We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98d09ee commit 61ddeb9Copy full SHA for 61ddeb9
script.js
@@ -78,11 +78,17 @@
78
/**
79
* Inserts the given ID into the current editor
80
*
81
- * @todo add suppprt for other editors like Prosemirror or CKEditor
+ * @todo add support for other editors like CKEditor
82
* @param {string} id The newly uploaded file ID
83
*/
84
function insertSyntax(id) {
85
- insertAtCarret('wiki__text', '{{:' + id + '}}');
+ if (proseMirrorIsActive) {
86
+ const pm = window.Prosemirror.view;
87
+ const imageNode = pm.state.schema.nodes.image.create({id: id});
88
+ pm.dispatch(pm.state.tr.replaceSelectionWith(imageNode));
89
+ } else {
90
+ insertAtCarret('wiki__text', '{{:' + id + '}}');
91
+ }
92
}
93
94
// main
0 commit comments