mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
TODO: fix JS errors
This commit is contained in:
@@ -37,7 +37,7 @@ function um_admin_new_modal( id, ajax, size ) {
|
||||
function um_tinymce_init( id, content ) {
|
||||
var object = jQuery('#' + id);
|
||||
|
||||
if ( tinyMCE.get( id ) !== null ) {
|
||||
if ( typeof(tinyMCE) === 'object' && 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 );
|
||||
@@ -55,7 +55,9 @@ function um_tinymce_init( id, content ) {
|
||||
QTags( tinyMCEPreInit.qtInit[ id ] );
|
||||
QTags._buttonsInit();
|
||||
}
|
||||
window.switchEditors.go( id );
|
||||
if ( typeof(window.switchEditors) === 'object' ) {
|
||||
window.switchEditors.go( id );
|
||||
}
|
||||
tinyMCE.init( init );
|
||||
tinyMCE.get( id ).setContent( content );
|
||||
object.html( content );
|
||||
@@ -77,7 +79,7 @@ function um_tinymce_init( id, content ) {
|
||||
jQuery( 'body' ).on( 'click', '.wp-switch-editor', function() {
|
||||
var target = jQuery(this);
|
||||
|
||||
if ( target.hasClass( 'wp-switch-editor' ) ) {
|
||||
if ( target.hasClass( 'wp-switch-editor' ) && typeof(window.switchEditors) === 'object' ) {
|
||||
var mode = target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
||||
window.switchEditors.go( id, mode );
|
||||
}
|
||||
|
||||
@@ -265,8 +265,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
wp_register_style( 'um_admin_modal', $this->css_url . 'um-admin-modal.css', array( 'wp-color-picker' ), ultimatemember_version );
|
||||
wp_enqueue_style( 'um_admin_modal' );
|
||||
|
||||
wp_register_script( 'um_admin_modal', $this->js_url . 'um-admin-modal.js', array( 'jquery', 'wp-util', 'wp-color-picker' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_admin_modal', $this->js_url . 'um-admin-modal.js', array( 'jquery', 'editor', 'wp-util', 'wp-color-picker', 'wp-tinymce' ), ultimatemember_version, true );
|
||||
wp_enqueue_script( 'um_admin_modal' );
|
||||
|
||||
if ( ! class_exists( '_WP_Editors', false ) ) {
|
||||
require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
|
||||
}
|
||||
if ( ! did_action( 'print_default_editor_scripts' ) ) {
|
||||
\_WP_Editors::editor_js();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1180,6 +1180,15 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// echo '<pre>';;
|
||||
// echo '<br>$screen<br>';
|
||||
// var_dump($screen);
|
||||
// echo '<br>$this->is_loaded<br>';
|
||||
// var_dump($this->is_loaded);
|
||||
// echo '</pre>';
|
||||
|
||||
|
||||
// needed on forms only
|
||||
if ( ! isset( $this->is_loaded ) && isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
|
||||
$settings['textarea_rows'] = 8;
|
||||
|
||||
Reference in New Issue
Block a user