mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 10:24:39 +08:00
UX: keep content on rich editor footnote inputrule (#32296)
Instead of using the matched string, this PR uses the actual sliced content from the ProseMirror document range as the content when creating the footnote node.
This commit is contained in:
@ -235,10 +235,10 @@ const extension = {
|
||||
{
|
||||
match: /\^\[(.*?)]$/,
|
||||
handler: (state, match, start, end) => {
|
||||
const footnote = state.schema.nodes.footnote.create(
|
||||
null,
|
||||
state.schema.nodes.paragraph.create(null, state.schema.text(match[1]))
|
||||
);
|
||||
const content = state.doc.slice(start + 2, end).content;
|
||||
const paragraph = state.schema.nodes.paragraph.create(null, content);
|
||||
const footnote = state.schema.nodes.footnote.create(null, paragraph);
|
||||
|
||||
return state.tr.replaceWith(start, end, footnote);
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user