Changeset 1993190 for tinymce-advanced
- Timestamp:
- 12/13/2018 12:18:14 AM (7 years ago)
- Location:
- tinymce-advanced/trunk
- Files:
-
- 5 added
- 14 edited
-
block-editor (added)
-
block-editor/block-editor.css (added)
-
block-editor/block-register.js (added)
-
block-editor/classic-paragraph.css (added)
-
css/tadv-styles.css (modified) (13 diffs)
-
js/tadv.js (modified) (2 diffs)
-
mce/importcss/plugin.js (modified) (1 diff)
-
mce/importcss/plugin.min.js (modified) (1 diff)
-
mce/wptadv/plugin.js (modified) (2 diffs)
-
mce/wptadv/plugin.min.js (modified) (1 diff)
-
readme.txt (modified) (10 diffs)
-
screenshot-1.png (modified) (previous)
-
screenshot-2.png (modified) (previous)
-
screenshot-3.png (modified) (previous)
-
screenshot-4.png (modified) (previous)
-
screenshot-5.png (modified) (previous)
-
screenshot-6.png (added)
-
tadv_admin.php (modified) (16 diffs)
-
tinymce-advanced.php (modified) (32 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tinymce-advanced/trunk/css/tadv-styles.css
r1643101 r1993190 5 5 * Copyright (c) 2007-2016 Andrew Ozz. All rights reserved. 6 6 */ 7 8 .wrap.tinymce-advanced { 9 max-width: 900px; 10 margin: 10px 20px 0 10px; 11 } 12 13 #block-editor { 14 margin-bottom: 45px; 15 max-width: 672px; 16 } 17 18 #classic-editor, 19 .tadv-submit-top { 20 margin-bottom: 45px; 21 width: 92%; 22 } 23 24 .rtl #classic-editor, 25 .rtl .tadv-submit-top { 26 margin: 0 0 35px 280px; 27 } 7 28 8 29 .tadv-more-plugins label { … … 16 37 17 38 .advanced-options { 18 margin: 20px 0; 19 border: 1px solid #ccc; 20 padding: 0 15px; 39 margin: 40px 0; 21 40 } 22 41 … … 28 47 margin-left: 22px; 29 48 margin-top: 5px; 49 } 50 51 .advanced-options .tadv-help { 52 margin: 1em 0; 30 53 } 31 54 … … 70 93 71 94 ul.container, 72 #unused {95 .unused { 73 96 position: relative; 74 97 } … … 105 128 } 106 129 107 #tadv-mce-menu{130 .tadv-mce-menu.mce-menubar { 108 131 margin-bottom: 0; 109 132 background: #fff; … … 114 137 } 115 138 116 #tadv-mce-menu.enabled {139 .tadv-mce-menu.enabled { 117 140 opacity: 1; 118 141 filter: alpha(opacity=100); 119 142 } 120 143 121 #tadv-mce-menu.mce-menubar .mce-menubtn:hover {144 .tadv-mce-menu.mce-menubar .mce-menubtn:hover { 122 145 background: transparent; 123 146 } 124 147 125 #tadv-mce-menu .mce-btn .mce-caret {148 .tadv-mce-menu .mce-btn .mce-caret { 126 149 margin-top: 9px; 127 150 margin-left: 1px; 128 151 } 129 152 130 #tadv-mce-menu * {153 .tadv-mce-menu * { 131 154 cursor: default; 132 155 } 133 156 134 157 #tadvzones, 135 #unused {158 .unused { 136 159 -webkit-user-select: none; 137 160 -moz-user-select: none; … … 146 169 #tadvadmin #save { 147 170 float: right; 148 }149 150 #tadvzones {151 margin: 25px 280px 0 0;152 171 } 153 172 … … 159 178 } 160 179 161 #unuseddiv.highlighted,180 .unuseddiv .highlighted, 162 181 .tadvdropzone.highlighted { 163 background-color: #efefe9; 182 background-color: #e4f2fd; 183 color: #000; 164 184 border-color: #aaa; 165 185 } … … 210 230 } 211 231 212 #unuseddiv {232 .unuseddiv { 213 233 padding: 10px; 214 234 border: 1px solid #ccc; 215 235 } 216 236 217 #unuseddiv h3{237 .unuseddiv h4 { 218 238 margin: 5px 5px 12px; 219 } 220 221 #unused li, 239 font-size: 1.2em; 240 } 241 242 .unused li, 222 243 .tadvdropzone li { 223 244 margin: 0; … … 229 250 } 230 251 231 #unused li {252 .unused li { 232 253 margin: 4px; 233 254 } 234 255 235 #unused {256 .unused { 236 257 margin: 0; 237 258 min-height: 36px; 238 259 } 239 260 240 #unused .tadvmodule .tadvitem {261 .unused .tadvmodule .tadvitem { 241 262 display: block; 242 height: 2 2px;263 height: 24px; 243 264 width: 140px; 244 265 border: 1px solid #bbb; … … 255 276 } 256 277 257 #unused .tadvmodule .descr {278 .unused .tadvmodule .descr { 258 279 display: inline; 259 280 font-size: 12px; … … 261 282 } 262 283 263 #unused .tadvmodule .the-button .descr {284 .unused .tadvmodule .the-button .descr { 264 285 padding: 0 4px; 265 286 font-size: 13px; … … 302 323 .tadv-error { 303 324 color: #d54e21; 304 font-weight: bold; 305 } 325 } 326 327 .tadv-block-editor .mce-menubtn { 328 margin: 6px 0; 329 } 330 331 #tadvadmin label { 332 vertical-align: text-bottom; 333 } 334 335 .tadv-block-editor.tadvdropzone { 336 height: 60px; 337 } -
tinymce-advanced/trunk/js/tadv.js
r1475916 r1993190 34 34 }); 35 35 36 $('.container-classic-block' ).sortable({ 37 connectWith: '.container-classic-block', 38 items: '> li', 39 cursor: 'move', 40 stop: function( event, ui ) { 41 var toolbar_id; 42 43 if ( ui && ( toolbar_id = ui.item.parent().attr( 'id' ) ) ) { 44 ui.item.find( 'input.tadv-button' ).attr( 'name', toolbar_id + '[]' ); 45 } 46 }, 47 activate: function( event, ui ) { 48 $(this).parent().addClass( 'highlighted' ); 49 }, 50 deactivate: function( event, ui ) { 51 $(this).parent().removeClass( 'highlighted' ); 52 }, 53 revert: 300, 54 opacity: 0.7, 55 placeholder: 'tadv-placeholder', 56 forcePlaceholderSize: true, 57 containment: 'document' 58 }); 59 60 36 61 $( '#menubar' ).on( 'change', function() { 37 $( '#tadv-mce-menu' ).toggleClass( 'enabled', $(this).prop('checked') ); 62 $( '.tadv-mce-menu.tadv-classic-editor' ).toggleClass( 'enabled', $(this).prop('checked') ); 63 }); 64 65 $( '#menubar_block' ).on( 'change', function() { 66 $( '.tadv-mce-menu.tadv-block-editor' ).toggleClass( 'enabled', $(this).prop('checked') ); 38 67 }); 39 68 … … 86 115 }); 87 116 88 $( ' #tadv-mce-menu .tadv-translate' ).each( function( i, element ) {117 $( '.tadv-mce-menu .tadv-translate' ).each( function( i, element ) { 89 118 var $element = $( element ), 90 119 text = $element.text(); -
tinymce-advanced/trunk/mce/importcss/plugin.js
r1919233 r1993190 75 75 function append(styleSheet, imported) { 76 76 var href = styleSheet.href, rules; 77 href = removeCacheSuffix(href); 77 78 if ( editor.settings.classic_block_editor ) { 79 // Attempt to import the CSS rules from the style tag. 80 tinymce.$( 'style' ).each( function( i, node ) { 81 var css = node.textContent || ''; 82 83 if ( /theme name: /i.test( css ) || css.indexOf( 'TinyMCE' ) > -1 ) { 84 try{ 85 rules = node.sheet.cssRules; 86 } catch ( er ) {} 87 } 88 }); 89 90 if ( rules ) { 91 tinymce.each( rules, function ( cssRule ) { 92 if ( cssRule.selectorText ) { 93 tinymce.each( cssRule.selectorText.split(','), function ( selector ) { 94 selector = selector.replace( /^\.editor-styles-wrapper/, '' ); 95 96 if ( selector ) { 97 selectors.push( tinymce.trim( selector ) ); 98 } 99 }); 100 } 101 }); 102 103 return; 104 } 105 } 106 107 href = removeCacheSuffix(href); 78 108 if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) { 79 109 return; -
tinymce-advanced/trunk/mce/importcss/plugin.min.js
r1919233 r1993190 1 !function(){ "use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.EditorManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),o=function(e){return e.getParam("importcss_merge_classes")},n=function(e){return e.getParam("importcss_exclusive")},_=function(e){return e.getParam("importcss_selector_converter")},r=function(e){return e.getParam("importcss_selector_filter")},i=function(e){return e.getParam("importcss_groups")},u=function(e){return e.getParam("importcss_append")},l=function(e){return e.getParam("importcss_file_filter")},a=function(t){return"string"==typeof t?function(e){return-1!==e.indexOf(t)}:t instanceof RegExp?function(e){return t.test(e)}:t},f=function(f,e,m){var g=[],n={};function p(e,t){var n,r,i,c=e.href;if(r=c,i=h.cacheSuffix,"string"==typeof r&&(r=r.replace("?"+i,"").replace("&"+i,"")),(c=r)&&m(c,t)&&(o=c,u=(s=f).settings,!(l=!1!==u.skin&&(u.skin||"lightgray"))||o!==(u.skin_url?s.documentBaseURI.toAbsolute(u.skin_url):v.baseURL+"/skins/"+l)+"/content"+(s.inline?".inline":"")+".min.css")){var s,o,u,l;y.each(e.imports,function(e){p(e,!0)});try{n=e.cssRules||e.rules}catch(a){}y.each(n,function(e){e.styleSheet?p(e.styleSheet,!0):e.selectorText&&y.each(e.selectorText.split(","),function(e){g.push(y.trim(e))})})}}y.each(f.contentCSS,function(e){n[e]=!0}),m||(m=function(e,t){return t||n[e]});try{y.each(e.styleSheets,function(e){p(e)})}catch(t){}return g},x=function(e,t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var i=r[1],c=r[2].substr(1).split(".").join(" "),s=y.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[i]?n.block=i:e.schema.getBlockElements()[i]||s[i.toLowerCase()]?n.selector=i:n.inline=i):r[2]&&(n={inline:"span",title:t.substr(1),classes:c}),!1!==o(e)?n.classes=c:n.attributes={"class":c},n}},T=function(e,t){return null===t||!1!==n(e)},c=x,t=function(h){h.on("renderFormatsMenu",function(e){var t,p={},c=a(r(h)),v=e.control,s=(t=i(h),y.map(t,function(e){return y.extend({},e,{original:e,selectors:{},filter:a(e.filter),item:{text:e.title,menu:[]}})})),o=function(e,t){if(f=e,g=p,!(T(h,m=t)?f in g:f in m.selectors)){u=e,a=p,T(h,l=t)?a[u]=!0:l.selectors[u]=!0;var n=(c=(i=h).plugins.importcss,s=e,((o=t)&&o.selector_converter?o.selector_converter:_(i)?_(i):function(){return x(i,s)}).call(c,s,o));if(n){var r=n.name||d.DOM.uniqueId();return h.formatter.register(r,n),y.extend({},v.settings.itemDefaults,{text:n.title,format:r})}}var i,c,s,o,u,l,a,f,m,g;return null};u(h)||v.items().remove(),y.each(f(h,e.doc||h.getDoc(),a(l(h))),function(n){if(-1===n.indexOf(".mce-")&&(!c||c(n))){var e=(r=s,i=n,y.grep(r,function(e){return!e.filter||e.filter(i)}));if(0<e.length)y.each(e,function(e){var t=o(n,e);t&&e.item.menu.push(t)});else{var t=o(n,null);t&&v.add(t)}}var r,i}),y.each(s,function(e){0<e.item.menu.length&&v.add(e.item)}),e.control.renderNew()})},s=function(t){return{convertSelectorToFormat:function(e){return c(t,e)}}};e.add("importcss",function(e){return t(e),s(e)})}();1 !function(){(function(){"use strict";function a(){}var b=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),d=tinymce.util.Tools.resolve("tinymce.EditorManager"),e=tinymce.util.Tools.resolve("tinymce.Env"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(a){return a.getParam("importcss_merge_classes")},h=function(a){return a.getParam("importcss_exclusive")},i=function(a){return a.getParam("importcss_selector_converter")},j=function(a){return a.getParam("importcss_selector_filter")},k=function(a){return a.getParam("importcss_groups")},l=function(a){return a.getParam("importcss_append")},m=function(a){return a.getParam("importcss_file_filter")},n={shouldMergeClasses:g,shouldImportExclusive:h,getSelectorConverter:i,getSelectorFilter:j,getCssGroups:k,shouldAppend:l,getFileFilter:m},o=function(a){var b=e.cacheSuffix;return"string"==typeof a&&(a=a.replace("?"+b,"").replace("&"+b,"")),a},p=function(a,b){var c=a.settings,e=c.skin!==!1&&(c.skin||"lightgray");if(e){var f=c.skin_url?a.documentBaseURI.toAbsolute(c.skin_url):d.baseURL+"/skins/"+e;return b===f+"/content"+(a.inline?".inline":"")+".min.css"}return!1},q=function(a){return"string"==typeof a?function(b){return b.indexOf(a)!==-1}:a instanceof RegExp?function(b){return a.test(b)}:a},r=function(a,b,c){function d(b,g){var h,i=b.href;if(a.settings.classic_block_editor&&(tinymce.$("style").each(function(a,b){var c=b.textContent||"";if(/theme name: /i.test(c)||c.indexOf("TinyMCE")>-1)try{h=b.sheet.cssRules}catch(d){}}),h))return void tinymce.each(h,function(a){a.selectorText&&tinymce.each(a.selectorText.split(","),function(a){a=a.replace(/^\.editor-styles-wrapper/,""),a&&e.push(tinymce.trim(a))})});if(i=o(i),i&&c(i,g)&&!p(a,i)){f.each(b.imports,function(a){d(a,!0)});try{h=b.cssRules||b.rules}catch(j){}f.each(h,function(a){a.styleSheet?d(a.styleSheet,!0):a.selectorText&&f.each(a.selectorText.split(","),function(a){e.push(f.trim(a))})})}}var e=[],g={};f.each(a.contentCSS,function(a){g[a]=!0}),c||(c=function(a,b){return b||g[a]});try{f.each(b.styleSheets,function(a){d(a)})}catch(h){}return e},s=function(a,b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],g=d[2].substr(1).split(".").join(" "),h=f.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||h[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:g}),n.shouldMergeClasses(a)!==!1?c.classes=g:c.attributes={"class":g},c}},t=function(a,b){return f.grep(a,function(a){return!a.filter||a.filter(b)})},u=function(a){return f.map(a,function(a){return f.extend({},a,{original:a,selectors:{},filter:q(a.filter),item:{text:a.title,menu:[]}})})},v=function(a,b){return null===b||n.shouldImportExclusive(a)!==!1},w=function(a,b,c,d){return!(v(a,c)?b in d:b in c.selectors)},x=function(a,b,c,d){v(a,c)?d[b]=!0:c.selectors[b]=!0},y=function(a,b,c,d){var e;return e=d&&d.selector_converter?d.selector_converter:n.getSelectorConverter(a)?n.getSelectorConverter(a):function(){return s(a,c)},e.call(b,c,d)},z=function(a){a.on("renderFormatsMenu",function(b){var d={},e=q(n.getSelectorFilter(a)),g=b.control,h=u(n.getCssGroups(a)),i=function(b,e){if(w(a,b,e,d)){x(a,b,e,d);var h=y(a,a.plugins.importcss,b,e);if(h){var i=h.name||c.DOM.uniqueId();return a.formatter.register(i,h),f.extend({},g.settings.itemDefaults,{text:h.title,format:i})}}return null};n.shouldAppend(a)||g.items().remove(),f.each(r(a,b.doc||a.getDoc(),q(n.getFileFilter(a))),function(a){if(a.indexOf(".mce-")===-1&&(!e||e(a))){var b=t(h,a);if(b.length>0)f.each(b,function(b){var c=i(a,b);c&&b.item.menu.push(c)});else{var c=i(a,null);c&&g.add(c)}}}),f.each(h,function(a){a.item.menu.length>0&&g.add(a.item)}),b.control.renderNew()})},A={defaultConvertSelectorToFormat:s,setup:z},B=function(a){var b=function(b){return A.defaultConvertSelectorToFormat(a,b)};return{convertSelectorToFormat:b}},C={get:B};return b.add("importcss",function(a){return A.setup(a),C.get(a)}),a})()}(); -
tinymce-advanced/trunk/mce/wptadv/plugin.js
r1876961 r1993190 66 66 if ( noAutop ) { 67 67 editor.on( 'beforeSetContent', function( event ) { 68 var autop = typeof window.wp !== 'undefined' && window.wp.editor && window.wp.editor.autop; 68 var autop; 69 var wp = window.wp; 70 71 if ( ! wp ) { 72 return; 73 } 74 75 autop = wp.editor && wp.editor.autop; 76 77 if ( ! autop ) { 78 autop = wp.oldEditor && wp.oldEditor.autop; 79 } 69 80 70 81 if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) { … … 72 83 } 73 84 }, true ); 85 86 if ( editor.settings.classic_block_editor ) { 87 editor.on( 'beforeGetContent', function( event ) { 88 // Mark all paragraph tags so they are not stripped by the Block Editor... 89 if ( event.format !== 'raw' ) { 90 editor.$( 'p' ).each( function ( i, node ) { 91 if ( ! node.hasAttributes() ) { 92 editor.$( node ).attr( 'data-tadv-p', 'keep' ); 93 } 94 } ) 95 } 96 }, true ); 97 } 74 98 } 75 99 -
tinymce-advanced/trunk/mce/wptadv/plugin.min.js
r1475916 r1993190 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," <li"),b=b.replace(/<td>\u00a0<\/td>/g,"<td> </td>"),a.trim(b)}var d=b.settings.tadv_oembed_regex||[new RegExp("https?://(www\\.)?youtube\\.com/(watch|playlist).*","i"),new RegExp("https?://youtu.be/.*","i"),new RegExp("https?://blip.tv/.*","i"),new RegExp("https?://(www\\.)?vimeo\\.com/.*","i"),new RegExp("https?://(www\\.)?dailymotion\\.com/.*","i"),new RegExp("https?://dai.ly/.*","i"),new RegExp("https?://(www\\.)?flickr\\.com/.*","i"),new RegExp("https?://flic.kr/.*","i"),new RegExp("https?://(.+\\.)?smugmug\\.com/.*","i"),new RegExp("https?://(www\\.)?hulu\\.com/watch/.*","i"),new RegExp("https?://(www\\.)?viddler\\.com/.*","i"),new RegExp("https?://qik.com/.*","i"),new RegExp("https?://revision3.com/.*","i"),new RegExp("https?://i*.photobucket.com/albums/.*","i"),new RegExp("https?://gi*.photobucket.com/groups/.*","i"),new RegExp("https?://(www\\.)?scribd\\.com/.*","i"),new RegExp("https?://wordpress.tv/.*","i"),new RegExp("https?://(.+\\.)?polldaddy\\.com/.*","i"),new RegExp("https?://poll\\.fm/.*","i"),new RegExp("https?://(www\\.)?funnyordie\\.com/videos/.*","i"),new RegExp("https?://(www\\.)?twitter\\.com/.+?/status(es)?/.*","i"),new RegExp("https?://vine\\.co/v/.*","i"),new RegExp("https?://(www\\.)?soundcloud\\.com/.*","i"),new RegExp("https?://(www\\.)?slideshare\\.net/.*","i"),new RegExp("https?://instagr(\\.am|am\\.com)/p/.*","i"),new RegExp("https?://(www\\.)?rdio\\.com/.*","i"),new RegExp("https?://rd\\.io/x/.*","i"),new RegExp("https?://(open|play)\\.spotify\\.com/.*","i"),new RegExp("https?://(.+\\.)?imgur\\.com/.*","i"),new RegExp("https?://(www\\.)?meetu(\\.ps|p\\.com)/.*","i"),new RegExp("https?://(www\\.)?issuu\\.com/.+/docs/.*","i"),new RegExp("https?://(www\\.)?collegehumor\\.com/video/.*","i"),new RegExp("https?://(www\\.)?mixcloud\\.com/.*","i"),new RegExp("https?://(www\\.|embed\\.)?ted\\.com/talks/.*","i"),new RegExp("https?://(www\\.)(animoto|video214)\\.com/play/.*","i"),new RegExp("https?://(.+).tumblr.com/post/.*","i"),new RegExp("https?://(www.)?kickstarter.com/projects/.*","i"),new RegExp("https?://kck.st/.*","i")],e=!b.settings.wpautop&&b.settings.tadv_noautop;return b.on("init",function(){e&&b.on("SaveContent",function(a){b.settings.tadv_noautop2&&(a.content=a.content.replace(/<p>\s*(https?:\/\/[^<>\s]+)\s*<\/p>/gi,function(a,b){for(var c in d)if(d[c].test(b))return b+"\n\n";return a})),a.content=a.content.replace(/caption\](\s|<br[^>]*>|<p> <\/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){}}),e&&b.on("beforeSetContent",function(a){var b="undefined"!=typeof window.wp&&window.wp.editor&&window.wp.editor.autop;a.load&&b&&a.content&&a.content.indexOf("\n")>-1&&!/<p>/i.test(a.content)&&(a.content=b(a.content))},!0),b.on("beforeGetContent",function(a){"raw"!==a.format&&b.$('img[id="__wp-temp-img-id"]').attr("id",null)}),{addLineBreaks:c}})}(window.tinymce);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> </td>"),a.trim(b)}var d=!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(){d&&b.on("SaveContent",function(a){a.content=a.content.replace(/caption\](\s|<br[^>]*>|<p> <\/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"}})}),d&&(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(a){"raw"!==a.format&&b.$("p").each(function(a,c){c.hasAttributes()||b.$(c).attr("data-tadv-p","keep")})},!0)),{addLineBreaks:c}})}(window.tinymce); -
tinymce-advanced/trunk/readme.txt
r1919235 r1993190 1 1 === TinyMCE Advanced === 2 2 Contributors: azaozz 3 Tags: wysiwyg, formatting, tinymce, write, editor3 Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write 4 4 Requires at least: 4.9.8 5 Tested up to: 4.95 Tested up to: 5.0 6 6 Stable tag: 4.8.0 7 Requires PHP: 5.2 7 8 License: GPLv2 8 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 10 10 Extends and enhances TinyMCE, the WordPress Visual Editor.11 Extends and enhances TinyMCE, the visual editor used in both the Classic Editor and the new Block Editor in WordPress. 11 12 12 13 == Description == 13 14 14 This plugin will let you add, remove and arrange the buttons that are shown on the Visual Editor toolbar. You can configure up to four rows of buttons including Font Sizes, Font Family, text and background colors, tables, etc. It will also let you enable the editor menu, see the [screenshots](screenshots). 15 16 It includes 15 plugins for [TinyMCE](https://tinymce.com/) that are automatically enabled or disabled depending on the buttons you have chosen. In addition this plugin adds some commonly used options as keeping the paragraph tags in the Text editor and importing the CSS classes from the theme's editor-style.css. 15 For WordPress version 5.0 and newer the TinyMCE Advanced plugin introduces a "Hybrid Mode" for the new Block Editor (Gutenberg). 16 It brings the best of both editors together, enhances the Classic Block and adds a new Classic Paragraph Block that replaces the default Paragraph Block. 17 18 If you are not quite ready to switch to the Block Editor, or have plugins that cannot be used there (yet), using Hybrid Mode is your best option. 19 It lets you to continue to use the familiar "Classic" editor inside the Classic Block, and at the same time gives you access to all blocks and new features in the Block Editor. 20 21 If you want to continue to use the previous 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. 22 23 As always this plugin will let you add, remove and arrange the buttons that are shown on the Visual Editor toolbar in the Classic Block in the new Block Editor, and in the Classic Editor (when enabled by a plugin). You can configure up to four rows of buttons including Font Sizes, Font Family, text and background colors, tables, etc. It will also let you enable the editor menu, see the [screenshots](screenshots). 24 25 It includes 15 plugins for [TinyMCE](https://tinymce.com/) that are automatically enabled or disabled depending on the buttons you have chosen. 26 In addition this plugin adds some commonly used options as keeping the paragraph tags in the Text editor and importing the CSS classes from the theme's editor-style.css. 17 27 18 28 = Some of the features added by this plugin = 19 29 20 * Support for creating and editing tables. 21 * More options when inserting lists. 22 * Search and Replace in the editor. 23 * Ability to set Font Family and Font Sizes. 30 * Hybrid mode that lets you use the best of both editors. 31 * Support for creating and editing tables in the Classic Block or the Classic Editor. 32 * More options when inserting lists in the Classic Block or the Classic Editor. 33 * Search and Replace in the Classic Block or the Classic Editor. 34 * Ability to set Font Family and Font Sizes in the Classic Block or the Classic Editor. 24 35 * And many others. 25 36 26 With this plugin you can also enable the TinyMCE menu above the toolbars. This will make the editor even more powerful and convenient.27 28 37 = Privacy = 29 38 … … 37 46 38 47 == Changelog == 48 49 = 4.8.1 = 50 * Updated for WordPress 5.0. 51 * Added Hybrid Mode for the Block Editor. Includes a Classic Paragraph Block that replaces the default Paragraph Block. 52 * Added option to replace the Block Editor with the Classic Editor. 53 * Added another settings section for configuring the toolbars in the Classic Block and the Classic Paragraph Block. 54 * Added some CSS fixed for the Classic Block. 55 * 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. 39 56 40 57 = 4.8.0 = … … 69 86 70 87 = 4.3.10.1 = 71 * Fixed adding paragraph tags when loading posts that were saved before turning autopoff.88 * Fixed adding paragraph tags when loading posts that were saved before turning `wpautop` off. 72 89 * Disabled the (new) inline toolbar for tables as it was overlapping the table in some cases. 73 90 … … 91 108 92 109 = 4.2.3.1 = 93 * Fix error with removing the 'textpattern'plugin.110 * Fix error with removing the `textpattern` plugin. 94 111 95 112 = 4.2.3 = 96 113 * Updated for WordPress 4.3 and TinyMCE 4.2.3. 97 * Removed the 'textpattern'plugin as WordPress 4.3 includes similar functionality by default.114 * Removed the `textpattern` plugin as WordPress 4.3 includes similar functionality by default. 98 115 * French translation by Nicolas Schneider. 99 116 … … 113 130 = 4.1 = 114 131 * Updated for WordPress 4.0 and TinyMCE 4.1. 115 * Add the 'textpattern'plugin that supports some of the markdown syntax while typing, [(more info)](http://www.tinymce.com/wiki.php/Configuration:textpattern_patterns).132 * Add the `textpattern` plugin that supports some of the markdown syntax while typing, [(more info)](http://www.tinymce.com/wiki.php/Configuration:textpattern_patterns). 116 133 * Add the updated 'table' plugin that supports background and border color. 117 134 118 135 = 4.0.2 = 119 136 * Fix showing of the second, third and forth button rows when the Toolbar Toggle button is not used. 120 * Fix adding the ''directionality''plugin when RTL or LTR button is selected.137 * Fix adding the `directionality` plugin when RTL or LTR button is selected. 121 138 * Show the ''Advanced Options'' to super admins on multisite installs. 122 * Add the ''link''plugin including link rel setting. Replaces the Insert/Edit Link dialog when enabled.139 * Add the `link` plugin including link rel setting. Replaces the Insert/Edit Link dialog when enabled. 123 140 * Include updated ''table'' plugin that has support for vertical align for cells. 124 141 … … 156 173 Added advanced options: stop removing iframes, stop removing HTML 5.0 elements, moved the support for custom editor styles to editor-style.css in the current theme. 157 174 158 Attention: if you have a customized tadv-mce.css file and your theme doesn't have editor-style.css, please download tadv-mce.css, rename it to editor-style.css and upload it to your current theme directory. Alternatively you can add there the editor-style.css from the Twenty Ten theme. If your theme has editor-style.css you can add any custom styles there.175 Attention: if you have a customized `tadv-mce.css` file and your theme doesn't have editor-style.css, please download `tadv-mce.css`, rename it to editor-style.css and upload it to your current theme directory. Alternatively you can add there the editor-style.css from the Twenty Ten theme. If your theme has editor-style.css you can add any custom styles there. 159 176 160 177 = 3.3.9 = … … 171 188 172 189 = 3.1 = 173 Compatibility with WordPress 2.6 and TinyMCE 3.1, keeps empty paragraphs when disabling the removal of P and BR tags, the buttons for MCImageManager and MCFileManagercan be arranged (if installed).190 Compatibility with WordPress 2.6 and TinyMCE 3.1, keeps empty paragraphs when disabling the removal of P and BR tags, the buttons for `MCImageManager` and `MCFileManager` can be arranged (if installed). 174 191 175 192 = 3.0.1 = 176 Compatibility with WordPress 2.5.1 and TinyMCE 3.0.7, added option to disable the removal of P and BR tags when saving and in the HTML editor ( autop), added two more buttons to the HTML editor: autopand undo, fixed the removal of non-default TinyMCE buttons.193 Compatibility with WordPress 2.5.1 and TinyMCE 3.0.7, added option to disable the removal of P and BR tags when saving and in the HTML editor (wpautop), added two more buttons to the HTML editor: `wpautop` and undo, fixed the removal of non-default TinyMCE buttons. 177 194 178 195 = 3.0 = … … 197 214 198 215 = 4.1 = 199 Includes the 'textpattern'plugin that supports some of the markdown syntax while typing, and the updated 'table' plugin that supports background and border color for tables.216 Includes the `textpattern` plugin that supports some of the markdown syntax while typing, and the updated 'table' plugin that supports background and border color for tables. 200 217 201 218 == Frequently Asked Questions == … … 207 224 = I have just installed this plugin, but it does not do anything. = 208 225 209 Change some buttons on one of the toolbars, save your changes, clear your browser cache, and try again. If that does not work try relo ding the Edit page several times while holding down Shift or Ctrl. There may also be a network cache somewhere between you and your host. You may need to wait for a few hours until this cache expires.226 Change some buttons on one of the toolbars, save your changes, clear your browser cache, and try again. If that does not work try reloading the Edit page several times while holding down Shift. There may also be a network cache somewhere between you and your host. You may need to wait for a few hours until this cache expires. 210 227 211 228 = When I add "Smilies", they do not show in the editor. = … … 225 242 Please post on the support forum or visit the homepage for [TinyMCE Advanced](http://www.laptoptips.ca/projects/tinymce-advanced/). 226 243 227 228 244 == Screenshots == 229 245 230 1. The WordPress editor after installing this plugin (default plugin settings). 231 2. The TinyMCE Advanced settings page, toolbars options. 232 3. The TinyMCE Advanced settings page, user options. 233 4. The TinyMCE Advanced settings page, advanced options. 234 5. The TinyMCE Advanced settings page, admin options. 246 1. Classic Paragraph Block. 247 2. The Classic Editor (TinyMCE) toolbars settings. 248 3. The Classic Block (Block Editor) toolbars settings. 249 4. Editor options. 250 5. Advanced plugin options. 251 6. Administration options. 252 253 == Upgrade Notice == 254 255 = 4.8.1 = 256 Updated for WordPress 5.0 and the Block Editor (Gutenebrg). Adds a "Classic Paragraph Block" with TinyMCE that replaces the default Paragraph Block. -
tinymce-advanced/trunk/tadv_admin.php
r1919233 r1993190 13 13 // TODO 14 14 if ( ! current_user_can( 'manage_options' ) ) { 15 wp_die( 'Access denied');15 wp_die( 'Invalid request' ); 16 16 } 17 17 … … 22 22 $tadv_options_updated = false; 23 23 $settings = $admin_settings = array(); 24 25 26 24 27 25 if ( isset( $_POST['tadv-save'] ) ) { … … 50 48 51 49 ?> 52 <div class="wrap ">50 <div class="wrap tinymce-advanced"> 53 51 <h2><?php _e( 'TinyMCE Advanced Settings Export', 'tinymce-advanced' ); ?></h2> 54 52 … … 75 73 // TODO: all users 76 74 ?> 77 <div class="wrap ">75 <div class="wrap tinymce-advanced"> 78 76 <h2><?php _e( 'TinyMCE Advanced Settings Import', 'tinymce-advanced' ); ?></h2> 79 77 … … 126 124 127 125 ?> 128 <div class="wrap " id="contain">126 <div class="wrap tinymce-advanced" id="contain"> 129 127 <h2><?php _e( 'Editor Settings', 'tinymce-advanced' ); ?></h2> 130 128 <?php … … 142 140 <form id="tadvadmin" method="post" action=""> 143 141 144 <p class="tadv-submit ">145 <input class="button-primary button-large " type="submit" name="tadv-save" value="<?php _e( 'Save Changes', 'tinymce-advanced' ); ?>" />142 <p class="tadv-submit tadv-submit-top"> 143 <input class="button-primary button-large top-button" type="submit" name="tadv-save" value="<?php _e( 'Save Changes', 'tinymce-advanced' ); ?>" /> 146 144 </p> 147 145 146 <div id="classic-editor"> 147 <h3><?php _e( 'Toolbars for the Classic Editor (TinyMCE)', 'tinymce-advanced' ); ?></h3> 148 148 149 <div id="tadvzones"> 149 150 <p><label> 151 <input type="checkbox" name="options[]" id="menubar" value="menubar" <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' checked="checked"'; } ?>> 152 <?php _e( 'Enable the editor menu.', 'tinymce-advanced' ); ?> 153 </label></p> 154 155 <div id="tadv-mce-menu" class="mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item 150 <p> 151 <input type="checkbox" name="options[]" id="menubar" value="menubar" <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' checked="checked"'; } ?>> 152 <label for="menubar"><?php _e( 'Enable the editor menu.', 'tinymce-advanced' ); ?></label> 153 </p> 154 155 <div class="tadv-mce-menu tadv-classic-editor mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item 156 156 <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' enabled'; } ?>"> 157 157 <div class="mce-container-body mce-flow-layout"> … … 204 204 205 205 $mce_text_buttons = array( 'styleselect', 'formatselect', 'fontselect', 'fontsizeselect' ); 206 $all_buttons_classic = $all_buttons; 206 207 207 208 for ( $i = 1; $i < 5; $i++ ) { … … 218 219 } 219 220 220 if ( isset( $all_buttons [$button] ) ) {221 $name = $all_buttons [$button];222 unset( $all_buttons [$button] );221 if ( isset( $all_buttons_classic[ $button ] ) ) { 222 $name = $all_buttons_classic[ $button ]; 223 unset( $all_buttons_classic[ $button ] ); 223 224 } else { 224 // error?..225 225 continue; 226 226 } 227 227 228 ?><li class="tadvmodule" id="<?php echo $button; ?>"> 228 ?> 229 <li class="tadvmodule" id="<?php echo $button; ?>"> 229 230 <?php 230 231 … … 250 251 251 252 ?> 252 </li><?php 253 </li> 254 <?php 253 255 254 256 } … … 262 264 </div> 263 265 264 <p><?php _e( 'Drag buttons from the unused buttons below and drop them in the toolbars above, or drag the buttons in the toolbars to rearrange them.', 'tinymce-advanced' ); ?></p> 265 266 <div id="unuseddiv"> 267 <h3><?php _e( 'Unused Buttons', 'tinymce-advanced' ); ?></h3> 268 <ul id="unused" class="container"> 269 <?php 270 271 foreach( $all_buttons as $button => $name ) { 272 if ( strpos( $button, 'separator' ) !== false ) { 273 continue; 266 <p><?php _e( 'Drop buttons in the toolbars, or drag the buttons to rearrange them.', 'tinymce-advanced' ); ?></p> 267 268 <div class="unuseddiv"> 269 <h4><?php _e( 'Unused Buttons', 'tinymce-advanced' ); ?></h4> 270 <div> 271 <ul id="unused" class="unused container"> 272 <?php 273 274 foreach( $all_buttons_classic as $button => $name ) { 275 if ( strpos( $button, 'separator' ) !== false ) { 276 continue; 277 } 278 279 ?> 280 <li class="tadvmodule" id="<?php echo $button; ?>"> 281 <?php 282 283 if ( in_array( $button, $mce_text_buttons, true ) ) { 284 ?> 285 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox"> 286 <div class="the-button"> 287 <span class="descr"><?php echo $name; ?></span> 288 <i class="mce-caret"></i> 289 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button; ?>" /> 290 </div> 291 </div> 292 <?php 293 } else { 294 ?> 295 <div class="tadvitem"> 296 <i class="mce-ico mce-i-<?php echo $button; ?>" title="<?php echo $name; ?>"></i> 297 <span class="descr"><?php echo $name; ?></span> 298 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button; ?>" /> 299 </div> 300 <?php 301 } 302 303 ?> 304 </li> 305 <?php 306 } 307 308 ?> 309 </ul> 310 </div><!-- /highlighted --> 311 </div> 312 </div><!-- /classic-editor --> 313 314 <div id="block-editor"> 315 <h3><?php _e( 'Toolbars for the Classic Blocks in the Block Editor (Gutenberg)', 'tinymce-advanced' ); ?></h3> 316 317 <p> 318 <?php _e( 'The toolbars in the Classic Block are narrower and show on focus.', 'tinymce-advanced' ); ?> 319 <?php _e( 'For best results enable the menu and add only essential buttons.', 'tinymce-advanced' ); ?> 320 <?php _e( 'The buttons will wrap around depending on the width of the toolbar.', 'tinymce-advanced' ); ?> 321 </p> 322 323 <p> 324 <input type="checkbox" name="options[]" id="menubar_block" value="menubar_block" <?php if ( $this->check_user_setting( 'menubar_block' ) ) { echo ' checked'; } ?>> 325 <label for="menubar_block"><?php _e( 'Enable the editor menu (recommended).', 'tinymce-advanced' ); ?></label> 326 </p> 327 328 <div class="tadv-mce-menu tadv-block-editor mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item 329 <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' enabled'; } ?>"> 330 <div class="mce-container-body mce-flow-layout"> 331 <div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item"> 332 <button type="button"> 333 <span class="tadv-translate">File</span> 334 <i class="mce-caret"></i> 335 </button> 336 </div> 337 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item"> 338 <button type="button"> 339 <span class="tadv-translate">Edit</span> 340 <i class="mce-caret"></i> 341 </button> 342 </div> 343 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item"> 344 <button type="button"> 345 <span class="tadv-translate">Insert</span> 346 <i class="mce-caret"></i> 347 </button> 348 </div> 349 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item mce-toolbar-item"> 350 <button type="button"> 351 <span class="tadv-translate">View</span> 352 <i class="mce-caret"></i> 353 </button> 354 </div> 355 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item"> 356 <button type="button"> 357 <span class="tadv-translate">Format</span> 358 <i class="mce-caret"></i> 359 </button> 360 </div> 361 <div class="mce-widget mce-btn mce-menubtn mce-flow-layout-item"> 362 <button type="button"> 363 <span class="tadv-translate">Table</span> 364 <i class="mce-caret"></i> 365 </button> 366 </div> 367 <div class="mce-widget mce-btn mce-menubtn mce-last mce-flow-layout-item"> 368 <button type="button"> 369 <span class="tadv-translate">Tools</span> 370 <i class="mce-caret"></i> 371 </button> 372 </div> 373 </div> 374 </div> 375 376 <div class="tadvdropzone tadv-block-editor mce-toolbar"> 377 <ul id="toolbar_classic_block" class="container-classic-block"> 378 <?php 379 380 $all_buttons_block = $all_buttons; 381 382 // Remove the toolbar-toggle 383 unset( $all_buttons_block['wp_adv'] ); 384 385 foreach( $this->toolbar_classic_block as $button_id ) { 386 $name = ''; 387 388 if ( strpos( $button, 'separator' ) !== false || in_array( $button, array( 'moveforward', 'movebackward', 'absolute' ) ) ) { 389 continue; 390 } 391 392 if ( isset( $all_buttons_block[ $button_id ] ) ) { 393 $name = $all_buttons_block[ $button_id ]; 394 unset( $all_buttons_block[ $button_id ] ); 395 } else { 396 continue; 397 } 398 399 ?> 400 <li class="tadvmodule" id="<?php echo $button_id; ?>"> 401 <?php 402 403 if ( in_array( $button_id, $mce_text_buttons, true ) ) { 404 ?> 405 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox"> 406 <div class="the-button"> 407 <span class="descr"><?php echo $name; ?></span> 408 <i class="mce-caret"></i> 409 <input type="hidden" class="tadv-button" name="toolbar_classic_block[]" value="<?php echo $button_id; ?>" /> 410 </div> 411 </div> 412 <?php 413 } else { 414 ?> 415 <div class="tadvitem"> 416 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i> 417 <span class="descr"><?php echo $name; ?></span> 418 <input type="hidden" class="tadv-button" name="toolbar_classic_block[]" value="<?php echo $button_id; ?>" /> 419 </div> 420 <?php 421 } 422 423 ?> 424 </li> 425 <?php 274 426 } 275 427 276 ?><li class="tadvmodule" id="<?php echo $button; ?>"> 428 ?> 429 </ul> 430 </div> 431 432 <p><?php _e( 'Drop buttons in the toolbars, or drag the buttons to rearrange them.', 'tinymce-advanced' ); ?></p> 433 434 <div class="unuseddiv"> 435 <h4><?php _e( 'Unused Buttons for the Classic Block', 'tinymce-advanced' ); ?></h4> 436 <div> 437 <ul id="unused-classic-block" class="unused container-classic-block"> 277 438 <?php 278 439 279 if ( in_array( $button, $mce_text_buttons, true ) ) { 440 foreach( $all_buttons_block as $button_id => $name ) { 441 if ( strpos( $button, 'separator' ) !== false ) { 442 continue; 443 } 444 280 445 ?> 281 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox"> 282 <div class="the-button"> 283 <span class="descr"><?php echo $name; ?></span> 284 <i class="mce-caret"></i> 285 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button; ?>" /> 286 </div> 287 </div> 446 <li class="tadvmodule" id="<?php echo $button_id; ?>"> 447 <?php 448 449 if ( in_array( $button_id, $mce_text_buttons, true ) ) { 450 ?> 451 <div class="tadvitem mce-widget mce-btn mce-menubtn mce-fixed-width mce-listbox"> 452 <div class="the-button"> 453 <span class="descr"><?php echo $name; ?></span> 454 <i class="mce-caret"></i> 455 <input type="hidden" class="tadv-button" name="unused-classic-block[]" value="<?php echo $button_id; ?>" /> 456 </div> 457 </div> 458 <?php 459 } else { 460 ?> 461 <div class="tadvitem"> 462 <i class="mce-ico mce-i-<?php echo $button_id; ?>" title="<?php echo $name; ?>"></i> 463 <span class="descr"><?php echo $name; ?></span> 464 <input type="hidden" class="tadv-button" name="unused-classic-block[]" value="<?php echo $button_id; ?>" /> 465 </div> 466 <?php 467 } 468 469 ?> 470 </li> 288 471 <?php 289 } else {290 ?>291 <div class="tadvitem">292 <i class="mce-ico mce-i-<?php echo $button; ?>" title="<?php echo $name; ?>"></i>293 <span class="descr"><?php echo $name; ?></span>294 <input type="hidden" class="tadv-button" name="unused[]" value="<?php echo $button; ?>" />295 </div>296 <?php297 472 } 298 473 299 474 ?> 300 </li><?php 301 302 } 303 304 ?> 305 </ul> 306 </div> 475 </ul> 476 </div><!-- /highlight --> 477 </div><!-- /unuseddiv --> 478 </div><!-- /block-editor --> 307 479 308 480 <div class="advanced-options"> 309 481 <h3><?php _e( 'Options', 'tinymce-advanced' ); ?></h3> 310 <div> 311 <label><input type="checkbox" name="options[]" value="advlist" id="advlist" <?php if ( $this->check_user_setting('advlist') ) echo ' checked="checked"'; ?> /> 312 <?php _e( 'List Style Options', 'tinymce-advanced' ); ?></label> 482 483 <div> 484 <input type="checkbox" name="options[]" value="no_merge_toolbars" id="merge_toolbars" <?php if ( ! $this->check_user_setting('no_merge_toolbars') ) echo ' checked'; ?> /> 485 <label for="merge_toolbars"><?php _e( 'Append all buttons to the top toolbar in the Classic and Classic Paragraph blocks.', 'tinymce-advanced' ); ?></label> 486 <p><?php _e( 'This affects buttons that are added by other plugins. These buttons will be appended to the top toolbar row instead of forming second, third, and forth rows.', 'tinymce-advanced' ); ?></p> 487 </div> 488 489 <div> 490 <input type="checkbox" name="options[]" value="advlist" id="advlist" <?php if ( $this->check_user_setting('advlist') ) echo ' checked'; ?> /> 491 <label for="advlist"><?php _e( 'List Style Options', 'tinymce-advanced' ); ?></label> 313 492 <p> 314 493 <?php _e( 'Enable more list options: upper or lower case letters for ordered lists, disk or square for unordered lists, etc.', 'tinymce-advanced' ); ?> 315 494 </p> 316 495 </div> 317 <div> 318 <label><input type="checkbox" name="options[]" value="contextmenu" id="contextmenu" <?php if ( $this->check_user_setting('contextmenu') ) echo ' checked="checked"'; ?> /> 319 <?php _e( 'Context Menu', 'tinymce-advanced' ); ?></label> 320 <p> 321 <?php _e( 'Replace the browser context (right-click) menu.', 'tinymce-advanced' ); ?> 322 </p> 323 </div> 324 <div> 325 <label><input type="checkbox" name="options[]" value="advlink" id="advlink" <?php if ( $this->check_user_setting('advlink') ) echo ' checked="checked"'; ?> /> 326 <?php _e( 'Alternative link dialog', 'tinymce-advanced' ); ?></label> 327 <p> 328 <?php _e( 'Open the TinyMCE link dialog when using the link button on the toolbar or the link menu item.', 'tinymce-advanced' ); ?> 329 </p> 330 </div> 331 <div> 332 <label><input type="checkbox" name="options[]" value="fontsize_formats" id="fontsize_formats" <?php if ( $this->check_user_setting( 'fontsize_formats' ) ) echo ' checked="checked"'; ?> /> 333 <?php _e( 'Font sizes', 'tinymce-advanced' ); ?></label> 496 497 <div> 498 <input type="checkbox" name="options[]" value="contextmenu" id="contextmenu" <?php if ( $this->check_user_setting('contextmenu') ) echo ' checked'; ?> /> 499 <label for="contextmenu"><?php _e( 'Context Menu', 'tinymce-advanced' ); ?></label> 500 <p><?php _e( 'Replace the browser context (right-click) menu.', 'tinymce-advanced' ); ?></p> 501 </div> 502 503 <div> 504 <input type="checkbox" name="options[]" value="advlink" id="advlink" <?php if ( $this->check_user_setting('advlink') ) echo ' checked'; ?> /> 505 <label for="advlink"><?php _e( 'Alternative link dialog', 'tinymce-advanced' ); ?></label> 506 <p><?php _e( 'Open the TinyMCE link dialog when using the link button on the toolbar or the link menu item.', 'tinymce-advanced' ); ?></p> 507 </div> 508 509 <div> 510 <input type="checkbox" name="options[]" value="fontsize_formats" id="fontsize_formats" <?php if ( $this->check_user_setting( 'fontsize_formats' ) ) echo ' checked="checked"'; ?> /> 511 <label for="fontsize_formats"><?php _e( 'Font sizes', 'tinymce-advanced' ); ?></label> 334 512 <p><?php printf( __( 'Replace the size setting available for fonts with: %s.', 'tinymce-advanced' ), $this->fontsize_formats ); ?></p> 335 513 </div> … … 338 516 339 517 if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) { 518 $preselect = function_exists( 'use_block_editor_for_post_type' ) ? '' : '<p>' . __( 'You can pre-select this option. It will be enabled as soon as you upgrade to WordPress 5.0 or later.', 'tinymce-advanced' ) . '</p>'; 519 340 520 ?> 341 521 <div class="advanced-options"> 342 522 <h3><?php _e( 'Advanced Options', 'tinymce-advanced' ); ?></h3> 523 <div> 524 <input type="checkbox" name="admin_options[]" value="no_hybrid_mode" id="no_hybrid_mode" <?php if ( ! $this->check_admin_setting( 'no_hybrid_mode' ) ) echo ' checked'; ?> /> 525 <label for="no_hybrid_mode"><?php _e( 'Hybrid Block Editor Mode', 'tinymce-advanced' ); ?></label> 526 <p><strong><?php _e( 'Brings the best of both editors together!', 'tinymce-advanced' ); ?></strong></p> 527 <p> 528 <?php _e( 'You can continue to use the familiar TinyMCE Editor in the (new and improved) “Classic” Paragraph Block, and at the same time have access to all blocks and new goodies of the Block Editor.', 'tinymce-advanced' ); ?> 529 </p> 530 <p> 531 <?php _e( 'Selecting this option makes the Classic Block in the Block Editor more prominent and adds a new “Classic Paragraph Block” that includes the TinyMCE Editor and replaces the Paragraph Block.', 'tinymce-advanced' ); ?> 532 <?php _e( 'Most existing TinyMCE plugins and add-ons will continue to work in the Classic Paragraph Block as well as in the Classic Block.', 'tinymce-advanced' ); ?> 533 <?php _e( 'This makes the Block Editor more familiar, easier to use, and much more compatible with your existing workflow.', 'tinymce-advanced' ); ?> 534 </p> 535 <p> 536 <?php _e( 'Note: The Classic Paragraph Block and the Classic Block are interchangeable. When saving a post that contains several successive Classic Paragraph blocks, they will be merged into one Classic Block.', 'tinymce-advanced' ); ?> 537 <?php _e( 'This will keep the blocks compatible should you decide to uninstall this plugin or turn the above option off.', 'tinymce-advanced' ); ?> 538 </p> 539 <?php echo $preselect ?> 540 </div> 541 <div> 542 <?php 543 544 if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) { 545 546 ?> 547 <input type="checkbox" name="admin_options[]" value="replace_block_editor" id="replace_block_editor" <?php if ( $this->check_admin_setting( 'replace_block_editor' ) ) echo ' checked'; ?> /> 548 <label for="replace_block_editor"><?php _e( 'Replace the Block Editor with the Classic Editor', 'tinymce-advanced' ); ?></label> 549 <p> 550 <?php _e( 'Selecting this option will restore the previous (“classic”) editor and the previous Edit Post screen.', 'tinymce-advanced' ); ?> 551 <?php _e( 'It will allow you to use other plugins that enhance that editor, add old-style Meta Boxes, or in some way depend on the previous Edit Post screen.', 'tinymce-advanced' ); ?> 552 </p> 553 <?php echo $preselect ?> 554 <p> 555 <?php 556 557 $text = __( 'If you prefer to use both editors side by side, do not enable this option. It is better to install the %1$sClassic Editor plugin%2$s.', 'tinymce-advanced' ); 558 $url = 'https://wordpress.org/plugins/classic-editor/'; 559 printf( $text, '<a href="' . esc_url( $url ) . '">', '</a>' ); 560 561 ?> 562 </p> 563 <?php 564 } 565 566 ?> 567 </div> 568 <div> 569 <input type="checkbox" name="admin_options[]" value="no_autop" id="no_autop" <?php if ( $this->check_admin_setting( 'no_autop' ) ) echo ' checked'; ?> /> 570 <label for="no_autop"><?php _e( 'Keep paragraph tags', 'tinymce-advanced' ); ?></label> 571 <p><strong><?php _e( 'Recommended for better compatibility with the Block Editor (Gutenberg).', 'tinymce-advanced' ); ?></strong></p> 572 <p> 573 <?php _e( 'Stop removing the <p> and <br> tags when saving and show them in the Text editor.', 'tinymce-advanced' ); ?> 574 <?php _e( 'This will make it possible to use more advanced coding in the Text editor without the back-end filtering affecting it much.', 'tinymce-advanced' ); ?> 575 <?php _e( 'However it may behave unexpectedly in rare cases, so test it thoroughly before enabling it permanently.', 'tinymce-advanced' ); ?> 576 <?php _e( 'Line breaks in the Text editor would still affect the output, in particular do not use empty lines, line breaks inside HTML tags or multiple <br> tags.', 'tinymce-advanced' ); ?> 577 </p> 578 </div> 343 579 <?php 344 580 … … 346 582 $disabled = ' disabled'; 347 583 348 if ( $has_editor_style === 'not-supporetd' || $has_editor_style === 'not-present') {584 if ( $has_editor_style === false ) { 349 585 add_editor_style(); 586 $has_editor_style = $this->has_editor_style(); 350 587 } 351 588 352 if ( $ this->has_editor_style() === 'present') {589 if ( $has_editor_style ) { 353 590 $disabled = ''; 354 $has_editor_style = 'present';355 591 } 356 592 357 593 ?> 358 594 <div> 359 <label><input type="checkbox" name="admin_options[]" value="importcss" id="importcss" <?php if ( ! $disabled && $this->check_admin_setting( 'importcss' ) ) echo ' checked="checked"'; echo $disabled; ?> /> 360 <?php _e( 'Create CSS classes menu', 'tinymce-advanced' ); ?></label> 361 <p> 595 <input type="checkbox" name="admin_options[]" value="importcss" id="importcss" <?php if ( ! $disabled && $this->check_admin_setting( 'importcss' ) ) echo ' checked'; echo $disabled; ?> /> 596 <label for="importcss"><?php _e( 'Create CSS classes menu', 'tinymce-advanced' ); ?></label> 597 <p> 598 <?php _e( 'Load the CSS classes used in editor-style.css and replace the Formats menu.', 'tinymce-advanced' ); ?> 599 </p> 362 600 <?php 363 601 364 _e( 'Load the CSS classes used in editor-style.css and replace the Formats menu.', 'tinymce-advanced' ); 365 366 if ( $has_editor_style === 'not-supporetd' ) { 602 if ( $disabled ) { 367 603 ?> 368 <br> 369 <span class="tadv-error"><?php _e( 'ERROR:', 'tinymce-advanced' ); ?></span> 370 <?php _e( 'Your theme does not support editor-style.css.', 'tinymce-advanced' ); ?> 604 <p> 605 <span class="tadv-error"><?php _e( 'Disabled:', 'tinymce-advanced' ); ?></span> 606 <?php _e( 'A stylesheet file named editor-style.css was not added by your theme.', 'tinymce-advanced' ); ?> 607 <br> 371 608 <?php 372 } elseif ( $disabled ) {373 ?>374 <br>375 <span class="tadv-error"><?php _e( 'ERROR:', 'tinymce-advanced' ); ?></span>376 <?php _e( 'A stylesheet file named editor-style.css was not added by your theme.', 'tinymce-advanced' ); ?>377 <?php378 }379 380 if ( $has_editor_style === 'not-supporetd' || $disabled ) {381 _e( 'To use this option, add editor-style.css to your theme or a child theme. Enabling this option will also load that stylesheet in the editor.', 'tinymce-advanced' );382 609 } 383 610 … … 386 613 </div> 387 614 <div> 388 <label><input type="checkbox" name="admin_options[]" value="no_autop" id="no_autop" <?php if ( $this->check_admin_setting( 'no_autop' ) ) echo ' checked="checked"'; ?> /> 389 <?php _e( 'Keep paragraph tags', 'tinymce-advanced' ); ?></label> 390 <p> 391 <?php _e( 'Stop removing the <p> and <br /> tags when saving and show them in the Text editor.', 'tinymce-advanced' ); ?> 392 <?php _e( 'This will make it possible to use more advanced coding in the Text editor without the back-end filtering affecting it much.', 'tinymce-advanced' ); ?> 393 <?php _e( 'However it may behave unexpectedly in rare cases, so test it thoroughly before enabling it permanently.', 'tinymce-advanced' ); ?> 394 <?php _e( 'Line breaks in the Text editor would still affect the output, in particular do not use empty lines, line breaks inside HTML tags or multiple <br /> tags.', 'tinymce-advanced' ); ?> 395 </p> 396 </div> 397 <div> 398 <label><input type="checkbox" name="admin_options[]" value="paste_images" id="paste_images" <?php if ( $this->check_admin_setting( 'paste_images' ) ) echo ' checked="checked"'; ?> /> 399 <?php _e( 'Enable pasting of image source', 'tinymce-advanced' ); ?></label> 615 <input type="checkbox" name="admin_options[]" value="paste_images" id="paste_images" <?php if ( $this->check_admin_setting( 'paste_images' ) ) echo ' checked'; ?> /> 616 <label for="paste_images"><?php _e( 'Enable pasting of image source', 'tinymce-advanced' ); ?></label> 400 617 <p> 401 618 <?php _e( 'Works only in Firefox and Safari. These browsers support pasting of images directly in the editor and convert them to base64 encoded text.', 'tinymce-advanced' ); ?> … … 404 621 </p> 405 622 </div> 623 <div> 624 <p class="tadv-help"> 625 <?php 626 627 $text = __( 'For other advanced TinyMCE settings, including settings for the Classic Block in the Block Editor, you can use the %1$sAdvanced TinyMCE Configuration plugin%2$s.', 'tinymce-advanced' ); 628 $url = 'https://wordpress.org/plugins/advanced-tinymce-configuration/'; 629 printf( $text, '<a href="' . esc_url( $url ) . '">', '</a>' ); 630 631 ?> 632 </p> 633 </div> 406 634 </div> 407 635 … … 418 646 <h4><?php _e( 'Enable the editor enhancements for:', 'tinymce-advanced' ); ?></h4> 419 647 <p> 420 < label><input type="checkbox" name="tadv_enable_at[]" value="edit_post_screen" <?php if ( $this->check_admin_setting( 'enable_edit_post_screen' ) ) echo ' checked="checked"'; ?> />421 < ?php _e( 'The main editor (Add New and Edit posts and pages)', 'tinymce-advanced' ); ?></label>422 </p> 423 <p> 424 < label><input type="checkbox" name="tadv_enable_at[]" value="rest_of_wpadmin" <?php if ( $this->check_admin_setting( 'enable_rest_of_wpadmin' ) ) echo ' checked="checked"'; ?> />425 < ?php _e( 'Other editors in wp-admin', 'tinymce-advanced' ); ?></label>426 </p> 427 <p> 428 < label><input type="checkbox" name="tadv_enable_at[]" value="on_front_end" <?php if ( $this->check_admin_setting( 'enable_on_front_end' ) ) echo ' checked="checked"'; ?> />429 < ?php _e( 'Editors on the front end of the site', 'tinymce-advanced' ); ?></label>648 <input type="checkbox" id="tadv_enable_1" name="tadv_enable_at[]" value="edit_post_screen" <?php if ( $this->check_admin_setting( 'enable_edit_post_screen' ) ) echo ' checked'; ?> /> 649 <label for="tadv_enable_1"><?php _e( 'The main editor (Add New and Edit posts and pages)', 'tinymce-advanced' ); ?></label> 650 </p> 651 <p> 652 <input type="checkbox" id="tadv_enable_2" name="tadv_enable_at[]" value="rest_of_wpadmin" <?php if ( $this->check_admin_setting( 'enable_rest_of_wpadmin' ) ) echo ' checked'; ?> /> 653 <label for="tadv_enable_2"><?php _e( 'Other editors in wp-admin', 'tinymce-advanced' ); ?></label> 654 </p> 655 <p> 656 <input type="checkbox" id="tadv_enable_3" name="tadv_enable_at[]" value="on_front_end" <?php if ( $this->check_admin_setting( 'enable_on_front_end' ) ) echo ' checked'; ?> /> 657 <label for="tadv_enable_3"><?php _e( 'Editors on the front end of the site', 'tinymce-advanced' ); ?></label> 430 658 </p> 431 659 </div> … … 435 663 } 436 664 ?> 665 666 <hr> 437 667 438 668 <p class="tadv-submit"> -
tinymce-advanced/trunk/tinymce-advanced.php
r1919233 r1993190 4 4 Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/ 5 5 Description: Enables advanced features and plugins in TinyMCE, the visual editor in WordPress. 6 Version: 4.8. 06 Version: 4.8.1 7 7 Author: Andrew Ozz 8 8 Author URI: http://www.laptoptips.ca/ … … 28 28 */ 29 29 30 if ( ! defined( 'ABSPATH' ) ) { 31 exit; 32 } 33 30 34 if ( ! class_exists('Tinymce_Advanced') ) : 31 35 … … 33 37 34 38 private $required_version = '4.9.6'; 35 private $plugin_version = '4. 7.13';39 private $plugin_version = '4.8.1'; 36 40 37 41 private $user_settings; … … 51 55 private $buttons_filter = array(); 52 56 private $fontsize_formats = '8px 10px 12px 14px 16px 20px 24px 28px 32px 36px 48px 60px 72px 96px'; 53 57 private $required_menubar_plugins = array( 58 'anchor', 59 'code', 60 'insertdatetime', 61 'nonbreaking', 62 'print', 63 'searchreplace', 64 'table', 65 'visualblocks', 66 'visualchars' 67 ); 54 68 55 69 private function get_default_user_settings() { 56 70 return array( 57 'options' => 'menubar,advlist ',71 'options' => 'menubar,advlist,menubar_block', 58 72 'toolbar_1' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,unlink,undo,redo', 59 73 'toolbar_2' => 'fontselect,fontsizeselect,outdent,indent,pastetext,removeformat,charmap,wp_more,forecolor,table,wp_help', 60 74 'toolbar_3' => '', 61 75 'toolbar_4' => '', 76 'toolbar_classic_block' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,forecolor,backcolor,table,wp_help', 62 77 'plugins' => 'anchor,code,insertdatetime,nonbreaking,print,searchreplace,table,visualblocks,visualchars,advlist,wptadv', 63 78 ); … … 96 111 'contextmenu', 97 112 'menubar', 113 'menubar_block', 98 114 'fontsize_formats', 115 'no_merge_toolbars', 99 116 ); 100 117 } … … 105 122 'no_autop', 106 123 'paste_images', 124 'no_hybrid_mode', 125 'replace_block_editor', 107 126 ); 108 127 } … … 117 136 118 137 public function __construct() { 119 if ( ! defined('ABSPATH') ) {120 return;121 }122 138 123 139 register_activation_hook( __FILE__, array( $this, 'check_plugin_version' ) ); … … 136 152 137 153 add_filter( 'mce_buttons', array( $this, 'mce_buttons_1' ), 999, 2 ); 138 add_filter( 'mce_buttons_2', array( $this, 'mce_buttons_2' ), 999 );139 add_filter( 'mce_buttons_3', array( $this, 'mce_buttons_3' ), 999 );140 add_filter( 'mce_buttons_4', array( $this, 'mce_buttons_4' ), 999 );141 142 add_filter( 'tiny_mce_before_init', array( $this, 'mce_options' ) );154 add_filter( 'mce_buttons_2', array( $this, 'mce_buttons_2' ), 999, 2 ); 155 add_filter( 'mce_buttons_3', array( $this, 'mce_buttons_3' ), 999, 2 ); 156 add_filter( 'mce_buttons_4', array( $this, 'mce_buttons_4' ), 999, 2 ); 157 158 add_filter( 'tiny_mce_before_init', array( $this, 'mce_options' ), 10, 2 ); 143 159 add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 999 ); 144 160 add_filter( 'tiny_mce_plugins', array( $this, 'tiny_mce_plugins' ), 999 ); 145 add_action( 'after_wp_tiny_mce', array( $this, 'after_wp_tiny_mce' ) ); 161 162 add_action( 'enqueue_block_editor_assets', array( $this, 'block_editor_assets' ), 20 ); 163 // add_filter( 'block_editor_preload_paths', array( $this, 'initial_post_content' ), 10, 2 ); 164 165 add_action( 'init', array( $this, 'block_editor_init' ) ); 166 167 add_filter( 'wp_insert_post_data', array( $this, 'filter_post_content' ), 1 ); 146 168 } 147 169 … … 174 196 175 197 if ( ! $this->disabled_for_editor && ! $editor_style_added ) { 176 if ( $this->check_admin_setting( 'importcss' ) && $this->has_editor_style() !== 'present') {198 if ( $this->check_admin_setting( 'importcss' ) && $this->has_editor_style() === false ) { 177 199 add_editor_style(); 178 200 } … … 190 212 private function has_editor_style() { 191 213 if ( ! current_theme_supports( 'editor-style' ) ) { 192 return 'not-supporetd';214 return false; 193 215 } 194 216 … … 198 220 foreach ( $editor_stylesheets as $url ) { 199 221 if ( strpos( $url, 'editor-style.css' ) !== false ) { 200 return 'present';222 return $url; 201 223 } 202 224 } 203 225 } 204 226 205 return ' not-present';227 return ''; 206 228 } 207 229 … … 258 280 $this->admin_options = ! empty( $this->admin_settings['options'] ) ? explode( ',', $this->admin_settings['options'] ) : array(); 259 281 282 $default_user_settings = $this->get_default_user_settings(); 283 260 284 if ( $this->user_settings === false ) { 261 $this->user_settings = $this->get_default_user_settings(); 285 $this->user_settings = $default_user_settings; 286 } 287 288 if ( empty( $this->user_settings['toolbar_1'] ) ) { 289 $this->user_settings['toolbar_1'] = $default_user_settings['toolbar_1']; 290 } 291 292 if ( empty( $this->user_settings['toolbar_classic_block'] ) ) { 293 $this->user_settings['toolbar_classic_block'] = $default_user_settings['toolbar_classic_block']; 262 294 } 263 295 … … 268 300 $this->toolbar_3 = ! empty( $this->user_settings['toolbar_3'] ) ? explode( ',', $this->user_settings['toolbar_3'] ) : array(); 269 301 $this->toolbar_4 = ! empty( $this->user_settings['toolbar_4'] ) ? explode( ',', $this->user_settings['toolbar_4'] ) : array(); 270 271 $this->used_buttons = array_merge( $this->toolbar_1, $this->toolbar_2, $this->toolbar_3, $this->toolbar_4 ); 302 $this->toolbar_classic_block = ! empty( $this->user_settings['toolbar_classic_block'] ) ? explode( ',', $this->user_settings['toolbar_classic_block'] ) : array(); 303 304 $this->used_buttons = array_merge( $this->toolbar_1, $this->toolbar_2, $this->toolbar_3, $this->toolbar_4, $this->toolbar_classic_block ); 272 305 $this->get_all_buttons(); 273 306 … … 400 433 'backcolor' => 'Background color', 401 434 402 // Layer plugin ?403 // 'insertlayer' => 'Layer',404 405 435 // WP 406 436 'wp_adv' => 'Toolbar Toggle', … … 513 543 } 514 544 515 $buttons_1 = $this->toolbar_1; 545 if ( $editor_id === 'classic-block' ) { 546 $buttons_1 = $this->toolbar_classic_block; 547 } else { 548 $buttons_1 = $this->toolbar_1; 549 } 516 550 517 551 if ( is_array( $original ) && ! empty( $original ) ) { … … 523 557 } 524 558 525 public function mce_buttons_2( $original ) {559 public function mce_buttons_2( $original, $editor_id ) { 526 560 if ( $this->is_disabled() ) { 527 561 return $original; … … 532 566 } 533 567 534 $buttons_2 = $this->toolbar_2; 568 if ( $editor_id === 'classic-block' ) { 569 $buttons_2 = array(); 570 } else { 571 $buttons_2 = $this->toolbar_2; 572 } 535 573 536 574 if ( is_array( $original ) && ! empty( $original ) ) { … … 542 580 } 543 581 544 public function mce_buttons_3( $original ) {582 public function mce_buttons_3( $original, $editor_id ) { 545 583 if ( $this->is_disabled() ) { 546 584 return $original; … … 551 589 } 552 590 553 $buttons_3 = $this->toolbar_3; 591 if ( $editor_id === 'classic-block' ) { 592 $buttons_3 = array(); 593 } else { 594 $buttons_3 = $this->toolbar_3; 595 } 554 596 555 597 if ( is_array( $original ) && ! empty( $original ) ) { … … 561 603 } 562 604 563 public function mce_buttons_4( $original ) {605 public function mce_buttons_4( $original, $editor_id ) { 564 606 if ( $this->is_disabled() ) { 565 607 return $original; … … 570 612 } 571 613 572 $buttons_4 = $this->toolbar_4; 614 if ( $editor_id === 'classic-block' ) { 615 $buttons_4 = array(); 616 } else { 617 $buttons_4 = $this->toolbar_4; 618 } 573 619 574 620 if ( is_array( $original ) && ! empty( $original ) ) { … … 580 626 } 581 627 582 public function mce_options( $init ) {628 public function mce_options( $init, $editor_id = '' ) { 583 629 if ( $this->is_disabled() ) { 584 630 return $init; … … 586 632 587 633 $init['image_advtab'] = true; 588 $init['rel_list'] = '[{text: "None", value: ""}, {text: "Nofollow", value: "nofollow "}]';634 $init['rel_list'] = '[{text: "None", value: ""}, {text: "Nofollow", value: "nofollow noreferrer"}]'; 589 635 590 636 if ( $this->check_admin_setting( 'no_autop' ) ) { … … 594 640 } 595 641 596 if ( $this->check_user_setting('menubar') ) { 597 $init['menubar'] = true; 642 if ( $editor_id === 'classic-block' ) { 643 if ( $this->check_user_setting('menubar_block') ) { 644 $init['menubar'] = true; 645 } 646 647 if ( 648 ! $this->check_user_setting( 'no_merge_toolbars' ) && 649 ! empty( $init['toolbar1'] ) && 650 is_string( $init['toolbar1'] ) 651 ) { 652 if ( ! empty( $init['toolbar2'] ) && is_string( $init['toolbar2'] ) ) { 653 $init['toolbar1'] = $init['toolbar1'] . ',' . $init['toolbar2']; 654 $init['toolbar2'] = ''; 655 } 656 if ( ! empty( $init['toolbar3'] ) && is_string( $init['toolbar3'] ) ) { 657 $init['toolbar1'] = $init['toolbar1'] . ',' . $init['toolbar3']; 658 $init['toolbar3'] = ''; 659 } 660 if ( ! empty( $init['toolbar4'] ) && is_string( $init['toolbar4'] ) ) { 661 $init['toolbar1'] = $init['toolbar1'] . ',' . $init['toolbar4']; 662 $init['toolbar4'] = ''; 663 } 664 } 665 } else { 666 if ( $this->check_user_setting('menubar') ) { 667 $init['menubar'] = true; 668 } 598 669 } 599 670 … … 603 674 604 675 if ( $this->check_admin_setting( 'importcss' ) ) { 605 // $init['importcss_selector_filter'] = 'function(sel){return /^\.[a-z0-9]+$/i.test(sel);}';606 676 $init['importcss_file_filter'] = 'editor-style.css'; 607 677 } … … 617 687 if ( in_array( 'table', $this->plugins, true ) ) { 618 688 $init['table_toolbar'] = false; 689 690 // Remove default table styles and attributes. They should be set by the theme. 691 // Note that if the table cells are resized by dragging, an inline style with the widths will still be added. 692 $init['table_default_attributes'] = '{}'; 693 $init['table_default_styles'] = '{}'; 619 694 } 620 695 … … 622 697 } 623 698 624 public function after_wp_tiny_mce() { 625 if ( $this->is_disabled() ) { 626 return; 627 } 628 629 ?> 630 <script> 631 !function(a,b){"undefined"!=typeof a&&"undefined"!=typeof b&&a(function(){b.addButton("sofbg-axcell","¶",function(b,c){ 632 var d=a(c),e=a.trim(d.val()),f="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|" + 633 "address|math|style|p|h[1-6]|hr|fieldset|legend|tmadv|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary"; 634 -1!==e.indexOf("</p>")&&-1===e.indexOf("\n\n")&&(e=e.replace(new RegExp("<(?:"+f+")(?: [^>]*)?>","gi"),"\n$&"), 635 e=e.replace(new RegExp("</(?:"+f+")>","gi"),"$&\n"),e=e.replace(/(<br(?: [^>]*)?>)[\r\n\t]*/gi,"$1\n"), 636 e=e.replace(/>\n[\r\n\t]+</g,">\n<"),e=e.replace(/^<li/gm," <li"),e=e.replace(/<td>\u00a0<\/td>/g,"<td> </td>"), 637 d.val(a.trim(e)))},"","","Fix line breaks")})}(window.jQuery,window.QTags); 638 </script> 639 <?php 640 } 641 642 public function htmledit( $content ) { 643 return $content; 699 public function block_editor_assets() { 700 $plugin_url = plugins_url( 'block-editor', __FILE__ ); 701 702 if ( ! $this->check_admin_setting( 'no_hybrid_mode' ) ) { 703 $dependencies = array( 'wp-element', 'wp-components', 'wp-i18n', 'wp-keycodes', 'wp-blocks', 'wp-hooks', 'lodash' ); 704 wp_enqueue_script( 'tadv-block-register', $plugin_url . '/block-register.js', $dependencies ); 705 706 wp_enqueue_style( 'tadv-classic-paragraph-styles', $plugin_url . '/classic-paragraph.css' ); 707 } 708 709 wp_enqueue_style( 'tadv-block-editor-styles', $plugin_url . '/block-editor.css' ); 710 } 711 712 public function initial_post_content( $paths, $post ) { 713 if ( $post->post_status === 'auto-draft' && empty( $post->post_content ) ) { 714 $post->post_content = '<p><br data-mce-bogus="1"></p>'; 715 } 716 717 return $paths; 718 } 719 720 public function block_editor_init() { 721 if ( $this->check_admin_setting( 'replace_block_editor' ) && ! class_exists( 'Classic_Editor' ) ) { 722 add_filter( 'use_block_editor_for_post_type', '__return_false', 1000 ); 723 } 724 } 725 726 public function filter_post_content( $data ) { 727 $content = $data['post_content']; 728 // Fix for the fix to keep <p> tags inside the classic block :-( 729 // $data is slashed... 730 if ( strpos( $content, '<p data-tadv-p=\"keep\">' ) !== false ) { 731 $content = str_replace( '<p data-tadv-p=\"keep\">', '<p>', $content ); 732 } 733 734 if ( ! $this->check_admin_setting( 'no_hybrid_mode' ) && strpos( $content, '<!-- wp:paragraph {\"tadvType\":\"classic\"} -->' ) !== false ) { 735 $content = preg_replace( '@<!-- wp:paragraph \{\\\"tadvType\\\":\\\"classic\\\"\} -->\s*([\s\S]+?)<!-- \/wp:paragraph -->\s*@', '$1', $content ); 736 } 737 738 $data['post_content'] = $content; 739 return $data; 644 740 } 645 741 … … 761 857 } 762 858 763 for ( $i = 1; $i < 5; $i++ ) {764 $toolbar_name = 'toolbar_' . $i;859 for ( $i = 1; $i < 6; $i++ ) { 860 $toolbar_name = ( $i < 5 ) ? 'toolbar_' . $i : 'toolbar_classic_block'; 765 861 766 862 if ( ! empty( $user_settings[ $toolbar_name ] ) ) { … … 772 868 } 773 869 774 if ( $i > 1 && ( $wp_adv = array_search( 'wp_adv', $toolbar ) ) !== false) {775 unset( $toolbar[ $wp_adv ]);870 if ( $i > 1 && in_array( 'wp_adv', $toolbar, true ) ) { 871 $toolbar = array_diff( $toolbar, array( 'wp_adv' ) ); 776 872 } 777 873 … … 782 878 $options = explode( ',', $user_settings['options'] ); 783 879 } elseif ( ! empty( $_POST['options'] ) && is_array( $_POST['options'] ) ) { 784 $options = $_POST['options']; 880 $options_raw = $_POST['options']; 881 // Negate 882 if ( in_array( 'no_merge_toolbars', $options_raw, true ) ) { 883 $options_raw = array_diff( $options_raw, array( 'no_merge_toolbars' ) ); 884 } else { 885 $options_raw[] = 'no_merge_toolbars'; 886 } 887 888 $options = $options_raw; 785 889 } else { 786 890 $options = array(); … … 791 895 if ( ! empty( $user_settings['plugins'] ) ) { 792 896 $plugins = explode( ',', $user_settings['plugins'] ); 793 } elseif ( ! empty( $_POST['options']['menubar'] ) ) {794 $plugins = array( 'anchor', 'code', 'insertdatetime', 'nonbreaking', 'print', 'searchreplace', 'table', 'visualblocks', 'visualchars' );795 897 } else { 796 898 $plugins = array(); 899 } 900 901 if ( ! empty( $settings['options']['menubar'] ) || ! empty( $settings['options']['menubar_block'] ) ) { 902 $plugins = array_merge( $plugins, $this->required_menubar_plugins ); 797 903 } 798 904 … … 832 938 } elseif ( isset( $_POST['tadv-save'] ) ) { 833 939 if ( ! empty( $_POST['admin_options'] ) && is_array( $_POST['admin_options'] ) ) { 834 $save_admin_settings['options'] = $this->validate_settings( $_POST['admin_options'], $this->get_all_admin_options() ); 940 $admin_options = $_POST['admin_options']; 941 // Negate 942 if ( in_array( 'no_hybrid_mode', $admin_options, true ) ) { 943 $admin_options = array_diff( $admin_options, array( 'no_hybrid_mode' ) ); 944 } else { 945 $admin_options[] = 'no_hybrid_mode'; 946 } 947 948 $save_admin_settings['options'] = $this->validate_settings( $admin_options, $this->get_all_admin_options() ); 835 949 } 836 950
Note: See TracChangeset
for help on using the changeset viewer.