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

Editor with enterMode set to ENTER_DIV alters content on paste #2751

Closed
engineering-this opened this issue Jan 14, 2019 · 1 comment · Fixed by #2776
Closed

Editor with enterMode set to ENTER_DIV alters content on paste #2751

engineering-this opened this issue Jan 14, 2019 · 1 comment · Fixed by #2776
Assignees
Labels
status:confirmed An issue confirmed by the development team. support:2 An issue reported by a commercially licensed client. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Milestone

Comments

@engineering-this
Copy link
Contributor

Type of report

Bug

Provide detailed reproduction steps (if any).

  1. Open SDK sample: https://ckeditor.com/docs/ckeditor4/latest/examples/enterkey.html
  2. Pick Create a new <div> from select under When Enter is pressed:
  3. Focus editor at the end of content, press Enter and type some text.
  4. Select all.
  5. Copy.
  6. Paste

Expected result

Editor content looks like:

<div>This is some sample text.</div>

<div>New line.</div>

Actual result

There is an extra div wrapping whole editor content:

<div>
<div>This is some sample text.</div>

<div>New line.</div>
</div>

Other details

  • Browser: …
  • OS: …
  • CKEditor version: …
  • Installed CKEditor plugins: …
@engineering-this engineering-this added type:bug A bug. status:confirmed An issue confirmed by the development team. labels Jan 14, 2019
@lslowikowska lslowikowska added the support:3 An issue reported by a commercially licensed client. label Jan 14, 2019
@mlewand mlewand added the target:minor Any docs related issue that can be merged into a master or major branch. label Jan 15, 2019
@msamsel msamsel self-assigned this Jan 15, 2019
@msamsel
Copy link
Contributor

msamsel commented Jan 15, 2019

Issue might be reproduce with insertHtml method.

  1. Use editor in ENTER_DIV mode
  2. Put selection in new line
  3. Use editor.insertHtml( '<div>one</div><div>two</div>' )

Source of the problem is how we insert nodes.
Wrapping DIV, which allows on writing in editor, remains in editor. So when node is added to editor, selection is located directly in this div, not under the body.
https://github.com/ckeditor/ckeditor-dev/blob/1f365357c043a74e69ad21f32c829929d8610106/core/editable.js#L1899-L1906

This result in situation that we get additional div surrounded inserted content.

@mlewand mlewand added this to the Backlog milestone Jan 15, 2019
@msamsel msamsel removed their assignment Jan 15, 2019
@engineering-this engineering-this self-assigned this Jan 22, 2019
@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 Apr 15, 2019
@f1ames f1ames modified the milestones: Backlog, 4.11.5 Apr 15, 2019
@f1ames f1ames modified the milestones: 4.11.5, 4.12.0 May 17, 2019
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. target:minor Any docs related issue that can be merged into a master or major branch. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants