mirror of
https://github.com/codex-team/editor.js
synced 2024-06-09 09:22:16 +02:00
fix formatting
This commit is contained in:
parent
7cd05fe6eb
commit
398b0118a4
|
@ -16,10 +16,13 @@ export function isMutationBelongsToElement(mutationRecord: MutationRecord, eleme
|
|||
*/
|
||||
if (type === 'childList') {
|
||||
const elementAddedItself = Array.from(addedNodes).some(node => node === element);
|
||||
|
||||
if (elementAddedItself) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const elementRemovedItself = Array.from(removedNodes).some(node => node === element);
|
||||
|
||||
if (elementRemovedItself) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('onChange callback', () => {
|
|||
const config = {
|
||||
tools: {
|
||||
header: Header,
|
||||
code: Code
|
||||
code: Code,
|
||||
},
|
||||
onChange: (api, event): void => {
|
||||
console.log('something changed', event);
|
||||
|
@ -790,15 +790,24 @@ describe('onChange callback', () => {
|
|||
});
|
||||
|
||||
it('should be fired when the whole text inside some descendant of the block is removed', () => {
|
||||
/**
|
||||
* Mock of Tool with nested contenteditable element
|
||||
*/
|
||||
class ToolWithContentEditableDescendant extends ToolMock {
|
||||
/**
|
||||
* Creates element with nested contenteditable element
|
||||
*/
|
||||
public render(): HTMLElement {
|
||||
const contenteditable = document.createElement('div');
|
||||
|
||||
contenteditable.contentEditable = 'true';
|
||||
contenteditable.innerText = 'a';
|
||||
contenteditable.setAttribute('data-cy', 'nested-contenteditable');
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
|
||||
wrapper.appendChild(contenteditable);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
@ -813,14 +822,15 @@ describe('onChange callback', () => {
|
|||
blocks: [
|
||||
{
|
||||
type: 'testTool',
|
||||
data: 'a'
|
||||
}
|
||||
]
|
||||
data: 'a',
|
||||
},
|
||||
],
|
||||
},
|
||||
onChange: (): void => {
|
||||
console.log('something changed');
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
cy.spy(config, 'onChange').as('onChange');
|
||||
cy.createEditor(config).as('editorInstance');
|
||||
|
||||
|
|
Loading…
Reference in a new issue