TinyMCE Advanced - Version 5.4.0

Version Description

  • Updated for WordPress 5.4.
  • Improved "Reset Table Size" to reset all table elements (tr, th, td, thead, tbody, tfoot).
  • Improved "Remove Table Styling" to remove all current and deprecated styling attributes from all table elements.
Download this release

Release Info

Developer azaozz
Plugin Icon 128x128 TinyMCE Advanced
Version 5.4.0
Comparing to
See all releases

Code changes from version 5.3 to 5.4.0

block-editor/classic-paragraph.css CHANGED
@@ -1 +1 @@
1
- div[data-type="tadv/classic-paragraph"] .block-editor-block-list__block-edit:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #e2e4e7;outline:1px solid transparent}@media (prefers-reduced-motion:reduce){div[data-type="tadv/classic-paragraph"] .block-editor-block-list__block-edit:before{transition-duration:0s}}div[data-type="tadv/classic-paragraph"].is-selected .block-editor-block-list__block-edit:before{border-color:#b5bcc2 #b5bcc2 #b5bcc2 transparent}div[data-type="tadv/classic-paragraph"] .editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="tadv/classic-paragraph"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}div[data-type="tadv/classic-paragraph"].is-selected .block-library-classic__toolbar,div[data-type="tadv/classic-paragraph"].is-typing .block-library-classic__toolbar{border-color:#b5bcc2}div[data-type="tadv/classic-paragraph"] .block-library-classic__toolbar:empty{display:none}div[data-type="tadv/classic-paragraph"].is-selected .block-library-classic__toolbar,div[data-type="tadv/classic-paragraph"].is-typing .block-library-classic__toolbar{display:block;border-color:transparent}div[data-type="tadv/classic-paragraph"] .block-library-classic__toolbar .mce-menubar{min-height:34px;padding:3px 2px 0}@media (min-width:600px){.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-switcher__no-switcher-icon{display:none}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{float:right;margin-right:74px;transform:translateY(-16px);top:14px}.rtl .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{float:left;margin-right:0;margin-left:74px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{border:none;box-shadow:none;margin-top:1px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar:before{content:"";display:block;border-left:1px solid #e2e4e7;margin-top:4px;margin-bottom:4px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar__control.components-button:hover{background-color:transparent}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar{background:transparent;border:none}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar{padding-right:86px}.rtl .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar{padding-left:86px;padding-right:0}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-library-classic__toolbar .mce-menubar+.mce-toolbar-grp .mce-container-body .mce-toolbar{padding:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{float:none;margin-right:0;transform:translateY(-52px);top:0;position:absolute}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{margin-right:-15px;margin-left:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{box-shadow:-3px 0 0 0 #555d66;position:relative}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{box-shadow:3px 0 0 0 #555d66}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar:before{display:none}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar{background:#fff;border:1px solid #b5bcc2;border-left-width:0}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar{border:1px solid #b5bcc2;border-right-width:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar{padding:3px 2px 0}}
1
+ div[data-type="tadv/classic-paragraph"].is-selected .block-library-classic__toolbar,div[data-type="tadv/classic-paragraph"].is-typing .block-library-classic__toolbar,div[data-type="tadv/classic-paragraph"] div.mce-toolbar-grp{border-color:rgba(66,88,99,.35)}div[data-type="tadv/classic-paragraph"] .block-library-classic__toolbar:empty{display:none}div[data-type="tadv/classic-paragraph"].is-selected .block-library-classic__toolbar,div[data-type="tadv/classic-paragraph"].is-typing .block-library-classic__toolbar{display:block;z-index:31}
block-editor/classic-paragraph.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=11)}([function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,o){var r=o(7);e.exports=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){r(e,t,o[t])})}return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function o(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}},function(e,t,o){var r=o(8),n=o(0);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?n(e):t}},function(e,t){function o(t){return e.exports=o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(t)}e.exports=o},function(e,t,o){var r=o(9);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t){e.exports=function(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}},function(e,t){function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?e.exports=r=function(e){return o(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)},r(t)}e.exports=r},function(e,t){function o(t,r){return e.exports=o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(t,r)}e.exports=o},,function(e,t,o){"use strict";o.r(t);var r=o(1),n=o.n(r),c=o(2),i=o.n(c),a=o(3),l=o.n(a),u=o(4),s=o.n(u),d=o(5),p=o.n(d),f=o(0),m=o.n(f),b=o(6),y=o.n(b),v=window.wp,h=v.element,g=h.Component,k=h.createElement,w=v.keycodes,x=w.BACKSPACE,S=w.DELETE,O=w.F10,_=window.tadvBlockRegister;var P=function(e){function t(e){var o;return i()(this,t),(o=s()(this,p()(t).call(this,e))).initialize=o.initialize.bind(m()(o)),o.onSetup=o.onSetup.bind(m()(o)),o.focus=o.focus.bind(m()(o)),o}return y()(t,e),l()(t,[{key:"componentDidMount",value:function(){var e=window.wpEditorL10n.tinymce,t=e.baseURL,o=e.suffix;window.tinymce.EditorManager.overrideDefaults({base_url:t,suffix:o}),"complete"===document.readyState?this.initialize():window.addEventListener("DOMContentLoaded",this.initialize)}},{key:"componentWillUnmount",value:function(){window.addEventListener("DOMContentLoaded",this.initialize),v.oldEditor.remove("editor-".concat(this.props.clientId))}},{key:"componentDidUpdate",value:function(e){var t=this.props,o=t.clientId,r=t.isSelected,n=t.attributes.content,c=window.tinymce.get("editor-".concat(o));e.attributes.content!==n&&this.content!==n&&c.setContent(n||""),!r&&c.initialized&&c.fire("blur",{wpBlockDidUpdate:!0})}},{key:"initialize",value:function(){var e=this.props,t=e.clientId,o=e.setAttributes,r=window.wpEditorL10n.tinymce.settings;v.oldEditor.initialize("editor-".concat(t),{tinymce:n()({},r,{inline:!0,content_css:!1,fixed_toolbar_container:"#toolbar-".concat(t),setup:this.onSetup})}),o({id:t})}},{key:"onSetup",value:function(e){var t,o=this,r=this.props,n=r.attributes.content,c=r.setAttributes;this.ref;this.editor=e,n&&e.on("loadContent",function(){return e.setContent(n)}),e.on("blur",function(r){if(!r.wpBlockDidUpdate){t=e.selection.getBookmark(2,!0),o.content=e.getContent();var n=o.props.isSelected;return c({content:o.content}),e.once("focus",function(){t&&e.selection.moveToBookmark(t)}),!n&&void 0}}),e.on("mousedown touchstart",function(){t=null}),e.on("keydown",function(t){t.keyCode!==x&&t.keyCode!==S||!function(e){var t=e.getBody();return!(t.childNodes.length>1)&&(0===t.childNodes.length||!(t.childNodes[0].childNodes.length>1)&&/^\n?$/.test(t.innerText||t.textContent))}(e)||(o.props.onReplace([]),t.preventDefault(),t.stopImmediatePropagation()),t.altKey&&t.keyCode===O&&t.stopPropagation()}),e.on("init",function(){var e=o.editor.getBody();document.activeElement===e&&(e.blur(),o.editor.focus())})}},{key:"focus",value:function(){this.editor&&this.editor.focus()}},{key:"onToolbarKeyDown",value:function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}},{key:"render",value:function(){var e=this,t=this.props,o=t.clientId;t.name;return[k("div",{key:"toolbar",id:"toolbar-".concat(o),ref:function(t){return e.ref=t},className:"block-library-classic__toolbar tma-classic-paragraph__toolbar",onClick:this.focus,"data-placeholder":_.classicParagraphTitle,onKeyDown:this.onToolbarKeyDown}),k("div",{key:"editor",id:"editor-".concat(o),className:"wp-block-freeform block-library-rich-text__tinymce tma-classic-paragraph"})]}}]),t}(g),B=wp.element,E=B.RawHTML,j=B.createElement;var C,M=wp.richText,T=M.join,D=(M.split,M.create),L=M.toHTMLString,z=wp.blocks,N=z.createBlock,I=z.getBlockContent,R={from:(C=[],["core-embed/twitter","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/wordpress","core-embed/soundcloud","core-embed/spotify","core-embed/flickr","core-embed/vimeo","core-embed/animoto","core-embed/cloudup","core-embed/collegehumor","core-embed/crowdsignal","core-embed/dailymotion","core-embed/hulu","core-embed/imgur","core-embed/issuu","core-embed/kickstarter","core-embed/meetup-com","core-embed/mixcloud","core-embed/polldaddy","core-embed/reddit","core-embed/reverbnation","core-embed/screencast","core-embed/scribd","core-embed/slideshare","core-embed/smugmug","core-embed/speaker","core-embed/speaker-deck","core-embed/ted","core-embed/tumblr","core-embed/videopress","core-embed/wordpress-tv","core-embed/amazon-kindle"].forEach(function(e){C.push({type:"block",blocks:[e],transform:function(t){if(!t.url)return N("tadv/classic-paragraph",{content:""});var o,r=I(N(e,t)),n="<p>"+t.url+"</p>";return r&&r.indexOf("</figcaption>")>-1&&r.replace(/<figcaption[^>]*>([\s\S]*?)<\/figcaption>/,function(e,t){o=t}),N("tadv/classic-paragraph",{content:n+=o?"<p>"+o+"</p>":'<p><br data-mce-bogus="1"></p>'})}})}),["core/paragraph","core/image","core/heading","core/gallery","core/list","core/quote","core/code","core/columns","core/freeform","core/html","core/media-text","core/missing","core/preformatted","core/pullquote","core/subhead","core/table","core/text-columns","core/verse"].forEach(function(e){C.push({type:"block",blocks:[e],transform:function(t){var o=I(N(e,t));return(!o||o.indexOf("</div>")>-1)&&(o+='<p><br data-mce-bogus="1"></p>'),N("tadv/classic-paragraph",{content:o})}})}),C.push({type:"raw",priority:21,isMatch:function(){return!0}},{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:function(e){var t=L({value:T(e.map(function(e){var t=e.content;return D({html:t})}),"\u2028"),multilineTag:"p"});return N("tadv/classic-paragraph",{content:t})}},{type:"block",isMultiBlock:!0,blocks:["tadv/classic-paragraph"],transform:function(e){var t=L({value:T(e.map(function(e){var t=e.content;return D({html:t})}),"\u2028")});return N("tadv/classic-paragraph",{content:t})}},{type:"block",isMultiBlock:!0,blocks:["core/freeform"],transform:function(e){var t=L({value:T(e.map(function(e){var t=e.content;return D({html:t})}),"\u2028")});return N("tadv/classic-paragraph",{content:t})}}),C),to:[{type:"block",blocks:["core/freeform"],transform:function(e){return N("core/freeform",e)}},{type:"block",blocks:["core/html"],transform:function(e){return N("core/html",e)}}]},K="tadv/classic-paragraph",U="common",A={content:{type:"string",source:"html"}},H=wp.i18n.__,q=window.tadvBlockRegister,F={name:K,attributes:A,category:U,title:q.classicParagraphTitle,description:q.description,keywords:[H("text")],icon:"welcome-widgets-menus",supports:{className:!1,customClassName:!1,reusable:!0},merge:function(e,t){return{content:(e.content||"")+(t.content||"")}},transforms:R,edit:P,save:function(e){var t=e.attributes.content;return j(E,null,t)}},W=wp.data,$=W.dispatch,G=W.select,J=wp.blocks,Q=J.createBlock,V=J.rawHandler,X=function(){var e,t=G("core/block-editor").getSelectedBlock();if(t){var o=t.attributes.content;o?(/<p data-tadv-p="keep">/.test(o)&&(o=o.replace(/<p data-tadv-p="keep">/g,"<p>")),e=V({HTML:o})):e=Q("core/paragraph"),$("core/block-editor").replaceBlocks(t.clientId,e)}};!function(){var e=window.wp,t=window.tadvBlockRegister;if(e&&t){var o=e.element.createElement,r=e.i18n.__,n=(e.hooks.addFilter,e.editPost.PluginBlockSettingsMenuItem),c=e.plugins.registerPlugin,i=e.blocks,a=i.registerBlockType,l=i.setDefaultBlockName;t.classicParagraph?(a("tadv/classic-paragraph",F),c("tadv-add-submenu",{render:function(){return t.hybridMode&&l("tadv/classic-paragraph"),o(n,{allowedBlocks:["tadv/classic-paragraph"],icon:"screenoptions",label:r("Convert to Blocks"),onClick:X,small:null,role:"menuitem"})}})):t.hybridMode&&c("tadv-set-default-block",{render:function(){return l("core/freeform"),null}})}}()}]);
1
+ !function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([,function(e,t,o){"use strict";o.r(t);const{wp:r}=window,{Component:n,createElement:c}=r.element,{BACKSPACE:i,DELETE:a,F10:s}=r.keycodes,l=window.tadvBlockRegister;const{RawHTML:d,createElement:p}=wp.element;const{join:u,split:m,create:b,toHTMLString:f}=wp.richText,{createBlock:h,getBlockContent:g}=wp.blocks;var k={from:(()=>{const e=[];return["core-embed/twitter","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/wordpress","core-embed/soundcloud","core-embed/spotify","core-embed/flickr","core-embed/vimeo","core-embed/animoto","core-embed/cloudup","core-embed/collegehumor","core-embed/crowdsignal","core-embed/dailymotion","core-embed/hulu","core-embed/imgur","core-embed/issuu","core-embed/kickstarter","core-embed/meetup-com","core-embed/mixcloud","core-embed/polldaddy","core-embed/reddit","core-embed/reverbnation","core-embed/screencast","core-embed/scribd","core-embed/slideshare","core-embed/smugmug","core-embed/speaker","core-embed/speaker-deck","core-embed/ted","core-embed/tumblr","core-embed/videopress","core-embed/wordpress-tv","core-embed/amazon-kindle"].forEach(t=>{e.push({type:"block",blocks:[t],transform:e=>{if(!e.url)return h("tadv/classic-paragraph",{content:""});const o=g(h(t,e));let r,n="<p>"+e.url+"</p>";return o&&o.indexOf("</figcaption>")>-1&&o.replace(/<figcaption[^>]*>([\s\S]*?)<\/figcaption>/,(function(e,t){r=t})),n+=r?"<p>"+r+"</p>":'<p><br data-mce-bogus="1"></p>',h("tadv/classic-paragraph",{content:n})}})}),["core/paragraph","core/image","core/heading","core/gallery","core/list","core/quote","core/code","core/columns","core/freeform","core/html","core/media-text","core/missing","core/preformatted","core/pullquote","core/subhead","core/table","core/text-columns","core/verse"].forEach(t=>{e.push({type:"block",blocks:[t],transform:e=>{let o=g(h(t,e));return(!o||o.indexOf("</div>")>-1)&&(o+='<p><br data-mce-bogus="1"></p>'),h("tadv/classic-paragraph",{content:o})}})}),e.push({type:"raw",priority:21,isMatch:()=>!0},{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>{const t=f({value:u(e.map(({content:e})=>b({html:e})),"\u2028"),multilineTag:"p"});return h("tadv/classic-paragraph",{content:t})}},{type:"block",isMultiBlock:!0,blocks:["tadv/classic-paragraph"],transform:e=>{const t=f({value:u(e.map(({content:e})=>b({html:e})),"\u2028")});return h("tadv/classic-paragraph",{content:t})}},{type:"block",isMultiBlock:!0,blocks:["core/freeform"],transform:e=>{const t=f({value:u(e.map(({content:e})=>b({html:e})),"\u2028")});return h("tadv/classic-paragraph",{content:t})}}),e})(),to:[{type:"block",blocks:["core/freeform"],transform:e=>h("core/freeform",e)},{type:"block",blocks:["core/html"],transform:e=>h("core/html",e)}]};const{__:y}=wp.i18n,v=window.tadvBlockRegister,{name:w,attributes:B,category:_}={name:"tadv/classic-paragraph",category:"common",attributes:{content:{type:"string",source:"html"},align:{type:"string"}}};var x={name:w,attributes:B,category:_,title:v.classicParagraphTitle,description:v.description,keywords:[y("text")],icon:"welcome-widgets-menus",supports:{className:!1,customClassName:!1,reusable:!0},merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),transforms:k,edit:class extends n{constructor(e){super(e),this.initialize=this.initialize.bind(this),this.onSetup=this.onSetup.bind(this),this.focus=this.focus.bind(this)}componentDidMount(){const{baseURL:e,suffix:t}=window.wpEditorL10n.tinymce;window.tinymce.EditorManager.overrideDefaults({base_url:e,suffix:t}),"complete"===document.readyState?this.initialize():window.addEventListener("DOMContentLoaded",this.initialize)}componentWillUnmount(){window.addEventListener("DOMContentLoaded",this.initialize),r.oldEditor.remove(`editor-${this.props.clientId}`)}componentDidUpdate(e){const{clientId:t,isSelected:o,attributes:{content:r}}=this.props,n=window.tinymce.get(`editor-${t}`);e.attributes.content!==r&&this.content!==r&&n.setContent(r||""),!o&&n.initialized&&n.fire("blur",{wpBlockDidUpdate:!0})}initialize(){const{clientId:e,setAttributes:t}=this.props,{settings:o}=window.wpEditorL10n.tinymce;r.oldEditor.initialize(`editor-${e}`,{tinymce:{...o,inline:!0,content_css:!1,fixed_toolbar_container:`#toolbar-${e}`,setup:this.onSetup}}),t({id:e})}onSetup(e){const{attributes:{content:t},setAttributes:o}=this.props;let r;this.editor=e,t&&e.on("loadContent",()=>e.setContent(t)),e.on("blur",t=>{if(t.wpBlockDidUpdate)return;r=e.selection.getBookmark(2,!0),this.content=e.getContent();const{isSelected:n}=this.props;return o({content:this.content}),e.once("focus",()=>{r&&e.selection.moveToBookmark(r)}),!n&&void 0}),e.on("mousedown touchstart",()=>{r=null}),e.on("keydown",t=>{t.keyCode!==i&&t.keyCode!==a||!function(e){const t=e.getBody();return!(t.childNodes.length>1)&&(0===t.childNodes.length||!(t.childNodes[0].childNodes.length>1)&&/^\n?$/.test(t.innerText||t.textContent))}(e)||(this.props.onReplace([]),t.preventDefault(),t.stopImmediatePropagation());const{altKey:o}=t;o&&t.keyCode===s&&t.stopPropagation()}),e.on("init",()=>{const e=this.editor.getBody();document.activeElement===e&&(e.blur(),this.editor.focus())})}focus(){this.editor&&this.editor.focus()}onToolbarKeyDown(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}render(){const{clientId:e,name:t,attributes:o,setAttributes:r}=this.props;return[c("div",{key:"toolbar",id:`toolbar-${e}`,className:"block-library-classic__toolbar tma-classic-paragraph__toolbar",onClick:this.focus,"data-placeholder":l.classicParagraphTitle,onKeyDown:this.onToolbarKeyDown}),c("div",{key:"editor",id:`editor-${e}`,className:"wp-block-freeform block-library-rich-text__tinymce tma-classic-paragraph"})]}},save:function({attributes:e}){const{content:t}=e;return p(d,null,t)}};const{dispatch:C,select:E}=wp.data,{createBlock:M,rawHandler:S}=wp.blocks;var P=function(){const e=E("core/block-editor").getSelectedBlock();let t;if(e){let o=e.attributes.content;o?(/<p data-tadv-p="keep">/.test(o)&&(o=o.replace(/<p data-tadv-p="keep">/g,"<p>")),t=S({HTML:o})):t=M("core/paragraph"),C("core/block-editor").replaceBlocks(e.clientId,t)}};!function(){const e=window.wp,t=window.tadvBlockRegister;if(!e||!t)return;const{createElement:o}=e.element,{__:r}=e.i18n,{addFilter:n}=e.hooks,{PluginBlockSettingsMenuItem:c}=e.editPost,{registerPlugin:i}=e.plugins,{registerBlockType:a,setDefaultBlockName:s}=e.blocks;t.classicParagraph?(a("tadv/classic-paragraph",x),i("tadv-add-submenu",{render:()=>(t.hybridMode&&s("tadv/classic-paragraph"),o(c,{allowedBlocks:["tadv/classic-paragraph"],icon:"screenoptions",label:r("Convert to Blocks"),onClick:P,small:null,role:"menuitem"}))})):t.hybridMode&&i("tadv-set-default-block",{render:()=>(s("core/freeform"),null)})}()}]);
block-editor/richtext-buttons.css CHANGED
@@ -1 +1 @@
1
- .tadv-buttons-panel .components-toolbar__control.tadv-icon-button{width:38px;height:38px}.tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{height:32px;width:32px}.tadv-buttons-panel .components-toolbar{border:none;display:block}.tadv-buttons-panel div.components-toolbar>div{display:inline-block;margin:0}.dashicons-editor-textcolor{background-color:#fff9c0;background-clip:content-box}
1
+ .tadv-buttons-panel .components-toolbar__control.tadv-icon-button{width:38px;height:38px;padding:3px}.tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{height:32px;width:32px;padding:5px;border-radius:4px;box-sizing:border-box;outline:none;box-shadow:none}.tadv-buttons-panel .components-toolbar{border:none;display:block}.tadv-buttons-panel div.components-toolbar>div{display:inline-block;margin:0}.tadv-mark-icon{background-color:#fff9c0;background-clip:content-box}
block-editor/richtext-buttons.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=10)}({10:function(t,e,o){"use strict";o.r(e);var n=window.tadvBlockButtons,r=window.wp,a=window.lodash.get,c=r.element.createElement,i=r.blockEditor,l=i.InspectorControls,u=i.PanelColorSettings,s=r.richText,d=s.registerFormatType,v=s.applyFormat,m=s.removeFormat,p=s.getActiveFormat;function f(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}var h,g=window.tadvBlockButtons||{},b=window.wp,y=b.blockEditor.RichTextToolbarButton,k=b.richText,T=k.registerFormatType,w=k.removeFormat,x=b.element.createElement,F=b.components.ToolbarButton;function C(t){var e=[];return h||(h=g.formats_to_remove&&g.formats_to_remove.indexOf(",")>-1?g.formats_to_remove.split(","):["core/bold","core/italic","core/code","core/underline","core/strikethrough","tadv/sup","tadv/sub","tadv/mark","tadv/color-panel","tadv/background-color-panel"]),t.forEach(function(t){t&&t.forEach(function(t){h.indexOf(t.type)>-1&&-1===e.indexOf(t.type)&&e.push(t.type)})}),e}function B(t){var e=t.formats;if(!e.length)return t;var o=0,n=e.length;t.end>t.start&&(o=t.start,n=t.end,e=e.slice(o,n));var r=C(e);return r.length?(r.forEach(function(e){t=w(t,e,o,n)}),t):t}var N="tadv/removeformat",A=g.strRemoveFormatting||"Remove formatting",E="editor-removeformatting";var _=window.wp,S=_.element,O=S.createElement,R=S.Fragment,P=_.i18n.__,M=_.components.ToolbarButton,j=_.blockEditor,U=j.RichTextToolbarButton,I=j.RichTextShortcut,z=_.richText,L=z.registerFormatType,G=z.getActiveFormat,V=z.toggleFormat,$=(z.applyFormat,z.removeFormat,"core/strikethrough"),q=P("Strikethrough"),D="editor-strikethrough";function H(t,e){e(V(t,{type:$}))}var J=window.wp,K=J.element,Q=K.createElement,W=K.Fragment,X=J.i18n.__,Y=J.components.ToolbarButton,Z=J.blockEditor,tt=Z.RichTextToolbarButton,et=Z.RichTextShortcut,ot=J.richText,nt=ot.registerFormatType,rt=ot.getActiveFormat,at=ot.toggleFormat,ct=ot.applyFormat,it=ot.remove,lt="core/code",ut=X("Inline Code"),st="editor-code";function dt(t,e){e(at(t,{type:lt}))}var vt=window.wp,mt=window.tadvBlockButtons||{},pt=vt.element,ft=pt.createElement,ht=pt.Fragment,gt=(vt.i18n.__,vt.components.ToolbarButton),bt=vt.blockEditor,yt=bt.RichTextToolbarButton,kt=bt.RichTextShortcut,Tt=vt.richText,wt=Tt.registerFormatType,xt=Tt.getActiveFormat,Ft=Tt.toggleFormat,Ct=(Tt.applyFormat,Tt.removeFormat,"tadv/mark"),Bt=mt.strMark||"Mark",Nt="editor-textcolor";function At(t,e){e(Ft(t,{type:Ct}))}var Et=window.wp,_t=window.tadvBlockButtons||{},St=Et.element,Ot=St.createElement,Rt=St.Fragment,Pt=Et.i18n.__,Mt=Et.components.ToolbarButton,jt=Et.blockEditor,Ut=jt.RichTextToolbarButton,It=jt.RichTextShortcut,zt=Et.richText,Lt=zt.registerFormatType,Gt=zt.getActiveFormat,Vt=zt.applyFormat,$t=zt.removeFormat,qt="core/underline",Dt=Pt("Underline"),Ht="editor-underline";function Jt(t,e){Gt(t,qt)?e($t(t,qt)):e(Vt(t,{type:qt,attributes:{style:"text-decoration: underline"}}))}var Kt=window.wp,Qt=Kt.element,Wt=Qt.createElement,Xt=(Qt.Fragment,Kt.i18n.__),Yt=Kt.components.ToolbarButton,Zt=Kt.blockEditor,te=(Zt.RichTextToolbarButton,Zt.RichTextShortcut,Kt.richText),ee=(te.registerFormatType,te.getActiveFormat),oe=te.toggleFormat;function ne(t,e){e(oe(t,{type:"core/bold"}))}var re=window.wp,ae=re.element,ce=ae.createElement,ie=(ae.Fragment,re.i18n.__),le=re.components.ToolbarButton,ue=re.blockEditor,se=(ue.RichTextToolbarButton,ue.RichTextShortcut,re.richText),de=(se.registerFormatType,se.getActiveFormat),ve=se.toggleFormat;function me(t,e){e(ve(t,{type:"core/italic"}))}var pe=window.wp,fe=window.tadvBlockButtons,he=pe.element,ge=he.createElement,be=he.Fragment,ye=pe.richText,ke=ye.registerFormatType,Te=ye.getActiveFormat,we=ye.toggleFormat,xe=pe.components.ToolbarButton,Fe=pe.blockEditor,Ce=Fe.RichTextToolbarButton,Be=Fe.RichTextShortcut,Ne=pe.components,Ae=Ne.Path,Ee=Ne.SVG,_e=ge(Ee,{viewBox:"-85 -985 1024 1024",xmlns:"http://www.w3.org/2000/svg"},ge(Ae,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 754v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"})),Se=ge(Ee,{viewBox:"-85 -975 1024 1024",xmlns:"http://www.w3.org/2000/svg"},ge(Ae,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 50v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"}));function Oe(t,e,o){e(we(t,{type:o}))}function Re(t,e){var o=t.type,n=t.tagName,r=t.title,a=t.character,c=t.icon;ke(o,{title:r,tagName:n,className:null,edit:function(t){var n=t.isActive,i=t.value,l=t.onChange,u=null,s=ge(Be,{type:"primary",character:a,onUse:function(){return Oe(i,l,o)}});return e||(u=ge(Ce,{title:r,icon:c,onClick:function(){return Oe(i,l,o)},isActive:n,shortcutType:"primary",shortcutCharacter:a})),ge(be,null,s,u)}})}var Pe,Me=window.wp,je=Me.element.createElement,Ue=Me.data.select,Ie=Me.hooks.addFilter,ze=Me.components,Le=ze.PanelBody,Ge=ze.Toolbar,Ve=Me.blockEditor.InspectorControls,$e=Me.richText,qe=$e.registerFormatType,De=$e.unregisterFormatType,He=window.tadvBlockButtons||{},Je=He.buttons?He.buttons.split(","):[],Ke=He.panelButtons?He.panelButtons.split(","):[],Qe=He.unusedButtons?He.unusedButtons.split(","):[],We={"tadv/mark":function(t){wt(Ct,{title:mt.strMark,tagName:"mark",className:null,edit:function(e){var o=e.isActive,n=e.value,r=e.onChange,a=null,c=ft(kt,{type:"access",character:"m",onUse:function(){return At(n,r)}});return t||(a=ft(yt,{icon:Nt,title:Bt,onClick:function(){return At(n,r)},className:"tadv-icon-button-mark",isActive:o,shortcutType:"access",shortcutCharacter:"m"})),ft(ht,null,c,a)}})},"tadv/removeformat":function(t){T(N,{title:A,tagName:"u",className:"remove-format",edit:function(e){e.isActive;var o=e.value,n=e.onChange;return t?null:x(y,{icon:E,title:A,onClick:function(){return n(B(o))},isActive:null})}})},"tadv/sub":function(t){Re({type:"tadv/sub",tagName:"sub",title:fe.strSubscript,character:",",icon:Se},t)},"tadv/sup":function(t){Re({type:"tadv/sup",tagName:"sup",title:fe.strSuperscript,character:".",icon:_e},t)},"core/code":function(t){nt(lt,{title:ut,tagName:"code",className:null,__unstableInputRule:function(t){var e=t,o=e.start,n=e.text;if("`"!==n.slice(o-1,o))return t;var r=n.slice(0,o-1).lastIndexOf("`");if(-1===r)return t;var a=r,c=o-2;return a===c?t:(t=it(t,a,a+1),t=it(t,c,c+1),t=ct(t,{type:lt},a,c))},edit:function(e){var o=e.isActive,n=e.value,r=e.onChange,a=null,c=Q(et,{type:"access",character:"x",onUse:function(){return dt(n,r)}});return t||(a=Q(tt,{icon:st,title:ut,onClick:function(){return dt(n,r)},isActive:o,shortcutType:"access",shortcutCharacter:"x"})),Q(W,null,c,a)}})},"core/strikethrough":function(t){L($,{name:$,title:q,tagName:"s",className:null,edit:function(e){var o=e.isActive,n=e.value,r=e.onChange,a=null,c=O(I,{type:"access",character:"d",onUse:function(){return H(n,r)}});return t||(a=O(U,{icon:D,title:q,onClick:function(){return H(n,r)},isActive:o,shortcutType:"access",shortcutCharacter:"d"})),O(R,null,c,a)}})},"core/underline":function(t){Lt(qt,{title:Dt,tagName:"span",className:"underline",attributes:{style:"style"},edit:function(e){var o=e.isActive,n=e.value,r=e.onChange,a=null,c=Ot(It,{type:"primary",character:"u",onUse:function(){return Jt(n,r)}});return t||(a=Ot(Ut,{title:_t.strUnderline,icon:"editor-underline",onClick:function(){return Jt(n,r)},className:null,isActive:o,shortcutType:"primary",shortcutCharacter:"u"})),Ot(Rt,null,c,a)}})}},Xe={"core/bold":function(t,e,o){return Wt(Yt,{key:"core/bold",icon:"editor-bold",className:"tadv-icon-button",isActive:ee(e,"core/bold"),title:Xt("Bold"),onClick:function(){return ne(e,o)}})},"core/italic":function(t,e,o){return ce(le,{key:"core/italic",icon:"editor-italic",className:"tadv-icon-button",isActive:de(e,"core/italic"),title:ie("Italic"),onClick:function(){return me(e,o)}})},"core/code":function(t,e,o){return Q(Y,{key:lt,icon:st,className:"tadv-icon-button",isActive:rt(e,lt),title:ut,onClick:function(){return dt(e,o)}})},"core/strikethrough":function(t,e,o){return O(M,{key:$,icon:D,title:q,className:"tadv-icon-button",isActive:G(e,$),onClick:function(){return H(e,o)}})},"core/underline":function(t,e,o){return Ot(Mt,{key:qt,title:Dt,icon:Ht,className:"tadv-icon-button",isActive:Gt(e,qt),onClick:function(){return Jt(e,o)}})},"tadv/removeformat":function(t,e,o){return x(F,{key:N,icon:E,title:A,className:"tadv-icon-button",onClick:function(){return o(B(e))}})},"tadv/mark":function(t,e,o){return ft(gt,{key:Ct,icon:Nt,title:Bt,className:"tadv-icon-button tadv-icon-button-mark",isActive:xt(e,Ct),onClick:function(){return At(e,o)}})},"tadv/sup":function(t,e,o){var n="tadv/sup",r={key:n,icon:_e,className:"tadv-icon-button",isActive:Te(e,n),title:fe.strSuperscript,onClick:function(){return Oe(e,o,n)}};return ge(xe,r)},"tadv/sub":function(t,e,o){var n="tadv/sub",r={key:n,icon:Se,className:"tadv-icon-button",isActive:Te(e,n),title:fe.strSubscript,onClick:function(){return Oe(e,o,n)}};return ge(xe,r)}};function Ye(t){(function(t){var e=Ue("core/rich-text").getFormatTypes(),o=!1;return e.forEach(function(e){e.name===t&&(o=!0)}),o})(t)&&De(t)}function Ze(){Qe.length&&Qe.forEach(function(t){Ye(t)}),Je.forEach(function(t){We.hasOwnProperty(t)&&(Ye(t),We[t].call(null))}),Ke.length&&(Ke.forEach(function(t){-1===Je.indexOf(t)&&We.hasOwnProperty(t)&&(Ye(t),We[t].call(null,"panel"))}),qe("tadv/tadv-format-panel",{title:He.strFormatting,tagName:"span",className:"tadv-format-panel",edit:function(t){var e=t.isActive,o=t.value,n=t.onChange,r=[];return Ke.forEach(function(t){Xe.hasOwnProperty(t)&&r.push(Xe[t].call(null,e,o,n))}),je(Ve,null,je(Le,{title:He.strFormatting,className:"tadv-buttons-panel"},je(Ge,null,r)))}})),function(){if(n.colorPanel){var t=n.colorPanel.indexOf("tadv/color-panel")>-1,e=n.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&d("tadv/color-panel",{title:n.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit:function(t){var o,r,i=t.isActive,s=t.value,d=t.onChange;if(i){var h=p(s,"tadv/color-panel"),g=a(h,["attributes","style"])||"",b=p(s,"tadv/background-color-panel"),y=a(b,["attributes","style"])||"";o=f(g),r=f(y)}var k=[{value:o,onChange:function(t){d(t?v(s,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):m(s,"tadv/color-panel"))},label:n.strTextColorLabel}];return e&&k.push({value:r,onChange:function(t){d(t?v(s,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):m(s,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}),c(l,null,c(u,{title:n.strTextColor,initialOpen:!1,colorSettings:k}))}}),d("tadv/background-color-panel",{title:n.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit:function(o){var r,i=o.isActive,s=o.value,d=o.onChange;if(!e||t)return null;if(i){var h=p(s,"tadv/background-color-panel");r=f(a(h,["attributes","style"])||"")}var g=[{value:r,onChange:function(t){d(t?v(s,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):m(s,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}];return c(l,null,c(u,{title:n.strTextColor,initialOpen:!1,colorSettings:g}))}})}}()}Ie("blocks.registerBlockType","tadv-register-formats",function(t){return Pe||(Ze(),Pe=!0),t})}});
1
+ !function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=0)}([function(t,e,o){"use strict";o.r(e);const n=window.tadvBlockButtons,{wp:r}=window,{get:a}=window.lodash,{createElement:c}=r.element,{InspectorControls:l,PanelColorSettings:i}=r.blockEditor,{registerFormatType:s,applyFormat:u,removeFormat:d,getActiveFormat:v}=r.richText;function m(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}const h=window.tadvBlockButtons||{},{wp:p}=window,{RichTextToolbarButton:g}=p.blockEditor,{registerFormatType:f,removeFormat:b}=p.richText,{createElement:y}=p.element,{ToolbarButton:k}=p.components,w=h.strRemoveFormatting||"Clear formatting";let F;function T(t){const e=[];return F||(F=h.formats_to_remove?h.formats_to_remove.split(","):["core/bold","core/italic","core/code","core/underline","core/strikethrough","core/text-color","tadv/sup","tadv/sub","tadv/mark","tadv/color-panel","tadv/background-color-panel"]),t.forEach(t=>{t&&t.forEach(t=>{F.indexOf(t.type)>-1&&-1===e.indexOf(t.type)&&e.push(t.type)})}),e}function C(t){let e=t.formats;if(!e.length)return t;let o=0,n=e.length;t.end>t.start&&(o=t.start,n=t.end,e=e.slice(o,n));const r=T(e);return r.length?(r.forEach(e=>{t=b(t,e,o,n)}),t):t}const{wp:x}=window,{createElement:B,Fragment:A}=(window.tadvBlockButtons,x.element),{__:N}=x.i18n,{ToolbarButton:E}=x.components,{RichTextToolbarButton:S,RichTextShortcut:_}=x.blockEditor,{registerFormatType:O,getActiveFormat:P,toggleFormat:R,applyFormat:M,removeFormat:U}=x.richText,j=N("Strikethrough");function z(t,e,o){e(R(t,{type:"core/strikethrough"})),o&&o()}const{wp:L}=window,{createElement:I,Fragment:G}=L.element,{__:H}=L.i18n,{ToolbarButton:V}=L.components,{RichTextToolbarButton:$,RichTextShortcut:q}=L.blockEditor,{registerFormatType:D,getActiveFormat:J,toggleFormat:K,remove:Q,applyFormat:W}=L.richText,X=H("Inline Code");function Y(t,e,o){e(K(t,{type:"core/code"})),o&&o()}const{wp:Z}=window,tt=window.tadvBlockButtons||{},{createElement:et,Fragment:ot}=Z.element,{__:nt}=Z.i18n,{ToolbarButton:rt}=Z.components,{RichTextToolbarButton:at,RichTextShortcut:ct}=Z.blockEditor,{Path:lt,SVG:it}=Z.components,{registerFormatType:st,getActiveFormat:ut,toggleFormat:dt,applyFormat:vt,removeFormat:mt}=Z.richText,ht=et(it,{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"dashicon tadv-mark-icon"},et(lt,{"aria-hidden":"true",role:"img",focusable:"false",width:"20",height:"20",d:"M13.23 15h1.9L11 4H9L5 15h1.88l1.07-3h4.18zm-1.53-4.54H8.51L10 5.6z"})),pt=tt.strMark;function gt(t,e,o){e(dt(t,{type:"tadv/mark"})),o&&o()}const{wp:ft}=window,bt=window.tadvBlockButtons||{},{createElement:yt,Fragment:kt}=ft.element,{__:wt}=ft.i18n,{ToolbarButton:Ft}=ft.components,{RichTextToolbarButton:Tt,RichTextShortcut:Ct}=ft.blockEditor,{registerFormatType:xt,getActiveFormat:Bt,applyFormat:At,removeFormat:Nt}=ft.richText;function Et(t,e,o,n){if(t)o(Nt(e,"core/underline"));else{o(At(e,{type:"core/underline",attributes:{style:"text-decoration: underline"}}))}n&&n()}const{wp:St}=window,_t=window.tadvBlockButtons,{createElement:Ot,Fragment:Pt}=St.element,{registerFormatType:Rt,getActiveFormat:Mt,toggleFormat:Ut}=St.richText,{ToolbarButton:jt}=St.components,{RichTextToolbarButton:zt,RichTextShortcut:Lt}=St.blockEditor,{Path:It,SVG:Gt}=St.components,Ht=Ot(Gt,{viewBox:"-85 -985 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 754v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"})),Vt=Ot(Gt,{viewBox:"-85 -975 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ot(It,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 50v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"}));function $t(t,e,o,n){o(Ut(e,{type:t})),n&&n()}function qt({type:t,tagName:e,title:o,character:n,icon:r},a){Rt(t,{title:o,tagName:e,className:null,edit({value:e,onChange:c,onFocus:l,isActive:i}){let s=null;return a||(s=Ot(zt,{title:o,icon:r,onClick:()=>$t(t,e,c,l),isActive:i,shortcutType:"primary",shortcutCharacter:n})),Ot(Pt,null,Ot(Lt,{type:"primary",character:n,onUse:()=>$t(t,e,c)}),s)}})}const{wp:Dt}=window,{createElement:Jt}=Dt.element,{select:Kt}=Dt.data,{addFilter:Qt}=Dt.hooks,{PanelBody:Wt,Toolbar:Xt}=Dt.components,{InspectorControls:Yt}=Dt.blockEditor,{registerFormatType:Zt,unregisterFormatType:te}=Dt.richText,ee=window.tadvBlockButtons||{},oe=ee.buttons?ee.buttons.split(","):[],ne=ee.panelButtons?ee.panelButtons.split(","):[],re=ee.unusedButtons?ee.unusedButtons.split(","):[],ae={"tadv/mark":function(t){st("tadv/mark",{title:pt,tagName:"mark",className:null,edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=et(at,{title:pt,icon:ht,onClick:()=>gt(e,o,n),className:"tadv-icon-button-mark",isActive:r,shortcutType:"access",shortcutCharacter:"m"})),et(ot,null,et(ct,{type:"access",character:"m",onUse:()=>gt(e,o)}),a)}})},"tadv/removeformat":function(t){f("tadv/removeformat",{title:w,tagName:"u",className:"remove-format",edit:({value:e,onChange:o,onFocus:n,isActive:r})=>t?null:y(g,{icon:"editor-removeformatting",title:w,onClick:()=>o(C(e)),isActive:null})})},"tadv/sub":function(t){qt({type:"tadv/sub",tagName:"sub",title:_t.strSubscript,character:",",icon:Vt},t)},"tadv/sup":function(t){qt({type:"tadv/sup",tagName:"sup",title:_t.strSuperscript,character:".",icon:Ht},t)},"core/code":function(t){D("core/code",{title:X,tagName:"code",className:null,__unstableInputRule(t){const{start:e,text:o}=t;if("`"!==o.slice(e-1,e))return t;const n=o.slice(0,e-1).lastIndexOf("`");if(-1===n)return t;const r=n,a=e-2;return r===a?t:(t=Q(t,r,r+1),t=Q(t,a,a+1),t=W(t,{type:"core/code"},r,a))},edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=I($,{icon:"editor-code",title:X,onClick:()=>Y(e,o,n),isActive:r,shortcutType:"access",shortcutCharacter:"x"})),I(G,null,I(q,{type:"access",character:"x",onUse:()=>Y(e,o)}),a)}})},"core/strikethrough":function(t){O("core/strikethrough",{name:"core/strikethrough",title:j,tagName:"s",className:null,edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=B(S,{icon:"editor-strikethrough",title:j,onClick:()=>z(e,o,n),isActive:r,shortcutType:"access",shortcutCharacter:"d"})),B(A,null,B(_,{type:"access",character:"d",onUse:()=>z(e,o)}),a)}})},"core/underline":function(t){xt("core/underline",{title:bt.strUnderline,tagName:"span",className:"underline",attributes:{style:"style"},edit({value:e,onChange:o,onFocus:n,isActive:r}){let a=null;return t||(a=yt(Tt,{title:bt.strUnderline,icon:"editor-underline",onClick:()=>Et(r,e,o,n),className:null,isActive:r,shortcutType:"primary",shortcutCharacter:"u"})),yt(kt,null,yt(Ct,{type:"primary",character:"u",onUse:()=>Et(r,e,o)}),a)}})}},ce={"core/code":function({value:t,onChange:e,onFocus:o,isActive:n}){return I(V,{key:"core/code",icon:"editor-code",className:"tadv-icon-button",isActive:J(t,"core/code"),title:X,onClick:()=>Y(t,e,o)})},"core/strikethrough":function({value:t,onChange:e,onFocus:o,isActive:n}){return B(E,{key:"core/strikethrough",icon:"editor-strikethrough",className:"tadv-icon-button",isActive:P(t,"core/strikethrough"),title:j,onClick:()=>z(t,e,o)})},"core/underline":function({value:t,onChange:e,onFocus:o,isActive:n}){const r=!!Bt(t,"core/underline");return yt(Ft,{key:"core/underline",icon:"editor-underline",className:"tadv-icon-button",isActive:r,title:bt.strUnderline,onClick:()=>Et(r,t,e,o)})},"tadv/removeformat":function({value:t,onChange:e,onFocus:o,isActive:n}){return y(k,{key:"tadv/removeformat",icon:"editor-removeformatting",className:"tadv-icon-button",title:w,onClick:()=>e(C(t))})},"tadv/mark":function({value:t,onChange:e,onFocus:o,isActive:n}){return et(rt,{key:"tadv/mark",icon:"editor-textcolor",className:"tadv-icon-button tadv-icon-button-mark",isActive:ut(t,"tadv/mark"),title:pt,onClick:()=>gt(t,e,o)})},"tadv/sup":function({value:t,onChange:e,onFocus:o,isActive:n}){return Ot(jt,{key:"tadv/sup",icon:Ht,className:"tadv-icon-button",isActive:Mt(t,"tadv/sup"),title:_t.strSuperscript,onClick:()=>$t("tadv/sup",t,e,o)})},"tadv/sub":function({value:t,onChange:e,onFocus:o,isActive:n}){return Ot(jt,{key:"tadv/sub",icon:Vt,className:"tadv-icon-button",isActive:Mt(t,"tadv/sub"),title:_t.strSubscript,onClick:()=>$t("tadv/sub",t,e,o)})}};function le(t){(function(t){const e=Kt("core/rich-text").getFormatTypes();let o=!1;return e.forEach(e=>{e.name===t&&(o=!0)}),o})(t)&&te(t)}function ie(){re.length&&re.forEach(t=>{le(t)}),oe.forEach(t=>{ae.hasOwnProperty(t)&&(le(t),ae[t].call(null))}),ne.length&&(ne.forEach(t=>{-1===oe.indexOf(t)&&ae.hasOwnProperty(t)&&(le(t),ae[t].call(null,"panel"))}),Zt("tadv/tadv-format-panel",{title:ee.strFormatting,tagName:"span",className:"tadv-format-panel",edit({value:t,onChange:e,onFocus:o,isActive:n}){const r=[];return ne.forEach(a=>{ce.hasOwnProperty(a)&&r.push(ce[a].call(null,{value:t,onChange:e,onFocus:o,isActive:n}))}),Jt(Yt,null,Jt(Wt,{title:ee.strFormatting,className:"tadv-buttons-panel"},Jt(Xt,null,r)))}})),function(){if(!n.colorPanel)return;const t=n.colorPanel.indexOf("tadv/color-panel")>-1,e=n.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&s("tadv/color-panel",{title:n.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit({isActive:t,value:o,onChange:r}){let s,h;if(t){const t=v(o,"tadv/color-panel"),e=a(t,["attributes","style"])||"",n=v(o,"tadv/background-color-panel"),r=a(n,["attributes","style"])||"";s=m(e),h=m(r)}const p=[{value:s,onChange:t=>{r(t?u(o,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):d(o,"tadv/color-panel"))},label:n.strTextColorLabel}];return e&&p.push({value:h,onChange:t=>{r(t?u(o,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(o,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}),c(l,null,c(i,{title:n.strTextColor,initialOpen:!1,colorSettings:p}))}}),s("tadv/background-color-panel",{title:n.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit({isActive:o,value:r,onChange:s}){if(!e||t)return null;let h;if(o){const t=v(r,"tadv/background-color-panel");h=m(a(t,["attributes","style"])||"")}const p=[{value:h,onChange:t=>{s(t?u(r,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):d(r,"tadv/background-color-panel"))},label:n.strBackgroundColorLabel}];return c(l,null,c(i,{title:n.strTextColor,initialOpen:!1,colorSettings:p}))}})}()}let se;Qt("blocks.registerBlockType","tadv-register-formats",(function(t){return se||(ie(),se=!0),t}))}]);
block-editor/tma-block-editor.css CHANGED
@@ -1 +1 @@
1
- div[data-type="core/freeform"].is-selected .block-library-classic__toolbar,div[data-type="core/freeform"].is-typing .block-library-classic__toolbar{display:block;border-color:transparent}.block-library-classic__toolbar .mce-btn .mce-txt{font-size:13px;color:#454545}.mce-tinymce-inline .mce-menubar>div,.mce-tinymce-inline .mce-toolbar .mce-btn-group>div{white-space:normal}div.mce-menubar,div.mce-menubar *{box-sizing:border-box}.block-library-classic__toolbar .mce-menubar{padding:2px 2px 1px}.block-library-classic__toolbar .mce-menubar .mce-menubtn button span{font-size:13px}.block-library-classic__toolbar .mce-menubar i.mce-caret{margin-top:.35em}.block-library-classic__toolbar .mce-menubar .mce-flow-layout-item{margin:2px 0}div.mce-menubar.mce-toolbar .mce-btn button{padding:3px 4px 2px}div.mce-menubar{border-color:#e5e5e5;background:#fff;border-width:0 0 1px}div.mce-menubar .mce-menubtn:focus{color:#124964;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}div.mce-menu-item-sep:hover,div.mce-menu .mce-menu-item-sep{border-bottom:1px solid #ddd;height:0;margin:5px 0}div.mce-menubtn span{margin-right:0;padding-left:3px}div.mce-menu-has-icons i.mce-ico:before{margin-left:0}div.mce-menu-has-icons i.mce-ico{line-height:16px}.wp-core-ui .mce-menu-item .mce-text{font-size:13px}.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active,.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus,.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover{border-color:transparent}.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active span,.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus span,.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover span{color:#000}.mce-inline-toolbar-grp div.wp-link-input{margin:2px 4px}.mce-inline-toolbar-grp div.wp-link-input input{padding:4px}div.mce-menu-item.mce-menu-item-preview.mce-active:hover,div.mce-menu .mce-menu-item-normal.mce-active,div.mce-menu .mce-menu-item-preview.mce-active,div.mce-menu .mce-menu-item.mce-selected,div.mce-menu .mce-menu-item:focus,div.mce-menu .mce-menu-item:hover{background:#0073aa;color:#fff}div.mce-menu-item.mce-active .mce-menu-shortcut,div.mce-menu-item.mce-disabled:hover .mce-ico,div.mce-menu-item.mce-disabled:hover .mce-text,div.mce-menu-item.mce-menu-item-preview.mce-active .mce-ico,div.mce-menu-item.mce-menu-item-preview.mce-active .mce-text,div.mce-menu-item:focus .mce-ico,div.mce-menu-item:focus .mce-menu-shortcut,div.mce-menu-item:focus .mce-text,div.mce-menu-item:hover .mce-ico,div.mce-menu-item:hover .mce-menu-shortcut,div.mce-menu-item:hover .mce-text{color:inherit}div.mce-menu .mce-menu-item.mce-disabled{cursor:default}div.mce-menu .mce-menu-item.mce-disabled:hover{background:#ccc}div.mce-inline-toolbar-grp .mce-btn.mce-active:hover button,div.mce-inline-toolbar-grp .mce-btn.mce-active:hover i,div.mce-inline-toolbar-grp .mce-btn.mce-active button,div.mce-inline-toolbar-grp .mce-btn.mce-active i,div.mce-inline-toolbar-grp .mce-btn:hover i,div.mce-toolbar-grp .mce-btn.mce-active:hover button,div.mce-toolbar-grp .mce-btn.mce-active:hover i div.mce-inline-toolbar-grp .mce-btn:hover button,div.mce-toolbar-grp .mce-btn.mce-active button,div.mce-toolbar-grp .mce-btn.mce-active i,div.mce-toolbar-grp .mce-btn:hover button,div.mce-toolbar-grp .mce-btn:hover i{color:#191e23}div.mce-inline-toolbar-grp .mce-btn i,div.mce-toolbar-grp .mce-btn i{font-style:normal}div.mce-widget.mce-tooltip .mce-tooltip-inner{font-size:13px;opacity:1}.mce-toolbar-grp .mce-toolbar .mce-btn-group .mce-btn{margin:0}.mce-inline-toolbar-grp.mce-panel .mce-toolbar .mce-btn{margin:2px 1px}.mce-inline-toolbar-grp.mce-panel .mce-toolbar .mce-btn button{padding:3px}.wp-block-freeform.block-library-rich-text__tinymce table{width:100%}
1
+ div[data-type="core/freeform"].is-selected .block-library-classic__toolbar,div[data-type="core/freeform"].is-typing .block-library-classic__toolbar{z-index:31}.block-library-classic__toolbar .mce-btn .mce-txt{font-size:13px;color:#454545}.mce-tinymce-inline .mce-menubar>div,.mce-tinymce-inline .mce-toolbar .mce-btn-group>div{white-space:normal}div.mce-menubar,div.mce-menubar *{box-sizing:border-box}.block-library-classic__toolbar .mce-menubar{padding:1px}.block-library-classic__toolbar .mce-menubar .mce-menubtn button span{font-size:13px}.block-library-classic__toolbar .mce-menubar i.mce-caret{margin-top:.35em}.block-library-classic__toolbar .mce-menubar .mce-flow-layout-item{margin:2px 0}div.mce-menubar.mce-toolbar .mce-btn button{padding:3px 4px 2px}div.mce-menubar{border-color:#e5e5e5;background:#fff;border-width:0 0 1px}div.mce-menubar .mce-menubtn:focus{color:#124964;box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}div.mce-menu-item-sep:hover,div.mce-menu .mce-menu-item-sep{border-bottom:1px solid #ddd;height:0;margin:5px 0}div.mce-menubtn span{margin-right:0;padding-left:3px}div.mce-menu-has-icons i.mce-ico:before{margin-left:0}div.mce-menu-has-icons i.mce-ico{line-height:18px;width:18px;height:18px}.wp-core-ui .mce-menu-item .mce-text{font-size:13px}.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active,.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus,.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover{border-color:transparent}.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active span,.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus span,.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover span{color:#000}.mce-inline-toolbar-grp div.wp-link-input{margin:2px 4px}.mce-inline-toolbar-grp div.wp-link-input input{padding:4px}div.mce-menu-item.mce-menu-item-preview.mce-active:hover,div.mce-menu .mce-menu-item-normal.mce-active,div.mce-menu .mce-menu-item-preview.mce-active,div.mce-menu .mce-menu-item.mce-selected,div.mce-menu .mce-menu-item:focus,div.mce-menu .mce-menu-item:hover{background:#0073aa;color:#fff}div.mce-menu-item.mce-active .mce-menu-shortcut,div.mce-menu-item.mce-disabled:hover .mce-ico,div.mce-menu-item.mce-disabled:hover .mce-text,div.mce-menu-item.mce-menu-item-preview.mce-active .mce-ico,div.mce-menu-item.mce-menu-item-preview.mce-active .mce-text,div.mce-menu-item:focus .mce-ico,div.mce-menu-item:focus .mce-menu-shortcut,div.mce-menu-item:focus .mce-text,div.mce-menu-item:hover .mce-ico,div.mce-menu-item:hover .mce-menu-shortcut,div.mce-menu-item:hover .mce-text{color:inherit}div.mce-menu .mce-menu-item.mce-disabled{cursor:default}div.mce-menu .mce-menu-item.mce-disabled:hover{background:#ccc}div.mce-inline-toolbar-grp .mce-btn.mce-active:hover button,div.mce-inline-toolbar-grp .mce-btn.mce-active:hover i,div.mce-inline-toolbar-grp .mce-btn.mce-active button,div.mce-inline-toolbar-grp .mce-btn.mce-active i,div.mce-inline-toolbar-grp .mce-btn:hover button,div.mce-inline-toolbar-grp .mce-btn:hover i,div.mce-toolbar-grp .mce-btn.mce-active:hover button,div.mce-toolbar-grp .mce-btn.mce-active:hover i,div.mce-toolbar-grp .mce-btn.mce-active button,div.mce-toolbar-grp .mce-btn.mce-active i,div.mce-toolbar-grp .mce-btn:hover button,div.mce-toolbar-grp .mce-btn:hover i{color:#191e23}div.mce-inline-toolbar-grp .mce-btn i,div.mce-toolbar-grp .mce-btn i{font-style:normal}div.mce-toolbar-grp .mce-btn i.mce-ico{font-size:20px}div.mce-widget.mce-tooltip .mce-tooltip-inner{font-size:13px;opacity:1}.mce-inline-toolbar-grp.mce-panel .mce-toolbar .mce-btn{margin:1px}.mce-inline-toolbar-grp.mce-panel .mce-toolbar .mce-btn button{padding:3px}.wp-block-freeform.block-library-rich-text__tinymce table{width:100%}
mce/wptadv/plugin.js CHANGED
@@ -2,7 +2,7 @@
2
  * This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
3
  * For more information please see tinymce-advanced.php.
4
  *
5
- * Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
6
  */
7
 
8
  ( function( tinymce ) {
@@ -122,21 +122,29 @@
122
  editor.addCommand( 'tmaRemoveTableStyles', function() {
123
  var node = editor.selection.getStart();
124
  var table = editor.dom.getParents( node, 'table' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  if ( table ) {
127
- editor.$( table ).attr({
128
- style: null,
129
- width: null,
130
- height: null,
131
- border: null,
132
- cellspacing: null,
133
- cellpadding: null
134
- }).find( 'tr, td' ).each( function( i, element ) {
135
- editor.$( element ).attr({
136
- style: null,
137
- width: null,
138
- height: null
139
- });
140
  } );
141
  }
142
  } );
@@ -146,21 +154,34 @@
146
  var table = editor.dom.getParents( node, 'table' );
147
 
148
  if ( table ) {
149
- removeInlineSizes( table );
150
 
151
- editor.$( table ).find( 'tr, td' ).each( function( i, element ) {
152
- removeInlineSizes( element );
153
- } );
154
  }
155
  } );
156
 
157
- function removeInlineSizes( node ) {
158
  var element = editor.$( node );
159
 
 
 
 
 
 
 
 
 
 
160
  element.css({ width: null, height: null });
161
 
 
 
 
 
162
  if ( ! element.attr( 'style' ) ) {
163
- element.attr({ style: null });
 
 
164
  }
165
  }
166
 
2
  * This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
3
  * For more information please see tinymce-advanced.php.
4
  *
5
+ * Copyright (c) 2007-2020 Andrew Ozz. All rights reserved.
6
  */
7
 
8
  ( function( tinymce ) {
122
  editor.addCommand( 'tmaRemoveTableStyles', function() {
123
  var node = editor.selection.getStart();
124
  var table = editor.dom.getParents( node, 'table' );
125
+ var attr = {
126
+ style: null,
127
+ 'data-mce-style': null,
128
+ width: null,
129
+ height: null,
130
+ minWidth: null,
131
+ maxWidth: null,
132
+ minHeight: null,
133
+ maxHeight: null,
134
+ align: null,
135
+ valign: null,
136
+ axis: null,
137
+ 'char': null,
138
+ charoff: null,
139
+ bgcolor: null,
140
+ border: null,
141
+ cellspacing: null,
142
+ cellpadding: null
143
+ };
144
 
145
  if ( table ) {
146
+ editor.$( table ).attr( attr ).find( 'tr, th, td, thead, tbody, tfoot' ).each( function( i, element ) {
147
+ editor.$( element ).attr( attr );
 
 
 
 
 
 
 
 
 
 
 
148
  } );
149
  }
150
  } );
154
  var table = editor.dom.getParents( node, 'table' );
155
 
156
  if ( table ) {
157
+ removeInlineSizes( null, table );
158
 
159
+ editor.$( table ).find( 'tr, th, td, thead, tbody, tfoot' ).each( removeInlineSizes );
 
 
160
  }
161
  } );
162
 
163
+ function removeInlineSizes( i, node ) {
164
  var element = editor.$( node );
165
 
166
+ element.attr( {
167
+ width: null,
168
+ height: null,
169
+ minWidth: null,
170
+ maxWidth: null,
171
+ minHeight: null,
172
+ maxHeight: null
173
+ } );
174
+
175
  element.css({ width: null, height: null });
176
 
177
+ if ( element.is( 'table' ) ) {
178
+ element.css({ 'border-collapse': 'collapse', width: '100%;' });
179
+ }
180
+
181
  if ( ! element.attr( 'style' ) ) {
182
+ element.attr({ style: null, 'data-mce-style': null });
183
+ } else {
184
+ element.attr( 'data-mce-style', element.attr( 'style' ) );
185
  }
186
  }
187
 
mce/wptadv/plugin.min.js CHANGED
@@ -1 +1,235 @@
1
- !function(a){a.PluginManager.add("wptadv",function(b){function c(b){var c="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";return b=b.replace(new RegExp("<(?:"+c+")(?: [^>]*)?>","gi"),"\n$&"),b=b.replace(new RegExp("</(?:"+c+")>","gi"),"$&\n"),b=b.replace(/(<br(?: [^>]*)?>)[\r\n\t]*/gi,"$1\n"),b=b.replace(/>\n[\r\n\t]+</g,">\n<"),b=b.replace(/^<li/gm,"\t<li"),b=b.replace(/<td>\u00a0<\/td>/g,"<td>&nbsp;</td>"),a.trim(b)}function d(a){var c=b.$(a);c.css({width:null,height:null}),c.attr("style")||c.attr({style:null})}var e=!b.settings.wpautop&&b.settings.tadv_noautop;return b.addCommand("Tadv_Mark",function(){b.formatter.toggle("mark")}),b.addButton("tadv_mark",{icon:"backcolor",tooltip:"Mark",cmd:"Tadv_Mark",stateSelector:"mark"}),b.on("init",function(){e&&b.on("SaveContent",function(a){a.content=a.content.replace(/caption\](\s|<br[^>]*>|<p>&nbsp;<\/p>)*\[caption/g,"caption] [caption"),a.content=a.content.replace(/<(object|audio|video)[\s\S]+?<\/\1>/g,function(a){return a.replace(/[\r\n\t ]+/g," ")}),a.content=a.content.replace(/<pre( [^>]*)?>[\s\S]+?<\/pre>/g,function(a){return a=a.replace(/<br ?\/?>(\r\n|\n)?/g,"\n"),a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"\n")}),a.content=c(a.content)});try{b.plugins.searchreplace&&!b.controlManager.buttons.searchreplace&&b.shortcuts.remove("meta+f")}catch(a){}b.formatter.register({mark:{inline:"mark"}})}),b.on("ObjectResizeStart",function(a){var c,d,e,f=a.target,g=b.$(f);if(g.is("table")){if(f.style.width&&f.style.width.indexOf("%")!==-1)return;c=parseInt(g.parent().css("width"),10),d=parseInt(a.width,10),c&&d&&(Math.abs(c-d)<3?g.css({width:"100%"}):(e=Math.round(d/c*100),e>10&&e<200&&g.css({width:e+"%"})))}},!0),b.addMenuItem("tmaresettablesize",{text:"Reset table size",cmd:"tmaResetTableSize",icon:"dashicon dashicons-image-flip-horizontal",context:"format"}),b.addMenuItem("tmaremovetablestyles",{text:"Remove table styling",cmd:"tmaRemoveTableStyles",icon:"dashicon dashicons-editor-table",context:"format"}),b.addButton("tmaresettablesize",{title:"Reset table size",cmd:"tmaResetTableSize",icon:"dashicon dashicons-image-flip-horizontal"}),b.addButton("tmaremovetablestyles",{title:"Remove table styling",cmd:"tmaRemoveTableStyles",icon:"dashicon dashicons-editor-table"}),b.addCommand("tmaRemoveTableStyles",function(){var a=b.selection.getStart(),c=b.dom.getParents(a,"table");c&&b.$(c).attr({style:null,width:null,height:null,border:null,cellspacing:null,cellpadding:null}).find("tr, td").each(function(a,c){b.$(c).attr({style:null,width:null,height:null})})}),b.addCommand("tmaResetTableSize",function(){var a=b.selection.getStart(),c=b.dom.getParents(a,"table");c&&(d(c),b.$(c).find("tr, td").each(function(a,b){d(b)}))}),e&&(b.on("beforeSetContent",function(a){var b,c=window.wp;c&&(b=c.editor&&c.editor.autop,b||(b=c.oldEditor&&c.oldEditor.autop),a.load&&b&&a.content&&a.content.indexOf("\n")>-1&&!/<p>/i.test(a.content)&&(a.content=b(a.content)))},!0),b.settings.classic_block_editor&&b.on("beforeGetContent",function(c){if("raw"!==c.format){var d=a.$(".block-editor-block-list__block");1===d.length&&"core/freeform"===d.attr("data-type")?b.$("p").each(function(a,c){c.hasAttributes()||b.$(c).attr("data-tadv-p","keep")}):b.$("p[data-tadv-p]").removeAttr("data-tadv-p")}},!0)),{addLineBreaks:c}})}(window.tinymce);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
3
+ * For more information please see tinymce-advanced.php.
4
+ *
5
+ * Copyright (c) 2007-2020 Andrew Ozz. All rights reserved.
6
+ */
7
+
8
+ ( function( tinymce ) {
9
+ tinymce.PluginManager.add( 'wptadv', function( editor ) {
10
+ var noAutop = ( ! editor.settings.wpautop && editor.settings.tadv_noautop );
11
+
12
+ function addLineBreaks( html ) {
13
+ var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' +
14
+ '|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' +
15
+ '|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary';
16
+
17
+ html = html.replace( new RegExp( '<(?:' + blocklist + ')(?: [^>]*)?>', 'gi' ), '\n$&' );
18
+ html = html.replace( new RegExp( '</(?:' + blocklist + ')>', 'gi' ), '$&\n' );
19
+ html = html.replace( /(<br(?: [^>]*)?>)[\r\n\t]*/gi, '$1\n' );
20
+ html = html.replace( />\n[\r\n\t]+</g, '>\n<' );
21
+ html = html.replace( /^<li/gm, '\t<li' );
22
+ html = html.replace( /<td>\u00a0<\/td>/g, '<td>&nbsp;</td>' );
23
+
24
+ return tinymce.trim( html );
25
+ }
26
+
27
+ editor.addCommand( 'Tadv_Mark', function() {
28
+ editor.formatter.toggle('mark');
29
+ });
30
+
31
+ editor.addButton( 'tadv_mark', {
32
+ icon: 'backcolor',
33
+ tooltip: 'Mark',
34
+ cmd: 'Tadv_Mark',
35
+ stateSelector: 'mark'
36
+ });
37
+
38
+ editor.on( 'init', function() {
39
+ if ( noAutop ) {
40
+ editor.on( 'SaveContent', function( event ) {
41
+ event.content = event.content.replace( /caption\](\s|<br[^>]*>|<p>&nbsp;<\/p>)*\[caption/g, 'caption] [caption' );
42
+
43
+ event.content = event.content.replace( /<(object|audio|video)[\s\S]+?<\/\1>/g, function( match ) {
44
+ return match.replace( /[\r\n\t ]+/g, ' ' );
45
+ });
46
+
47
+ event.content = event.content.replace( /<pre( [^>]*)?>[\s\S]+?<\/pre>/g, function( match ) {
48
+ match = match.replace( /<br ?\/?>(\r\n|\n)?/g, '\n' );
49
+ return match.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '\n' );
50
+ });
51
+
52
+ event.content = addLineBreaks( event.content );
53
+ });
54
+ }
55
+
56
+ try {
57
+ if ( editor.plugins.searchreplace && ! editor.controlManager.buttons.searchreplace ) {
58
+ editor.shortcuts.remove( 'meta+f' );
59
+ }
60
+ } catch ( er ) {}
61
+
62
+ editor.formatter.register({
63
+ mark: { inline: 'mark' }
64
+ });
65
+ });
66
+
67
+ editor.on( 'ObjectResizeStart', function( event ) {
68
+ var element = event.target;
69
+ var table = editor.$( element );
70
+ var parentWidth;
71
+ var tableWidth;
72
+ var width;
73
+
74
+ if ( table.is( 'table' ) ) {
75
+ if ( element.style.width && element.style.width.indexOf( '%' ) !== -1 ) {
76
+ return;
77
+ }
78
+
79
+ parentWidth = parseInt( table.parent().css( 'width' ), 10 );
80
+ tableWidth = parseInt( event.width, 10 );
81
+
82
+ if ( parentWidth && tableWidth ) {
83
+ if ( Math.abs( parentWidth - tableWidth ) < 3 ) {
84
+ table.css({ width: '100%' });
85
+ } else {
86
+ width = Math.round( ( tableWidth / parentWidth ) * 100 );
87
+
88
+ if ( width > 10 && width < 200 ) {
89
+ table.css({ width: width + '%' });
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }, true );
95
+
96
+ editor.addMenuItem( 'tmaresettablesize', {
97
+ text: 'Reset table size',
98
+ cmd: 'tmaResetTableSize',
99
+ icon: 'dashicon dashicons-image-flip-horizontal',
100
+ context: 'format',
101
+ });
102
+
103
+ editor.addMenuItem( 'tmaremovetablestyles', {
104
+ text: 'Remove table styling',
105
+ cmd: 'tmaRemoveTableStyles',
106
+ icon: 'dashicon dashicons-editor-table',
107
+ context: 'format',
108
+ });
109
+
110
+ editor.addButton( 'tmaresettablesize', {
111
+ title: 'Reset table size',
112
+ cmd: 'tmaResetTableSize',
113
+ icon: 'dashicon dashicons-image-flip-horizontal',
114
+ } );
115
+
116
+ editor.addButton( 'tmaremovetablestyles', {
117
+ title: 'Remove table styling',
118
+ cmd: 'tmaRemoveTableStyles',
119
+ icon: 'dashicon dashicons-editor-table',
120
+ } );
121
+
122
+ editor.addCommand( 'tmaRemoveTableStyles', function() {
123
+ var node = editor.selection.getStart();
124
+ var table = editor.dom.getParents( node, 'table' );
125
+ var attr = {
126
+ style: null,
127
+ 'data-mce-style': null,
128
+ width: null,
129
+ height: null,
130
+ minWidth: null,
131
+ maxWidth: null,
132
+ minHeight: null,
133
+ maxHeight: null,
134
+ align: null,
135
+ valign: null,
136
+ axis: null,
137
+ 'char': null,
138
+ charoff: null,
139
+ bgcolor: null,
140
+ border: null,
141
+ cellspacing: null,
142
+ cellpadding: null
143
+ };
144
+
145
+ if ( table ) {
146
+ editor.$( table ).attr( attr ).find( 'tr, th, td, thead, tbody, tfoot' ).each( function( i, element ) {
147
+ editor.$( element ).attr( attr );
148
+ } );
149
+ }
150
+ } );
151
+
152
+ editor.addCommand( 'tmaResetTableSize', function() {
153
+ var node = editor.selection.getStart();
154
+ var table = editor.dom.getParents( node, 'table' );
155
+
156
+ if ( table ) {
157
+ removeInlineSizes( null, table );
158
+
159
+ editor.$( table ).find( 'tr, th, td, thead, tbody, tfoot' ).each( removeInlineSizes );
160
+ }
161
+ } );
162
+
163
+ function removeInlineSizes( i, node ) {
164
+ var element = editor.$( node );
165
+
166
+ element.attr( {
167
+ width: null,
168
+ height: null,
169
+ minWidth: null,
170
+ maxWidth: null,
171
+ minHeight: null,
172
+ maxHeight: null
173
+ } );
174
+
175
+ element.css({ width: null, height: null });
176
+
177
+ if ( element.is( 'table' ) ) {
178
+ element.css({ 'border-collapse': 'collapse', width: '100%;' });
179
+ }
180
+
181
+ if ( ! element.attr( 'style' ) ) {
182
+ element.attr({ style: null, 'data-mce-style': null });
183
+ } else {
184
+ element.attr( 'data-mce-style', element.attr( 'style' ) );
185
+ }
186
+ }
187
+
188
+ if ( noAutop ) {
189
+ editor.on( 'beforeSetContent', function( event ) {
190
+ var autop;
191
+ var wp = window.wp;
192
+
193
+ if ( ! wp ) {
194
+ return;
195
+ }
196
+
197
+ autop = wp.editor && wp.editor.autop;
198
+
199
+ if ( ! autop ) {
200
+ autop = wp.oldEditor && wp.oldEditor.autop;
201
+ }
202
+
203
+ if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) {
204
+ event.content = autop( event.content );
205
+ }
206
+ }, true );
207
+
208
+ if ( editor.settings.classic_block_editor ) {
209
+ editor.on( 'beforeGetContent', function( event ) {
210
+ if ( event.format === 'raw' ) {
211
+ return;
212
+ }
213
+
214
+ var blocks = tinymce.$( '.block-editor-block-list__block' );
215
+
216
+ if ( blocks.length === 1 && blocks.attr( 'data-type' ) === 'core/freeform' ) {
217
+ // Mark all paragraph tags inside a single freeform block so they are not stripped by the block editor...
218
+ editor.$( 'p' ).each( function ( i, node ) {
219
+ if ( ! node.hasAttributes() ) {
220
+ editor.$( node ).attr( 'data-tadv-p', 'keep' );
221
+ }
222
+ } );
223
+ } else {
224
+ // Remove the above ugliness...
225
+ editor.$( 'p[data-tadv-p]' ).removeAttr( 'data-tadv-p' );
226
+ }
227
+ }, true );
228
+ }
229
+ }
230
+
231
+ return {
232
+ addLineBreaks: addLineBreaks
233
+ };
234
+ });
235
+ }( window.tinymce ));
plugin-assets/tadv.css CHANGED
@@ -154,7 +154,7 @@ span.tma-down-addow::after {
154
  border-right-color: transparent;
155
  border-top: none;
156
  margin-left: -10px;
157
-
158
  left: 235px;
159
  }
160
 
@@ -795,10 +795,10 @@ div.tadv-error {
795
  font-size: 16px;
796
  line-height: 1.8;
797
  color: #191e23;
798
-
799
  display: flex;
800
  flex-grow: 1;
801
-
802
  width: auto;
803
  overflow: inherit;
804
  border-right: none;
@@ -813,7 +813,7 @@ div.tadv-error {
813
  border-top: 1px solid #b5bcc2;
814
  border-bottom: 1px solid #b5bcc2;
815
  border-right: 1px solid #b5bcc2;
816
-
817
  margin: 0;
818
  background-color: #fff;
819
  display: flex;
@@ -885,7 +885,7 @@ div.tadv-error {
885
  border: 1px solid transparent;
886
  display: flex;
887
  flex-direction: row;
888
-
889
  /* Always hover... */
890
  color: #555d66;
891
  box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
@@ -1001,3 +1001,7 @@ div.tadv-error {
1001
  padding: 2px 10px 3px;
1002
  }
1003
 
 
 
 
 
154
  border-right-color: transparent;
155
  border-top: none;
156
  margin-left: -10px;
157
+
158
  left: 235px;
159
  }
160
 
795
  font-size: 16px;
796
  line-height: 1.8;
797
  color: #191e23;
798
+
799
  display: flex;
800
  flex-grow: 1;
801
+
802
  width: auto;
803
  overflow: inherit;
804
  border-right: none;
813
  border-top: 1px solid #b5bcc2;
814
  border-bottom: 1px solid #b5bcc2;
815
  border-right: 1px solid #b5bcc2;
816
+
817
  margin: 0;
818
  background-color: #fff;
819
  display: flex;
885
  border: 1px solid transparent;
886
  display: flex;
887
  flex-direction: row;
888
+
889
  /* Always hover... */
890
  color: #555d66;
891
  box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
1001
  padding: 2px 10px 3px;
1002
  }
1003
 
1004
+ span.small-info {
1005
+ font-weight: 400;
1006
+ font-size: 13px;
1007
+ }
plugin-assets/tadv.js CHANGED
@@ -116,7 +116,10 @@ jQuery( document ).ready( function( $ ) {
116
  $(this).parent().removeClass( 'highlighted' );
117
  },
118
  receive: function( event, ui ) {
119
- if ( $( event.target ).is( '#toolbar_block_side' ) && ui.item.is( 'li.core-image' ) ) {
 
 
 
120
  block.sortable( 'cancel' );
121
  }
122
  },
116
  $(this).parent().removeClass( 'highlighted' );
117
  },
118
  receive: function( event, ui ) {
119
+ if (
120
+ $( event.target ).is( '#toolbar_block_side' ) &&
121
+ ( ui.item.is( 'li.core-image' ) || ui.item.is( 'li.core-text-color' ) )
122
+ ) {
123
  block.sortable( 'cancel' );
124
  }
125
  },
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
  Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write
4
- Requires at least: 5.3
5
- Tested up to: 5.3
6
- Stable tag: 5.2.1
7
- Requires PHP: 5.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,16 +12,16 @@ Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMC
12
 
13
  == Description ==
14
 
15
- TinyMCE Advanced introduces a "Classic Paragraph" block for the block editor (Gutenberg).
16
  If you are not quite ready to switch to the block editor, or have plugins that cannot be used there (yet), using the Classic Paragraph block is your best option. It lets you to continue to use the familiar TinyMCE editor for most tasks, and at the same time gives you full access to all blocks and new features in the block editor.
17
 
18
- Version 5.3 continues to improve and enhance the new features introduced in version 5.0 of TinyMCE Advanced. It includes an improved "Clear Formatting" button, several advanced settings for tables, and importing and exporting of the settings to a file.
19
 
20
  If you want to continue to use the previous ("classic") editor in WordPress 5.0 and newer, this plugin has an option to replace the new editor with the previous one. If you prefer to have access to both editors side by side or to allow your users to switch editors, it would be better to install the [Classic Editor plugin](https://wordpress.org/plugins/classic-editor/). TinyMCE Advanced is fully compatible with the classic editor plugin and similar plugins that restore use of the previous WordPress editor.
21
 
22
- As always this plugin will let you add, remove and arrange the buttons that are shown on the Visual Editor toolbar in the Classic Paragraph and Classic blocks in the block editor, and in the classic editor (when enabled by a plugin). There you can configure up to four rows of buttons including Font Sizes, Font Family, text and background colors, tables, etc.
23
 
24
- It includes 15 plugins for [TinyMCE](https://tinymce.com/) that are automatically enabled or disabled depending on the buttons you have chosen.
25
  In addition this plugin adds options for keeping the paragraph tags in text mode and importing the CSS classes from the theme's editor-style.css.
26
 
27
  = Some of the features added by this plugin =
@@ -47,6 +47,11 @@ Best is to install directly from WordPress. If manual installation is required,
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
50
  = 5.3.0 =
51
  * Updated for WordPress 5.3 and TinyMCE 4.9.6.
52
 
@@ -68,7 +73,7 @@ Best is to install directly from WordPress. If manual installation is required,
68
  * Fixed importing of backed-up settings.
69
  * Updated the FAQ section in the readme.
70
 
71
- = 5.0.0 =
72
  * Added several new buttons to the rich-text toolbar in the block editor.
73
  * Added functionality to add, remove and arrange most buttons on the rich-text toolbar in the block editor.
74
  * Added alternative location for buttons for the rich-text component. That lets users move buttons that are not used frequently out of the way.
@@ -90,7 +95,7 @@ Best is to install directly from WordPress. If manual installation is required,
90
  * Fixed (removed) setting of inline CSS for table cells when inserting a table. Inline CSS is still added when a table is resized by dragging.
91
 
92
  = 4.8.0 =
93
- * Updated for WordPress 4.9.8 and TinyMCE 4.8.0.
94
 
95
  = 4.7.13 =
96
  * Updated the table and anchor plugins to 4.7.13 (2018-05-16). Fixes a bug in the table plugin in Edge.
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
  Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write
4
+ Requires at least: 5.4
5
+ Tested up to: 5.4
6
+ Stable tag: 5.4.0
7
+ Requires PHP: 5.6
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ TinyMCE Advanced introduces a "Classic Paragraph" block for the block editor (Gutenberg).
16
  If you are not quite ready to switch to the block editor, or have plugins that cannot be used there (yet), using the Classic Paragraph block is your best option. It lets you to continue to use the familiar TinyMCE editor for most tasks, and at the same time gives you full access to all blocks and new features in the block editor.
17
 
18
+ Version 5.4 continues to improve and enhance the new features introduced in version 5.0 of TinyMCE Advanced. It includes an improved "Clear Formatting" button, several advanced settings for tables, and importing and exporting of the settings to a file.
19
 
20
  If you want to continue to use the previous ("classic") editor in WordPress 5.0 and newer, this plugin has an option to replace the new editor with the previous one. If you prefer to have access to both editors side by side or to allow your users to switch editors, it would be better to install the [Classic Editor plugin](https://wordpress.org/plugins/classic-editor/). TinyMCE Advanced is fully compatible with the classic editor plugin and similar plugins that restore use of the previous WordPress editor.
21
 
22
+ As always this plugin will let you add, remove and arrange the buttons that are shown on the Visual Editor toolbar in the Classic Paragraph and Classic blocks in the block editor, and in the classic editor (when enabled by a plugin). There you can configure up to four rows of buttons including Font Sizes, Font Family, text and background colors, tables, etc.
23
 
24
+ It includes 15 plugins for [TinyMCE](https://www.tiny.cloud/) that are automatically enabled or disabled depending on the buttons you have chosen.
25
  In addition this plugin adds options for keeping the paragraph tags in text mode and importing the CSS classes from the theme's editor-style.css.
26
 
27
  = Some of the features added by this plugin =
47
 
48
  == Changelog ==
49
 
50
+ = 5.4.0 =
51
+ * Updated for WordPress 5.4.
52
+ * Improved "Reset Table Size" to reset all table elements (tr, th, td, thead, tbody, tfoot).
53
+ * Improved "Remove Table Styling" to remove all current and deprecated styling attributes from all table elements.
54
+
55
  = 5.3.0 =
56
  * Updated for WordPress 5.3 and TinyMCE 4.9.6.
57
 
73
  * Fixed importing of backed-up settings.
74
  * Updated the FAQ section in the readme.
75
 
76
+ = 5.0.0 =
77
  * Added several new buttons to the rich-text toolbar in the block editor.
78
  * Added functionality to add, remove and arrange most buttons on the rich-text toolbar in the block editor.
79
  * Added alternative location for buttons for the rich-text component. That lets users move buttons that are not used frequently out of the way.
95
  * Fixed (removed) setting of inline CSS for table cells when inserting a table. Inline CSS is still added when a table is resized by dragging.
96
 
97
  = 4.8.0 =
98
+ * Updated for WordPress 4.9.8 and TinyMCE 4.8.0.
99
 
100
  = 4.7.13 =
101
  * Updated the table and anchor plugins to 4.7.13 (2018-05-16). Fixes a bug in the table plugin in Edge.
tadv_admin.php CHANGED
@@ -174,10 +174,8 @@ $dashicons_arrow = is_rtl() ? 'dashicons-arrow-left' : 'dashicons-arrow-right';
174
  <li><?php _e( 'The Align Left, Align Center, Align Right, Bold, Italic, and Link buttons cannot be moved or arranged.', 'tinymce-advanced' ); ?></li>
175
  <li><?php _e( 'All other buttons are always shown in a drop-down. The users are not allowed to add any of them to the main toolbar.', 'tinymce-advanced' ); ?></li>
176
  <li><?php _e( 'All buttons that are shown in the drop-down are auto-arranged by alphabetical order. The users are not allowed to arrange them.', 'tinymce-advanced' ); ?></li>
 
177
  </ol>
178
- <p>
179
- <?php _e( 'Also currently the drop-down should not be empty and the Inline Image item cannot be placed in the side toolbar.', 'tinymce-advanced' ); ?>
180
- </p>
181
  </div>
182
 
183
  <div class="toolbar-block-wrap toolbar-wrap">
@@ -270,7 +268,7 @@ $dashicons_arrow = is_rtl() ? 'dashicons-arrow-left' : 'dashicons-arrow-right';
270
  <ul id="toolbar_block" class="toolbar-block-dropdown container-block">
271
  <?php
272
 
273
- // Block editor limitation: only the buttons in the overflow drop-down sub-toolbar can be moved or arranged.
274
  $excluded_block_buttons = array(
275
  'core/bold',
276
  'core/italic',
@@ -380,7 +378,10 @@ $dashicons_arrow = is_rtl() ? 'dashicons-arrow-left' : 'dashicons-arrow-right';
380
 
381
  <table class="form-table panel-block-colors-settings"><tbody>
382
  <tr class="panel-block-colors-settings__text">
383
- <th><?php _e( 'Enable setting of selected text color', 'tinymce-advanced' ); ?></th>
 
 
 
384
  <td>
385
  <p>
386
  <input type="radio" name="selected_text_color" id="selected_text_color_yes" value="yes"<?php if ( $this->check_user_setting( 'selected_text_color' ) ) echo ' checked'; ?>>
174
  <li><?php _e( 'The Align Left, Align Center, Align Right, Bold, Italic, and Link buttons cannot be moved or arranged.', 'tinymce-advanced' ); ?></li>
175
  <li><?php _e( 'All other buttons are always shown in a drop-down. The users are not allowed to add any of them to the main toolbar.', 'tinymce-advanced' ); ?></li>
176
  <li><?php _e( 'All buttons that are shown in the drop-down are auto-arranged by alphabetical order. The users are not allowed to arrange them.', 'tinymce-advanced' ); ?></li>
177
+ <li><?php _e( 'The drop-down cannot be empty and the Inline Image and Text Color items cannot be placed in the side toolbar.', 'tinymce-advanced' ); ?>
178
  </ol>
 
 
 
179
  </div>
180
 
181
  <div class="toolbar-block-wrap toolbar-wrap">
268
  <ul id="toolbar_block" class="toolbar-block-dropdown container-block">
269
  <?php
270
 
271
+ // Block editor limitation: only the buttons in the overflow drop-down/sub-toolbar can be moved (but not arranged).
272
  $excluded_block_buttons = array(
273
  'core/bold',
274
  'core/italic',
378
 
379
  <table class="form-table panel-block-colors-settings"><tbody>
380
  <tr class="panel-block-colors-settings__text">
381
+ <th>
382
+ <?php _e( 'Enable setting of selected text color', 'tinymce-advanced' ); ?>
383
+ <span class="small-info"><?php _e( '(this will replace the default text color popup in WP 5.4 and newer)', 'tinymce-advanced' ); ?></span>
384
+ </th>
385
  <td>
386
  <p>
387
  <input type="radio" name="selected_text_color" id="selected_text_color_yes" value="yes"<?php if ( $this->check_user_setting( 'selected_text_color' ) ) echo ' checked'; ?>>
tinymce-advanced.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: TinyMCE Advanced
4
  Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/
5
  Description: Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMCE).
6
- Version: 5.3.0
7
  Author: Andrew Ozz
8
  Author URI: http://www.laptoptips.ca/
9
  License: GPL2
@@ -24,19 +24,19 @@ GNU General Public License for more details.
24
  You should have received a copy of the GNU General Public License along
25
  with TinyMCE Advanced or WordPress. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
26
 
27
- Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
28
  */
29
 
30
  if ( ! defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
 
34
- if ( ! class_exists('Tinymce_Advanced') ) :
35
 
36
  class Tinymce_Advanced {
37
 
38
- private $required_wp_version = '5.2';
39
- private $plugin_version = 5210;
40
 
41
  private $user_settings;
42
  private $admin_settings;
@@ -156,6 +156,7 @@ class Tinymce_Advanced {
156
  'core/code' => array( 'name' => 'Code', 'icon' => '<span class="dashicons dashicons-editor-code"></span>' ),
157
 
158
  'core/image' => array( 'name' => 'Inline Image', 'icon' => '<span class="dashicons">' . $inline_img_icon . '</span>' ),
 
159
 
160
  'tadv/mark' => array( 'name' => 'Mark', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
161
  'tadv/removeformat' => array( 'name' => 'Clear formatting', 'icon' => '<span class="dashicons dashicons-editor-removeformatting"></span>' ),
@@ -477,6 +478,24 @@ class Tinymce_Advanced {
477
  }
478
  }
479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  update_option( 'tadv_admin_settings', $admin_settings );
481
  update_option( 'tadv_settings', $user_settings );
482
  }
@@ -1080,7 +1099,7 @@ class Tinymce_Advanced {
1080
  } elseif ( ! empty( $_POST[ 'toolbar_block' ] ) && is_array( $_POST[ 'toolbar_block' ] ) ) {
1081
  $settings[ 'toolbar_block' ] = $this->validate_settings( $_POST[ 'toolbar_block' ], $this->block_buttons_filter );
1082
  } else {
1083
- $settings[ 'toolbar_block' ] = array();
1084
  }
1085
 
1086
  if ( ! empty( $user_settings[ 'toolbar_block_side' ] ) ) {
@@ -1088,7 +1107,7 @@ class Tinymce_Advanced {
1088
  } elseif ( ! empty( $_POST[ 'toolbar_block_side' ] ) && is_array( $_POST[ 'toolbar_block_side' ] ) ) {
1089
  $settings[ 'toolbar_block_side' ] = $this->validate_settings( $_POST[ 'toolbar_block_side' ], $this->block_buttons_filter );
1090
  } else {
1091
- $settings[ 'toolbar_block_side' ] = array();
1092
  }
1093
 
1094
  if ( ! empty( $user_settings[ 'panels_block' ] ) ) {
@@ -1104,6 +1123,15 @@ class Tinymce_Advanced {
1104
  $panels_block[] = 'tadv/background-color-panel';
1105
  }
1106
 
 
 
 
 
 
 
 
 
 
1107
  $panels_block = implode( ',', $panels_block );
1108
  }
1109
 
3
  Plugin Name: TinyMCE Advanced
4
  Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/
5
  Description: Extends and enhances the block editor (Gutenberg) and the classic editor (TinyMCE).
6
+ Version: 5.4.0
7
  Author: Andrew Ozz
8
  Author URI: http://www.laptoptips.ca/
9
  License: GPL2
24
  You should have received a copy of the GNU General Public License along
25
  with TinyMCE Advanced or WordPress. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
26
 
27
+ Copyright (c) 2007-2020 Andrew Ozz. All rights reserved.
28
  */
29
 
30
  if ( ! defined( 'ABSPATH' ) ) {
31
  exit;
32
  }
33
 
34
+ if ( ! class_exists( 'Tinymce_Advanced' ) ) :
35
 
36
  class Tinymce_Advanced {
37
 
38
+ private $required_wp_version = '5.4-beta';
39
+ private $plugin_version = 5400;
40
 
41
  private $user_settings;
42
  private $admin_settings;
156
  'core/code' => array( 'name' => 'Code', 'icon' => '<span class="dashicons dashicons-editor-code"></span>' ),
157
 
158
  'core/image' => array( 'name' => 'Inline Image', 'icon' => '<span class="dashicons">' . $inline_img_icon . '</span>' ),
159
+ 'core/text-color' => array( 'name' => 'Text Color', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
160
 
161
  'tadv/mark' => array( 'name' => 'Mark', 'icon' => '<span class="dashicons dashicons-editor-textcolor"></span>' ),
162
  'tadv/removeformat' => array( 'name' => 'Clear formatting', 'icon' => '<span class="dashicons dashicons-editor-removeformatting"></span>' ),
478
  }
479
  }
480
 
481
+ // Add the new text colot popup in 5.4 if 'tadv/color-panel' is not enabled.
482
+ // 'core/text-color' duplicates the functionality...
483
+ if ( $version < 5400 ) {
484
+ if ( ! empty( $user_settings['panels_block'] ) && is_string( $user_settings['panels_block'] ) ) {
485
+ $has_color_panel = ( strpos( $user_settings['panels_block'], 'tadv/color-panel' ) !== false );
486
+ } else {
487
+ $has_color_panel = false;
488
+ }
489
+
490
+ if ( ! $has_color_panel ) {
491
+ if ( empty( $user_settings['toolbar_block'] ) ) {
492
+ $user_settings['toolbar_block'] = 'core/text-color';
493
+ } else {
494
+ $user_settings['toolbar_block'] = $user_settings['toolbar_block'] . ',core/text-color';
495
+ }
496
+ }
497
+ }
498
+
499
  update_option( 'tadv_admin_settings', $admin_settings );
500
  update_option( 'tadv_settings', $user_settings );
501
  }
1099
  } elseif ( ! empty( $_POST[ 'toolbar_block' ] ) && is_array( $_POST[ 'toolbar_block' ] ) ) {
1100
  $settings[ 'toolbar_block' ] = $this->validate_settings( $_POST[ 'toolbar_block' ], $this->block_buttons_filter );
1101
  } else {
1102
+ $settings[ 'toolbar_block' ] = '';
1103
  }
1104
 
1105
  if ( ! empty( $user_settings[ 'toolbar_block_side' ] ) ) {
1107
  } elseif ( ! empty( $_POST[ 'toolbar_block_side' ] ) && is_array( $_POST[ 'toolbar_block_side' ] ) ) {
1108
  $settings[ 'toolbar_block_side' ] = $this->validate_settings( $_POST[ 'toolbar_block_side' ], $this->block_buttons_filter );
1109
  } else {
1110
+ $settings[ 'toolbar_block_side' ] = '';
1111
  }
1112
 
1113
  if ( ! empty( $user_settings[ 'panels_block' ] ) ) {
1123
  $panels_block[] = 'tadv/background-color-panel';
1124
  }
1125
 
1126
+ // core/text-color is a duplicate of tadv/color-panel :(
1127
+ // Remove it if both are set
1128
+ $toolbar_block = explode( ',', $settings[ 'toolbar_block' ] );
1129
+
1130
+ if ( in_array( 'tadv/color-panel', $panels_block, true ) && in_array( 'core/text-color', $toolbar_block, true ) ) {
1131
+ $toolbar_block = array_diff( $toolbar_block, array( 'core/text-color' ) );
1132
+ $settings[ 'toolbar_block' ] = implode( ',', $toolbar_block );
1133
+ }
1134
+
1135
  $panels_block = implode( ',', $panels_block );
1136
  }
1137