@progress/kendo-editor-common 1.6.1-dev.202112201300 → 1.7.0-dev.202201041037

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cdn/main.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("prosemirror-state"),require("tslib"),require("prosemirror-model"),require("prosemirror-transform"),require("prosemirror-view"),require("prosemirror-commands"),require("prosemirror-schema-list"),require("prosemirror-tables"),require("prosemirror-history"),require("prosemirror-inputrules"),require("prosemirror-dropcursor"),require("prosemirror-gapcursor"),require("prosemirror-keymap")):"function"==typeof define&&define.amd?define(["prosemirror-state","tslib","prosemirror-model","prosemirror-transform","prosemirror-view","prosemirror-commands","prosemirror-schema-list","prosemirror-tables","prosemirror-history","prosemirror-inputrules","prosemirror-dropcursor","prosemirror-gapcursor","prosemirror-keymap"],t):"object"==typeof exports?exports.KendoEditorCommon=t(require("prosemirror-state"),require("tslib"),require("prosemirror-model"),require("prosemirror-transform"),require("prosemirror-view"),require("prosemirror-commands"),require("prosemirror-schema-list"),require("prosemirror-tables"),require("prosemirror-history"),require("prosemirror-inputrules"),require("prosemirror-dropcursor"),require("prosemirror-gapcursor"),require("prosemirror-keymap")):e.KendoEditorCommon=t(e["prosemirror-state"],e.tslib,e["prosemirror-model"],e["prosemirror-transform"],e["prosemirror-view"],e["prosemirror-commands"],e["prosemirror-schema-list"],e["prosemirror-tables"],e["prosemirror-history"],e["prosemirror-inputrules"],e["prosemirror-dropcursor"],e["prosemirror-gapcursor"],e["prosemirror-keymap"])}(window,(function(e,t,r,n,o,i,a,s,l,u,c,d,f){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=21)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(0),i=r(11);t.changeStylesString=function(e,t){var r=t.style,n=t.value,o=t.newValue;if(!e)return{changed:!1,style:null};var i=e.split(/\s*;\s*/).filter((function(e){return Boolean(e)})),a=i.filter((function(e){var t=e.split(/\s*:\s*/);return!(t[0].toLowerCase()===r&&n.test(t[1]))}));return o&&a.push(r+": "+o),{style:a.join("; ")+(a.length?";":""),changed:Boolean(o)||a.length!==i.length}},t.canInsert=function(e,t){for(var r=e.selection.$from,n=r.depth;n>=0;n--){var o=r.index(n);if(r.node(n).canReplaceWith(o,o,t))return!0}return!1};var a=function(e){return e instanceof n.Node?e.type.name:e.name};t.findNthParentNodeOfType=function(e,t){return void 0===t&&(t=1),function(r){return function(e,t){return void 0===t&&(t=1),function(r){for(var n=r.$from,o=n.depth;o>0;o--){var i=n.node(o);if(e(i)&&0===(t-=1))return{depth:o,node:i}}}}((function(t){return a(t)===a(e)}),t)(r)}},t.insertNode=function(e,t){return function(r,n){var o=r.tr.replaceSelectionWith(e);t&&o.scrollIntoView(),n(o)}},t.hasSameMarkup=function(e,t,r,o){var a=n.Fragment.from(i.parseContent(e,r,o)),s=n.Fragment.from(i.parseContent(t,r,o));return a.eq(s)},t.getSelectionText=function(e){var t=e.selection;if(t instanceof o.TextSelection||t instanceof o.AllSelection){var r=t.content().content;return r.textBetween(0,r.size)}return""},t.getNodeFromSelection=function(e){if(e.selection instanceof o.NodeSelection)return e.selection.node},t.selectedLineTextOnly=function(e){var r="",n=!1,o=e.selection,i=e.doc,a=o.$from,s=o.$to,l=o.from,u=o.to;return a.sameParent(s)&&(i.nodesBetween(l,u,(function(e){n=n||e.isLeaf&&!e.isText})),n||(r=t.getSelectionText(e))),r},t.indentHtml=function(e){return e.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},t.shallowEqual=function(e,t){var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return e[r]===t[r]}))};var s={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};t.expandSelection=function(e,t,r){if(!r.applyToWord||!e.selection.empty)return{state:e,dispatch:t};var n=!0===r.applyToWord?s:r.applyToWord,i=null,a=e.tr,l=e.selection,u=l.$head.nodeBefore,c=l.$head.nodeAfter;if(u&&"text"===u.type.name&&u.text&&c&&"text"===c.type.name&&c.text){var d=[];l.$head.parent.descendants((function(e,t){return d.push({node:e,pos:t}),!1}));for(var f=l.$head.parentOffset,p=d.findIndex((function(e){var t=e.node,r=e.pos;return r<=f&&r+t.nodeSize>=f})),m=d[p].node.text,g=!1,v=p-1;v>=0;v--){var h=d[v];!g&&h&&"text"===h.node.type.name?m=h.node.text+m:(g=!0,f-=h.node.nodeSize)}for(v=p+1;v<d.length;v++){if(!(h=d[v])||"text"!==h.node.type.name)break;m+=h.node.text}var y=m.substring(0,f),k=m.substring(f),b=n.before.exec(y),x=n.after.exec(k);if(b&&x){var M=b[0].length,_=x[0].length,S=i=l.from;a.setSelection(o.TextSelection.create(e.doc,S-M,S+_));return{state:{tr:a,selection:a.selection,doc:a.doc,storedMarks:null,schema:a.doc.type.schema},dispatch:function(e){e.setSelection(o.TextSelection.create(e.doc,i)),t(e)}}}}return{state:e,dispatch:t}},t.expandToWordWrap=function(e,r){return function(n,o,i){var a=t.expandSelection(n,o,r),s=a.state,l=a.dispatch;return e(r)(s,l)}}},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r(3);t.markApplies=function(e,t,r){for(var n=function(n){var o=t[n],i=o.$from,a=o.$to,s=0===i.depth&&e.type.allowsMarkType(r);if(e.nodesBetween(i.pos,a.pos,(function(e){if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(r)})),s)return{v:!0}},o=0;o<t.length;o++){var i=n(o);if(i)return i.v}return!1},t.toggleMark=function(e,r,n){return function(o,i){var a=o.selection,s=a.empty,l=a.$cursor,u=a.ranges;if(s&&!l||!t.markApplies(o.doc,u,e))return!1;if(i)if(l)e.isInSet(o.storedMarks||l.marks())?i(n.removeStoredMark(e)):i(n.addStoredMark(e.create(r)));else{for(var c=!1,d=0;!c&&d<u.length;d++){var f=u[d],p=f.$from,m=f.$to;c=o.doc.rangeHasMark(p.pos,m.pos,e)}for(d=0;d<u.length;d++){var g=u[d];p=g.$from,m=g.$to;c?n.removeMark(p.pos,m.pos,e):n.addMark(p.pos,m.pos,e.create(r))}i(n.scrollIntoView())}return!0}},t.removeMark=function(e,t,r,i){void 0===i&&(i=null);var a=[],s=0;return e.doc.nodesBetween(t,r,(function(e,n){if(e.isInline){s++;var l=null;if(i instanceof o.MarkType){var u=i.isInSet(e.marks);u&&(l=[u])}else i?i.isInSet(e.marks)&&(l=[i]):l=e.marks;if(l&&l.length)for(var c=Math.min(n+e.nodeSize,r),d=0;d<l.length;d++){for(var f=l[d],p=void 0,m=0;m<a.length;m++){var g=a[m];g.step===s-1&&f.eq(g.style)&&(p=g)}p?(p.to=c,p.step=s):a.push({style:f,from:Math.max(n,t),to:c,step:s})}}})),a.forEach((function(t){return e.step(new n.RemoveMarkStep(t.from,t.to,t.style))})),e},t.removeMarks=function(e,r,n,o){var i=r.selection,a=i.$cursor,s=i.ranges;if(o=o||r.tr,a)e.forEach((function(e){e.isInSet(r.storedMarks||a.marks())&&n(o.removeStoredMark(e))}));else{for(var l=function(r){var n=s[r],i=n.$from,a=n.$to;e.forEach((function(e){t.removeMark(o,i.pos,a.pos,e)}))},u=0;u<s.length;u++)l(u);n(o.scrollIntoView())}return!0};t.removeAllMarks=function(e){var r=(void 0===e?{}:e).except,n=void 0===r?[]:r;return function(e,r){var o,i=e.tr;t.cleanMarks(i,{except:(o=n,o instanceof Array?o:[o])}),i.docChanged&&r(i)}},t.cleanMarks=function(e,t){var r=t.except,n=e.doc,o=e.selection,i=n.type.schema,a=o.empty,s=o.ranges,l=(r||[]).map((function(e){return e.name}));if(!a){var u=Object.keys(i.marks).map((function(e){return i.marks[e]})).filter((function(e){return-1===l.indexOf(e.name)}));s.forEach((function(t){var r=t.$from,n=t.$to;u.forEach((function(t){return e.removeMark(r.pos,n.pos,t)}))}))}},t.hasMark=function(e,r){var n,o=e.schema.marks,i=(r.altMarks||[]).filter((function(e){return o[e]})),a=r.altStyle,s=e.selection,l=s.from,u=s.$from,c=s.to,d=s.empty,f=o[r.mark],p=e.doc,m=!1;return d?(n=e.storedMarks||u.marks(),m=f&&f.isInSet(n)||i.some((function(e){return o[e].isInSet(n)}))):m=f&&p.rangeHasMark(l,c,f)||i.some((function(e){return p.rangeHasMark(l,c,o[e])})),!m&&a&&o.style?t.selectionMarks(e,o.style).some((function(e){return null!==t.styleValue(e,a)})):Boolean(m)},t.styleValue=function(e,t){for(var r=(e&&e.attrs.style||"").split(/\s*;\s*/).filter((function(e){return Boolean(e)})),n=0;n<r.length;n++){var o=r[n].split(/\s*:\s*/);if(o[0].toLowerCase()===t.name&&t.value.test(o[1]))return o[1]}return null},t.selectionMarks=function(e,t){var r=e.selection,n=r.from,o=r.$from,i=r.to,a=r.empty,s=[];return a?s.push(t.isInSet(e.storedMarks||o.marks())):e.doc.nodesBetween(n,i,(function(e){e.isInline&&s.push(t.isInSet(e.marks))})),s},t.getMark=function(e,r){var n=t.selectionMarks(e,r),o=n.filter((function(e){return Boolean(e)}));return n.length===o.length?n[0]:void 0},t.getActiveMarks=function(e,r){var n=t.selectionMarks(e,r),o=n.filter((function(e){return Boolean(e)}));return{hasNodesWithoutMarks:n.length!==o.length,marks:o}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(2),i=r(4),a=r(3),s=r(0);t.changeTextBlock=function(e,t,r,n){if(!r.isTextblock)return!1;e.selection.ranges.forEach((function(o){var s=e.steps.length,l=o.$from.pos,u=o.$to.pos;e.doc.nodesBetween(l,u,(function(o,l){if(o.eq(t)&&o.isTextblock&&!o.hasMarkup(r,n)&&function(e,t,r){var n=e.resolve(t),o=n.index();return n.parent.canReplaceWith(o,o+1,r)}(e.doc,e.mapping.slice(s).map(l),r)){e.clearIncompatible(e.mapping.slice(s).map(l,1),r);var u=e.mapping.slice(s),c=u.map(l,1),d=u.map(l+o.nodeSize,1),f=new a.Slice(a.Fragment.from(r.create(n,null,o.marks)),0,0);return e.step(new i.ReplaceAroundStep(c,d,c+1,d-1,f,1,!0)),!1}}))}))},t.blockNodes=function(e,t){void 0===t&&(t={blocksInSelection:!1});var r=e.doc,n=e.selection,o=n.$from,i=n.ranges,a=t.blocksInSelection,l=[],u=n instanceof s.NodeSelection?n.node:void 0;return u?u.isBlock?(l.push(u),u.nodesBetween(0,u.content.size,(function(e){e.isBlock&&l.push(e)}))):!a&&o.parent&&o.parent.isBlock&&l.push(o.parent):i.forEach((function(e){var t=e.$from.pos,n=e.$to.pos;r.nodesBetween(t,n,(function(e,r,o,i){e.isBlock&&(!a||r>=t&&r+e.content.size+2<=n)&&l.push(e)}))})),l},t.formatBlockElements=function(e,r){return function(o,i){var a=t.blockNodes(o),s=o.schema.nodes,l=o.tr;l.setMeta("commandName",r),l.setMeta("args",{value:e}),a.forEach((function(r){if(r.type.isTextblock)if("p"===e){var o=r.attrs,i=o.level,a=n.__rest(o,["level"]);t.changeTextBlock(l,r,s.paragraph,a)}else if(/^h[1-6]$/i.test(e)){i=parseInt(e.substr(1),10);t.changeTextBlock(l,r,s.heading,n.__assign({},r.attrs,{level:i}))}else if("blockquote"===e){var u=r.attrs;i=u.level,a=n.__rest(u,["level"]);t.changeTextBlock(l,r,s.blockquote,a)}}));var u=l.docChanged;return u&&i(l.scrollIntoView()),u}},t.cleanTextBlockFormatting=function(e,r){void 0===r&&(r={blocksInSelection:!0});var o=e.doc,i=e.selection,a=r.blocksInSelection,s=r.blockNodeType;t.blockNodes({doc:o,selection:i},{blocksInSelection:a}).filter((function(e){return e.isTextblock})).forEach((function(r){var o=r.attrs||{},i=o.style,a=void 0===i?"":i,l=o.class,u=void 0===l?"":l,c=n.__rest(o,["style","class"]),d=s||r.type;(a||u||d!==r.type)&&t.changeTextBlock(e,r,d,c)}))},t.getBlockFormats=function(e){var r=t.blockNodes(e),n=e.schema.nodes,o=[];return r.forEach((function(e){e.type===n.paragraph?o.push("p"):e.type===n.heading?o.push("h"+e.attrs.level):e.type===n.blockquote&&o.push("blockquote")})),o},t.addStyles=function(e,t){var r,n,i=e.attrs.style;i&&t.forEach((function(e){n={style:e.name,value:/^.+$/,newValue:e.value},r=o.changeStylesString(i,n),i=r.changed?r.style:i}));return i=i||t.reduce((function(e,t){return(e&&t.value?e+" ":"")+t.value?t.name+": "+t.value+";":""}),""),Object.assign({},e.attrs,{style:i||null})},t.hasNode=function(e,t){var r=e.selection,n=r.from,o=r.to,i=!1;return e.doc.nodesBetween(n,o,(function(e){return!(i=i||e.type===t)})),i},t.parentBlockFormat=function(e){var r=t.getBlockFormats(e);return 1===new Set(r).size?r[0]:null},t.activeNode=function(e){return{tag:t.parentBlockFormat(e)||""}}},function(e,t){e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(4),i=r(2),a=r(6),s=function(e,t){var r=e.find((function(e){return"style"===e.type.name})),n=r&&r.attrs.style;return i.changeStylesString(n,t)},l=function(e,t,r,i,a){var l=a.create({style:i.style}),u=[],c=[],d=null,f=null;return e.doc.nodesBetween(t,r,(function(e,p,m){if(e.isInline){var g=e.marks;if(!l.isInSet(g)&&m.type.allowsMarkType(l.type)){var v=Math.max(p,t),h=Math.min(p+e.nodeSize,r),y=s(g,i);if(y.changed||i.newValue){for(var k=y.changed?{style:y.style||null}:{style:[i.style]+": "+i.newValue+";"},b=a.isInSet(g)?g.find((function(e){return"style"===e.type.name})):null,x=b?n.__assign({},b.attrs,k):k,M=a.create(x),_=M.addToSet(g),S=0;S<g.length;S++)g[S].isInSet(_)||(d&&d.to===v&&d.mark.eq(g[S])?d.to=h:(d=new o.RemoveMarkStep(v,h,g[S]),u.push(d)));var T=f&&f.to===v,w=T&&M.attrs.style===f.mark.attrs.style;T&&w?f.to=h:Object.keys(x).some((function(e){return null!==x[e]}))&&(f=new o.AddMarkStep(v,h,M),c.push(f))}}}})),u.forEach((function(t){return e.step(t)})),c.forEach((function(t){return e.step(t)})),u.length+c.length>0};t.getInlineStyles=function(e,t){var r=e.schema.marks.style;return(r?a.selectionMarks(e,r):[]).map((function(e){return a.styleValue(e,t)})).filter((function(e){return null!==e}))};var u=function(e,t){return function(r,o,u){var c=r.selection,d=c.empty,f=c.$cursor,p=c.ranges;if(d&&!f||!a.markApplies(r.doc,p,e))return!1;var m=!1;if(o){var g=u||r.tr;if(f){var v=r.storedMarks||f.marks();if(e.isInSet(v)){var h=s(v,t),y=v.find((function(e){return"style"===e.type.name})),k=n.__assign({},y?y.attrs:{},{style:h.style||null});if(i.shallowEqual(y.attrs,k))return!1;o(g.removeStoredMark(e)),Object.keys(k).some((function(e){return null!==k[e]}))&&o(g.addStoredMark(e.create(k))),m=!0}}else{for(var b=0;b<p.length;b++){var x=p[b],M=x.$from,_=x.$to;m=l(g,M.pos,_.pos,t,e)}m&&(g.scrollIntoView(),o(g))}}return m}};t.toggleInlineFormat=function(e,t,r){return function(n,o){var i=n.schema.marks,s=e.altStyle,l=e.altMarks,c=void 0===l?[]:l,d=e.mark,f=t||n.tr,p=!1,m=!1,g=function(){return m=!0};s&&i.style&&(p=u(i.style,{style:s.name,value:s.value})(n,g,f));var v=[d].concat(c).filter((function(e){return i[e]})).map((function(e){return a.hasMark(n,{mark:e})&&i[e]})).filter((function(e){return e}));return v.length?a.removeMarks(v,n,g,f):p||a.toggleMark(i[d],r,f)(n,g),m&&o(f),m}},t.applyInlineStyle=function(e,t){return function(r,o){var s=r.schema.marks.style,l={style:e.style,value:/^.+$/,newValue:e.value},c=r.tr;t&&c.setMeta("commandName",t),c.setMeta("args",e);var d=r.selection,f=d.empty,p=d.$cursor,m=d.ranges;if(f&&!p||!s||!a.markApplies(r.doc,m,s))return!1;if(p){var g=r.storedMarks||p.marks(),v=s.isInSet(g)?g.find((function(e){return"style"===e.type.name})):null,h={style:null};if(v&&v.attrs.style){var y=i.changeStylesString(v.attrs.style,l);y.changed&&y.style&&(h.style=y.style)}else l.newValue&&(h.style=[l.style]+": "+l.newValue+";");var k=v?n.__assign({},v.attrs,h):h;return Object.keys(k).some((function(e){return null!==k[e]}))?o(c.addStoredMark(s.create(k))):o(c.removeStoredMark(s)),!0}return u(s,l)(r,o,c)}}},function(e,t){e.exports=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(0),i=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"];t.trimWhitespace=function(e,t){void 0===t&&(t=i);var r=t.join("|");return e.replace(new RegExp("\\s*(<(?:"+r+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+r+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},t.htmlToFragment=function(e){var t,r=document.createElement("template");if("content"in r)r.innerHTML=e,t=r.content;else{var n=(new DOMParser).parseFromString(e,"text/html");t=document.createDocumentFragment();for(var o=n.body;o&&o.firstChild;)t.appendChild(o.firstChild)}return t},t.pmDocToFragment=function(e){return n.DOMSerializer.fromSchema(e.type.schema).serializeFragment(e.content)},t.domToPmDoc=function(e,t,r){return n.DOMParser.fromSchema(t).parse(e,r)},t.parseContent=function(e,r,n){var o=t.htmlToFragment(e);return t.domToPmDoc(o,r,n)},t.getHtml=function(e){var r=t.pmDocToFragment(e.doc),n=document.createElement("div");return n.appendChild(r),n.innerHTML},t.setHtml=function(e,r,n){return void 0===r&&(r="setHTML"),void 0===n&&(n={preserveWhitespace:"full"}),function(i,a){return a(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith(t.parseContent(e,i.schema,n)).setMeta("commandName",r))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(13);t.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:n.__assign({},o.listsTypes)},t.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:n.__assign({},o.listsTypes)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},t.orderedList={listType:t.listsTypes.orderedList,types:n.__assign({},t.listsTypes)},t.bulletList={listType:t.listsTypes.bulletList,types:n.__assign({},t.listsTypes)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8);t.blockquote=function(e,t){return n.wrapIn(e.schema.nodes.blockquote)(e,t)},t.liftBlockquote=function(e,t){var r=e.selection,n=r.$from,o=r.$to,i=e.schema.nodes.blockquote,a=e.doc,s=-1,l=n.blockRange(o);l&&a.nodesBetween(l.start,l.end,(function(e,t,r,n){e.type===i&&(s=t)}));var u=-1!==s;return t&&u&&t(e.tr.lift(l,a.resolve(s).depth)),u}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(3),i=r(0),a=r(4),s=r(8),l=r(10),u=r(13),c=function(e,t,r){for(var n=t.depth,o=e.nodes[r.bulletList],i=e.nodes[r.orderedList],a=e.nodes[r.listItem],s=t.depth;s>0;s--){var l=t.node(s);if(l.type!==o&&l.type!==i||(n=s),l.type!==o&&l.type!==i&&l.type!==a)break}return n-1};function d(e){return function(t,r,n){if(!n)return!1;var o,i=(t=n.state).schema.nodes[e.listType],a=t.selection,u=a.$from,c=a.$to,d=u.node(-2),f=u.node(-3),m=function(e,t,r,n){return 0===function(e,t,r){var n=Array(),o=function(e,t){var r=["blockquote","bulletList","orderedList"];if(1===t.depth)return t;var n=t.node(t.depth),o=t;for(;t.depth>=1;)t=e.resolve(t.before(t.depth)),(n=t.node(t.depth))&&-1!==r.indexOf(n.type.name)&&(o=t);return o}(e,t).depth,i=e.resolve(t.start(o));for(;i.pos<=r.start(r.depth);){var a=Math.min(i.depth,o),s=i.node(a);if(s&&n.push(s),0===a)break;var l=e.resolve(i.after(a));if(l.start(a)>=e.nodeSize-2)break;l.depth!==i.depth&&(l=e.resolve(l.pos+2)),i=l.depth?e.resolve(l.start(l.depth)):e.resolve(l.end(l.depth))}return n}(e,t,r).filter((function(e){return e.type!==n})).length}(t.doc,u,c,i);return(d&&d.type===i||f&&f.type===i)&&m?p(e)(t,r):(m||(p(e)(t,r),t=n.state),(o=i,s.autoJoin(l.wrapInList(o),(function(e,t){return e.type===t.type&&e.type===o})))(t,r))}}function f(e,t,r,n){n||(n=e.schema.nodes.listItem);var i=t.$from,s=t.$to,l=i.blockRange(s,(function(e){return e.childCount&&e.firstChild.type===n}));if(!l||l.depth<2||i.node(l.depth-1).type!==n)return r;var u=l.end,c=s.end(l.depth);return u<c&&(r.step(new a.ReplaceAroundStep(u-1,c,u,c,new o.Slice(o.Fragment.from(n.create(void 0,l.parent.copy())),1,0),1,!0)),l=new o.NodeRange(r.doc.resolve(i.pos),r.doc.resolve(c),l.depth)),r.lift(l,a.liftTarget(l)).scrollIntoView()}function p(e){return function(t,r){var n=t.tr,o=t.selection,s=o.$from,l=o.$to;return n.doc.nodesBetween(s.pos,l.pos,(function(r,o){if(r.isTextblock||"blockquote"===r.type.name||"div"===r.type.name){var s=new i.NodeSelection(n.doc.resolve(n.mapping.map(o))),l=s.$from.blockRange(s.$to);if(!l||s.$from.parent.type!==t.schema.nodes[e.listItem])return!1;var u=l&&a.liftTarget(l);if(null==u)return!1;n.lift(l,u)}})),r&&r(n),!0}}t.toggleList=function(e,t,r,n,o){var a=n.listType,s=e.selection,l=s.$from.node(s.$from.depth-2),u=s.$to.node(s.$to.depth-2);if(l&&l.type.name===a&&u&&u.type.name===a){var p=r.state.schema.nodes,m={bulletList:p[n.bulletList],orderedList:p[n.orderedList],listItem:p[n.listItem]},g=function(e,t){for(var r,n=t.bulletList,o=t.orderedList,i=t.listItem,a=e.depth-1;a>0;a--){var s=e.node(a);if(s.type!==n&&s.type!==o||(r=a),s.type!==n&&s.type!==o&&s.type!==i)break}return r}(s.$to,m),v=function(e,t,r,n,o,a){a||(a=e.schema.nodes.listItem);var s=!1;return o.doc.nodesBetween(t,r,(function(r,l){if(!s&&r.type===a&&l>t){s=!0;for(var u=n+3;u>n+2;){var c=o.doc.resolve(o.mapping.map(l));u=c.depth;var d=o.doc.resolve(o.mapping.map(l+r.textContent.length)),p=new i.TextSelection(c,d);o=f(e,p,o,a)}}})),o}(e,s.$to.pos,s.$to.end(g),g,r.state.tr,m.listItem);return(v=function(e,t,r){var n=e.selection,o=n.from,i=n.to,a=e.schema.nodes,s=a.paragraph,l=a.heading,u=[];t.doc.nodesBetween(o,i,(function(e,t){e.type!==s&&e.type!==l||u.push({node:e,pos:t})}));for(var d=u.length-1;d>=0;d--){var f=u[d],p=t.doc.resolve(t.mapping.map(f.pos));if(p.depth>0){var m=void 0;m=f.node.textContent&&f.node.textContent.length>0?t.doc.resolve(t.mapping.map(f.pos+f.node.textContent.length)):t.doc.resolve(t.mapping.map(f.pos+1));var g=p.blockRange(m);g&&t.lift(g,c(e.schema,p,r))}}return t}(e,v,n)).setMeta("commandName",o),t(v),!0}return d(n)(e,t,r)},t.toggleUnorderedList=function(e,r,o){return t.toggleList(e,r,o,n.__assign({listType:u.bulletList.listType},u.bulletList.types))},t.toggleOrderedList=function(e,r,o){return t.toggleList(e,r,o,n.__assign({listType:u.orderedList.listType},u.orderedList.types))},t.splitListItemKeepMarks=function(e){return function(t,r){return l.splitListItem(e)(t,(function(e){var n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();n&&e.ensureMarks(n),r(e)}))}}},function(e,t){e.exports=s},function(e,t){e.exports=l},function(e,t){e.exports=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},t.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},t.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},t.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},t.subscript={mark:"sub"},t.superscript={mark:"sup"},t.link={mark:"link"},t.unlink={mark:"link"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,o=function(e){return/^MsoListParagraph/.test(e.className)},i=function(e){var t=e.innerHTML;return t=(t=t.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},a=function(e,t){var r=document.createElement(e);return r.style.listStyleType=t,r},s=function(e){var t=null;return/^\d/.test(e)||(t=(/^[a-z]/.test(e)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(e)?"roman":"alpha")),t},l=function(e,t){var r=[];Array.from(e).forEach((function(e){if(e.nodeType===Node.ELEMENT_NODE){var n=e;n.getAttribute("datalist")?(r.push(e),t.add(r)):o(n)&&r.length?r.push(e):(r=[],"DIV"===n.nodeName?l(n.children,t):"TABLE"===n.nodeName&&Array.from(n.querySelectorAll("td,th")).forEach((function(e){l(e.children,t)})))}}))},u=function(e){var t,r=e.innerHTML,n=function(e){return e.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/,"")};return r=r.replace(/<\/?\w+[^>]*>/g,"").replace(/&nbsp;/g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(r)?{tag:"ul",style:(t=n(i(e)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(t)?null:/^o/.test(t)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(r)?{tag:"ol",style:s(n(i(e)))}:void 0},c=function(e){var t,r=e.nodeName.toLowerCase();e.firstChild&&e.firstChild.nodeType===Node.COMMENT_NODE&&e.removeChild(e.firstChild),1===e.childNodes.length?t=e.firstChild.nodeType===Node.TEXT_NODE?i(e):e.firstChild.innerHTML.replace(/^\w+[\.\)](&nbsp;)+ /,""):(e.removeChild(e.firstChild),3===e.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(e.firstChild.nodeValue)&&e.removeChild(e.firstChild),/^(&nbsp;|\s)+$/i.test(e.firstChild.innerHTML)&&e.removeChild(e.firstChild),t="p"!==r?"<"+r+">"+e.innerHTML+"</"+r+">":e.innerHTML),e.parentNode.removeChild(e);var n=document.createElement("li");return n.innerHTML=t,n};t.convertMsLists=function(e){var t=document.createElement("div");t.innerHTML=function(e){return e=e.replace(n,(function(e,t,r){return'datalist="'+t+'" datalevel="'+r+'" '+e}))}(e);var r=new Set;return l(t.children,r),r.forEach((function(e){return function(e){var t,r,n,i,s,l,d,f,p,m,g,v,h,y=-1,k={};for(f=0;f<e.length;f++){var b=(h={datalist:(p=e[f]).getAttribute("datalist"),datalevel:p.getAttribute("datalevel")}).datalist,x=u(p);if(m=x&&x.tag){if(g=h.datalevel||parseFloat(p.style.marginLeft||0),h.datalevel||p.style.marginLeft){var M=m+b;k[g]||(k[g]={}),(!r||r<0)&&(r=g,n=b,i=(d=e.filter((function(e){return e.getAttribute("datalist")===String(n)})))[d.length-1],l=a(m,x&&x.style),p.parentNode.insertBefore(l,p),y=g,k[g][M]=l),s=i===p,v=k[g][M],(g>y||!v)&&(v=a(m,x&&x.style),k[g][M]=v,t.appendChild(v)),t=c(p),v.appendChild(t),s?r=y=-1:y=g}}else!t||s&&!o(p)||(p.style.marginLeft&&(p.style.marginLeft=""),p.style.marginLeft&&(p.style.margin=""),t.appendChild(p))}}(e)})),t.innerHTML}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(11);t.getHtml=o.getHtml,t.setHtml=o.setHtml,t.parseContent=o.parseContent,t.trimWhitespace=o.trimWhitespace,t.htmlToFragment=o.htmlToFragment,t.domToPmDoc=o.domToPmDoc,t.pmDocToFragment=o.pmDocToFragment;var i=r(9);t.applyInlineStyle=i.applyInlineStyle,t.getInlineStyles=i.getInlineStyles,t.toggleInlineFormat=i.toggleInlineFormat;var a=r(22);t.applyLink=a.applyLink,t.removeLink=a.removeLink;var s=r(23);t.insertText=s.insertText;var l=r(24);t.insertImage=l.insertImage;var u=r(25);t.alignBlocks=u.alignBlocks,t.isAligned=u.isAligned;var c=r(26);t.cleanFormatting=c.cleanFormatting;var d=r(7);t.hasNode=d.hasNode,t.activeNode=d.activeNode,t.formatBlockElements=d.formatBlockElements,t.getBlockFormats=d.getBlockFormats,t.parentBlockFormat=d.parentBlockFormat,t.changeTextBlock=d.changeTextBlock,t.blockNodes=d.blockNodes,t.cleanTextBlockFormatting=d.cleanTextBlockFormatting;var f=r(6);t.hasMark=f.hasMark,t.getMark=f.getMark,t.getActiveMarks=f.getActiveMarks,t.removeAllMarks=f.removeAllMarks,t.cleanMarks=f.cleanMarks,t.selectionMarks=f.selectionMarks;var p=r(27);t.indent=p.indent,t.canIndentAsListItem=p.canIndentAsListItem,t.outdent=p.outdent,t.canOutdentAsListItem=p.canOutdentAsListItem,t.isIndented=p.isIndented,t.canBeIndented=p.canBeIndented,t.indentBlocks=p.indentBlocks;var m=r(15);t.toggleOrderedList=m.toggleOrderedList,t.toggleUnorderedList=m.toggleUnorderedList,t.toggleList=m.toggleList;var g=r(14);t.blockquote=g.blockquote,t.liftBlockquote=g.liftBlockquote;var v=r(2);t.hasSameMarkup=v.hasSameMarkup,t.getSelectionText=v.getSelectionText,t.getNodeFromSelection=v.getNodeFromSelection,t.selectedLineTextOnly=v.selectedLineTextOnly,t.expandSelection=v.expandSelection,t.expandToWordWrap=v.expandToWordWrap,t.canInsert=v.canInsert,t.insertNode=v.insertNode,t.indentHtml=v.indentHtml;var h=r(28);t.alignLeftRules=h.alignLeftRules,t.alignCenterRules=h.alignCenterRules,t.alignRightRules=h.alignRightRules,t.alignJustifyRules=h.alignJustifyRules,t.alignRemoveRules=h.alignRemoveRules;var y=r(12);t.indentRules=y.indentRules,t.outdentRules=y.outdentRules;var k=r(29);t.nodes=k.nodes,t.marks=k.marks;var b=r(30);t.buildKeymap=b.buildKeymap,t.buildListKeymap=b.buildListKeymap;var x=r(19);t.bold=x.bold,t.italic=x.italic,t.underline=x.underline,t.strikethrough=x.strikethrough,t.subscript=x.subscript,t.superscript=x.superscript,t.link=x.link;var M=r(31);t.sanitize=M.sanitize,t.removeComments=M.removeComments,t.removeTag=M.removeTag,t.pasteCleanup=M.pasteCleanup,t.sanitizeClassAttr=M.sanitizeClassAttr,t.sanitizeStyleAttr=M.sanitizeStyleAttr,t.removeAttribute=M.removeAttribute,t.replaceImageSourcesFromRtf=M.replaceImageSourcesFromRtf;var _=r(20);t.convertMsLists=_.convertMsLists;var S=r(32);t.createTable=S.createTable;var T=r(33);t.find=T.find,t.findAt=T.findAt,t.findAll=T.findAll,t.replace=T.replace,t.replaceAll=T.replaceAll;var w=r(34);t.placeholder=w.placeholder;var I=r(35);t.spacesFix=I.spacesFix;var L=r(36);t.textHighlight=L.textHighlight,t.textHighlightKey=L.textHighlightKey;var A=r(37);t.imageResizing=A.imageResizing,t.imageResizeKey=A.imageResizeKey,n.__exportStar(r(8),t),n.__exportStar(r(38),t),n.__exportStar(r(39),t),n.__exportStar(r(17),t),n.__exportStar(r(18),t),n.__exportStar(r(40),t),n.__exportStar(r(3),t),n.__exportStar(r(10),t),n.__exportStar(r(0),t),n.__exportStar(r(16),t),n.__exportStar(r(4),t),n.__exportStar(r(5),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9),o=r(6),i=r(0);t.removeLink=function(e,t){return function(r,i){var a=r.selection.$cursor;if(a){var s=a.parent,l=a.index(),u=r.schema.marks[e.mark],c=s.child(l).marks.find((function(e){return e.type===u})),d=s.childCount,f=a.pos-a.textOffset,p=s.child(l).nodeSize,m=void 0,g=void 0;for(m=l-1;m>=0&&c.isInSet(s.child(m).marks);)p+=g=s.child(m).nodeSize,f-=g,m-=1;for(m=l+1;m<d&&c.isInSet(s.child(m).marks);)p+=s.child(m).nodeSize,m+=1;i(o.removeMark(t||r.tr,f,f+p,c))}else n.toggleInlineFormat(e,t)(r,i)}};t.applyLink=function(e,r){var a=e.mark,s=e.attrs;return void 0===r&&(r="link"),function(e,l){var u=e.schema.marks,c=e.tr;r&&(c.setMeta("commandName",r),c.setMeta("args",s));var d=!1,f=function(){return d=!0};if(function(e,t){var r=o.selectionMarks(e,t);return 1===r.length&&r[0]?r[0]:null}(e,u[a]))!function(e,t){return function(r,n){var o=r.selection,i=o.$cursor,a=o.from,s=o.to,l=r.schema.marks[e.mark];if(i){var u=i.parent,c=i.index(),d=u.child(c).marks.find((function(e){return e.type===l})),f=u.childCount,p=i.pos-i.textOffset,m=u.child(c).nodeSize,g=void 0,v=void 0;for(g=c-1;g>=0&&d.isInSet(u.child(g).marks);)m+=v=u.child(g).nodeSize,p-=v,g-=1;for(g=c+1;g<f&&d.isInSet(u.child(g).marks);)m+=u.child(g).nodeSize,g+=1;t.removeMark(p,p+m,l),t.addMark(p,p+m,l.create(e.attrs)),n(t)}else t.doc.nodesBetween(a,s,(function(r,o){r.isInline&&l.isInSet(r.marks)&&(t.removeMark(o,o+r.nodeSize,l),t.addMark(o,o+r.nodeSize,l.create(e.attrs)),n(t))}))}}({mark:a,attrs:s},c)(e,f);else{var p=e;o.hasMark(e,{mark:a})&&(t.removeLink({mark:a,attrs:s},c)(e,f),p=i.EditorState.create({doc:c.doc,selection:c.selection})),d?o.toggleMark(u[a],s,c)(p,f):n.toggleInlineFormat({mark:a},c,s)(p,f)}return d&&l(c),d}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertText=function(e){return function(t,r){r(t.tr.insertText(e.text,e.from,e.to))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.insertImage=function(e){return function(t,r){var o=t.schema.nodes.image,i=o.createAndFill(e);n.insertNode(i)(t,(function(t){return r(t.setMeta("commandName","insertImage").setMeta("args",e))}))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.alignBlocks=function(e,t){return function(r,o){var i=n.blockNodes(r),a=r.tr;a.setMeta("commandName",t),i.forEach((function(t){if(t.type.isTextblock){var r={},o=e.find((function(e){return e.node===t.type.name}));o&&(r=n.addStyles(t,o.style)),n.changeTextBlock(a,t,t.type,r)}}));var s=a.docChanged;return s&&o(a.scrollIntoView()),s}},t.isAligned=function(e,t){var r=n.blockNodes(e),o=!1;return r.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var r=t.find((function(t){return t.node===e.type.name}));r&&(o=r.style.every((function(t){return!!t.value&&new RegExp(t.name+":\\s?"+t.value,"i").test(e.attrs.style)})))}})),o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),o=r(6);t.cleanFormatting=function(e){return void 0===e&&(e={blocksInSelection:!0}),function(t,r){var i=t.tr,a=e.blocksInSelection,s=e.blockNodeType,l=(e.exceptMarks||[t.schema.marks.link]).filter(Boolean);o.cleanMarks(i,{except:l}),n.cleanTextBlockFormatting(i,{blocksInSelection:a,blockNodeType:s});var u=i.docChanged;return u&&r&&r(i),u}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(10),o=r(12),i=r(7),a=r(2),s=r(14);t.indentBlocks=function(e,t,r){return function(n,o){var a=i.blockNodes(n),s=n.tr;s.setMeta("commandName",t),a.forEach((function(t){if(t.type.isTextblock){var n=void 0,o=e.find((function(e){return e.node===t.type.name}));if(o){var a="rtl"===r?o.rtlStyle:o.style,l={name:a,value:o.step>0?""+o.step+o.unit:""};if(t.attrs.style){var u=new RegExp(a+":\\s?(\\d+)"+o.unit,"i"),c=t.attrs.style.match(u);if(c){var d=parseFloat(c[1])+o.step;d=d<=0?"":d,l.value=""+d+(d?o.unit:"")}}n=i.addStyles(t,[l])}n&&i.changeTextBlock(s,t,t.type,n)}}));var l=s.docChanged;return l&&o(s.scrollIntoView()),l}},t.isIndented=function(e,t,r){var n=i.blockNodes(e),o=!1;return n.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var n=t.find((function(t){return t.node===e.type.name}));if(n){var i="rtl"===r?n.rtlStyle:n.style,a=new RegExp(i+":\\s?\\d+"+n.unit,"i");o=a.test(e.attrs.style)}}})),o},t.canIndentAsListItem=function(e,t){return n.sinkListItem(t)(e)},t.canOutdentAsListItem=function(e,t){var r=e.schema.nodes[t.listsTypes.listItem],o=e.schema.nodes[t.listsTypes.orderedList],i=e.schema.nodes[t.listsTypes.bulletList],s=!!a.findNthParentNodeOfType(o,2)(e.selection),l=!!a.findNthParentNodeOfType(i,2)(e.selection);return(s||l)&&n.liftListItem(r)(e)},t.canBeIndented=function(e,r){var n=e.schema.nodes,a=n[o.indentRules.listsTypes.listItem];return(t.isIndented(e,r.nodes)||o.indentRules.nodes.some((function(t){return n[t.node]&&i.hasNode(e,n[t.node])})))&&!i.hasNode(e,a)},t.indent=function(e,r){var i=e.schema.nodes[o.indentRules.listsTypes.listItem],a=t.canBeIndented(e,o.indentRules);t.canIndentAsListItem(e,i)?n.sinkListItem(i)(e,r):a&&t.indentBlocks(o.indentRules.nodes)(e,r)},t.outdent=function(e,r){var a=e.schema.nodes,l=a[o.outdentRules.listsTypes.listItem],u=t.canBeIndented(e,o.outdentRules);i.hasNode(e,a.blockquote)?s.liftBlockquote(e,r):t.canOutdentAsListItem(e,o.outdentRules)?n.liftListItem(l)(e,r):u&&t.indentBlocks(o.outdentRules.nodes)(e,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return{name:e,value:t}};t.alignLeftRules=[{node:"paragraph",style:[n("text-align","left")]},{node:"heading",style:[n("text-align","left")]}],t.alignRightRules=[{node:"paragraph",style:[n("text-align","right")]},{node:"heading",style:[n("text-align","right")]}],t.alignCenterRules=[{node:"paragraph",style:[n("text-align","center")]},{node:"heading",style:[n("text-align","center")]}],t.alignJustifyRules=[{node:"paragraph",style:[n("text-align","justify")]},{node:"heading",style:[n("text-align","justify")]}],t.alignRemoveRules=[{node:"paragraph",style:[n("text-align","")]},{node:"heading",style:[n("text-align","")]}]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(16),i=["blockquote",0],a=["hr"],s=["pre",["code",0]],l=["ol",0],u=["ul",0],c=["li",0],d=function(e){for(var t,r={},n=e.attributes,o=0;o<n.length;o++)r[(t=n[o]).name]=t.value;return r},f=function(e,t){for(var r in e)if(r&&null!==e[r]&&r!==t)return!0;return!1},p=function(e,t){var r={};for(var n in e)n&&null!==e[n]&&n!==t&&(r[n]=e[n]);return r},m=function(e){var t;return(t={})[e]={name:e,inclusive:!0,parseDOM:[{tag:e}],toDOM:function(){return[e,0]}},t},g=n.__assign({link:{attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}},{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:d}],toDOM:function(e){return["a",p(e.attrs),0]}}},m("strong"),m("b"),m("em"),m("i"),m("u"),m("del"),m("sub"),m("sup"),m("code"),{style:{attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),parseDOM:[{tag:"span",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["span",p(e.attrs),0]:["span",0]}}});t.marks=g;var v=n.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),parseDOM:[{tag:"p",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["p",p(e.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),parseDOM:[{tag:"div",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["div",p(e.attrs),0]:["div",0]}},blockquote:{attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["blockquote",p(e.attrs),0]:i}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return a}},heading:{attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}},{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(e){return n.__assign({},d(e),{level:1})}},{tag:"h2",getAttrs:function(e){return n.__assign({},d(e),{level:2})}},{tag:"h3",getAttrs:function(e){return n.__assign({},d(e),{level:3})}},{tag:"h4",getAttrs:function(e){return n.__assign({},d(e),{level:4})}},{tag:"h5",getAttrs:function(e){return n.__assign({},d(e),{level:5})}},{tag:"h6",getAttrs:function(e){return n.__assign({},d(e),{level:6})}}],toDOM:function(e){return f(e.attrs,"level")?["h"+e.attrs.level,p(e.attrs,"level"),0]:["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return s}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:n.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},{style:{default:null},class:{default:null},id:{default:null}}),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["img",p(e.attrs)]:["img"]}},hard_break:{inline:!0,attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["br",p(e.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}},{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(e){return n.__assign({},d(e),{order:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"1",10):1})}}],toDOM:function(e){return 1===e.attrs.order?f(e.attrs,"order")?["ol",p(e.attrs,"order"),0]:l:["ol",n.__assign({},p(e.attrs,"order"),{start:e.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),parseDOM:[{tag:"ul",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["ul",p(e.attrs),0]:u}},list_item:{content:"(paragraph | heading) block*",attrs:n.__assign({},{style:{default:null},class:{default:null},id:{default:null}}),parseDOM:[{tag:"li",getAttrs:d}],toDOM:function(e){return f(e.attrs)?["li",p(e.attrs),0]:c},defining:!0}},o.tableNodes({tableGroup:"block",cellContent:"block+",cellAttributes:{}}));t.nodes=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(8),i=r(17),a=r(18),s=r(15),l=r(19),u=r(9),c=r(2),d="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);t.buildKeymap=function(e,t){var r={},s=t&&t.applyToWord||!1;if(r["Mod-z"]=i.undo,r["Shift-Mod-z"]=i.redo,r.Backspace=o.chainCommands(a.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),r.Enter=o.chainCommands(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),d||(r["Mod-y"]=i.redo),e.marks.strong&&(r["Mod-b"]=c.expandToWordWrap(u.toggleInlineFormat,n.__assign({},l.bold,{applyToWord:s}))),e.marks.em&&(r["Mod-i"]=c.expandToWordWrap(u.toggleInlineFormat,n.__assign({},l.italic,{applyToWord:s}))),e.marks.u&&(r["Mod-u"]=c.expandToWordWrap(u.toggleInlineFormat,n.__assign({},l.underline,{applyToWord:s}))),e.nodes.hard_break){var f=e.nodes.hard_break,p=o.chainCommands(o.exitCode,(function(e,t){return t(e.tr.replaceSelectionWith(f.create()).scrollIntoView()),!0}));r["Shift-Enter"]=p}return r},t.buildListKeymap=function(e){var t={};return e.nodes.list_item&&(t.Enter=s.splitListItemKeepMarks(e.nodes.list_item)),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(20);t.sanitize=function(e){return e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},t.removeComments=function(e){return e.replace(/<!--[\s\S]+?-->/g,"")},t.removeTag=function(e,t){return e.replace(new RegExp("<\\/?("+t+")(?:\\s[^>]*?)?>","gi"),"")},t.removeAttribute=function(e){e.ownerElement&&e.ownerElement.removeAttribute(e.name)},t.sanitizeClassAttr=function(e){/^Mso/.test(e.value)&&t.removeAttribute(e)};var o=/\s*;\s*/,i=/\s*:\s*/;t.sanitizeStyleAttr=function(e){var r,n,a=e.value.split(o).filter((function(e){return Boolean(e)})),s=e.ownerElement.style,l="";a.forEach((function(e){var t;t=e.split(i),r=t[0],n=t[1],void 0!==s[r]&&(l+=r+": "+n+"; ")})),(l=l.trim())?e.value=l:t.removeAttribute(e)};function a(e){for(var t=e.length,r=new Array(t/2),n=0;n<t;n+=2)r[n]=String.fromCharCode(parseInt(e.substring(n,n+2),16));return btoa(r.join(""))}t.pasteCleanup=function(e,r){var o=e;if(r.convertMsLists&&(o=n.convertMsLists(o)),r.stripTags&&(o=t.removeTag(o,r.stripTags)),r.attributes){var i=document.createElement("div");i.innerHTML=o,Array.from(i.querySelectorAll("*")).forEach((function(e){return function(e,t){if(e.nodeType===Node.ELEMENT_NODE){for(var r=e.attributes.length-1;r>=0;r--){var n=e.attributes[r];t[n.name]?t[n.name](n):t["*"]&&t["*"](n)}"SPAN"===e.nodeName&&0===e.attributes.length&&function(e){var t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}(e)}}(e,r.attributes)})),o=i.innerHTML}return o};var s=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,l=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,u=new RegExp("(?:("+l.source+"))([\\da-fA-F\\s]+)\\}","g"),c=/[^\da-fA-F]/g,d=/file:\/[^'"]+\.(jpg|png|gif)/i,f=/\\(png|jpeg)blip\\/;t.replaceImageSourcesFromRtf=function(e,t){var r=e.match(s);if(!r||-1===t.types.indexOf("text/rtf"))return e;var n=t.getData("text/rtf"),o=[],i=n.match(u);if(!n||!i)return e;for(var p=0,m=i;p<m.length;p++){var g=m[p],v=f.exec(g);if(v){var h=g.replace(l,"").replace(c,"");o.push("data:image/"+v[1]+";base64,"+a(h))}}return r.length!==o.length?e:e.replace(s,(function(e){var t=o.shift()||"";return e.replace(d,t)}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createTable=function(e,t,r){for(var n,o=e.table,i=e.table_row,a=e.table_cell,s=[],l=0;l<t+1;l++){n=[];for(var u=0;u<r+1;u++)n.push(a.createAndFill());s.push(i.createAndFill(void 0,n))}return o.createAndFill(void 0,s)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0);t.findAt=function(e,t,r,n,i){var l,u,c,d,f,p,m=[],g=[],v=t.matchCase,h=t.matchWord,y=t.useRegExp,k=t.text;if(y&&(/^\\$/.test(k)||/[^\\]\\$/.test(k))&&(k=k.substring(0,k.length-1)),!k)return m;var b=v?"g":"gi",x=y?new RegExp(k,b):s(k,b);return e.nodesBetween(r,n,(function(t,s,v){if(i(m))return!1;t.inlineContent&&s+t.content.size>=r&&(g.length=0,t.nodesBetween(0,t.content.size,(function(t,v,y,k){if(i(m))return!1;var b=1+s+v;if(t.isText&&b+t.nodeSize>=r){if(f=t.text||"",p=y.childCount-1>=k+1&&y.child(k+1),g.push(r<=b?{text:f,start:b}:{text:f.slice(r-b),start:r}),p&&p.isText)return;for(u=g.map((function(e){return e.text})).join(""),l=x.exec(u);null!==l&&(c=g[0].start+l.index,d=c+l[0].length,r<=c&&n>=d&&a(l,h)&&m.push(o.TextSelection.create(e,c,d)),!i(m));)l=x.exec(u)}else g.length=0})))})),m},t.find=function(e,r){var o=r.backward,i=r.matchCyclic,a=n.__rest(r,["backward","matchCyclic"]),s=o?function(){return!1}:function(e){return e.length>0},l=e.doc,u=e.selection,c=[];return o?!(c=t.findAt(l,a,0,u.from,s)).length&&i&&(c=t.findAt(l,a,u.from,l.content.size,s)):!(c=t.findAt(l,a,u.to,l.content.size,s)).length&&i&&(c=t.findAt(l,a,0,u.to,s)),c.length?c[c.length-1]:null},t.findAll=function(e,r){return t.findAt(e,r,0,e.content.size,(function(){return!1}))},t.replace=function(e,t,r){var n=e.from,i=e.to;return r.insertText(t,n,i).setSelection(o.TextSelection.create(r.doc,n,n+t.length)),r},t.replaceAll=function(e,r,n){var o=t.findAll(e.doc,n);if(0===o.length)return null;for(var i=e.tr,a=o.length-1;a>=0;a--)i.insertText(r,o[a].from,o[a].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,a=function(e,t){if(t){if(!0===t){var r=e.input,n=r.charAt(e.index-1),o=r.charAt(e.index+e[0].length);return i.test(n)&&i.test(o)}return t(e)}return!0},s=function(e,t){var r=e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(r,t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5);t.placeholder=function(e){var t={class:"k-placeholder","data-placeholder":e};return new n.Plugin({key:new n.PluginKey("placeholder"),props:{decorations:function(e){var r=e.doc,n=r.content.firstChild;if(!(0===r.childCount||1===r.childCount&&n.inlineContent&&0===n.childCount))return o.DecorationSet.empty;var i=[];return r.descendants((function(e,r){i.push(o.Decoration.node(r,r+e.nodeSize,t))})),o.DecorationSet.create(r,i)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5),i=/\s+/g,a=/text-align/;t.spacesFix=function(){return new n.Plugin({key:new n.PluginKey("spaces-fix"),props:{decorations:function(e){var t,r,n,s,l=[],u=e.doc;return u.nodesBetween(0,u.content.size,(function(e,u,c){if(e.type.isText&&function(e){return a.test(e&&e.attrs&&e.attrs.style||"")}(c))for(r=i.exec(e.text||"");null!==r;){if(t=u+r.index,n=r[0].length,r.index+n<r.input.length)for(s=0;s<=n-1;s+=2)l.push(o.Decoration.inline(t+s,t+s+1,{style:"white-space: normal"}));r=i.exec(e.text||"")}})),o.DecorationSet.create(u,l)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5);t.textHighlightKey=new n.PluginKey("highlight"),t.textHighlight=function(e){return void 0===e&&(e=t.textHighlightKey),new n.Plugin({key:e,state:{init:function(){return null},apply:function(e){return e.getMeta(this.spec.key)}},props:{decorations:function(e){var t=(this.spec.key.getState(e)||[]).map((function(e){return o.Decoration.inline(e.from,e.to,e.attrs)}));return o.DecorationSet.create(e.doc,t)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0),i=r(5),a=r(2);t.imageResizeKey=new o.PluginKey("image-resize");var s={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},l=Object.keys(s),u=function(e,t,r){e.style[t]=r+"px"},c=/[^\-]width:|[^\-]height:/,d=/^.+$/,f=function(){function e(e,t,r,n){this.activeHandle=e,this.dragging=t,this.rect=r,this.nodePosition=n}return e.prototype.apply=function(r){var n=r.getMeta(t.imageResizeKey);return n?new e(n.activeHandle,n.setDragging,n.rect,n.nodePosition):this},e}(),p=function(e,r,i){var l=r.target.getAttribute("data-direction");if(!l)return!1;var f=t.imageResizeKey.getState(e.state);r.preventDefault();var p=e.state.tr;function m(r){!function(e,r,n){var o=t.imageResizeKey.getState(e.state),i=o.rect,a=o.dragging,l=o.nodePosition,c=o.activeHandle;if(a&&i){var d=e.nodeDOM(l),f=s[c],p=(r.clientX-a.startX)*f.x,m=(r.clientY-a.startY)*f.y,g=f.x?p+d.width:i.width,v=f.y?m+d.height:i.height;if(n.lockRatio&&f.x&&f.y){var h=Math.min(g/d.width,v/d.height),y=d.width*h,k=d.height*h;a.startX=r.clientX-(g-y)*f.x,a.startY=r.clientY-(v-k)*f.y,g=y,v=k}else a.startX=f.x?r.clientX:a.startX,a.startY=f.y?r.clientY:a.startY;u(d,"width",g),u(d,"height",v),i.top=d.offsetTop,i.left=d.offsetLeft,i.width=d.offsetWidth,i.height=d.offsetHeight;var b=d.nextElementSibling;b.style.width=i.width+"px",b.style.height=i.height+"px",b.style.top=i.top+"px",b.style.left=i.left+"px"}}(e,r,i)}return p.setMeta(t.imageResizeKey,{setDragging:{startX:r.clientX,startY:r.clientY},activeHandle:l,rect:f.rect,nodePosition:f.nodePosition}),p.setMeta("addToHistory",!1),e.dispatch(p),r.view.addEventListener("mouseup",(function r(i){i.view.removeEventListener("mouseup",r),i.view.removeEventListener("mousemove",m),function(e){var r=t.imageResizeKey.getState(e.state),i=r.rect,s=r.dragging,l=r.nodePosition;if(s&&i){var u=e.state.selection;if(u instanceof o.NodeSelection){var f=u.node.attrs,p=i.width,m=i.height,g=void 0;if(c.test(f.style||"")){var v=a.changeStylesString(f.style,{style:"width",value:d,newValue:p+"px"}),h=a.changeStylesString(v.style||"",{style:"height",value:d,newValue:m+"px"}).style;g=n.__assign({},f,{style:h})}else g=n.__assign({},f,{width:p,height:m});var y=u.node.type.createAndFill(g);if(y){var k=e.state.tr;k.replaceWith(l,l+1,y),k.setSelection(o.NodeSelection.create(k.doc,l)),k.setMeta("commandName","image-resize"),k.setMeta("args",g),k.setMeta(t.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:l}),e.dispatch(k)}}}}(e)})),r.view.addEventListener("mousemove",m),!0};t.imageResizing=function(e){return void 0===e&&(e={node:"image",lockRatio:!0}),new o.Plugin({key:t.imageResizeKey,view:function(r){return{resize:function(){t.imageResizeKey.getState(r.state).rect&&r.dispatch(r.state.tr.setMeta("resize",!0))},get window(){return r.dom.ownerDocument&&r.dom.ownerDocument.defaultView},attachResize:function(){var e=this.window;e&&(e.removeEventListener("resize",this.resize),e.addEventListener("resize",this.resize))},removeResize:function(){var e=this.window;e&&e.removeEventListener("resize",this.resize)},update:function(r,n){var i=r.state,a=i.selection,s=i.schema.nodes[e.node],l=t.imageResizeKey.getState(i),u=l.rect;if(a instanceof o.NodeSelection&&s===a.node.type){var c=r.nodeDOM(a.from),d={top:c.offsetTop,left:c.offsetLeft,width:c.offsetWidth,height:c.offsetHeight};if(!n.selection.eq(a)||u&&(u.width!==d.width||u.height!==d.height||u.top!==d.top||u.left!==d.left)){var f=i.tr;f.setMeta(t.imageResizeKey,{rect:d,nodePosition:a.from}),r.dispatch(f),this.attachResize()}}else u&&(l.rect=null,l.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new f("",null,null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(t,r){return p(t,r,e)}},decorations:function(r){var n=r.selection,a=r.schema.nodes[e.node],s=t.imageResizeKey.getState(r).rect;if(s&&n instanceof o.NodeSelection&&a===n.node.type){var u=document.createElement("div");u.className="k-editor-resize-handles-wrapper",u.style.width=s.width+"px",u.style.height=s.height+"px",u.style.top=s.top+"px",u.style.left=s.left+"px";for(var c=0;c<l.length;c++){var d=document.createElement("div");d.className="k-editor-resize-handle "+l[c],d.setAttribute("data-direction",l[c]),u.appendChild(d)}return i.DecorationSet.create(r.doc,[i.Decoration.widget(r.selection.from+1,u)])}return i.DecorationSet.empty}}})}},function(e,t){e.exports=c},function(e,t){e.exports=d},function(e,t){e.exports=f}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("prosemirror-state"),require("tslib"),require("prosemirror-model"),require("prosemirror-transform"),require("prosemirror-view"),require("prosemirror-commands"),require("prosemirror-schema-list"),require("prosemirror-tables"),require("prosemirror-history"),require("prosemirror-inputrules"),require("prosemirror-dropcursor"),require("prosemirror-gapcursor"),require("prosemirror-keymap")):"function"==typeof define&&define.amd?define(["prosemirror-state","tslib","prosemirror-model","prosemirror-transform","prosemirror-view","prosemirror-commands","prosemirror-schema-list","prosemirror-tables","prosemirror-history","prosemirror-inputrules","prosemirror-dropcursor","prosemirror-gapcursor","prosemirror-keymap"],t):"object"==typeof exports?exports.KendoEditorCommon=t(require("prosemirror-state"),require("tslib"),require("prosemirror-model"),require("prosemirror-transform"),require("prosemirror-view"),require("prosemirror-commands"),require("prosemirror-schema-list"),require("prosemirror-tables"),require("prosemirror-history"),require("prosemirror-inputrules"),require("prosemirror-dropcursor"),require("prosemirror-gapcursor"),require("prosemirror-keymap")):e.KendoEditorCommon=t(e["prosemirror-state"],e.tslib,e["prosemirror-model"],e["prosemirror-transform"],e["prosemirror-view"],e["prosemirror-commands"],e["prosemirror-schema-list"],e["prosemirror-tables"],e["prosemirror-history"],e["prosemirror-inputrules"],e["prosemirror-dropcursor"],e["prosemirror-gapcursor"],e["prosemirror-keymap"])}(window,(function(e,t,r,n,o,i,a,s,l,c,u,d,f){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(0),i=r(9);t.changeStylesString=function(e,t){var r=t.style,n=t.value,o=t.newValue;if(!e)return{changed:!1,style:null};var i=e.split(/\s*;\s*/).filter((function(e){return Boolean(e)})),a=i.filter((function(e){var t=e.split(/\s*:\s*/);return!(t[0].toLowerCase()===r&&n.test(t[1]))}));return o&&a.push(r+": "+o),{style:a.join("; ")+(a.length?";":""),changed:Boolean(o)||a.length!==i.length}},t.canInsert=function(e,t){for(var r=e.selection.$from,n=r.depth;n>=0;n--){var o=r.index(n);if(r.node(n).canReplaceWith(o,o,t))return!0}return!1};var a=function(e){return e instanceof n.Node?e.type.name:e.name};t.findNthParentNodeOfType=function(e,t){return void 0===t&&(t=1),function(r){return function(e,t){return void 0===t&&(t=1),function(r){for(var n=r.$from,o=n.depth;o>0;o--){var i=n.node(o);if(e(i)&&0===(t-=1))return{depth:o,node:i}}}}((function(t){return a(t)===a(e)}),t)(r)}},t.insertNode=function(e,t){return function(r,n){var o=r.tr.replaceSelectionWith(e);t&&o.scrollIntoView(),n(o)}},t.hasSameMarkup=function(e,t,r,o){var a=n.Fragment.from(i.parseContent(e,r,o)),s=n.Fragment.from(i.parseContent(t,r,o));return a.eq(s)},t.getSelectionText=function(e){var t=e.selection;if(t instanceof o.TextSelection||t instanceof o.AllSelection){var r=t.content().content;return r.textBetween(0,r.size)}return""},t.getNodeFromSelection=function(e){if(e.selection instanceof o.NodeSelection)return e.selection.node},t.selectedLineTextOnly=function(e){var r="",n=!1,o=e.selection,i=e.doc,a=o.$from,s=o.$to,l=o.from,c=o.to;return a.sameParent(s)&&(i.nodesBetween(l,c,(function(e){n=n||e.isLeaf&&!e.isText})),n||(r=t.getSelectionText(e))),r},t.indentHtml=function(e){return e.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},t.shallowEqual=function(e,t){var r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((function(r){return e[r]===t[r]}))};var s={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i};t.expandSelection=function(e,t,r){if(!r.applyToWord||!e.selection.empty)return{state:e,dispatch:t};var n=!0===r.applyToWord?s:r.applyToWord,i=null,a=e.tr,l=e.selection,c=l.$head.nodeBefore,u=l.$head.nodeAfter;if(c&&"text"===c.type.name&&c.text&&u&&"text"===u.type.name&&u.text){var d=[];l.$head.parent.descendants((function(e,t){return d.push({node:e,pos:t}),!1}));for(var f=l.$head.parentOffset,p=d.findIndex((function(e){var t=e.node,r=e.pos;return r<=f&&r+t.nodeSize>=f})),m=d[p].node.text,g=!1,v=p-1;v>=0;v--){var h=d[v];!g&&h&&"text"===h.node.type.name?m=h.node.text+m:(g=!0,f-=h.node.nodeSize)}for(v=p+1;v<d.length;v++){if(!(h=d[v])||"text"!==h.node.type.name)break;m+=h.node.text}var y=m.substring(0,f),k=m.substring(f),b=n.before.exec(y),M=n.after.exec(k);if(b&&M){var x=b[0].length,_=M[0].length,S=i=l.from;a.setSelection(o.TextSelection.create(e.doc,S-x,S+_));return{state:{tr:a,selection:a.selection,doc:a.doc,storedMarks:null,schema:a.doc.type.schema},dispatch:function(e){e.setSelection(o.TextSelection.create(e.doc,i)),t(e)}}}}return{state:e,dispatch:t}},t.expandToWordWrap=function(e,r){return function(n,o,i){var a=t.expandSelection(n,o,r),s=a.state,l=a.dispatch;return e(r)(s,l)}}},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r(2);t.markApplies=function(e,t,r){for(var n=function(n){var o=t[n],i=o.$from,a=o.$to,s=0===i.depth&&e.type.allowsMarkType(r);if(e.nodesBetween(i.pos,a.pos,(function(e){if(s)return!1;s=e.inlineContent&&e.type.allowsMarkType(r)})),s)return{v:!0}},o=0;o<t.length;o++){var i=n(o);if(i)return i.v}return!1},t.toggleMark=function(e,r,n){return function(o,i){var a=o.selection,s=a.empty,l=a.$cursor,c=a.ranges;if(s&&!l||!t.markApplies(o.doc,c,e))return!1;if(i)if(l)e.isInSet(o.storedMarks||l.marks())?i(n.removeStoredMark(e)):i(n.addStoredMark(e.create(r)));else{for(var u=!1,d=0;!u&&d<c.length;d++){var f=c[d],p=f.$from,m=f.$to;u=o.doc.rangeHasMark(p.pos,m.pos,e)}for(d=0;d<c.length;d++){var g=c[d];p=g.$from,m=g.$to;u?n.removeMark(p.pos,m.pos,e):n.addMark(p.pos,m.pos,e.create(r))}i(n.scrollIntoView())}return!0}},t.removeMark=function(e,t,r,i){void 0===i&&(i=null);var a=[],s=0;return e.doc.nodesBetween(t,r,(function(e,n){if(e.isInline){s++;var l=null;if(i instanceof o.MarkType){var c=i.isInSet(e.marks);c&&(l=[c])}else i?i.isInSet(e.marks)&&(l=[i]):l=e.marks;if(l&&l.length)for(var u=Math.min(n+e.nodeSize,r),d=0;d<l.length;d++){for(var f=l[d],p=void 0,m=0;m<a.length;m++){var g=a[m];g.step===s-1&&f.eq(g.style)&&(p=g)}p?(p.to=u,p.step=s):a.push({style:f,from:Math.max(n,t),to:u,step:s})}}})),a.forEach((function(t){return e.step(new n.RemoveMarkStep(t.from,t.to,t.style))})),e},t.removeMarks=function(e,r,n,o){var i=r.selection,a=i.$cursor,s=i.ranges;if(o=o||r.tr,a)e.forEach((function(e){e.isInSet(r.storedMarks||a.marks())&&n(o.removeStoredMark(e))}));else{for(var l=function(r){var n=s[r],i=n.$from,a=n.$to;e.forEach((function(e){t.removeMark(o,i.pos,a.pos,e)}))},c=0;c<s.length;c++)l(c);n(o.scrollIntoView())}return!0};t.removeAllMarks=function(e){var r=(void 0===e?{}:e).except,n=void 0===r?[]:r;return function(e,r){var o,i=e.tr;t.cleanMarks(i,{except:(o=n,o instanceof Array?o:[o])}),i.docChanged&&r(i)}},t.cleanMarks=function(e,t){var r=t.except,n=e.doc,o=e.selection,i=n.type.schema,a=o.empty,s=o.ranges,l=(r||[]).map((function(e){return e.name}));if(!a){var c=Object.keys(i.marks).map((function(e){return i.marks[e]})).filter((function(e){return-1===l.indexOf(e.name)}));s.forEach((function(t){var r=t.$from,n=t.$to;c.forEach((function(t){return e.removeMark(r.pos,n.pos,t)}))}))}},t.hasMark=function(e,r){var n,o=e.schema.marks,i=(r.altMarks||[]).filter((function(e){return o[e]})),a=r.altStyle,s=e.selection,l=s.from,c=s.$from,u=s.to,d=s.empty,f=o[r.mark],p=e.doc,m=!1;return d?(n=e.storedMarks||c.marks(),m=f&&f.isInSet(n)||i.some((function(e){return o[e].isInSet(n)}))):m=f&&p.rangeHasMark(l,u,f)||i.some((function(e){return p.rangeHasMark(l,u,o[e])})),!m&&a&&o.style?t.selectionMarks(e,o.style).some((function(e){return null!==t.styleValue(e,a)})):Boolean(m)},t.styleValue=function(e,t){for(var r=(e&&e.attrs.style||"").split(/\s*;\s*/).filter((function(e){return Boolean(e)})),n=0;n<r.length;n++){var o=r[n].split(/\s*:\s*/);if(o[0].toLowerCase()===t.name&&t.value.test(o[1]))return o[1]}return null},t.selectionMarks=function(e,t){var r=e.selection,n=r.from,o=r.$from,i=r.to,a=r.empty,s=[];return a?s.push(t.isInSet(e.storedMarks||o.marks())):e.doc.nodesBetween(n,i,(function(e){e.isInline&&s.push(t.isInSet(e.marks))})),s},t.getMark=function(e,r){var n=t.selectionMarks(e,r),o=n.filter((function(e){return Boolean(e)}));return n.length===o.length?n[0]:void 0},t.getActiveMarks=function(e,r){var n=t.selectionMarks(e,r),o=n.filter((function(e){return Boolean(e)}));return{hasNodesWithoutMarks:n.length!==o.length,marks:o}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(3),i=r(4),a=r(2),s=r(0);t.changeTextBlock=function(e,t,r,n){if(!r.isTextblock)return!1;e.selection.ranges.forEach((function(o){var s=e.steps.length,l=o.$from.pos,c=o.$to.pos;e.doc.nodesBetween(l,c,(function(o,l){if(o.eq(t)&&o.isTextblock&&!o.hasMarkup(r,n)&&function(e,t,r){var n=e.resolve(t),o=n.index();return n.parent.canReplaceWith(o,o+1,r)}(e.doc,e.mapping.slice(s).map(l),r)){e.clearIncompatible(e.mapping.slice(s).map(l,1),r);var c=e.mapping.slice(s),u=c.map(l,1),d=c.map(l+o.nodeSize,1),f=new a.Slice(a.Fragment.from(r.create(n,null,o.marks)),0,0);return e.step(new i.ReplaceAroundStep(u,d,u+1,d-1,f,1,!0)),!1}}))}))},t.blockNodes=function(e,t){void 0===t&&(t={blocksInSelection:!1});var r=e.doc,n=e.selection,o=n.$from,i=n.ranges,a=t.blocksInSelection,l=[],c=n instanceof s.NodeSelection?n.node:void 0;return c?c.isBlock?(l.push(c),c.nodesBetween(0,c.content.size,(function(e){e.isBlock&&l.push(e)}))):!a&&o.parent&&o.parent.isBlock&&l.push(o.parent):i.forEach((function(e){var t=e.$from.pos,n=e.$to.pos;r.nodesBetween(t,n,(function(e,r,o,i){e.isBlock&&(!a||r>=t&&r+e.content.size+2<=n)&&l.push(e)}))})),l},t.formatBlockElements=function(e,r){return function(o,i){var a=t.blockNodes(o),s=o.schema.nodes,l=o.tr;l.setMeta("commandName",r),l.setMeta("args",{value:e}),a.forEach((function(r){if(r.type.isTextblock)if("p"===e){var o=r.attrs,i=o.level,a=n.__rest(o,["level"]);t.changeTextBlock(l,r,s.paragraph,a)}else if(/^h[1-6]$/i.test(e)){i=parseInt(e.substr(1),10);t.changeTextBlock(l,r,s.heading,n.__assign({},r.attrs,{level:i}))}else if("blockquote"===e){var c=r.attrs;i=c.level,a=n.__rest(c,["level"]);t.changeTextBlock(l,r,s.blockquote,a)}}));var c=l.docChanged;return c&&i(l.scrollIntoView()),c}},t.cleanTextBlockFormatting=function(e,r){void 0===r&&(r={blocksInSelection:!0});var o=e.doc,i=e.selection,a=r.blocksInSelection,s=r.blockNodeType;t.blockNodes({doc:o,selection:i},{blocksInSelection:a}).filter((function(e){return e.isTextblock})).forEach((function(r){var o=r.attrs||{},i=o.style,a=void 0===i?"":i,l=o.class,c=void 0===l?"":l,u=n.__rest(o,["style","class"]),d=s||r.type;(a||c||d!==r.type)&&t.changeTextBlock(e,r,d,u)}))},t.getBlockFormats=function(e){var r=t.blockNodes(e),n=e.schema.nodes,o=[];return r.forEach((function(e){e.type===n.paragraph?o.push("p"):e.type===n.heading?o.push("h"+e.attrs.level):e.type===n.blockquote&&o.push("blockquote")})),o},t.addStyles=function(e,t){var r,n,i=e.attrs.style;i&&t.forEach((function(e){n={style:e.name,value:/^.+$/,newValue:e.value},r=o.changeStylesString(i,n),i=r.changed?r.style:i}));return i=i||t.reduce((function(e,t){return(e&&t.value?e+" ":"")+t.value?t.name+": "+t.value+";":""}),""),Object.assign({},e.attrs,{style:i||null})},t.hasNode=function(e,t){var r=e.selection,n=r.from,o=r.to,i=!1;return e.doc.nodesBetween(n,o,(function(e){return!(i=i||e.type===t)})),i},t.parentBlockFormat=function(e){var r=t.getBlockFormats(e);return 1===new Set(r).size?r[0]:null},t.activeNode=function(e){return{tag:t.parentBlockFormat(e)||""}}},function(e,t){e.exports=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(0),i=r(10),a=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],s=function(e,t){var r=(e.ownerDocument||document).createElement(t);Array.from(e.rows).filter((function(e){return e.getAttribute(i.rowTypeAttr)===t})).forEach((function(e){e.removeAttribute(i.rowTypeAttr),r.appendChild(e)})),r.children.length&&e.appendChild(r)},l=function(e,t){var r=t.toUpperCase();e.filter((function(e){return e.nodeName===r})).forEach((function(e){Array.from(e.children).forEach((function(r){r.setAttribute(i.rowTypeAttr,t),e.parentNode&&e.parentNode.insertBefore(r,e)})),e.remove()}))};t.trimWhitespace=function(e,t){void 0===t&&(t=a);var r=t.join("|");return e.replace(new RegExp("\\s*(<(?:"+r+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+r+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},t.htmlToFragment=function(e){var t,r=document.createElement("template");if("content"in r)r.innerHTML=e,t=r.content;else{var n=(new DOMParser).parseFromString(e,"text/html");t=document.createDocumentFragment();for(var o=n.body;o&&o.firstChild;)t.appendChild(o.firstChild)}return t},t.pmDocToFragment=function(e){var t=n.DOMSerializer.fromSchema(e.type.schema).serializeFragment(e.content);return function(e){Array.from(e.querySelectorAll("table")).forEach((function(e){s(e,"thead"),s(e,"tbody"),s(e,"tfoot");var t=Array.from(e.children).find((function(e){return 0===e.children.length}));t&&t.remove()}))}(t),t},t.domToPmDoc=function(e,t,r){return n.DOMParser.fromSchema(t).parse(e,r)},t.parseContent=function(e,r,n){var o,a=t.htmlToFragment(e);return o=a,Array.from(o.querySelectorAll("table")).forEach((function(e){var t=Array.from(e.children);t.some((function(e){return"THEAD"===e.nodeName||"TFOOT"===e.nodeName}))&&(l(t,"thead"),l(t,"tbody"),l(t,"tfoot"));var r=t.find((function(e){return"COLGROUP"===e.nodeName}));r&&(e.setAttribute(i.colgroupAttr,r.outerHTML),r.remove())})),t.domToPmDoc(a,r,n)},t.getHtml=function(e){var r=t.pmDocToFragment(e.doc),n=document.createElement("div");return n.appendChild(r),n.innerHTML},t.setHtml=function(e,r,n){return void 0===r&&(r="setHTML"),void 0===n&&(n={preserveWhitespace:"full"}),function(i,a){return a(i.tr.setSelection(new o.AllSelection(i.doc)).replaceSelectionWith(t.parseContent(e,i.schema,n)).setMeta("commandName",r))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rowTypeAttr="k-parent-node",t.colgroupAttr="k-colgroup-data"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(4),i=r(3),a=r(6),s=function(e,t){var r=e.find((function(e){return"style"===e.type.name})),n=r&&r.attrs.style;return i.changeStylesString(n,t)},l=function(e,t,r,i,a){var l=a.create({style:i.style}),c=[],u=[],d=null,f=null;return e.doc.nodesBetween(t,r,(function(e,p,m){if(e.isInline){var g=e.marks;if(!l.isInSet(g)&&m.type.allowsMarkType(l.type)){var v=Math.max(p,t),h=Math.min(p+e.nodeSize,r),y=s(g,i);if(y.changed||i.newValue){for(var k=y.changed?{style:y.style||null}:{style:[i.style]+": "+i.newValue+";"},b=a.isInSet(g)?g.find((function(e){return"style"===e.type.name})):null,M=b?n.__assign({},b.attrs,k):k,x=a.create(M),_=x.addToSet(g),S=0;S<g.length;S++)g[S].isInSet(_)||(d&&d.to===v&&d.mark.eq(g[S])?d.to=h:(d=new o.RemoveMarkStep(v,h,g[S]),c.push(d)));var w=f&&f.to===v,T=w&&x.attrs.style===f.mark.attrs.style;w&&T?f.to=h:Object.keys(M).some((function(e){return null!==M[e]}))&&(f=new o.AddMarkStep(v,h,x),u.push(f))}}}})),c.forEach((function(t){return e.step(t)})),u.forEach((function(t){return e.step(t)})),c.length+u.length>0};t.getInlineStyles=function(e,t){var r=e.schema.marks.style;return(r?a.selectionMarks(e,r):[]).map((function(e){return a.styleValue(e,t)})).filter((function(e){return null!==e}))};var c=function(e,t){return function(r,o,c){var u=r.selection,d=u.empty,f=u.$cursor,p=u.ranges;if(d&&!f||!a.markApplies(r.doc,p,e))return!1;var m=!1;if(o){var g=c||r.tr;if(f){var v=r.storedMarks||f.marks();if(e.isInSet(v)){var h=s(v,t),y=v.find((function(e){return"style"===e.type.name})),k=n.__assign({},y?y.attrs:{},{style:h.style||null});if(i.shallowEqual(y.attrs,k))return!1;o(g.removeStoredMark(e)),Object.keys(k).some((function(e){return null!==k[e]}))&&o(g.addStoredMark(e.create(k))),m=!0}}else{for(var b=0;b<p.length;b++){var M=p[b],x=M.$from,_=M.$to;m=l(g,x.pos,_.pos,t,e)}m&&(g.scrollIntoView(),o(g))}}return m}};t.toggleInlineFormat=function(e,t,r){return function(n,o){var i=n.schema.marks,s=e.altStyle,l=e.altMarks,u=void 0===l?[]:l,d=e.mark,f=t||n.tr,p=!1,m=!1,g=function(){return m=!0};s&&i.style&&(p=c(i.style,{style:s.name,value:s.value})(n,g,f));var v=[d].concat(u).filter((function(e){return i[e]})).map((function(e){return a.hasMark(n,{mark:e})&&i[e]})).filter((function(e){return e}));return v.length?a.removeMarks(v,n,g,f):p||a.toggleMark(i[d],r,f)(n,g),m&&o(f),m}},t.applyInlineStyle=function(e,t){return function(r,o){var s=r.schema.marks.style,l={style:e.style,value:/^.+$/,newValue:e.value},u=r.tr;t&&u.setMeta("commandName",t),u.setMeta("args",e);var d=r.selection,f=d.empty,p=d.$cursor,m=d.ranges;if(f&&!p||!s||!a.markApplies(r.doc,m,s))return!1;if(p){var g=r.storedMarks||p.marks(),v=s.isInSet(g)?g.find((function(e){return"style"===e.type.name})):null,h={style:null};if(v&&v.attrs.style){var y=i.changeStylesString(v.attrs.style,l);y.changed&&y.style&&(h.style=y.style)}else l.newValue&&(h.style=[l.style]+": "+l.newValue+";");var k=v?n.__assign({},v.attrs,h):h;return Object.keys(k).some((function(e){return null!==k[e]}))?o(u.addStoredMark(s.create(k))):o(u.removeStoredMark(s)),!0}return c(s,l)(r,o,u)}}},function(e,t){e.exports=a},function(e,t){e.exports=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(15);t.indentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:n.__assign({},o.listsTypes)},t.outdentRules={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:n.__assign({},o.listsTypes)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t.listsTypes={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},t.orderedList={listType:t.listsTypes.orderedList,types:n.__assign({},t.listsTypes)},t.bulletList={listType:t.listsTypes.bulletList,types:n.__assign({},t.listsTypes)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8);t.blockquote=function(e,t){return n.wrapIn(e.schema.nodes.blockquote)(e,t)},t.liftBlockquote=function(e,t){var r=e.selection,n=r.$from,o=r.$to,i=e.schema.nodes.blockquote,a=e.doc,s=-1,l=n.blockRange(o);l&&a.nodesBetween(l.start,l.end,(function(e,t,r,n){e.type===i&&(s=t)}));var c=-1!==s;return t&&c&&t(e.tr.lift(l,a.resolve(s).depth)),c}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(2),i=r(0),a=r(4),s=r(8),l=r(12),c=r(15),u=function(e,t,r){for(var n=t.depth,o=e.nodes[r.bulletList],i=e.nodes[r.orderedList],a=e.nodes[r.listItem],s=t.depth;s>0;s--){var l=t.node(s);if(l.type!==o&&l.type!==i||(n=s),l.type!==o&&l.type!==i&&l.type!==a)break}return n-1};function d(e){return function(t,r,n){if(!n)return!1;var o,i=(t=n.state).schema.nodes[e.listType],a=t.selection,c=a.$from,u=a.$to,d=c.node(-2),f=c.node(-3),m=function(e,t,r,n){return 0===function(e,t,r){var n=Array(),o=function(e,t){var r=["blockquote","bulletList","orderedList"];if(1===t.depth)return t;var n=t.node(t.depth),o=t;for(;t.depth>=1;)t=e.resolve(t.before(t.depth)),(n=t.node(t.depth))&&-1!==r.indexOf(n.type.name)&&(o=t);return o}(e,t).depth,i=e.resolve(t.start(o));for(;i.pos<=r.start(r.depth);){var a=Math.min(i.depth,o),s=i.node(a);if(s&&n.push(s),0===a)break;var l=e.resolve(i.after(a));if(l.start(a)>=e.nodeSize-2)break;l.depth!==i.depth&&(l=e.resolve(l.pos+2)),i=l.depth?e.resolve(l.start(l.depth)):e.resolve(l.end(l.depth))}return n}(e,t,r).filter((function(e){return e.type!==n})).length}(t.doc,c,u,i);return(d&&d.type===i||f&&f.type===i)&&m?p(e)(t,r):(m||(p(e)(t,r),t=n.state),(o=i,s.autoJoin(l.wrapInList(o),(function(e,t){return e.type===t.type&&e.type===o})))(t,r))}}function f(e,t,r,n){n||(n=e.schema.nodes.listItem);var i=t.$from,s=t.$to,l=i.blockRange(s,(function(e){return e.childCount&&e.firstChild.type===n}));if(!l||l.depth<2||i.node(l.depth-1).type!==n)return r;var c=l.end,u=s.end(l.depth);return c<u&&(r.step(new a.ReplaceAroundStep(c-1,u,c,u,new o.Slice(o.Fragment.from(n.create(void 0,l.parent.copy())),1,0),1,!0)),l=new o.NodeRange(r.doc.resolve(i.pos),r.doc.resolve(u),l.depth)),r.lift(l,a.liftTarget(l)).scrollIntoView()}function p(e){return function(t,r){var n=t.tr,o=t.selection,s=o.$from,l=o.$to;return n.doc.nodesBetween(s.pos,l.pos,(function(r,o){if(r.isTextblock||"blockquote"===r.type.name||"div"===r.type.name){var s=new i.NodeSelection(n.doc.resolve(n.mapping.map(o))),l=s.$from.blockRange(s.$to);if(!l||s.$from.parent.type!==t.schema.nodes[e.listItem])return!1;var c=l&&a.liftTarget(l);if(null==c)return!1;n.lift(l,c)}})),r&&r(n),!0}}t.toggleList=function(e,t,r,n,o){var a=n.listType,s=e.selection,l=s.$from.node(s.$from.depth-2),c=s.$to.node(s.$to.depth-2);if(l&&l.type.name===a&&c&&c.type.name===a){var p=r.state.schema.nodes,m={bulletList:p[n.bulletList],orderedList:p[n.orderedList],listItem:p[n.listItem]},g=function(e,t){for(var r,n=t.bulletList,o=t.orderedList,i=t.listItem,a=e.depth-1;a>0;a--){var s=e.node(a);if(s.type!==n&&s.type!==o||(r=a),s.type!==n&&s.type!==o&&s.type!==i)break}return r}(s.$to,m),v=function(e,t,r,n,o,a){a||(a=e.schema.nodes.listItem);var s=!1;return o.doc.nodesBetween(t,r,(function(r,l){if(!s&&r.type===a&&l>t){s=!0;for(var c=n+3;c>n+2;){var u=o.doc.resolve(o.mapping.map(l));c=u.depth;var d=o.doc.resolve(o.mapping.map(l+r.textContent.length)),p=new i.TextSelection(u,d);o=f(e,p,o,a)}}})),o}(e,s.$to.pos,s.$to.end(g),g,r.state.tr,m.listItem);return(v=function(e,t,r){var n=e.selection,o=n.from,i=n.to,a=e.schema.nodes,s=a.paragraph,l=a.heading,c=[];t.doc.nodesBetween(o,i,(function(e,t){e.type!==s&&e.type!==l||c.push({node:e,pos:t})}));for(var d=c.length-1;d>=0;d--){var f=c[d],p=t.doc.resolve(t.mapping.map(f.pos));if(p.depth>0){var m=void 0;m=f.node.textContent&&f.node.textContent.length>0?t.doc.resolve(t.mapping.map(f.pos+f.node.textContent.length)):t.doc.resolve(t.mapping.map(f.pos+1));var g=p.blockRange(m);g&&t.lift(g,u(e.schema,p,r))}}return t}(e,v,n)).setMeta("commandName",o),t(v),!0}return d(n)(e,t,r)},t.toggleUnorderedList=function(e,r,o){return t.toggleList(e,r,o,n.__assign({listType:c.bulletList.listType},c.bulletList.types))},t.toggleOrderedList=function(e,r,o){return t.toggleList(e,r,o,n.__assign({listType:c.orderedList.listType},c.orderedList.types))},t.splitListItemKeepMarks=function(e){return function(t,r){return l.splitListItem(e)(t,(function(e){var n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();n&&e.ensureMarks(n),r(e)}))}}},function(e,t){e.exports=l},function(e,t){e.exports=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bold={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},t.italic={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},t.underline={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},t.strikethrough={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},t.subscript={mark:"sub"},t.superscript={mark:"sup"},t.link={mark:"link"},t.unlink={mark:"link"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,o=function(e){return/^MsoListParagraph/.test(e.className)},i=function(e){var t=e.innerHTML;return t=(t=t.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},a=function(e,t){var r=document.createElement(e);return r.style.listStyleType=t,r},s=function(e){var t=null;return/^\d/.test(e)||(t=(/^[a-z]/.test(e)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(e)?"roman":"alpha")),t},l=function(e,t){var r=[];Array.from(e).forEach((function(e){if(e.nodeType===Node.ELEMENT_NODE){var n=e;n.getAttribute("datalist")?(r.push(e),t.add(r)):o(n)&&r.length?r.push(e):(r=[],"DIV"===n.nodeName?l(n.children,t):"TABLE"===n.nodeName&&Array.from(n.querySelectorAll("td,th")).forEach((function(e){l(e.children,t)})))}}))},c=function(e){var t,r=e.innerHTML,n=function(e){return e.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/,"")};return r=r.replace(/<\/?\w+[^>]*>/g,"").replace(/&nbsp;/g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(r)?{tag:"ul",style:(t=n(i(e)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(t)?null:/^o/.test(t)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(r)?{tag:"ol",style:s(n(i(e)))}:void 0},u=function(e){var t,r=e.nodeName.toLowerCase();e.firstChild&&e.firstChild.nodeType===Node.COMMENT_NODE&&e.removeChild(e.firstChild),1===e.childNodes.length?t=e.firstChild.nodeType===Node.TEXT_NODE?i(e):e.firstChild.innerHTML.replace(/^\w+[\.\)](&nbsp;)+ /,""):(e.removeChild(e.firstChild),3===e.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(e.firstChild.nodeValue)&&e.removeChild(e.firstChild),/^(&nbsp;|\s)+$/i.test(e.firstChild.innerHTML)&&e.removeChild(e.firstChild),t="p"!==r?"<"+r+">"+e.innerHTML+"</"+r+">":e.innerHTML),e.parentNode.removeChild(e);var n=document.createElement("li");return n.innerHTML=t,n};t.convertMsLists=function(e){var t=document.createElement("div");t.innerHTML=function(e){return e=e.replace(n,(function(e,t,r){return'datalist="'+t+'" datalevel="'+r+'" '+e}))}(e);var r=new Set;return l(t.children,r),r.forEach((function(e){return function(e){var t,r,n,i,s,l,d,f,p,m,g,v,h,y=-1,k={};for(f=0;f<e.length;f++){var b=(h={datalist:(p=e[f]).getAttribute("datalist"),datalevel:p.getAttribute("datalevel")}).datalist,M=c(p);if(m=M&&M.tag){if(g=h.datalevel||parseFloat(p.style.marginLeft||0),h.datalevel||p.style.marginLeft){var x=m+b;k[g]||(k[g]={}),(!r||r<0)&&(r=g,n=b,i=(d=e.filter((function(e){return e.getAttribute("datalist")===String(n)})))[d.length-1],l=a(m,M&&M.style),p.parentNode.insertBefore(l,p),y=g,k[g][x]=l),s=i===p,v=k[g][x],(g>y||!v)&&(v=a(m,M&&M.style),k[g][x]=v,t.appendChild(v)),t=u(p),v.appendChild(t),s?r=y=-1:y=g}}else!t||s&&!o(p)||(p.style.marginLeft&&(p.style.marginLeft=""),p.style.marginLeft&&(p.style.margin=""),t.appendChild(p))}}(e)})),t.innerHTML}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(9);t.getHtml=o.getHtml,t.setHtml=o.setHtml,t.parseContent=o.parseContent,t.trimWhitespace=o.trimWhitespace,t.htmlToFragment=o.htmlToFragment,t.domToPmDoc=o.domToPmDoc,t.pmDocToFragment=o.pmDocToFragment;var i=r(11);t.applyInlineStyle=i.applyInlineStyle,t.getInlineStyles=i.getInlineStyles,t.toggleInlineFormat=i.toggleInlineFormat;var a=r(23);t.applyLink=a.applyLink,t.removeLink=a.removeLink;var s=r(24);t.insertText=s.insertText;var l=r(25);t.insertImage=l.insertImage;var c=r(26);t.alignBlocks=c.alignBlocks,t.isAligned=c.isAligned;var u=r(27);t.cleanFormatting=u.cleanFormatting;var d=r(7);t.hasNode=d.hasNode,t.activeNode=d.activeNode,t.formatBlockElements=d.formatBlockElements,t.getBlockFormats=d.getBlockFormats,t.parentBlockFormat=d.parentBlockFormat,t.changeTextBlock=d.changeTextBlock,t.blockNodes=d.blockNodes,t.cleanTextBlockFormatting=d.cleanTextBlockFormatting;var f=r(6);t.hasMark=f.hasMark,t.getMark=f.getMark,t.getActiveMarks=f.getActiveMarks,t.removeAllMarks=f.removeAllMarks,t.cleanMarks=f.cleanMarks,t.selectionMarks=f.selectionMarks;var p=r(28);t.indent=p.indent,t.canIndentAsListItem=p.canIndentAsListItem,t.outdent=p.outdent,t.canOutdentAsListItem=p.canOutdentAsListItem,t.isIndented=p.isIndented,t.canBeIndented=p.canBeIndented,t.indentBlocks=p.indentBlocks;var m=r(17);t.toggleOrderedList=m.toggleOrderedList,t.toggleUnorderedList=m.toggleUnorderedList,t.toggleList=m.toggleList;var g=r(16);t.blockquote=g.blockquote,t.liftBlockquote=g.liftBlockquote;var v=r(3);t.hasSameMarkup=v.hasSameMarkup,t.getSelectionText=v.getSelectionText,t.getNodeFromSelection=v.getNodeFromSelection,t.selectedLineTextOnly=v.selectedLineTextOnly,t.expandSelection=v.expandSelection,t.expandToWordWrap=v.expandToWordWrap,t.canInsert=v.canInsert,t.insertNode=v.insertNode,t.indentHtml=v.indentHtml;var h=r(29);t.alignLeftRules=h.alignLeftRules,t.alignCenterRules=h.alignCenterRules,t.alignRightRules=h.alignRightRules,t.alignJustifyRules=h.alignJustifyRules,t.alignRemoveRules=h.alignRemoveRules;var y=r(14);t.indentRules=y.indentRules,t.outdentRules=y.outdentRules;var k=r(30);t.nodes=k.nodes,t.marks=k.marks;var b=r(31);t.buildKeymap=b.buildKeymap,t.buildListKeymap=b.buildListKeymap;var M=r(20);t.bold=M.bold,t.italic=M.italic,t.underline=M.underline,t.strikethrough=M.strikethrough,t.subscript=M.subscript,t.superscript=M.superscript,t.link=M.link;var x=r(32);t.sanitize=x.sanitize,t.removeComments=x.removeComments,t.removeTag=x.removeTag,t.pasteCleanup=x.pasteCleanup,t.sanitizeClassAttr=x.sanitizeClassAttr,t.sanitizeStyleAttr=x.sanitizeStyleAttr,t.removeAttribute=x.removeAttribute,t.replaceImageSourcesFromRtf=x.replaceImageSourcesFromRtf;var _=r(21);t.convertMsLists=_.convertMsLists;var S=r(33);t.find=S.find,t.findAt=S.findAt,t.findAll=S.findAll,t.replace=S.replace,t.replaceAll=S.replaceAll;var w=r(34);t.placeholder=w.placeholder;var T=r(35);t.spacesFix=T.spacesFix;var A=r(36);t.textHighlight=A.textHighlight,t.textHighlightKey=A.textHighlightKey;var O=r(37);t.imageResizing=O.imageResizing,t.imageResizeKey=O.imageResizeKey,n.__exportStar(r(8),t),n.__exportStar(r(38),t),n.__exportStar(r(39),t),n.__exportStar(r(18),t),n.__exportStar(r(19),t),n.__exportStar(r(40),t),n.__exportStar(r(2),t),n.__exportStar(r(12),t),n.__exportStar(r(0),t),n.__exportStar(r(13),t),n.__exportStar(r(4),t),n.__exportStar(r(5),t);var I=r(41);t.createTable=I.createTable,t.addRowAfter=I.addRowAfter,t.addRowBefore=I.addRowBefore,t.pmAddRowAfter=I.pmAddRowAfter,t.pmAddRowBefore=I.pmAddRowBefore},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11),o=r(6),i=r(0);t.removeLink=function(e,t){return function(r,i){var a=r.selection.$cursor;if(a){var s=a.parent,l=a.index(),c=r.schema.marks[e.mark],u=s.child(l).marks.find((function(e){return e.type===c})),d=s.childCount,f=a.pos-a.textOffset,p=s.child(l).nodeSize,m=void 0,g=void 0;for(m=l-1;m>=0&&u.isInSet(s.child(m).marks);)p+=g=s.child(m).nodeSize,f-=g,m-=1;for(m=l+1;m<d&&u.isInSet(s.child(m).marks);)p+=s.child(m).nodeSize,m+=1;i(o.removeMark(t||r.tr,f,f+p,u))}else n.toggleInlineFormat(e,t)(r,i)}};t.applyLink=function(e,r){var a=e.mark,s=e.attrs;return void 0===r&&(r="link"),function(e,l){var c=e.schema.marks,u=e.tr;r&&(u.setMeta("commandName",r),u.setMeta("args",s));var d=!1,f=function(){return d=!0};if(function(e,t){var r=o.selectionMarks(e,t);return 1===r.length&&r[0]?r[0]:null}(e,c[a]))!function(e,t){return function(r,n){var o=r.selection,i=o.$cursor,a=o.from,s=o.to,l=r.schema.marks[e.mark];if(i){var c=i.parent,u=i.index(),d=c.child(u).marks.find((function(e){return e.type===l})),f=c.childCount,p=i.pos-i.textOffset,m=c.child(u).nodeSize,g=void 0,v=void 0;for(g=u-1;g>=0&&d.isInSet(c.child(g).marks);)m+=v=c.child(g).nodeSize,p-=v,g-=1;for(g=u+1;g<f&&d.isInSet(c.child(g).marks);)m+=c.child(g).nodeSize,g+=1;t.removeMark(p,p+m,l),t.addMark(p,p+m,l.create(e.attrs)),n(t)}else t.doc.nodesBetween(a,s,(function(r,o){r.isInline&&l.isInSet(r.marks)&&(t.removeMark(o,o+r.nodeSize,l),t.addMark(o,o+r.nodeSize,l.create(e.attrs)),n(t))}))}}({mark:a,attrs:s},u)(e,f);else{var p=e;o.hasMark(e,{mark:a})&&(t.removeLink({mark:a,attrs:s},u)(e,f),p=i.EditorState.create({doc:u.doc,selection:u.selection})),d?o.toggleMark(c[a],s,u)(p,f):n.toggleInlineFormat({mark:a},u,s)(p,f)}return d&&l(u),d}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertText=function(e){return function(t,r){r(t.tr.insertText(e.text,e.from,e.to))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);t.insertImage=function(e){return function(t,r){var o=t.schema.nodes.image,i=o.createAndFill(e);n.insertNode(i)(t,(function(t){return r(t.setMeta("commandName","insertImage").setMeta("args",e))}))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.alignBlocks=function(e,t){return function(r,o){var i=n.blockNodes(r),a=r.tr;a.setMeta("commandName",t),i.forEach((function(t){if(t.type.isTextblock){var r={},o=e.find((function(e){return e.node===t.type.name}));o&&(r=n.addStyles(t,o.style)),n.changeTextBlock(a,t,t.type,r)}}));var s=a.docChanged;return s&&o(a.scrollIntoView()),s}},t.isAligned=function(e,t){var r=n.blockNodes(e),o=!1;return r.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var r=t.find((function(t){return t.node===e.type.name}));r&&(o=r.style.every((function(t){return!!t.value&&new RegExp(t.name+":\\s?"+t.value,"i").test(e.attrs.style)})))}})),o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),o=r(6);t.cleanFormatting=function(e){return void 0===e&&(e={blocksInSelection:!0}),function(t,r){var i=t.tr,a=e.blocksInSelection,s=e.blockNodeType,l=(e.exceptMarks||[t.schema.marks.link]).filter(Boolean);o.cleanMarks(i,{except:l}),n.cleanTextBlockFormatting(i,{blocksInSelection:a,blockNodeType:s});var c=i.docChanged;return c&&r&&r(i),c}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),o=r(14),i=r(7),a=r(3),s=r(16);t.indentBlocks=function(e,t,r){return function(n,o){var a=i.blockNodes(n),s=n.tr;s.setMeta("commandName",t),a.forEach((function(t){if(t.type.isTextblock){var n=void 0,o=e.find((function(e){return e.node===t.type.name}));if(o){var a="rtl"===r?o.rtlStyle:o.style,l={name:a,value:o.step>0?""+o.step+o.unit:""};if(t.attrs.style){var c=new RegExp(a+":\\s?(\\d+)"+o.unit,"i"),u=t.attrs.style.match(c);if(u){var d=parseFloat(u[1])+o.step;d=d<=0?"":d,l.value=""+d+(d?o.unit:"")}}n=i.addStyles(t,[l])}n&&i.changeTextBlock(s,t,t.type,n)}}));var l=s.docChanged;return l&&o(s.scrollIntoView()),l}},t.isIndented=function(e,t,r){var n=i.blockNodes(e),o=!1;return n.forEach((function(e){if(!o&&e.type.isTextblock&&e.attrs.style){var n=t.find((function(t){return t.node===e.type.name}));if(n){var i="rtl"===r?n.rtlStyle:n.style,a=new RegExp(i+":\\s?\\d+"+n.unit,"i");o=a.test(e.attrs.style)}}})),o},t.canIndentAsListItem=function(e,t){return n.sinkListItem(t)(e)},t.canOutdentAsListItem=function(e,t){var r=e.schema.nodes[t.listsTypes.listItem],o=e.schema.nodes[t.listsTypes.orderedList],i=e.schema.nodes[t.listsTypes.bulletList],s=!!a.findNthParentNodeOfType(o,2)(e.selection),l=!!a.findNthParentNodeOfType(i,2)(e.selection);return(s||l)&&n.liftListItem(r)(e)},t.canBeIndented=function(e,r){var n=e.schema.nodes,a=n[o.indentRules.listsTypes.listItem];return(t.isIndented(e,r.nodes)||o.indentRules.nodes.some((function(t){return n[t.node]&&i.hasNode(e,n[t.node])})))&&!i.hasNode(e,a)},t.indent=function(e,r){var i=e.schema.nodes[o.indentRules.listsTypes.listItem],a=t.canBeIndented(e,o.indentRules);t.canIndentAsListItem(e,i)?n.sinkListItem(i)(e,r):a&&t.indentBlocks(o.indentRules.nodes)(e,r)},t.outdent=function(e,r){var a=e.schema.nodes,l=a[o.outdentRules.listsTypes.listItem],c=t.canBeIndented(e,o.outdentRules);i.hasNode(e,a.blockquote)?s.liftBlockquote(e,r):t.canOutdentAsListItem(e,o.outdentRules)?n.liftListItem(l)(e,r):c&&t.indentBlocks(o.outdentRules.nodes)(e,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return{name:e,value:t}};t.alignLeftRules=[{node:"paragraph",style:[n("text-align","left")]},{node:"heading",style:[n("text-align","left")]}],t.alignRightRules=[{node:"paragraph",style:[n("text-align","right")]},{node:"heading",style:[n("text-align","right")]}],t.alignCenterRules=[{node:"paragraph",style:[n("text-align","center")]},{node:"heading",style:[n("text-align","center")]}],t.alignJustifyRules=[{node:"paragraph",style:[n("text-align","justify")]},{node:"heading",style:[n("text-align","justify")]}],t.alignRemoveRules=[{node:"paragraph",style:[n("text-align","")]},{node:"heading",style:[n("text-align","")]}]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(2),i=r(13),a=r(9),s=r(10),l=["blockquote",0],c=["hr"],u=["pre",["code",0]],d=["ol",0],f=["ul",0],p=["li",0],m=function(e){for(var t,r={},n=e.attributes,o=0;o<n.length;o++)r[(t=n[o]).name]=t.value;return r},g=function(e){var t={};return e.forEach((function(e){t[e]={default:null}})),t},v=function(){return g(["style","class","id"])},h=function(e,t){for(var r in e)if(r&&null!==e[r]&&r!==t)return!0;return!1},y=function(e,t){var r={};for(var n in e)n&&null!==e[n]&&n!==t&&(r[n]=e[n]);return r},k=function(e){var t;return(t={})[e]={name:e,inclusive:!0,parseDOM:[{tag:e}],toDOM:function(){return[e,0]}},t},b=n.__assign({link:{attrs:n.__assign({},v(),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:m}],toDOM:function(e){return["a",y(e.attrs),0]}}},k("strong"),k("b"),k("em"),k("i"),k("u"),k("del"),k("sub"),k("sup"),k("code"),{style:{attrs:n.__assign({},v()),parseDOM:[{tag:"span",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["span",y(e.attrs),0]:["span",0]}}});t.marks=b;var M=function(e){var t;return(t={})[e]={default:null,getFromDOM:function(t){return t.getAttribute(e)},setDOMAttr:function(t,r){r[e]=t}},t},x=n.__assign({},M("style"),M("class"),M("id"),M("headers")),_={doc:{content:"colgroup*"},col:{attrs:g(["id","class","style","span"]),parseDOM:[{getAttrs:m,tag:"col"}],toDOM:function(e){return["col",e.attrs]}},colgroup:{attrs:g(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:m,tag:"colgroup"}],toDOM:function(e){return["colgroup",e.attrs,0]}},text:{inline:!0,group:"inline"}},S=new o.Schema({nodes:_,marks:{}}),w=i.tableNodes({tableGroup:"block",cellContent:"block+",cellAttributes:x});w.table_row.attrs=n.__assign({},w.table_row.attrs,g([s.rowTypeAttr,"style","class","id"])),w.table_row.toDOM=function(e){return["tr",y(e.attrs),0]},w.table_row.parseDOM=[{tag:"tr",getAttrs:m}],w.table.attrs=n.__assign({},w.table.attrs,g(["style","class","id",s.colgroupAttr])),w.table.toDOM=function(e){var t=h(e.attrs)?y(e.attrs,s.colgroupAttr):{},r=null;if(e.attrs[s.colgroupAttr]&&!function(e){for(var t=!1,r=e.child(0),n=0;n<r.childCount;n++){if(r.child(n).attrs.colwidth){t=!0;break}}return t}(e)){var n=a.domToPmDoc(a.htmlToFragment(e.attrs[s.colgroupAttr]),S,{preserveWhitespace:!1}),o=a.pmDocToFragment(n).firstChild;if(o){var i=Array.from(o.children).map((function(e){return["col",m(e)]}));r=["colgroup",m(o)].concat(i)}}return r?["table",t,r,["tbody",0]]:["table",t,["tbody",0]]},w.table.parseDOM=[{tag:"table",getAttrs:function(e){var t=m(e),r=Array.from(e.childNodes).find((function(e){return"COLGROUP"===e.nodeName}));return r&&(t[s.colgroupAttr]=r.outerHTML),t}}];var T=n.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:n.__assign({},v()),parseDOM:[{tag:"p",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["p",y(e.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:n.__assign({},v()),parseDOM:[{tag:"div",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["div",y(e.attrs),0]:["div",0]}},blockquote:{attrs:n.__assign({},v()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["blockquote",y(e.attrs),0]:l}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return c}},heading:{attrs:n.__assign({},v(),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(e){return n.__assign({},m(e),{level:1})}},{tag:"h2",getAttrs:function(e){return n.__assign({},m(e),{level:2})}},{tag:"h3",getAttrs:function(e){return n.__assign({},m(e),{level:3})}},{tag:"h4",getAttrs:function(e){return n.__assign({},m(e),{level:4})}},{tag:"h5",getAttrs:function(e){return n.__assign({},m(e),{level:5})}},{tag:"h6",getAttrs:function(e){return n.__assign({},m(e),{level:6})}}],toDOM:function(e){return h(e.attrs,"level")?["h"+e.attrs.level,y(e.attrs,"level"),0]:["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return u}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:n.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},v()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["img",y(e.attrs)]:["img"]}},hard_break:{inline:!0,attrs:n.__assign({},v()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["br",y(e.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:n.__assign({},v(),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(e){return n.__assign({},m(e),{order:e.hasAttribute("start")?parseInt(e.getAttribute("start")||"1",10):1})}}],toDOM:function(e){return 1===e.attrs.order?h(e.attrs,"order")?["ol",y(e.attrs,"order"),0]:d:["ol",n.__assign({},y(e.attrs,"order"),{start:e.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:n.__assign({},v()),parseDOM:[{tag:"ul",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["ul",y(e.attrs),0]:f}},list_item:{content:"(paragraph | heading) block*",attrs:n.__assign({},v()),parseDOM:[{tag:"li",getAttrs:m}],toDOM:function(e){return h(e.attrs)?["li",y(e.attrs),0]:p},defining:!0}},w);t.nodes=T},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(8),i=r(18),a=r(19),s=r(17),l=r(20),c=r(11),u=r(3),d="undefined"!=typeof navigator&&/Mac/.test(navigator.platform);t.buildKeymap=function(e,t){var r={},s=t&&t.applyToWord||!1;if(r["Mod-z"]=i.undo,r["Shift-Mod-z"]=i.redo,r.Backspace=o.chainCommands(a.undoInputRule,o.deleteSelection,o.joinBackward,o.selectNodeBackward),r.Enter=o.chainCommands(o.newlineInCode,o.createParagraphNear,o.liftEmptyBlock,o.splitBlockKeepMarks),d||(r["Mod-y"]=i.redo),e.marks.strong&&(r["Mod-b"]=u.expandToWordWrap(c.toggleInlineFormat,n.__assign({},l.bold,{applyToWord:s}))),e.marks.em&&(r["Mod-i"]=u.expandToWordWrap(c.toggleInlineFormat,n.__assign({},l.italic,{applyToWord:s}))),e.marks.u&&(r["Mod-u"]=u.expandToWordWrap(c.toggleInlineFormat,n.__assign({},l.underline,{applyToWord:s}))),e.nodes.hard_break){var f=e.nodes.hard_break,p=o.chainCommands(o.exitCode,(function(e,t){return t(e.tr.replaceSelectionWith(f.create()).scrollIntoView()),!0}));r["Shift-Enter"]=p}return r},t.buildListKeymap=function(e){var t={};return e.nodes.list_item&&(t.Enter=s.splitListItemKeepMarks(e.nodes.list_item)),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(21);t.sanitize=function(e){return e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},t.removeComments=function(e){return e.replace(/<!--[\s\S]+?-->/g,"")},t.removeTag=function(e,t){return e.replace(new RegExp("<\\/?("+t+")(?:\\s[^>]*?)?>","gi"),"")},t.removeAttribute=function(e){e.ownerElement&&e.ownerElement.removeAttribute(e.name)},t.sanitizeClassAttr=function(e){/^Mso/.test(e.value)&&t.removeAttribute(e)};var o=/\s*;\s*/,i=/\s*:\s*/;t.sanitizeStyleAttr=function(e){var r,n,a=e.value.split(o).filter((function(e){return Boolean(e)})),s=e.ownerElement.style,l="";a.forEach((function(e){var t;t=e.split(i),r=t[0],n=t[1],void 0!==s[r]&&(l+=r+": "+n+"; ")})),(l=l.trim())?e.value=l:t.removeAttribute(e)};function a(e){for(var t=e.length,r=new Array(t/2),n=0;n<t;n+=2)r[n]=String.fromCharCode(parseInt(e.substring(n,n+2),16));return btoa(r.join(""))}t.pasteCleanup=function(e,r){var o=e;if(r.convertMsLists&&(o=n.convertMsLists(o)),r.stripTags&&(o=t.removeTag(o,r.stripTags)),r.attributes){var i=document.createElement("div");i.innerHTML=o,Array.from(i.querySelectorAll("*")).forEach((function(e){return function(e,t){if(e.nodeType===Node.ELEMENT_NODE){for(var r=e.attributes.length-1;r>=0;r--){var n=e.attributes[r];t[n.name]?t[n.name](n):t["*"]&&t["*"](n)}"SPAN"===e.nodeName&&0===e.attributes.length&&function(e){var t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}(e)}}(e,r.attributes)})),o=i.innerHTML}return o};var s=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,l=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,c=new RegExp("(?:("+l.source+"))([\\da-fA-F\\s]+)\\}","g"),u=/[^\da-fA-F]/g,d=/file:\/[^'"]+\.(jpg|png|gif)/i,f=/\\(png|jpeg)blip\\/;t.replaceImageSourcesFromRtf=function(e,t){var r=e.match(s);if(!r||-1===t.types.indexOf("text/rtf"))return e;var n=t.getData("text/rtf"),o=[],i=n.match(c);if(!n||!i)return e;for(var p=0,m=i;p<m.length;p++){var g=m[p],v=f.exec(g);if(v){var h=g.replace(l,"").replace(u,"");o.push("data:image/"+v[1]+";base64,"+a(h))}}return r.length!==o.length?e:e.replace(s,(function(e){var t=o.shift()||"";return e.replace(d,t)}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0);t.findAt=function(e,t,r,n,i){var l,c,u,d,f,p,m=[],g=[],v=t.matchCase,h=t.matchWord,y=t.useRegExp,k=t.text;if(y&&(/^\\$/.test(k)||/[^\\]\\$/.test(k))&&(k=k.substring(0,k.length-1)),!k)return m;var b=v?"g":"gi",M=y?new RegExp(k,b):s(k,b);return e.nodesBetween(r,n,(function(t,s,v){if(i(m))return!1;t.inlineContent&&s+t.content.size>=r&&(g.length=0,t.nodesBetween(0,t.content.size,(function(t,v,y,k){if(i(m))return!1;var b=1+s+v;if(t.isText&&b+t.nodeSize>=r){if(f=t.text||"",p=y.childCount-1>=k+1&&y.child(k+1),g.push(r<=b?{text:f,start:b}:{text:f.slice(r-b),start:r}),p&&p.isText)return;for(c=g.map((function(e){return e.text})).join(""),l=M.exec(c);null!==l&&(u=g[0].start+l.index,d=u+l[0].length,r<=u&&n>=d&&a(l,h)&&m.push(o.TextSelection.create(e,u,d)),!i(m));)l=M.exec(c)}else g.length=0})))})),m},t.find=function(e,r){var o=r.backward,i=r.matchCyclic,a=n.__rest(r,["backward","matchCyclic"]),s=o?function(){return!1}:function(e){return e.length>0},l=e.doc,c=e.selection,u=[];return o?!(u=t.findAt(l,a,0,c.from,s)).length&&i&&(u=t.findAt(l,a,c.from,l.content.size,s)):!(u=t.findAt(l,a,c.to,l.content.size,s)).length&&i&&(u=t.findAt(l,a,0,c.to,s)),u.length?u[u.length-1]:null},t.findAll=function(e,r){return t.findAt(e,r,0,e.content.size,(function(){return!1}))},t.replace=function(e,t,r){var n=e.from,i=e.to;return r.insertText(t,n,i).setSelection(o.TextSelection.create(r.doc,n,n+t.length)),r},t.replaceAll=function(e,r,n){var o=t.findAll(e.doc,n);if(0===o.length)return null;for(var i=e.tr,a=o.length-1;a>=0;a--)i.insertText(r,o[a].from,o[a].to);return i};var i=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,a=function(e,t){if(t){if(!0===t){var r=e.input,n=r.charAt(e.index-1),o=r.charAt(e.index+e[0].length);return i.test(n)&&i.test(o)}return t(e)}return!0},s=function(e,t){var r=e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(r,t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5);t.placeholder=function(e){var t={class:"k-placeholder","data-placeholder":e};return new n.Plugin({key:new n.PluginKey("placeholder"),props:{decorations:function(e){var r=e.doc,n=r.content.firstChild;if(!(0===r.childCount||1===r.childCount&&n.inlineContent&&0===n.childCount))return o.DecorationSet.empty;var i=[];return r.descendants((function(e,r){i.push(o.Decoration.node(r,r+e.nodeSize,t))})),o.DecorationSet.create(r,i)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5),i=/\s+/g,a=/text-align/;t.spacesFix=function(){return new n.Plugin({key:new n.PluginKey("spaces-fix"),props:{decorations:function(e){var t,r,n,s,l=[],c=e.doc;return c.nodesBetween(0,c.content.size,(function(e,c,u){if(e.type.isText&&function(e){return a.test(e&&e.attrs&&e.attrs.style||"")}(u))for(r=i.exec(e.text||"");null!==r;){if(t=c+r.index,n=r[0].length,r.index+n<r.input.length)for(s=0;s<=n-1;s+=2)l.push(o.Decoration.inline(t+s,t+s+1,{style:"white-space: normal"}));r=i.exec(e.text||"")}})),o.DecorationSet.create(c,l)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5);t.textHighlightKey=new n.PluginKey("highlight"),t.textHighlight=function(e){return void 0===e&&(e=t.textHighlightKey),new n.Plugin({key:e,state:{init:function(){return null},apply:function(e){return e.getMeta(this.spec.key)}},props:{decorations:function(e){var t=(this.spec.key.getState(e)||[]).map((function(e){return o.Decoration.inline(e.from,e.to,e.attrs)}));return o.DecorationSet.create(e.doc,t)}}})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0),i=r(5),a=r(3);t.imageResizeKey=new o.PluginKey("image-resize");var s={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},l=Object.keys(s),c=function(e,t,r){e.style[t]=r+"px"},u=/[^\-]width:|[^\-]height:/,d=/^.+$/,f=function(){function e(e,t,r,n){this.activeHandle=e,this.dragging=t,this.rect=r,this.nodePosition=n}return e.prototype.apply=function(r){var n=r.getMeta(t.imageResizeKey);return n?new e(n.activeHandle,n.setDragging,n.rect,n.nodePosition):this},e}(),p=function(e,r,i){var l=r.target.getAttribute("data-direction");if(!l)return!1;var f=t.imageResizeKey.getState(e.state);r.preventDefault();var p=e.state.tr;function m(r){!function(e,r,n){var o=t.imageResizeKey.getState(e.state),i=o.rect,a=o.dragging,l=o.nodePosition,u=o.activeHandle;if(a&&i){var d=e.nodeDOM(l),f=s[u],p=(r.clientX-a.startX)*f.x,m=(r.clientY-a.startY)*f.y,g=f.x?p+d.width:i.width,v=f.y?m+d.height:i.height;if(n.lockRatio&&f.x&&f.y){var h=Math.min(g/d.width,v/d.height),y=d.width*h,k=d.height*h;a.startX=r.clientX-(g-y)*f.x,a.startY=r.clientY-(v-k)*f.y,g=y,v=k}else a.startX=f.x?r.clientX:a.startX,a.startY=f.y?r.clientY:a.startY;c(d,"width",g),c(d,"height",v),i.top=d.offsetTop,i.left=d.offsetLeft,i.width=d.offsetWidth,i.height=d.offsetHeight;var b=d.nextElementSibling;b.style.width=i.width+"px",b.style.height=i.height+"px",b.style.top=i.top+"px",b.style.left=i.left+"px"}}(e,r,i)}return p.setMeta(t.imageResizeKey,{setDragging:{startX:r.clientX,startY:r.clientY},activeHandle:l,rect:f.rect,nodePosition:f.nodePosition}),p.setMeta("addToHistory",!1),e.dispatch(p),r.view.addEventListener("mouseup",(function r(i){i.view.removeEventListener("mouseup",r),i.view.removeEventListener("mousemove",m),function(e){var r=t.imageResizeKey.getState(e.state),i=r.rect,s=r.dragging,l=r.nodePosition;if(s&&i){var c=e.state.selection;if(c instanceof o.NodeSelection){var f=c.node.attrs,p=i.width,m=i.height,g=void 0;if(u.test(f.style||"")){var v=a.changeStylesString(f.style,{style:"width",value:d,newValue:p+"px"}),h=a.changeStylesString(v.style||"",{style:"height",value:d,newValue:m+"px"}).style;g=n.__assign({},f,{style:h})}else g=n.__assign({},f,{width:p,height:m});var y=c.node.type.createAndFill(g);if(y){var k=e.state.tr;k.replaceWith(l,l+1,y),k.setSelection(o.NodeSelection.create(k.doc,l)),k.setMeta("commandName","image-resize"),k.setMeta("args",g),k.setMeta(t.imageResizeKey,{setDragging:null,activeHandle:null,rect:i,nodePosition:l}),e.dispatch(k)}}}}(e)})),r.view.addEventListener("mousemove",m),!0};t.imageResizing=function(e){return void 0===e&&(e={node:"image",lockRatio:!0}),new o.Plugin({key:t.imageResizeKey,view:function(r){return{resize:function(){t.imageResizeKey.getState(r.state).rect&&r.dispatch(r.state.tr.setMeta("resize",!0))},get window(){return r.dom.ownerDocument&&r.dom.ownerDocument.defaultView},attachResize:function(){var e=this.window;e&&(e.removeEventListener("resize",this.resize),e.addEventListener("resize",this.resize))},removeResize:function(){var e=this.window;e&&e.removeEventListener("resize",this.resize)},update:function(r,n){var i=r.state,a=i.selection,s=i.schema.nodes[e.node],l=t.imageResizeKey.getState(i),c=l.rect;if(a instanceof o.NodeSelection&&s===a.node.type){var u=r.nodeDOM(a.from),d={top:u.offsetTop,left:u.offsetLeft,width:u.offsetWidth,height:u.offsetHeight};if(!n.selection.eq(a)||c&&(c.width!==d.width||c.height!==d.height||c.top!==d.top||c.left!==d.left)){var f=i.tr;f.setMeta(t.imageResizeKey,{rect:d,nodePosition:a.from}),r.dispatch(f),this.attachResize()}}else c&&(l.rect=null,l.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new f("",null,null,-1)},apply:function(e,t){return t.apply(e)}},props:{handleDOMEvents:{mousedown:function(t,r){return p(t,r,e)}},decorations:function(r){var n=r.selection,a=r.schema.nodes[e.node],s=t.imageResizeKey.getState(r).rect;if(s&&n instanceof o.NodeSelection&&a===n.node.type){var c=document.createElement("div");c.className="k-editor-resize-handles-wrapper",c.style.width=s.width+"px",c.style.height=s.height+"px",c.style.top=s.top+"px",c.style.left=s.left+"px";for(var u=0;u<l.length;u++){var d=document.createElement("div");d.className="k-editor-resize-handle "+l[u],d.setAttribute("data-direction",l[u]),c.appendChild(d)}return i.DecorationSet.create(r.doc,[i.Decoration.widget(r.selection.from+1,c)])}return i.DecorationSet.empty}}})}},function(e,t){e.exports=u},function(e,t){e.exports=d},function(e,t){e.exports=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);t.pmAddRowAfter=n.addRowAfter,t.pmAddRowBefore=n.addRowBefore;var o=r(10);t.createTable=function(e,t,r){for(var n,o=e.table,i=e.table_row,a=e.table_cell,s=[],l=0;l<t+1;l++){n=[];for(var c=0;c<r+1;c++)n.push(a.createAndFill());s.push(i.createAndFill(void 0,n))}return o.createAndFill(void 0,s)};var i=function(e,t){for(var r=e.$head,n=r.depth;n>0;n--){var o=r.node(n);if(o.type.name===t)return{pos:r.before(n),node:o}}return null};t.addRowBefore=function(e,t){var r=t&&function(e){var r,n=i(e.selection,"table_row"),a=i(e.selection,"table");if(n&&a&&n.node.attrs[o.rowTypeAttr]){for(var s=0,l=0;l<a.node.nodeSize;l++)if(a.node.child(l).eq(n.node)){s=l;break}var c=a.node.child(s-1),u=n.pos-c.nodeSize;e.setNodeMarkup(u,void 0,((r={})[o.rowTypeAttr]=n.node.attrs[o.rowTypeAttr],r))}return t(e)};return n.addRowBefore(e,r)},t.addRowAfter=function(e,t){var r=t&&function(e){var r,n=i(e.selection,"table_row");if(n&&n.node.attrs[o.rowTypeAttr]){var a=n.pos+n.node.nodeSize;e.setNodeMarkup(a,void 0,((r={})[o.rowTypeAttr]=n.node.attrs[o.rowTypeAttr],r))}return t(e)};return n.addRowAfter(e,r)}}])}));
@@ -0,0 +1,2 @@
1
+ export var rowTypeAttr = 'k-parent-node';
2
+ export var colgroupAttr = 'k-colgroup-data';
@@ -1,9 +1,12 @@
1
1
  import * as tslib_1 from "tslib";
2
+ import { Schema } from 'prosemirror-model';
2
3
  import { tableNodes } from 'prosemirror-tables';
4
+ import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source';
5
+ import { rowTypeAttr, colgroupAttr } from './constants';
3
6
  var hole = 0;
4
7
  var blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['code', hole]];
5
8
  var olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
6
- var getAttributes = function (dom) {
9
+ var domAttributes = function (dom) {
7
10
  var result = {};
8
11
  var attributes = dom.attributes, attr;
9
12
  for (var i = 0; i < attributes.length; i++) {
@@ -12,13 +15,14 @@ var getAttributes = function (dom) {
12
15
  }
13
16
  return result;
14
17
  };
15
- var commonAttributes = function () {
16
- return {
17
- style: { default: null },
18
- class: { default: null },
19
- id: { default: null }
20
- };
18
+ var defaultAttrs = function (attrs) {
19
+ var nodeAttrs = {};
20
+ attrs.forEach(function (attr) {
21
+ nodeAttrs[attr] = { default: null };
22
+ });
23
+ return nodeAttrs;
21
24
  };
25
+ var commonAttributes = function () { return defaultAttrs(['style', 'class', 'id']); };
22
26
  var hasAttrs = function (attrs, exclude) {
23
27
  for (var attr in attrs) {
24
28
  if (attr && attrs[attr] !== null && attr !== exclude) {
@@ -27,7 +31,7 @@ var hasAttrs = function (attrs, exclude) {
27
31
  }
28
32
  return false;
29
33
  };
30
- var getAttrs = function (attrs, exclude) {
34
+ var pmAttributes = function (attrs, exclude) {
31
35
  var result = {};
32
36
  for (var attr in attrs) {
33
37
  if (attr && attrs[attr] !== null && attr !== exclude) {
@@ -54,17 +58,91 @@ var marks = tslib_1.__assign({
54
58
  link: {
55
59
  attrs: tslib_1.__assign({}, commonAttributes(), { href: { default: null }, target: { default: null }, title: { default: null } }),
56
60
  inclusive: false,
57
- parseDOM: [{ tag: 'a', getAttrs: getAttributes }],
58
- toDOM: function (node) { return ['a', getAttrs(node.attrs), hole]; }
61
+ parseDOM: [{ tag: 'a', getAttrs: domAttributes }],
62
+ toDOM: function (node) { return ['a', pmAttributes(node.attrs), hole]; }
59
63
  } }, tagMark('strong'), tagMark('b'), tagMark('em'), tagMark('i'), tagMark('u'), tagMark('del'), tagMark('sub'), tagMark('sup'), tagMark('code'), { style: {
60
64
  attrs: tslib_1.__assign({}, commonAttributes()),
61
65
  parseDOM: [{
62
66
  tag: 'span',
63
- getAttrs: getAttributes
67
+ getAttrs: domAttributes
64
68
  }],
65
69
  toDOM: function (node) { return hasAttrs(node.attrs) ?
66
- ['span', getAttrs(node.attrs), hole] : ['span', hole]; }
70
+ ['span', pmAttributes(node.attrs), hole] : ['span', hole]; }
67
71
  } });
72
+ var cellAttribute = function (name) {
73
+ var _a;
74
+ return _a = {},
75
+ _a[name] = {
76
+ default: null,
77
+ getFromDOM: function (cell) { return cell.getAttribute(name); },
78
+ setDOMAttr: function (value, attrs) { attrs[name] = value; }
79
+ },
80
+ _a;
81
+ };
82
+ var cellAttributes = tslib_1.__assign({}, cellAttribute('style'), cellAttribute('class'), cellAttribute('id'), cellAttribute('headers'));
83
+ var colgroupNodes = {
84
+ doc: { content: 'colgroup*' },
85
+ col: {
86
+ attrs: defaultAttrs(['id', 'class', 'style', 'span']),
87
+ parseDOM: [{ getAttrs: domAttributes, tag: 'col' }],
88
+ toDOM: function (node) { return ['col', node.attrs]; }
89
+ },
90
+ colgroup: {
91
+ attrs: defaultAttrs(['id', 'class', 'style', 'span']),
92
+ content: 'col*',
93
+ parseDOM: [{ getAttrs: domAttributes, tag: 'colgroup' }],
94
+ toDOM: function (node) { return ['colgroup', node.attrs, 0]; }
95
+ },
96
+ text: { inline: true, group: 'inline' }
97
+ };
98
+ var colgroupSchema = new Schema({ nodes: colgroupNodes, marks: {} });
99
+ // will be removed when we implement our own columnResizing
100
+ var shouldSkipColgroup = function (node) {
101
+ var shouldSkip = false;
102
+ var row = node.child(0);
103
+ for (var r = 0; r < row.childCount; r++) {
104
+ var cell = row.child(r);
105
+ if (cell.attrs.colwidth) {
106
+ shouldSkip = true;
107
+ break;
108
+ }
109
+ }
110
+ return shouldSkip;
111
+ };
112
+ var tNodes = tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes: cellAttributes });
113
+ tNodes.table_row.attrs = tslib_1.__assign({}, tNodes.table_row.attrs, defaultAttrs([rowTypeAttr, 'style', 'class', 'id']));
114
+ tNodes.table_row.toDOM = function (node) { return ['tr', pmAttributes(node.attrs), 0]; };
115
+ tNodes.table_row.parseDOM = [{ tag: 'tr', getAttrs: domAttributes }];
116
+ tNodes.table.attrs = tslib_1.__assign({}, tNodes.table.attrs, defaultAttrs(['style', 'class', 'id', colgroupAttr]));
117
+ tNodes.table.toDOM = function (node) {
118
+ var tableAttrs = hasAttrs(node.attrs) ? pmAttributes(node.attrs, colgroupAttr) : {};
119
+ var colgroup = null;
120
+ if (node.attrs[colgroupAttr] && !shouldSkipColgroup(node)) {
121
+ var doc = domToPmDoc(htmlToFragment(node.attrs[colgroupAttr]), colgroupSchema, { preserveWhitespace: false });
122
+ var fragment = pmDocToFragment(doc);
123
+ var colgroupEl = fragment.firstChild;
124
+ if (colgroupEl) {
125
+ var cols = Array.from(colgroupEl.children).map(function (c) { return ['col', domAttributes(c)]; });
126
+ colgroup = [
127
+ 'colgroup',
128
+ domAttributes(colgroupEl)
129
+ ].concat(cols);
130
+ }
131
+ }
132
+ return colgroup ? ['table', tableAttrs, colgroup, ['tbody', 0]] :
133
+ ['table', tableAttrs, ['tbody', 0]];
134
+ };
135
+ tNodes.table.parseDOM = [{
136
+ tag: 'table',
137
+ getAttrs: function (node) {
138
+ var attrs = domAttributes(node);
139
+ var colgroup = Array.from(node.childNodes).find(function (c) { return c.nodeName === 'COLGROUP'; });
140
+ if (colgroup) {
141
+ attrs[colgroupAttr] = colgroup.outerHTML;
142
+ }
143
+ return attrs;
144
+ }
145
+ }];
68
146
  var nodes = tslib_1.__assign({
69
147
  // :: NodeSpec The top level document node.
70
148
  doc: {
@@ -78,9 +156,9 @@ var nodes = tslib_1.__assign({
78
156
  attrs: tslib_1.__assign({}, commonAttributes()),
79
157
  parseDOM: [{
80
158
  tag: 'p',
81
- getAttrs: getAttributes
159
+ getAttrs: domAttributes
82
160
  }],
83
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['p', getAttrs(node.attrs), hole] : ['p', hole]; }
161
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]; }
84
162
  }, div: {
85
163
  // Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
86
164
  // content: '(block | inline)*',
@@ -89,9 +167,9 @@ var nodes = tslib_1.__assign({
89
167
  attrs: tslib_1.__assign({}, commonAttributes()),
90
168
  parseDOM: [{
91
169
  tag: 'div',
92
- getAttrs: getAttributes
170
+ getAttrs: domAttributes
93
171
  }],
94
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', getAttrs(node.attrs), hole] : ['div', hole]; }
172
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
95
173
  },
96
174
  // :: NodeSpec A blockquote (`<blockquote>`) wrapping one or more blocks.
97
175
  blockquote: {
@@ -101,9 +179,9 @@ var nodes = tslib_1.__assign({
101
179
  defining: true,
102
180
  parseDOM: [{
103
181
  tag: 'blockquote',
104
- getAttrs: getAttributes
182
+ getAttrs: domAttributes
105
183
  }],
106
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['blockquote', getAttrs(node.attrs), hole] : blockquoteDOM; }
184
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['blockquote', pmAttributes(node.attrs), hole] : blockquoteDOM; }
107
185
  },
108
186
  // :: NodeSpec A horizontal rule (`<hr>`).
109
187
  horizontal_rule: {
@@ -120,15 +198,15 @@ var nodes = tslib_1.__assign({
120
198
  group: 'block',
121
199
  defining: true,
122
200
  parseDOM: [
123
- { tag: 'h1', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 1 })); } },
124
- { tag: 'h2', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 2 })); } },
125
- { tag: 'h3', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 3 })); } },
126
- { tag: 'h4', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 4 })); } },
127
- { tag: 'h5', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 5 })); } },
128
- { tag: 'h6', getAttrs: function (node) { return (tslib_1.__assign({}, getAttributes(node), { level: 6 })); } }
201
+ { tag: 'h1', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 1 })); } },
202
+ { tag: 'h2', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 2 })); } },
203
+ { tag: 'h3', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 3 })); } },
204
+ { tag: 'h4', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 4 })); } },
205
+ { tag: 'h5', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 5 })); } },
206
+ { tag: 'h6', getAttrs: function (node) { return (tslib_1.__assign({}, domAttributes(node), { level: 6 })); } }
129
207
  ],
130
208
  toDOM: function (node) { return hasAttrs(node.attrs, 'level') ?
131
- ['h' + node.attrs.level, getAttrs(node.attrs, 'level'), hole] :
209
+ ['h' + node.attrs.level, pmAttributes(node.attrs, 'level'), hole] :
132
210
  ['h' + node.attrs.level, hole]; }
133
211
  },
134
212
  // :: NodeSpec A code listing. Disallows marks or non-text inline
@@ -156,8 +234,8 @@ var nodes = tslib_1.__assign({
156
234
  attrs: tslib_1.__assign({ src: { default: null }, alt: { default: null }, title: { default: null }, width: { default: null }, height: { default: null } }, commonAttributes()),
157
235
  group: 'inline',
158
236
  draggable: true,
159
- parseDOM: [{ tag: 'img', getAttrs: getAttributes }],
160
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['img', getAttrs(node.attrs)] : ['img']; }
237
+ parseDOM: [{ tag: 'img', getAttrs: domAttributes }],
238
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['img', pmAttributes(node.attrs)] : ['img']; }
161
239
  },
162
240
  // :: NodeSpec A hard line break represented in the DOM as a `<br>` element.
163
241
  hard_break: {
@@ -167,9 +245,9 @@ var nodes = tslib_1.__assign({
167
245
  selectable: false,
168
246
  parseDOM: [{
169
247
  tag: 'br',
170
- getAttrs: getAttributes
248
+ getAttrs: domAttributes
171
249
  }],
172
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['br', getAttrs(node.attrs)] : ['br']; }
250
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['br', pmAttributes(node.attrs)] : ['br']; }
173
251
  },
174
252
  // :: NodeSpec
175
253
  // An ordered list [node spec](#model.NodeSpec). Has a single
@@ -181,12 +259,12 @@ var nodes = tslib_1.__assign({
181
259
  group: 'block',
182
260
  attrs: tslib_1.__assign({}, commonAttributes(), { type: { default: null }, order: { default: 1 } }),
183
261
  parseDOM: [{ tag: 'ol', getAttrs: function (dom) {
184
- return tslib_1.__assign({}, getAttributes(dom), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
262
+ return tslib_1.__assign({}, domAttributes(dom), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
185
263
  } }],
186
264
  toDOM: function (node) {
187
265
  return node.attrs.order === 1 ?
188
- (hasAttrs(node.attrs, 'order') ? ['ol', getAttrs(node.attrs, 'order'), hole] : olDOM) :
189
- ['ol', tslib_1.__assign({}, getAttrs(node.attrs, 'order'), { start: node.attrs.order }), hole];
266
+ (hasAttrs(node.attrs, 'order') ? ['ol', pmAttributes(node.attrs, 'order'), hole] : olDOM) :
267
+ ['ol', tslib_1.__assign({}, pmAttributes(node.attrs, 'order'), { start: node.attrs.order }), hole];
190
268
  }
191
269
  },
192
270
  // :: NodeSpec
@@ -195,16 +273,16 @@ var nodes = tslib_1.__assign({
195
273
  content: 'list_item+',
196
274
  group: 'block',
197
275
  attrs: tslib_1.__assign({}, commonAttributes()),
198
- parseDOM: [{ tag: 'ul', getAttrs: getAttributes }],
199
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['ul', getAttrs(node.attrs), hole] : ulDOM; }
276
+ parseDOM: [{ tag: 'ul', getAttrs: domAttributes }],
277
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['ul', pmAttributes(node.attrs), hole] : ulDOM; }
200
278
  },
201
279
  // :: NodeSpec
202
280
  // A list item (`<li>`) specification.
203
281
  list_item: {
204
282
  content: '(paragraph | heading) block*',
205
283
  attrs: tslib_1.__assign({}, commonAttributes()),
206
- parseDOM: [{ tag: 'li', getAttrs: getAttributes }],
207
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['li', getAttrs(node.attrs), hole] : liDOM; },
284
+ parseDOM: [{ tag: 'li', getAttrs: domAttributes }],
285
+ toDOM: function (node) { return hasAttrs(node.attrs) ? ['li', pmAttributes(node.attrs), hole] : liDOM; },
208
286
  defining: true
209
- } }, tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes: {} }));
287
+ } }, tNodes);
210
288
  export { nodes, marks };
package/dist/es/main.js CHANGED
@@ -18,7 +18,6 @@ export { buildKeymap, buildListKeymap } from './config/keymap';
18
18
  export { bold, italic, underline, strikethrough, subscript, superscript, link } from './config/commands';
19
19
  export { sanitize, removeComments, removeTag, pasteCleanup, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, replaceImageSourcesFromRtf } from './paste';
20
20
  export { convertMsLists } from './listConvert';
21
- export { createTable } from './table';
22
21
  export { find, findAt, findAll, replace, replaceAll } from './find-replace';
23
22
  export { placeholder } from './plugins/placeholder';
24
23
  export { spacesFix } from './plugins/spaces-fix';
@@ -37,3 +36,4 @@ export * from 'prosemirror-state';
37
36
  export * from 'prosemirror-tables';
38
37
  export * from 'prosemirror-transform';
39
38
  export * from 'prosemirror-view';
39
+ export { createTable, addRowAfter, addRowBefore, pmAddRowAfter, pmAddRowBefore } from './table';