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

Switch off semantic correction and other DOM corrections #720

Closed
vasotelvi opened this issue Apr 20, 2021 · 9 comments
Closed

Switch off semantic correction and other DOM corrections #720

vasotelvi opened this issue Apr 20, 2021 · 9 comments

Comments

@vasotelvi
Copy link

Hi!
Is it possible to switch off semantic correction and other DOM corrections?

@JiHong88
Copy link
Owner

@vasotelvi Sorry I don't understand what I mean.
Could you please explain again?

@vasotelvi
Copy link
Author

vasotelvi commented Apr 20, 2021

I have to see raw text data in SunEditor. In raw text I have

<div class='message'>
<h4>Heading</h4>
<p>Paragraph</p>
</div>

When I initialize SunEditor, I have this semantic correction – heading extracted outside of div container

<h4>Heading</h4>

<div class='message'>
<p>Paragraph</p>
</div>

And every line break \n in text generates paragraphs wrapping text from line break to line break

Text \n
Text

transform to

<p>Text</p>\n
<p>Text</p>\n

Hope, I explained enough.

@JiHong88
Copy link
Owner

JiHong88 commented Apr 20, 2021

You can use the __se__tag or __se__format_xxx class.

__se__tag refer:
#397
#594 (comment)

__se__format_xxx refer:
#412 (comment)

simple ex)

<div class='message __se__format__range_message'>
  <h4>Heading</h4>
  <p>Paragraph</p>
</div>

@vasotelvi
Copy link
Author

vasotelvi commented Apr 21, 2021

Unfortunately I can't modify and add extra classes in raw text to solve this inconvenience before I initialize SunEditor for textareas. 😪

@JiHong88
Copy link
Owner

I don't understand..
The contents of the initial "text area" must be entered directly.

@anthomus
Copy link

I believe what @vasotelvi is suggesting and I agree is to have a config setting that would disable semantic corrections for the entire component vs having to put this in a class attribute. With this setting, we would not want Suneditor to reorder tags or rewrite tags if they are valid HTML/XML. It is OK to remove tags not in the "whitelist", but not to restructure the HTML.

Reasons:

  1. Users of the application containing the Suneditor will not know to use these special class attributes, and therefore as the application programmer we want to be able to control whether to allow corrections or not. (Generally I can't imagine a use case for reordering HTML that was pasted or entered.)

  2. Users may have existing HTML snippets that they are pasting in that require certain HTML structure, and reordering elements may not change the appearance in the Suneditor, but may change the behavior of the HTML where used with CSS selectors.

@anthomus
Copy link

Would it be easy to add a config setting that would achieve the same behavior as __se__tag for the entire component in the 2.x branch?

@JiHong88
Copy link
Owner

@anthomus Yes you are right, In code view mode, I will modify the format format so that it does not check duplicates.

"format" is an important prerequisite for the current editor function.
Custom issues related to "format" like this issue will be fixed in v3.0.0.

@JiHong88 JiHong88 added this to the 2.40.1 milestone Jun 18, 2021
@JiHong88
Copy link
Owner

The 2.41.0 version has been updated.
Thank you.

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

3 participants