From f4e81c77b45d8bde233c15afd21a809646b569cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4f?= Date: Thu, 7 Nov 2024 20:16:38 +0100 Subject: [PATCH] wip --- src/app/models/AppFeatures.ts | 5 + src/app/models/FeatureIdent.ts | 3 +- src/components/SidePanelFooter.vue | 67 ++++++++++--- src/pages/SidePanelCollectionsPage.vue | 99 ++++++++++++++----- src/pages/SidePanelPage2.vue | 25 ----- .../sidepanel/SidePanelPageContextMenu.vue | 12 +-- .../sidepanel/helper/FirstToolbarHelper2.vue | 67 ++++++------- .../SidePanelCollectionsPageToolbar.vue | 20 ++-- src/spaces | 2 +- src/tabsets | 2 +- 10 files changed, 185 insertions(+), 117 deletions(-) diff --git a/src/app/models/AppFeatures.ts b/src/app/models/AppFeatures.ts index d9eb0de6..3ca3dfa1 100644 --- a/src/app/models/AppFeatures.ts +++ b/src/app/models/AppFeatures.ts @@ -181,6 +181,11 @@ export class AppFeatures { 'Analyse tab contents and use the distraction-free Reading Mode if applicable', 'library_books', '', ['bex']), + new Feature(FeatureIdent.HTML_SNIPPETS, FeatureType.EXPERIMENTAL, + 'HTML Snippets', + 'Drag and drop Text and Images to the sidebar to create Website Snippets', + 'text_snippet', '', ['bex']), + ] getFeature(f: FeatureIdent): Feature | undefined { diff --git a/src/app/models/FeatureIdent.ts b/src/app/models/FeatureIdent.ts index 95623502..25d00240 100644 --- a/src/app/models/FeatureIdent.ts +++ b/src/app/models/FeatureIdent.ts @@ -32,7 +32,8 @@ export enum FeatureIdent { RESEARCH_SESSIONS="RESEARCH_SESSIONS", DYNAMIC_TABSET="DYNAMIC_TABSET", GALLERY="GALLERY", - READING_MODE="READING_MODE" + READING_MODE="READING_MODE", + HTML_SNIPPETS="HTML_SNIPPETS" } export enum FeatureType { diff --git a/src/components/SidePanelFooter.vue b/src/components/SidePanelFooter.vue index 9067f13d..6892ab0f 100644 --- a/src/components/SidePanelFooter.vue +++ b/src/components/SidePanelFooter.vue @@ -71,7 +71,15 @@  
- + + + Drag and drop text or images from your current tab + Tabsets as full-page app - - - - - - - - - - + + + + + + + + + + (uid()) const progressValue = ref(0.0) @@ -242,7 +256,7 @@ watchEffect(() => { showSuggestionButton.value = doShowSuggestionButton.value || (useUiStore().sidePanelActiveViewIs(SidePanelViews.MAIN) && - _.findIndex(suggestions, (s:Suggestion) => { + _.findIndex(suggestions, (s: Suggestion) => { return s.state === SuggestionState.NEW || (s.state === SuggestionState.NOTIFICATION && !useFeaturesStore().hasFeature(FeatureIdent.NOTIFICATIONS)) }) >= 0) @@ -250,7 +264,7 @@ watchEffect(() => { showSuggestionIcon.value = !doShowSuggestionButton.value && useUiStore().sidePanelActiveViewIs(SidePanelViews.MAIN) && - _.findIndex(suggestions, (s:Suggestion) => { + _.findIndex(suggestions, (s: Suggestion) => { return s.state === SuggestionState.DECISION_DELAYED }) >= 0 }) @@ -481,6 +495,31 @@ const additionalActionWasClicked = (event: any) => { const offsetBottom = () => ($q.platform.is.capacitor || $q.platform.is.cordova) ? 'margin-bottom:20px;' : '' const openPwaUrl = () => NavigationService.openOrCreateTab([process.env.TABSETS_PWA_URL || 'https://www.skysail.io']) const showSettingsButton = () => route?.path !== '/sidepanel/welcome' || useAuthStore().isAuthenticated + +const drop = (evt: any) => { + evt.preventDefault() + var text = evt.dataTransfer.getData('text') + var html = evt.dataTransfer.getData('text/html') + const currentTabUrl = useContentStore().currentTabUrl + console.log("===>", evt, text, html, currentTabUrl) + if (currentTabUrl) { + const existing: Tab | undefined = useTabsetsStore().tabForUrlInSelectedTabset(currentTabUrl!) + if (existing) { + existing.snippets.push(new TabSnippet(text, html)) + existing.title = "Snippet ("+existing.snippets.length+")" + const currentTabset = useTabsetsStore().getCurrentTabset + if (currentTabset) { + useTabsetsStore().saveTabset(currentTabset) + } + } else { + const tab = new Tab(uid(), BrowserApi.createChromeTabObject("Snippet", currentTabUrl!)) + tab.snippets.push(new TabSnippet(text, html)) + tab.description = text + useCommandExecutor().executeFromUi(new AddTabToTabsetCommand(tab)) + } + } +} +