Skip to content

Setting HTML messes with cke #357

@soerenmeier

Description

@soerenmeier

Describe the bug

Well this is probably a big edge case.

I read the html of the editor and then set it again (see repro code).
If a cke is inside a block the formatting inside that block is lost after saving.

See this video for an example:

Screencast.From.2025-11-27.17-18-59.webm

Steps to reproduce

  1. Install Control Panel JS:
    Add the following js as its content:
document.addEventListener('onVizyConfigReady', () => {
    let first = true;

    Craft.Vizy.Config.registerExtensions((extensions, vizyInput) => {
        if (!first) return;
        first = false;

        window.vizyGetSetHTML = () => {
            const html = vizyInput.editor.getHTML();
            vizyInput.editor.chain().focus().setContent(html, true).run();
            console.log('set content to: ', html);
        };

        console.log('vizyGetSetHTML registered');
	});
});
  1. Open a page with a vizy field with a cke field inside a block (see video).
  2. Go into the console and execute the function vizyGetSetHTML().
  3. After reloading the page, the formatting in the cke is gone.

Craft CMS version

5.8.20

Plugin version

3.0.12

Multi-site?

No

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions