Black Studio TinyMCE Widget - Version 0.6.5

Version Description

  • Forced TinyMCE editor to not automatically add/remove paragraph tags when switching to HTML mode (you may need to re-edit your widgets to adjust linebreaks, if you were using multiple paragraphs)
Download this release

Release Info

Developer marcochiesi
Plugin Icon 128x128 Black Studio TinyMCE Widget
Version 0.6.5
Comparing to
See all releases

Code changes from version 0.6.4 to 0.6.5

black-studio-tinymce-widget.js CHANGED
@@ -10,7 +10,9 @@ function black_studio_activate_visual_editor(id) {
10
  function black_studio_deactivate_visual_editor(id) {
11
  if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
12
  if (typeof(tinyMCE.get(id)) == "object") {
 
13
  tinyMCE.execCommand("mceRemoveControl", false, id);
 
14
  }
15
  }
16
  }
@@ -57,10 +59,7 @@ jQuery(document).ready(function(){
57
  // Event handler for widget saving button
58
  jQuery('input[id^=widget-black-studio-tinymce][id$=savewidget]').live('click', function(){
59
  txt_area = jQuery('textarea[id^=widget-black-studio-tinymce]', jQuery(this).parents('div.widget'));
60
- editor = tinyMCE.get(txt_area.attr('id'));
61
- if (typeof(editor) == "object") {
62
- content = editor.getContent()
63
- txt_area.val(content);
64
  black_studio_deactivate_visual_editor(txt_area.attr('id'));
65
  }
66
  // Event handler for ajax complete
@@ -70,11 +69,6 @@ jQuery(document).ready(function(){
70
  });
71
  return true;
72
  });
73
- // Event handler for ajax complete
74
- //jQuery('input[id^=widget-black-studio-tinymce][id$=savewidget]').ajaxSuccess(function(event, xhr, settings) {
75
- // txt_area = jQuery('textarea[id^=widget-black-studio-tinymce]', jQuery(this).parents('div.widget'));
76
- // black_studio_ajax_deferred_activate_visual_editor(txt_area.attr('id'));
77
- //});
78
  // Event handler for visual switch button
79
  jQuery('a[id^=widget-black-studio-tinymce][id$=visual]').live('click', function(){
80
  jQuery(this).addClass('active');
10
  function black_studio_deactivate_visual_editor(id) {
11
  if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
12
  if (typeof(tinyMCE.get(id)) == "object") {
13
+ content = tinyMCE.get(id).getContent();
14
  tinyMCE.execCommand("mceRemoveControl", false, id);
15
+ jQuery('textarea#'+id).val(content);
16
  }
17
  }
18
  }
59
  // Event handler for widget saving button
60
  jQuery('input[id^=widget-black-studio-tinymce][id$=savewidget]').live('click', function(){
61
  txt_area = jQuery('textarea[id^=widget-black-studio-tinymce]', jQuery(this).parents('div.widget'));
62
+ if (typeof(tinyMCE.get(txt_area.attr('id'))) == "object") {
 
 
 
63
  black_studio_deactivate_visual_editor(txt_area.attr('id'));
64
  }
65
  // Event handler for ajax complete
69
  });
70
  return true;
71
  });
 
 
 
 
 
72
  // Event handler for visual switch button
73
  jQuery('a[id^=widget-black-studio-tinymce][id$=visual]').live('click', function(){
74
  jQuery(this).addClass('active');
black-studio-tinymce-widget.php CHANGED
@@ -3,14 +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: 0.6.4
7
  Author: Black Studio
8
  Author URI: http://www.blackstudio.it
9
  License: GPL2
10
  */
11
 
12
  global $black_studio_tinymce_widget_version;
13
- $black_studio_tinymce_widget_version = "0.6.4"; // This is used internally - should be the same reported on the plugin header
14
 
15
  /* Widget class */
16
  class WP_Widget_Black_Studio_TinyMCE extends WP_Widget {
@@ -80,7 +80,7 @@ function black_studio_tinymce_init() {
80
  /* Add actions and filter (only in widgets admin page) */
81
  if ($pagenow == "widgets.php") {
82
  add_action( 'admin_head', 'black_studio_tinymce_load_tiny_mce');
83
- add_filter( 'tiny_mce_before_init', 'black_studio_tinymce_init_editor', 15);
84
  add_action( 'admin_print_scripts', 'black_studio_tinymce_scripts');
85
  add_action( 'admin_print_styles', 'black_studio_tinymce_styles');
86
  add_action( 'admin_print_footer_scripts', 'black_studio_tinymce_preload_dialogs');
@@ -109,6 +109,20 @@ function black_studio_tinymce_init_editor($initArray) {
109
  $initArray['plugins'] = implode(',', $plugins);
110
  // Remove the "More" toolbar button
111
  $initArray['theme_advanced_buttons1'] = str_replace(',wp_more', '', $initArray['theme_advanced_buttons1']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  // Return modified settings
113
  return $initArray;
114
  }
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: 0.6.5
7
  Author: Black Studio
8
  Author URI: http://www.blackstudio.it
9
  License: GPL2
10
  */
11
 
12
  global $black_studio_tinymce_widget_version;
13
+ $black_studio_tinymce_widget_version = "0.6.5"; // This is used internally - should be the same reported on the plugin header
14
 
15
  /* Widget class */
16
  class WP_Widget_Black_Studio_TinyMCE extends WP_Widget {
80
  /* Add actions and filter (only in widgets admin page) */
81
  if ($pagenow == "widgets.php") {
82
  add_action( 'admin_head', 'black_studio_tinymce_load_tiny_mce');
83
+ add_filter( 'tiny_mce_before_init', 'black_studio_tinymce_init_editor', 20);
84
  add_action( 'admin_print_scripts', 'black_studio_tinymce_scripts');
85
  add_action( 'admin_print_styles', 'black_studio_tinymce_styles');
86
  add_action( 'admin_print_footer_scripts', 'black_studio_tinymce_preload_dialogs');
109
  $initArray['plugins'] = implode(',', $plugins);
110
  // Remove the "More" toolbar button
111
  $initArray['theme_advanced_buttons1'] = str_replace(',wp_more', '', $initArray['theme_advanced_buttons1']);
112
+ // Do not remove linebreaks
113
+ $initArray['remove_linebreaks'] = false;
114
+ // Convert newline characters to BR tags
115
+ $initArray['convert_newlines_to_brs'] = false;
116
+ // Force P newlines
117
+ $initArray['force_p_newlines'] = true;
118
+ // Force P newlines
119
+ $initArray['force_br_newlines'] = false;
120
+ // Do not remove redundant BR tags
121
+ $initArray['remove_redundant_brs'] = false;
122
+ // Force p block
123
+ $initArray['forced_root_block'] = 'p';
124
+ // Apply source formatting
125
+ $initArray['apply_source_formatting '] = true;
126
  // Return modified settings
127
  return $initArray;
128
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.blackstudio.it/pagamento/
4
  Tags: wysiwyg, widget, tinymce, editor, 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, visual editor widget
5
  Requires at least: 3.2.0
6
  Tested up to: 3.2.1
7
- Stable tag: 0.6.4
8
 
9
  Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
10
 
@@ -34,12 +34,15 @@ This section describes how to install the plugin and get it working.
34
 
35
  == Changelog ==
36
 
 
 
 
37
  = 0.6.4 =
38
  * Fixed compatibility issue with "Jetpack / After the Deadline" plugin
39
  * Optimization of js/css loading
40
 
41
  = 0.6.3 =
42
- * Fixed Javascript issue preventing the plugin working correctly with some browsers
43
 
44
  = 0.6.2 =
45
  * Fixed Javascript issue with Media Library inserts in HTML mode
4
  Tags: wysiwyg, widget, tinymce, editor, 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, visual editor widget
5
  Requires at least: 3.2.0
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.6.5
8
 
9
  Adds a WYSIWYG widget based on the standard TinyMCE WordPress visual editor.
10
 
34
 
35
  == Changelog ==
36
 
37
+ = 0.6.5 =
38
+ * Forced TinyMCE editor to not automatically add/remove paragraph tags when switching to HTML mode (you may need to re-edit your widgets to adjust linebreaks, if you were using multiple paragraphs)
39
+
40
  = 0.6.4 =
41
  * Fixed compatibility issue with "Jetpack / After the Deadline" plugin
42
  * Optimization of js/css loading
43
 
44
  = 0.6.3 =
45
+ * Fixed Javascript issue preventing the plugin from working correctly with some browsers
46
 
47
  = 0.6.2 =
48
  * Fixed Javascript issue with Media Library inserts in HTML mode