Remove force options in Caret.navigateNext() and Caret.navigatePrevious() (#1525)

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
Tomoyuki Hata 2021-02-18 21:19:20 +09:00 committed by GitHub
parent fbd4bd9e0a
commit 4c7cad1b41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View file

@ -2,6 +2,7 @@
### 2.19.2
- `Improvements` - Remove unused `force` option in `Caret.navigateNext()` and `Caret.navigatePrevious()` [#857](https://github.com/codex-team/editor.js/issues/857#issuecomment-770363438).
- `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541).
- `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503).

View file

@ -388,11 +388,9 @@ export default class Caret extends Module {
* Before moving caret, we should check if caret position is at the end of Plugins node
* Using {@link Dom#getDeepestNode} to get a last node and match with current selection
*
* @param {boolean} force - force navigation even if caret is not at the end
*
* @returns {boolean}
*/
public navigateNext(force = false): boolean {
public navigateNext(): boolean {
const { BlockManager, Tools } = this.Editor;
const { currentBlock, nextContentfulBlock } = BlockManager;
const { nextInput } = currentBlock;
@ -422,7 +420,7 @@ export default class Caret extends Module {
nextBlock = BlockManager.insertAtEnd();
}
if (force || isAtEnd) {
if (isAtEnd) {
/** If next Tool`s input exists, focus on it. Otherwise set caret to the next Block */
if (!nextInput) {
this.setToBlock(nextBlock, this.positions.START);
@ -441,11 +439,9 @@ export default class Caret extends Module {
* Before moving caret, we should check if caret position is start of the Plugins node
* Using {@link Dom#getDeepestNode} to get a last node and match with current selection
*
* @param {boolean} force - force navigation even if caret is not at the start
*
* @returns {boolean}
*/
public navigatePrevious(force = false): boolean {
public navigatePrevious(): boolean {
const { currentBlock, previousContentfulBlock } = this.Editor.BlockManager;
if (!currentBlock) {
@ -458,7 +454,7 @@ export default class Caret extends Module {
return false;
}
if (force || this.isAtStart) {
if (this.isAtStart) {
/** If previous Tool`s input exists, focus on it. Otherwise set caret to the previous Block */
if (!previousInput) {
this.setToBlock(previousContentfulBlock, this.positions.END);