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

Metabox group: wysiwig content replaced with post content after deactivate Classic Editor #1381

Closed
SimonvanWijhe opened this issue Jul 27, 2020 · 6 comments
Assignees

Comments

@SimonvanWijhe
Copy link

Issue Overview

Metabox group: wysiwig content replaced with post content after deactivate Classic Editor.

Steps to Reproduce (for bugs)

  1. Add the following code to functions.php:
add_filter('rwmb_meta_boxes', 'meta_box_group_demo_register');
function meta_box_group_demo_register($meta_boxes)
{
    $meta_boxes[] = array(
        'title'  => 'Demo group',
        'fields' => array(
            array(
                'id'     => 'standard',
                'type'   => 'group',
                'clone'  => true,
                'sort_clone' => true,
                'fields' => array(
                    array(
                        'name' => 'Demo field',
                        'id' => 'demo-field',
                        'type' => 'wysiwyg',
                        'options' => array(
                            'textarea_rows' => 4,
                        ),
                    )
                ),
            ),
        ),
    );
    return $meta_boxes;
}
  1. Install "Classic Editor" plugin by Wordpress Contributors
  2. Create a post.
  3. Add some post content.
  4. Add content to demo field.
  5. Click 'Add more'
  6. Add content to second demo field.
  7. Switch the demo fields around.

Expected Behavior

Expect the group fields to display their content, as before moving it.

Current Behavior

The content of the group fields are replaced with the post content.

Screenshots / Video

demo-wysiwyg-group-classic-editor

Additional information:

@edwinsiebel
Copy link

This is a annoying bug. We also have the same issue.

I've traced it down to the file js/clone.js and specific line 245:

tinymce.execCommand( 'mceAddEditor', true, this.id );

When removing this line, the drag and drop is successful, however the tab visual is switch to text, and the editor show the html instead of the styled text.

Hope this helps the journey into this bug.

@edwinsiebel
Copy link

Adding editor.execCommand('mceSetContent', false, this.id); above tinymce.execCommand( 'mceAddEditor', true, this.id ); (line 245) does seem to fix the problem of the content being swapped.

The tabs are still scambled (see my previous post)

@viet34tqc
Copy link
Contributor

@edwinsiebel
What is 'editor' in editor.execCommand('mceSetContent', false, this.id);?

@edwinsiebel
Copy link

@viet34tqc , never mind my reaction. The editor.execCommand('mceSetContent', false, this.id); returns an error, so that's why tinymce.execCommand( 'mceAddEditor', true, this.id ); was not executed, and thus that 'fixes' what I wrote in #1381 (comment).

@edwinsiebel
Copy link

Any research or improvements on this post?

@rilwis
Copy link
Member

rilwis commented May 22, 2024

Hi,

This is an old issue and it seems to be fixed in the latest version of Meta Box and extensions. So I'll close the issue.

If you still notice the bug, please re-open it.

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

No branches or pull requests

5 participants