Version Description
- HTML and CSS optimization by using WordPress native editor markup and styles
- Adoption of WordPress JS minification conventions (".min" suffix)
- Integration with WordPress SCRIPT_DEBUG constant for javascript debugging purposes
- Enhanced compatibility with 3rd party media buttons provider (i.e. Shortcodes Ultimate)
- Enhanced plugin internal version handling
- Duplicated widget IDs detection
- Added Rate link
- Added compatibility with WordPress Language packs
- Added ukrainian translation (Contributor: Michael Yunat getvoip.com)
- Fixed notice on theme_advanced_buttons1 parameter
- Fixed z-index issue with WordPress 3.9 admin menu on small screens
Download this release
Release Info
Developer | marcochiesi |
Plugin | Black Studio TinyMCE Widget |
Version | 1.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.3 to 1.4
- black-studio-tinymce-widget-legacy.css +70 -0
- black-studio-tinymce-widget-legacy.dev.js +0 -131
- black-studio-tinymce-widget-legacy.js +131 -1
- black-studio-tinymce-widget-legacy.min.js +1 -0
- black-studio-tinymce-widget.css +0 -66
- black-studio-tinymce-widget.dev.js +0 -147
- black-studio-tinymce-widget.js +160 -1
- black-studio-tinymce-widget.min.js +1 -0
- black-studio-tinymce-widget.php +56 -36
- languages/black-studio-tinymce-widget-it_IT.mo +0 -0
- languages/black-studio-tinymce-widget-it_IT.po +20 -7
- languages/black-studio-tinymce-widget_uk_UA.mo +0 -0
- languages/black-studio-tinymce-widget_uk_UA.po +37 -0
- readme.txt +16 -2
black-studio-tinymce-widget-legacy.css
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* CSS Document */
|
2 |
+
|
3 |
+
#mce_fullscreen_container {
|
4 |
+
background-color: white;
|
5 |
+
}
|
6 |
+
|
7 |
+
#wp-black-studio-tinymce-widget-wrap {
|
8 |
+
display: none;
|
9 |
+
}
|
10 |
+
|
11 |
+
.editor_container {
|
12 |
+
background-color: #FFF;
|
13 |
+
border-color: #DEDEDE;
|
14 |
+
border-style: solid;
|
15 |
+
border-width: 1px;
|
16 |
+
border-collapse: separate;
|
17 |
+
border-top-right-radius: 3px;
|
18 |
+
border-top-left-radius: 3px;
|
19 |
+
padding: 0 1px 1px 1px;
|
20 |
+
clear: both;
|
21 |
+
}
|
22 |
+
.editor_toggle_buttons {
|
23 |
+
margin-right: 15px;
|
24 |
+
margin-top: 8px;
|
25 |
+
float: right;
|
26 |
+
}
|
27 |
+
.editor_toggle_buttons a {
|
28 |
+
background: none repeat scroll 0 0 #EBEBEB;
|
29 |
+
border: 1px solid #DEDEDE;
|
30 |
+
color: #777777;
|
31 |
+
cursor: pointer;
|
32 |
+
float: right;
|
33 |
+
font: 13px/19px "Open Sans",sans-serif;
|
34 |
+
margin: 5px 0 0 5px;
|
35 |
+
padding: 3px 8px 4px;
|
36 |
+
position: relative;
|
37 |
+
top: 1px;
|
38 |
+
}
|
39 |
+
.editor_toggle_buttons a.active {
|
40 |
+
background: none repeat scroll 0 0 #F5F5F5;
|
41 |
+
border-bottom: 0 none;
|
42 |
+
color: #555555;
|
43 |
+
height: 20px;
|
44 |
+
}
|
45 |
+
.editor_toggle_buttons_legacy a.active {
|
46 |
+
border-color: #CCC #CCC #E9E9E9;
|
47 |
+
background-color: #E9E9E9;
|
48 |
+
}
|
49 |
+
.editor_media_buttons {
|
50 |
+
cursor: default;
|
51 |
+
padding: 8px 8px;
|
52 |
+
height: 22px;
|
53 |
+
}
|
54 |
+
.editor_media_buttons a {
|
55 |
+
cursor: pointer;
|
56 |
+
text-decoration: none;
|
57 |
+
color: #333;
|
58 |
+
font-size: 12px;
|
59 |
+
margin-right: 8px;
|
60 |
+
}
|
61 |
+
.editor_media_buttons img {
|
62 |
+
vertical-align: middle;
|
63 |
+
padding: 0 4px;
|
64 |
+
}
|
65 |
+
.editor_links {
|
66 |
+
font-size: 10px;
|
67 |
+
text-align: right;
|
68 |
+
padding-top: 3px;
|
69 |
+
padding-bottom: 3px;
|
70 |
+
}
|
black-studio-tinymce-widget-legacy.dev.js
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
// TinyMCE initialization parameters
|
2 |
-
var tinyMCEPreInit;
|
3 |
-
// Current editor (backward compatibility)
|
4 |
-
var edCanvas;
|
5 |
-
// Current editor
|
6 |
-
var wpActiveEditor;
|
7 |
-
|
8 |
-
(function($) {
|
9 |
-
// Activate visual editor
|
10 |
-
function black_studio_activate_visual_editor(id) {
|
11 |
-
$('#'+id).addClass("mceEditor");
|
12 |
-
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
|
13 |
-
black_studio_deactivate_visual_editor(id);
|
14 |
-
if (typeof (tinyMCEPreInit.mceInit['black-studio-tinymce-widget']) == "object") { // WP 3.3+
|
15 |
-
tinyMCEPreInit.mceInit[id] = tinyMCEPreInit.mceInit['black-studio-tinymce-widget'];
|
16 |
-
tinyMCEPreInit.mceInit[id]["elements"] = id;
|
17 |
-
try {
|
18 |
-
// Instantiate new TinyMCE editor
|
19 |
-
tinymce.init(tinymce.extend( {}, tinyMCEPreInit.mceInit['black-studio-tinymce-widget'], tinyMCEPreInit.mceInit[id] ));
|
20 |
-
} catch(e){
|
21 |
-
alert(e);
|
22 |
-
}
|
23 |
-
}
|
24 |
-
else { // WP 3.2
|
25 |
-
tinyMCE.execCommand("mceAddControl", false, id);
|
26 |
-
}
|
27 |
-
}
|
28 |
-
}
|
29 |
-
// Deactivate visual editor
|
30 |
-
function black_studio_deactivate_visual_editor(id) {
|
31 |
-
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
|
32 |
-
if (typeof(tinyMCE.get(id)) == "object") {
|
33 |
-
var content = tinyMCE.get(id).getContent();
|
34 |
-
tinyMCE.execCommand("mceRemoveControl", false, id);
|
35 |
-
$('textarea#'+id).val(content);
|
36 |
-
}
|
37 |
-
}
|
38 |
-
}
|
39 |
-
// Activate editor deferred (used upon opening the widget)
|
40 |
-
function black_studio_open_deferred_activate_visual_editor(id) {
|
41 |
-
$('div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]').each(function() {
|
42 |
-
// If textarea is visible and animation/ajax has completed (or in accessibility mode) then trigger a click to Visual button and enable the editor
|
43 |
-
if ($('div.widget:has(#' + id + ') :animated').size() == 0 && typeof(tinyMCE.get(id)) != "object" && $('#' + id).is(':visible')) {
|
44 |
-
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
45 |
-
}
|
46 |
-
// Otherwise wait and retry later (animation ongoing)
|
47 |
-
else if (typeof(tinyMCE.get(id)) != "object") {
|
48 |
-
setTimeout(function(){black_studio_open_deferred_activate_visual_editor(id);id=null;}, 100);
|
49 |
-
}
|
50 |
-
// If editor instance is already existing (i.e. dragged from another sidebar) just activate it
|
51 |
-
else {
|
52 |
-
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
53 |
-
}
|
54 |
-
});
|
55 |
-
}
|
56 |
-
|
57 |
-
// Activate editor deferred (used upon ajax requests)
|
58 |
-
function black_studio_ajax_deferred_activate_visual_editor(id) {
|
59 |
-
$('div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]').each(function() {
|
60 |
-
// If textarea is visible and animation/ajax has completed then trigger a click to Visual button and enable the editor
|
61 |
-
if ($.active == 0 && typeof(tinyMCE.get(id)) != "object" && $('#' + id).is(':visible')) {
|
62 |
-
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
63 |
-
}
|
64 |
-
// Otherwise wait and retry later (animation ongoing)
|
65 |
-
else if ($('div.widget:has(#' + id + ') div.widget-inside').is(':visible') && typeof(tinyMCE.get(id)) != "object") {
|
66 |
-
setTimeout(function(){black_studio_ajax_deferred_activate_visual_editor(id);id=null;}, 100);
|
67 |
-
}
|
68 |
-
});
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
// Document ready stuff
|
73 |
-
$(document).ready(function(){
|
74 |
-
// Event handler for widget opening button
|
75 |
-
$('div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action').live('click', function(event){
|
76 |
-
event.preventDefault();
|
77 |
-
var $widget = $(this).closest('div.widget');
|
78 |
-
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $widget);
|
79 |
-
$('#wpbody-content').css('overflow', 'visible'); // needed for small screens
|
80 |
-
$widget.css('position', 'relative').css('z-index', '100'); // needed for small screens
|
81 |
-
black_studio_open_deferred_activate_visual_editor($text_area.attr('id'));
|
82 |
-
});
|
83 |
-
// Force BS handler of opening button to be executed before the one coming with Wordpress
|
84 |
-
$(document).data("events").click.unshift($(document).data("events").click.pop());
|
85 |
-
// Event handler for widget saving button
|
86 |
-
$('div.widget[id*=black-studio-tinymce] input[name=savewidget]').live('click', function(event){
|
87 |
-
event.preventDefault();
|
88 |
-
var $widget = $(this).closest('div.widget')
|
89 |
-
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $widget);
|
90 |
-
if (typeof(tinyMCE.get($text_area.attr('id'))) == "object") {
|
91 |
-
black_studio_deactivate_visual_editor($text_area.attr('id'));
|
92 |
-
}
|
93 |
-
// Event handler for ajax complete
|
94 |
-
$(this).unbind('ajaxSuccess').ajaxSuccess(function(event, xhr, settings) {
|
95 |
-
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $(this).closest('div.widget-inside'));
|
96 |
-
black_studio_ajax_deferred_activate_visual_editor($text_area.attr('id'));
|
97 |
-
});
|
98 |
-
});
|
99 |
-
// Force BS handler of save button to be executed before the one coming with Wordpress
|
100 |
-
$(document).data("events").click.unshift($(document).data("events").click.pop());
|
101 |
-
// Event handler for visual switch button
|
102 |
-
$('a[id^=widget-black-studio-tinymce][id$=visual]').live('click', function(event){
|
103 |
-
event.preventDefault();
|
104 |
-
var $widget_inside = $(this).closest('div.widget-inside')
|
105 |
-
$('input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside).val('visual');
|
106 |
-
$(this).addClass('active');
|
107 |
-
$('a[id^=widget-black-studio-tinymce][id$=html]', $widget_inside).removeClass('active');
|
108 |
-
black_studio_activate_visual_editor($('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id'));
|
109 |
-
});
|
110 |
-
// Event handler for html switch button
|
111 |
-
$('a[id^=widget-black-studio-tinymce][id$=html]').live('click', function(event){
|
112 |
-
event.preventDefault();
|
113 |
-
var $widget_inside = $(this).closest('div.widget-inside')
|
114 |
-
$('input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside).val('html');
|
115 |
-
$(this).addClass('active');
|
116 |
-
$('a[id^=widget-black-studio-tinymce][id$=visual]', $widget_inside).removeClass('active');
|
117 |
-
black_studio_deactivate_visual_editor($('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id'));
|
118 |
-
});
|
119 |
-
// Set edCanvas/wpActiveEditor variables used when adding media from media library dialog
|
120 |
-
$('.editor_media_buttons a').live('click', function(){
|
121 |
-
var $widget_inside = $(this).closest('div.widget-inside')
|
122 |
-
edCanvas = $('textarea[id^=widget-black-studio-tinymce]', $widget_inside).get();
|
123 |
-
wpActiveEditor = $('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id');
|
124 |
-
});
|
125 |
-
// Activate editor when in accessibility mode
|
126 |
-
if($('body.widgets_access').size() > 0) {
|
127 |
-
var $text_area = $('textarea[id^=widget-black-studio-tinymce]');
|
128 |
-
black_studio_open_deferred_activate_visual_editor($text_area.attr('id'));
|
129 |
-
}
|
130 |
-
});
|
131 |
-
})(jQuery); // end self-invoked wrapper function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
black-studio-tinymce-widget-legacy.js
CHANGED
@@ -1 +1,131 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// TinyMCE initialization parameters
|
2 |
+
var tinyMCEPreInit;
|
3 |
+
// Current editor (backward compatibility)
|
4 |
+
var edCanvas;
|
5 |
+
// Current editor
|
6 |
+
var wpActiveEditor;
|
7 |
+
|
8 |
+
(function($) {
|
9 |
+
// Activate visual editor
|
10 |
+
function black_studio_activate_visual_editor(id) {
|
11 |
+
$('#'+id).addClass("mceEditor");
|
12 |
+
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
|
13 |
+
black_studio_deactivate_visual_editor(id);
|
14 |
+
if (typeof (tinyMCEPreInit.mceInit['black-studio-tinymce-widget']) == "object") { // WP 3.3+
|
15 |
+
tinyMCEPreInit.mceInit[id] = tinyMCEPreInit.mceInit['black-studio-tinymce-widget'];
|
16 |
+
tinyMCEPreInit.mceInit[id]["elements"] = id;
|
17 |
+
try {
|
18 |
+
// Instantiate new TinyMCE editor
|
19 |
+
tinymce.init(tinymce.extend( {}, tinyMCEPreInit.mceInit['black-studio-tinymce-widget'], tinyMCEPreInit.mceInit[id] ));
|
20 |
+
} catch(e){
|
21 |
+
alert(e);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
else { // WP 3.2
|
25 |
+
tinyMCE.execCommand("mceAddControl", false, id);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
// Deactivate visual editor
|
30 |
+
function black_studio_deactivate_visual_editor(id) {
|
31 |
+
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
|
32 |
+
if (typeof(tinyMCE.get(id)) == "object") {
|
33 |
+
var content = tinyMCE.get(id).getContent();
|
34 |
+
tinyMCE.execCommand("mceRemoveControl", false, id);
|
35 |
+
$('textarea#'+id).val(content);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
// Activate editor deferred (used upon opening the widget)
|
40 |
+
function black_studio_open_deferred_activate_visual_editor(id) {
|
41 |
+
$('div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]').each(function() {
|
42 |
+
// If textarea is visible and animation/ajax has completed (or in accessibility mode) then trigger a click to Visual button and enable the editor
|
43 |
+
if ($('div.widget:has(#' + id + ') :animated').size() == 0 && typeof(tinyMCE.get(id)) != "object" && $('#' + id).is(':visible')) {
|
44 |
+
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
45 |
+
}
|
46 |
+
// Otherwise wait and retry later (animation ongoing)
|
47 |
+
else if (typeof(tinyMCE.get(id)) != "object") {
|
48 |
+
setTimeout(function(){black_studio_open_deferred_activate_visual_editor(id);id=null;}, 100);
|
49 |
+
}
|
50 |
+
// If editor instance is already existing (i.e. dragged from another sidebar) just activate it
|
51 |
+
else {
|
52 |
+
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
53 |
+
}
|
54 |
+
});
|
55 |
+
}
|
56 |
+
|
57 |
+
// Activate editor deferred (used upon ajax requests)
|
58 |
+
function black_studio_ajax_deferred_activate_visual_editor(id) {
|
59 |
+
$('div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]').each(function() {
|
60 |
+
// If textarea is visible and animation/ajax has completed then trigger a click to Visual button and enable the editor
|
61 |
+
if ($.active == 0 && typeof(tinyMCE.get(id)) != "object" && $('#' + id).is(':visible')) {
|
62 |
+
$('a[id^=widget-black-studio-tinymce][id$=visual]', $(this).closest('div.widget-inside')).click();
|
63 |
+
}
|
64 |
+
// Otherwise wait and retry later (animation ongoing)
|
65 |
+
else if ($('div.widget:has(#' + id + ') div.widget-inside').is(':visible') && typeof(tinyMCE.get(id)) != "object") {
|
66 |
+
setTimeout(function(){black_studio_ajax_deferred_activate_visual_editor(id);id=null;}, 100);
|
67 |
+
}
|
68 |
+
});
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
// Document ready stuff
|
73 |
+
$(document).ready(function(){
|
74 |
+
// Event handler for widget opening button
|
75 |
+
$('div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action').live('click', function(event){
|
76 |
+
event.preventDefault();
|
77 |
+
var $widget = $(this).closest('div.widget');
|
78 |
+
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $widget);
|
79 |
+
$('#wpbody-content').css('overflow', 'visible'); // needed for small screens
|
80 |
+
$widget.css('position', 'relative').css('z-index', '100'); // needed for small screens
|
81 |
+
black_studio_open_deferred_activate_visual_editor($text_area.attr('id'));
|
82 |
+
});
|
83 |
+
// Force BS handler of opening button to be executed before the one coming with Wordpress
|
84 |
+
$(document).data("events").click.unshift($(document).data("events").click.pop());
|
85 |
+
// Event handler for widget saving button
|
86 |
+
$('div.widget[id*=black-studio-tinymce] input[name=savewidget]').live('click', function(event){
|
87 |
+
event.preventDefault();
|
88 |
+
var $widget = $(this).closest('div.widget')
|
89 |
+
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $widget);
|
90 |
+
if (typeof(tinyMCE.get($text_area.attr('id'))) == "object") {
|
91 |
+
black_studio_deactivate_visual_editor($text_area.attr('id'));
|
92 |
+
}
|
93 |
+
// Event handler for ajax complete
|
94 |
+
$(this).unbind('ajaxSuccess').ajaxSuccess(function(event, xhr, settings) {
|
95 |
+
var $text_area = $('textarea[id^=widget-black-studio-tinymce]', $(this).closest('div.widget-inside'));
|
96 |
+
black_studio_ajax_deferred_activate_visual_editor($text_area.attr('id'));
|
97 |
+
});
|
98 |
+
});
|
99 |
+
// Force BS handler of save button to be executed before the one coming with Wordpress
|
100 |
+
$(document).data("events").click.unshift($(document).data("events").click.pop());
|
101 |
+
// Event handler for visual switch button
|
102 |
+
$('a[id^=widget-black-studio-tinymce][id$=visual]').live('click', function(event){
|
103 |
+
event.preventDefault();
|
104 |
+
var $widget_inside = $(this).closest('div.widget-inside')
|
105 |
+
$('input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside).val('visual');
|
106 |
+
$(this).addClass('active');
|
107 |
+
$('a[id^=widget-black-studio-tinymce][id$=html]', $widget_inside).removeClass('active');
|
108 |
+
black_studio_activate_visual_editor($('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id'));
|
109 |
+
});
|
110 |
+
// Event handler for html switch button
|
111 |
+
$('a[id^=widget-black-studio-tinymce][id$=html]').live('click', function(event){
|
112 |
+
event.preventDefault();
|
113 |
+
var $widget_inside = $(this).closest('div.widget-inside')
|
114 |
+
$('input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside).val('html');
|
115 |
+
$(this).addClass('active');
|
116 |
+
$('a[id^=widget-black-studio-tinymce][id$=visual]', $widget_inside).removeClass('active');
|
117 |
+
black_studio_deactivate_visual_editor($('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id'));
|
118 |
+
});
|
119 |
+
// Set edCanvas/wpActiveEditor variables used when adding media from media library dialog
|
120 |
+
$('.editor_media_buttons a').live('click', function(){
|
121 |
+
var $widget_inside = $(this).closest('div.widget-inside')
|
122 |
+
edCanvas = $('textarea[id^=widget-black-studio-tinymce]', $widget_inside).get();
|
123 |
+
wpActiveEditor = $('textarea[id^=widget-black-studio-tinymce]', $widget_inside).attr('id');
|
124 |
+
});
|
125 |
+
// Activate editor when in accessibility mode
|
126 |
+
if($('body.widgets_access').size() > 0) {
|
127 |
+
var $text_area = $('textarea[id^=widget-black-studio-tinymce]');
|
128 |
+
black_studio_open_deferred_activate_visual_editor($text_area.attr('id'));
|
129 |
+
}
|
130 |
+
});
|
131 |
+
})(jQuery); // end self-invoked wrapper function
|
black-studio-tinymce-widget-legacy.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var tinyMCEPreInit;var edCanvas;var wpActiveEditor;(function(c){function d(g){c("#"+g).addClass("mceEditor");if(typeof(tinyMCE)=="object"&&typeof(tinyMCE.execCommand)=="function"){b(g);if(typeof(tinyMCEPreInit.mceInit["black-studio-tinymce-widget"])=="object"){tinyMCEPreInit.mceInit[g]=tinyMCEPreInit.mceInit["black-studio-tinymce-widget"];tinyMCEPreInit.mceInit[g]["elements"]=g;try{tinymce.init(tinymce.extend({},tinyMCEPreInit.mceInit["black-studio-tinymce-widget"],tinyMCEPreInit.mceInit[g]))}catch(f){alert(f)}}else{tinyMCE.execCommand("mceAddControl",false,g)}}}function b(g){if(typeof(tinyMCE)=="object"&&typeof(tinyMCE.execCommand)=="function"){if(typeof(tinyMCE.get(g))=="object"){var f=tinyMCE.get(g).getContent();tinyMCE.execCommand("mceRemoveControl",false,g);c("textarea#"+g).val(f)}}}function a(f){c("div.widget-inside:has(#"+f+") input[id^=widget-black-studio-tinymce][id$=type][value=visual]").each(function(){if(c("div.widget:has(#"+f+") :animated").size()==0&&typeof(tinyMCE.get(f))!="object"&&c("#"+f).is(":visible")){c("a[id^=widget-black-studio-tinymce][id$=visual]",c(this).closest("div.widget-inside")).click()}else{if(typeof(tinyMCE.get(f))!="object"){setTimeout(function(){a(f);f=null},100)}else{c("a[id^=widget-black-studio-tinymce][id$=visual]",c(this).closest("div.widget-inside")).click()}}})}function e(f){c("div.widget-inside:has(#"+f+") input[id^=widget-black-studio-tinymce][id$=type][value=visual]").each(function(){if(c.active==0&&typeof(tinyMCE.get(f))!="object"&&c("#"+f).is(":visible")){c("a[id^=widget-black-studio-tinymce][id$=visual]",c(this).closest("div.widget-inside")).click()}else{if(c("div.widget:has(#"+f+") div.widget-inside").is(":visible")&&typeof(tinyMCE.get(f))!="object"){setTimeout(function(){e(f);f=null},100)}}})}c(document).ready(function(){c("div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action").live("click",function(g){g.preventDefault();var i=c(this).closest("div.widget");var h=c("textarea[id^=widget-black-studio-tinymce]",i);c("#wpbody-content").css("overflow","visible");i.css("position","relative").css("z-index","100");a(h.attr("id"))});c(document).data("events").click.unshift(c(document).data("events").click.pop());c("div.widget[id*=black-studio-tinymce] input[name=savewidget]").live("click",function(g){g.preventDefault();var i=c(this).closest("div.widget");var h=c("textarea[id^=widget-black-studio-tinymce]",i);if(typeof(tinyMCE.get(h.attr("id")))=="object"){b(h.attr("id"))}c(this).unbind("ajaxSuccess").ajaxSuccess(function(k,l,j){var m=c("textarea[id^=widget-black-studio-tinymce]",c(this).closest("div.widget-inside"));e(m.attr("id"))})});c(document).data("events").click.unshift(c(document).data("events").click.pop());c("a[id^=widget-black-studio-tinymce][id$=visual]").live("click",function(g){g.preventDefault();var h=c(this).closest("div.widget-inside");c("input[id^=widget-black-studio-tinymce][id$=type]",h).val("visual");c(this).addClass("active");c("a[id^=widget-black-studio-tinymce][id$=html]",h).removeClass("active");d(c("textarea[id^=widget-black-studio-tinymce]",h).attr("id"))});c("a[id^=widget-black-studio-tinymce][id$=html]").live("click",function(g){g.preventDefault();var h=c(this).closest("div.widget-inside");c("input[id^=widget-black-studio-tinymce][id$=type]",h).val("html");c(this).addClass("active");c("a[id^=widget-black-studio-tinymce][id$=visual]",h).removeClass("active");b(c("textarea[id^=widget-black-studio-tinymce]",h).attr("id"))});c(".editor_media_buttons a").live("click",function(){var g=c(this).closest("div.widget-inside");edCanvas=c("textarea[id^=widget-black-studio-tinymce]",g).get();wpActiveEditor=c("textarea[id^=widget-black-studio-tinymce]",g).attr("id")});if(c("body.widgets_access").size()>0){var f=c("textarea[id^=widget-black-studio-tinymce]");a(f.attr("id"))}})})(jQuery);
|
black-studio-tinymce-widget.css
CHANGED
@@ -1,70 +1,4 @@
|
|
1 |
/* CSS Document */
|
2 |
-
|
3 |
-
#mce_fullscreen_container {
|
4 |
-
background-color: white;
|
5 |
-
}
|
6 |
-
|
7 |
#wp-black-studio-tinymce-widget-wrap {
|
8 |
display: none;
|
9 |
-
}
|
10 |
-
|
11 |
-
.editor_container {
|
12 |
-
background-color: #FFF;
|
13 |
-
border-color: #DEDEDE;
|
14 |
-
border-style: solid;
|
15 |
-
border-width: 1px;
|
16 |
-
border-collapse: separate;
|
17 |
-
border-top-right-radius: 3px;
|
18 |
-
border-top-left-radius: 3px;
|
19 |
-
padding: 0 1px 1px 1px;
|
20 |
-
clear: both;
|
21 |
-
}
|
22 |
-
.editor_toggle_buttons {
|
23 |
-
margin-right: 15px;
|
24 |
-
margin-top: 8px;
|
25 |
-
float: right;
|
26 |
-
}
|
27 |
-
.editor_toggle_buttons a {
|
28 |
-
background: none repeat scroll 0 0 #EBEBEB;
|
29 |
-
border: 1px solid #DEDEDE;
|
30 |
-
color: #777777;
|
31 |
-
cursor: pointer;
|
32 |
-
float: right;
|
33 |
-
font: 13px/19px "Open Sans",sans-serif;
|
34 |
-
margin: 5px 0 0 5px;
|
35 |
-
padding: 3px 8px 4px;
|
36 |
-
position: relative;
|
37 |
-
top: 1px;
|
38 |
-
}
|
39 |
-
.editor_toggle_buttons a.active {
|
40 |
-
background: none repeat scroll 0 0 #F5F5F5;
|
41 |
-
border-bottom: 0 none;
|
42 |
-
color: #555555;
|
43 |
-
height: 20px;
|
44 |
-
}
|
45 |
-
.editor_toggle_buttons_legacy a.active {
|
46 |
-
border-color: #CCC #CCC #E9E9E9;
|
47 |
-
background-color: #E9E9E9;
|
48 |
-
}
|
49 |
-
.editor_media_buttons {
|
50 |
-
cursor: default;
|
51 |
-
padding: 8px 8px;
|
52 |
-
height: 22px;
|
53 |
-
}
|
54 |
-
.editor_media_buttons a {
|
55 |
-
cursor: pointer;
|
56 |
-
text-decoration: none;
|
57 |
-
color: #333;
|
58 |
-
font-size: 12px;
|
59 |
-
margin-right: 8px;
|
60 |
-
}
|
61 |
-
.editor_media_buttons img {
|
62 |
-
vertical-align: middle;
|
63 |
-
padding: 0 4px;
|
64 |
-
}
|
65 |
-
.editor_links {
|
66 |
-
font-size: 10px;
|
67 |
-
text-align: right;
|
68 |
-
padding-top: 3px;
|
69 |
-
padding-bottom: 3px;
|
70 |
}
|
1 |
/* CSS Document */
|
|
|
|
|
|
|
|
|
|
|
2 |
#wp-black-studio-tinymce-widget-wrap {
|
3 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
black-studio-tinymce-widget.dev.js
DELETED
@@ -1,147 +0,0 @@
|
|
1 |
-
// TinyMCE initialization parameters
|
2 |
-
var tinyMCEPreInit;
|
3 |
-
// Current editor
|
4 |
-
var wpActiveEditor;
|
5 |
-
|
6 |
-
(function( $ ) {
|
7 |
-
// Activate visual editor
|
8 |
-
function black_studio_activate_visual_editor(id) {
|
9 |
-
$( '#' + id ).addClass( 'mceEditor' );
|
10 |
-
if ( typeof tinyMCE == 'object' && typeof tinyMCE.execCommand == 'function' ) {
|
11 |
-
black_studio_deactivate_visual_editor( id );
|
12 |
-
tinyMCEPreInit.mceInit[id] = tinyMCEPreInit.mceInit['black-studio-tinymce-widget'];
|
13 |
-
tinyMCEPreInit.mceInit[id]['selector'] = '#' + id;
|
14 |
-
try {
|
15 |
-
// Instantiate new TinyMCE editor
|
16 |
-
tinymce.init( tinymce.extend( {}, tinyMCEPreInit.mceInit['black-studio-tinymce-widget'], tinyMCEPreInit.mceInit[id] ) );
|
17 |
-
tinyMCE.execCommand( 'mceAddControl', false, id );
|
18 |
-
} catch( e ) {
|
19 |
-
alert( e );
|
20 |
-
}
|
21 |
-
if ( typeof tinyMCE.get( id ).on == 'function' ) {
|
22 |
-
tinyMCE.get( id ).on( 'keyup change', function() {
|
23 |
-
var content = tinyMCE.get( id ).getContent();
|
24 |
-
$( 'textarea#' + id ).val( content ).change();
|
25 |
-
});
|
26 |
-
}
|
27 |
-
}
|
28 |
-
}
|
29 |
-
// Deactivate visual editor
|
30 |
-
function black_studio_deactivate_visual_editor( id ) {
|
31 |
-
if ( typeof tinyMCE == 'object' && typeof tinyMCE.execCommand == 'function' ) {
|
32 |
-
if ( tinyMCE.get( id ) != null && typeof tinyMCE.get( id ).getContent == 'function' ) {
|
33 |
-
var content = tinyMCE.get( id ).getContent();
|
34 |
-
// tinyMCE.execCommand('mceRemoveControl', false, id);
|
35 |
-
tinyMCE.get( id ).remove();
|
36 |
-
$( 'textarea#' + id ).val( content );
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
// Activate editor deferred (used upon opening the widget)
|
41 |
-
function black_studio_open_deferred_activate_visual_editor( id ) {
|
42 |
-
$( 'div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]' ).each(function() {
|
43 |
-
// If textarea is visible and animation/ajax has completed (or in accessibility mode) then trigger a click to Visual button and enable the editor
|
44 |
-
if ( $('div.widget:has(#' + id + ') :animated' ).size() == 0 && tinyMCE.get( id ) == null && $( '#' + id ).is( ':visible' ) ) {
|
45 |
-
$( 'a[id^=widget-black-studio-tinymce][id$=visual]', $( this ).closest( 'div.widget-inside' ) ).click();
|
46 |
-
}
|
47 |
-
// Otherwise wait and retry later (animation ongoing)
|
48 |
-
else if ( tinyMCE.get( id ) == null ) {
|
49 |
-
setTimeout(function() {
|
50 |
-
black_studio_open_deferred_activate_visual_editor( id );
|
51 |
-
id = null;
|
52 |
-
}, 100 );
|
53 |
-
}
|
54 |
-
// If editor instance is already existing (i.e. dragged from another sidebar) just activate it
|
55 |
-
else {
|
56 |
-
$( 'a[id^=widget-black-studio-tinymce][id$=visual]', $( this ).closest( 'div.widget-inside' ) ).click();
|
57 |
-
}
|
58 |
-
});
|
59 |
-
}
|
60 |
-
|
61 |
-
// Activate editor deferred (used upon ajax requests)
|
62 |
-
function black_studio_ajax_deferred_activate_visual_editor( id ) {
|
63 |
-
$( 'div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]' ).each(function() {
|
64 |
-
// If textarea is visible and animation/ajax has completed then trigger a click to Visual button and enable the editor
|
65 |
-
if ( $.active == 0 && tinyMCE.get( id ) == null && $( '#' + id ).is( ':visible' ) ) {
|
66 |
-
$( 'a[id^=widget-black-studio-tinymce][id$=visual]', $( this ).closest( 'div.widget-inside' ) ).click();
|
67 |
-
}
|
68 |
-
// Otherwise wait and retry later (animation ongoing)
|
69 |
-
else if ( $( 'div.widget:has(#' + id + ') div.widget-inside' ).is( ':visible' ) && tinyMCE.get( id ) == null ) {
|
70 |
-
setTimeout(function() {
|
71 |
-
black_studio_ajax_deferred_activate_visual_editor( id );
|
72 |
-
id=null;
|
73 |
-
}, 100 );
|
74 |
-
}
|
75 |
-
});
|
76 |
-
}
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
// Document ready stuff
|
81 |
-
$( document ).ready(function() {
|
82 |
-
// Event handler for widget opening button
|
83 |
-
$( document ).on( 'click', 'div.widget:has(textarea[id^=widget-black-studio-tinymce]) .widget-title, div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action', function( event ) {
|
84 |
-
//event.preventDefault();
|
85 |
-
var $widget = $( this ).closest( 'div.widget' );
|
86 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
87 |
-
// Event handler for widget saving button (for new instances)
|
88 |
-
$( 'input[name=savewidget]', $widget ).on( 'click', function( event ) {
|
89 |
-
var $widget = $( this ).closest( 'div.widget' )
|
90 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
91 |
-
if ( tinyMCE.get( $text_area.attr( 'id' ) ) != null ) {
|
92 |
-
black_studio_deactivate_visual_editor( $text_area.attr( 'id' ) );
|
93 |
-
}
|
94 |
-
// Event handler for ajax complete
|
95 |
-
$( this ).unbind( 'ajaxSuccess' ).ajaxSuccess( function( event, xhr, settings ) {
|
96 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $( this ).closest( 'div.widget-inside') );
|
97 |
-
black_studio_ajax_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
98 |
-
});
|
99 |
-
});
|
100 |
-
$( '#wpbody-content' ).css( 'overflow', 'visible' ); // needed for small screens
|
101 |
-
$widget.css( 'position', 'relative' ).css( 'z-index', '100' ); // needed for small screens
|
102 |
-
black_studio_open_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
103 |
-
$( '.insert-media', $widget ).data( 'editor', $text_area.attr( 'id' ) );
|
104 |
-
});
|
105 |
-
// Event handler for widget saving button (for existing instances)
|
106 |
-
$( 'div.widget[id*=black-studio-tinymce] input[name=savewidget]').on( 'click', function( event ) {
|
107 |
-
var $widget = $( this ).closest( 'div.widget' )
|
108 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
109 |
-
if ( tinyMCE.get( $text_area.attr( 'id' ) ) != null ) {
|
110 |
-
black_studio_deactivate_visual_editor( $text_area.attr( 'id' ) );
|
111 |
-
}
|
112 |
-
// Event handler for ajax complete
|
113 |
-
$( this ).unbind( 'ajaxSuccess' ).ajaxSuccess( function( event, xhr, settings ) {
|
114 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $( this ).closest( 'div.widget-inside' ) );
|
115 |
-
black_studio_ajax_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
116 |
-
});
|
117 |
-
});
|
118 |
-
// Event handler for visual switch button
|
119 |
-
$( document ).on( 'click', 'a[id^=widget-black-studio-tinymce][id$=visual]', function( event ) {
|
120 |
-
//event.preventDefault();
|
121 |
-
var $widget_inside = $( this ).closest( 'div.widget-inside,div.panel-dialog' );
|
122 |
-
$( 'input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside ).val( 'visual' );
|
123 |
-
$( this ).addClass( 'active' );
|
124 |
-
$( 'a[id^=widget-black-studio-tinymce][id$=html]', $widget_inside ).removeClass( 'active' );
|
125 |
-
black_studio_activate_visual_editor( $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' ) );
|
126 |
-
});
|
127 |
-
// Event handler for html switch button
|
128 |
-
$( document ).on( 'click', 'a[id^=widget-black-studio-tinymce][id$=html]', function( event ) {
|
129 |
-
//event.preventDefault();
|
130 |
-
var $widget_inside = $( this ).closest( 'div.widget-inside,div.panel-dialog' );
|
131 |
-
$( 'input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside ).val( 'html' );
|
132 |
-
$( this ).addClass( 'active' );
|
133 |
-
$( 'a[id^=widget-black-studio-tinymce][id$=visual]', $widget_inside ).removeClass( 'active' );
|
134 |
-
black_studio_deactivate_visual_editor( $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' ) );
|
135 |
-
});
|
136 |
-
// Set wpActiveEditor variables used when adding media from media library dialog
|
137 |
-
$( document ).on( 'click', '.editor_media_buttons a', function() {
|
138 |
-
var $widget_inside = $( this ).closest( 'div.widget-inside' );
|
139 |
-
wpActiveEditor = $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' );
|
140 |
-
});
|
141 |
-
// Activate editor when in accessibility mode
|
142 |
-
if ( $( 'body.widgets_access' ).size() > 0) {
|
143 |
-
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]' );
|
144 |
-
black_studio_open_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
145 |
-
}
|
146 |
-
});
|
147 |
-
})( jQuery ); // end self-invoked wrapper function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
black-studio-tinymce-widget.js
CHANGED
@@ -1 +1,160 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// TinyMCE initialization parameters
|
2 |
+
var tinyMCEPreInit;
|
3 |
+
// Current editor
|
4 |
+
var wpActiveEditor;
|
5 |
+
|
6 |
+
(function( $ ) {
|
7 |
+
// Activate visual editor
|
8 |
+
function black_studio_activate_visual_editor(id) {
|
9 |
+
$( '#' + id ).addClass( 'mceEditor' );
|
10 |
+
if ( typeof tinyMCE == 'object' && typeof tinyMCE.execCommand == 'function' ) {
|
11 |
+
black_studio_deactivate_visual_editor( id );
|
12 |
+
tinyMCEPreInit.mceInit[id] = tinyMCEPreInit.mceInit['black-studio-tinymce-widget'];
|
13 |
+
tinyMCEPreInit.mceInit[id]['selector'] = '#' + id;
|
14 |
+
try {
|
15 |
+
// Instantiate new TinyMCE editor
|
16 |
+
tinymce.init( tinymce.extend( {}, tinyMCEPreInit.mceInit['black-studio-tinymce-widget'], tinyMCEPreInit.mceInit[id] ) );
|
17 |
+
tinyMCE.execCommand( 'mceAddControl', false, id );
|
18 |
+
} catch( e ) {
|
19 |
+
alert( e );
|
20 |
+
}
|
21 |
+
if ( tinyMCE.get( id ) != null) {
|
22 |
+
if ( typeof tinyMCE.get( id ).on == 'function' ) {
|
23 |
+
tinyMCE.get( id ).on( 'keyup change', function() {
|
24 |
+
var content = tinyMCE.get( id ).getContent();
|
25 |
+
$( 'textarea#' + id ).val( content ).change();
|
26 |
+
});
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
// Deactivate visual editor
|
32 |
+
function black_studio_deactivate_visual_editor( id ) {
|
33 |
+
if ( typeof tinyMCE == 'object' && typeof tinyMCE.execCommand == 'function' ) {
|
34 |
+
if ( tinyMCE.get( id ) != null && typeof tinyMCE.get( id ).getContent == 'function' ) {
|
35 |
+
var content = tinyMCE.get( id ).getContent();
|
36 |
+
// tinyMCE.execCommand('mceRemoveControl', false, id);
|
37 |
+
tinyMCE.get( id ).remove();
|
38 |
+
$( 'textarea#' + id ).val( content );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
// Activate editor deferred (used upon opening the widget)
|
43 |
+
function black_studio_open_deferred_activate_visual_editor( id ) {
|
44 |
+
$( 'div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]' ).each(function() {
|
45 |
+
// If textarea is visible and animation/ajax has completed (or in accessibility mode) then trigger a click to Visual button and enable the editor
|
46 |
+
if ( $('div.widget:has(#' + id + ') :animated' ).size() == 0 && tinyMCE.get( id ) == null && $( '#' + id ).is( ':visible' ) ) {
|
47 |
+
$( 'a[id^=widget-black-studio-tinymce][id$=tmce]', $( this ).closest( 'div.widget-inside' ) ).click();
|
48 |
+
}
|
49 |
+
// Otherwise wait and retry later (animation ongoing)
|
50 |
+
else if ( tinyMCE.get( id ) == null ) {
|
51 |
+
setTimeout(function() {
|
52 |
+
black_studio_open_deferred_activate_visual_editor( id );
|
53 |
+
id = null;
|
54 |
+
}, 100 );
|
55 |
+
}
|
56 |
+
// If editor instance is already existing (i.e. dragged from another sidebar) just activate it
|
57 |
+
else {
|
58 |
+
$( 'a[id^=widget-black-studio-tinymce][id$=tmce]', $( this ).closest( 'div.widget-inside' ) ).click();
|
59 |
+
}
|
60 |
+
});
|
61 |
+
}
|
62 |
+
|
63 |
+
// Activate editor deferred (used upon ajax requests)
|
64 |
+
function black_studio_ajax_deferred_activate_visual_editor( id ) {
|
65 |
+
$( 'div.widget-inside:has(#' + id + ') input[id^=widget-black-studio-tinymce][id$=type][value=visual]' ).each(function() {
|
66 |
+
// If textarea is visible and animation/ajax has completed then trigger a click to Visual button and enable the editor
|
67 |
+
if ( $.active == 0 && tinyMCE.get( id ) == null && $( '#' + id ).is( ':visible' ) ) {
|
68 |
+
$( 'a[id^=widget-black-studio-tinymce][id$=tmce]', $( this ).closest( 'div.widget-inside' ) ).click();
|
69 |
+
}
|
70 |
+
// Otherwise wait and retry later (animation ongoing)
|
71 |
+
else if ( $( 'div.widget:has(#' + id + ') div.widget-inside' ).is( ':visible' ) && tinyMCE.get( id ) == null ) {
|
72 |
+
setTimeout(function() {
|
73 |
+
black_studio_ajax_deferred_activate_visual_editor( id );
|
74 |
+
id=null;
|
75 |
+
}, 100 );
|
76 |
+
}
|
77 |
+
});
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
// Document ready stuff
|
83 |
+
$( document ).ready(function() {
|
84 |
+
// Event handler for widget opening button
|
85 |
+
$( document ).on( 'click', 'div.widget:has(textarea[id^=widget-black-studio-tinymce]) .widget-title, div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action', function( event ) {
|
86 |
+
//event.preventDefault();
|
87 |
+
var $widget = $( this ).closest( 'div.widget' );
|
88 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
89 |
+
if ( $( '[name="' + $( '#' + $text_area.attr('id') ).attr('name') + '"]' ).size() > 1) {
|
90 |
+
var $widget_inside = $( 'div.widget-inside', $widget );
|
91 |
+
if ( $( 'div.error', $widget_inside).length == 0 ) {
|
92 |
+
$widget_inside.prepend('<div class="error"><strong>' + black_studio_tinymce_local.error_duplicate_id + '</strong></div>');
|
93 |
+
}
|
94 |
+
}
|
95 |
+
// Event handler for widget saving button (for new instances)
|
96 |
+
$( 'input[name=savewidget]', $widget ).on( 'click', function( event ) {
|
97 |
+
var $widget = $( this ).closest( 'div.widget' )
|
98 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
99 |
+
if ( tinyMCE.get( $text_area.attr( 'id' ) ) != null ) {
|
100 |
+
black_studio_deactivate_visual_editor( $text_area.attr( 'id' ) );
|
101 |
+
}
|
102 |
+
// Event handler for ajax complete
|
103 |
+
$( this ).unbind( 'ajaxSuccess' ).ajaxSuccess( function( event, xhr, settings ) {
|
104 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $( this ).closest( 'div.widget-inside') );
|
105 |
+
black_studio_ajax_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
106 |
+
});
|
107 |
+
});
|
108 |
+
$( '#wpbody-content' ).css( 'overflow', 'visible' ); // needed for small screens
|
109 |
+
$widget.css( 'position', 'relative' ).css( 'z-index', '10000' ); // needed for small screens
|
110 |
+
black_studio_open_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
111 |
+
$( '.insert-media', $widget ).data( 'editor', $text_area.attr( 'id' ) );
|
112 |
+
});
|
113 |
+
// Event handler for widget saving button (for existing instances)
|
114 |
+
$( 'div.widget[id*=black-studio-tinymce] input[name=savewidget]').on( 'click', function( event ) {
|
115 |
+
var $widget = $( this ).closest( 'div.widget' )
|
116 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $widget );
|
117 |
+
if ( tinyMCE.get( $text_area.attr( 'id' ) ) != null ) {
|
118 |
+
black_studio_deactivate_visual_editor( $text_area.attr( 'id' ) );
|
119 |
+
}
|
120 |
+
// Event handler for ajax complete
|
121 |
+
$( this ).unbind( 'ajaxSuccess' ).ajaxSuccess( function( event, xhr, settings ) {
|
122 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]', $( this ).closest( 'div.widget-inside' ) );
|
123 |
+
black_studio_ajax_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
124 |
+
});
|
125 |
+
});
|
126 |
+
// Event handler for visual switch button
|
127 |
+
$( document ).on( 'click', 'a[id^=widget-black-studio-tinymce][id$=tmce]', function( event ) {
|
128 |
+
//event.preventDefault();
|
129 |
+
var $widget_inside = $( this ).closest( 'div.widget-inside,div.panel-dialog' );
|
130 |
+
var $wrap_id = $( 'div[id^=wp-widget-black-studio-tinymce][id$=-wrap]', $widget_inside );
|
131 |
+
var $textarea_id = $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' )
|
132 |
+
tinymce.DOM.removeClass( $wrap_id, 'html-active' );
|
133 |
+
tinymce.DOM.addClass( $wrap_id, 'tmce-active' );
|
134 |
+
$( 'input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside ).val( 'visual' );
|
135 |
+
black_studio_activate_visual_editor( $textarea_id );
|
136 |
+
});
|
137 |
+
// Event handler for html switch button
|
138 |
+
$( document ).on( 'click', 'a[id^=widget-black-studio-tinymce][id$=html]', function( event ) {
|
139 |
+
//event.preventDefault();
|
140 |
+
var $widget_inside = $( this ).closest( 'div.widget-inside,div.panel-dialog' );
|
141 |
+
var $wrap_id = $( 'div[id^=wp-widget-black-studio-tinymce][id$=-wrap]', $widget_inside );
|
142 |
+
var $textarea_id = $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' )
|
143 |
+
$( 'input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside ).val( 'visual' );
|
144 |
+
tinymce.DOM.removeClass( $wrap_id, 'tmce-active' );
|
145 |
+
tinymce.DOM.addClass( $wrap_id, 'html-active' );
|
146 |
+
$( 'input[id^=widget-black-studio-tinymce][id$=type]', $widget_inside ).val( 'html' );
|
147 |
+
black_studio_deactivate_visual_editor( $textarea_id );
|
148 |
+
});
|
149 |
+
// Set wpActiveEditor variables used when adding media from media library dialog
|
150 |
+
$( document ).on( 'click', '.wp-media-buttons a', function() {
|
151 |
+
var $widget_inside = $( this ).closest( 'div.widget-inside' );
|
152 |
+
wpActiveEditor = $( 'textarea[id^=widget-black-studio-tinymce]', $widget_inside ).attr( 'id' );
|
153 |
+
});
|
154 |
+
// Activate editor when in accessibility mode
|
155 |
+
if ( $( 'body.widgets_access' ).size() > 0) {
|
156 |
+
var $text_area = $( 'textarea[id^=widget-black-studio-tinymce]' );
|
157 |
+
black_studio_open_deferred_activate_visual_editor( $text_area.attr( 'id' ) );
|
158 |
+
}
|
159 |
+
});
|
160 |
+
})( jQuery ); // end self-invoked wrapper function
|
black-studio-tinymce-widget.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var tinyMCEPreInit;var wpActiveEditor;(function(c){function d(g){c("#"+g).addClass("mceEditor");if(typeof tinyMCE=="object"&&typeof tinyMCE.execCommand=="function"){b(g);tinyMCEPreInit.mceInit[g]=tinyMCEPreInit.mceInit["black-studio-tinymce-widget"];tinyMCEPreInit.mceInit[g]["selector"]="#"+g;try{tinymce.init(tinymce.extend({},tinyMCEPreInit.mceInit["black-studio-tinymce-widget"],tinyMCEPreInit.mceInit[g]));tinyMCE.execCommand("mceAddControl",false,g)}catch(f){alert(f)}if(tinyMCE.get(g)!=null){if(typeof tinyMCE.get(g).on=="function"){tinyMCE.get(g).on("keyup change",function(){var h=tinyMCE.get(g).getContent();c("textarea#"+g).val(h).change()})}}}}function b(g){if(typeof tinyMCE=="object"&&typeof tinyMCE.execCommand=="function"){if(tinyMCE.get(g)!=null&&typeof tinyMCE.get(g).getContent=="function"){var f=tinyMCE.get(g).getContent();tinyMCE.get(g).remove();c("textarea#"+g).val(f)}}}function a(f){c("div.widget-inside:has(#"+f+") input[id^=widget-black-studio-tinymce][id$=type][value=visual]").each(function(){if(c("div.widget:has(#"+f+") :animated").size()==0&&tinyMCE.get(f)==null&&c("#"+f).is(":visible")){c("a[id^=widget-black-studio-tinymce][id$=tmce]",c(this).closest("div.widget-inside")).click()}else{if(tinyMCE.get(f)==null){setTimeout(function(){a(f);f=null},100)}else{c("a[id^=widget-black-studio-tinymce][id$=tmce]",c(this).closest("div.widget-inside")).click()}}})}function e(f){c("div.widget-inside:has(#"+f+") input[id^=widget-black-studio-tinymce][id$=type][value=visual]").each(function(){if(c.active==0&&tinyMCE.get(f)==null&&c("#"+f).is(":visible")){c("a[id^=widget-black-studio-tinymce][id$=tmce]",c(this).closest("div.widget-inside")).click()}else{if(c("div.widget:has(#"+f+") div.widget-inside").is(":visible")&&tinyMCE.get(f)==null){setTimeout(function(){e(f);f=null},100)}}})}c(document).ready(function(){c(document).on("click","div.widget:has(textarea[id^=widget-black-studio-tinymce]) .widget-title, div.widget:has(textarea[id^=widget-black-studio-tinymce]) a.widget-action",function(g){var j=c(this).closest("div.widget");var i=c("textarea[id^=widget-black-studio-tinymce]",j);if(c('[name="'+c("#"+i.attr("id")).attr("name")+'"]').size()>1){var h=c("div.widget-inside",j);if(c("div.error",h).length==0){h.prepend('<div class="error"><strong>'+black_studio_tinymce_local.error_duplicate_id+"</strong></div>")}}c("input[name=savewidget]",j).on("click",function(k){var m=c(this).closest("div.widget");var l=c("textarea[id^=widget-black-studio-tinymce]",m);if(tinyMCE.get(l.attr("id"))!=null){b(l.attr("id"))}c(this).unbind("ajaxSuccess").ajaxSuccess(function(o,p,n){var q=c("textarea[id^=widget-black-studio-tinymce]",c(this).closest("div.widget-inside"));e(q.attr("id"))})});c("#wpbody-content").css("overflow","visible");j.css("position","relative").css("z-index","10000");a(i.attr("id"));c(".insert-media",j).data("editor",i.attr("id"))});c("div.widget[id*=black-studio-tinymce] input[name=savewidget]").on("click",function(g){var i=c(this).closest("div.widget");var h=c("textarea[id^=widget-black-studio-tinymce]",i);if(tinyMCE.get(h.attr("id"))!=null){b(h.attr("id"))}c(this).unbind("ajaxSuccess").ajaxSuccess(function(k,l,j){var m=c("textarea[id^=widget-black-studio-tinymce]",c(this).closest("div.widget-inside"));e(m.attr("id"))})});c(document).on("click","a[id^=widget-black-studio-tinymce][id$=tmce]",function(h){var i=c(this).closest("div.widget-inside,div.panel-dialog");var j=c("div[id^=wp-widget-black-studio-tinymce][id$=-wrap]",i);var g=c("textarea[id^=widget-black-studio-tinymce]",i).attr("id");tinymce.DOM.removeClass(j,"html-active");tinymce.DOM.addClass(j,"tmce-active");c("input[id^=widget-black-studio-tinymce][id$=type]",i).val("visual");d(g)});c(document).on("click","a[id^=widget-black-studio-tinymce][id$=html]",function(h){var i=c(this).closest("div.widget-inside,div.panel-dialog");var j=c("div[id^=wp-widget-black-studio-tinymce][id$=-wrap]",i);var g=c("textarea[id^=widget-black-studio-tinymce]",i).attr("id");c("input[id^=widget-black-studio-tinymce][id$=type]",i).val("visual");tinymce.DOM.removeClass(j,"tmce-active");tinymce.DOM.addClass(j,"html-active");c("input[id^=widget-black-studio-tinymce][id$=type]",i).val("html");b(g)});c(document).on("click",".wp-media-buttons a",function(){var g=c(this).closest("div.widget-inside");wpActiveEditor=c("textarea[id^=widget-black-studio-tinymce]",g).attr("id")});if(c("body.widgets_access").size()>0){var f=c("textarea[id^=widget-black-studio-tinymce]");a(f.attr("id"))}})})(jQuery);
|
black-studio-tinymce-widget.php
CHANGED
@@ -3,17 +3,14 @@
|
|
3 |
Plugin Name: Black Studio TinyMCE Widget
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/black-studio-tinymce-widget/
|
5 |
Description: Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
|
6 |
-
Version: 1.
|
7 |
Author: Black Studio
|
8 |
Author URI: http://www.blackstudio.it
|
9 |
License: GPL2
|
|
|
|
|
10 |
*/
|
11 |
|
12 |
-
global $black_studio_tinymce_widget_version;
|
13 |
-
global $black_studio_tinymce_widget_dev_mode;
|
14 |
-
$black_studio_tinymce_widget_version = "1.3.3"; // This is used internally - should be the same reported on the plugin header
|
15 |
-
$black_studio_tinymce_widget_dev_mode = false;
|
16 |
-
|
17 |
/* Widget class */
|
18 |
class WP_Widget_Black_Studio_TinyMCE extends WP_Widget {
|
19 |
|
@@ -74,33 +71,50 @@ class WP_Widget_Black_Studio_TinyMCE extends WP_Widget {
|
|
74 |
$text = stripslashes( wp_filter_post_kses( addslashes( $instance['text'] ) ) );
|
75 |
}
|
76 |
$type = esc_attr( $instance['type'] );
|
77 |
-
|
78 |
-
|
79 |
-
$
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
else {
|
82 |
-
$
|
83 |
-
$
|
84 |
}
|
|
|
85 |
?>
|
86 |
<input id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" type="hidden" value="<?php echo esc_attr( $type ); ?>" />
|
87 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
88 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
89 |
-
<div class="
|
90 |
-
<
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
</div>
|
96 |
-
<div class="
|
97 |
-
<textarea class="widefat" rows="20" cols="40" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
|
98 |
-
</div>
|
99 |
-
<div class="editor_links"><a href="http://www.blackstudio.it/en/wordpress-plugins/black-studio-tinymce-widget/" target="_blank"><?php echo __( 'Donate', 'black-studio-tinymce-widget' ); ?></a> | <a href="http://wordpress.org/support/plugin/black-studio-tinymce-widget" target="_blank"><?php echo __( 'Support', 'black-studio-tinymce-widget' ); ?></a> | <a href="https://twitter.com/blackstudioita" target="_blank"><?php echo __( 'Follow', 'black-studio-tinymce-widget' ); ?></a></div>
|
100 |
<?php
|
101 |
}
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/* Load localization */
|
105 |
load_plugin_textdomain( 'black-studio-tinymce-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
106 |
|
@@ -140,7 +154,6 @@ function black_studio_tinymce_admin_init() {
|
|
140 |
|
141 |
/* Instantiate tinyMCE editor */
|
142 |
function black_studio_tinymce_load_tiny_mce() {
|
143 |
-
// Remove filters added from "After the deadline" plugin, to avoid conflicts
|
144 |
// Add support for thickbox media dialog
|
145 |
add_thickbox();
|
146 |
// New media modal dialog (WP 3.5+)
|
@@ -153,7 +166,7 @@ function black_studio_tinymce_load_tiny_mce() {
|
|
153 |
function black_studio_tinymce_init_editor( $initArray ) {
|
154 |
global $pagenow;
|
155 |
// Remove WP fullscreen mode and set the native tinyMCE fullscreen mode
|
156 |
-
if ( get_bloginfo( 'version' )
|
157 |
$plugins = explode(',', $initArray['plugins']);
|
158 |
if ( isset( $plugins['wpfullscreen'] ) ) {
|
159 |
unset( $plugins['wpfullscreen'] );
|
@@ -164,7 +177,7 @@ function black_studio_tinymce_init_editor( $initArray ) {
|
|
164 |
$initArray['plugins'] = implode( ',', $plugins );
|
165 |
}
|
166 |
// Remove the "More" toolbar button (only in widget screen)
|
167 |
-
if ( $pagenow == "widgets.php" ) {
|
168 |
$initArray['theme_advanced_buttons1'] = str_replace( ',wp_more', '', $initArray['theme_advanced_buttons1'] );
|
169 |
}
|
170 |
// Do not remove linebreaks
|
@@ -187,36 +200,43 @@ function black_studio_tinymce_init_editor( $initArray ) {
|
|
187 |
|
188 |
/* Widget js loading */
|
189 |
function black_studio_tinymce_scripts() {
|
190 |
-
global $black_studio_tinymce_widget_version, $black_studio_tinymce_widget_dev_mode;
|
191 |
wp_enqueue_script('media-upload');
|
192 |
-
|
|
|
|
|
|
|
193 |
wp_enqueue_script( 'wplink' );
|
194 |
wp_enqueue_script( 'wpdialogs-popup' );
|
195 |
-
wp_enqueue_script( 'black-studio-tinymce-widget', plugins_url('black-studio-tinymce-widget' .
|
|
|
196 |
}
|
197 |
else {
|
198 |
-
wp_enqueue_script( 'black-studio-tinymce-widget-legacy', plugins_url('black-studio-tinymce-widget-legacy' .
|
199 |
}
|
200 |
}
|
201 |
|
202 |
/* Widget css loading */
|
203 |
function black_studio_tinymce_styles() {
|
204 |
-
|
205 |
-
if ( get_bloginfo( 'version' ) < "3.3" ) {
|
206 |
wp_enqueue_style( 'thickbox' );
|
207 |
}
|
208 |
else {
|
209 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
210 |
}
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
|
215 |
|
216 |
/* Footer script */
|
217 |
function black_studio_tinymce_footer_scripts() {
|
218 |
// Setup for WP 3.1 and previous versions
|
219 |
-
if ( get_bloginfo( 'version' )
|
220 |
if ( function_exists( 'wp_tiny_mce' ) ) {
|
221 |
wp_tiny_mce( false, array() );
|
222 |
}
|
@@ -224,8 +244,8 @@ function black_studio_tinymce_footer_scripts() {
|
|
224 |
wp_tiny_mce_preload_dialogs();
|
225 |
}
|
226 |
}
|
227 |
-
// Setup for WP 3.2
|
228 |
-
else if ( get_bloginfo( 'version' )
|
229 |
if ( function_exists( 'wp_tiny_mce' ) ) {
|
230 |
wp_tiny_mce( false, array() );
|
231 |
}
|
@@ -233,7 +253,7 @@ function black_studio_tinymce_footer_scripts() {
|
|
233 |
wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );
|
234 |
}
|
235 |
}
|
236 |
-
// Setup for WP 3.3 - New Editor API
|
237 |
else {
|
238 |
wp_editor( '', 'black-studio-tinymce-widget' );
|
239 |
}
|
3 |
Plugin Name: Black Studio TinyMCE Widget
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/black-studio-tinymce-widget/
|
5 |
Description: Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
|
6 |
+
Version: 1.4
|
7 |
Author: Black Studio
|
8 |
Author URI: http://www.blackstudio.it
|
9 |
License: GPL2
|
10 |
+
Text Domain: black-studio-tinymce-widget
|
11 |
+
Domain Path: /languages
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
/* Widget class */
|
15 |
class WP_Widget_Black_Studio_TinyMCE extends WP_Widget {
|
16 |
|
71 |
$text = stripslashes( wp_filter_post_kses( addslashes( $instance['text'] ) ) );
|
72 |
}
|
73 |
$type = esc_attr( $instance['type'] );
|
74 |
+
$switch_class = $type == 'visual' ? 'html-active' : 'tmce-active';
|
75 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) {
|
76 |
+
$toggle_buttons_class = "editor_toggle_buttons_legacy";
|
77 |
+
$media_buttons_class = "editor_media_buttons_legacy";
|
78 |
+
}
|
79 |
+
else if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) {
|
80 |
+
$toggle_buttons_class = "wp-toggle-buttons";
|
81 |
+
$media_buttons_class = "wp-media-buttons";
|
82 |
}
|
83 |
else {
|
84 |
+
$toggle_buttons_class = "wp-editor-tabs";
|
85 |
+
$media_buttons_class = "wp-media-buttons";
|
86 |
}
|
87 |
+
|
88 |
?>
|
89 |
<input id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" type="hidden" value="<?php echo esc_attr( $type ); ?>" />
|
90 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
91 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
92 |
+
<div id="wp-<?php echo $this->get_field_id( 'text' ); ?>-wrap" class="wp-core-ui wp-editor-wrap <?php echo $switch_class; ?>">
|
93 |
+
<div class="wp-editor-tools hide-if-no-js">
|
94 |
+
<div class="<?php echo $toggle_buttons_class; ?>">
|
95 |
+
<a id="<?php echo $this->get_field_id( 'text' ); ?>-html" class="wp-switch-editor switch-html"><?php _e( 'HTML' ); ?></a>
|
96 |
+
<a id="<?php echo $this->get_field_id( 'text' ); ?>-tmce" class="wp-switch-editor switch-tmce"><?php _e(' Visual' ); ?></a>
|
97 |
+
</div>
|
98 |
+
<div class="<?php echo $media_buttons_class; ?>">
|
99 |
+
<?php do_action( 'media_buttons', $this->get_field_id( 'text' ) ); ?>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
<div class="wp-editor-container">
|
103 |
+
<textarea class="widefat" rows="20" cols="40" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
|
104 |
+
</div>
|
105 |
</div>
|
106 |
+
<div class="wp-editor-bstw-links" style="font-size: 10px; text-align: right; padding: 5px 0;"><a href="http://www.blackstudio.it/en/wordpress-plugins/black-studio-tinymce-widget/" target="_blank"><?php echo __( 'Donate', 'black-studio-tinymce-widget' ); ?></a> | <a href="http://wordpress.org/support/plugin/black-studio-tinymce-widget" target="_blank"><?php echo __( 'Support', 'black-studio-tinymce-widget' ); ?></a> | <a href="http://wordpress.org/support/view/plugin-reviews/black-studio-tinymce-widget" target="_blank"><?php echo __( 'Rate', 'black-studio-tinymce-widget' ); ?></a> | <a href="https://twitter.com/blackstudioita" target="_blank"><?php echo __( 'Follow', 'black-studio-tinymce-widget' ); ?></a></div>
|
|
|
|
|
|
|
107 |
<?php
|
108 |
}
|
109 |
}
|
110 |
|
111 |
+
/* Get plugin version */
|
112 |
+
function black_studio_tinymce_get_version() {
|
113 |
+
$plugin_data = get_plugin_data( __FILE__ );
|
114 |
+
$plugin_version = $plugin_data['Version'];
|
115 |
+
return $plugin_version;
|
116 |
+
}
|
117 |
+
|
118 |
/* Load localization */
|
119 |
load_plugin_textdomain( 'black-studio-tinymce-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
120 |
|
154 |
|
155 |
/* Instantiate tinyMCE editor */
|
156 |
function black_studio_tinymce_load_tiny_mce() {
|
|
|
157 |
// Add support for thickbox media dialog
|
158 |
add_thickbox();
|
159 |
// New media modal dialog (WP 3.5+)
|
166 |
function black_studio_tinymce_init_editor( $initArray ) {
|
167 |
global $pagenow;
|
168 |
// Remove WP fullscreen mode and set the native tinyMCE fullscreen mode
|
169 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
|
170 |
$plugins = explode(',', $initArray['plugins']);
|
171 |
if ( isset( $plugins['wpfullscreen'] ) ) {
|
172 |
unset( $plugins['wpfullscreen'] );
|
177 |
$initArray['plugins'] = implode( ',', $plugins );
|
178 |
}
|
179 |
// Remove the "More" toolbar button (only in widget screen)
|
180 |
+
if ( $pagenow == "widgets.php" && version_compare( get_bloginfo( 'version' ), '3.8', '<' )) {
|
181 |
$initArray['theme_advanced_buttons1'] = str_replace( ',wp_more', '', $initArray['theme_advanced_buttons1'] );
|
182 |
}
|
183 |
// Do not remove linebreaks
|
200 |
|
201 |
/* Widget js loading */
|
202 |
function black_studio_tinymce_scripts() {
|
|
|
203 |
wp_enqueue_script('media-upload');
|
204 |
+
$version = black_studio_tinymce_get_version();
|
205 |
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
|
206 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.3', '>=' ) ) {
|
207 |
+
$local_data = array( 'error_duplicate_id' => __('ERROR: Duplicate widget ID detected. To avoid content loss, please create a new one with the same content and then delete this widget.', 'black-studio-tinymce-widget') );
|
208 |
wp_enqueue_script( 'wplink' );
|
209 |
wp_enqueue_script( 'wpdialogs-popup' );
|
210 |
+
wp_enqueue_script( 'black-studio-tinymce-widget', plugins_url('black-studio-tinymce-widget' . $suffix . '.js', __FILE__ ), array( 'jquery', 'editor' ), $version, true );
|
211 |
+
wp_localize_script( 'black-studio-tinymce-widget', 'black_studio_tinymce_local', $local_data );
|
212 |
}
|
213 |
else {
|
214 |
+
wp_enqueue_script( 'black-studio-tinymce-widget-legacy', plugins_url('black-studio-tinymce-widget-legacy' . $suffix . '.js', __FILE__ ), array( 'jquery', 'editor' ), $version, true );
|
215 |
}
|
216 |
}
|
217 |
|
218 |
/* Widget css loading */
|
219 |
function black_studio_tinymce_styles() {
|
220 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
|
|
|
221 |
wp_enqueue_style( 'thickbox' );
|
222 |
}
|
223 |
else {
|
224 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
225 |
}
|
226 |
+
$style = 'black-studio-tinymce-widget';
|
227 |
+
$version = black_studio_tinymce_get_version();
|
228 |
+
wp_enqueue_style( 'editor-buttons' );
|
229 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) {
|
230 |
+
$style .= '-legacy';
|
231 |
+
}
|
232 |
+
wp_enqueue_style( $style, plugins_url( $style. '.css', __FILE__ ), array(), $version );
|
233 |
}
|
234 |
|
235 |
|
236 |
/* Footer script */
|
237 |
function black_studio_tinymce_footer_scripts() {
|
238 |
// Setup for WP 3.1 and previous versions
|
239 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.2', '<' ) ) {
|
240 |
if ( function_exists( 'wp_tiny_mce' ) ) {
|
241 |
wp_tiny_mce( false, array() );
|
242 |
}
|
244 |
wp_tiny_mce_preload_dialogs();
|
245 |
}
|
246 |
}
|
247 |
+
// Setup for WP 3.2
|
248 |
+
else if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
|
249 |
if ( function_exists( 'wp_tiny_mce' ) ) {
|
250 |
wp_tiny_mce( false, array() );
|
251 |
}
|
253 |
wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );
|
254 |
}
|
255 |
}
|
256 |
+
// Setup for WP 3.3+ - New Editor API
|
257 |
else {
|
258 |
wp_editor( '', 'black-studio-tinymce-widget' );
|
259 |
}
|
languages/black-studio-tinymce-widget-it_IT.mo
CHANGED
Binary file
|
languages/black-studio-tinymce-widget-it_IT.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Black Studio TinyMCE Widget\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2014-
|
6 |
-
"PO-Revision-Date: 2014-
|
7 |
"Last-Translator: Marco <marco@blackstudio.it>\n"
|
8 |
"Language-Team: Black Studio <info@blackstudio.it>\n"
|
9 |
"Language: it_IT\n"
|
@@ -16,25 +16,38 @@ msgstr ""
|
|
16 |
"X-Generator: Poedit 1.5.5\n"
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
|
19 |
-
#: black-studio-tinymce-widget.php:
|
20 |
msgid "Arbitrary text or HTML with visual editor"
|
21 |
msgstr "Testo o HTML libero con editor visuale"
|
22 |
|
23 |
-
#: black-studio-tinymce-widget.php:
|
24 |
msgid "Visual Editor"
|
25 |
msgstr "Editor Visuale"
|
26 |
|
27 |
-
#: black-studio-tinymce-widget.php:
|
28 |
msgid "Donate"
|
29 |
msgstr "Donazione"
|
30 |
|
31 |
-
#: black-studio-tinymce-widget.php:
|
32 |
msgid "Support"
|
33 |
msgstr "Supporto"
|
34 |
|
35 |
-
#: black-studio-tinymce-widget.php:
|
|
|
|
|
|
|
|
|
36 |
msgid "Follow"
|
37 |
msgstr "Seguici"
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
#~ msgid "Black Studio TinyMCE"
|
40 |
#~ msgstr "Black Studio TinyMCE"
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Black Studio TinyMCE Widget\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2014-06-12 14:55+0100\n"
|
6 |
+
"PO-Revision-Date: 2014-06-12 14:56+0100\n"
|
7 |
"Last-Translator: Marco <marco@blackstudio.it>\n"
|
8 |
"Language-Team: Black Studio <info@blackstudio.it>\n"
|
9 |
"Language: it_IT\n"
|
16 |
"X-Generator: Poedit 1.5.5\n"
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
|
19 |
+
#: black-studio-tinymce-widget.php:18
|
20 |
msgid "Arbitrary text or HTML with visual editor"
|
21 |
msgstr "Testo o HTML libero con editor visuale"
|
22 |
|
23 |
+
#: black-studio-tinymce-widget.php:20
|
24 |
msgid "Visual Editor"
|
25 |
msgstr "Editor Visuale"
|
26 |
|
27 |
+
#: black-studio-tinymce-widget.php:106
|
28 |
msgid "Donate"
|
29 |
msgstr "Donazione"
|
30 |
|
31 |
+
#: black-studio-tinymce-widget.php:106
|
32 |
msgid "Support"
|
33 |
msgstr "Supporto"
|
34 |
|
35 |
+
#: black-studio-tinymce-widget.php:106
|
36 |
+
msgid "Rate"
|
37 |
+
msgstr "Vota"
|
38 |
+
|
39 |
+
#: black-studio-tinymce-widget.php:106
|
40 |
msgid "Follow"
|
41 |
msgstr "Seguici"
|
42 |
|
43 |
+
#: black-studio-tinymce-widget.php:207
|
44 |
+
msgid ""
|
45 |
+
"ERROR: Duplicate widget ID detected. To avoid content loss, please create a "
|
46 |
+
"new one with the same content and then delete this widget."
|
47 |
+
msgstr ""
|
48 |
+
"ERRORE: Rilevato un widget con ID duplicato. Per evitare perdite di dati, si "
|
49 |
+
"consiglia di creare un nuovo widget con il medesimo contenuto e "
|
50 |
+
"successivamente cancellare questo widget."
|
51 |
+
|
52 |
#~ msgid "Black Studio TinyMCE"
|
53 |
#~ msgstr "Black Studio TinyMCE"
|
languages/black-studio-tinymce-widget_uk_UA.mo
ADDED
Binary file
|
languages/black-studio-tinymce-widget_uk_UA.po
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Black Studio TinyMCE Widget\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2014-03-06 12:08+0100\n"
|
6 |
+
"PO-Revision-Date: 2014-05-22 17:42+0200\n"
|
7 |
+
"Last-Translator: Michael Yunat <Michael.Yunat@gmail.com>\n"
|
8 |
+
"Language-Team: http://getvoip.com/\n"
|
9 |
+
"Language: uk\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Generator: Poedit 1.6.5\n"
|
17 |
+
"X-Poedit-SearchPath-0: .\n"
|
18 |
+
|
19 |
+
#: black-studio-tinymce-widget.php:21
|
20 |
+
msgid "Arbitrary text or HTML with visual editor"
|
21 |
+
msgstr "Довільний текст або HTML з візуальним редактором"
|
22 |
+
|
23 |
+
#: black-studio-tinymce-widget.php:23
|
24 |
+
msgid "Visual Editor"
|
25 |
+
msgstr "Візуальний редактор"
|
26 |
+
|
27 |
+
#: black-studio-tinymce-widget.php:99
|
28 |
+
msgid "Donate"
|
29 |
+
msgstr "Жертвувати"
|
30 |
+
|
31 |
+
#: black-studio-tinymce-widget.php:99
|
32 |
+
msgid "Support"
|
33 |
+
msgstr "Підтримка"
|
34 |
+
|
35 |
+
#: black-studio-tinymce-widget.php:99
|
36 |
+
msgid "Follow"
|
37 |
+
msgstr "Слідувати"
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.blackstudio.it/en/wordpress-plugins/black-studio-tinymce
|
|
4 |
Tags: wysiwyg, widget, tinymce, editor, image, media, rich text, rich text editor, visual editor, wysiwyg editor, tinymce editor, widget editor, html editor, wysiwyg widget, html widget, editor widget, text widget, rich text widget, enhanced text widget, tinymce widget, visual widget, image widget, media widget
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.9
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
|
10 |
|
@@ -13,7 +13,7 @@ This plugin adds a WYSIWYG text widget based on the standard TinyMCE WordPress v
|
|
13 |
|
14 |
= Features =
|
15 |
|
16 |
-
* Add rich text widgets to your
|
17 |
* Switch between Visual mode and HTML mode
|
18 |
* Insert images/videos from WordPress Media Library
|
19 |
* Insert links to existing WordPress pages/posts
|
@@ -21,6 +21,7 @@ This plugin adds a WYSIWYG text widget based on the standard TinyMCE WordPress v
|
|
21 |
* Widgets accessibility mode supported
|
22 |
* WordPress networks (Multi-site) supported
|
23 |
* WPML (Multi-language) supported
|
|
|
24 |
|
25 |
= Links =
|
26 |
|
@@ -72,6 +73,19 @@ When dealing with a WordPress site URL change it is necessary to face the "seria
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 1.3.3 =
|
76 |
* Fixed visualization bug upon widget saving
|
77 |
* Enhanced support WordPress 3.9 Theme Customizer (live edit)
|
4 |
Tags: wysiwyg, widget, tinymce, editor, image, media, rich text, rich text editor, visual editor, wysiwyg editor, tinymce editor, widget editor, html editor, wysiwyg widget, html widget, editor widget, text widget, rich text widget, enhanced text widget, tinymce widget, visual widget, image widget, media widget
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 1.4
|
8 |
|
9 |
Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
|
10 |
|
13 |
|
14 |
= Features =
|
15 |
|
16 |
+
* Add rich text widgets to your sidebars using visual editor
|
17 |
* Switch between Visual mode and HTML mode
|
18 |
* Insert images/videos from WordPress Media Library
|
19 |
* Insert links to existing WordPress pages/posts
|
21 |
* Widgets accessibility mode supported
|
22 |
* WordPress networks (Multi-site) supported
|
23 |
* WPML (Multi-language) supported
|
24 |
+
* Live preview of widgets in Theme customizer supported (since WordPress 3.9)
|
25 |
|
26 |
= Links =
|
27 |
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 1.4 =
|
77 |
+
* HTML and CSS optimization by using WordPress native editor markup and styles
|
78 |
+
* Adoption of WordPress JS minification conventions (".min" suffix)
|
79 |
+
* Integration with WordPress SCRIPT_DEBUG constant for javascript debugging purposes
|
80 |
+
* Enhanced compatibility with 3rd party media buttons provider (i.e. Shortcodes Ultimate)
|
81 |
+
* Enhanced plugin internal version handling
|
82 |
+
* Duplicated widget IDs detection
|
83 |
+
* Added Rate link
|
84 |
+
* Added compatibility with WordPress Language packs
|
85 |
+
* Added ukrainian translation (Contributor: Michael Yunat [getvoip.com](http://getvoip.com/blog))
|
86 |
+
* Fixed notice on theme_advanced_buttons1 parameter
|
87 |
+
* Fixed z-index issue with WordPress 3.9 admin menu on small screens
|
88 |
+
|
89 |
= 1.3.3 =
|
90 |
* Fixed visualization bug upon widget saving
|
91 |
* Enhanced support WordPress 3.9 Theme Customizer (live edit)
|