Merge branch 'next' into feat/events_update

This commit is contained in:
Ilya Gorenburg 2023-10-17 21:12:15 -04:00 committed by GitHub
commit 59efb5e522
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 9 deletions

View file

@ -6,6 +6,15 @@
- `Fix` — Layout did not shrink when a large document cleared in Chrome
- `Fix` — Multiple Tooltip elements creation fixed
- `Fix` — When the focusing Block is out of the viewport, the page will be scrolled.
- `Fix``blocks.render()` won't lead the `onChange` call in Safari
### 2.28.2
- `Fix` — Get rid of redundant logs from the build
### 2.28.1
- `Fix` — Some Block were be skipped on saving after pasting them as HTML
### 2.28.0
@ -31,6 +40,7 @@
- `Improvement` - `blocks.update(id, data)` now will trigger onChange with only `block-change` event.
- `Improvement` - `blocks.update(id, data)` will return a promise with BlockAPI object of the changed block.
### 2.27.2
- `Fix` - `onChange` won't be called when element with data-mutation-free changes some attribute

View file

@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.29.0-rc.1",
"version": "2.29.0-rc.3",
"description": "Editor.js — Native JS, based on API and Open Source",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",
@ -44,7 +44,7 @@
"@editorjs/code": "^2.7.0",
"@editorjs/delimiter": "^1.2.0",
"@editorjs/header": "^2.7.0",
"@editorjs/paragraph": "^2.10.0",
"@editorjs/paragraph": "^2.11.1",
"@editorjs/simple-image": "^1.4.1",
"@types/node": "^18.15.11",
"chai-subset": "^1.6.0",

View file

@ -399,7 +399,16 @@ export default class BlockManager extends Module {
});
try {
block.call(BlockToolAPI.ON_PASTE, pasteEvent);
/**
* We need to call onPaste after Block will be ready
* because onPaste could change tool's root element, and we need to do that after block.watchBlockMutations() bound
* to detect tool root element change
*
* @todo make this.insert() awaitable and remove requestIdleCallback
*/
window.requestIdleCallback(() => {
block.call(BlockToolAPI.ON_PASTE, pasteEvent);
});
} catch (e) {
_.log(`${toolName}: onPaste callback call is failed`, 'error', e);
}

View file

@ -1,8 +1,10 @@
import Header from '@editorjs/header';
import Image from '@editorjs/simple-image';
import * as _ from '../../../src/components/utils';
import { BlockTool, BlockToolData } from '../../../types';
import { BlockTool, BlockToolData, OutputData } from '../../../types';
import $ from '../../../src/components/dom';
import type EditorJS from '../../../types/index';
describe('Copy pasting from Editor', function () {
context('pasting', function () {
@ -111,7 +113,7 @@ describe('Copy pasting from Editor', function () {
tools: {
header: Header,
},
});
}).as('editorInstance');
cy.get('[data-cy=editorjs]')
.get('div.ce-block')
@ -121,6 +123,9 @@ describe('Copy pasting from Editor', function () {
'text/html': '<h2>First block</h2><p>Second block</p>',
});
/**
* Check inserted blocks
*/
cy.get('[data-cy=editorjs]')
.get('h2.ce-header')
.should('contain', 'First block');
@ -128,6 +133,28 @@ describe('Copy pasting from Editor', function () {
cy.get('[data-cy=editorjs]')
.get('div.ce-paragraph')
.should('contain', 'Second block');
/**
* Check saved data as well
*/
cy.get<EditorJS>('@editorInstance')
.then(async (editor) => {
cy.wrap<OutputData>(await editor.save())
.then((data) => {
/**
* <h2> has been correctly saved
*/
expect(data.blocks[0].type).to.eq('header');
expect(data.blocks[0].data.text).to.eq('First block');
expect(data.blocks[0].data.level).to.eq(2);
/**
* <p> has been correctly saved
*/
expect(data.blocks[1].type).to.eq('paragraph');
expect(data.blocks[1].data.text).to.eq('Second block');
});
});
});
it('should parse pattern', function () {

View file

@ -571,10 +571,10 @@
dependencies:
"@codexteam/icons" "^0.0.5"
"@editorjs/paragraph@^2.10.0":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@editorjs/paragraph/-/paragraph-2.10.0.tgz#dcf152e69738a9399b4af83262606d76cf1376e5"
integrity sha512-AzaGxR9DQAdWhx43yupBcwqtwH0WWi5jBDOCSeALIK86IYOnO6Lp4anEbH8IYmYrE/5MdnRiTwdU8/Xs8W15Nw==
"@editorjs/paragraph@^2.11.1":
version "2.11.1"
resolved "https://registry.yarnpkg.com/@editorjs/paragraph/-/paragraph-2.11.1.tgz#86e14a9f4856eaa9577ddf65cfcf21a89f0b4bca"
integrity sha512-OekbO6/47yTV7n6+uF/Qw2/blsI+QpveqdFUK5dh0Hq6hfKMjBYkENiShmEUKP69EbI9BQrlMNVnrmz8W4V2jw==
dependencies:
"@codexteam/icons" "^0.0.4"