Revert "fix: Updates logic to insert canned response into editor (#5880)"
This reverts commit c94ba16565
.
This commit is contained in:
parent
85b52a1d3f
commit
2d5d7866f8
1 changed files with 13 additions and 19 deletions
|
@ -233,9 +233,7 @@ export default {
|
|||
node
|
||||
);
|
||||
this.state = this.editorView.state.apply(tr);
|
||||
this.emitOnChange();
|
||||
|
||||
return false;
|
||||
return this.emitOnChange();
|
||||
},
|
||||
|
||||
insertCannedResponse(cannedItem) {
|
||||
|
@ -243,26 +241,22 @@ export default {
|
|||
return null;
|
||||
}
|
||||
|
||||
let from = this.range.from - 1;
|
||||
let node = addMentionsToMarkdownParser(defaultMarkdownParser).parse(
|
||||
cannedItem
|
||||
const tr = this.editorView.state.tr.insertText(
|
||||
cannedItem,
|
||||
this.range.from,
|
||||
this.range.to
|
||||
);
|
||||
|
||||
if (node.childCount === 1) {
|
||||
node = this.editorView.state.schema.text(cannedItem);
|
||||
from = this.range.from;
|
||||
}
|
||||
|
||||
const tr = this.editorView.state.tr.replaceWith(
|
||||
from,
|
||||
this.range.to,
|
||||
node
|
||||
);
|
||||
|
||||
this.state = this.editorView.state.apply(tr);
|
||||
this.emitOnChange();
|
||||
|
||||
tr.scrollIntoView();
|
||||
// Hacky fix for #5501
|
||||
this.state = createState(
|
||||
this.contentFromEditor,
|
||||
this.placeholder,
|
||||
this.plugins
|
||||
);
|
||||
this.editorView.updateState(this.state);
|
||||
this.focusEditorInputField();
|
||||
return false;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue