-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
blockSeperator
in getTextBetween, will return double new line characters when call editor.getText()
#3369
Comments
blockSeperator
in getTextBetween, will return double new line characters when call editor.getText()
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days |
i have the same confusion, why?
when |
any update? |
Same for me. |
@Matrixbirds @HZZformGD @J-Yaleen @tecoad you can use |
I've submitted #5055 PR that tweaks |
It works for me! Thank you! |
What’s the bug you are facing?
I'd like to custom shortcut key with 'Enter'. When keypress
Enter
, it should splitBlock instead of using hardBreak to appendin the current element:
.
Which browser was this experienced in? Are any special extensions installed?
Chromium 107.0.5304.87 (Official Build) (arm64)
Offical Github repo. commit id: bbf0803
Node version:
LTS
macOS
My setup scripts
How can we reproduce the bug on our side?
Step 1. Typing any character as below.
Step 2. Run
splitBlock
by editor instance, then<p>
tag in will be forked.Step 3. Keep typing any characters like this.
Step 4. Check the content editor html structure.
It looks like two paragraph element and it did correct when call
editor.getJSON()
then return value only contain two paragraph items.But the
editor.getText()
will returnabcedfg\n\nhijkl
.I'm digging in the implementation of getText. I find there is the code will serialize textNodes and it will add
blockSeparator = \n\n
. I don't know the blockSeparator works for what. But If we can modify assign as\n
. Maybe it works for me.Can you provide a CodeSandbox?
No response
What did you expect to happen?
The
getText
method should return single newline character whenever item has been splitBlock.So In this case:
editor.getText
should return returnabcedfg\nhijkl
.Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: