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

HTML structure is destroyed when changes are made #4866

Open
SKPFCW opened this issue Jan 22, 2025 · 0 comments
Open

HTML structure is destroyed when changes are made #4866

SKPFCW opened this issue Jan 22, 2025 · 0 comments

Comments

@SKPFCW
Copy link

SKPFCW commented Jan 22, 2025

Hello everyone.

Let's assume you have a span structure like this in the editor document:

<p>lorem ipsum ... </p>

<span class="-label" contenteditable="false">
  <span>Label Line 1</span>
  <span>Label Line 2</span>
</span>

<p>lorem ipsum ... </p>

The inner span elements are used to assign css attributes to the structure, e.g:

span.-label {
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  border: 1px solid black;
  border-radius: 4px;
  padding: 2px;  
}

span.-label > span{
  flex: 1 1 100%;
}

span.-label > span:nth-child(1) {
  font-weight: bold;
}

Expected result:

Image

If changes are made in the editor (e.g. changing the font size in the previous paragraph), the span element loses its children:

<span class="-label" contenteditable="false">Label Line 1Label Line 2</span>

Result:

Image

Setting the ‘htmlUntouched’ option to true does not solve the problem.
The specified span structure is provided by an external service and cannot be changed by me.

See Fiddle:
https://jsfiddle.net/w10kjq54/

I am thankful for any help.

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

1 participant