From ecc08c5795a85c5843381812ba2b657d76bf2ba6 Mon Sep 17 00:00:00 2001 From: Oliver Sauter Date: Mon, 26 Feb 2024 22:18:31 +0100 Subject: [PATCH] fixes for smart notes, default annotation color and some small style stuff --- external/@worldbrain/memex-common | 2 +- src/annotations/components/AnnotationEdit.tsx | 8 +++++--- src/content-scripts/content_script/global.ts | 10 ++++++++++ src/dashboard-refactor/index.tsx | 1 + src/overview/help-btn/components/help-btn.tsx | 2 +- src/sidebar/annotations-sidebar/containers/logic.ts | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/external/@worldbrain/memex-common b/external/@worldbrain/memex-common index cbd02557b9..32403bc9fe 160000 --- a/external/@worldbrain/memex-common +++ b/external/@worldbrain/memex-common @@ -1 +1 @@ -Subproject commit cbd02557b958d93194b4a6db2f06e767b8ae4d58 +Subproject commit 32403bc9fee1dace7b39c01ad1ee2a288fbe6d64 diff --git a/src/annotations/components/AnnotationEdit.tsx b/src/annotations/components/AnnotationEdit.tsx index 8c34f92d25..f89d742ba7 100644 --- a/src/annotations/components/AnnotationEdit.tsx +++ b/src/annotations/components/AnnotationEdit.tsx @@ -68,23 +68,25 @@ class AnnotationEdit extends React.Component { async componentDidMount() { await this.youtubeKeyboardShortcut() - this.editorRef?.setEditable(this.props?.isEditMode ?? false) + this.editorRef?.setEditable(this.props?.isEditMode) if (!this.editorRef?.checkIfHasContent() && !this.props.isEditMode) { this.setState({ shouldShowEditor: false }) + } else if (this.props.isEditMode) { + this.setState({ shouldShowEditor: true }) } } componentDidUpdate(prevProps: Props) { if (prevProps.isEditMode !== this.props.isEditMode) { - this.editorRef?.setEditable(this.props?.isEditMode ?? false) + this.editorRef?.setEditable(this.props?.isEditMode) if ( !this.editorRef?.checkIfHasContent() && !this.props.isEditMode ) { this.setState({ shouldShowEditor: false }) - } else { + } else if (this.props.isEditMode) { this.setState({ shouldShowEditor: true }) } } diff --git a/src/content-scripts/content_script/global.ts b/src/content-scripts/content_script/global.ts index 4b1ebc2496..c15423b926 100644 --- a/src/content-scripts/content_script/global.ts +++ b/src/content-scripts/content_script/global.ts @@ -671,11 +671,16 @@ export async function main( shouldCopyShareLink: boolean, showSpacePicker?: boolean, commentText?: string, + highlightColorSetting?: HighlightColor, ) => { if (!(await pageActionAllowed(analyticsBG))) { return } + const highlightColorSettingStorage = await getHighlightColorSettings() + const highlightColor = + highlightColorSetting ?? highlightColorSettingStorage[0] + let screenshotGrabResult if ( isPdfViewerRunning && @@ -704,6 +709,7 @@ export async function main( screenshotGrabResult.anchor, screenshotGrabResult.screenshot, imageSupportBG, + highlightColor, ) const annotationId = result.annotationId @@ -729,6 +735,10 @@ export async function main( const result = await saveHighlight( shouldShare, shouldCopyShareLink, + null, + null, + imageSupportBG, + highlightColor, ) const annotationId = result.annotationId diff --git a/src/dashboard-refactor/index.tsx b/src/dashboard-refactor/index.tsx index 39b170f25c..c8413d235d 100644 --- a/src/dashboard-refactor/index.tsx +++ b/src/dashboard-refactor/index.tsx @@ -2003,6 +2003,7 @@ const Container = styled.div<{ fullSizeInPage: boolean }>` display: flex; + position: relative; flex-direction: column; width: fill-available; background-color: ${(props) => diff --git a/src/overview/help-btn/components/help-btn.tsx b/src/overview/help-btn/components/help-btn.tsx index c8d9d73858..3edb5ea782 100644 --- a/src/overview/help-btn/components/help-btn.tsx +++ b/src/overview/help-btn/components/help-btn.tsx @@ -247,7 +247,7 @@ const HelpIconPosition = styled.div` justify-content: space-between; height: fit-content; width: fit-content; - position: fixed; + position: absolute; bottom: 10px; right: 10px; z-index: 100; diff --git a/src/sidebar/annotations-sidebar/containers/logic.ts b/src/sidebar/annotations-sidebar/containers/logic.ts index 98c27a0ac4..c3c2347bc0 100644 --- a/src/sidebar/annotations-sidebar/containers/logic.ts +++ b/src/sidebar/annotations-sidebar/containers/logic.ts @@ -4655,7 +4655,7 @@ export class SidebarContainerLogic extends UILogic< let prompt = event.prompt ?? 'Summarise this concisely and briefly' await this.queryAI( - undefined, + this.fullPageUrl, combinedText, prompt, previousState,