From b0908ec2512b9affb5f7b7feb71859a1bc74e3fb Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Thu, 30 Dec 2021 15:10:13 +0600 Subject: [PATCH] Markdown issues (#747) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- .../src/components/message/Nodes.svelte | 8 ++++++++ .../text-editor/src/components/TextEditor.svelte | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/presentation/src/components/message/Nodes.svelte b/packages/presentation/src/components/message/Nodes.svelte index b9372b63bd..e052600fdf 100644 --- a/packages/presentation/src/components/message/Nodes.svelte +++ b/packages/presentation/src/components/message/Nodes.svelte @@ -35,6 +35,8 @@
{:else if node.nodeName === 'CODE'} + {:else if node.nodeName === 'PRE'} +
{:else if node.nodeName === 'BR'}
{:else if node.nodeName === 'HR'} @@ -45,6 +47,12 @@

{:else if node.nodeName === 'H3'}

+ {:else if node.nodeName === 'H4'} +

+ {:else if node.nodeName === 'H5'} +
+ {:else if node.nodeName === 'H6'} +
{:else if node.nodeName === 'UL'} {:else if node.nodeName === 'OL'} diff --git a/packages/text-editor/src/components/TextEditor.svelte b/packages/text-editor/src/components/TextEditor.svelte index 9ef5e7458c..5bfb37db1b 100644 --- a/packages/text-editor/src/components/TextEditor.svelte +++ b/packages/text-editor/src/components/TextEditor.svelte @@ -51,9 +51,21 @@ export function clear (): void { editor.commands.clearContent(false) } -const HandleEnter = Extension.create({ +const Handle = Extension.create({ addKeyboardShortcuts() { return { + 'Shift-Enter': () => { + const res = this.editor.commands.splitListItem('listItem') + if (!res) { + this.editor.commands.first(({ commands }) => [ + () => commands.newlineInCode(), + () => commands.createParagraphNear(), + () => commands.liftEmptyBlock(), + () => commands.splitBlock(), + ]) + } + return true + }, 'Enter': () => { submit() return true @@ -67,10 +79,10 @@ onMount(() => { element, content: content, extensions: [ - HandleEnter, StarterKit, Highlight, Link, + Handle, // order important // Typography, // we need to disable 1/2 -> ½ rule (https://github.com/hcengineering/anticrm/issues/345) Placeholder.configure({placeholder: placeholder}), Mention.configure({