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

Unexpected call to sanitizeToDOMFragment in Version 11.1.1 breaking new lines in iOS #413

Open
cvle opened this issue Jun 8, 2021 · 1 comment

Comments

@cvle
Copy link

cvle commented Jun 8, 2021

Since version 11.1.1 there is a Problem with creating a new line on iOS.

When using a simple sanitizeToDOMFragment like this:

const createSanitizeToDOMFragment = () => {
  const purify = createDOMPurify(window);
  purify.setConfig({
    ALLOWED_TAGS: ["div", "br"],
    RETURN_DOM: true,
  });

  return (html: string) => {
    const frag = document.createDocumentFragment();
    if (html) {
      // Added this for debug.
      alert(html);

      const sanitized = purify.sanitize(html);
      while (sanitized.firstChild) {
        frag.appendChild(sanitized.firstChild);
      }
    }
    return frag;
  };
};

Starting with version 11.1.1 sanitizeToDOMFragment would be called when tapping Enter to create a new line.

image

Afterwards the cursor gets moved to the beginning of the RTE without actually creating a new line.

image

This only happens in version 11.1.1, so it must be caused by this commit 108ff8f

As a workaround I have downgraded to 11.1.0 which fixed the issue.

Also I want to take this moment to thank you all for this awesome open source project <3

cvle added a commit to coralproject/rte that referenced this issue Jun 8, 2021
cvle added a commit to coralproject/rte that referenced this issue Jun 9, 2021
cvle added a commit to coralproject/rte that referenced this issue Jun 9, 2021
@Dorfeuheinz
Copy link

Hey, is it possible if you could tell me how the sarcasm button works? & howd you implement that & spoiler as its not present by default

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

2 participants