WP Editor Widget - Version 0.5.1

Version Description

  • Bugfix: Couldn't switch to plain text on customize.php (Issue #27853)
  • Bugfix: JS errors that could appear depending on if you loaded the editor in wysiwyg or plain text
  • Bugfix: Didn't store plain text widget content correctly
Download this release

Release Info

Developer feedmeastraycat
Plugin Icon wp plugin WP Editor Widget
Version 0.5.1
Comparing to
See all releases

Code changes from version 0.5.0 to 0.5.1

Files changed (3) hide show
  1. assets/js/admin.js +10 -6
  2. readme.txt +6 -1
  3. wp-editor-widget.php +16 -3
assets/js/admin.js CHANGED
@@ -54,11 +54,13 @@ WPEditorWidget = {
54
  */
55
  setEditorContent: function(contentId) {
56
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
57
- if (typeof editor == "undefined") {
58
- jQuery('#wp-editor-widget').val(jQuery('#'+ contentId).val());
 
 
59
  }
60
  else {
61
- editor.setContent(jQuery('#'+ contentId).val());
62
  }
63
  },
64
 
@@ -68,12 +70,14 @@ WPEditorWidget = {
68
  updateWidgetAndCloseEditor: function() {
69
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
70
 
71
- if (typeof editor == "undefined") {
72
- jQuery('#'+ this.currentContentId).val(jQuery('#wp-editor-widget').val());
73
  }
74
  else {
75
- jQuery('#'+ this.currentContentId).val(editor.getContent());
76
  }
 
 
77
 
78
  // customize.php
79
  if (this.currentEditorPage == "wp-customizer") {
54
  */
55
  setEditorContent: function(contentId) {
56
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
57
+ var content = jQuery('#'+ contentId).val();
58
+
59
+ if (typeof editor == "undefined" || editor == null || editor.isHidden()) {
60
+ jQuery('#wp-editor-widget').val(content);
61
  }
62
  else {
63
+ editor.setContent(content);
64
  }
65
  },
66
 
70
  updateWidgetAndCloseEditor: function() {
71
  var editor = tinyMCE.EditorManager.get('wp-editor-widget');
72
 
73
+ if (typeof editor == "undefined" || editor == null || editor.isHidden()) {
74
+ var content = jQuery('#wp-editor-widget').val();
75
  }
76
  else {
77
+ var content = editor.getContent();
78
  }
79
+
80
+ jQuery('#'+ this.currentContentId).val(content);
81
 
82
  // customize.php
83
  if (this.currentEditorPage == "wp-customizer") {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: feedmeastraycat
3
  Tags: widget, wysiwyg, editor, rich text
4
  Requires at least: 3.5.1
5
  Tested up to: 3.9.0
6
- Stable tag: 0.5.0
7
  License: MIT
8
 
9
  WP Editor Widget adds a rich text widget where the content is edited using the standard WordPress visual editor.
@@ -32,6 +32,11 @@ Feel free to help with developement or issue reporting on [Github](https://githu
32
 
33
  == Changelog ==
34
 
 
 
 
 
 
35
  = 0.5.0 =
36
  * *This is a big change, please file an issue on [Github](https://github.com/feedmeastraycat/wp-editor-widget) if you find anything weird!*
37
  * Changes for WP 3.9.0 (editor now works on the admin customization page as well as on the admin widgets page)
3
  Tags: widget, wysiwyg, editor, rich text
4
  Requires at least: 3.5.1
5
  Tested up to: 3.9.0
6
+ Stable tag: 0.5.1
7
  License: MIT
8
 
9
  WP Editor Widget adds a rich text widget where the content is edited using the standard WordPress visual editor.
32
 
33
  == Changelog ==
34
 
35
+ = 0.5.1 =
36
+ * Bugfix: Couldn't switch to plain text on customize.php ([Issue #27853](https://core.trac.wordpress.org/ticket/27853))
37
+ * Bugfix: JS errors that could appear depending on if you loaded the editor in wysiwyg or plain text
38
+ * Bugfix: Didn't store plain text widget content correctly
39
+
40
  = 0.5.0 =
41
  * *This is a big change, please file an issue on [Github](https://github.com/feedmeastraycat/wp-editor-widget) if you find anything weird!*
42
  * Changes for WP 3.9.0 (editor now works on the admin customization page as well as on the admin widgets page)
wp-editor-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Editor Widget
4
  Plugin URI: https://github.com/feedmeastraycat/wp-editor-widget
5
  Description: WP Editor Widget adds a WYSIWYG widget using the wp_editor().
6
  Author: David Mårtensson, Odd Alice
7
- Version: 0.5.0
8
  Author URI: http://www.feedmeastraycat.net/
9
  Text Domain: wp-editor-widget
10
  Domain Path: /langs
@@ -27,7 +27,7 @@ class WPEditorWidget {
27
  /**
28
  * @var string
29
  */
30
- const VERSION = "0.5.0";
31
 
32
  /**
33
  * Action: init
@@ -38,7 +38,8 @@ class WPEditorWidget {
38
  add_action( 'load-widgets.php', array( $this, 'load_admin_assets' ) );
39
  add_action( 'load-customize.php', array( $this, 'load_admin_assets' ) );
40
  add_action( 'widgets_admin_page', array( $this, 'output_wp_editor_widget_html' ), 100 );
41
- add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_wp_editor_widget_html' ) );
 
42
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
43
 
44
  } // END __construct()
@@ -99,6 +100,18 @@ class WPEditorWidget {
99
  <?php
100
 
101
  } // END output_wp_editor_widget_html
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  /**
104
  * Action: widgets_init
4
  Plugin URI: https://github.com/feedmeastraycat/wp-editor-widget
5
  Description: WP Editor Widget adds a WYSIWYG widget using the wp_editor().
6
  Author: David M&aring;rtensson, Odd Alice
7
+ Version: 0.5.1
8
  Author URI: http://www.feedmeastraycat.net/
9
  Text Domain: wp-editor-widget
10
  Domain Path: /langs
27
  /**
28
  * @var string
29
  */
30
+ const VERSION = "0.5.1";
31
 
32
  /**
33
  * Action: init
38
  add_action( 'load-widgets.php', array( $this, 'load_admin_assets' ) );
39
  add_action( 'load-customize.php', array( $this, 'load_admin_assets' ) );
40
  add_action( 'widgets_admin_page', array( $this, 'output_wp_editor_widget_html' ), 100 );
41
+ add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_wp_editor_widget_html' ), 1 );
42
+ add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_controls_print_footer_scripts' ), 2 );
43
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
44
 
45
  } // END __construct()
100
  <?php
101
 
102
  } // END output_wp_editor_widget_html
103
+
104
+ /**
105
+ * Action: customize_controls_print_footer_scripts
106
+ */
107
+ public function customize_controls_print_footer_scripts() {
108
+
109
+ // Because of https://core.trac.wordpress.org/ticket/27853
110
+ if ( class_exists( '_WP_Editors' ) ) {
111
+ _WP_Editors::enqueue_scripts();
112
+ }
113
+
114
+ } // END customize_controls_print_footer_scripts
115
 
116
  /**
117
  * Action: widgets_init