opentiny 6.9.22 → 6.9.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentiny",
3
- "version": "6.9.22",
3
+ "version": "6.9.24",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mild-blue/opentiny"
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * TinyMCE version 7.0.0 (TBD)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),n=t("autolink_pattern"),o=t("link_default_target"),r=t("link_default_protocol"),a=t("allow_unsafe_link_target"),s=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(a=o.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var n,o,r,a})(e);const l=e=>undefined===e;const i=e=>!(e=>null==e)(e),c=Object.hasOwnProperty,d=e=>"\ufeff"===e;var u=tinymce.util.Tools.resolve("tinymce.dom.TextSeeker");const f=e=>3===e.nodeType,g=e=>1===e.nodeType,m=e=>/^[(\[{ \u00a0]$/.test(e),k=(e,t,n)=>{for(let o=t-1;o>=0;o--){const t=e.charAt(o);if(!d(t)&&n(t))return o}return-1},p=(e,t)=>{var o;const a=e.schema.getVoidElements(),s=n(e),{dom:i,selection:d}=e;if(null!==i.getParent(d.getNode(),"a[href]"))return null;const p=d.getRng(),y=u(i,e=>{return i.isBlock(e)||(t=a,n=e.nodeName.toLowerCase(),c.call(t,n))||"false"===i.getContentEditable(e);var t,n}),{container:w,offset:h}=((e,t)=>{let n=e,o=t;for(;g(n)&&n.childNodes[o];)n=n.childNodes[o],o=f(n)?n.data.length:n.childNodes.length;return{container:n,offset:o}})(p.endContainer,p.endOffset),v=null!==(o=i.getParent(w,i.isBlock))&&void 0!==o?o:i.getRoot(),_=y.backwards(w,h+t,(e,t)=>{const n=e.data,o=k(n,t,(r=m,e=>!r(e)));var r,a;return-1===o||(a=n[o],/[?!,.;:]/.test(a))?o:o+1},v);if(!_)return null;let A=_.container;const C=y.backwards(_.container,_.offset,(e,t)=>{A=e;const n=k(e.data,t,m);return-1===n?n:n+1},v),b=i.createRng();C?b.setStart(C.container,C.offset):b.setStart(A,0),b.setEnd(_.container,_.offset);const $=b.toString().replace(/\uFEFF/g,"").match(s);if($){let t=$[0];return E="www.",(x=t).length>=4&&x.substr(0,4)===E?t=r(e)+"://"+t:((e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!l(o)||r+t.length<=o)})(t,"@")&&!(e=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(e))(t)&&(t="mailto:"+t),{rng:b,url:t}}var x,E;return null},y=(e,t)=>{const{dom:n,selection:r}=e,{rng:l,url:i}=t,c=r.getBookmark();r.setRng(l);const d="createlink",u={command:d,ui:!1,value:i};if(!e.dispatch("BeforeExecCommand",u).isDefaultPrevented()){e.getDoc().execCommand(d,!1,i),e.dispatch("ExecCommand",u);const t=o(e);if(s(t)){const o=r.getNode();n.setAttrib(o,"target",t),"_blank"!==t||a(e)||n.setAttrib(o,"rel","noopener")}}r.moveToBookmark(c),e.nodeChanged()},w=e=>{const t=p(e,-1);i(t)&&y(e,t)},h=w;e.add("autolink",e=>{(e=>{const t=e.options.register;t("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"})})(e),(e=>{e.on("keydown",t=>{13!==t.keyCode||t.isDefaultPrevented()||(e=>{const t=p(e,0);i(t)&&y(e,t)})(e)}),e.on("keyup",t=>{32===t.keyCode?w(e):(48===t.keyCode&&t.shiftKey||221===t.keyCode)&&h(e)})})(e)})}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),n=t("autolink_pattern"),o=t("link_default_target"),r=t("link_default_protocol"),a=t("allow_unsafe_link_target"),s=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||(null===(a=o.constructor)||void 0===a?void 0:a.name)===r.name)?"string":t;var n,o,r,a})(e);const l=e=>void 0===e;const i=e=>!(e=>null==e)(e),c=Object.hasOwnProperty,d=e=>"\ufeff"===e;var u=tinymce.util.Tools.resolve("tinymce.dom.TextSeeker");const f=e=>3===e.nodeType,g=e=>1===e.nodeType,m=e=>/^[(\[{ \u00a0]$/.test(e),k=(e,t,n)=>{for(let o=t-1;o>=0;o--){const t=e.charAt(o);if(!d(t)&&n(t))return o}return-1},p=(e,t)=>{var o;const a=e.schema.getVoidElements(),s=n(e),{dom:i,selection:d}=e;if(null!==i.getParent(d.getNode(),"a[href]"))return null;const p=d.getRng(),y=u(i,e=>{return i.isBlock(e)||(t=a,n=e.nodeName.toLowerCase(),c.call(t,n))||"false"===i.getContentEditable(e);var t,n}),{container:w,offset:h}=((e,t)=>{let n=e,o=t;for(;g(n)&&n.childNodes[o];)n=n.childNodes[o],o=f(n)?n.data.length:n.childNodes.length;return{container:n,offset:o}})(p.endContainer,p.endOffset),v=null!==(o=i.getParent(w,i.isBlock))&&void 0!==o?o:i.getRoot(),_=y.backwards(w,h+t,(e,t)=>{const n=e.data,o=k(n,t,(r=m,e=>!r(e)));var r,a;return-1===o||(a=n[o],/[?!,.;:]/.test(a))?o:o+1},v);if(!_)return null;let A=_.container;const C=y.backwards(_.container,_.offset,(e,t)=>{A=e;const n=k(e.data,t,m);return-1===n?n:n+1},v),b=i.createRng();C?b.setStart(C.container,C.offset):b.setStart(A,0),b.setEnd(_.container,_.offset);const $=b.toString().replace(/\uFEFF/g,"").match(s);if($){let t=$[0];return E="www.",(x=t).length>=4&&x.substr(0,4)===E?t=r(e)+"://"+t:((e,t,n=0,o)=>{const r=e.indexOf(t,n);return-1!==r&&(!!l(o)||r+t.length<=o)})(t,"@")&&!(e=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(e))(t)&&(t="mailto:"+t),{rng:b,url:t}}var x,E;return null},y=(e,t)=>{const{dom:n,selection:r}=e,{rng:l,url:i}=t,c=r.getBookmark();r.setRng(l);const d="createlink",u={command:d,ui:!1,value:i};if(!e.dispatch("BeforeExecCommand",u).isDefaultPrevented()){e.getDoc().execCommand(d,!1,i),e.dispatch("ExecCommand",u);const t=o(e);if(s(t)){const o=r.getNode();n.setAttrib(o,"target",t),"_blank"!==t||a(e)||n.setAttrib(o,"rel","noopener")}}r.moveToBookmark(c),e.nodeChanged()},w=e=>{const t=p(e,-1);i(t)&&y(e,t)},h=w;e.add("autolink",e=>{(e=>{const t=e.options.register;t("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"})})(e),(e=>{e.on("keydown",t=>{13!==t.keyCode||t.isDefaultPrevented()||(e=>{const t=p(e,0);i(t)&&y(e,t)})(e)}),e.on("keyup",t=>{32===t.keyCode?w(e):(48===t.keyCode&&t.shiftKey||221===t.keyCode)&&h(e)})})(e)})}();
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * TinyMCE version 7.0.0 (TBD)
3
3
  */
4
- !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":e;var r,o,a,s})(t);const r=t=>undefined===t;var o=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),s=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=t=>{const e=/^(\d+)([ms]?)$/.exec(t);return(e&&e[2]?{s:1e3,m:6e4}[e[2]]:1)*parseInt(t,10)},i=t=>e=>e.options.get(t),u=i("autosave_ask_before_unload"),l=i("autosave_restore_when_empty"),c=i("autosave_interval"),d=i("autosave_retention"),m=t=>{const e=document.location;return t.options.get("autosave_prefix").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},v=(t,e)=>{if(r(e))return t.dom.isEmpty(t.getBody());{const r=s.trim(e);if(""===r)return!0;{const e=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(e)}}},f=t=>{var e;const r=parseInt(null!==(e=a.getItem(m(t)+"time"))&&void 0!==e?e:"0",10)||0;return!((new Date).getTime()-r>d(t)&&(p(t,!1),1))},p=(t,e)=>{const r=m(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&(t=>{t.dispatch("RemoveDraft")})(t)},g=t=>{const e=m(t);!v(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),(t=>{t.dispatch("StoreDraft")})(t))},y=t=>{var e;const r=m(t);f(t)&&(t.setContent(null!==(e=a.getItem(r+"draft"))&&void 0!==e?e:"",{format:"raw"}),(t=>{t.dispatch("RestoreDraft")})(t))};var D=tinymce.util.Tools.resolve("tinymce.EditorManager");const h=t=>e=>{e.setEnabled(f(t));const r=()=>e.setEnabled(f(t));return t.on("StoreDraft RestoreDraft RemoveDraft",r),()=>t.off("StoreDraft RestoreDraft RemoveDraft",r)};t.add("autosave",t=>((t=>{const r=t.options.register,o=t=>{const r=e(t);return r?{value:n(t),valid:r}:{valid:!1,message:"Must be a string."}};r("autosave_ask_before_unload",{processor:"boolean",default:!0}),r("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),r("autosave_restore_when_empty",{processor:"boolean",default:!1}),r("autosave_interval",{processor:o,default:"30s"}),r("autosave_retention",{processor:o,default:"20m"})})(t),(t=>{t.editorManager.on("BeforeUnload",t=>{let e;s.each(D.get(),t=>{t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)})})(t),(t=>{(t=>{const e=c(t);o.setEditorInterval(t,()=>{g(t)},e)})(t);const e=()=>{(t=>{t.undoManager.transact(()=>{y(t),p(t)}),t.focus()})(t)};t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)})})(t),t.on("init",()=>{l(t)&&t.dom.isEmpty(t.getBody())&&y(t)}),(t=>({hasDraft:()=>f(t),storeDraft:()=>g(t),restoreDraft:()=>y(t),removeDraft:e=>p(t,e),isEmpty:e=>v(t,e)}))(t)))}();
4
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":e;var r,o,a,s})(t);const r=t=>void 0===t;var o=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),s=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=t=>{const e=/^(\d+)([ms]?)$/.exec(t);return(e&&e[2]?{s:1e3,m:6e4}[e[2]]:1)*parseInt(t,10)},i=t=>e=>e.options.get(t),u=i("autosave_ask_before_unload"),l=i("autosave_restore_when_empty"),c=i("autosave_interval"),m=i("autosave_retention"),d=t=>{const e=document.location;return t.options.get("autosave_prefix").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},v=(t,e)=>{if(r(e))return t.dom.isEmpty(t.getBody());{const r=s.trim(e);if(""===r)return!0;{const e=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(e)}}},f=t=>{var e;const r=parseInt(null!==(e=a.getItem(d(t)+"time"))&&void 0!==e?e:"0",10)||0;return!((new Date).getTime()-r>m(t)&&(p(t,!1),1))},p=(t,e)=>{const r=d(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&(t=>{t.dispatch("RemoveDraft")})(t)},g=t=>{const e=d(t);!v(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),(t=>{t.dispatch("StoreDraft")})(t))},y=t=>{var e;const r=d(t);f(t)&&(t.setContent(null!==(e=a.getItem(r+"draft"))&&void 0!==e?e:"",{format:"raw"}),(t=>{t.dispatch("RestoreDraft")})(t))};var D=tinymce.util.Tools.resolve("tinymce.EditorManager");const h=t=>e=>{e.setEnabled(f(t));const r=()=>e.setEnabled(f(t));return t.on("StoreDraft RestoreDraft RemoveDraft",r),()=>t.off("StoreDraft RestoreDraft RemoveDraft",r)};t.add("autosave",t=>((t=>{const r=t.options.register,o=t=>{const r=e(t);return r?{value:n(t),valid:r}:{valid:!1,message:"Must be a string."}};r("autosave_ask_before_unload",{processor:"boolean",default:!0}),r("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),r("autosave_restore_when_empty",{processor:"boolean",default:!1}),r("autosave_interval",{processor:o,default:"30s"}),r("autosave_retention",{processor:o,default:"20m"})})(t),(t=>{t.editorManager.on("BeforeUnload",t=>{let e;s.each(D.get(),t=>{t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e&&(t.preventDefault(),t.returnValue=e)})})(t),(t=>{(t=>{const e=c(t);o.setEditorInterval(t,()=>{g(t)},e)})(t);const e=()=>{(t=>{t.undoManager.transact(()=>{y(t),p(t)}),t.focus()})(t)};t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:e,onSetup:h(t)})})(t),t.on("init",()=>{l(t)&&t.dom.isEmpty(t.getBody())&&y(t)}),(t=>({hasDraft:()=>f(t),storeDraft:()=>g(t),restoreDraft:()=>y(t),removeDraft:e=>p(t,e),isEmpty:e=>v(t,e)}))(t)))}();
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * TinyMCE version 7.0.0 (TBD)
3
3
  */
4
- !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");let t=0;const n=e=>{const n=(new Date).getTime(),a=Math.floor(1e9*Math.random());return t++,e+"_"+a+t+String(n)},a=e=>t=>t.options.get(e),r=a("help_tabs"),o=a("forced_plugins"),i=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=a=e,(r=String).prototype.isPrototypeOf(n)||(null===(o=a.constructor)||void 0===o?void 0:o.name)===r.name)?"string":t;var n,a,r,o})(e);const s=e=>undefined===e;const l=e=>"function"==typeof e,m=()=>false;class c{constructor(e,t){this.tag=e,this.value=t}static some(e){return new c(!0,e)}static none(){return c.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?c.some(e(this.value)):c.none()}bind(e){return this.tag?e(this.value):c.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:c.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return null==e?c.none():c.some(e)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}c.singletonNone=new c(!1);const u=Array.prototype.slice,p=Array.prototype.indexOf,y=(e,t)=>{const n=e.length,a=new Array(n);for(let r=0;r<n;r++){const n=e[r];a[r]=t(n,r)}return a},h=(e,t)=>{const n=[];for(let a=0,r=e.length;a<r;a++){const r=e[a];t(r,a)&&n.push(r)}return n},d=(e,t)=>{const n=u.call(e,0);return n.sort(t),n},g=Object.keys,k=Object.hasOwnProperty,v=(e,t)=>k.call(e,t);var b=tinymce.util.Tools.resolve("tinymce.Resource"),f=tinymce.util.Tools.resolve("tinymce.util.I18n");const A=(e,t)=>b.load(`tinymce.html-i18n.help-keynav.${t}`,`${e}/js/i18n/keynav/${t}.js`),w=e=>A(e,f.getCode()).catch(()=>A(e,"en"));var C=tinymce.util.Tools.resolve("tinymce.Env");const M=e=>{const t=C.os.isMacOS()||C.os.isiOS(),n=t?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl ",access:"Shift + Alt "},a=e.split("+"),r=y(a,e=>{const t=e.toLowerCase().trim();return v(n,t)?n[t]:e});return t?r.join("").replace(/\s/,""):r.join("+")},S=[{shortcuts:["Meta + B"],action:"Bold"},{shortcuts:["Meta + I"],action:"Italic"},{shortcuts:["Meta + U"],action:"Underline"},{shortcuts:["Meta + A"],action:"Select all"},{shortcuts:["Meta + Y","Meta + Shift + Z"],action:"Redo"},{shortcuts:["Meta + Z"],action:"Undo"},{shortcuts:["Access + 1"],action:"Heading 1"},{shortcuts:["Access + 2"],action:"Heading 2"},{shortcuts:["Access + 3"],action:"Heading 3"},{shortcuts:["Access + 4"],action:"Heading 4"},{shortcuts:["Access + 5"],action:"Heading 5"},{shortcuts:["Access + 6"],action:"Heading 6"},{shortcuts:["Access + 7"],action:"Paragraph"},{shortcuts:["Access + 8"],action:"Div"},{shortcuts:["Access + 9"],action:"Address"},{shortcuts:["Alt + 0"],action:"Open help dialog"},{shortcuts:["Alt + F9"],action:"Focus to menubar"},{shortcuts:["Alt + F10"],action:"Focus to toolbar"},{shortcuts:["Alt + F11"],action:"Focus to element path"},{shortcuts:["Ctrl + F9"],action:"Focus to contextual toolbar"},{shortcuts:["Shift + Enter"],action:"Open popup menu for split buttons"},{shortcuts:["Meta + K"],action:"Insert link (if link plugin activated)"},{shortcuts:["Meta + S"],action:"Save (if save plugin activated)"},{shortcuts:["Meta + F"],action:"Find (if searchreplace plugin activated)"},{shortcuts:["Meta + Shift + F"],action:"Switch to or from fullscreen mode"}],_=()=>({name:"shortcuts",title:"Handy Shortcuts",items:[{type:"table",header:["Action","Shortcut"],cells:y(S,e=>{const t=y(e.shortcuts,M).join(" or ");return[e.action,t]})}]}),x=y([{key:"accordion",name:"Accordion"},{key:"advlist",name:"Advanced List"},{key:"anchor",name:"Anchor"},{key:"autolink",name:"Autolink"},{key:"autoresize",name:"Autoresize"},{key:"autosave",name:"Autosave"},{key:"charmap",name:"Character Map"},{key:"code",name:"Code"},{key:"codesample",name:"Code Sample"},{key:"colorpicker",name:"Color Picker"},{key:"directionality",name:"Directionality"},{key:"emoticons",name:"Emoticons"},{key:"fullscreen",name:"Full Screen"},{key:"help",name:"Help"},{key:"image",name:"Image"},{key:"importcss",name:"Import CSS"},{key:"insertdatetime",name:"Insert Date/Time"},{key:"link",name:"Link"},{key:"lists",name:"Lists"},{key:"media",name:"Media"},{key:"nonbreaking",name:"Nonbreaking"},{key:"pagebreak",name:"Page Break"},{key:"preview",name:"Preview"},{key:"quickbars",name:"Quick Toolbars"},{key:"save",name:"Save"},{key:"searchreplace",name:"Search and Replace"},{key:"table",name:"Table"},{key:"textcolor",name:"Text Color"},{key:"visualblocks",name:"Visual Blocks"},{key:"visualchars",name:"Visual Characters"},{key:"wordcount",name:"Word Count"},{key:"a11ychecker",name:"Accessibility Checker",type:"premium"},{key:"typography",name:"Advanced Typography",type:"premium",slug:"advanced-typography"},{key:"ai",name:"AI Assistant",type:"premium"},{key:"casechange",name:"Case Change",type:"premium"},{key:"checklist",name:"Checklist",type:"premium"},{key:"advcode",name:"Enhanced Code Editor",type:"premium"},{key:"mediaembed",name:"Enhanced Media Embed",type:"premium",slug:"introduction-to-mediaembed"},{key:"advtable",name:"Enhanced Tables",type:"premium"},{key:"exportpdf",name:"Export to PDF",type:"premium"},{key:"exportword",name:"Export to Word",type:"premium"},{key:"footnotes",name:"Footnotes",type:"premium"},{key:"formatpainter",name:"Format Painter",type:"premium"},{key:"editimage",name:"Image Editing",type:"premium"},{key:"importword",name:"Import from Word",type:"premium"},{key:"inlinecss",name:"Inline CSS",type:"premium",slug:"inline-css"},{key:"linkchecker",name:"Link Checker",type:"premium"},{key:"markdown",name:"Markdown",type:"premium"},{key:"mentions",name:"Mentions",type:"premium"},{key:"mergetags",name:"Merge Tags",type:"premium"},{key:"pageembed",name:"Page Embed",type:"premium"},{key:"permanentpen",name:"Permanent Pen",type:"premium"},{key:"powerpaste",name:"PowerPaste",type:"premium",slug:"introduction-to-powerpaste"},{key:"revisionhistory",name:"Revision History",type:"premium"},{key:"tinymcespellchecker",name:"Spell Checker",type:"premium",slug:"introduction-to-tiny-spellchecker"},{key:"autocorrect",name:"Spelling Autocorrect",type:"premium"},{key:"tableofcontents",name:"Table of Contents",type:"premium"},{key:"advtemplate",name:"Templates",type:"premium",slug:"advanced-templates"},{key:"tinycomments",name:"Tiny Comments",type:"premium",slug:"introduction-to-tiny-comments"},{key:"tinydrive",name:"Tiny Drive",type:"premium",slug:"tinydrive-introduction"}],e=>({...e,type:e.type||"opensource",slug:e.slug||e.key})),T=e=>{const t=e=>`<a data-alloy-tabstop="true" tabindex="-1" href="${e.url}" target="_blank" rel="noopener">${e.name}</a>`,n=(e,n)=>{return(a=x,r=e=>e.key===n,((e,t,n)=>{for(let a=0,r=e.length;a<r;a++){const r=e[a];if(t(r,a))return c.some(r);if(n(r,a))break}return c.none()})(a,r,m)).fold(()=>((e,n)=>{const a=e.plugins[n].getMetadata;if(l(a)){const e=a();return{name:e.name,html:t(e)}}return{name:n,html:n}})(e,n),e=>{const n="premium"===e.type?`${e.name}*`:e.name;return{name:n,html:t({name:n,url:`https://www.tiny.cloud/docs/tinymce/7/${e.slug}/`})}});var a,r},a=e=>{const t=(e=>{const t=g(e.plugins),n=o(e);return s(n)?t:h(t,e=>!(((e,t)=>p.call(e,t))(n,e)>-1))})(e),a=d(y(t,t=>n(e,t)),(e,t)=>e.name.localeCompare(t.name)),r=y(a,e=>"<li>"+e.html+"</li>"),i=r.length,l=r.join("");return"<p><b>"+f.translate(["Plugins installed ({0}):",i])+"</b></p><ul>"+l+"</ul>"},r={type:"htmlpanel",presets:"document",html:[(e=>null==e?"":"<div>"+a(e)+"</div>")(e),(()=>{const e=h(x,({type:e})=>"premium"===e),t=d(y(e,e=>e.name),(e,t)=>e.localeCompare(t)),n=y(t,e=>`<li>${e}</li>`).join("");return"<div><p><b>"+f.translate("Premium plugins:")+"</b></p><ul>"+n+'<li class="tox-help__more-link" "><a href="https://www.tiny.cloud/pricing/?utm_campaign=help_dialog_plugin_tab&utm_source=tiny&utm_medium=referral&utm_term=read_more&utm_content=premium_plugin_heading" rel="noopener" target="_blank" data-alloy-tabstop="true" tabindex="-1">'+f.translate("Learn more...")+"</a></li></ul></div>"})()].join("")};return{name:"plugins",title:"Plugins",items:[r]}};var O=tinymce.util.Tools.resolve("tinymce.EditorManager");const P=(e,t,a)=>()=>{(async(e,t,a)=>{const o=_(),s=await(async e=>({name:"keyboardnav",title:"Keyboard Navigation",items:[{type:"htmlpanel",presets:"document",html:await w(e)}]}))(a),l=T(e),m=(()=>{var e,t;const n='<a data-alloy-tabstop="true" tabindex="-1" href="https://www.tiny.cloud/docs/tinymce/7/changelog/?utm_campaign=help_dialog_version_tab&utm_source=tiny&utm_medium=referral" rel="noopener" target="_blank">TinyMCE '+(e=O.majorVersion,t=O.minorVersion,(0===e.indexOf("@")?"X.X.X":e+"."+t)+"</a>");return{name:"versions",title:"Version",items:[{type:"htmlpanel",html:"<p>"+f.translate(["You are using {0}",n])+"</p>",presets:"document"}]}})(),u={[o.name]:o,[s.name]:s,[l.name]:l,[m.name]:m,...t.get()};return c.from(r(e)).fold(()=>(e=>{const t=g(e),n=t.indexOf("versions");return-1!==n&&(t.splice(n,1),t.push("versions")),{tabs:e,names:t}})(u),e=>((e,t)=>{const a={},r=y(e,e=>{var r;if(i(e))return v(t,e)&&(a[e]=t[e]),e;{const t=null!==(r=e.name)&&void 0!==r?r:n("tab-name");return a[t]=e,t}});return{tabs:a,names:r}})(e,u))})(e,t,a).then(({tabs:t,names:n})=>{const a={type:"tabpanel",tabs:(e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t})(y(n,e=>{return v(n=t,a=e)?c.from(n[a]):c.none();var n,a}))};e.windowManager.open({title:"Help",size:"medium",body:a,buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{}})})};e.add("help",(e,t)=>{const a=(()=>{let e={};return{get:()=>e,set:t=>{e=t}}})(),r=(e=>({addTab:t=>{var a;const r=null!==(a=t.name)&&void 0!==a?a:n("tab-name"),o=e.get();o[r]=t,e.set(o)}}))(a);(e=>{(0,e.options.register)("help_tabs",{processor:"array"})})(e);const o=P(e,a,t);return((e,t)=>{e.ui.registry.addButton("help",{icon:"help",tooltip:"Help",onAction:t}),e.ui.registry.addMenuItem("help",{text:"Help",icon:"help",shortcut:"Alt+0",onAction:t})})(e,o),((e,t)=>{e.addCommand("mceHelp",t)})(e,o),e.shortcuts.add("Alt+0","Open help dialog","mceHelp"),((e,t)=>{e.on("init",()=>{w(t)})})(e,t),r})}();
4
+ !function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");let t=0;const n=e=>{const n=(new Date).getTime(),a=Math.floor(1e9*Math.random());return t++,e+"_"+a+t+String(n)},a=e=>t=>t.options.get(e),r=a("help_tabs"),o=a("forced_plugins"),i=e=>"string"===(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=a=e,(r=String).prototype.isPrototypeOf(n)||(null===(o=a.constructor)||void 0===o?void 0:o.name)===r.name)?"string":t;var n,a,r,o})(e);const s=e=>void 0===e;const l=e=>"function"==typeof e,m=()=>false;class c{constructor(e,t){this.tag=e,this.value=t}static some(e){return new c(!0,e)}static none(){return c.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?c.some(e(this.value)):c.none()}bind(e){return this.tag?e(this.value):c.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:c.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return null==e?c.none():c.some(e)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}c.singletonNone=new c(!1);const u=Array.prototype.slice,p=Array.prototype.indexOf,y=(e,t)=>{const n=e.length,a=new Array(n);for(let r=0;r<n;r++){const n=e[r];a[r]=t(n,r)}return a},h=(e,t)=>{const n=[];for(let a=0,r=e.length;a<r;a++){const r=e[a];t(r,a)&&n.push(r)}return n},d=(e,t)=>{const n=u.call(e,0);return n.sort(t),n},g=Object.keys,k=Object.hasOwnProperty,v=(e,t)=>k.call(e,t);var b=tinymce.util.Tools.resolve("tinymce.Resource"),f=tinymce.util.Tools.resolve("tinymce.util.I18n");const A=(e,t)=>b.load(`tinymce.html-i18n.help-keynav.${t}`,`${e}/js/i18n/keynav/${t}.js`),w=e=>A(e,f.getCode()).catch(()=>A(e,"en"));var C=tinymce.util.Tools.resolve("tinymce.Env");const M=e=>{const t=C.os.isMacOS()||C.os.isiOS(),n=t?{alt:"&#x2325;",ctrl:"&#x2303;",shift:"&#x21E7;",meta:"&#x2318;",access:"&#x2303;&#x2325;"}:{meta:"Ctrl ",access:"Shift + Alt "},a=e.split("+"),r=y(a,e=>{const t=e.toLowerCase().trim();return v(n,t)?n[t]:e});return t?r.join("").replace(/\s/,""):r.join("+")},S=[{shortcuts:["Meta + B"],action:"Bold"},{shortcuts:["Meta + I"],action:"Italic"},{shortcuts:["Meta + U"],action:"Underline"},{shortcuts:["Meta + A"],action:"Select all"},{shortcuts:["Meta + Y","Meta + Shift + Z"],action:"Redo"},{shortcuts:["Meta + Z"],action:"Undo"},{shortcuts:["Access + 1"],action:"Heading 1"},{shortcuts:["Access + 2"],action:"Heading 2"},{shortcuts:["Access + 3"],action:"Heading 3"},{shortcuts:["Access + 4"],action:"Heading 4"},{shortcuts:["Access + 5"],action:"Heading 5"},{shortcuts:["Access + 6"],action:"Heading 6"},{shortcuts:["Access + 7"],action:"Paragraph"},{shortcuts:["Access + 8"],action:"Div"},{shortcuts:["Access + 9"],action:"Address"},{shortcuts:["Alt + 0"],action:"Open help dialog"},{shortcuts:["Alt + F9"],action:"Focus to menubar"},{shortcuts:["Alt + F10"],action:"Focus to toolbar"},{shortcuts:["Alt + F11"],action:"Focus to element path"},{shortcuts:["Ctrl + F9"],action:"Focus to contextual toolbar"},{shortcuts:["Shift + Enter"],action:"Open popup menu for split buttons"},{shortcuts:["Meta + K"],action:"Insert link (if link plugin activated)"},{shortcuts:["Meta + S"],action:"Save (if save plugin activated)"},{shortcuts:["Meta + F"],action:"Find (if searchreplace plugin activated)"},{shortcuts:["Meta + Shift + F"],action:"Switch to or from fullscreen mode"}],_=()=>({name:"shortcuts",title:"Handy Shortcuts",items:[{type:"table",header:["Action","Shortcut"],cells:y(S,e=>{const t=y(e.shortcuts,M).join(" or ");return[e.action,t]})}]}),x=y([{key:"accordion",name:"Accordion"},{key:"advlist",name:"Advanced List"},{key:"anchor",name:"Anchor"},{key:"autolink",name:"Autolink"},{key:"autoresize",name:"Autoresize"},{key:"autosave",name:"Autosave"},{key:"charmap",name:"Character Map"},{key:"code",name:"Code"},{key:"codesample",name:"Code Sample"},{key:"colorpicker",name:"Color Picker"},{key:"directionality",name:"Directionality"},{key:"emoticons",name:"Emoticons"},{key:"fullscreen",name:"Full Screen"},{key:"help",name:"Help"},{key:"image",name:"Image"},{key:"importcss",name:"Import CSS"},{key:"insertdatetime",name:"Insert Date/Time"},{key:"link",name:"Link"},{key:"lists",name:"Lists"},{key:"media",name:"Media"},{key:"nonbreaking",name:"Nonbreaking"},{key:"pagebreak",name:"Page Break"},{key:"preview",name:"Preview"},{key:"quickbars",name:"Quick Toolbars"},{key:"save",name:"Save"},{key:"searchreplace",name:"Search and Replace"},{key:"table",name:"Table"},{key:"textcolor",name:"Text Color"},{key:"visualblocks",name:"Visual Blocks"},{key:"visualchars",name:"Visual Characters"},{key:"wordcount",name:"Word Count"},{key:"a11ychecker",name:"Accessibility Checker",type:"premium"},{key:"typography",name:"Advanced Typography",type:"premium",slug:"advanced-typography"},{key:"ai",name:"AI Assistant",type:"premium"},{key:"casechange",name:"Case Change",type:"premium"},{key:"checklist",name:"Checklist",type:"premium"},{key:"advcode",name:"Enhanced Code Editor",type:"premium"},{key:"mediaembed",name:"Enhanced Media Embed",type:"premium",slug:"introduction-to-mediaembed"},{key:"advtable",name:"Enhanced Tables",type:"premium"},{key:"exportpdf",name:"Export to PDF",type:"premium"},{key:"exportword",name:"Export to Word",type:"premium"},{key:"footnotes",name:"Footnotes",type:"premium"},{key:"formatpainter",name:"Format Painter",type:"premium"},{key:"editimage",name:"Image Editing",type:"premium"},{key:"importword",name:"Import from Word",type:"premium"},{key:"inlinecss",name:"Inline CSS",type:"premium",slug:"inline-css"},{key:"linkchecker",name:"Link Checker",type:"premium"},{key:"markdown",name:"Markdown",type:"premium"},{key:"mentions",name:"Mentions",type:"premium"},{key:"mergetags",name:"Merge Tags",type:"premium"},{key:"pageembed",name:"Page Embed",type:"premium"},{key:"permanentpen",name:"Permanent Pen",type:"premium"},{key:"powerpaste",name:"PowerPaste",type:"premium",slug:"introduction-to-powerpaste"},{key:"revisionhistory",name:"Revision History",type:"premium"},{key:"tinymcespellchecker",name:"Spell Checker",type:"premium",slug:"introduction-to-tiny-spellchecker"},{key:"autocorrect",name:"Spelling Autocorrect",type:"premium"},{key:"tableofcontents",name:"Table of Contents",type:"premium"},{key:"advtemplate",name:"Templates",type:"premium",slug:"advanced-templates"},{key:"tinycomments",name:"Tiny Comments",type:"premium",slug:"introduction-to-tiny-comments"},{key:"tinydrive",name:"Tiny Drive",type:"premium",slug:"tinydrive-introduction"}],e=>({...e,type:e.type||"opensource",slug:e.slug||e.key})),T=e=>{const t=e=>`<a data-alloy-tabstop="true" tabindex="-1" href="${e.url}" target="_blank" rel="noopener">${e.name}</a>`,n=(e,n)=>{return(a=x,r=e=>e.key===n,((e,t,n)=>{for(let a=0,r=e.length;a<r;a++){const r=e[a];if(t(r,a))return c.some(r);if(n(r,a))break}return c.none()})(a,r,m)).fold(()=>((e,n)=>{const a=e.plugins[n].getMetadata;if(l(a)){const e=a();return{name:e.name,html:t(e)}}return{name:n,html:n}})(e,n),e=>{const n="premium"===e.type?`${e.name}*`:e.name;return{name:n,html:t({name:n,url:`https://www.tiny.cloud/docs/tinymce/7/${e.slug}/`})}});var a,r},a=e=>{const t=(e=>{const t=g(e.plugins),n=o(e);return s(n)?t:h(t,e=>!(((e,t)=>p.call(e,t))(n,e)>-1))})(e),a=d(y(t,t=>n(e,t)),(e,t)=>e.name.localeCompare(t.name)),r=y(a,e=>"<li>"+e.html+"</li>"),i=r.length,l=r.join("");return"<p><b>"+f.translate(["Plugins installed ({0}):",i])+"</b></p><ul>"+l+"</ul>"},r={type:"htmlpanel",presets:"document",html:[(e=>null==e?"":"<div>"+a(e)+"</div>")(e),(()=>{const e=h(x,({type:e})=>"premium"===e),t=d(y(e,e=>e.name),(e,t)=>e.localeCompare(t)),n=y(t,e=>`<li>${e}</li>`).join("");return"<div><p><b>"+f.translate("Premium plugins:")+"</b></p><ul>"+n+'<li class="tox-help__more-link" "><a href="https://www.tiny.cloud/pricing/?utm_campaign=help_dialog_plugin_tab&utm_source=tiny&utm_medium=referral&utm_term=read_more&utm_content=premium_plugin_heading" rel="noopener" target="_blank" data-alloy-tabstop="true" tabindex="-1">'+f.translate("Learn more...")+"</a></li></ul></div>"})()].join("")};return{name:"plugins",title:"Plugins",items:[r]}};var O=tinymce.util.Tools.resolve("tinymce.EditorManager");const P=(e,t,a)=>()=>{(async(e,t,a)=>{const o=_(),s=await(async e=>({name:"keyboardnav",title:"Keyboard Navigation",items:[{type:"htmlpanel",presets:"document",html:await w(e)}]}))(a),l=T(e),m=(()=>{var e,t;const n='<a data-alloy-tabstop="true" tabindex="-1" href="https://www.tiny.cloud/docs/tinymce/7/changelog/?utm_campaign=help_dialog_version_tab&utm_source=tiny&utm_medium=referral" rel="noopener" target="_blank">TinyMCE '+(e=O.majorVersion,t=O.minorVersion,(0===e.indexOf("@")?"X.X.X":e+"."+t)+"</a>");return{name:"versions",title:"Version",items:[{type:"htmlpanel",html:"<p>"+f.translate(["You are using {0}",n])+"</p>",presets:"document"}]}})(),u={[o.name]:o,[s.name]:s,[l.name]:l,[m.name]:m,...t.get()};return c.from(r(e)).fold(()=>(e=>{const t=g(e),n=t.indexOf("versions");return-1!==n&&(t.splice(n,1),t.push("versions")),{tabs:e,names:t}})(u),e=>((e,t)=>{const a={},r=y(e,e=>{var r;if(i(e))return v(t,e)&&(a[e]=t[e]),e;{const t=null!==(r=e.name)&&void 0!==r?r:n("tab-name");return a[t]=e,t}});return{tabs:a,names:r}})(e,u))})(e,t,a).then(({tabs:t,names:n})=>{const a={type:"tabpanel",tabs:(e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t})(y(n,e=>{return v(n=t,a=e)?c.from(n[a]):c.none();var n,a}))};e.windowManager.open({title:"Help",size:"medium",body:a,buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}],initialData:{}})})};e.add("help",(e,t)=>{const a=(()=>{let e={};return{get:()=>e,set:t=>{e=t}}})(),r=(e=>({addTab:t=>{var a;const r=null!==(a=t.name)&&void 0!==a?a:n("tab-name"),o=e.get();o[r]=t,e.set(o)}}))(a);(e=>{(0,e.options.register)("help_tabs",{processor:"array"})})(e);const o=P(e,a,t);return((e,t)=>{e.ui.registry.addButton("help",{icon:"help",tooltip:"Help",onAction:t}),e.ui.registry.addMenuItem("help",{text:"Help",icon:"help",shortcut:"Alt+0",onAction:t})})(e,o),((e,t)=>{e.addCommand("mceHelp",t)})(e,o),e.shortcuts.add("Alt+0","Open help dialog","mceHelp"),((e,t)=>{e.on("init",()=>{w(t)})})(e,t),r})}();
@@ -89,6 +89,10 @@
89
89
  };
90
90
 
91
91
  const defaultMaxImageWidthPx = 300;
92
+ const getContentRootSelector = editor => {
93
+ const contentRootClass = editor.options.get('document_content_root_class');
94
+ return contentRootClass.startsWith('.') ? contentRootClass : `.${ contentRootClass }`;
95
+ };
92
96
  const insertTable = (editor, columns, rows) => {
93
97
  editor.execCommand('mceInsertTable', false, {
94
98
  rows,
@@ -102,8 +106,9 @@
102
106
  const img = new Image();
103
107
  img.src = blobInfo.blobUri();
104
108
  img.onload = () => {
105
- const contentBodyElement = editor.dom.select('.mce-content-body')[0];
106
- const maxImageWidth = contentBodyElement ? parseInt(window.getComputedStyle(contentBodyElement).width) : defaultMaxImageWidthPx;
109
+ const contentRootElement = editor.dom.select(getContentRootSelector(editor))[0];
110
+ const computedStyles = contentRootElement ? window.getComputedStyle(contentRootElement) : null;
111
+ const maxImageWidth = computedStyles ? parseInt(computedStyles.width) - parseInt(computedStyles.paddingLeft) - parseInt(computedStyles.paddingRight) : defaultMaxImageWidthPx;
107
112
  editor.insertContent(editor.dom.createHTML('img', {
108
113
  src: blobInfo.blobUri(),
109
114
  width: `${ Math.min(img.naturalWidth, maxImageWidth) }px`
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * TinyMCE version 7.0.0 (TBD)
3
3
  */
4
- !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,o=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=n=t,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var o,n,r,i})(t);const n=e("boolean"),r=e("function"),i=t=>e=>e.options.get(t),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.util.Delay");const d=t=>{t.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(t=>new Promise(e=>{let o=!1;const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.opacity="0.001",document.body.appendChild(n);const r=t=>{var r;o||(null===(r=n.parentNode)||void 0===r||r.removeChild(n),o=!0,e(t))},i=t=>{r(Array.prototype.slice.call(t.target.files))};n.addEventListener("input",i),n.addEventListener("change",i);const s=e=>{const n=()=>{r([])};o||("focusin"===e.type?u.setEditorTimeout(t,n,1e3):n()),t.off("focusin remove",s)};t.on("focusin remove",s),n.click()}))(t).then(e=>{if(e.length>0){const o=e[0];(t=>new Promise(e=>{const o=new FileReader;o.onloadend=()=>{e(o.result.split(",")[1])},o.readAsDataURL(t)}))(o).then(e=>{((t,e,o)=>{const n=t.editorUpload.blobCache,r=n.create((()=>{const t=(new Date).getTime(),e=Math.floor(1e9*Math.random());return c++,"mceu_"+e+c+String(t)})(),o,e);n.add(r);const i=new Image;i.src=r.blobUri(),i.onload=()=>{const e=t.dom.select(".mce-content-body")[0],o=e?parseInt(window.getComputedStyle(e).width):300;t.insertContent(t.dom.createHTML("img",{src:r.blobUri(),width:`${Math.min(i.naturalWidth,o)}px`}))},i.onerror=t=>{console.error("Failed to load the image blob:",t)}})(t,e,o)})}})}}),t.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{(t=>{t.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(t)}})},m=()=>false;class h{constructor(t,e){this.tag=t,this.value=e}static some(t){return new h(!0,t)}static none(){return h.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?h.some(t(this.value)):h.none()}bind(t){return this.tag?t(this.value):h.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:h.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return null==t?h.none():h.some(t)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}h.singletonNone=new h(!1),"undefined"!=typeof window?window:Function("return this;")();var g=(t,e,o,n,i)=>t(o,n)?h.some(o):r(i)&&i(o)?h.none():e(o,n,i);const b=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},p=b,v=(t,e)=>{const o=t.dom;if(1!==o.nodeType)return!1;{const t=o;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},f=(t,e,o)=>{let n=t.dom;const i=r(o)?o:m;for(;n.parentNode;){n=n.parentNode;const t=p(n);if(e(t))return h.some(t);if(i(t))break}return h.none()},y=(t,e,o)=>f(t,t=>v(t,e),o),w=t=>{const e=a(t);e.length>0&&t.ui.registry.addContextToolbar("quickblock",{predicate:e=>{const o=p(e),n=t.schema.getTextBlockElements(),r=e=>e.dom===t.getBody();return!(t=>{const e=t.dom;return!(!e||!e.hasAttribute)&&e.hasAttribute("data-mce-bogus")})(o)&&((t,e,o)=>g((t,e)=>v(t,e),y,t,'table,[data-mce-bogus="all"]',o))(o,0,r).fold(()=>((t,e,o)=>((t,e,o)=>g((t,e)=>e(t),f,t,e,o))(t,e,o).isSome())(o,e=>e.dom.nodeName.toLowerCase()in n&&t.dom.isEmpty(e.dom),r),m)},items:e,position:"line",scope:"editor"})};t.add("quickbars",t=>{(t=>{const e=t.options.register,r=t=>e=>{const r=n(e)||o(e);return r?n(e)?{value:e?t:"",valid:r}:{value:e.trim(),valid:r}:{valid:!1,message:"Must be a boolean or string."}},i="bold italic | quicklink h2 h3 blockquote";e("quickbars_selection_toolbar",{processor:r(i),default:i});const s="quickimage quicktable";e("quickbars_insert_toolbar",{processor:r(s),default:s});const a="alignleft aligncenter alignright";e("quickbars_image_toolbar",{processor:r(a),default:a})})(t),d(t),w(t),(t=>{const e=e=>t.dom.isEditable(e),o=t=>{return(t=>void 0!==t.dom.classList)(e=p(t))&&e.dom.classList.contains("mce-pagebreak");var e},n=t=>{const n="FIGURE"===t.nodeName&&/image/i.test(t.className);return("IMG"===t.nodeName||n)&&e(t.parentElement)&&!o(t)},r=l(t);r.length>0&&t.ui.registry.addContextToolbar("imageselection",{predicate:t=>n(t),items:r,position:"node"});const i=s(t);i.length>0&&t.ui.registry.addContextToolbar("textselection",{predicate:r=>!n(r)&&!o(r)&&!t.selection.isCollapsed()&&e(r)&&!o(r),items:i,position:"selection",scope:"editor"})})(t)})}();
4
+ !function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>typeof e===t,o=t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(o=n=t,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var o,n,r,i})(t);const n=e("boolean"),r=e("function"),i=t=>e=>e.options.get(t),s=i("quickbars_selection_toolbar"),a=i("quickbars_insert_toolbar"),l=i("quickbars_image_toolbar");let c=0;var u=tinymce.util.Tools.resolve("tinymce.util.Delay");const d=t=>{t.ui.registry.addButton("quickimage",{icon:"image",tooltip:"Insert image",onAction:()=>{(t=>new Promise(e=>{let o=!1;const n=document.createElement("input");n.type="file",n.accept="image/*",n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.opacity="0.001",document.body.appendChild(n);const r=t=>{var r;o||(null===(r=n.parentNode)||void 0===r||r.removeChild(n),o=!0,e(t))},i=t=>{r(Array.prototype.slice.call(t.target.files))};n.addEventListener("input",i),n.addEventListener("change",i);const s=e=>{const n=()=>{r([])};o||("focusin"===e.type?u.setEditorTimeout(t,n,1e3):n()),t.off("focusin remove",s)};t.on("focusin remove",s),n.click()}))(t).then(e=>{if(e.length>0){const o=e[0];(t=>new Promise(e=>{const o=new FileReader;o.onloadend=()=>{e(o.result.split(",")[1])},o.readAsDataURL(t)}))(o).then(e=>{((t,e,o)=>{const n=t.editorUpload.blobCache,r=n.create((()=>{const t=(new Date).getTime(),e=Math.floor(1e9*Math.random());return c++,"mceu_"+e+c+String(t)})(),o,e);n.add(r);const i=new Image;i.src=r.blobUri(),i.onload=()=>{const e=t.dom.select((t=>{const e=t.options.get("document_content_root_class");return e.startsWith(".")?e:`.${e}`})(t))[0],o=e?window.getComputedStyle(e):null,n=o?parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight):300;t.insertContent(t.dom.createHTML("img",{src:r.blobUri(),width:`${Math.min(i.naturalWidth,n)}px`}))},i.onerror=t=>{console.error("Failed to load the image blob:",t)}})(t,e,o)})}})}}),t.ui.registry.addButton("quicktable",{icon:"table",tooltip:"Insert table",onAction:()=>{(t=>{t.execCommand("mceInsertTable",!1,{rows:2,columns:2})})(t)}})},m=()=>false;class h{constructor(t,e){this.tag=t,this.value=e}static some(t){return new h(!0,t)}static none(){return h.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?h.some(t(this.value)):h.none()}bind(t){return this.tag?t(this.value):h.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:h.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return null==t?h.none():h.some(t)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}h.singletonNone=new h(!1),"undefined"!=typeof window?window:Function("return this;")();var g=(t,e,o,n,i)=>t(o,n)?h.some(o):r(i)&&i(o)?h.none():e(o,n,i);const p=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},b=p,v=(t,e)=>{const o=t.dom;if(1!==o.nodeType)return!1;{const t=o;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},f=(t,e,o)=>{let n=t.dom;const i=r(o)?o:m;for(;n.parentNode;){n=n.parentNode;const t=b(n);if(e(t))return h.some(t);if(i(t))break}return h.none()},y=(t,e,o)=>f(t,t=>v(t,e),o),w=t=>{const e=a(t);e.length>0&&t.ui.registry.addContextToolbar("quickblock",{predicate:e=>{const o=b(e),n=t.schema.getTextBlockElements(),r=e=>e.dom===t.getBody();return!(t=>{const e=t.dom;return!(!e||!e.hasAttribute)&&e.hasAttribute("data-mce-bogus")})(o)&&((t,e,o)=>g((t,e)=>v(t,e),y,t,'table,[data-mce-bogus="all"]',o))(o,0,r).fold(()=>((t,e,o)=>((t,e,o)=>g((t,e)=>e(t),f,t,e,o))(t,e,o).isSome())(o,e=>e.dom.nodeName.toLowerCase()in n&&t.dom.isEmpty(e.dom),r),m)},items:e,position:"line",scope:"editor"})};t.add("quickbars",t=>{(t=>{const e=t.options.register,r=t=>e=>{const r=n(e)||o(e);return r?n(e)?{value:e?t:"",valid:r}:{value:e.trim(),valid:r}:{valid:!1,message:"Must be a boolean or string."}},i="bold italic | quicklink h2 h3 blockquote";e("quickbars_selection_toolbar",{processor:r(i),default:i});const s="quickimage quicktable";e("quickbars_insert_toolbar",{processor:r(s),default:s});const a="alignleft aligncenter alignright";e("quickbars_image_toolbar",{processor:r(a),default:a})})(t),d(t),w(t),(t=>{const e=e=>t.dom.isEditable(e),o=t=>{return(t=>void 0!==t.dom.classList)(e=b(t))&&e.dom.classList.contains("mce-pagebreak");var e},n=t=>{const n="FIGURE"===t.nodeName&&/image/i.test(t.className);return("IMG"===t.nodeName||n)&&e(t.parentElement)&&!o(t)},r=l(t);r.length>0&&t.ui.registry.addContextToolbar("imageselection",{predicate:t=>n(t),items:r,position:"node"});const i=s(t);i.length>0&&t.ui.registry.addContextToolbar("textselection",{predicate:r=>!n(r)&&!o(r)&&!t.selection.isCollapsed()&&e(r)&&!o(r),items:i,position:"selection",scope:"editor"})})(t)})}();
@@ -948,9 +948,9 @@
948
948
  var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
949
949
 
950
950
  const defaultTableToolbar = 'tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol';
951
- const defaultTableCellInputs = 'width celltype scope halign valign class';
952
- const defaultTableRowInputs = 'type align height class';
953
- const defaultTableInputs = 'width height cellspacing cellpadding border caption align class';
951
+ const defaultTableCellInputs = 'width height celltype scope halign valign backgroundcolor class';
952
+ const defaultTableRowInputs = 'type align backgroundcolor class';
953
+ const defaultTableInputs = 'width height cellspacing cellpadding backgroundcolor caption align class';
954
954
  const defaultCellBorderWidths = range(5, i => {
955
955
  const size = `${ i + 1 }px`;
956
956
  return {
@@ -1067,6 +1067,26 @@
1067
1067
  processor: 'string',
1068
1068
  default: defaultTableToolbar
1069
1069
  });
1070
+ registerOption('table_contextmenu', {
1071
+ processor: 'string[]',
1072
+ default: []
1073
+ });
1074
+ registerOption('table_contextmenu_flatten', {
1075
+ processor: 'boolean',
1076
+ default: false
1077
+ });
1078
+ registerOption('table_row_contextmenu', {
1079
+ processor: 'string[]',
1080
+ default: []
1081
+ });
1082
+ registerOption('table_column_contextmenu', {
1083
+ processor: 'string[]',
1084
+ default: []
1085
+ });
1086
+ registerOption('table_cell_contextmenu', {
1087
+ processor: 'string[]',
1088
+ default: []
1089
+ });
1070
1090
  registerOption('table_background_color_map', {
1071
1091
  processor: 'object[]',
1072
1092
  default: []
@@ -1091,6 +1111,11 @@
1091
1111
  const getRowClassList = option('table_row_class_list');
1092
1112
  const getTableClassList = option('table_class_list');
1093
1113
  const getToolbar = option('table_toolbar');
1114
+ const getTableContextMenu = option('table_contextmenu');
1115
+ const getTableContextMenuFlatten = option('table_contextmenu_flatten');
1116
+ const getTableRowContextMenu = option('table_row_contextmenu');
1117
+ const getTableColumnContextMenu = option('table_column_contextmenu');
1118
+ const getTableCellContextMenu = option('table_cell_contextmenu');
1094
1119
  const getTableBackgroundColorMap = option('table_background_color_map');
1095
1120
  const getTableBorderColorMap = option('table_border_color_map');
1096
1121
  const isPixelsForced = editor => getTableSizingMode(editor) === 'fixed';
@@ -1105,6 +1130,11 @@
1105
1130
  const defaultAttributes = options.get('table_default_attributes');
1106
1131
  return options.isSet('table_default_attributes') ? defaultAttributes : determineDefaultAttributes(editor, defaultAttributes);
1107
1132
  };
1133
+ const isTableContextMenuSet = editor => editor.options.isSet('table_contextmenu');
1134
+ const isTableContextMenuFlatten = editor => getTableContextMenuFlatten(editor);
1135
+ const isTableRowContextMenuSet = editor => editor.options.isSet('table_row_contextmenu');
1136
+ const isTableColumnContextMenuSet = editor => editor.options.isSet('table_column_contextmenu');
1137
+ const isTableCellContextMenuSet = editor => editor.options.isSet('table_cell_contextmenu');
1108
1138
 
1109
1139
  const isWithin = (bounds, detail) => {
1110
1140
  return detail.column >= bounds.startCol && detail.column + detail.colspan - 1 <= bounds.finishCol && detail.row >= bounds.startRow && detail.row + detail.rowspan - 1 <= bounds.finishRow;
@@ -1676,6 +1706,48 @@
1676
1706
  return isNotEmpty(item.value) ? [item] : [];
1677
1707
  }
1678
1708
  });
1709
+ const filterContextMenu = (menu, allowed) => {
1710
+ if (allowed.length === 0) {
1711
+ return '';
1712
+ }
1713
+ const allowedSet = new Set(allowed);
1714
+ const filteredGroups = menu.split('|').map(group => group.trim()).map(group => group.length === 0 ? [] : group.split(/\s+/).filter(item => allowedSet.has(item))).filter(items => items.length > 0).map(items => items.join(' '));
1715
+ return filteredGroups.join(' | ');
1716
+ };
1717
+ const flattenContextMenu = (menu, replacements) => {
1718
+ const groups = menu.split('|').map(group => group.trim()).filter(group => group.length > 0);
1719
+ const flattened = [];
1720
+ const addGroup = items => {
1721
+ if (items.length > 0) {
1722
+ flattened.push(items.join(' '));
1723
+ }
1724
+ };
1725
+ each(groups, group => {
1726
+ const tokens = group.split(/\s+/).filter(token => token.length > 0);
1727
+ let current = [];
1728
+ each(tokens, token => {
1729
+ const replacement = replacements[token];
1730
+ if (replacement === undefined) {
1731
+ current.push(token);
1732
+ } else if (replacement.length === 0) {
1733
+ return;
1734
+ } else {
1735
+ const replacementGroups = replacement.split('|').map(repGroup => repGroup.trim()).filter(repGroup => repGroup.length > 0);
1736
+ if (replacementGroups.length === 1) {
1737
+ current = current.concat(replacementGroups[0].split(/\s+/).filter(item => item.length > 0));
1738
+ } else {
1739
+ addGroup(current);
1740
+ current = [];
1741
+ each(replacementGroups, repGroup => {
1742
+ addGroup(repGroup.split(/\s+/).filter(item => item.length > 0));
1743
+ });
1744
+ }
1745
+ }
1746
+ });
1747
+ addGroup(current);
1748
+ });
1749
+ return flattened.join(' | ');
1750
+ };
1679
1751
  const generateMenuItemsCallback = (editor, items, format, onAction) => callback => callback(buildMenuItems(editor, items, format, onAction));
1680
1752
  const buildColorMenu = (editor, colorList, style) => {
1681
1753
  const colorMap = map(colorList, entry => ({
@@ -1720,6 +1792,18 @@
1720
1792
  label: 'Width',
1721
1793
  tooltip: 'Cell width in pixels or percentage (e.g., 50px or 10%).'
1722
1794
  },
1795
+ {
1796
+ name: 'height',
1797
+ type: 'input',
1798
+ label: 'Height',
1799
+ tooltip: 'Row height in pixels (e.g., 20px). If the height change does not apply to the row, remove the table height in Table Properties and try again.'
1800
+ },
1801
+ {
1802
+ name: 'backgroundcolor',
1803
+ type: 'colorinput',
1804
+ label: 'Background color',
1805
+ tooltip: 'Background color of the cell.'
1806
+ },
1723
1807
  {
1724
1808
  name: 'celltype',
1725
1809
  type: 'listbox',
@@ -1817,19 +1901,10 @@
1817
1901
  return `Color of the outer border of the ${ dialogName }.`;
1818
1902
  }
1819
1903
  };
1820
- const getBackgroundColourTooltip = dialogName => {
1821
- switch (dialogName) {
1822
- case 'table':
1823
- return 'Changes the background color of all cells in the table, except for those set individually through Cell Properties or Row Properties.';
1824
- case 'row':
1825
- return 'Changes the background color of all cells in the row, except for those set individually through Cell Properties.';
1826
- case 'cell':
1827
- return `Background color of the cell.`;
1828
- }
1829
- };
1830
1904
  const getBorderWidthTooltip = dialogName => {
1831
1905
  switch (dialogName) {
1832
1906
  case 'table':
1907
+ return 'Width of the border for the entire table and individual cells.';
1833
1908
  case 'row':
1834
1909
  return undefined;
1835
1910
  case 'cell':
@@ -1856,23 +1931,17 @@
1856
1931
  type: 'colorinput',
1857
1932
  label: 'Border color',
1858
1933
  tooltip: getBorderColorTooltip(dialogName)
1859
- },
1860
- {
1861
- name: 'backgroundcolor',
1862
- type: 'colorinput',
1863
- label: 'Background color',
1864
- tooltip: getBackgroundColourTooltip(dialogName)
1865
1934
  }
1866
1935
  ];
1867
1936
  const borderWidth = {
1868
- name: 'borderwidth',
1937
+ name: dialogName === 'cell' ? 'borderwidth' : 'border',
1869
1938
  type: 'input',
1870
1939
  label: 'Border width',
1871
1940
  tooltip: getBorderWidthTooltip(dialogName)
1872
1941
  };
1873
- const items = dialogName === 'cell' ? [borderWidth].concat(advTabItems) : advTabItems;
1942
+ const items = dialogName === 'cell' || dialogName === 'table' ? [borderWidth].concat(advTabItems) : advTabItems;
1874
1943
  return {
1875
- title: 'Advanced',
1944
+ title: 'Border',
1876
1945
  name: 'advanced',
1877
1946
  items
1878
1947
  };
@@ -2199,7 +2268,6 @@
2199
2268
  const extractDataFromRowElement = (editor, elm, hasAdvancedRowTab) => {
2200
2269
  const dom = editor.dom;
2201
2270
  return {
2202
- height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
2203
2271
  class: dom.getAttrib(elm, 'class', ''),
2204
2272
  type: getRowType(elm),
2205
2273
  align: getHAlignment(editor, elm),
@@ -2209,9 +2277,11 @@
2209
2277
  const extractDataFromCellElement = (editor, cell, hasAdvancedCellTab, column) => {
2210
2278
  const dom = editor.dom;
2211
2279
  const colElm = column.getOr(cell);
2280
+ const rowElm = cell.parentElement;
2212
2281
  const getStyle = (element, style) => dom.getStyle(element, style) || dom.getAttrib(element, style);
2213
2282
  return {
2214
2283
  width: getStyle(colElm, 'width'),
2284
+ height: rowElm ? dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height') : '',
2215
2285
  scope: dom.getAttrib(cell, 'scope'),
2216
2286
  celltype: getNodeName(cell),
2217
2287
  class: dom.getAttrib(cell, 'class', ''),
@@ -2265,6 +2335,7 @@
2265
2335
  };
2266
2336
  const applyStyleData$1 = (editor, cells, data, wasChanged) => {
2267
2337
  const isSingleCell = cells.length === 1;
2338
+ const rowsSeen = new Set();
2268
2339
  each(cells, item => {
2269
2340
  const cellElm = item.element;
2270
2341
  const shouldOverrideCurrentValue = isSingleCell ? always : wasChanged;
@@ -2274,6 +2345,16 @@
2274
2345
  if (hasAdvancedCellTab(editor)) {
2275
2346
  updateAdvancedProps$1(modifier, data, shouldOverrideCurrentValue);
2276
2347
  }
2348
+ if (shouldOverrideCurrentValue('height')) {
2349
+ const rowElm = cellElm.parentElement;
2350
+ if (rowElm !== null && !rowsSeen.has(rowElm)) {
2351
+ rowsSeen.add(rowElm);
2352
+ editor.dom.setStyle(rowElm, 'height', addPxSuffix(data.height));
2353
+ if (wasChanged('height')) {
2354
+ Array.from(rowElm.cells).forEach(cell => editor.dom.setStyle(cell, 'height', null));
2355
+ }
2356
+ }
2357
+ }
2277
2358
  if (wasChanged('halign')) {
2278
2359
  setAlign(editor, cellElm, data.halign);
2279
2360
  }
@@ -2419,10 +2500,10 @@
2419
2500
  ]
2420
2501
  },
2421
2502
  {
2422
- label: 'Height',
2423
- name: 'height',
2424
- type: 'input',
2425
- tooltip: 'Row height in pixels (e.g., 20px).'
2503
+ name: 'backgroundcolor',
2504
+ type: 'colorinput',
2505
+ label: 'Background color',
2506
+ tooltip: 'Changes the background color of all cells in the row, except for those set individually through Cell Properties.'
2426
2507
  }
2427
2508
  ];
2428
2509
  const getItems$1 = editor => {
@@ -2440,9 +2521,6 @@
2440
2521
  if (shouldUpdate('class') && data.class !== 'mce-no-match') {
2441
2522
  modifier.setAttrib('class', data.class);
2442
2523
  }
2443
- if (shouldUpdate('height')) {
2444
- modifier.setStyle('height', addPxSuffix(data.height));
2445
- }
2446
2524
  };
2447
2525
  const updateAdvancedProps = (modifier, data, shouldUpdate) => {
2448
2526
  if (shouldUpdate('backgroundcolor')) {
@@ -2459,17 +2537,11 @@
2459
2537
  const isSingleRow = rows.length === 1;
2460
2538
  const shouldOverrideCurrentValue = isSingleRow ? always : wasChanged;
2461
2539
  each(rows, rowElm => {
2462
- const rowCells = children$1(SugarElement.fromDom(rowElm), 'td,th');
2463
2540
  const modifier = DomModifier.normal(editor, rowElm);
2464
2541
  updateSimpleProps(modifier, data, shouldOverrideCurrentValue);
2465
2542
  if (hasAdvancedRowTab(editor)) {
2466
2543
  updateAdvancedProps(modifier, data, shouldOverrideCurrentValue);
2467
2544
  }
2468
- if (wasChanged('height')) {
2469
- each(rowCells, cell => {
2470
- editor.dom.setStyle(cell.dom, 'height', null);
2471
- });
2472
- }
2473
2545
  if (wasChanged('align')) {
2474
2546
  setAlign(editor, rowElm, data.align);
2475
2547
  }
@@ -2597,10 +2669,10 @@
2597
2669
  tooltip: 'Inner text padding in cells, e.g., 0px 5px (where 0px is vertical padding, and 5px is horizontal padding).'
2598
2670
  },
2599
2671
  {
2600
- type: 'input',
2601
- name: 'border',
2602
- label: 'Border width',
2603
- tooltip: 'Width of the border for the entire table and individual cells.'
2672
+ name: 'backgroundcolor',
2673
+ type: 'colorinput',
2674
+ label: 'Background color',
2675
+ tooltip: 'Changes the background color of all cells in the table, except for those set individually through Cell Properties or Row Properties.'
2604
2676
  },
2605
2677
  {
2606
2678
  type: 'label',
@@ -3023,12 +3095,40 @@
3023
3095
  editor.off('NodeChange', nodeChanged);
3024
3096
  };
3025
3097
  };
3098
+ const getFilteredRowMenuItems = editor => {
3099
+ const rowMenuItems = 'tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter';
3100
+ return isTableRowContextMenuSet(editor) ? filterContextMenu(rowMenuItems, getTableRowContextMenu(editor)) : rowMenuItems;
3101
+ };
3102
+ const getFilteredColumnMenuItems = editor => {
3103
+ const columnMenuItems = 'tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter';
3104
+ return isTableColumnContextMenuSet(editor) ? filterContextMenu(columnMenuItems, getTableColumnContextMenu(editor)) : columnMenuItems;
3105
+ };
3106
+ const getFilteredCellMenuItems = editor => {
3107
+ const cellMenuItems = 'tablecellprops tablemergecells tablesplitcells';
3108
+ return isTableCellContextMenuSet(editor) ? filterContextMenu(cellMenuItems, getTableCellContextMenu(editor)) : cellMenuItems;
3109
+ };
3110
+ const getTableMenuItems = editor => {
3111
+ const menu = 'inserttable | cell row column | advtablesort | tableprops deletetable';
3112
+ const filteredMenu = isTableContextMenuSet(editor) ? filterContextMenu(menu, [
3113
+ 'inserttable',
3114
+ ...getTableContextMenu(editor)
3115
+ ]) : menu;
3116
+ if (isTableContextMenuFlatten(editor) && filteredMenu.length > 0) {
3117
+ return flattenContextMenu(filteredMenu, {
3118
+ cell: getFilteredCellMenuItems(editor),
3119
+ row: getFilteredRowMenuItems(editor),
3120
+ column: getFilteredColumnMenuItems(editor)
3121
+ });
3122
+ } else {
3123
+ return filteredMenu;
3124
+ }
3125
+ };
3026
3126
  const addButtons = (editor, selectionTargets) => {
3027
3127
  editor.ui.registry.addMenuButton('table', {
3028
3128
  tooltip: 'Table',
3029
3129
  icon: 'table',
3030
3130
  onSetup: onSetupEditable$1(editor),
3031
- fetch: callback => callback('inserttable | cell row column | advtablesort | tableprops deletetable')
3131
+ fetch: callback => callback(getTableMenuItems(editor))
3032
3132
  });
3033
3133
  const cmd = command => () => editor.execCommand(command);
3034
3134
  const addButtonIfRegistered = (name, spec) => {
@@ -3444,37 +3544,53 @@
3444
3544
  onSetup: selectionTargets.onSetupTable,
3445
3545
  command: 'mceTableDelete'
3446
3546
  });
3447
- if (contains(hasRowMenuItems, true)) {
3547
+ const rowMenuItems = 'tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter';
3548
+ const filteredRowMenuItems = isTableRowContextMenuSet(editor) ? filterContextMenu(rowMenuItems, getTableRowContextMenu(editor)) : rowMenuItems;
3549
+ if (contains(hasRowMenuItems, true) && filteredRowMenuItems.length > 0) {
3448
3550
  editor.ui.registry.addNestedMenuItem('row', {
3449
3551
  type: 'nestedmenuitem',
3450
3552
  text: 'Row',
3451
- getSubmenuItems: constant('tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter')
3553
+ getSubmenuItems: constant(filteredRowMenuItems)
3452
3554
  });
3453
3555
  }
3454
- if (contains(hasColumnMenuItems, true)) {
3556
+ const columnMenuItems = 'tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter';
3557
+ const filteredColumnMenuItems = isTableColumnContextMenuSet(editor) ? filterContextMenu(columnMenuItems, getTableColumnContextMenu(editor)) : columnMenuItems;
3558
+ if (contains(hasColumnMenuItems, true) && filteredColumnMenuItems.length > 0) {
3455
3559
  editor.ui.registry.addNestedMenuItem('column', {
3456
3560
  type: 'nestedmenuitem',
3457
3561
  text: 'Column',
3458
- getSubmenuItems: constant('tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter')
3562
+ getSubmenuItems: constant(filteredColumnMenuItems)
3459
3563
  });
3460
3564
  }
3461
- if (contains(hasCellMenuItems, true)) {
3565
+ const cellMenuItems = 'tablecellprops tablemergecells tablesplitcells';
3566
+ const filteredCellMenuItems = isTableCellContextMenuSet(editor) ? filterContextMenu(cellMenuItems, getTableCellContextMenu(editor)) : cellMenuItems;
3567
+ if (contains(hasCellMenuItems, true) && filteredCellMenuItems.length > 0) {
3462
3568
  editor.ui.registry.addNestedMenuItem('cell', {
3463
3569
  type: 'nestedmenuitem',
3464
3570
  text: 'Cell',
3465
- getSubmenuItems: constant('tablecellprops tablemergecells tablesplitcells')
3571
+ getSubmenuItems: constant(filteredCellMenuItems)
3466
3572
  });
3467
3573
  }
3468
3574
  editor.ui.registry.addContextMenu('table', {
3469
3575
  update: () => {
3470
3576
  selectionTargets.resetTargets();
3471
- return selectionTargets.targets().fold(constant(''), targets => {
3577
+ const menu = selectionTargets.targets().fold(constant(''), targets => {
3472
3578
  if (name(targets.element) === 'caption') {
3473
3579
  return 'tableprops deletetable';
3474
3580
  } else {
3475
3581
  return 'cell row column | advtablesort | tableprops deletetable';
3476
3582
  }
3477
3583
  });
3584
+ const filteredMenu = isTableContextMenuSet(editor) ? filterContextMenu(menu, getTableContextMenu(editor)) : menu;
3585
+ if (isTableContextMenuFlatten(editor) && filteredMenu.length > 0) {
3586
+ return flattenContextMenu(filteredMenu, {
3587
+ cell: filteredCellMenuItems,
3588
+ row: filteredRowMenuItems,
3589
+ column: filteredColumnMenuItems
3590
+ });
3591
+ } else {
3592
+ return filteredMenu;
3593
+ }
3478
3594
  }
3479
3595
  });
3480
3596
  const tableClassList = filterNoneItem(getTableClassList(editor));