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

[Bug] When doing a block conversion, it strips all formatting #2227

Open
ARH3 opened this issue Dec 22, 2022 · 3 comments
Open

[Bug] When doing a block conversion, it strips all formatting #2227

ARH3 opened this issue Dec 22, 2022 · 3 comments
Labels

Comments

@ARH3
Copy link

ARH3 commented Dec 22, 2022

When I convert a paragraph to a header, for example, it strips all html tags.. including ones that should be saved by sanitize. Bold, italics, underline, links, and any other expected HTML gets stripped. This happens across all conversions that I've tested.

Steps to reproduce:

  1. Go to editorjs.io
  2. Select any paragraph block that has alternative formatting (inline code, marker, links, etc)
  3. Convert it to a heading or quote, using the option available within the inline toolbar (on the left). You'll notice that all html tags are stripped and links, etc are lost.

Expected behavior: html tags should be preserved and interpreted by the rules defined in the Tool Class it is transforming into. Perhaps ideally, it runs through the onPaste and/or Sanitize functions... rather than stripping all html.

Screenshots: easy to reproduce on editorjs.io

Device, Browser, OS: Macbook Pro, Mac OS 11.7, Chrome Version 108.0.5359.124 (Official Build) (x86_64)

Editor.js version: @latest as of 12/22/22

Plugins you use with their versions: Easily reproducable on editorjs.io

Thank you!!

@ARH3 ARH3 added the bug label Dec 22, 2022
@ARH3
Copy link
Author

ARH3 commented Dec 29, 2022

Here is some more evidence. This is the conversionConfig in my Tool:
image

And here is my console output, notice the missing
on the import:
image

When I try to pass the entire data object through (which I know is not what I'm supposed to do)...
image

It clearly gets passed through a toString function of some sort along the way... and as a result shows up as [Object object] even in the console.
image

Since you are passing text through the export, no additional parsing should be necessary. Expected behavior is the exact string, including potential html and relevant markup, is received on the import.

Please help!

@ARH3
Copy link
Author

ARH3 commented Dec 31, 2022

If it helps anyone, I hope this is resolved rather than being expected behavior... but in the meantime I was able to work around it by using Tunes instead of Tools for my use case!

@ncer
Copy link

ncer commented Jun 2, 2023

As I see the sanitized data is used in the import method. Is it possible to make sanitizing optional?

image

https://github.com/codex-team/editor.js/blob/next/src/components/modules/toolbar/conversion.ts#L223

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

No branches or pull requests

2 participants