Version Description
- Bug fix when richedit is enabled.
- Add filter hook
tinymce_templates_enable_media_buttons
.
Download this release
Release Info
Developer | miyauchi |
Plugin | TinyMCE Templates |
Version | 4.4.0 |
Comparing to | |
See all releases |
Code changes from version 4.3.6 to 4.4.0
- js/tinymce-templates.js +4 -5
- readme.txt +14 -2
- tinymce-templates.php +5 -3
js/tinymce-templates.js
CHANGED
@@ -65,7 +65,7 @@ var tinymceTemplates;
|
|
65 |
for (var i=0; i<tags.length; i++) {
|
66 |
var tag = tags[i].match(/[a-zA-Z0-9_]+/);
|
67 |
if ('content' === tag[0]) {
|
68 |
-
is_content = '
|
69 |
continue;
|
70 |
}
|
71 |
args.push(tag[0] + '=""');
|
@@ -73,9 +73,9 @@ var tinymceTemplates;
|
|
73 |
}
|
74 |
|
75 |
if (0 < args.length) {
|
76 |
-
html = '
|
77 |
} else {
|
78 |
-
html = '
|
79 |
}
|
80 |
|
81 |
wp.media.editor.insert(html);
|
@@ -127,8 +127,7 @@ var tinymceTemplates;
|
|
127 |
dataType: 'json',
|
128 |
data: args
|
129 |
}).done(function(data){
|
130 |
-
var
|
131 |
-
var styles = content_css.replace(/(\s+)/g, "").split(',');
|
132 |
|
133 |
var html = '<!DOCTYPE html><html><head>';
|
134 |
html += '<style>body{ padding: 0 !important; margin: 20px !important; }</style>';
|
65 |
for (var i=0; i<tags.length; i++) {
|
66 |
var tag = tags[i].match(/[a-zA-Z0-9_]+/);
|
67 |
if ('content' === tag[0]) {
|
68 |
+
is_content = '[/template]';
|
69 |
continue;
|
70 |
}
|
71 |
args.push(tag[0] + '=""');
|
73 |
}
|
74 |
|
75 |
if (0 < args.length) {
|
76 |
+
html = '[template id="' + tinymceTemplates.template_id + '" ' + args.join(' ')+']' + is_contentz;
|
77 |
} else {
|
78 |
+
html = '[template id="' + tinymceTemplates.template_id + '"]' + is_content;
|
79 |
}
|
80 |
|
81 |
wp.media.editor.insert(html);
|
127 |
dataType: 'json',
|
128 |
data: args
|
129 |
}).done(function(data){
|
130 |
+
var styles = tinymce_templates_editor_stylesheets;
|
|
|
131 |
|
132 |
var html = '<!DOCTYPE html><html><head>';
|
133 |
html += '<style>body{ padding: 0 !important; margin: 20px !important; }</style>';
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: miyauchi
|
3 |
Tags: tinymce, Visual Editor, template
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 4.
|
7 |
|
8 |
TinyMCE Template plugin will enable to use HTML template on WordPress Visual Editor.
|
9 |
|
@@ -39,6 +39,13 @@ TinyMCE Template plugin will enable to use HTML template on WordPress Visual Edi
|
|
39 |
|
40 |
You can send your own language pack to me.
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
== Installation ==
|
44 |
|
@@ -56,6 +63,11 @@ You can send your own language pack to me.
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
= 4.3.6 =
|
60 |
|
61 |
* Update German translation.
|
2 |
Contributors: miyauchi
|
3 |
Tags: tinymce, Visual Editor, template
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.3
|
6 |
+
Stable tag: 4.4.0
|
7 |
|
8 |
TinyMCE Template plugin will enable to use HTML template on WordPress Visual Editor.
|
9 |
|
39 |
|
40 |
You can send your own language pack to me.
|
41 |
|
42 |
+
= Note =
|
43 |
+
|
44 |
+
How to display insert template button on wysiwyg editor of the ACF.
|
45 |
+
|
46 |
+
add_filter( 'tinymce_templates_enable_media_buttons', function(){
|
47 |
+
return true; // Displays insert template button on all visual editors
|
48 |
+
} );
|
49 |
|
50 |
== Installation ==
|
51 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 4.4.0 =
|
67 |
+
|
68 |
+
* Bug fix when richedit is enabled.
|
69 |
+
* Add filter hook `tinymce_templates_enable_media_buttons`.
|
70 |
+
|
71 |
= 4.3.6 =
|
72 |
|
73 |
* Update German translation.
|
tinymce-templates.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: TinyMCE Templates
|
|
4 |
Plugin URI: http://miya0001.github.io/tinymce-templates/
|
5 |
Description: TinyMCE Templates plugin will enable to use HTML template on WordPress Visual Editor.
|
6 |
Author: Takayuki Miyauchi
|
7 |
-
Version: 4.
|
8 |
Author URI: http://miya0001.github.io/tinymce-templates/
|
9 |
Domain Path: /languages
|
10 |
Text Domain: tinymce_templates
|
@@ -199,7 +199,8 @@ class TinyMCE_Templates
|
|
199 |
*/
|
200 |
public function media_buttons( $editor_id = 'content' )
|
201 |
{
|
202 |
-
|
|
|
203 |
$button_html = '<a id="%s" class="%s" href="#" data-editor="%s" title="%s">';
|
204 |
$button_html .= '<span class="%s" style="%s"></span> %s';
|
205 |
$button_html .= '</a>';
|
@@ -547,8 +548,9 @@ class TinyMCE_Templates
|
|
547 |
);
|
548 |
?>
|
549 |
<script type="text/javascript">
|
550 |
-
var tinymce_templates_list_uri = '<?php echo $url; ?>';
|
551 |
var tinymce_templates_list_args = <?php echo json_encode($args); ?>;
|
|
|
552 |
</script>
|
553 |
<?php
|
554 |
}
|
4 |
Plugin URI: http://miya0001.github.io/tinymce-templates/
|
5 |
Description: TinyMCE Templates plugin will enable to use HTML template on WordPress Visual Editor.
|
6 |
Author: Takayuki Miyauchi
|
7 |
+
Version: 4.4.0
|
8 |
Author URI: http://miya0001.github.io/tinymce-templates/
|
9 |
Domain Path: /languages
|
10 |
Text Domain: tinymce_templates
|
199 |
*/
|
200 |
public function media_buttons( $editor_id = 'content' )
|
201 |
{
|
202 |
+
$editors = apply_filters( 'tinymce_templates_editors', array( 'content' ), $editor_id );
|
203 |
+
if ( apply_filters( 'tinymce_templates_enable_media_buttons', in_array( $editor_id, $editors ), $editor_id ) ) {
|
204 |
$button_html = '<a id="%s" class="%s" href="#" data-editor="%s" title="%s">';
|
205 |
$button_html .= '<span class="%s" style="%s"></span> %s';
|
206 |
$button_html .= '</a>';
|
548 |
);
|
549 |
?>
|
550 |
<script type="text/javascript">
|
551 |
+
var tinymce_templates_list_uri = '<?php echo esc_url( $url ); ?>';
|
552 |
var tinymce_templates_list_args = <?php echo json_encode($args); ?>;
|
553 |
+
var tinymce_templates_editor_stylesheets = <?php echo json_encode(get_editor_stylesheets() ); ?>;
|
554 |
</script>
|
555 |
<?php
|
556 |
}
|