1(async() => { 2 while(!window.hasOwnProperty('Prosemirror')) 3 await new Promise(resolve => setTimeout(resolve, 1000)); 4 5 window.Prosemirror.pluginSchemas.push((nodes, marks) => { 6 nodes = nodes.addToEnd('diagrams', { 7 inline: true, 8 attrs: { 9 src: {}, 10 id: {}, 11 title: {default: null}, 12 width: {default: null}, 13 height: {default: null}, 14 align: {default: ''} 15 }, 16 group: "inline", 17 draggable: true, 18 toDOM: function toDOM(node) { 19 const ref = node.attrs; 20 const src = ref.src; 21 const id = ref.id; 22 const width = ref.width; 23 const height = ref.height; 24 const title = ref.title; 25 let alignclass = ref.align; 26 27 if (alignclass.length != 0) { 28 alignclass = ` media${alignclass}`; 29 } 30 31 return [ 32 'object', 33 { 34 type: 'image/svg+xml', 35 class: 'media diagrams-svg' + alignclass, 36 title: title, 37 data: src, 38 'data-id': id, 39 width: width, 40 height: height, 41 } 42 ] 43 } 44 }); 45 return {nodes, marks}; 46 }); 47 48})(); 49