mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 02:40:23 +02:00
[Fix] Selection issues (#988)
This commit is contained in:
parent
22b6f8073c
commit
952c1480ef
4
dist/editor.js
vendored
4
dist/editor.js
vendored
File diff suppressed because one or more lines are too long
2
dist/editor.licenses.txt
vendored
2
dist/editor.licenses.txt
vendored
|
@ -163,7 +163,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||||
|
|
||||||
core-js
|
core-js
|
||||||
MIT
|
MIT
|
||||||
Copyright (c) 2014-2018 Denis Pushkarev
|
Copyright (c) 2014-2019 Denis Pushkarev
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
- `Fix` — Fix Firefox bug with incorrect height and cursor position of empty content editable elements [#947](https://github.com/codex-team/editor.js/issues/947) [#876](https://github.com/codex-team/editor.js/issues/876) [#608](https://github.com/codex-team/editor.js/issues/608) [#876](https://github.com/codex-team/editor.js/issues/876)
|
- `Fix` — Fix Firefox bug with incorrect height and cursor position of empty content editable elements [#947](https://github.com/codex-team/editor.js/issues/947) [#876](https://github.com/codex-team/editor.js/issues/876) [#608](https://github.com/codex-team/editor.js/issues/608) [#876](https://github.com/codex-team/editor.js/issues/876)
|
||||||
- `Fix` — Set initial hidden Inline Toolbar position [#979](https://github.com/codex-team/editor.js/issues/979)
|
- `Fix` — Set initial hidden Inline Toolbar position [#979](https://github.com/codex-team/editor.js/issues/979)
|
||||||
- `Fix` — Fix issue with CodeX.Toolips TypeScript definitions [#978](https://github.com/codex-team/editor.js/issues/978)
|
- `Fix` — Fix issue with CodeX.Toolips TypeScript definitions [#978](https://github.com/codex-team/editor.js/issues/978)
|
||||||
|
- `Fix` — Fix some issues with Inline and Tunes toolbars.
|
||||||
- `Fix` - Fix `minHeight` option with zero-value issue [#724](https://github.com/codex-team/editor.js/issues/724)
|
- `Fix` - Fix `minHeight` option with zero-value issue [#724](https://github.com/codex-team/editor.js/issues/724)
|
||||||
|
|
||||||
### 2.16
|
### 2.16
|
||||||
|
|
|
@ -289,6 +289,15 @@ export default class InlineToolbar extends Module {
|
||||||
this.flipper.activate(visibleTools as HTMLElement[]);
|
this.flipper.activate(visibleTools as HTMLElement[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if node is contained by Inline Toolbar
|
||||||
|
*
|
||||||
|
* @param {Node} node — node to chcek
|
||||||
|
*/
|
||||||
|
public containsNode(node: Node): boolean {
|
||||||
|
return this.nodes.wrapper.contains(node);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to show Inline Toolbar or not
|
* Need to show Inline Toolbar or not
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -496,18 +496,6 @@ export default class UI extends Module {
|
||||||
this.Editor.ConversionToolbar.close();
|
this.Editor.ConversionToolbar.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Selection.isAtEditor) {
|
|
||||||
/**
|
|
||||||
* Focus clicked Block.
|
|
||||||
* Workaround case when user clicks on the bottom of editor
|
|
||||||
*/
|
|
||||||
if (Selection.anchorNode === this.nodes.redactor) {
|
|
||||||
this.Editor.Caret.setToTheLastBlock();
|
|
||||||
} else {
|
|
||||||
this.Editor.BlockManager.setCurrentBlockByChildNode(Selection.anchorNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear Selection if user clicked somewhere
|
* Clear Selection if user clicked somewhere
|
||||||
*/
|
*/
|
||||||
|
@ -625,6 +613,14 @@ export default class UI extends Module {
|
||||||
* We need to skip such firings
|
* We need to skip such firings
|
||||||
*/
|
*/
|
||||||
if (!focusedElement || !focusedElement.closest(`.${Block.CSS.content}`)) {
|
if (!focusedElement || !focusedElement.closest(`.${Block.CSS.content}`)) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If new selection is not on Inline Toolbar, we need to close it
|
||||||
|
*/
|
||||||
|
if (!this.Editor.InlineToolbar.containsNode(focusedElement)) {
|
||||||
|
this.Editor.InlineToolbar.close();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue