mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-24 07:42:07 +03:00
Improved iframe embed interaction within editor
This commit is contained in:
26
resources/js/editor/node-views/IframeView.js
Normal file
26
resources/js/editor/node-views/IframeView.js
Normal file
@ -0,0 +1,26 @@
|
||||
class IframeView {
|
||||
/**
|
||||
* @param {PmNode} node
|
||||
* @param {PmView} view
|
||||
* @param {(function(): number)} getPos
|
||||
*/
|
||||
constructor(node, view, getPos) {
|
||||
this.dom = document.createElement('div');
|
||||
this.dom.classList.add('ProseMirror-iframewrap');
|
||||
|
||||
this.iframe = document.createElement("iframe");
|
||||
for (const [key, value] of Object.entries(node.attrs)) {
|
||||
if (value) {
|
||||
this.iframe.setAttribute(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
this.dom.appendChild(this.iframe);
|
||||
}
|
||||
|
||||
stopEvent() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default IframeView;
|
Reference in New Issue
Block a user