Skip to content

Commit

Permalink
feat: skip to set cursot to the end of caption on insert embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
robertu7 committed May 2, 2023
1 parent 697180c commit 3337b6f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 5 additions & 5 deletions src/editors/extensions/figureAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
},
Expand Down
10 changes: 5 additions & 5 deletions src/editors/extensions/figureEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
},
Expand Down
10 changes: 5 additions & 5 deletions src/editors/extensions/figureImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
},
Expand Down

0 comments on commit 3337b6f

Please sign in to comment.