mirror of
https://github.com/codex-team/editor.js
synced 2024-05-17 22:06:49 +02:00
the long line splitted for several small ones, some more docs added
This commit is contained in:
parent
7c8778acc4
commit
c106819184
2
dist/editor.js
vendored
2
dist/editor.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,7 @@
|
|||
# Changelog
|
||||
|
||||
### 2.19.2
|
||||
|
||||
- `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503).
|
||||
|
||||
### 2.19.1
|
||||
|
|
|
@ -559,7 +559,8 @@ export default class BlockManager extends Module {
|
|||
* 1) Find first-level Block from passed child Node
|
||||
* 2) Mark it as current
|
||||
*
|
||||
* @param {Node} childNode - look ahead from this node.
|
||||
* @param {Node} childNode - look ahead from this node.
|
||||
* @returns can return undefined in case when the passed child note is not a part of the current editor instance
|
||||
*/
|
||||
public setCurrentBlockByChildNode(childNode: Node): Block | undefined {
|
||||
/**
|
||||
|
@ -571,7 +572,20 @@ export default class BlockManager extends Module {
|
|||
|
||||
const parentFirstLevelBlock = (childNode as HTMLElement).closest(`.${Block.CSS.wrapper}`);
|
||||
|
||||
if (!parentFirstLevelBlock?.closest(`.${this.Editor.UI.CSS.editorWrapper}`)?.isEqualNode(this.Editor.UI.nodes.wrapper)) {
|
||||
if (!parentFirstLevelBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Support multiple Editor.js instances,
|
||||
* by checking whether the found block belongs to the current instance
|
||||
*
|
||||
* @see {@link Ui#documentTouched}
|
||||
*/
|
||||
const editorWrapper = parentFirstLevelBlock.closest(`.${this.Editor.UI.CSS.editorWrapper}`);
|
||||
const isBlockBelongsToCurrentInstance = editorWrapper?.isEqualNode(this.Editor.UI.nodes.wrapper);
|
||||
|
||||
if (!isBlockBelongsToCurrentInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue