Skip to content

Commit cd5faaa

Browse files
authored
enable sending html from a plugin (#333)
1 parent 705e346 commit cd5faaa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

blocks/edit/da-library/da-library.js

+5
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ class DaLibrary extends LitElement {
236236
const para = window.view.state.schema.text(e.data.details);
237237
window.view.dispatch(window.view.state.tr.replaceSelectionWith(para));
238238
}
239+
if (e.data.action === 'sendHTML') {
240+
const dom = new DOMParser().parseFromString(e.data.details, 'text/html');
241+
const nodes = proseDOMParser.fromSchema(window.view.state.schema).parse(dom);
242+
window.view.dispatch(window.view.state.tr.replaceSelectionWith(nodes));
243+
}
239244
if (e.data.action === 'closeLibrary') {
240245
closeLibrary();
241246
}

0 commit comments

Comments
 (0)