From 3337b6fd9099d30837ccecd3ee1350033d8de63c Mon Sep 17 00:00:00 2001 From: robertu <4065233+robertu7@users.noreply.github.com> Date: Tue, 2 May 2023 15:59:06 +0700 Subject: [PATCH] feat: skip to set cursot to the end of caption on insert embeds --- package.json | 2 +- src/editors/extensions/figureAudio.ts | 10 +++++----- src/editors/extensions/figureEmbed.ts | 10 +++++----- src/editors/extensions/figureImage.ts | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 64e70512..6707f009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@matters/matters-editor", - "version": "0.2.0-alpha.31", + "version": "0.2.0-alpha.32", "description": "Editor for matters.news", "author": "https://github.com/thematters", "homepage": "https://github.com/thematters/matters-editor", diff --git a/src/editors/extensions/figureAudio.ts b/src/editors/extensions/figureAudio.ts index 77fc348b..369efc5f 100644 --- a/src/editors/extensions/figureAudio.ts +++ b/src/editors/extensions/figureAudio.ts @@ -127,12 +127,12 @@ export const FigureAudio = Node.create({ content: caption ? [{ type: 'text', text: caption }] : [], }) // set cursor at end of caption field - .command(({ tr, commands }) => { - const { doc, selection } = tr - const position = doc.resolve(selection.to - 2).end() + // .command(({ tr, commands }) => { + // const { doc, selection } = tr + // const position = doc.resolve(selection.to - 2).end() - return commands.setTextSelection(position) - }) + // return commands.setTextSelection(position) + // }) .run() ) }, diff --git a/src/editors/extensions/figureEmbed.ts b/src/editors/extensions/figureEmbed.ts index 3c221824..694ccb32 100644 --- a/src/editors/extensions/figureEmbed.ts +++ b/src/editors/extensions/figureEmbed.ts @@ -311,12 +311,12 @@ export const FigureEmbed = Node.create({ content: caption ? [{ type: 'text', text: caption }] : [], }) // set cursor at end of caption field - .command(({ tr, commands }) => { - const { doc, selection } = tr - const position = doc.resolve(selection.to - 2).end() + // .command(({ tr, commands }) => { + // const { doc, selection } = tr + // const position = doc.resolve(selection.to - 2).end() - return commands.setTextSelection(position) - }) + // return commands.setTextSelection(position) + // }) .run() ) }, diff --git a/src/editors/extensions/figureImage.ts b/src/editors/extensions/figureImage.ts index daebbeb7..d34af513 100644 --- a/src/editors/extensions/figureImage.ts +++ b/src/editors/extensions/figureImage.ts @@ -81,12 +81,12 @@ export const FigureImage = Node.create({ content: caption ? [{ type: 'text', text: caption }] : [], }) // set cursor at end of caption field - .command(({ tr, commands }) => { - const { doc, selection } = tr - const position = doc.resolve(selection.to - 2).end() + // .command(({ tr, commands }) => { + // const { doc, selection } = tr + // const position = doc.resolve(selection.to - 2).end() - return commands.setTextSelection(position) - }) + // return commands.setTextSelection(position) + // }) .run() ) },