Version Description
- Fixes and improvements for 4.8.1.
- Added separate option to enable the Classic Paragraph Block.
- Added converting of most default blocks to classic paragraphs, and from classic paragraphs to default blocks.
Download this release
Release Info
Developer | azaozz |
Plugin | TinyMCE Advanced |
Version | 4.8.2 |
Comparing to | |
See all releases |
Code changes from version 4.8.1 to 4.8.2
- block-editor/block-editor.css +21 -8
- block-editor/block-register.js +176 -67
- block-editor/classic-paragraph.css +59 -10
- css/tadv-styles.css +11 -3
- mce/wptadv/plugin.js +1 -0
- readme.txt +16 -9
- screenshot-5.png +0 -0
- tadv_admin.php +21 -19
- tinymce-advanced.php +64 -71
block-editor/block-editor.css
CHANGED
@@ -1,7 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/* Fixes for the Block Editor */
|
2 |
|
3 |
.block-library-classic__toolbar .mce-menubar {
|
4 |
-
height:
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
|
7 |
.block-library-classic__toolbar .mce-btn .mce-txt {
|
@@ -10,16 +21,14 @@
|
|
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. */
|
@@ -132,6 +141,10 @@
|
|
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,
|
@@ -248,13 +261,13 @@ div.mce-menu-has-icons i.mce-ico {
|
|
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 |
-
|
257 |
-
|
|
|
258 |
}
|
259 |
}
|
260 |
|
1 |
+
/**
|
2 |
+
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
+
* For more information please see tinymce-advanced.php.
|
4 |
+
*
|
5 |
+
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
6 |
+
*/
|
7 |
+
|
8 |
/* Fixes for the Block Editor */
|
9 |
|
10 |
.block-library-classic__toolbar .mce-menubar {
|
11 |
+
min-height: 38px;
|
12 |
+
}
|
13 |
+
|
14 |
+
.block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-container-body .mce-toolbar {
|
15 |
+
padding: 0;
|
16 |
}
|
17 |
|
18 |
.block-library-classic__toolbar .mce-btn .mce-txt {
|
21 |
|
22 |
.block-library-classic__toolbar .mce-menubar > .mce-container-body {
|
23 |
padding-top: 0.5em;
|
24 |
+
white-space: normal;
|
25 |
+
width: calc(100% - 36px) !important;
|
26 |
}
|
27 |
|
28 |
.block-library-classic__toolbar .mce-menubar i.mce-caret {
|
29 |
margin-top: 0.4em;
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
32 |
/* Classic Block styling regressions fixes */
|
33 |
.wp-block-freeform.block-library-rich-text__tinymce {
|
34 |
padding: 6px; /* For wpview outlines and image resize handles. */
|
141 |
/* Toolbars (some get appended to <body>) */
|
142 |
div.mce-toolbar-grp .mce-btn:hover button,
|
143 |
div.mce-toolbar-grp .mce-btn:hover i,
|
144 |
+
div.mce-toolbar-grp .mce-btn.mce-active button,
|
145 |
+
div.mce-toolbar-grp .mce-btn.mce-active:hover button,
|
146 |
+
div.mce-toolbar-grp .mce-btn.mce-active i,
|
147 |
+
div.mce-toolbar-grp .mce-btn.mce-active:hover i
|
148 |
div.mce-inline-toolbar-grp .mce-btn:hover button,
|
149 |
div.mce-inline-toolbar-grp .mce-btn:hover i,
|
150 |
div.mce-inline-toolbar-grp .mce-btn.mce-active button,
|
261 |
}
|
262 |
|
263 |
.edit-post-layout .editor-styles-wrapper .wp-block {
|
|
|
264 |
margin-left: auto;
|
265 |
margin-right: auto;
|
266 |
}
|
267 |
|
268 |
+
|
269 |
+
.edit-post-layout .wp-block-columns .editor-styles-wrapper .wp-block {
|
270 |
+
min-width: 0;
|
271 |
}
|
272 |
}
|
273 |
|
block-editor/block-register.js
CHANGED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
( function( wp, _ ) {
|
2 |
if ( ! wp ) {
|
3 |
return;
|
@@ -11,17 +18,32 @@
|
|
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
settings = settingsClassic;
|
21 |
-
|
22 |
// Ughhhhh :-(
|
23 |
setTimeout( function() {
|
24 |
-
setDefaultBlockName(
|
25 |
}, 0 );
|
26 |
}
|
27 |
|
@@ -30,20 +52,32 @@
|
|
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 );
|
@@ -94,10 +128,6 @@
|
|
94 |
setup: this.onSetup,
|
95 |
},
|
96 |
} );
|
97 |
-
|
98 |
-
setAttributes( {
|
99 |
-
tadvType: 'classic',
|
100 |
-
} );
|
101 |
}
|
102 |
|
103 |
onSetup( editor ) {
|
@@ -184,7 +214,7 @@
|
|
184 |
ref: ( ref ) => this.ref = ref,
|
185 |
className: "block-library-classic__toolbar",
|
186 |
onClick: this.focus,
|
187 |
-
'data-placeholder':
|
188 |
onKeyDown: this.onToolbarKeyDown,
|
189 |
} ),
|
190 |
createElement( 'div', {
|
@@ -198,9 +228,52 @@
|
|
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" } ),
|
@@ -216,73 +289,109 @@
|
|
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 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
tadvType: {
|
226 |
-
type: 'string',
|
227 |
-
default: '',
|
228 |
-
},
|
229 |
-
},
|
230 |
|
231 |
supports: {
|
232 |
className: false,
|
233 |
customClassName: false,
|
234 |
-
reusable:
|
235 |
-
},
|
236 |
-
|
237 |
-
merge( attributes, attributesToMerge ) {
|
238 |
-
return {
|
239 |
-
content: attributes.content + attributesToMerge.content,
|
240 |
-
};
|
241 |
},
|
242 |
|
243 |
transforms: {
|
244 |
-
from:
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
to: [
|
252 |
{
|
253 |
-
type: '
|
254 |
blocks: [ 'core/freeform' ],
|
255 |
-
transform: (
|
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 |
-
|
280 |
-
|
281 |
-
|
282 |
-
category: 'common',
|
283 |
-
} );
|
284 |
-
|
285 |
-
// registerBlockType( 'core/paragraph', settingsParagraph );
|
286 |
-
// registerBlockType( 'core/freeform', settingsClassic );
|
287 |
|
288 |
} )( window.wp, window.lodash );
|
1 |
+
/**
|
2 |
+
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
+
* For more information please see tinymce-advanced.php.
|
4 |
+
*
|
5 |
+
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
6 |
+
*/
|
7 |
+
|
8 |
( function( wp, _ ) {
|
9 |
if ( ! wp ) {
|
10 |
return;
|
18 |
const { Path, Rect, SVG } = wp.components;
|
19 |
const { BACKSPACE, DELETE, F10 } = wp.keycodes;
|
20 |
const { addFilter } = wp.hooks;
|
|
|
21 |
|
22 |
+
const { PluginBlockSettingsMenuItem } = wp.editPost;
|
23 |
+
const { registerPlugin } = wp.plugins;
|
24 |
+
const { join, split, create, toHTMLString } = wp.richText;
|
25 |
+
const { get, assign } = _;
|
26 |
+
|
27 |
+
const {
|
28 |
+
registerBlockType,
|
29 |
+
setDefaultBlockName,
|
30 |
+
setFreeformContentHandlerName,
|
31 |
+
createBlock,
|
32 |
+
getBlockContent,
|
33 |
+
rawHandler,
|
34 |
+
} = wp.blocks;
|
35 |
+
|
36 |
+
const tadvSettings = window.tadvBlockRegister || {};
|
37 |
+
const addClassicParagraph = tadvSettings && tadvSettings.classicParagraph;
|
38 |
+
const defaultBlock = addClassicParagraph ? 'tadv/classic-paragraph' : 'core/freeform';
|
39 |
+
|
40 |
+
addFilter( 'blocks.registerBlockType', 'tadv-reregister-blocks', function ( settings, name ) {
|
41 |
+
if ( name === 'core/freeform' ) {
|
42 |
settings = settingsClassic;
|
43 |
+
|
44 |
// Ughhhhh :-(
|
45 |
setTimeout( function() {
|
46 |
+
setDefaultBlockName( defaultBlock );
|
47 |
}, 0 );
|
48 |
}
|
49 |
|
52 |
|
53 |
function isTmceEmpty( editor ) {
|
54 |
const body = editor.getBody();
|
55 |
+
|
56 |
if ( body.childNodes.length > 1 ) {
|
57 |
return false;
|
58 |
} else if ( body.childNodes.length === 0 ) {
|
59 |
return true;
|
60 |
}
|
61 |
+
|
62 |
if ( body.childNodes[ 0 ].childNodes.length > 1 ) {
|
63 |
return false;
|
64 |
}
|
65 |
+
|
66 |
return /^\n?$/.test( body.innerText || body.textContent );
|
67 |
}
|
68 |
|
69 |
+
function getTitle( blockName ) {
|
70 |
+
if ( blockName === 'core/freeform' ) {
|
71 |
+
return _x( 'Classic', 'block title' );
|
72 |
+
} else {
|
73 |
+
if ( tadvSettings && tadvSettings.classicParagraphTitle ) {
|
74 |
+
return tadvSettings.classicParagraphTitle;
|
75 |
+
}
|
76 |
+
|
77 |
+
return __( 'Classic Paragraph' );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
class ClassicEdit extends Component {
|
82 |
constructor( props ) {
|
83 |
super( props );
|
128 |
setup: this.onSetup,
|
129 |
},
|
130 |
} );
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
|
133 |
onSetup( editor ) {
|
214 |
ref: ( ref ) => this.ref = ref,
|
215 |
className: "block-library-classic__toolbar",
|
216 |
onClick: this.focus,
|
217 |
+
'data-placeholder': getTitle( this.props.name ),
|
218 |
onKeyDown: this.onToolbarKeyDown,
|
219 |
} ),
|
220 |
createElement( 'div', {
|
228 |
|
229 |
const settings = {
|
230 |
keywords: [ __( 'text' ) ],
|
231 |
+
category: 'common',
|
232 |
+
|
233 |
+
icon: 'welcome-widgets-menus',
|
234 |
+
|
235 |
+
/*
|
236 |
+
icon: {
|
237 |
+
background: '#f8f9f9',
|
238 |
+
foreground: '#006289',
|
239 |
+
src: 'welcome-widgets-menus',
|
240 |
+
},
|
241 |
+
*/
|
242 |
+
|
243 |
+
attributes: {
|
244 |
+
content: {
|
245 |
+
type: 'string',
|
246 |
+
source: 'html',
|
247 |
+
},
|
248 |
+
},
|
249 |
+
|
250 |
+
merge( attributes, attributesToMerge ) {
|
251 |
+
return {
|
252 |
+
content: attributes.content + attributesToMerge.content,
|
253 |
+
};
|
254 |
+
},
|
255 |
+
|
256 |
+
edit: ClassicEdit,
|
257 |
+
|
258 |
+
save( { attributes } ) {
|
259 |
+
const { content } = attributes;
|
260 |
+
|
261 |
+
return createElement( RawHTML, null, content );
|
262 |
+
},
|
263 |
+
};
|
264 |
+
|
265 |
+
const settingsClassic = assign( {}, settings, {
|
266 |
+
title: getTitle( 'core/freeform' ),
|
267 |
+
name: 'core/freeform',
|
268 |
|
269 |
description: __( 'Use the classic WordPress editor.' ),
|
270 |
|
271 |
+
supports: {
|
272 |
+
className: false,
|
273 |
+
customClassName: false,
|
274 |
+
reusable: false,
|
275 |
+
},
|
276 |
+
|
277 |
icon: createElement( SVG, { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
278 |
createElement( Path, { d: "M0,0h24v24H0V0z M0,0h24v24H0V0z", fill: "none" } ),
|
279 |
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" } ),
|
289 |
createElement( Rect, { x: "17", y: "11", width: "2", height: "2" } ),
|
290 |
createElement( Rect, { x: "17", y: "8", width: "2", height: "2" } )
|
291 |
),
|
292 |
+
} );
|
293 |
|
294 |
+
const settingsParagraph = assign( {}, settings, {
|
295 |
+
title: getTitle( 'tadv/classic-paragraph' ),
|
296 |
+
name: 'tadv/classic-paragraph',
|
297 |
+
|
298 |
+
description: tadvSettings ? tadvSettings.description : __( 'Paragraph block with TinyMCE, the classic WordPress editor.' ),
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
supports: {
|
301 |
className: false,
|
302 |
customClassName: false,
|
303 |
+
reusable: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
},
|
305 |
|
306 |
transforms: {
|
307 |
+
from: ( () => {
|
308 |
+
const out = [];
|
309 |
+
[
|
310 |
+
'core/freeform',
|
311 |
+
'core/code',
|
312 |
+
'core/cover',
|
313 |
+
'core/embed',
|
314 |
+
'core/gallery',
|
315 |
+
'core/heading',
|
316 |
+
'core/html',
|
317 |
+
'core/image',
|
318 |
+
'core/list',
|
319 |
+
'core/media-text',
|
320 |
+
'core/preformatted',
|
321 |
+
'core/nextpage',
|
322 |
+
'core/more',
|
323 |
+
'core/quote',
|
324 |
+
'core/pullquote',
|
325 |
+
'core/separator',
|
326 |
+
// 'core/shortcode',
|
327 |
+
'core/subhead',
|
328 |
+
'core/table',
|
329 |
+
'core/verse',
|
330 |
+
'core/video',
|
331 |
+
'core/audio',
|
332 |
+
].forEach( ( blockName ) => {
|
333 |
+
out.push( {
|
334 |
+
type: 'block',
|
335 |
+
blocks: [ blockName ],
|
336 |
+
transform: ( attributes ) => {
|
337 |
+
const html = getBlockContent( createBlock( blockName, attributes ) );
|
338 |
+
return createBlock( 'tadv/classic-paragraph', { content: html } );
|
339 |
+
},
|
340 |
+
} );
|
341 |
+
} );
|
342 |
+
|
343 |
+
out.push(
|
344 |
+
{
|
345 |
+
type: 'raw',
|
346 |
+
priority: 21,
|
347 |
+
isMatch: () => true,
|
348 |
+
},
|
349 |
+
{
|
350 |
+
type: 'block',
|
351 |
+
isMultiBlock: true,
|
352 |
+
blocks: [ 'core/paragraph' ],
|
353 |
+
transform: ( attributes ) => {
|
354 |
+
const html = toHTMLString( {
|
355 |
+
value: join( attributes.map( ( { content } ) =>
|
356 |
+
create( { html: content } )
|
357 |
+
), '\u2028' ),
|
358 |
+
multilineTag: 'p',
|
359 |
+
} );
|
360 |
+
|
361 |
+
return createBlock( 'tadv/classic-paragraph', { content: html } );
|
362 |
+
},
|
363 |
+
},
|
364 |
+
);
|
365 |
+
|
366 |
+
return out;
|
367 |
+
} )(),
|
368 |
to: [
|
369 |
{
|
370 |
+
type: 'block',
|
371 |
blocks: [ 'core/freeform' ],
|
372 |
+
transform: ( attributes ) => createBlock( 'core/freeform', attributes ),
|
|
|
|
|
|
|
|
|
373 |
},
|
374 |
+
{
|
375 |
+
type: 'block',
|
376 |
+
blocks: [ 'core/paragraph' ],
|
377 |
+
transform: ( attributes ) => {
|
378 |
+
let html = attributes.content;
|
379 |
+
|
380 |
+
if ( ! html ) {
|
381 |
+
html = '­';
|
382 |
+
} else if ( html.indexOf( '</p>' ) === -1 ) {
|
383 |
+
html += '­';
|
384 |
+
}
|
385 |
+
|
386 |
+
return rawHandler( { HTML: html } );
|
387 |
+
},
|
388 |
+
}
|
389 |
],
|
390 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
} );
|
392 |
|
393 |
+
if ( addClassicParagraph ) {
|
394 |
+
registerBlockType( 'tadv/classic-paragraph', settingsParagraph );
|
395 |
+
}
|
|
|
|
|
|
|
|
|
|
|
396 |
|
397 |
} )( window.wp, window.lodash );
|
block-editor/classic-paragraph.css
CHANGED
@@ -1,33 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/* Tweaks for "Classic Paragraph" */
|
2 |
|
3 |
-
/* Toolbar
|
4 |
-
.editor-block-list__block[data-type="
|
5 |
display: none;
|
6 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
@media (min-width: 600px) {
|
9 |
-
.editor-block-
|
|
|
10 |
float: right;
|
11 |
-
margin-right:
|
12 |
transform: translateY(-13px);
|
13 |
top: 14px;
|
14 |
}
|
15 |
-
|
16 |
-
.editor-block-
|
|
|
17 |
background: transparent;
|
18 |
border: none;
|
19 |
}
|
20 |
|
21 |
-
.editor-block-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
margin-top: 0;
|
23 |
border: none;
|
24 |
}
|
25 |
-
|
26 |
-
.editor-block-
|
|
|
27 |
content: "";
|
28 |
display: block;
|
29 |
-
border-left: 1px solid #e2e4e7;
|
30 |
margin-top: 4px;
|
31 |
margin-bottom: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
1 |
+
/**
|
2 |
+
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
+
* For more information please see tinymce-advanced.php.
|
4 |
+
*
|
5 |
+
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
6 |
+
*/
|
7 |
+
|
8 |
/* Tweaks for "Classic Paragraph" */
|
9 |
|
10 |
+
/* Toolbar
|
11 |
+
.editor-block-list__block[data-type="tadv/classic-paragraph"] .editor-block-contextual-toolbar .editor-block-switcher {
|
12 |
display: none;
|
13 |
}
|
14 |
+
*/
|
15 |
+
|
16 |
+
div.mce-toolbar .mce-btn-group {
|
17 |
+
padding: 3px 4px;
|
18 |
+
}
|
19 |
+
|
20 |
+
div.mce-toolbar-grp.mce-container > div {
|
21 |
+
padding: 0;
|
22 |
+
}
|
23 |
|
24 |
@media (min-width: 600px) {
|
25 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar,
|
26 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar {
|
27 |
float: right;
|
28 |
+
margin-right: 71px;
|
29 |
transform: translateY(-13px);
|
30 |
top: 14px;
|
31 |
}
|
32 |
+
|
33 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > div.wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .components-toolbar,
|
34 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > div.wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .components-toolbar {
|
35 |
background: transparent;
|
36 |
border: none;
|
37 |
}
|
38 |
|
39 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > div.wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .components-toolbar button:hover,
|
40 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > div.wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .components-toolbar button:hover {
|
41 |
+
background: transparent;
|
42 |
+
}
|
43 |
+
|
44 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .editor-block-toolbar,
|
45 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .editor-block-toolbar {
|
46 |
margin-top: 0;
|
47 |
border: none;
|
48 |
}
|
49 |
+
|
50 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .editor-block-toolbar::before,
|
51 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar .editor-block-toolbar::before {
|
52 |
content: "";
|
53 |
display: block;
|
|
|
54 |
margin-top: 4px;
|
55 |
margin-bottom: 4px;
|
56 |
+
border: none;
|
57 |
+
}
|
58 |
+
|
59 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-toolbar.mce-stack-layout-item,
|
60 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-toolbar.mce-stack-layout-item {
|
61 |
+
padding-right: 71px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-toolbar.mce-stack-layout-item,
|
65 |
+
.editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-toolbar.mce-stack-layout-item {
|
66 |
+
padding: 0;
|
67 |
+
}
|
68 |
+
|
69 |
+
/* RTL */
|
70 |
+
.rtl .editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar,
|
71 |
+
.rtl .editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar {
|
72 |
+
float: left;
|
73 |
+
margin-left: 23px;
|
74 |
+
margin-right: 0;
|
75 |
+
}
|
76 |
+
|
77 |
+
.rtl .editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="tadv/classic-paragraph"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-toolbar.mce-stack-layout-item,
|
78 |
+
.rtl .editor-writing-flow > div > div > .editor-block-list__layout > .wp-block[data-type="core/freeform"] > .editor-block-list__block-edit > div[data-block] > .block-library-classic__toolbar .mce-toolbar.mce-stack-layout-item {
|
79 |
+
padding-right: 0;
|
80 |
+
padding-left: 71px;
|
81 |
}
|
82 |
}
|
css/tadv-styles.css
CHANGED
@@ -35,6 +35,14 @@
|
|
35 |
font-weight: bold;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
.advanced-options {
|
39 |
margin: 40px 0;
|
40 |
}
|
@@ -328,10 +336,10 @@ div.tadv-error {
|
|
328 |
margin: 6px 0;
|
329 |
}
|
330 |
|
331 |
-
|
332 |
-
|
333 |
}
|
334 |
|
335 |
-
|
336 |
height: 60px;
|
337 |
}
|
35 |
font-weight: bold;
|
36 |
}
|
37 |
|
38 |
+
.tinymce-advanced label {
|
39 |
+
vertical-align: baseline;
|
40 |
+
}
|
41 |
+
|
42 |
+
.tinymce-advanced input[type="checkbox"] {
|
43 |
+
vertical-align: text-bottom;
|
44 |
+
}
|
45 |
+
|
46 |
.advanced-options {
|
47 |
margin: 40px 0;
|
48 |
}
|
336 |
margin: 6px 0;
|
337 |
}
|
338 |
|
339 |
+
.tadv-block-editor.tadvdropzone {
|
340 |
+
height: 60px;
|
341 |
}
|
342 |
|
343 |
+
#toolbar_classic_block {
|
344 |
height: 60px;
|
345 |
}
|
mce/wptadv/plugin.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
6 |
*/
|
|
|
7 |
( function( tinymce ) {
|
8 |
tinymce.PluginManager.add( 'wptadv', function( editor ) {
|
9 |
var noAutop = ( ! editor.settings.wpautop && editor.settings.tadv_noautop );
|
4 |
*
|
5 |
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
6 |
*/
|
7 |
+
|
8 |
( function( tinymce ) {
|
9 |
tinymce.PluginManager.add( 'wptadv', function( editor ) {
|
10 |
var noAutop = ( ! editor.settings.wpautop && editor.settings.tadv_noautop );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.
|
7 |
Requires PHP: 5.2
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -13,10 +13,10 @@ Extends and enhances TinyMCE, the visual editor used in both the Classic Editor
|
|
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
|
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 |
|
@@ -28,10 +28,12 @@ In addition this plugin adds some commonly used options as keeping the paragraph
|
|
28 |
= Some of the features added by this plugin =
|
29 |
|
30 |
* Hybrid mode that lets you use the best of both editors.
|
31 |
-
*
|
32 |
-
*
|
33 |
-
*
|
34 |
-
*
|
|
|
|
|
35 |
* And many others.
|
36 |
|
37 |
= Privacy =
|
@@ -46,6 +48,11 @@ Best is to install directly from WordPress. If manual installation is required,
|
|
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.
|
@@ -252,5 +259,5 @@ Please post on the support forum or visit the homepage for [TinyMCE Advanced](ht
|
|
252 |
|
253 |
== Upgrade Notice ==
|
254 |
|
255 |
-
= 4.8.
|
256 |
-
|
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.2
|
7 |
Requires PHP: 5.2
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
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 includes the TinyMCE editor.
|
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 and Classic Paragraph 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 |
|
28 |
= Some of the features added by this plugin =
|
29 |
|
30 |
* Hybrid mode that lets you use the best of both editors.
|
31 |
+
* Includes a "Classic Paragraph Block" that can be used instead of or together with the default Paragraph Block.
|
32 |
+
* Supports converting of most default blocks to "classic" paragraphs, and from classic paragraphs back to the default blocks.
|
33 |
+
* Support for creating and editing tables in the Classic Blocks and the Classic Editor.
|
34 |
+
* More options when inserting lists in the Classic Blocks and the Classic Editor.
|
35 |
+
* Search and Replace in the Classic Blocks and the Classic Editor.
|
36 |
+
* Ability to set Font Family and Font Sizes in the Classic Blocks and the Classic Editor.
|
37 |
* And many others.
|
38 |
|
39 |
= Privacy =
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 4.8.2 =
|
52 |
+
* Fixes and improvements for 4.8.1.
|
53 |
+
* Added separate option to enable the Classic Paragraph Block.
|
54 |
+
* Added converting of most default blocks to classic paragraphs, and from classic paragraphs to default blocks.
|
55 |
+
|
56 |
= 4.8.1 =
|
57 |
* Updated for WordPress 5.0.
|
58 |
* Added Hybrid Mode for the Block Editor. Includes a Classic Paragraph Block that replaces the default Paragraph Block.
|
259 |
|
260 |
== Upgrade Notice ==
|
261 |
|
262 |
+
= 4.8.2 =
|
263 |
+
Fixes and improvements for 4.8.1. Includes a Classic Paragraph Block. Can convert most default blocks to and from classic paragraphs.
|
screenshot-5.png
CHANGED
Binary file
|
tadv_admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
4 |
* For more information please see tinymce-advanced.php.
|
5 |
*
|
6 |
-
* Copyright (c) 2007-
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'TADV_ADMIN_PAGE' ) ) {
|
@@ -16,9 +16,6 @@ if ( ! current_user_can( 'manage_options' ) ) {
|
|
16 |
}
|
17 |
|
18 |
$message = '';
|
19 |
-
|
20 |
-
$this->set_paths();
|
21 |
-
$imgpath = TADV_URL . 'images/';
|
22 |
$tadv_options_updated = false;
|
23 |
$settings = $admin_settings = array();
|
24 |
|
@@ -106,10 +103,6 @@ if ( isset( $_POST['tadv-save'] ) ) {
|
|
106 |
}
|
107 |
}
|
108 |
|
109 |
-
if ( empty( $_POST ) ) {
|
110 |
-
$this->check_plugin_version();
|
111 |
-
}
|
112 |
-
|
113 |
$this->load_settings();
|
114 |
|
115 |
if ( empty( $this->toolbar_1 ) && empty( $this->toolbar_2 ) && empty( $this->toolbar_3 ) && empty( $this->toolbar_4 ) ) {
|
@@ -326,7 +319,7 @@ for ( $i = 1; $i < 5; $i++ ) {
|
|
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( '
|
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">
|
@@ -481,7 +474,7 @@ for ( $i = 1; $i < 5; $i++ ) {
|
|
481 |
<h3><?php _e( 'Options', 'tinymce-advanced' ); ?></h3>
|
482 |
|
483 |
<div>
|
484 |
-
<input type="checkbox" name="options[]" value="
|
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>
|
@@ -521,23 +514,32 @@ if ( ! is_multisite() || current_user_can( 'manage_sites' ) ) {
|
|
521 |
<div class="advanced-options">
|
522 |
<h3><?php _e( 'Advanced Options', 'tinymce-advanced' ); ?></h3>
|
523 |
<div>
|
524 |
-
<input type="checkbox" name="admin_options[]" value="
|
525 |
-
<label for="
|
526 |
-
<p><strong><?php _e( 'Brings the best of both editors together!', 'tinymce-advanced' ); ?></strong></p>
|
527 |
<p>
|
528 |
-
|
|
|
|
|
529 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
<p>
|
531 |
-
<?php _e( '
|
532 |
-
<?php _e( '
|
533 |
-
<?php _e( '
|
|
|
534 |
</p>
|
535 |
<p>
|
536 |
-
<?php _e( '
|
537 |
-
<?php _e( '
|
538 |
</p>
|
539 |
<?php echo $preselect ?>
|
540 |
</div>
|
|
|
541 |
<div>
|
542 |
<?php
|
543 |
|
3 |
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
4 |
* For more information please see tinymce-advanced.php.
|
5 |
*
|
6 |
+
* Copyright (c) 2007-2018 Andrew Ozz. All rights reserved.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'TADV_ADMIN_PAGE' ) ) {
|
16 |
}
|
17 |
|
18 |
$message = '';
|
|
|
|
|
|
|
19 |
$tadv_options_updated = false;
|
20 |
$settings = $admin_settings = array();
|
21 |
|
103 |
}
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
106 |
$this->load_settings();
|
107 |
|
108 |
if ( empty( $this->toolbar_1 ) && empty( $this->toolbar_2 ) && empty( $this->toolbar_3 ) && empty( $this->toolbar_4 ) ) {
|
319 |
</p>
|
320 |
|
321 |
<div class="tadv-mce-menu tadv-block-editor mce-container mce-menubar mce-toolbar mce-first mce-stack-layout-item
|
322 |
+
<?php if ( $this->check_user_setting( 'menubar_block' ) ) { echo ' enabled'; } ?>">
|
323 |
<div class="mce-container-body mce-flow-layout">
|
324 |
<div class="mce-widget mce-btn mce-menubtn mce-first mce-flow-layout-item">
|
325 |
<button type="button">
|
474 |
<h3><?php _e( 'Options', 'tinymce-advanced' ); ?></h3>
|
475 |
|
476 |
<div>
|
477 |
+
<input type="checkbox" name="options[]" value="merge_toolbars" id="merge_toolbars" <?php if ( $this->check_user_setting( 'merge_toolbars' ) ) echo ' checked'; ?> />
|
478 |
<label for="merge_toolbars"><?php _e( 'Append all buttons to the top toolbar in the Classic and Classic Paragraph blocks.', 'tinymce-advanced' ); ?></label>
|
479 |
<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>
|
480 |
</div>
|
514 |
<div class="advanced-options">
|
515 |
<h3><?php _e( 'Advanced Options', 'tinymce-advanced' ); ?></h3>
|
516 |
<div>
|
517 |
+
<input type="checkbox" name="admin_options[]" value="hybrid_mode" id="hybrid_mode" <?php if ( $this->check_admin_setting( 'hybrid_mode' ) ) echo ' checked'; ?> />
|
518 |
+
<label for="hybrid_mode"><?php _e( 'Hybrid Block Editor Mode', 'tinymce-advanced' ); ?></label>
|
|
|
519 |
<p>
|
520 |
+
<strong><?php _e( 'Brings the best of both editors together.', 'tinymce-advanced' ); ?></strong>
|
521 |
+
<?php _e( 'Selecting this option makes the Classic Block in the Block Editor somewhat more prominent and adds improvements and fixes for it.', 'tinymce-advanced' ); ?>
|
522 |
+
<?php _e( 'By default most existing TinyMCE plugins and add-ons will continue to work there.', 'tinymce-advanced' ); ?>
|
523 |
</p>
|
524 |
+
<?php echo $preselect ?>
|
525 |
+
</div>
|
526 |
+
|
527 |
+
<div>
|
528 |
+
<input type="checkbox" name="admin_options[]" value="classic_paragraph_block" id="classic_paragraph_block" <?php if ( $this->check_admin_setting( 'classic_paragraph_block' ) ) echo ' checked'; ?> />
|
529 |
+
<label for="classic_paragraph_block"><?php _e( 'Add “Classic Paragraph” Block.', 'tinymce-advanced' ); ?></label>
|
530 |
<p>
|
531 |
+
<?php _e( 'The Classic Paragraph Block includes the familiar TinyMCE editor and behaves similarly to the Classic Block.', 'tinymce-advanced' ); ?>
|
532 |
+
<?php _e( 'You can add multiple paragraphs, tables, galleries, embed video, set fonts and colors, and generally use everything that is available in the Classic Editor and the Classic Block.', 'tinymce-advanced' ); ?>
|
533 |
+
<?php _e( 'Also, like the Classic Block, most existing TinyMCE plugins and add-ons will continue to work.', 'tinymce-advanced' ); ?>
|
534 |
+
<?php _e( 'This makes the Block Editor more familiar, easier to use, easier to get used to, and more compatible with your existing workflow.', 'tinymce-advanced' ); ?>
|
535 |
</p>
|
536 |
<p>
|
537 |
+
<?php _e( 'It has several advantages over the Classic Block. Most importantly, nearly all default blocks can be converted to classic paragraphs.', 'tinymce-advanced' ); ?>
|
538 |
+
<?php _e( 'It can be used everywhere instead of the default Paragraph Block including in columns, when creating reusable blocks, etc.', 'tinymce-advanced' ); ?>
|
539 |
</p>
|
540 |
<?php echo $preselect ?>
|
541 |
</div>
|
542 |
+
|
543 |
<div>
|
544 |
<?php
|
545 |
|
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.
|
7 |
Author: Andrew Ozz
|
8 |
Author URI: http://www.laptoptips.ca/
|
9 |
License: GPL2
|
@@ -36,7 +36,7 @@ if ( ! class_exists('Tinymce_Advanced') ) :
|
|
36 |
class Tinymce_Advanced {
|
37 |
|
38 |
private $required_version = '4.9.6';
|
39 |
-
private $plugin_version = '4.8.
|
40 |
|
41 |
private $user_settings;
|
42 |
private $admin_settings;
|
@@ -68,7 +68,7 @@ class Tinymce_Advanced {
|
|
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' => '',
|
@@ -80,7 +80,7 @@ class Tinymce_Advanced {
|
|
80 |
|
81 |
private function get_default_admin_settings() {
|
82 |
return array(
|
83 |
-
'options' =>
|
84 |
);
|
85 |
}
|
86 |
|
@@ -112,7 +112,7 @@ class Tinymce_Advanced {
|
|
112 |
'menubar',
|
113 |
'menubar_block',
|
114 |
'fontsize_formats',
|
115 |
-
'
|
116 |
);
|
117 |
}
|
118 |
|
@@ -121,7 +121,8 @@ class Tinymce_Advanced {
|
|
121 |
'importcss',
|
122 |
'no_autop',
|
123 |
'paste_images',
|
124 |
-
'
|
|
|
125 |
'replace_block_editor',
|
126 |
);
|
127 |
}
|
@@ -135,11 +136,8 @@ class Tinymce_Advanced {
|
|
135 |
}
|
136 |
|
137 |
public function __construct() {
|
138 |
-
|
139 |
register_activation_hook( __FILE__, array( $this, 'check_plugin_version' ) );
|
140 |
|
141 |
-
add_action( 'plugins_loaded', array( $this, 'set_paths' ), 50 );
|
142 |
-
|
143 |
if ( is_admin() ) {
|
144 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
145 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
@@ -160,7 +158,6 @@ class Tinymce_Advanced {
|
|
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 |
|
@@ -227,27 +224,17 @@ class Tinymce_Advanced {
|
|
227 |
return '';
|
228 |
}
|
229 |
|
230 |
-
// When using a plugin that changes the paths dinamically, set these earlier than 'plugins_loaded' 50.
|
231 |
-
public function set_paths() {
|
232 |
-
if ( ! defined( 'TADV_URL' ) ) {
|
233 |
-
define( 'TADV_URL', plugin_dir_url( __FILE__ ) );
|
234 |
-
}
|
235 |
-
|
236 |
-
if ( ! defined( 'TADV_PATH' ) ) {
|
237 |
-
define( 'TADV_PATH', plugin_dir_path( __FILE__ ) );
|
238 |
-
}
|
239 |
-
}
|
240 |
-
|
241 |
public function load_textdomain() {
|
242 |
load_plugin_textdomain( 'tinymce-advanced', false, 'tinymce-advanced/langs' );
|
243 |
}
|
244 |
|
245 |
public function enqueue_scripts( $page ) {
|
246 |
-
if ( 'settings_page_tinymce-advanced'
|
247 |
-
$
|
248 |
-
|
249 |
-
|
250 |
-
wp_enqueue_style( 'tadv-
|
|
|
251 |
|
252 |
add_action( 'admin_footer', array( $this, 'load_mce_translation' ) );
|
253 |
}
|
@@ -359,7 +346,37 @@ class Tinymce_Advanced {
|
|
359 |
|
360 |
update_option( 'tadv_settings', $this->user_settings );
|
361 |
update_option( 'tadv_admin_settings', $this->admin_settings );
|
362 |
-
update_option( 'tadv_version',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
}
|
364 |
|
365 |
if ( $version < 4000 ) {
|
@@ -485,9 +502,6 @@ class Tinymce_Advanced {
|
|
485 |
if ( in_array( 'code', $this->used_buttons, true ) )
|
486 |
$plugins[] = 'code';
|
487 |
|
488 |
-
// if ( in_array( 'insertlayer', $this->used_buttons, true ) )
|
489 |
-
// $plugins[] = 'layer';
|
490 |
-
|
491 |
// From options
|
492 |
if ( $this->check_user_setting( 'advlist' ) )
|
493 |
$plugins[] = 'advlist';
|
@@ -640,12 +654,12 @@ class Tinymce_Advanced {
|
|
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 |
-
|
649 |
! empty( $init['toolbar1'] ) &&
|
650 |
is_string( $init['toolbar1'] )
|
651 |
) {
|
@@ -699,22 +713,23 @@ class Tinymce_Advanced {
|
|
699 |
public function block_editor_assets() {
|
700 |
$plugin_url = plugins_url( 'block-editor', __FILE__ );
|
701 |
|
702 |
-
if (
|
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 |
-
|
707 |
-
|
|
|
|
|
|
|
|
|
|
|
708 |
|
709 |
-
|
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 |
-
|
718 |
}
|
719 |
|
720 |
public function block_editor_init() {
|
@@ -731,10 +746,6 @@ class Tinymce_Advanced {
|
|
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 |
}
|
@@ -756,13 +767,12 @@ class Tinymce_Advanced {
|
|
756 |
|
757 |
$this->plugins = array_intersect( $this->plugins, $this->get_all_plugins() );
|
758 |
|
759 |
-
$
|
760 |
-
$plugpath = TADV_URL . 'mce/';
|
761 |
$mce_plugins = (array) $mce_plugins;
|
762 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
763 |
|
764 |
foreach ( $this->plugins as $plugin ) {
|
765 |
-
$mce_plugins["$plugin"] = $
|
766 |
}
|
767 |
|
768 |
return $mce_plugins;
|
@@ -877,15 +887,7 @@ class Tinymce_Advanced {
|
|
877 |
if ( ! empty( $user_settings['options'] ) ) {
|
878 |
$options = explode( ',', $user_settings['options'] );
|
879 |
} elseif ( ! empty( $_POST['options'] ) && is_array( $_POST['options'] ) ) {
|
880 |
-
$
|
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 |
}
|
@@ -937,15 +939,7 @@ class Tinymce_Advanced {
|
|
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 |
-
$
|
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'] ) ) {
|
@@ -970,8 +964,7 @@ class Tinymce_Advanced {
|
|
970 |
define( 'TADV_ADMIN_PAGE', true );
|
971 |
}
|
972 |
|
973 |
-
|
974 |
-
include_once( TADV_PATH . 'tadv_admin.php' );
|
975 |
}
|
976 |
|
977 |
public function add_menu() {
|
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.2
|
7 |
Author: Andrew Ozz
|
8 |
Author URI: http://www.laptoptips.ca/
|
9 |
License: GPL2
|
36 |
class Tinymce_Advanced {
|
37 |
|
38 |
private $required_version = '4.9.6';
|
39 |
+
private $plugin_version = '4.8.2';
|
40 |
|
41 |
private $user_settings;
|
42 |
private $admin_settings;
|
68 |
|
69 |
private function get_default_user_settings() {
|
70 |
return array(
|
71 |
+
'options' => 'menubar,advlist,menubar_block,merge_toolbars',
|
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' => '',
|
80 |
|
81 |
private function get_default_admin_settings() {
|
82 |
return array(
|
83 |
+
'options' => 'hybrid_mode,classic_paragraph_block',
|
84 |
);
|
85 |
}
|
86 |
|
112 |
'menubar',
|
113 |
'menubar_block',
|
114 |
'fontsize_formats',
|
115 |
+
'merge_toolbars',
|
116 |
);
|
117 |
}
|
118 |
|
121 |
'importcss',
|
122 |
'no_autop',
|
123 |
'paste_images',
|
124 |
+
'hybrid_mode',
|
125 |
+
'classic_paragraph_block',
|
126 |
'replace_block_editor',
|
127 |
);
|
128 |
}
|
136 |
}
|
137 |
|
138 |
public function __construct() {
|
|
|
139 |
register_activation_hook( __FILE__, array( $this, 'check_plugin_version' ) );
|
140 |
|
|
|
|
|
141 |
if ( is_admin() ) {
|
142 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
143 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
158 |
add_filter( 'tiny_mce_plugins', array( $this, 'tiny_mce_plugins' ), 999 );
|
159 |
|
160 |
add_action( 'enqueue_block_editor_assets', array( $this, 'block_editor_assets' ), 20 );
|
|
|
161 |
|
162 |
add_action( 'init', array( $this, 'block_editor_init' ) );
|
163 |
|
224 |
return '';
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
public function load_textdomain() {
|
228 |
load_plugin_textdomain( 'tinymce-advanced', false, 'tinymce-advanced/langs' );
|
229 |
}
|
230 |
|
231 |
public function enqueue_scripts( $page ) {
|
232 |
+
if ( 'settings_page_tinymce-advanced' === $page ) {
|
233 |
+
$plugin_url = plugin_dir_url( __FILE__ );
|
234 |
+
|
235 |
+
wp_enqueue_script( 'tadv-js', $plugin_url . 'js/tadv.js', array( 'jquery-ui-sortable' ), $this->plugin_version, true );
|
236 |
+
wp_enqueue_style( 'tadv-mce-skin', includes_url( 'js/tinymce/skins/lightgray/skin.min.css' ), array(), $this->plugin_version );
|
237 |
+
wp_enqueue_style( 'tadv-css', $plugin_url . 'css/tadv-styles.css', array( 'editor-buttons' ), $this->plugin_version );
|
238 |
|
239 |
add_action( 'admin_footer', array( $this, 'load_mce_translation' ) );
|
240 |
}
|
346 |
|
347 |
update_option( 'tadv_settings', $this->user_settings );
|
348 |
update_option( 'tadv_admin_settings', $this->admin_settings );
|
349 |
+
update_option( 'tadv_version', 4820 );
|
350 |
+
} elseif ( $version < 4820 ) {
|
351 |
+
// Update for WP 5.0
|
352 |
+
$admin_settings = get_option( 'tadv_admin_settings', false );
|
353 |
+
$user_settings = get_option( 'tadv_settings', false );
|
354 |
+
|
355 |
+
$admin = $admin_settings['options'];
|
356 |
+
$user = $user_settings['options'];
|
357 |
+
|
358 |
+
if ( empty( $admin ) ) {
|
359 |
+
$admin = 'hybrid_mode,classic_paragraph_block';
|
360 |
+
} elseif ( strpos( $admin, 'no_hybrid_mode' ) !== false ) {
|
361 |
+
$admin = str_replace( 'no_hybrid_mode', 'classic_paragraph_block', $admin );
|
362 |
+
} else {
|
363 |
+
$admin .= ',hybrid_mode,classic_paragraph_block';
|
364 |
+
}
|
365 |
+
|
366 |
+
if ( empty( $user ) ) {
|
367 |
+
$user = 'menubar_block,merge_toolbars';
|
368 |
+
} elseif ( strpos( $user, 'no_merge_toolbars' ) !== false ) {
|
369 |
+
$user = str_replace( 'no_merge_toolbars', 'menubar_block', $user );
|
370 |
+
} else {
|
371 |
+
$user .= ',menubar_block,merge_toolbars';
|
372 |
+
}
|
373 |
+
|
374 |
+
$admin_settings['options'] = $admin;
|
375 |
+
$user_settings['options'] = $user;
|
376 |
+
|
377 |
+
update_option( 'tadv_admin_settings', $admin_settings );
|
378 |
+
update_option( 'tadv_settings', $user_settings );
|
379 |
+
update_option( 'tadv_version', 4820 );
|
380 |
}
|
381 |
|
382 |
if ( $version < 4000 ) {
|
502 |
if ( in_array( 'code', $this->used_buttons, true ) )
|
503 |
$plugins[] = 'code';
|
504 |
|
|
|
|
|
|
|
505 |
// From options
|
506 |
if ( $this->check_user_setting( 'advlist' ) )
|
507 |
$plugins[] = 'advlist';
|
654 |
}
|
655 |
|
656 |
if ( $editor_id === 'classic-block' ) {
|
657 |
+
if ( $this->check_user_setting( 'menubar_block' ) ) {
|
658 |
$init['menubar'] = true;
|
659 |
}
|
660 |
|
661 |
if (
|
662 |
+
$this->check_user_setting( 'merge_toolbars' ) &&
|
663 |
! empty( $init['toolbar1'] ) &&
|
664 |
is_string( $init['toolbar1'] )
|
665 |
) {
|
713 |
public function block_editor_assets() {
|
714 |
$plugin_url = plugins_url( 'block-editor', __FILE__ );
|
715 |
|
716 |
+
if ( $this->check_admin_setting( 'hybrid_mode' ) || $this->check_admin_setting( 'classic_paragraph_block' ) ) {
|
717 |
+
$dependencies = array( 'wp-element', 'wp-components', 'wp-i18n', 'wp-keycodes', 'wp-blocks', 'wp-edit-post', 'wp-hooks', 'lodash' );
|
718 |
+
wp_enqueue_script( 'tadv-block-register', $plugin_url . '/block-register.js', $dependencies, $this->plugin_version );
|
719 |
|
720 |
+
if ( $this->check_admin_setting( 'classic_paragraph_block' ) ) {
|
721 |
+
$strings = array(
|
722 |
+
'classicParagraphTitle' => __( 'Classic Paragraph', 'tinymce-advanced' ),
|
723 |
+
'classicParagraph' => 'yes',
|
724 |
+
'description' => __( 'Can be used instead of the default Paragraph Block. Allows conversions to and from most default blocks, including Image, Table, Paragraph, Quote, Classic, and most others.', 'tinymce-advanced' ),
|
725 |
+
);
|
726 |
+
wp_localize_script( 'tadv-block-register', 'tadvBlockRegister', $strings );
|
727 |
|
728 |
+
wp_enqueue_style( 'tadv-classic-paragraph-styles', $plugin_url . '/classic-paragraph.css', array(), $this->plugin_version );
|
729 |
+
}
|
|
|
|
|
|
|
|
|
730 |
}
|
731 |
|
732 |
+
wp_enqueue_style( 'tadv-block-editor-styles', $plugin_url . '/block-editor.css', array(), $this->plugin_version );
|
733 |
}
|
734 |
|
735 |
public function block_editor_init() {
|
746 |
$content = str_replace( '<p data-tadv-p=\"keep\">', '<p>', $content );
|
747 |
}
|
748 |
|
|
|
|
|
|
|
|
|
749 |
$data['post_content'] = $content;
|
750 |
return $data;
|
751 |
}
|
767 |
|
768 |
$this->plugins = array_intersect( $this->plugins, $this->get_all_plugins() );
|
769 |
|
770 |
+
$plugin_url = plugins_url( 'mce/', __FILE__ );
|
|
|
771 |
$mce_plugins = (array) $mce_plugins;
|
772 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
773 |
|
774 |
foreach ( $this->plugins as $plugin ) {
|
775 |
+
$mce_plugins["$plugin"] = $plugin_url . $plugin . "/plugin{$suffix}.js";
|
776 |
}
|
777 |
|
778 |
return $mce_plugins;
|
887 |
if ( ! empty( $user_settings['options'] ) ) {
|
888 |
$options = explode( ',', $user_settings['options'] );
|
889 |
} elseif ( ! empty( $_POST['options'] ) && is_array( $_POST['options'] ) ) {
|
890 |
+
$options = $_POST['options'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
891 |
} else {
|
892 |
$options = array();
|
893 |
}
|
939 |
$disabled_editors = array_intersect( $this->get_editor_locations(), explode( ',', $admin_settings['disabled_editors'] ) );
|
940 |
} elseif ( isset( $_POST['tadv-save'] ) ) {
|
941 |
if ( ! empty( $_POST['admin_options'] ) && is_array( $_POST['admin_options'] ) ) {
|
942 |
+
$save_admin_settings['options'] = $this->validate_settings( $_POST['admin_options'], $this->get_all_admin_options() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
943 |
}
|
944 |
|
945 |
if ( ! empty( $_POST['tadv_enable_at'] ) && is_array( $_POST['tadv_enable_at'] ) ) {
|
964 |
define( 'TADV_ADMIN_PAGE', true );
|
965 |
}
|
966 |
|
967 |
+
include_once( plugin_dir_path( __FILE__ ) . 'tadv_admin.php' );
|
|
|
968 |
}
|
969 |
|
970 |
public function add_menu() {
|