Fixed editor error when using blockquote text expansion in product/toggle card content

no issue

- `<KoenigBasicHtmlTextarea>` has no UI or keyboard shortcut support for blockquotes but the markdown text expansion for quotes was left in despite the code required for it not existing, this meant any time `> text` was typed the editor would throw errors due to missing actions
This commit is contained in:
Kevin Ansfield 2022-05-27 15:21:43 +01:00
parent 191c7e312b
commit 3f9c019bc0

View File

@ -513,29 +513,6 @@ export function registerBasicTextareaTextExpansions(mobiledocEditor, koenig) {
}
});
mobiledocEditor.onTextInput({
name: 'md_blockquote',
match: /^> /,
run(editor, matches) {
let {range} = editor;
let {head, head: {section}} = range;
let text = section.textUntil(head);
// ensure cursor is at the end of the matched text so we don't
// convert text the users wants to start with `> ` and that we're
// not already on a blockquote section
if (text === matches[0] && section.tagName !== 'blockquote') {
editor.run((postEditor) => {
range = range.extend(-(matches[0].length));
let position = postEditor.deleteRange(range);
postEditor.setRange(position);
koenig.send('toggleSection', 'blockquote', postEditor);
});
}
}
});
// must come after block expansions so that the smart hyphens expansion
// doesn't break the divider card expansion
registerDashTextExpansions(mobiledocEditor);