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

Preserve empty inline elements #17524

Closed
dsdon opened this issue Nov 22, 2024 · 1 comment
Closed

Preserve empty inline elements #17524

dsdon opened this issue Nov 22, 2024 · 1 comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:bug This issue reports a buggy (incorrect) behavior.

Comments

@dsdon
Copy link

dsdon commented Nov 22, 2024

📝 Provide detailed reproduction steps (if any)

CKEditor4 uses an empty anchor element as the destination for a document/bookmark link. CKEditor5 removes the empty anchor element.

  1. In Source view, type <a id="footnotes" name="footnotes"></a>
  2. Switch back to WYSIWYG view, then switch back to Source view.

✔️ Expected result

Preserve the empty anchor element

❌ Actual result

The empty anchor element is removed.

📃 Other details

This appeared to be fixed in Issue#: 9888 but seems to be broken again.
I was able to duplicate this in the "Source code editing and HTML support" demo.
I also tried this using an empty span tag and had the same results so I assume this applies to all empty inline elements that have opening/closing tags.

  • Browser: Chrome Version: 131.0.6778.71
  • OS: Windows 11
  • First affected CKEditor version: 43.2.0
  • Installed CKEditor plugins: …
    import {
    ClassicEditor,
    AccessibilityHelp,
    Alignment,
    Autoformat,
    AutoImage,
    AutoLink,
    Autosave,
    BlockQuote,
    Bold,
    CloudServices,
    Code,
    CodeBlock,
    Essentials,
    FindAndReplace,
    FontBackgroundColor,
    FontColor,
    FontFamily,
    FontSize,
    GeneralHtmlSupport,
    Heading,
    Highlight,
    HorizontalLine,
    HtmlComment,
    HtmlEmbed,
    ImageBlock,
    ImageCaption,
    ImageInline,
    ImageInsertViaUrl,
    ImageResize,
    ImageStyle,
    ImageTextAlternative,
    ImageToolbar,
    ImageUpload,
    Indent,
    IndentBlock,
    Italic,
    Link,
    LinkImage,
    List,
    ListProperties,
    MediaEmbed,
    PageBreak,
    Paragraph,
    PasteFromOffice,
    RemoveFormat,
    SelectAll,
    ShowBlocks,
    SourceEditing,
    SpecialCharacters,
    SpecialCharactersArrows,
    SpecialCharactersCurrency,
    SpecialCharactersEssentials,
    SpecialCharactersLatin,
    SpecialCharactersMathematical,
    SpecialCharactersText,
    Strikethrough,
    Style,
    Subscript,
    Superscript,
    Table,
    TableCaption,
    TableCellProperties,
    TableColumnResize,
    TableProperties,
    TableToolbar,
    TextPartLanguage,
    TextTransformation,
    // Title,
    Underline,
    Undo
    } from 'ckeditor5';

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@dsdon dsdon added the type:bug This issue reports a buggy (incorrect) behavior. label Nov 22, 2024
@Witoso
Copy link
Member

Witoso commented Nov 25, 2024

Bookmarks feature will be available in the next release (#1944). Meanwhile, to preserve empty elements, you need to configure GeneralHtmlSupport with the allowEmpty property.

@Witoso Witoso closed this as completed Nov 25, 2024
@Witoso Witoso added the resolution:resolved This issue was already resolved (e.g. by another ticket). label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

2 participants