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

Pasting error in table when using custom sanitizer #980

Closed
seonim-ryu opened this issue May 12, 2020 · 0 comments
Closed

Pasting error in table when using custom sanitizer #980

seonim-ryu opened this issue May 12, 2020 · 0 comments

Comments

@seonim-ryu
Copy link
Member

seonim-ryu commented May 12, 2020

Describe the bug

When using the customHTMLSanitizer option, a script error occurs when pasting data in a WYSIWYG table.

const editor = new Editor({
  // ...
  customHTMLSanitizer: html => {
    return sanitize(html); // user's sanitizer
  }
});

To Reproduce

Steps to reproduce the behavior:

  1. Create a table in WYSIWYG and paste the data into table cells.
  2. Paste normal data or copy and paste cells within a table.
  3. Pasting is not possible due to a script error.

Expected behavior

When pasting data in a table, it should behave the same as a normal paste.

Cause

When pasting in a table, an error occurs because the paste value is processed as a string when no sanitizer is used or a custom sanitizer is used.

container.innerHTML = sanitizer(container.innerHTML, true);

container.appendChild(sanitizer ? sanitizer(html) : html);

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Sanitizer specification for paste

When pasting, the sanitizer behavior should be changed to run the default sanitizer used inside the Editor and then run customHTMLSanitizer.

Return value of custom sanitizer

The sanitized value should be returned as a string.

@seonim-ryu seonim-ryu changed the title Pasting error in table when using custom sanitizer option Pasting error in table when using custom sanitizer May 12, 2020
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

1 participant