Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placing two editor controls in the customizer leads to odd behavior. #140

Closed
briancwelch opened this issue Mar 29, 2015 · 13 comments
Closed

Comments

@briancwelch
Copy link
Contributor

When placing two editor controls within the customizer, one of the editor controls will have two toolbars.

Code used:

    $controls[] = array(
        'type'        => 'editor',
        'setting'     => 'projects_html_before',
        'label'       => __( 'Add/Edit Projects - Custom HTML (Before)', 'maera-diy' ),
        'description' => __( 'You can use this field to enter any custom HTML that you would like to be displayed before the Add/Edit projects fields in the popup window.', 'maera-diy' ),
        'default'     => '<h1>My Projects</h1>',
        'priority'    => 2,
        'section'     => 'maera_diy_general',
    );

    $controls[] = array(
        'type'        => 'editor',
        'setting'     => 'projects_html_after',
        'label'       => __( 'Add/Edit Projects - Custom HTML (After)', 'maera-diy' ),
        'description' => __( 'You can use this field to enter any custom HTML that you would like to be displayed after the Add/Edit projects fields in the popup window.', 'maera-diy' ),
        'default'     => '<h1>My Projects</h1>',
        'priority'    => 3,
        'section'     => 'maera_diy_general',
    );

Visual Reference.
capture

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@aristath aristath modified the milestone: 1.0 Mar 29, 2015
@dmgawel
Copy link
Contributor

dmgawel commented Apr 3, 2015

Which version of WordPress does it affect?

@aristath
Copy link
Contributor

aristath commented Apr 3, 2015

latest + trunk.

@aristath aristath self-assigned this Jun 13, 2015
@aristath aristath modified the milestones: 1.1, 1.0 Jun 20, 2015
@aristath aristath removed their assignment Sep 19, 2015
@aristath aristath modified the milestones: 1.1, 2.0 Nov 24, 2015
@nickkuijpers
Copy link

Any temp fixes for this issue?

@aristath
Copy link
Contributor

aristath commented Dec 7, 2015

I'm afraid not... The reason this issue occurs is still a mystery to me, I haven't been able to determine why it occurs.
If we find out why it happens we'll be able to fix it...

@nickkuijpers
Copy link

Okay, will dive into it. Thanks!

@nickkuijpers
Copy link

Couldn't find it either.. debugged some scripts and found out the following. If you console.log the registered MCE you see that if you add 1 editor field all goes well but if you add a second one, it loops thought all the registered ones, so first one = 1 time, second time = 3 times. 1 + 2 = 3.

See the following code, this is when i console.log public/wp-includes/class-wp-editor.php at row 1246 add the following so you can view all registered mce's.

console.log(init);

For some reason it double registeres them.

var init, id, $wrap;

            if ( typeof tinymce !== 'undefined' ) {
                for ( id in tinyMCEPreInit.mceInit ) {
                    init = tinyMCEPreInit.mceInit[id];
                    $wrap = tinymce.$( '#wp-' + id + '-wrap' );

                    console.log(init);

                    if ( ( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) && ! init.wp_skip_init ) {
                        tinymce.init( init );

                        if ( ! window.wpActiveEditor ) {
                            window.wpActiveEditor = id;
                        }
                    }
                }
            }
bject {
    theme: "modern",
    skin: "lightgray",
    language: "nl",
    formats: Object,
    relative_urls: false…
}
body_class: "footer_tekst_1 locale-nl-nl"
browser_spellcheck: truecache_suffix: "wp-mce-4205-20150910"
content_css: "http://talento.sageinku/wp-includes/css/dashicons.min.css?ver=4.3.1,http://talento.sageinku/wp-includes/js/tinymce/skins/wordpress/wp-content.css?ver=4.3.1,http://talento.sageinku/wp-content/themes/talento/dist/styles/main.css,http://talento.sageinku/wp-content/plugins/shortcode-ui/css/shortcode-ui-editor-styles.css"
convert_urls: falseend_container_on_empty_block: trueentities: "38,amp,60,lt,62,gt"
entity_encoding: "raw"
fix_list_elements: trueformats: Objectindent: falsekeep_styles: falselanguage: "nl"
menubar: falseplugins: "colorpicker,lists,fullscreen,image,wordpress,wpeditimage,wplink"
preview_styles: "font-family font-size font-weight font-style text-decoration text-transform"
relative_urls: falseremove_script_host: falseresize: "vertical"
selector: "#footer_tekst_1"
skin: "lightgray"
tabfocus_elements: ":prev,:next"
theme: "modern"
toolbar1: "bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link,unlink,fullscreen"
toolbar2: ""
toolbar3: ""
toolbar4: ""
wpautop: truewpeditimage_disable_captions: falsewpeditimage_html5_captions: true__proto__: Object
VM38661: 10 Object {
    theme: "modern",
    skin: "lightgray",
    language: "nl",
    formats: Object,
    relative_urls: false…
}
body_class: "footer_tekst_1 locale-nl-nl"
browser_spellcheck: truecache_suffix: "wp-mce-4205-20150910"
content_css: "http://talento.sageinku/wp-includes/css/dashicons.min.css?ver=4.3.1,http://talento.sageinku/wp-includes/js/tinymce/skins/wordpress/wp-content.css?ver=4.3.1,http://talento.sageinku/wp-content/themes/talento/dist/styles/main.css,http://talento.sageinku/wp-content/plugins/shortcode-ui/css/shortcode-ui-editor-styles.css"
convert_urls: falseend_container_on_empty_block: trueentities: "38,amp,60,lt,62,gt"
entity_encoding: "raw"
fix_list_elements: trueformats: Objectindent: falsekeep_styles: falselanguage: "nl"
menubar: falseplugins: "colorpicker,lists,fullscreen,image,wordpress,wpeditimage,wplink"
preview_styles: "font-family font-size font-weight font-style text-decoration text-transform"
relative_urls: falseremove_script_host: falseresize: "vertical"
selector: "#footer_tekst_1"
skin: "lightgray"
tabfocus_elements: ":prev,:next"
theme: "modern"
toolbar1: "bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link,unlink,fullscreen"
toolbar2: ""
toolbar3: ""
toolbar4: ""
wpautop: truewpeditimage_disable_captions: falsewpeditimage_html5_captions: true__proto__: Object
VM38661: 10 Object {
    theme: "modern",
    skin: "lightgray",
    language: "nl",
    formats: Object,
    relative_urls: false…
}
body_class: "footer_tekst_2 locale-nl-nl"
browser_spellcheck: truecache_suffix: "wp-mce-4205-20150910"
content_css: "http://talento.sageinku/wp-includes/css/dashicons.min.css?ver=4.3.1,http://talento.sageinku/wp-includes/js/tinymce/skins/wordpress/wp-content.css?ver=4.3.1,http://talento.sageinku/wp-content/themes/talento/dist/styles/main.css,http://talento.sageinku/wp-content/plugins/shortcode-ui/css/shortcode-ui-editor-styles.css"
convert_urls: falseend_container_on_empty_block: trueentities: "38,amp,60,lt,62,gt"
entity_encoding: "raw"
fix_list_elements: trueformats: Objectindent: falsekeep_styles: falselanguage: "nl"
menubar: falseplugins: "colorpicker,lists,fullscreen,image,wordpress,wpeditimage,wplink"
preview_styles: "font-family font-size font-weight font-style text-decoration text-transform"
relative_urls: falseremove_script_host: falseresize: "vertical"
selector: "#footer_tekst_2"
skin: "lightgray"
tabfocus_elements: ":prev,:next"
theme: "modern"
toolbar1: "bold,italic,underline,blockquote,strikethrough,bullist,numlist,alignleft,aligncenter,alignright,undo,redo,link,unlink,fullscreen"
toolbar2: ""
toolbar3: ""
toolbar4: ""
wpautop: truewpeditimage_disable_captions: falsewpeditimage_html5_captions: true__proto__: Object

@aristath aristath modified the milestones: 2.0, 2.1 Dec 19, 2015
@aristath aristath modified the milestones: 2.2, 2.2.1 Mar 3, 2016
@enginne
Copy link

enginne commented Mar 16, 2016

@aristath - I don´t know if this helps to this issue but i found someone who apparently find out what is causing the issue with more than one editor in the customizer.
Apparently they found the cause but they're still struggling with the fix.
I wish i could help but this is way too advanced for my current skills.
Please take a look in:
[https://github.com/paulund/wordpress-theme-customizer-custom-controls/issues/20]

@aristath aristath removed this from the 2.2.1 milestone Mar 17, 2016
@alexdonh
Copy link

alexdonh commented May 13, 2016

is this one really resolved? i'm currently on latest rev and looks like it still happening (to me). Anyone else confirm?

image

code snippets:

Kirki::add_field( 'bushwicked', array( 'type' => 'editor', 'settings' => 'portfolios_content', 'label' => __( 'Content', 'bushwicked' ), 'description' => __( 'Some introductory text content displayed right below the heading.', 'bushwicked' ), 'section' => 'portfolios', 'required' => array( array( 'setting' => 'enable_portfolios', 'operator' => '==', 'value' => 1 ) ) ) );

then

Kirki::add_field( 'bushwicked', array( 'type' => 'editor', 'settings' => 'services_content', 'label' => __( 'Content', 'bushwicked' ), 'description' => __( 'Some introductory text content displayed right below the heading.', 'bushwicked' ), 'section' => 'services', 'required' => array( array( 'setting' => 'enable_services', 'operator' => '==', 'value' => 1 ) ) ) );

(in another section)

@manandharsudin
Copy link

manandharsudin commented May 23, 2016

Yeah, it still exists and not solved when used in theme. But it is working when using Kirki as a plugin.
Hi, @aristath can you take a look.

Thanks

@aristath
Copy link
Contributor

Do you perhaps have another plugin activated that uses a WYSIWYG? perhaps something like customize-posts?

@aristath aristath reopened this May 23, 2016
@manandharsudin
Copy link

No, I don't. I've checked it in clean install without any plugin activated.

@aristath
Copy link
Contributor

@manandharsudin I believe this was just fixed in the develop branch, can you please verify it?

@manandharsudin
Copy link

@aristath Yes the develop branch is working fine. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants