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

Selection marker is gone after selecting a <br> node #2807

Closed
Rain-Zheng opened this issue Sep 25, 2024 · 0 comments
Closed

Selection marker is gone after selecting a <br> node #2807

Rain-Zheng opened this issue Sep 25, 2024 · 0 comments

Comments

@Rain-Zheng
Copy link
Contributor

Rain-Zheng commented Sep 25, 2024

Describe the bug
The selection marker in content model is gone after calling selectNodeContents on a <br> node. If calling selectNode, the marker won't be lost.

To Reproduce
The sample code for reproducing:

const range = new Range();
const br = contentDiv.querySelector('br');
range.selectNodeContents(br);
range.collapse(true);
editor.setDOMSelection({
  type: 'range',
  range: range,
  isReverted: false,
});
console.log(editor.getContentModelCopy('disconnected'));

The exported content model doesn't contain any selection marker. You can try this in codepen: https://codepen.io/xy-z-the-animator/pen/oNKgZeK

Expected behavior
The editor should handle the selection inside <br> element and include selection marker in the exported model.

Device Information

  • OS: Any
  • Browser: Chrome
  • Version: 128
JiuqingSong added a commit that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant