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

Restricted editing exception blank spans #9646

Open
enable934 opened this issue May 7, 2021 · 6 comments · May be fixed by #17367
Open

Restricted editing exception blank spans #9646

enable934 opened this issue May 7, 2021 · 6 comments · May be fixed by #17367
Assignees
Labels
package:restricted-editing resolution:expired This issue was closed due to lack of feedback. squad:core Issue to be handled by the Core team. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@enable934
Copy link

enable934 commented May 7, 2021

When call multiple times editor.setData(html), where html has restricted editing blocks, CKEditor inserts empty spans like this one:
<span class="restricted-editing-exception restricted-editing-exception_collapsed"></span>
Futhermore if u call setData 3 times with immutable html the result documents will include 3 empty spans even given html has only 1 restricted block.
Do you know any workarounds for this problem?).
Code:
image
Expect:
image
Result:
image
Env: Decoupled CKEDITOR5 build with enabled restrictedEditing plugin

@FilipTokarski
Copy link
Member

Hi, thanks for the report. Steps to reproduce on docs:

  1. Go to https://ckeditor.com/docs/ckeditor5/latest/features/restricted-editing.html
  2. Switch to restricted mode
  3. Do editor.setData(editor.getData()) few times

@FilipTokarski FilipTokarski added package:restricted-editing type:bug This issue reports a buggy (incorrect) behavior. squad:core Issue to be handled by the Core team. labels May 7, 2021
@arminyahya
Copy link

Hi
I examined this today. I realized this is happening on this line:

// 2. But for collapsed marker we need to render it as an element.
// Additionally the editing pipeline should always display a collapsed marker.
editor.conversion.for( 'editingDowncast' ).markerToElement( {
model: 'restrictedEditingException',
view: ( markerData, { writer } ) => {
return writer.createUIElement( 'span', {
class: 'restricted-editing-exception restricted-editing-exception_collapsed'
} );
}
} );

I want to debug this case. I am looking for a way so that if the marker was already around the word, this line would not be executed anymore.

What is your opinion? @FilipTokarski

@niegowski
Copy link
Contributor

The thing there is that the restricted editing resurrection mechanism is bringing back markers on removed nodes. While calling editor.setData() the content of root is removed (so are the markers because they are marking the nodes in $graveyard) but they are resurrected right away. I think that we should remove all restrictedEditingException markers while editor.data.set() is called (it's a decorated method).

@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past two years. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

@CKEditorBot CKEditorBot added the resolution:expired This issue was closed due to lack of feedback. label Oct 14, 2023
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2023
@Mati365 Mati365 self-assigned this Oct 30, 2024
@Mati365
Copy link
Member

Mati365 commented Oct 31, 2024

@niegowski I added fix based on your comment. Can you take a look? PR: #17367

@Mati365 Mati365 reopened this Oct 31, 2024
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:stale labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:restricted-editing resolution:expired This issue was closed due to lack of feedback. squad:core Issue to be handled by the Core team. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants