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 initial space for HTML element if there is no text node in parent element #791

Open
beatadelura opened this issue Aug 16, 2017 · 1 comment
Labels
status:confirmed An issue confirmed by the development team. support:2 An issue reported by a commercially licensed client. type:bug A bug.

Comments

@beatadelura
Copy link
Contributor

Are you reporting a feature request or a bug?

Bug. This issue is related to #605 .

Provide detailed reproduction steps (if any)

  1. Go to https://jsfiddle.net/cf5d457L/5/
  2. Click Source button
  3. Input <p><span> lorem </span>ipsum</p>
  4. Switch to WYSIWYG mode
  5. Click Source button

Expected result

There is an empty space before text lorem:
<p><span> lorem </span>ipsum</p>

Actual result

An empty space has been missed before lorem text.
<p><span>lorem </span>ipsum</p>

Please note, if you put any word before span element, like:
<p>lorem<span> lorem </span>ipsum</p> it works fine.

Other details

  • Browser: Chrome Version 60.0.3112.90
  • OS: macOS
  • CKEditor version: 4.7.1

This is a core issue. It's happening because of code https://github.com/ckeditor/ckeditor-dev/blob/master/core/htmlparser/fragment.js#L401

@beatadelura beatadelura added status:confirmed An issue confirmed by the development team. type:bug A bug. labels Aug 16, 2017
@Comandeer Comandeer changed the title Preserve initial space for inline widget if there is no text node in parent element Preserve initial space for HTML element if there is no text node in parent element Jul 12, 2018
@Comandeer
Copy link
Member

Comandeer commented Jul 12, 2018

This is more general issue, connected with nearly all HTML elements, not only inline widgets.

It occurs in several places:

  • editor.insertHtml calls;
  • toDataFormat event;
  • manually passing HTML to dataProcessor;
  • manually parsing HTML using htmlParser.fragment;
  • manually writing HTML using htmlParser.basicWriter.

In fact it's probably present in every place involving data processing.

More straightforward demo: http://jsfiddle.net/Comandeer/nu1wm3L8/

@Comandeer Comandeer added the support An issue reported by a commercially licensed client. label Jul 12, 2018
@lslowikowska lslowikowska added support:3 An issue reported by a commercially licensed client. and removed support An issue reported by a commercially licensed client. labels Dec 21, 2018
@lslowikowska lslowikowska added support:2 An issue reported by a commercially licensed client. and removed support:3 An issue reported by a commercially licensed client. labels Sep 13, 2021
@jacekbogdanski jacekbogdanski self-assigned this Jul 1, 2022
@jacekbogdanski jacekbogdanski removed their assignment Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:confirmed An issue confirmed by the development team. support:2 An issue reported by a commercially licensed client. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

4 participants