Skip to content

There is a flash of HTML when submitting a form with TinyMCE (requires change in core AND TinyMCE module) #198

Description

@swampopus

This is related to this issue in core: backdrop/backdrop-issues#7158

Basically, when the form is saved, the editor is removed and the user briefly sees a textarea with plain HTML instead of the editor.

This is easily fixed with a simple if statement, checking to see if the form is submitting or not. If it is, do not remove the editor.

Unfortunately (unless there is another way to handle this), this requires a single line of code added to core's filter.js file, as seen in this core issue and PR: backdrop/backdrop-issues#7149

Once that is in place (or if there is another technique for detecting the form is being submitted which can be used), then THIS bug would be easy to fix with the following code for tinymce-integration.js, on line 143:

    detach: function (element, format, trigger) {
      if (trigger === 'serialize') {
        tinymce.triggerSave();
        return;
      }
      if (Backdrop.settings.formIsSubmitting != true) {
        let idSelector = '#' + element.id;
        tinymce.remove(idSelector);
      }
    }

If the core PR gets merged, I will immediately create a PR for TinyMCE which adds this little bit of code. I wanted to create this issue in the meantime, to document the situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions