diff --git a/packages/text-editor/lang/en.json b/packages/text-editor/lang/en.json index 881fccca8f..2e210b9981 100644 --- a/packages/text-editor/lang/en.json +++ b/packages/text-editor/lang/en.json @@ -50,6 +50,7 @@ "Height": "Height", "Unset": "Unset", "Image": "Image", - "SeparatorLine": "Separator line" + "SeparatorLine": "Separator line", + "TodoList": "Todo list" } } diff --git a/packages/text-editor/src/components/CollaborativeTextEditor.svelte b/packages/text-editor/src/components/CollaborativeTextEditor.svelte index 6752aa9e3c..77e4b7bca6 100644 --- a/packages/text-editor/src/components/CollaborativeTextEditor.svelte +++ b/packages/text-editor/src/components/CollaborativeTextEditor.svelte @@ -308,7 +308,8 @@ ...(canEmbedImages ? [{ id: 'image', label: textEditorPlugin.string.Image, icon: view.icon.Image }] : []), { id: 'table', label: textEditorPlugin.string.Table, icon: view.icon.Table2 }, { id: 'code-block', label: textEditorPlugin.string.CodeBlock, icon: view.icon.CodeBlock }, - { id: 'separator-line', label: textEditorPlugin.string.SeparatorLine, icon: view.icon.SeparatorLine } + { id: 'separator-line', label: textEditorPlugin.string.SeparatorLine, icon: view.icon.SeparatorLine }, + { id: 'todo-list', label: textEditorPlugin.string.TodoList, icon: view.icon.TodoList } ], handleSelect: handleLeftMenuClick }) @@ -402,6 +403,9 @@ ) editor.commands.focus(pos, { scrollIntoView: false }) break + case 'todo-list': + editor.commands.toggleTaskList() + break case 'separator-line': editor.commands.setHorizontalRule() break diff --git a/packages/text-editor/src/components/extensions.ts b/packages/text-editor/src/components/extensions.ts index de25fac748..675b4029eb 100644 --- a/packages/text-editor/src/components/extensions.ts +++ b/packages/text-editor/src/components/extensions.ts @@ -129,7 +129,7 @@ export const completionConfig: Partial = { } } -const inlineCommandsIds = ['image', 'table', 'code-block', 'separator-line'] as const +const inlineCommandsIds = ['image', 'table', 'code-block', 'separator-line', 'todo-list'] as const export type InlineCommandId = (typeof inlineCommandsIds)[number] /** @@ -146,7 +146,8 @@ export function inlineCommandsConfig ( { id: 'image', label: plugin.string.Image, icon: view.icon.Image }, { id: 'table', label: plugin.string.Table, icon: view.icon.Table2 }, { id: 'code-block', label: plugin.string.CodeBlock, icon: view.icon.CodeBlock }, - { id: 'separator-line', label: plugin.string.SeparatorLine, icon: view.icon.SeparatorLine } + { id: 'separator-line', label: plugin.string.SeparatorLine, icon: view.icon.SeparatorLine }, + { id: 'todo-list', label: plugin.string.TodoList, icon: view.icon.TodoList } ].filter(({ id }) => !excludedCommands.includes(id as InlineCommandId)) }, command: ({ editor, range, props }: { editor: Editor, range: Range, props: any }) => { diff --git a/packages/text-editor/src/plugin.ts b/packages/text-editor/src/plugin.ts index 2d26972e4e..14607be571 100644 --- a/packages/text-editor/src/plugin.ts +++ b/packages/text-editor/src/plugin.ts @@ -81,6 +81,7 @@ export default plugin(textEditorId, { Height: '' as IntlString, Unset: '' as IntlString, Image: '' as IntlString, - SeparatorLine: '' as IntlString + SeparatorLine: '' as IntlString, + TodoList: '' as IntlString } }) diff --git a/plugins/view-assets/assets/icons.svg b/plugins/view-assets/assets/icons.svg index 37e8ffedfc..45423d3601 100644 --- a/plugins/view-assets/assets/icons.svg +++ b/plugins/view-assets/assets/icons.svg @@ -1,162 +1,186 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/view-assets/src/index.ts b/plugins/view-assets/src/index.ts index de6c0f503f..0ec032d9a2 100644 --- a/plugins/view-assets/src/index.ts +++ b/plugins/view-assets/src/index.ts @@ -51,6 +51,7 @@ loadMetadata(view.icon, { Table2: `${icons}#table2`, CodeBlock: `${icons}#code-block`, SeparatorLine: `${icons}#separator-line`, + TodoList: `${icons}#todo-list`, Circle: `${icons}#circle`, Join: `${icons}#join`, Leave: `${icons}#leave`, diff --git a/plugins/view/src/index.ts b/plugins/view/src/index.ts index 2823cc5f47..31d7e0c478 100644 --- a/plugins/view/src/index.ts +++ b/plugins/view/src/index.ts @@ -248,7 +248,8 @@ const view = plugin(viewId, { Circle: '' as Asset, Join: '' as Asset, Leave: '' as Asset, - Copy: '' as Asset + Copy: '' as Asset, + TodoList: '' as Asset }, category: { General: '' as Ref,