- fixed tinyMCE editor;

- fixed Live Preview;
This commit is contained in:
nikitasinelnikov
2018-12-13 17:47:01 +02:00
parent 748a82baf3
commit 2203007194
5 changed files with 96 additions and 64 deletions
+75 -50
View File
@@ -1,3 +1,6 @@
var $um_tiny_editor = {};
function um_admin_live_update_scripts() {
jQuery('.um-adm-conditional').each( function() {
jQuery(this).trigger('change');
@@ -31,6 +34,57 @@ function um_admin_new_modal( id, ajax, size ) {
}
}
function um_tinymce_init( id, content ) {
var object = jQuery('#' + id);
if ( tinyMCE.get( id ) !== null ) {
tinyMCE.triggerSave();
tinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, id );
"4" === tinyMCE.majorVersion ? window.tinyMCE.execCommand( "mceRemoveEditor", !0, id ) : window.tinyMCE.execCommand( "mceRemoveControl", !0, id );
$um_tiny_editor = jQuery('<div>').append( object.parents( '#wp-' + id + '-wrap' ).clone() );
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
var init;
if( typeof tinyMCEPreInit.mceInit[ id ] == 'undefined' ){
init = tinyMCEPreInit.mceInit[ id ] = tinyMCE.extend( {}, tinyMCEPreInit.mceInit[ id ] );
} else {
init = tinyMCEPreInit.mceInit[ id ];
}
if ( typeof(QTags) == 'function' ) {
QTags( tinyMCEPreInit.qtInit[ id ] );
QTags._buttonsInit();
}
window.switchEditors.go( id );
tinyMCE.init( init );
tinyMCE.get( id ).setContent( content );
object.html( content );
} else {
$um_tiny_editor = jQuery('<div>').append( object.parents('#wp-' + id + '-wrap').clone() );
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
if ( typeof(QTags) == 'function' ) {
QTags( tinyMCEPreInit.qtInit[ id ] );
QTags._buttonsInit();
}
//use duplicate because it's new element
jQuery('#' + id).html( content );
}
jQuery( 'body' ).on( 'click', '.wp-switch-editor', function() {
var target = jQuery(this);
if ( target.hasClass( 'wp-switch-editor' ) ) {
var mode = target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
window.switchEditors.go( id, mode );
}
});
}
function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
in_row = '';
in_sub_row = '';
@@ -63,61 +117,29 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
um_admin_modal_loaded();
um_admin_modal_responsive();
},
success: function(data){
success: function(data) {
jQuery('.um-admin-modal').find('.um-admin-modal-body').html( data );
um_responsive();
um_admin_live_update_scripts();
jQuery( "#_custom_dropdown_options_source" ).trigger('blur');
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
if ( act_id == 'um_admin_edit_field_popup' ) {
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-edit').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');
jQuery('.switch-html').trigger('click');
jQuery('.switch-html').trigger('click');
jQuery('.switch-tmce').trigger('click');
jQuery('#um_editor_edit_ifr').height(200);
var editor = tinyMCE.get('um_editor_edit');
var content = editor.getContent();
editor.setContent( jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
um_tinymce_init( 'um_editor_edit', jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
} else {
if ( tinyMCE.get('um_editor_new') !== null ) {
tinyMCE.get('um_editor_new').setContent('');
} else {
jQuery('#um_editor_new').val('');
}
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
jQuery('.um-admin-editor:visible').html( jQuery('.um-hidden-editor-new').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');
jQuery('.switch-html').trigger('click');
jQuery('.switch-html').trigger('click');
jQuery('.switch-tmce').trigger('click');
jQuery('#um_editor_new_ifr').height(200);
if ( tinyMCE.get('um_editor_new') === null ) {
jQuery('#um_editor_new').show();
}
um_tinymce_init( 'um_editor_new', '' );
}
}
um_init_tooltips();
},
error: function(data){
error: function(data) {
}
});
@@ -129,26 +151,30 @@ function um_admin_modal_responsive() {
jQuery('.um-admin-modal:visible').css({'margin-top': '-' + required_margin });
}
function um_admin_remove_modal(){
function um_admin_remove_modal() {
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
tinyMCE.triggerSave();
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
jQuery('#wp-um_editor_edit-wrap').remove();
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
jQuery('.um-hidden-editor-edit').html( jQuery('.um-admin-editor:visible').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');*/
} else {
tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
jQuery('#wp-um_editor_new-wrap').remove();
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
jQuery('.um-hidden-editor-new').html( jQuery('.um-admin-editor:visible').contents() );
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');*/
}
jQuery('.um_tiny_placeholder').replaceWith( jQuery( $um_tiny_editor ).html() );
}
jQuery('body').removeClass('um-admin-modal-open');
jQuery('.um-admin-modal div[id^="UM_"]').hide().appendTo('body');
jQuery('.um-admin-modal,.um-admin-overlay').remove();
@@ -298,7 +324,6 @@ jQuery(document).ready(function() {
fire new modal
**/
jQuery(document.body).on('click', 'a[data-modal^="UM_"], span[data-modal^="UM_"]', function(e){
console.log();
e.preventDefault();
var modal_id = jQuery(this).attr('data-modal');
+3 -3
View File
@@ -106,12 +106,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
wp_register_script( 'select2', $this->front_js_baseurl . 'select2/select2.full.min.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true );
wp_register_script( 'um-jquery-form', $this->front_js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um-fileupload', $this->front_js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_jquery_form', $this->front_js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_fileupload', $this->front_js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_crop', $this->front_js_baseurl . 'um-crop' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_tipsy', $this->front_js_baseurl . 'um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_functions', $this->front_js_baseurl . 'um-functions' . $this->suffix . '.js', array( 'jquery', 'um_tipsy', 'um_scrollbar' ), ultimatemember_version, true );
wp_register_script( 'um_scripts', $this->front_js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'um_functions', 'um_crop', 'um_raty', 'select2', 'um-jquery-form', 'um-fileupload' ), ultimatemember_version, true );
wp_register_script( 'um_scripts', $this->front_js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'um_functions', 'um_crop', 'um_raty', 'select2', 'um_jquery_form', 'um_fileupload' ), ultimatemember_version, true );
wp_register_script( 'um_responsive', $this->front_js_baseurl . 'um-responsive' . $this->suffix . '.js', array( 'um_scripts' ), ultimatemember_version, true );
wp_register_script( 'um_modal', $this->front_js_baseurl . 'um-modal' . $this->suffix . '.js', array( 'um_responsive' ), ultimatemember_version, true );
+11 -10
View File
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Ultimate Member\n"
"POT-Creation-Date: 2018-12-09 15:45+0200\n"
"PO-Revision-Date: 2018-12-09 15:45+0200\n"
"POT-Creation-Date: 2018-12-13 17:43+0200\n"
"PO-Revision-Date: 2018-12-13 17:43+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en_US\n"
@@ -249,16 +249,16 @@ msgstr ""
msgid "Yes"
msgstr ""
#: includes/admin/core/class-admin-enqueue.php:75
#: includes/admin/core/class-admin-enqueue.php:157
msgid "e.g. Member Directory"
msgstr ""
#: includes/admin/core/class-admin-enqueue.php:77
#: includes/admin/core/class-admin-enqueue.php:159
msgid "e.g. New Registration Form"
msgstr ""
#: includes/admin/core/class-admin-enqueue.php:122
#: includes/admin/core/class-admin-enqueue.php:153
#: includes/admin/core/class-admin-enqueue.php:204
#: includes/admin/core/class-admin-enqueue.php:235
#: includes/admin/core/class-admin-forms.php:823
#: includes/admin/core/class-admin-forms.php:837
#: includes/admin/core/class-admin-forms.php:942
@@ -268,13 +268,13 @@ msgstr ""
msgid "Remove"
msgstr ""
#: includes/admin/core/class-admin-enqueue.php:123
#: includes/admin/core/class-admin-enqueue.php:154
#: includes/admin/core/class-admin-enqueue.php:205
#: includes/admin/core/class-admin-enqueue.php:236
#: includes/admin/core/class-admin-forms.php:1019
msgid "Select"
msgstr ""
#: includes/admin/core/class-admin-enqueue.php:151
#: includes/admin/core/class-admin-enqueue.php:233
msgid "Are sure, maybe some settings not saved"
msgstr ""
@@ -1224,7 +1224,8 @@ msgid ""
"Thanks for installing <strong>%s</strong>! We hope you like the plugin. To "
"fund full-time development and support of the plugin we also sell "
"extensions. If you subscribe to our mailing list we will send you a 20%% "
"discount code for our <a href=\"%s\" target=\"_blank\">extensions bundle</a>."
"discount code for one of our <a href=\"%s\" target=\"_blank\">access passes</"
"a>."
msgstr ""
#: includes/admin/core/class-admin-notices.php:498
+6
View File
@@ -137,6 +137,12 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
= 2.0.36: December 17, 2018 =
* Bugfixes:
- Fixed Live Preview form at wp-admin
- Fixed tinyMCE editor loading in form builder
= 2.0.35: December 9, 2018 =
* Bugfixes:
+1 -1
View File
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
Version: 2.0.35
Version: 2.0.36
Author: Ultimate Member
Author URI: http://ultimatemember.com/
Text Domain: ultimate-member