ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

(Non-breaking Space) Inserted After Custom Container Elements in Inline Widgets

Open enes-akguen opened this issue 1 year ago • 2 comments

I have encountered an issue where   (non-breaking spaces) are automatically inserted after custom container elements (ContainerElement). This occurs specifically when using inline widgets.

I followed the official CKEditor 5 inline widget example to create a custom inline widget. The widget works well, but I noticed that after typing a space following the container element, a   is inserted automatically.

Is there a way to prevent CKEditor from inserting   after container elements, particularly in this scenario with inline widgets? I would appreciate any guidance or potential workarounds for this behavior.

enes-akguen avatar Oct 16 '24 19:10 enes-akguen

I do not know what element you use for your widget, but it is most probably an element not registered as an inline object in the DomConverter.

For common inline elements that should be treated as an inline object (display inline-block) you could specify more attributes of the element to be recognized as an inline object. For example <span class="placeholder"> could be an inline object but plain <span> would not.

Here is an example from not yet released bookmark feature: https://github.com/ckeditor/ckeditor5/blob/8a5694308a87a3dbaa3bc88cdb217475e92ff754/packages/ckeditor5-bookmark/src/bookmarkediting.ts#L99-L103

niegowski avatar Oct 17 '24 11:10 niegowski

Thanks, this helped

enes-akguen avatar Oct 17 '24 12:10 enes-akguen

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

CKEditorBot avatar Oct 17 '25 23:10 CKEditorBot

We've closed your issue due to inactivity. 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 avatar Nov 17 '25 23:11 CKEditorBot