You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the 2.18 by closing this issue the caret.navigateNext() method was improved. Now if we press right or down key at the last non-default block, editor will create the new default block at the bottom to allow navigation to it:
But there are some problems with the current implementation:
The new block will be created even if we press right with caret set not at the end of block content.
BlockManager.insertAtEnd(); will call .insert() without any params, and as a result, the currentBlockIndex will wrongly be incremented.
publicinsert({
tool =this.config.defaultBlock,
data ={},
index,
needToFocus =true,
replace =false,}: {tool?: string;
data?: BlockToolData;
index?: number;
needToFocus?: boolean;
replace?: boolean;}={}): Block{letnewIndex=index;if(newIndex===undefined){newIndex=this.currentBlockIndex+(replace ? 0 : 1);// <--- here is the +1}// ...}
Steps to reproduce:
Go to example.html
Clear all the content
Open DevTools / Elements
Find and open .codex-editor__redactor to see a list of .ce-block elements
Click on the last block
Create a Header or any other non-default block and type some text
Place the caret at the center of this block.
Press Right
You will see that the new .ce-block will be created below our block.
<divclass="codex-editor__redactor" style="padding-bottom: 300px;"><divclass="ce-block"></div><!-- the block where we pressed Right not at the end --><divclass="ce-block"></div><!-- wrongly created block --></div>
Expected behavior:
The new block should be created only when we're pressing Right or Downat the end of the last non-default block.
The currentBlockIndex should not be changed when we're pressing Right or Downnot at the end of the last non-default block.
Editor.js version:
2.19
The text was updated successfully, but these errors were encountered:
In the 2.18 by closing this issue the
caret.navigateNext()
method was improved. Now if we pressright
ordown
key at the last non-default block, editor will create the new default block at the bottom to allow navigation to it:But there are some problems with the current implementation:
right
with caret set not at the end of block content.BlockManager.insertAtEnd();
will call.insert()
without any params, and as a result, thecurrentBlockIndex
will wrongly be incremented.Steps to reproduce:
.codex-editor__redactor
to see a list of.ce-block
elementsRight
You will see that the new
.ce-block
will be created below our block.Expected behavior:
Right
orDown
at the end of the last non-default block.currentBlockIndex
should not be changed when we're pressingRight
orDown
not at the end of the last non-default block.Editor.js version:
2.19
The text was updated successfully, but these errors were encountered: