TinyMCE Advanced - Version 4.8.1

Version Description

  • Updated for WordPress 5.0.
  • Added Hybrid Mode for the Block Editor. Includes a Classic Paragraph Block that replaces the default Paragraph Block.
  • Added option to replace the Block Editor with the Classic Editor.
  • Added another settings section for configuring the toolbars in the Classic Block and the Classic Paragraph Block.
  • Added some CSS fixed for the Classic Block.
  • 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.
Download this release

Release Info

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

Code changes from version 4.8.0 to 4.8.1

block-editor/block-editor.css ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Fixes for the Block Editor */
2
+
3
+ .block-library-classic__toolbar .mce-menubar {
4
+ height: 2.8em !important;
5
+ }
6
+
7
+ .block-library-classic__toolbar .mce-btn .mce-txt {
8
+ font-size: 14px;
9
+ }
10
+
11
+ .block-library-classic__toolbar .mce-menubar > .mce-container-body {
12
+ padding-top: 0.5em;
13
+ }
14
+
15
+ .block-library-classic__toolbar .mce-menubar i.mce-caret {
16
+ margin-top: 0.4em;
17
+ }
18
+
19
+ .editor-block-list__block[data-type="core/freeform"] .block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-toolbar {
20
+ padding: 0;
21
+ }
22
+
23
+ /* Classic Block styling regressions fixes */
24
+ .wp-block-freeform.block-library-rich-text__tinymce {
25
+ padding: 6px; /* For wpview outlines and image resize handles. */
26
+ }
27
+
28
+ /* Remove blue highlighting of selected images in WebKit */
29
+ .wp-block-freeform.block-library-rich-text__tinymce img[data-mce-selected]::selection {
30
+ background-color: transparent;
31
+ }
32
+ /* Image resize handles */
33
+ .wp-block-freeform.block-library-rich-text__tinymce .mce-content-body div.mce-resizehandle {
34
+ border-color: #191e23;
35
+ width: 6px;
36
+ height: 6px;
37
+ }
38
+
39
+ .wp-block-freeform.block-library-rich-text__tinymce .mce-content-body img[data-mce-selected] {
40
+ outline: 1px solid #191e23;
41
+ }
42
+
43
+ .wp-block-freeform.block-library-rich-text__tinymce .mce-content-body img[data-mce-resize="false"] {
44
+ outline: 0;
45
+ }
46
+
47
+ /* Image captions */
48
+ .wp-block-freeform.block-library-rich-text__tinymce .wp-caption {
49
+ margin: 0; /* browser reset */
50
+ max-width: 100%;
51
+ }
52
+
53
+ .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption dt.wp-caption-dt img {
54
+ display: inline-block;
55
+ margin-bottom: -1ex;
56
+ }
57
+
58
+ .wp-block-freeform.block-library-rich-text__tinymce div.mceTemp {
59
+ -ms-user-select: element;
60
+ }
61
+
62
+ .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,
63
+ .wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * {
64
+ -webkit-user-drag: none;
65
+ }
66
+
67
+ .wp-block-freeform.block-library-rich-text__tinymce .wp-caption-dd {
68
+ padding-top: 0.5em;
69
+ margin: 0; /* browser reset */
70
+ }
71
+
72
+ /* WP Views */
73
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview {
74
+ width: 99.99%; /* All IE need hasLayout, incl. 11 (ugh, not again!!) */
75
+ position: relative;
76
+ clear: both;
77
+ margin-bottom: 16px;
78
+ border: 1px solid transparent;
79
+ }
80
+
81
+ .wp-block-freeform.block-library-rich-text__tinymce .mce-shim {
82
+ position: absolute;
83
+ top: 0;
84
+ right: 0;
85
+ bottom: 0;
86
+ left: 0;
87
+ }
88
+
89
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim {
90
+ display: none;
91
+ }
92
+
93
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder {
94
+ border: 1px dashed $light-gray-400;
95
+ padding: 10px;
96
+ }
97
+
98
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder {
99
+ border-color: transparent;
100
+ }
101
+
102
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-content > iframe {
103
+ max-width: 100%;
104
+ background: transparent;
105
+ }
106
+
107
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview-error {
108
+ border: 1px solid $light-gray-400;
109
+ padding: 1em 0;
110
+ margin: 0;
111
+ word-wrap: break-word;
112
+ }
113
+
114
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error {
115
+ border-color: transparent;
116
+ }
117
+
118
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview-error .dashicons,
119
+ .wp-block-freeform.block-library-rich-text__tinymce .loading-placeholder .dashicons {
120
+ display: block;
121
+ margin: 0 auto;
122
+ width: 32px;
123
+ height: 32px;
124
+ font-size: 32px;
125
+ }
126
+
127
+ .wp-block-freeform.block-library-rich-text__tinymce .wpview-error p {
128
+ margin: 0;
129
+ text-align: center;
130
+ }
131
+
132
+ /* Toolbars (some get appended to <body>) */
133
+ div.mce-toolbar-grp .mce-btn:hover button,
134
+ div.mce-toolbar-grp .mce-btn:hover i,
135
+ div.mce-inline-toolbar-grp .mce-btn:hover button,
136
+ div.mce-inline-toolbar-grp .mce-btn:hover i,
137
+ div.mce-inline-toolbar-grp .mce-btn.mce-active button,
138
+ div.mce-inline-toolbar-grp .mce-btn.mce-active:hover button,
139
+ div.mce-inline-toolbar-grp .mce-btn.mce-active i,
140
+ div.mce-inline-toolbar-grp .mce-btn.mce-active:hover i {
141
+ color: #191e23;
142
+ }
143
+
144
+ div.mce-toolbar-grp .mce-btn i,
145
+ div.mce-inline-toolbar-grp .mce-btn i {
146
+ font-style: normal;
147
+ }
148
+
149
+ div.mce-widget.mce-tooltip .mce-tooltip-inner {
150
+ font-size: 13px;
151
+ opacity: 1;
152
+ }
153
+
154
+ /* Menu */
155
+ div.mce-menu .mce-menu-item:hover,
156
+ div.mce-menu .mce-menu-item.mce-selected,
157
+ div.mce-menu .mce-menu-item:focus,
158
+ div.mce-menu .mce-menu-item-normal.mce-active,
159
+ div.mce-menu .mce-menu-item-preview.mce-active {
160
+ background: #0073aa; /* See color scheme. */
161
+ color: #fff;
162
+ }
163
+
164
+ div.mce-menu-item:hover .mce-text,
165
+ div.mce-menu-item:focus .mce-text,
166
+ div.mce-menu-item:hover .mce-ico,
167
+ div.mce-menu-item:focus .mce-ico,
168
+ div.mce-menu-item:hover .mce-menu-shortcut,
169
+ div.mce-menu-item:focus .mce-menu-shortcut,
170
+ div.mce-menu-item.mce-active .mce-menu-shortcut,
171
+ div.mce-menu-item.mce-disabled:hover .mce-text,
172
+ div.mce-menu-item.mce-disabled:hover .mce-ico {
173
+ color: inherit;
174
+ }
175
+
176
+ div.mce-menu .mce-menu-item.mce-disabled {
177
+ cursor: default;
178
+ }
179
+
180
+ div.mce-menu .mce-menu-item.mce-disabled:hover {
181
+ background: #ccc;
182
+ }
183
+
184
+ /* Menubar */
185
+ div.mce-menubar {
186
+ border-color: #e5e5e5;
187
+ background: #fff;
188
+ border-width: 0px 0px 1px;
189
+ }
190
+
191
+ div.mce-menubar .mce-menubtn:hover,
192
+ div.mce-menubar .mce-menubtn.mce-active,
193
+ div.mce-menubar .mce-menubtn:focus {
194
+ border-color: transparent;
195
+ background: transparent;
196
+ }
197
+
198
+ div.mce-menubar .mce-menubtn:focus {
199
+ color: #124964;
200
+ box-shadow:
201
+ 0 0 0 1px #5b9dd9,
202
+ 0 0 2px 1px rgba(30, 140, 190, .8);
203
+ }
204
+
205
+ div.mce-menu .mce-menu-item-sep,
206
+ div.mce-menu-item-sep:hover {
207
+ border-bottom: 1px solid #ddd;
208
+ height: 0px;
209
+ margin: 5px 0;
210
+ }
211
+
212
+ div.mce-menubtn span {
213
+ margin-right: 0;
214
+ padding-left: 3px;
215
+ }
216
+
217
+ div.mce-menu-has-icons i.mce-ico:before {
218
+ margin-left: 0;
219
+ }
220
+
221
+ div.mce-menu-has-icons i.mce-ico {
222
+ line-height: 16px;
223
+ }
224
+
225
+ .block-library-classic__toolbar .mce-menubar .mce-menubtn:hover,
226
+ .block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active,
227
+ .block-library-classic__toolbar .mce-menubar .mce-menubtn:focus {
228
+ border-color: transparent;
229
+ background: transparent;
230
+ }
231
+
232
+ .wp-block-freeform.block-library-rich-text__tinymce p {
233
+ margin: 1em 0;
234
+ }
235
+
236
+ .mce-content-body img[data-mce-selected],
237
+ .mce-content-body hr[data-mce-selected] {
238
+ outline: 1px solid black;
239
+ resize: none;
240
+ }
241
+
242
+ /* Increase editor width a bit... */
243
+ @media (min-width: 600px) {
244
+ .edit-post-layout.is-sidebar-opened .editor-post-title,
245
+ .edit-post-layout.is-sidebar-opened .editor-block-list__layout {
246
+ padding-left: 0;
247
+ padding-right: 0;
248
+ }
249
+
250
+ .edit-post-layout .editor-styles-wrapper .wp-block {
251
+ min-width: 640px;
252
+ margin-left: auto;
253
+ margin-right: auto;
254
+ }
255
+
256
+ .edit-post-layout.is-sidebar-opened .editor-styles-wrapper .wp-block {
257
+ min-width: 520px;
258
+ }
259
+ }
260
+
261
+ /* Fix regression in toolbar buttons :-( */
262
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i {
263
+ font-family: tinymce !important;
264
+ }
265
+
266
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-bold,
267
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-italic,
268
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-bullist,
269
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-numlist,
270
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-blockquote,
271
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignleft,
272
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-aligncenter,
273
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignright,
274
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-link,
275
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-unlink,
276
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_more,
277
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-strikethrough,
278
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-spellchecker,
279
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-fullscreen,
280
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_fullscreen,
281
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-dfw,
282
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_adv,
283
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-underline,
284
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignjustify,
285
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-forecolor,
286
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-backcolor,
287
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-pastetext,
288
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-pasteword,
289
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-removeformat,
290
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-charmap,
291
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-outdent,
292
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-indent,
293
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-undo,
294
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-redo,
295
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-help,
296
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_help,
297
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp-media-library,
298
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-ltr,
299
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_page,
300
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-hr,
301
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_code,
302
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-dashicon,
303
+ .editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-remove {
304
+ font-family: dashicons !important;
305
+ }
306
+
307
+ /* Editor content */
308
+ .wp-block-freeform.block-library-rich-text__tinymce table {
309
+ width: 100%;
310
+ }
block-editor/block-register.js ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( wp, _ ) {
2
+ if ( ! wp ) {
3
+ return;
4
+ }
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ const { RawHTML, Component, createElement } = wp.element;
10
+ const { __, _x } = wp.i18n;
11
+ const { Path, Rect, SVG } = wp.components;
12
+ const { BACKSPACE, DELETE, F10 } = wp.keycodes;
13
+ const { addFilter } = wp.hooks;
14
+ const { registerBlockType, setDefaultBlockName } = wp.blocks;
15
+
16
+ addFilter( 'blocks.registerBlockType', 'tadv-reregister-block', function ( settings, name ) {
17
+ if ( name === 'core/paragraph' ) {
18
+ settings = settingsParagraph;
19
+ } else if ( name === 'core/freeform' ) {
20
+ settings = settingsClassic;
21
+ } else if ( name === 'core/video' ) {
22
+ // Ughhhhh :-(
23
+ setTimeout( function() {
24
+ setDefaultBlockName( 'core/freeform' );
25
+ }, 0 );
26
+ }
27
+
28
+ return settings;
29
+ } );
30
+
31
+ function isTmceEmpty( editor ) {
32
+ const body = editor.getBody();
33
+
34
+ if ( body.childNodes.length > 1 ) {
35
+ return false;
36
+ } else if ( body.childNodes.length === 0 ) {
37
+ return true;
38
+ }
39
+
40
+ if ( body.childNodes[ 0 ].childNodes.length > 1 ) {
41
+ return false;
42
+ }
43
+
44
+ return /^\n?$/.test( body.innerText || body.textContent );
45
+ }
46
+
47
+ class ClassicEdit extends Component {
48
+ constructor( props ) {
49
+ super( props );
50
+ this.initialize = this.initialize.bind( this );
51
+ this.onSetup = this.onSetup.bind( this );
52
+ this.focus = this.focus.bind( this );
53
+ }
54
+
55
+ componentDidMount() {
56
+ const { baseURL, suffix } = window.wpEditorL10n.tinymce;
57
+
58
+ window.tinymce.EditorManager.overrideDefaults( {
59
+ base_url: baseURL,
60
+ suffix,
61
+ } );
62
+
63
+ if ( document.readyState === 'complete' ) {
64
+ this.initialize();
65
+ } else {
66
+ window.addEventListener( 'DOMContentLoaded', this.initialize );
67
+ }
68
+ }
69
+
70
+ componentWillUnmount() {
71
+ window.addEventListener( 'DOMContentLoaded', this.initialize );
72
+ wp.oldEditor.remove( `editor-${ this.props.clientId }` );
73
+ }
74
+
75
+ componentDidUpdate( prevProps ) {
76
+ const { clientId, attributes: { content } } = this.props;
77
+
78
+ const editor = window.tinymce.get( `editor-${ clientId }` );
79
+
80
+ if ( prevProps.attributes.content !== content && this.content !== content ) {
81
+ editor.setContent( content || '' );
82
+ }
83
+ }
84
+
85
+ initialize() {
86
+ const { clientId, setAttributes } = this.props;
87
+ const { settings } = window.wpEditorL10n.tinymce;
88
+ wp.oldEditor.initialize( `editor-${ clientId }`, {
89
+ tinymce: {
90
+ ...settings,
91
+ inline: true,
92
+ content_css: false,
93
+ fixed_toolbar_container: `#toolbar-${ clientId }`,
94
+ setup: this.onSetup,
95
+ },
96
+ } );
97
+
98
+ setAttributes( {
99
+ tadvType: 'classic',
100
+ } );
101
+ }
102
+
103
+ onSetup( editor ) {
104
+ const { attributes: { content }, setAttributes } = this.props;
105
+ const { ref } = this;
106
+ let bookmark;
107
+
108
+ this.editor = editor;
109
+
110
+ if ( content ) {
111
+ editor.on( 'loadContent', () => editor.setContent( content ) );
112
+ }
113
+
114
+ editor.on( 'blur', () => {
115
+ bookmark = editor.selection.getBookmark( 2, true );
116
+ this.content = editor.getContent();
117
+
118
+ setAttributes( {
119
+ content: this.content,
120
+ } );
121
+
122
+ editor.once( 'focus', () => {
123
+ if ( bookmark ) {
124
+ editor.selection.moveToBookmark( bookmark );
125
+ }
126
+ } );
127
+
128
+ return false;
129
+ } );
130
+
131
+ editor.on( 'mousedown touchstart', () => {
132
+ bookmark = null;
133
+ } );
134
+
135
+ editor.on( 'keydown', ( event ) => {
136
+ if ( ( event.keyCode === BACKSPACE || event.keyCode === DELETE ) && isTmceEmpty( editor ) ) {
137
+ // delete the block
138
+ this.props.onReplace( [] );
139
+ event.preventDefault();
140
+ event.stopImmediatePropagation();
141
+ }
142
+
143
+ const { altKey } = event;
144
+ /*
145
+ * Prevent Mousetrap from kicking in: TinyMCE already uses its own
146
+ * `alt+f10` shortcut to focus its toolbar.
147
+ */
148
+ if ( altKey && event.keyCode === F10 ) {
149
+ event.stopPropagation();
150
+ }
151
+ } );
152
+
153
+ editor.on( 'init', () => {
154
+ const rootNode = this.editor.getBody();
155
+
156
+ // Create the toolbar by refocussing the editor.
157
+ if ( document.activeElement === rootNode ) {
158
+ rootNode.blur();
159
+ this.editor.focus();
160
+ }
161
+ } );
162
+ }
163
+
164
+ focus() {
165
+ if ( this.editor ) {
166
+ this.editor.focus();
167
+ }
168
+ }
169
+
170
+ onToolbarKeyDown( event ) {
171
+ // Prevent WritingFlow from kicking in and allow arrows navigation on the toolbar.
172
+ event.stopPropagation();
173
+ // Prevent Mousetrap from moving focus to the top toolbar when pressing `alt+f10` on this block toolbar.
174
+ event.nativeEvent.stopImmediatePropagation();
175
+ }
176
+
177
+ render() {
178
+ const { clientId } = this.props;
179
+
180
+ return [
181
+ createElement( 'div', {
182
+ key: "toolbar",
183
+ id: `toolbar-${ clientId }`,
184
+ ref: ( ref ) => this.ref = ref,
185
+ className: "block-library-classic__toolbar",
186
+ onClick: this.focus,
187
+ 'data-placeholder': __( 'Classic' ),
188
+ onKeyDown: this.onToolbarKeyDown,
189
+ } ),
190
+ createElement( 'div', {
191
+ key: "editor",
192
+ id: `editor-${ clientId }`,
193
+ className: "wp-block-freeform block-library-rich-text__tinymce",
194
+ } ),
195
+ ];
196
+ }
197
+ }
198
+
199
+ const settings = {
200
+ keywords: [ __( 'text' ) ],
201
+
202
+ description: __( 'Use the classic WordPress editor.' ),
203
+
204
+ icon: createElement( SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
205
+ createElement( Path, { d: "M0,0h24v24H0V0z M0,0h24v24H0V0z", fill: "none" } ),
206
+ createElement( Path, { d: "m20 7v10h-16v-10h16m0-2h-16c-1.1 0-1.99 0.9-1.99 2l-0.01 10c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2v-10c0-1.1-0.9-2-2-2z" } ),
207
+ createElement( Rect, { x: "11", y: "8", width: "2", height: "2" } ),
208
+ createElement( Rect, { x: "11", y: "11", width: "2", height: "2" } ),
209
+ createElement( Rect, { x: "8", y: "8", width: "2", height: "2" } ),
210
+ createElement( Rect, { x: "8", y: "11", width: "2", height: "2" } ),
211
+ createElement( Rect, { x: "5", y: "11", width: "2", height: "2" } ),
212
+ createElement( Rect, { x: "5", y: "8", width: "2", height: "2" } ),
213
+ createElement( Rect, { x: "8", y: "14", width: "8", height: "2" } ),
214
+ createElement( Rect, { x: "14", y: "11", width: "2", height: "2" } ),
215
+ createElement( Rect, { x: "14", y: "8", width: "2", height: "2" } ),
216
+ createElement( Rect, { x: "17", y: "11", width: "2", height: "2" } ),
217
+ createElement( Rect, { x: "17", y: "8", width: "2", height: "2" } )
218
+ ),
219
+
220
+ attributes: {
221
+ content: {
222
+ type: 'string',
223
+ source: 'html',
224
+ },
225
+ tadvType: {
226
+ type: 'string',
227
+ default: '',
228
+ },
229
+ },
230
+
231
+ supports: {
232
+ className: false,
233
+ customClassName: false,
234
+ reusable: false,
235
+ },
236
+
237
+ merge( attributes, attributesToMerge ) {
238
+ return {
239
+ content: attributes.content + attributesToMerge.content,
240
+ };
241
+ },
242
+
243
+ transforms: {
244
+ from: [
245
+ {
246
+ type: 'raw',
247
+ priority: 15,
248
+ selector: '*',
249
+ },
250
+ ],
251
+ to: [
252
+ {
253
+ type: 'raw',
254
+ blocks: [ 'core/freeform' ],
255
+ transform: ( { content } ) => {
256
+ return createBlock( 'core/freeform', {
257
+ content,
258
+ } );
259
+ },
260
+ },
261
+ ],
262
+ },
263
+
264
+ edit: ClassicEdit,
265
+
266
+ save( { attributes } ) {
267
+ const { content } = attributes;
268
+
269
+ return createElement( RawHTML, null, content );
270
+ },
271
+ };
272
+
273
+ const settingsClassic = _.assign( {}, settings, {
274
+ title: _x( 'Classic', 'block title' ),
275
+ name: 'core/freeform',
276
+ category: 'formatting',
277
+ } );
278
+
279
+ const settingsParagraph = _.assign( {}, settings, {
280
+ title: __( 'Classic Paragraph' ),
281
+ name: 'core/paragraph',
282
+ category: 'common',
283
+ } );
284
+
285
+ // registerBlockType( 'core/paragraph', settingsParagraph );
286
+ // registerBlockType( 'core/freeform', settingsClassic );
287
+
288
+ } )( window.wp, window.lodash );
block-editor/classic-paragraph.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tweaks for "Classic Paragraph" */
2
+
3
+ /* Toolbar */
4
+ .editor-block-list__block[data-type="core/paragraph"] .editor-block-contextual-toolbar .editor-block-switcher {
5
+ display: none;
6
+ }
7
+
8
+ @media (min-width: 600px) {
9
+ .editor-block-list__block[data-type="core/paragraph"] .editor-block-contextual-toolbar {
10
+ float: right;
11
+ margin-right: 23px;
12
+ transform: translateY(-13px);
13
+ top: 14px;
14
+ }
15
+
16
+ .editor-block-list__block[data-type="core/paragraph"] .editor-block-contextual-toolbar .components-toolbar {
17
+ background: transparent;
18
+ border: none;
19
+ }
20
+
21
+ .editor-block-list__block[data-type="core/paragraph"] .editor-block-contextual-toolbar .editor-block-toolbar {
22
+ margin-top: 0;
23
+ border: none;
24
+ }
25
+
26
+ .editor-block-list__block[data-type="core/paragraph"] .editor-block-contextual-toolbar .editor-block-toolbar::before {
27
+ content: "";
28
+ display: block;
29
+ border-left: 1px solid #e2e4e7;
30
+ margin-top: 4px;
31
+ margin-bottom: 4px;
32
+ }
33
+ }
css/tadv-styles.css CHANGED
@@ -4,6 +4,27 @@
4
  *
5
  * Copyright (c) 2007-2016 Andrew Ozz. All rights reserved.
6
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  .tadv-more-plugins label {
9
  font-weight: bold;
@@ -15,9 +36,7 @@
15
  }
16
 
17
  .advanced-options {
18
- margin: 20px 0;
19
- border: 1px solid #ccc;
20
- padding: 0 15px;
21
  }
22
 
23
  .advanced-options div {
@@ -29,6 +48,10 @@
29
  margin-top: 5px;
30
  }
31
 
 
 
 
 
32
  .advanced-options h3 {
33
  margin-top: 15px;
34
  }
@@ -69,7 +92,7 @@
69
  }
70
 
71
  ul.container,
72
- #unused {
73
  position: relative;
74
  }
75
 
@@ -104,7 +127,7 @@ ul.container,
104
  background: #ddd;
105
  }
106
 
107
- #tadv-mce-menu {
108
  margin-bottom: 0;
109
  background: #fff;
110
  border: 1px solid #ccc;
@@ -113,26 +136,26 @@ ul.container,
113
  filter: alpha(opacity=40);
114
  }
115
 
116
- #tadv-mce-menu.enabled {
117
  opacity: 1;
118
  filter: alpha(opacity=100);
119
  }
120
 
121
- #tadv-mce-menu.mce-menubar .mce-menubtn:hover {
122
  background: transparent;
123
  }
124
 
125
- #tadv-mce-menu .mce-btn .mce-caret {
126
  margin-top: 9px;
127
  margin-left: 1px;
128
  }
129
 
130
- #tadv-mce-menu * {
131
  cursor: default;
132
  }
133
 
134
  #tadvzones,
135
- #unused {
136
  -webkit-user-select: none;
137
  -moz-user-select: none;
138
  -ms-user-select: none;
@@ -147,10 +170,6 @@ ul.container,
147
  float: right;
148
  }
149
 
150
- #tadvzones {
151
- margin: 25px 280px 0 0;
152
- }
153
-
154
  .tadvdropzone {
155
  padding: 2px 4px;
156
  margin: 0 0 10px;
@@ -158,9 +177,10 @@ ul.container,
158
  border: 1px solid #bbb;
159
  }
160
 
161
- #unuseddiv.highlighted,
162
  .tadvdropzone.highlighted {
163
- background-color: #efefe9;
 
164
  border-color: #aaa;
165
  }
166
 
@@ -209,16 +229,17 @@ ul.container,
209
  line-height: 1;
210
  }
211
 
212
- #unuseddiv {
213
  padding: 10px;
214
  border: 1px solid #ccc;
215
  }
216
 
217
- #unuseddiv h3 {
218
  margin: 5px 5px 12px;
 
219
  }
220
 
221
- #unused li,
222
  .tadvdropzone li {
223
  margin: 0;
224
  padding: 0;
@@ -228,18 +249,18 @@ ul.container,
228
  vertical-align: top;
229
  }
230
 
231
- #unused li {
232
  margin: 4px;
233
  }
234
 
235
- #unused {
236
  margin: 0;
237
  min-height: 36px;
238
  }
239
 
240
- #unused .tadvmodule .tadvitem {
241
  display: block;
242
- height: 22px;
243
  width: 140px;
244
  border: 1px solid #bbb;
245
  background-color: #fff;
@@ -254,13 +275,13 @@ ul.container,
254
  box-shadow: none;
255
  }
256
 
257
- #unused .tadvmodule .descr {
258
  display: inline;
259
  font-size: 12px;
260
  line-height: 22px;
261
  }
262
 
263
- #unused .tadvmodule .the-button .descr {
264
  padding: 0 4px;
265
  font-size: 13px;
266
  }
@@ -301,5 +322,16 @@ div.tadv-error {
301
 
302
  .tadv-error {
303
  color: #d54e21;
304
- font-weight: bold;
 
 
 
 
 
 
 
 
 
 
 
305
  }
4
  *
5
  * Copyright (c) 2007-2016 Andrew Ozz. All rights reserved.
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
+ }
28
 
29
  .tadv-more-plugins label {
30
  font-weight: bold;
36
  }
37
 
38
  .advanced-options {
39
+ margin: 40px 0;
 
 
40
  }
41
 
42
  .advanced-options div {
48
  margin-top: 5px;
49
  }
50
 
51
+ .advanced-options .tadv-help {
52
+ margin: 1em 0;
53
+ }
54
+
55
  .advanced-options h3 {
56
  margin-top: 15px;
57
  }
92
  }
93
 
94
  ul.container,
95
+ .unused {
96
  position: relative;
97
  }
98
 
127
  background: #ddd;
128
  }
129
 
130
+ .tadv-mce-menu.mce-menubar {
131
  margin-bottom: 0;
132
  background: #fff;
133
  border: 1px solid #ccc;
136
  filter: alpha(opacity=40);
137
  }
138
 
139
+ .tadv-mce-menu.enabled {
140
  opacity: 1;
141
  filter: alpha(opacity=100);
142
  }
143
 
144
+ .tadv-mce-menu.mce-menubar .mce-menubtn:hover {
145
  background: transparent;
146
  }
147
 
148
+ .tadv-mce-menu .mce-btn .mce-caret {
149
  margin-top: 9px;
150
  margin-left: 1px;
151
  }
152
 
153
+ .tadv-mce-menu * {
154
  cursor: default;
155
  }
156
 
157
  #tadvzones,
158
+ .unused {
159
  -webkit-user-select: none;
160
  -moz-user-select: none;
161
  -ms-user-select: none;
170
  float: right;
171
  }
172
 
 
 
 
 
173
  .tadvdropzone {
174
  padding: 2px 4px;
175
  margin: 0 0 10px;
177
  border: 1px solid #bbb;
178
  }
179
 
180
+ .unuseddiv .highlighted,
181
  .tadvdropzone.highlighted {
182
+ background-color: #e4f2fd;
183
+ color: #000;
184
  border-color: #aaa;
185
  }
186
 
229
  line-height: 1;
230
  }
231
 
232
+ .unuseddiv {
233
  padding: 10px;
234
  border: 1px solid #ccc;
235
  }
236
 
237
+ .unuseddiv h4 {
238
  margin: 5px 5px 12px;
239
+ font-size: 1.2em;
240
  }
241
 
242
+ .unused li,
243
  .tadvdropzone li {
244
  margin: 0;
245
  padding: 0;
249
  vertical-align: top;
250
  }
251
 
252
+ .unused li {
253
  margin: 4px;
254
  }
255
 
256
+ .unused {
257
  margin: 0;
258
  min-height: 36px;
259
  }
260
 
261
+ .unused .tadvmodule .tadvitem {
262
  display: block;
263
+ height: 24px;
264
  width: 140px;
265
  border: 1px solid #bbb;
266
  background-color: #fff;
275
  box-shadow: none;
276
  }
277
 
278
+ .unused .tadvmodule .descr {
279
  display: inline;
280
  font-size: 12px;
281
  line-height: 22px;
282
  }
283
 
284
+ .unused .tadvmodule .the-button .descr {
285
  padding: 0 4px;
286
  font-size: 13px;
287
  }
322
 
323
  .tadv-error {
324
  color: #d54e21;
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
  }
js/tadv.js CHANGED
@@ -33,8 +33,37 @@ jQuery( document ).ready( function( $ ) {
33
  containment: 'document'
34
  });
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  $( '#menubar' ).on( 'change', function() {
37
- $( '#tadv-mce-menu' ).toggleClass( 'enabled', $(this).prop('checked') );
 
 
 
 
38
  });
39
 
40
  $( '#tadvadmins' ).on( 'submit', function() {
@@ -85,7 +114,7 @@ jQuery( document ).ready( function( $ ) {
85
  }
86
  });
87
 
88
- $( '#tadv-mce-menu .tadv-translate' ).each( function( i, element ) {
89
  var $element = $( element ),
90
  text = $element.text();
91
 
33
  containment: 'document'
34
  });
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
+
61
  $( '#menubar' ).on( 'change', function() {
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') );
67
  });
68
 
69
  $( '#tadvadmins' ).on( 'submit', function() {
114
  }
115
  });
116
 
117
+ $( '.tadv-mce-menu .tadv-translate' ).each( function( i, element ) {
118
  var $element = $( element ),
119
  text = $element.text();
120
 
mce/importcss/plugin.js CHANGED
@@ -74,7 +74,37 @@ var importcss = (function () {
74
  var selectors = [], contentCSSUrls = {};
75
  function append(styleSheet, imported) {
76
  var href = styleSheet.href, rules;
77
- href = removeCacheSuffix(href);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
79
  return;
80
  }
74
  var selectors = [], contentCSSUrls = {};
75
  function append(styleSheet, imported) {
76
  var href = styleSheet.href, rules;
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);
108
  if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
109
  return;
110
  }
mce/importcss/plugin.min.js CHANGED
@@ -1 +1 @@
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})()}();
mce/wptadv/plugin.js CHANGED
@@ -65,12 +65,36 @@
65
 
66
  if ( noAutop ) {
67
  editor.on( 'beforeSetContent', function( event ) {
68
- var autop = typeof window.wp !== 'undefined' && window.wp.editor && window.wp.editor.autop;
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) {
71
  event.content = autop( event.content );
72
  }
73
  }, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  return {
65
 
66
  if ( noAutop ) {
67
  editor.on( 'beforeSetContent', function( event ) {
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
+ }
80
 
81
  if ( event.load && autop && event.content && event.content.indexOf( '\n' ) > -1 && ! /<p>/i.test( event.content ) ) {
82
  event.content = autop( event.content );
83
  }
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
+ }
98
  }
99
 
100
  return {
mce/wptadv/plugin.min.js CHANGED
@@ -1 +1 @@
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>&nbsp;</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>&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){}}),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>&nbsp;</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>&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"}})}),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);
readme.txt CHANGED
@@ -1,30 +1,39 @@
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
- Tags: wysiwyg, formatting, tinymce, write, editor
4
  Requires at least: 4.9.8
5
- Tested up to: 4.9
6
  Stable tag: 4.8.0
 
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Extends and enhances TinyMCE, the WordPress Visual Editor.
11
 
12
  == Description ==
13
 
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.
 
 
 
 
 
 
 
 
17
 
18
  = Some of the features added by this plugin =
19
 
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.
 
24
  * And many others.
25
 
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
  = Privacy =
29
 
30
  TinyMCE Advanced does not collect or store any user related data. It does not set cookies, and it does not connect to any third-party websites. It only uses functionality that is available in [WordPress](https://wordpress.org/), and in the [TinyMCE editor](https://tinymce.com/).
@@ -37,6 +46,14 @@ Best is to install directly from WordPress. If manual installation is required,
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
 
 
 
40
  = 4.8.0 =
41
  * Updated for WordPress 4.9.8 and TinyMCE 4.8.0.
42
 
@@ -68,7 +85,7 @@ Best is to install directly from WordPress. If manual installation is required,
68
  * Added new button in the Text editor to add or reset the line breaks. Adds line breaks only between tags. Works only when it detects that line breaks are missing so it doesn't reformat posts with removed paragraphs.
69
 
70
  = 4.3.10.1 =
71
- * Fixed adding paragraph tags when loading posts that were saved before turning autop off.
72
  * Disabled the (new) inline toolbar for tables as it was overlapping the table in some cases.
73
 
74
  = 4.3.10 =
@@ -90,11 +107,11 @@ Best is to install directly from WordPress. If manual installation is required,
90
  * Fixed text domain and plugin headers.
91
 
92
  = 4.2.3.1 =
93
- * Fix error with removing the 'textpattern' plugin.
94
 
95
  = 4.2.3 =
96
  * Updated for WordPress 4.3 and TinyMCE 4.2.3.
97
- * Removed the 'textpattern' plugin as WordPress 4.3 includes similar functionality by default.
98
  * French translation by Nicolas Schneider.
99
 
100
  = 4.1.9 =
@@ -112,14 +129,14 @@ Best is to install directly from WordPress. If manual installation is required,
112
 
113
  = 4.1 =
114
  * 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).
116
  * Add the updated 'table' plugin that supports background and border color.
117
 
118
  = 4.0.2 =
119
  * 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.
121
  * 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.
123
  * Include updated ''table'' plugin that has support for vertical align for cells.
124
 
125
  = 4.0.1 =
@@ -155,7 +172,7 @@ Compatibility with WordPress 3.2 and TinyMCE 3.4.2, removed the options for supp
155
  = 3.3.9.1 =
156
  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
 
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.
159
 
160
  = 3.3.9 =
161
  Compatibility with WordPress 3.1 and TinyMCE 3.3.9, improved P and BR tags option.
@@ -170,10 +187,10 @@ Compatibility with WordPress 2.8 and TinyMCE 3.2.4, minor bug fixes.
170
  Compatibility with WordPress 2.7 and TinyMCE 3.2, minor bug fixes.
171
 
172
  = 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 MCFileManager can be arranged (if installed).
174
 
175
  = 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: autop and undo, fixed the removal of non-default TinyMCE buttons.
177
 
178
  = 3.0 =
179
  Support for WordPress 2.5 and TinyMCE 3.0.
@@ -196,7 +213,7 @@ Updated for WordPress 4.3 and TinyMCE 4.2.3.
196
  Updated for WordPress 4.2 and TinyMCE 4.1.9.
197
 
198
  = 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.
200
 
201
  == Frequently Asked Questions ==
202
 
@@ -206,7 +223,7 @@ These styles are imported from your current theme editor-style.css file. However
206
 
207
  = I have just installed this plugin, but it does not do anything. =
208
 
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 reloding 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.
210
 
211
  = When I add "Smilies", they do not show in the editor. =
212
 
@@ -224,11 +241,16 @@ Click the "Restore Default Settings" button on the plugin settings page and then
224
 
225
  Please post on the support forum or visit the homepage for [TinyMCE Advanced](http://www.laptoptips.ca/projects/tinymce-advanced/).
226
 
227
-
228
  == Screenshots ==
229
 
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.
 
 
 
 
 
 
1
  === TinyMCE Advanced ===
2
  Contributors: azaozz
3
+ Tags: block editor, classic editor, editor, Gutenberg, formatting, tinymce, write
4
  Requires at least: 4.9.8
5
+ Tested up to: 5.0
6
  Stable tag: 4.8.0
7
+ Requires PHP: 5.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Extends and enhances TinyMCE, the visual editor used in both the Classic Editor and the new Block Editor in WordPress.
12
 
13
  == Description ==
14
 
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.
27
 
28
  = Some of the features added by this plugin =
29
 
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.
35
  * And many others.
36
 
 
 
37
  = Privacy =
38
 
39
  TinyMCE Advanced does not collect or store any user related data. It does not set cookies, and it does not connect to any third-party websites. It only uses functionality that is available in [WordPress](https://wordpress.org/), and in the [TinyMCE editor](https://tinymce.com/).
46
 
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.
56
+
57
  = 4.8.0 =
58
  * Updated for WordPress 4.9.8 and TinyMCE 4.8.0.
59
 
85
  * Added new button in the Text editor to add or reset the line breaks. Adds line breaks only between tags. Works only when it detects that line breaks are missing so it doesn't reformat posts with removed paragraphs.
86
 
87
  = 4.3.10.1 =
88
+ * Fixed adding paragraph tags when loading posts that were saved before turning `wpautop` off.
89
  * Disabled the (new) inline toolbar for tables as it was overlapping the table in some cases.
90
 
91
  = 4.3.10 =
107
  * Fixed text domain and plugin headers.
108
 
109
  = 4.2.3.1 =
110
+ * Fix error with removing the `textpattern` plugin.
111
 
112
  = 4.2.3 =
113
  * Updated for WordPress 4.3 and TinyMCE 4.2.3.
114
+ * Removed the `textpattern` plugin as WordPress 4.3 includes similar functionality by default.
115
  * French translation by Nicolas Schneider.
116
 
117
  = 4.1.9 =
129
 
130
  = 4.1 =
131
  * Updated for WordPress 4.0 and TinyMCE 4.1.
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).
133
  * Add the updated 'table' plugin that supports background and border color.
134
 
135
  = 4.0.2 =
136
  * Fix showing of the second, third and forth button rows when the Toolbar Toggle button is not used.
137
+ * Fix adding the `directionality` plugin when RTL or LTR button is selected.
138
  * Show the ''Advanced Options'' to super admins on multisite installs.
139
+ * Add the `link` plugin including link rel setting. Replaces the Insert/Edit Link dialog when enabled.
140
  * Include updated ''table'' plugin that has support for vertical align for cells.
141
 
142
  = 4.0.1 =
172
  = 3.3.9.1 =
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.
174
 
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.
176
 
177
  = 3.3.9 =
178
  Compatibility with WordPress 3.1 and TinyMCE 3.3.9, improved P and BR tags option.
187
  Compatibility with WordPress 2.7 and TinyMCE 3.2, minor bug fixes.
188
 
189
  = 3.1 =
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).
191
 
192
  = 3.0.1 =
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.
194
 
195
  = 3.0 =
196
  Support for WordPress 2.5 and TinyMCE 3.0.
213
  Updated for WordPress 4.2 and TinyMCE 4.1.9.
214
 
215
  = 4.1 =
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.
217
 
218
  == Frequently Asked Questions ==
219
 
223
 
224
  = I have just installed this plugin, but it does not do anything. =
225
 
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.
227
 
228
  = When I add "Smilies", they do not show in the editor. =
229
 
241
 
242
  Please post on the support forum or visit the homepage for [TinyMCE Advanced](http://www.laptoptips.ca/projects/tinymce-advanced/).
243
 
 
244
  == Screenshots ==
245
 
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.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
screenshot-6.png ADDED
Binary file
tadv_admin.php CHANGED
@@ -12,7 +12,7 @@ if ( ! defined( 'TADV_ADMIN_PAGE' ) ) {
12
 
13
  // TODO
14
  if ( ! current_user_can( 'manage_options' ) ) {
15
- wp_die('Access denied');
16
  }
17
 
18
  $message = '';
@@ -22,8 +22,6 @@ $imgpath = TADV_URL . 'images/';
22
  $tadv_options_updated = false;
23
  $settings = $admin_settings = array();
24
 
25
-
26
-
27
  if ( isset( $_POST['tadv-save'] ) ) {
28
  check_admin_referer( 'tadv-save-buttons-order' );
29
  $this->save_settings();
@@ -49,7 +47,7 @@ if ( isset( $_POST['tadv-save'] ) ) {
49
  $output['admin_settings'] = $this->admin_settings;
50
 
51
  ?>
52
- <div class="wrap">
53
  <h2><?php _e( 'TinyMCE Advanced Settings Export', 'tinymce-advanced' ); ?></h2>
54
 
55
  <div class="tadv-import-export">
@@ -74,7 +72,7 @@ if ( isset( $_POST['tadv-save'] ) ) {
74
 
75
  // TODO: all users
76
  ?>
77
- <div class="wrap">
78
  <h2><?php _e( 'TinyMCE Advanced Settings Import', 'tinymce-advanced' ); ?></h2>
79
 
80
  <div class="tadv-import-export">
@@ -125,7 +123,7 @@ if ( empty( $this->toolbar_1 ) && empty( $this->toolbar_2 ) && empty( $this->too
125
  $all_buttons = $this->get_all_buttons();
126
 
127
  ?>
128
- <div class="wrap" id="contain">
129
  <h2><?php _e( 'Editor Settings', 'tinymce-advanced' ); ?></h2>
130
  <?php
131
 
@@ -141,18 +139,20 @@ if ( isset( $_POST['tadv-save'] ) && empty( $message ) ) {
141
  ?>
142
  <form id="tadvadmin" method="post" action="">
143
 
144
- <p class="tadv-submit">
145
- <input class="button-primary button-large" type="submit" name="tadv-save" value="<?php _e( 'Save Changes', 'tinymce-advanced' ); ?>" />
146
  </p>
147
 
148
- <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
156
  <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' enabled'; } ?>">
157
  <div class="mce-container-body mce-flow-layout">
158
  <div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item">
@@ -203,6 +203,7 @@ if ( isset( $_POST['tadv-save'] ) && empty( $message ) ) {
203
  <?php
204
 
205
  $mce_text_buttons = array( 'styleselect', 'formatselect', 'fontselect', 'fontsizeselect' );
 
206
 
207
  for ( $i = 1; $i < 5; $i++ ) {
208
  $toolbar = "toolbar_$i";
@@ -217,15 +218,15 @@ for ( $i = 1; $i < 5; $i++ ) {
217
  continue;
218
  }
219
 
220
- if ( isset( $all_buttons[$button] ) ) {
221
- $name = $all_buttons[$button];
222
- unset( $all_buttons[$button] );
223
  } else {
224
- // error?..
225
  continue;
226
  }
227
 
228
- ?><li class="tadvmodule" id="<?php echo $button; ?>">
 
229
  <?php
230
 
231
  if ( in_array( $button, $mce_text_buttons, true ) ) {
@@ -249,7 +250,8 @@ for ( $i = 1; $i < 5; $i++ ) {
249
  }
250
 
251
  ?>
252
- </li><?php
 
253
 
254
  }
255
 
@@ -261,148 +263,374 @@ for ( $i = 1; $i < 5; $i++ ) {
261
  ?>
262
  </div>
263
 
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;
274
- }
275
 
276
- ?><li class="tadvmodule" id="<?php echo $button; ?>">
 
 
 
277
  <?php
278
 
279
- if ( in_array( $button, $mce_text_buttons, true ) ) {
 
 
 
 
280
  ?>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  <?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
- <?php
297
  }
298
 
299
  ?>
300
- </li><?php
 
301
 
302
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
 
304
- ?>
305
- </ul>
 
 
 
 
 
306
  </div>
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  <div class="advanced-options">
309
  <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>
313
  <p>
314
  <?php _e( 'Enable more list options: upper or lower case letters for ordered lists, disk or square for unordered lists, etc.', 'tinymce-advanced' ); ?>
315
  </p>
316
  </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>
334
  <p><?php printf( __( 'Replace the size setting available for fonts with: %s.', 'tinymce-advanced' ), $this->fontsize_formats ); ?></p>
335
  </div>
336
  </div>
337
  <?php
338
 
339
  if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) {
 
 
340
  ?>
341
  <div class="advanced-options">
342
  <h3><?php _e( 'Advanced Options', 'tinymce-advanced' ); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  <?php
344
 
345
  $has_editor_style = $this->has_editor_style();
346
  $disabled = ' disabled';
347
 
348
- if ( $has_editor_style === 'not-supporetd' || $has_editor_style === 'not-present' ) {
349
  add_editor_style();
 
350
  }
351
 
352
- if ( $this->has_editor_style() === 'present' ) {
353
  $disabled = '';
354
- $has_editor_style = 'present';
355
  }
356
 
357
  ?>
358
  <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>
 
 
362
  <?php
363
 
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' ) {
367
  ?>
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' ); ?>
 
371
  <?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
- <?php
378
- }
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
  }
383
 
384
  ?>
385
  </p>
386
  </div>
387
  <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 &lt;p&gt; and &lt;br /&gt; 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 &lt;br /&gt; 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>
400
  <p>
401
  <?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' ); ?>
402
  <?php _e( 'This is not acceptable for larger images like photos or graphics, but may be useful in some cases for very small images like icons, not larger than 2-3KB.', 'tinymce-advanced' ); ?>
403
  <?php _e( 'These images will not be available in the Media Library.', 'tinymce-advanced' ); ?>
404
  </p>
405
  </div>
 
 
 
 
 
 
 
 
 
 
 
406
  </div>
407
 
408
  <div class="advanced-options">
@@ -417,16 +645,16 @@ if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) {
417
  <div>
418
  <h4><?php _e( 'Enable the editor enhancements for:', 'tinymce-advanced' ); ?></h4>
419
  <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>
430
  </p>
431
  </div>
432
  </div>
@@ -435,6 +663,8 @@ if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) {
435
  }
436
  ?>
437
 
 
 
438
  <p class="tadv-submit">
439
  <?php wp_nonce_field( 'tadv-save-buttons-order' ); ?>
440
  <input class="button" type="submit" name="tadv-restore-defaults" value="<?php _e( 'Restore Default Settings', 'tinymce-advanced' ); ?>" />
12
 
13
  // TODO
14
  if ( ! current_user_can( 'manage_options' ) ) {
15
+ wp_die( 'Invalid request' );
16
  }
17
 
18
  $message = '';
22
  $tadv_options_updated = false;
23
  $settings = $admin_settings = array();
24
 
 
 
25
  if ( isset( $_POST['tadv-save'] ) ) {
26
  check_admin_referer( 'tadv-save-buttons-order' );
27
  $this->save_settings();
47
  $output['admin_settings'] = $this->admin_settings;
48
 
49
  ?>
50
+ <div class="wrap tinymce-advanced">
51
  <h2><?php _e( 'TinyMCE Advanced Settings Export', 'tinymce-advanced' ); ?></h2>
52
 
53
  <div class="tadv-import-export">
72
 
73
  // TODO: all users
74
  ?>
75
+ <div class="wrap tinymce-advanced">
76
  <h2><?php _e( 'TinyMCE Advanced Settings Import', 'tinymce-advanced' ); ?></h2>
77
 
78
  <div class="tadv-import-export">
123
  $all_buttons = $this->get_all_buttons();
124
 
125
  ?>
126
+ <div class="wrap tinymce-advanced" id="contain">
127
  <h2><?php _e( 'Editor Settings', 'tinymce-advanced' ); ?></h2>
128
  <?php
129
 
139
  ?>
140
  <form id="tadvadmin" method="post" action="">
141
 
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' ); ?>" />
144
  </p>
145
 
146
+ <div id="classic-editor">
147
+ <h3><?php _e( 'Toolbars for the Classic Editor (TinyMCE)', 'tinymce-advanced' ); ?></h3>
148
 
149
+ <div id="tadvzones">
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
  <?php if ( $this->check_user_setting( 'menubar' ) ) { echo ' enabled'; } ?>">
157
  <div class="mce-container-body mce-flow-layout">
158
  <div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item">
203
  <?php
204
 
205
  $mce_text_buttons = array( 'styleselect', 'formatselect', 'fontselect', 'fontsizeselect' );
206
+ $all_buttons_classic = $all_buttons;
207
 
208
  for ( $i = 1; $i < 5; $i++ ) {
209
  $toolbar = "toolbar_$i";
218
  continue;
219
  }
220
 
221
+ if ( isset( $all_buttons_classic[ $button ] ) ) {
222
+ $name = $all_buttons_classic[ $button ];
223
+ unset( $all_buttons_classic[ $button ] );
224
  } else {
 
225
  continue;
226
  }
227
 
228
+ ?>
229
+ <li class="tadvmodule" id="<?php echo $button; ?>">
230
  <?php
231
 
232
  if ( in_array( $button, $mce_text_buttons, true ) ) {
250
  }
251
 
252
  ?>
253
+ </li>
254
+ <?php
255
 
256
  }
257
 
263
  ?>
264
  </div>
265
 
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
426
+ }
427
+
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">
438
+ <?php
439
+
440
+ foreach( $all_buttons_block as $button_id => $name ) {
441
+ if ( strpos( $button, 'separator' ) !== false ) {
442
+ continue;
443
+ }
444
+
445
+ ?>
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>
471
+ <?php
472
+ }
473
+
474
+ ?>
475
+ </ul>
476
+ </div><!-- /highlight -->
477
+ </div><!-- /unuseddiv -->
478
+ </div><!-- /block-editor -->
479
+
480
  <div class="advanced-options">
481
  <h3><?php _e( 'Options', 'tinymce-advanced' ); ?></h3>
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>
492
  <p>
493
  <?php _e( 'Enable more list options: upper or lower case letters for ordered lists, disk or square for unordered lists, etc.', 'tinymce-advanced' ); ?>
494
  </p>
495
  </div>
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>
512
  <p><?php printf( __( 'Replace the size setting available for fonts with: %s.', 'tinymce-advanced' ), $this->fontsize_formats ); ?></p>
513
  </div>
514
  </div>
515
  <?php
516
 
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
+
520
  ?>
521
  <div class="advanced-options">
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) &#8220;Classic&#8221; 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 &#8220;Classic Paragraph Block&#8221; 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 (&#8220;classic&#8221;) 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 &lt;p&gt; and &lt;br&gt; 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 &lt;br&gt; tags.', 'tinymce-advanced' ); ?>
577
+ </p>
578
+ </div>
579
  <?php
580
 
581
  $has_editor_style = $this->has_editor_style();
582
  $disabled = ' disabled';
583
 
584
+ if ( $has_editor_style === false ) {
585
  add_editor_style();
586
+ $has_editor_style = $this->has_editor_style();
587
  }
588
 
589
+ if ( $has_editor_style ) {
590
  $disabled = '';
 
591
  }
592
 
593
  ?>
594
  <div>
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>
600
  <?php
601
 
602
+ if ( $disabled ) {
 
 
603
  ?>
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>
608
  <?php
 
 
 
 
 
 
 
 
 
 
609
  }
610
 
611
  ?>
612
  </p>
613
  </div>
614
  <div>
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>
 
 
 
 
 
 
 
 
 
 
617
  <p>
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' ); ?>
619
  <?php _e( 'This is not acceptable for larger images like photos or graphics, but may be useful in some cases for very small images like icons, not larger than 2-3KB.', 'tinymce-advanced' ); ?>
620
  <?php _e( 'These images will not be available in the Media Library.', 'tinymce-advanced' ); ?>
621
  </p>
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>
634
  </div>
635
 
636
  <div class="advanced-options">
645
  <div>
646
  <h4><?php _e( 'Enable the editor enhancements for:', 'tinymce-advanced' ); ?></h4>
647
  <p>
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>
658
  </p>
659
  </div>
660
  </div>
663
  }
664
  ?>
665
 
666
+ <hr>
667
+
668
  <p class="tadv-submit">
669
  <?php wp_nonce_field( 'tadv-save-buttons-order' ); ?>
670
  <input class="button" type="submit" name="tadv-restore-defaults" value="<?php _e( 'Restore Default Settings', 'tinymce-advanced' ); ?>" />
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: Enables advanced features and plugins in TinyMCE, the visual editor in WordPress.
6
- Version: 4.8.0
7
  Author: Andrew Ozz
8
  Author URI: http://www.laptoptips.ca/
9
  License: GPL2
@@ -27,12 +27,16 @@ Domain Path: /langs
27
  Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
28
  */
29
 
 
 
 
 
30
  if ( ! class_exists('Tinymce_Advanced') ) :
31
 
32
  class Tinymce_Advanced {
33
 
34
  private $required_version = '4.9.6';
35
- private $plugin_version = '4.7.13';
36
 
37
  private $user_settings;
38
  private $admin_settings;
@@ -50,15 +54,26 @@ class Tinymce_Advanced {
50
  private $all_buttons = array();
51
  private $buttons_filter = array();
52
  private $fontsize_formats = '8px 10px 12px 14px 16px 20px 24px 28px 32px 36px 48px 60px 72px 96px';
53
-
 
 
 
 
 
 
 
 
 
 
54
 
55
  private function get_default_user_settings() {
56
  return array(
57
- 'options' => 'menubar,advlist',
58
  'toolbar_1' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,unlink,undo,redo',
59
  'toolbar_2' => 'fontselect,fontsizeselect,outdent,indent,pastetext,removeformat,charmap,wp_more,forecolor,table,wp_help',
60
  'toolbar_3' => '',
61
  'toolbar_4' => '',
 
62
  'plugins' => 'anchor,code,insertdatetime,nonbreaking,print,searchreplace,table,visualblocks,visualchars,advlist,wptadv',
63
  );
64
  }
@@ -95,7 +110,9 @@ class Tinymce_Advanced {
95
  'advlink',
96
  'contextmenu',
97
  'menubar',
 
98
  'fontsize_formats',
 
99
  );
100
  }
101
 
@@ -104,6 +121,8 @@ class Tinymce_Advanced {
104
  'importcss',
105
  'no_autop',
106
  'paste_images',
 
 
107
  );
108
  }
109
 
@@ -116,9 +135,6 @@ class Tinymce_Advanced {
116
  }
117
 
118
  public function __construct() {
119
- if ( ! defined('ABSPATH') ) {
120
- return;
121
- }
122
 
123
  register_activation_hook( __FILE__, array( $this, 'check_plugin_version' ) );
124
 
@@ -135,14 +151,20 @@ class Tinymce_Advanced {
135
  add_filter( 'wp_editor_settings', array( $this, 'disable_for_editor' ), 10, 2 );
136
 
137
  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' ) );
143
  add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 999 );
144
  add_filter( 'tiny_mce_plugins', array( $this, 'tiny_mce_plugins' ), 999 );
145
- add_action( 'after_wp_tiny_mce', array( $this, 'after_wp_tiny_mce' ) );
 
 
 
 
 
 
146
  }
147
 
148
  public function disable_for_editor( $settings, $editor_id ) {
@@ -173,7 +195,7 @@ class Tinymce_Advanced {
173
  }
174
 
175
  if ( ! $this->disabled_for_editor && ! $editor_style_added ) {
176
- if ( $this->check_admin_setting( 'importcss' ) && $this->has_editor_style() !== 'present' ) {
177
  add_editor_style();
178
  }
179
 
@@ -189,7 +211,7 @@ class Tinymce_Advanced {
189
 
190
  private function has_editor_style() {
191
  if ( ! current_theme_supports( 'editor-style' ) ) {
192
- return 'not-supporetd';
193
  }
194
 
195
  $editor_stylesheets = get_editor_stylesheets();
@@ -197,12 +219,12 @@ class Tinymce_Advanced {
197
  if ( is_array( $editor_stylesheets ) ) {
198
  foreach ( $editor_stylesheets as $url ) {
199
  if ( strpos( $url, 'editor-style.css' ) !== false ) {
200
- return 'present';
201
  }
202
  }
203
  }
204
 
205
- return 'not-present';
206
  }
207
 
208
  // When using a plugin that changes the paths dinamically, set these earlier than 'plugins_loaded' 50.
@@ -257,8 +279,18 @@ class Tinymce_Advanced {
257
 
258
  $this->admin_options = ! empty( $this->admin_settings['options'] ) ? explode( ',', $this->admin_settings['options'] ) : array();
259
 
 
 
260
  if ( $this->user_settings === false ) {
261
- $this->user_settings = $this->get_default_user_settings();
 
 
 
 
 
 
 
 
262
  }
263
 
264
  $this->options = ! empty( $this->user_settings['options'] ) ? explode( ',', $this->user_settings['options'] ) : array();
@@ -267,8 +299,9 @@ class Tinymce_Advanced {
267
  $this->toolbar_2 = ! empty( $this->user_settings['toolbar_2'] ) ? explode( ',', $this->user_settings['toolbar_2'] ) : array();
268
  $this->toolbar_3 = ! empty( $this->user_settings['toolbar_3'] ) ? explode( ',', $this->user_settings['toolbar_3'] ) : array();
269
  $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 );
272
  $this->get_all_buttons();
273
 
274
  // Force refresh after activation.
@@ -399,9 +432,6 @@ class Tinymce_Advanced {
399
  'forecolor' => 'Text color',
400
  'backcolor' => 'Background color',
401
 
402
- // Layer plugin ?
403
- // 'insertlayer' => 'Layer',
404
-
405
  // WP
406
  'wp_adv' => 'Toolbar Toggle',
407
  'wp_help' => 'Keyboard Shortcuts',
@@ -512,7 +542,11 @@ class Tinymce_Advanced {
512
  $this->load_settings();
513
  }
514
 
515
- $buttons_1 = $this->toolbar_1;
 
 
 
 
516
 
517
  if ( is_array( $original ) && ! empty( $original ) ) {
518
  $original = array_diff( $original, $this->buttons_filter );
@@ -522,7 +556,7 @@ class Tinymce_Advanced {
522
  return $buttons_1;
523
  }
524
 
525
- public function mce_buttons_2( $original ) {
526
  if ( $this->is_disabled() ) {
527
  return $original;
528
  }
@@ -531,7 +565,11 @@ class Tinymce_Advanced {
531
  $this->load_settings();
532
  }
533
 
534
- $buttons_2 = $this->toolbar_2;
 
 
 
 
535
 
536
  if ( is_array( $original ) && ! empty( $original ) ) {
537
  $original = array_diff( $original, $this->buttons_filter );
@@ -541,7 +579,7 @@ class Tinymce_Advanced {
541
  return $buttons_2;
542
  }
543
 
544
- public function mce_buttons_3( $original ) {
545
  if ( $this->is_disabled() ) {
546
  return $original;
547
  }
@@ -550,7 +588,11 @@ class Tinymce_Advanced {
550
  $this->load_settings();
551
  }
552
 
553
- $buttons_3 = $this->toolbar_3;
 
 
 
 
554
 
555
  if ( is_array( $original ) && ! empty( $original ) ) {
556
  $original = array_diff( $original, $this->buttons_filter );
@@ -560,7 +602,7 @@ class Tinymce_Advanced {
560
  return $buttons_3;
561
  }
562
 
563
- public function mce_buttons_4( $original ) {
564
  if ( $this->is_disabled() ) {
565
  return $original;
566
  }
@@ -569,7 +611,11 @@ class Tinymce_Advanced {
569
  $this->load_settings();
570
  }
571
 
572
- $buttons_4 = $this->toolbar_4;
 
 
 
 
573
 
574
  if ( is_array( $original ) && ! empty( $original ) ) {
575
  $original = array_diff( $original, $this->buttons_filter );
@@ -579,13 +625,13 @@ class Tinymce_Advanced {
579
  return $buttons_4;
580
  }
581
 
582
- public function mce_options( $init ) {
583
  if ( $this->is_disabled() ) {
584
  return $init;
585
  }
586
 
587
  $init['image_advtab'] = true;
588
- $init['rel_list'] = '[{text: "None", value: ""}, {text: "Nofollow", value: "nofollow"}]';
589
 
590
  if ( $this->check_admin_setting( 'no_autop' ) ) {
591
  $init['wpautop'] = false;
@@ -593,8 +639,33 @@ class Tinymce_Advanced {
593
  $init['tadv_noautop'] = true;
594
  }
595
 
596
- if ( $this->check_user_setting('menubar') ) {
597
- $init['menubar'] = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  }
599
 
600
  if ( ! in_array( 'wp_adv', $this->toolbar_1, true ) ) {
@@ -602,7 +673,6 @@ class Tinymce_Advanced {
602
  }
603
 
604
  if ( $this->check_admin_setting( 'importcss' ) ) {
605
- // $init['importcss_selector_filter'] = 'function(sel){return /^\.[a-z0-9]+$/i.test(sel);}';
606
  $init['importcss_file_filter'] = 'editor-style.css';
607
  }
608
 
@@ -616,31 +686,57 @@ class Tinymce_Advanced {
616
 
617
  if ( in_array( 'table', $this->plugins, true ) ) {
618
  $init['table_toolbar'] = false;
 
 
 
 
 
619
  }
620
 
621
  return $init;
622
  }
623
 
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","&para;",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>&nbsp;</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;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  }
645
 
646
  public function mce_external_plugins( $mce_plugins ) {
@@ -760,8 +856,8 @@ class Tinymce_Advanced {
760
  $user_settings = $all_settings['settings'];
761
  }
762
 
763
- for ( $i = 1; $i < 5; $i++ ) {
764
- $toolbar_name = 'toolbar_' . $i;
765
 
766
  if ( ! empty( $user_settings[ $toolbar_name ] ) ) {
767
  $toolbar = explode( ',', $user_settings[ $toolbar_name ] );
@@ -771,8 +867,8 @@ class Tinymce_Advanced {
771
  $toolbar = array();
772
  }
773
 
774
- if ( $i > 1 && ( $wp_adv = array_search( 'wp_adv', $toolbar ) ) !== false ) {
775
- unset( $toolbar[ $wp_adv ] );
776
  }
777
 
778
  $settings[ $toolbar_name ] = $this->validate_settings( $toolbar, $this->buttons_filter );
@@ -781,7 +877,15 @@ class Tinymce_Advanced {
781
  if ( ! empty( $user_settings['options'] ) ) {
782
  $options = explode( ',', $user_settings['options'] );
783
  } elseif ( ! empty( $_POST['options'] ) && is_array( $_POST['options'] ) ) {
784
- $options = $_POST['options'];
 
 
 
 
 
 
 
 
785
  } else {
786
  $options = array();
787
  }
@@ -790,12 +894,14 @@ class Tinymce_Advanced {
790
 
791
  if ( ! empty( $user_settings['plugins'] ) ) {
792
  $plugins = explode( ',', $user_settings['plugins'] );
793
- } elseif ( ! empty( $_POST['options']['menubar'] ) ) {
794
- $plugins = array( 'anchor', 'code', 'insertdatetime', 'nonbreaking', 'print', 'searchreplace', 'table', 'visualblocks', 'visualchars' );
795
  } else {
796
  $plugins = array();
797
  }
798
 
 
 
 
 
799
  // Merge the submitted plugins with plugins needed for the buttons.
800
  $this->user_settings = $settings;
801
  $this->load_settings();
@@ -831,7 +937,15 @@ class Tinymce_Advanced {
831
  $disabled_editors = array_intersect( $this->get_editor_locations(), explode( ',', $admin_settings['disabled_editors'] ) );
832
  } elseif ( isset( $_POST['tadv-save'] ) ) {
833
  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() );
 
 
 
 
 
 
 
 
835
  }
836
 
837
  if ( ! empty( $_POST['tadv_enable_at'] ) && is_array( $_POST['tadv_enable_at'] ) ) {
3
  Plugin Name: TinyMCE Advanced
4
  Plugin URI: http://www.laptoptips.ca/projects/tinymce-advanced/
5
  Description: Enables advanced features and plugins in TinyMCE, the visual editor in WordPress.
6
+ Version: 4.8.1
7
  Author: Andrew Ozz
8
  Author URI: http://www.laptoptips.ca/
9
  License: GPL2
27
  Copyright (c) 2007-2018 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_version = '4.9.6';
39
+ private $plugin_version = '4.8.1';
40
 
41
  private $user_settings;
42
  private $admin_settings;
54
  private $all_buttons = array();
55
  private $buttons_filter = array();
56
  private $fontsize_formats = '8px 10px 12px 14px 16px 20px 24px 28px 32px 36px 48px 60px 72px 96px';
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
+ );
68
 
69
  private function get_default_user_settings() {
70
  return array(
71
+ 'options' => 'menubar,advlist,menubar_block',
72
  'toolbar_1' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,unlink,undo,redo',
73
  'toolbar_2' => 'fontselect,fontsizeselect,outdent,indent,pastetext,removeformat,charmap,wp_more,forecolor,table,wp_help',
74
  'toolbar_3' => '',
75
  'toolbar_4' => '',
76
+ 'toolbar_classic_block' => 'formatselect,bold,italic,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,forecolor,backcolor,table,wp_help',
77
  'plugins' => 'anchor,code,insertdatetime,nonbreaking,print,searchreplace,table,visualblocks,visualchars,advlist,wptadv',
78
  );
79
  }
110
  'advlink',
111
  'contextmenu',
112
  'menubar',
113
+ 'menubar_block',
114
  'fontsize_formats',
115
+ 'no_merge_toolbars',
116
  );
117
  }
118
 
121
  'importcss',
122
  'no_autop',
123
  'paste_images',
124
+ 'no_hybrid_mode',
125
+ 'replace_block_editor',
126
  );
127
  }
128
 
135
  }
136
 
137
  public function __construct() {
 
 
 
138
 
139
  register_activation_hook( __FILE__, array( $this, 'check_plugin_version' ) );
140
 
151
  add_filter( 'wp_editor_settings', array( $this, 'disable_for_editor' ), 10, 2 );
152
 
153
  add_filter( 'mce_buttons', array( $this, 'mce_buttons_1' ), 999, 2 );
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 );
159
  add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 999 );
160
  add_filter( 'tiny_mce_plugins', array( $this, 'tiny_mce_plugins' ), 999 );
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 );
168
  }
169
 
170
  public function disable_for_editor( $settings, $editor_id ) {
195
  }
196
 
197
  if ( ! $this->disabled_for_editor && ! $editor_style_added ) {
198
+ if ( $this->check_admin_setting( 'importcss' ) && $this->has_editor_style() === false ) {
199
  add_editor_style();
200
  }
201
 
211
 
212
  private function has_editor_style() {
213
  if ( ! current_theme_supports( 'editor-style' ) ) {
214
+ return false;
215
  }
216
 
217
  $editor_stylesheets = get_editor_stylesheets();
219
  if ( is_array( $editor_stylesheets ) ) {
220
  foreach ( $editor_stylesheets as $url ) {
221
  if ( strpos( $url, 'editor-style.css' ) !== false ) {
222
+ return $url;
223
  }
224
  }
225
  }
226
 
227
+ return '';
228
  }
229
 
230
  // When using a plugin that changes the paths dinamically, set these earlier than 'plugins_loaded' 50.
279
 
280
  $this->admin_options = ! empty( $this->admin_settings['options'] ) ? explode( ',', $this->admin_settings['options'] ) : array();
281
 
282
+ $default_user_settings = $this->get_default_user_settings();
283
+
284
  if ( $this->user_settings === false ) {
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'];
294
  }
295
 
296
  $this->options = ! empty( $this->user_settings['options'] ) ? explode( ',', $this->user_settings['options'] ) : array();
299
  $this->toolbar_2 = ! empty( $this->user_settings['toolbar_2'] ) ? explode( ',', $this->user_settings['toolbar_2'] ) : array();
300
  $this->toolbar_3 = ! empty( $this->user_settings['toolbar_3'] ) ? explode( ',', $this->user_settings['toolbar_3'] ) : array();
301
  $this->toolbar_4 = ! empty( $this->user_settings['toolbar_4'] ) ? explode( ',', $this->user_settings['toolbar_4'] ) : array();
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 );
305
  $this->get_all_buttons();
306
 
307
  // Force refresh after activation.
432
  'forecolor' => 'Text color',
433
  'backcolor' => 'Background color',
434
 
 
 
 
435
  // WP
436
  'wp_adv' => 'Toolbar Toggle',
437
  'wp_help' => 'Keyboard Shortcuts',
542
  $this->load_settings();
543
  }
544
 
545
+ if ( $editor_id === 'classic-block' ) {
546
+ $buttons_1 = $this->toolbar_classic_block;
547
+ } else {
548
+ $buttons_1 = $this->toolbar_1;
549
+ }
550
 
551
  if ( is_array( $original ) && ! empty( $original ) ) {
552
  $original = array_diff( $original, $this->buttons_filter );
556
  return $buttons_1;
557
  }
558
 
559
+ public function mce_buttons_2( $original, $editor_id ) {
560
  if ( $this->is_disabled() ) {
561
  return $original;
562
  }
565
  $this->load_settings();
566
  }
567
 
568
+ if ( $editor_id === 'classic-block' ) {
569
+ $buttons_2 = array();
570
+ } else {
571
+ $buttons_2 = $this->toolbar_2;
572
+ }
573
 
574
  if ( is_array( $original ) && ! empty( $original ) ) {
575
  $original = array_diff( $original, $this->buttons_filter );
579
  return $buttons_2;
580
  }
581
 
582
+ public function mce_buttons_3( $original, $editor_id ) {
583
  if ( $this->is_disabled() ) {
584
  return $original;
585
  }
588
  $this->load_settings();
589
  }
590
 
591
+ if ( $editor_id === 'classic-block' ) {
592
+ $buttons_3 = array();
593
+ } else {
594
+ $buttons_3 = $this->toolbar_3;
595
+ }
596
 
597
  if ( is_array( $original ) && ! empty( $original ) ) {
598
  $original = array_diff( $original, $this->buttons_filter );
602
  return $buttons_3;
603
  }
604
 
605
+ public function mce_buttons_4( $original, $editor_id ) {
606
  if ( $this->is_disabled() ) {
607
  return $original;
608
  }
611
  $this->load_settings();
612
  }
613
 
614
+ if ( $editor_id === 'classic-block' ) {
615
+ $buttons_4 = array();
616
+ } else {
617
+ $buttons_4 = $this->toolbar_4;
618
+ }
619
 
620
  if ( is_array( $original ) && ! empty( $original ) ) {
621
  $original = array_diff( $original, $this->buttons_filter );
625
  return $buttons_4;
626
  }
627
 
628
+ public function mce_options( $init, $editor_id = '' ) {
629
  if ( $this->is_disabled() ) {
630
  return $init;
631
  }
632
 
633
  $init['image_advtab'] = true;
634
+ $init['rel_list'] = '[{text: "None", value: ""}, {text: "Nofollow", value: "nofollow noreferrer"}]';
635
 
636
  if ( $this->check_admin_setting( 'no_autop' ) ) {
637
  $init['wpautop'] = false;
639
  $init['tadv_noautop'] = true;
640
  }
641
 
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
+ }
669
  }
670
 
671
  if ( ! in_array( 'wp_adv', $this->toolbar_1, true ) ) {
673
  }
674
 
675
  if ( $this->check_admin_setting( 'importcss' ) ) {
 
676
  $init['importcss_file_filter'] = 'editor-style.css';
677
  }
678
 
686
 
687
  if ( in_array( 'table', $this->plugins, true ) ) {
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'] = '{}';
694
  }
695
 
696
  return $init;
697
  }
698
 
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;
740
  }
741
 
742
  public function mce_external_plugins( $mce_plugins ) {
856
  $user_settings = $all_settings['settings'];
857
  }
858
 
859
+ for ( $i = 1; $i < 6; $i++ ) {
860
+ $toolbar_name = ( $i < 5 ) ? 'toolbar_' . $i : 'toolbar_classic_block';
861
 
862
  if ( ! empty( $user_settings[ $toolbar_name ] ) ) {
863
  $toolbar = explode( ',', $user_settings[ $toolbar_name ] );
867
  $toolbar = array();
868
  }
869
 
870
+ if ( $i > 1 && in_array( 'wp_adv', $toolbar, true ) ) {
871
+ $toolbar = array_diff( $toolbar, array( 'wp_adv' ) );
872
  }
873
 
874
  $settings[ $toolbar_name ] = $this->validate_settings( $toolbar, $this->buttons_filter );
877
  if ( ! empty( $user_settings['options'] ) ) {
878
  $options = explode( ',', $user_settings['options'] );
879
  } elseif ( ! empty( $_POST['options'] ) && is_array( $_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;
889
  } else {
890
  $options = array();
891
  }
894
 
895
  if ( ! empty( $user_settings['plugins'] ) ) {
896
  $plugins = explode( ',', $user_settings['plugins'] );
 
 
897
  } else {
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 );
903
+ }
904
+
905
  // Merge the submitted plugins with plugins needed for the buttons.
906
  $this->user_settings = $settings;
907
  $this->load_settings();
937
  $disabled_editors = array_intersect( $this->get_editor_locations(), explode( ',', $admin_settings['disabled_editors'] ) );
938
  } elseif ( isset( $_POST['tadv-save'] ) ) {
939
  if ( ! empty( $_POST['admin_options'] ) && is_array( $_POST['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() );
949
  }
950
 
951
  if ( ! empty( $_POST['tadv_enable_at'] ) && is_array( $_POST['tadv_enable_at'] ) ) {