mirror of
https://github.com/codex-team/editor.js
synced 2024-06-26 09:20:07 +02:00
[issue-779]: Grammarly conflicts (#956)
* grammarly conflicts * update * upd bundle
This commit is contained in:
parent
36f69f083a
commit
b19cb0695c
4
dist/editor.js
vendored
4
dist/editor.js
vendored
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@
|
|||
- `Fix` — On selection from end to start backspace is working as expected now [#869](https://github.com/codex-team/editor.js/issues/869)
|
||||
— `Fix` — Fix flipper with empty dom iterator [#926](https://github.com/codex-team/editor.js/issues/926)
|
||||
- `Fix` — Normalize node before walking through children at `isEmpty` method [943](https://github.com/codex-team/editor.js/issues/943)
|
||||
— `Fix` — Fixed Grammarly conflict [#779](https://github.com/codex-team/editor.js/issues/779)
|
||||
|
||||
### 2.15.1
|
||||
|
||||
|
|
|
@ -180,10 +180,20 @@ export default class Block {
|
|||
* @return {HTMLElement}
|
||||
*/
|
||||
get pluginsContent(): HTMLElement {
|
||||
const pluginsContent = this.holder.querySelector(`.${Block.CSS.content}`);
|
||||
const blockContentNodes = this.holder.querySelector(`.${Block.CSS.content}`);
|
||||
|
||||
if (pluginsContent && pluginsContent.childNodes.length) {
|
||||
return pluginsContent.childNodes[0] as HTMLElement;
|
||||
if (blockContentNodes && blockContentNodes.childNodes.length) {
|
||||
/**
|
||||
* Editors Block content can contain different Nodes from extensions
|
||||
* We use DOM isExtensionNode to ignore such Nodes and return first Block that does not match filtering list
|
||||
*/
|
||||
for (let child = blockContentNodes.childNodes.length - 1; child >= 0; child--) {
|
||||
const contentNode = blockContentNodes.childNodes[child];
|
||||
|
||||
if (!$.isExtensionNode(contentNode)) {
|
||||
return contentNode as HTMLElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -535,4 +535,16 @@ export default class Dom {
|
|||
if (typeof element === 'string') { return document.getElementById(element); }
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method checks passed Node if it is some extension Node
|
||||
* @param {Node} node - any node
|
||||
*/
|
||||
public static isExtensionNode(node: Node): boolean {
|
||||
const extensions = [
|
||||
'GRAMMARLY-EXTENSION',
|
||||
];
|
||||
|
||||
return node && extensions.includes(node.nodeName);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue