diff --git a/docs/src/demos/Experiments/Figure/figure.ts b/docs/src/demos/Experiments/Figure/figure.ts index dd4bb729..828a9f3c 100644 --- a/docs/src/demos/Experiments/Figure/figure.ts +++ b/docs/src/demos/Experiments/Figure/figure.ts @@ -96,18 +96,17 @@ export const Figure = Node.create({ .insertContent({ type: this.name, attrs, - content: [ - { + content: caption + ? [{ type: 'text', text: caption, - }, - ], + }] + : [], + }) + // set cursor at end of caption field + .command(({ tr, commands }) => { + return commands.setTextSelection(tr.doc.resolve(tr.selection.to - 2).end()) }) - // try to set cursor within caption field - // but this fails when inserting at an empty document - // .command(({ tr, commands }) => { - // return commands.setTextSelection(tr.selection.$from.before() - 1) - // }) .run() }, } diff --git a/docs/src/docPages/experiments/figure.md b/docs/src/docPages/experiments/figure.md index 5d280eef..8f6576c2 100644 --- a/docs/src/docPages/experiments/figure.md +++ b/docs/src/docPages/experiments/figure.md @@ -3,7 +3,6 @@ ⚠️ Experiment ## Tasks -* Add the caption as an optional parameter to the command * Build commands to wrap an image into a figure + figcaption? * Build commands to unrwap figure + figcaption to an image?