diff --git a/external/@worldbrain/memex-common b/external/@worldbrain/memex-common index 9aea444629..2b311ac6b1 160000 --- a/external/@worldbrain/memex-common +++ b/external/@worldbrain/memex-common @@ -1 +1 @@ -Subproject commit 9aea444629b0c5b2c9ddfcb192e10a2c2926faa6 +Subproject commit 2b311ac6b112fe055ae36a2ffec93054ce0c8c1d diff --git a/package.json b/package.json index 5385f2245b..4f6b3398a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "worldbrain-extension", - "version": "3.20.6", + "version": "3.20.7", "homepage": "https://memex.garden", "repository": "https://github.com/WorldBrain/Memex", "scripts": { diff --git a/src/common-ui/components/prompt-templates/logic.ts b/src/common-ui/components/prompt-templates/logic.ts index cc3cc4c13a..ca28244a29 100644 --- a/src/common-ui/components/prompt-templates/logic.ts +++ b/src/common-ui/components/prompt-templates/logic.ts @@ -95,7 +95,7 @@ export default class PromptTemplatesLogic extends UILogic< const currentTemplates = previousState.promptTemplatesArray this.dependencies.onTemplateSelect( - marked.parse(currentTemplates[selectedTemplate].text), + marked.parse(currentTemplates[selectedTemplate]?.text), ) } setTemplateEdit: EventHandler<'setTemplateEdit'> = async ({ diff --git a/src/common-ui/components/result-item-spaces-segment.tsx b/src/common-ui/components/result-item-spaces-segment.tsx index 3d1efa11ac..7da71f5a80 100644 --- a/src/common-ui/components/result-item-spaces-segment.tsx +++ b/src/common-ui/components/result-item-spaces-segment.tsx @@ -92,10 +92,13 @@ export default function ListsSegment({ return ( { - e.stopPropagation() + onMouseDown={(event: React.MouseEvent) => { + event.stopPropagation() onListClick(space.id) }} + onMouseUp={(event: React.MouseEvent) => { + event.stopPropagation() + }} isLoading={space.name == null && space != null} title={ typeof space.name === 'string' @@ -189,7 +192,6 @@ const loading = keyframes` ` const ListSpaceContainer = styled.div<{ - onClick: React.MouseEventHandler isLoading: boolean spaceId: number }>` diff --git a/src/in-page-ui/ribbon/react/components/ribbon.tsx b/src/in-page-ui/ribbon/react/components/ribbon.tsx index ec2a88b1d2..e7eea7fccf 100644 --- a/src/in-page-ui/ribbon/react/components/ribbon.tsx +++ b/src/in-page-ui/ribbon/react/components/ribbon.tsx @@ -1986,31 +1986,14 @@ export default class Ribbon extends Component { {!this.props.sidebar.isSidebarOpen && ( { - if (!this.props.showRemoveMenu) { + if (event.shiftKey) { this.props.toggleRemoveMenu() - } - }} - onMouseUp={(event) => { - if (!this.props.showRemoveMenu) { + } else { this.props.handleRemoveRibbon() } }} > { - // if (this.props.showRemoveMenu) { - // this.props.handleRemoveRibbon() - // } else { - // this.props.toggleRemoveMenu() - // } - // }} - // onClick={(event) => { - // if (event.shiftKey && this.props.isRibbonEnabled) { - // this.props.handleHover() - // } else { - // this.props.handleRemoveRibbon() - // } - // }} color={'greyScale5'} heightAndWidth="24px" padding="4px" diff --git a/src/options/routes.js b/src/options/routes.js index 9d3849c806..78a1fc8ddd 100644 --- a/src/options/routes.js +++ b/src/options/routes.js @@ -41,6 +41,10 @@ export default [ component: Blocklist, icon: 'block', }, + { + name: null, + icon: null, + }, { name: 'My Account', pathname: '/account', diff --git a/src/sidebar/annotations-sidebar/containers/logic.ts b/src/sidebar/annotations-sidebar/containers/logic.ts index 802882b52c..9e5cd64cb6 100644 --- a/src/sidebar/annotations-sidebar/containers/logic.ts +++ b/src/sidebar/annotations-sidebar/containers/logic.ts @@ -119,6 +119,7 @@ import { UserReference } from '@worldbrain/memex-common/lib/web-interface/types/ import { convertLinksInAIResponse } from '@worldbrain/memex-common/lib/ai-chat/utils' import { DEFAULT_AI_MODEL } from '@worldbrain/memex-common/lib/ai-chat/constants' import { HighlightRendererInterface } from '@worldbrain/memex-common/lib/in-page-ui/highlighting/types' +import { PromptTemplate } from 'src/common-ui/components/prompt-templates/types' const md = new MarkdownIt() export type SidebarContainerOptions = SidebarContainerDependencies & { @@ -3576,14 +3577,24 @@ export class SidebarContainerLogic extends UILogic< let prompt = event.prompt if (event.prompt == null) { - const syncsettings = - (await this.syncSettings.openAI?.get('promptSuggestions')) ?? - AI_PROMPT_DEFAULTS.map((text) => ({ + let savedPrompts = await this.syncSettings.openAI?.get( + 'promptSuggestions', + ) + if (!savedPrompts) { + savedPrompts = AI_PROMPT_DEFAULTS.map((text) => ({ text, isEditing: null, isFocused: false, })) - prompt = marked.parse(syncsettings[0].text) + } else if (typeof savedPrompts[0] === 'string') { + savedPrompts = ((savedPrompts as unknown) as string[]).map( + (text) => ({ + text: text, + }), + ) + this.syncSettings.openAI?.set('promptSuggestions', savedPrompts) + } + prompt = marked.parse(savedPrompts[0].text) } if (event.textToProcess) { @@ -3609,21 +3620,6 @@ export class SidebarContainerLogic extends UILogic< } if (!event.textToProcess) { let executed = false - let prompt = event.prompt - - if (event.prompt == null) { - const syncsettings = - (await this.syncSettings.openAI?.get( - 'promptSuggestions', - )) ?? - AI_PROMPT_DEFAULTS.map((text) => ({ - text, - isEditing: null, - isFocused: false, - })) - prompt = marked.parse(syncsettings[0].text) - } - let retries = 0 const maxRetries = 100 while (!executed && retries < maxRetries) { @@ -3663,7 +3659,7 @@ export class SidebarContainerLogic extends UILogic< isEditing: null, isFocused: false, })) - prompt = syncsettings[0].text + prompt = syncsettings[0]?.text } if (previousState.activeTab === 'summary') {