Merge branch 'next' of github.com:codex-team/editor.js into feature/clean-inline-fragments

This commit is contained in:
Georgy Berezhnoy 2022-01-13 19:08:18 +03:00
commit 80cffee2ca
No known key found for this signature in database
GPG key ID: F72152EC600B4FAE
19 changed files with 82 additions and 18 deletions

View file

@ -20,6 +20,7 @@
- `New``API` — The new `UiApi` section was added. It allows accessing some editor UI nodes and methods.
- `Refactoring` — Toolbox became a standalone class instead of a Module. It can be accessed only through the Toolbar module.
- `Refactoring` — CI flow optimized.
- `Fix` - Recognize async `onPaste` handlers in tools [#1803](https://github.com/codex-team/editor.js/issues/1803).
### 2.22.3

@ -1 +1 @@
Subproject commit 6e81175e48038d1244b9fc63fc8ecd49d6335a56
Subproject commit a0aefce6bdc9819fa71649a3d042b15a28a8f344

@ -1 +1 @@
Subproject commit cd102da627f5138b94d960ace16fb1a62e1c8069
Subproject commit b4f252d112a524e53e1f9c960746a61569eaae28

@ -1 +1 @@
Subproject commit a98f800569c4d952caec16cb527b65b6f2b3b589
Subproject commit 48bf650eadbb894606f3428d2fb30add022ad2b7

@ -1 +1 @@
Subproject commit a765a45ec03a9ed5529dac0b3a03ff0a1e16f3b3
Subproject commit b3c87948d5a5926f2557c2029d64aa819ca61920

@ -1 +1 @@
Subproject commit f511dc066aab6bf82b4ffcd4cdee35ad71db8d36
Subproject commit 585bca271f7696cd17533fa5877d1f72b3a03d2e

@ -1 +1 @@
Subproject commit e26b3e7c106486d2d776219e18cd125469991a25
Subproject commit 7edabc571ed4b5975b73073a9eaed857f0f10592

@ -1 +1 @@
Subproject commit 145be45a4fe991a40d3fdd99d275ef211116e6ee
Subproject commit 3722d145b02880fdd5b5792bdd6a9475284559bc

@ -1 +1 @@
Subproject commit f3d72358b5a35e7fde58b08604b57eea2c4fa8ff
Subproject commit d452b46106766b5fc4c5747e99888f613a3764fd

@ -1 +1 @@
Subproject commit cce71dc42bdc9df04f5c3efefc48217126e483c5
Subproject commit 004a06458d3881e8d922506381c21847900e3c62

@ -1 +1 @@
Subproject commit 3f388a64f92b408038eb1ab3db0c588dfb2b58ec
Subproject commit 40ef7e3adc32dea1762ffe4fa75f90c6ad8af7cc

@ -1 +1 @@
Subproject commit fbccf7e35e1ca7a3b7b04422fbdfc10634302d1c
Subproject commit d781cd0d5c7529930440c254f0146ce5db63f9f8

@ -1 +1 @@
Subproject commit 208cbfd7ea1da507173686e1312f95788fb8f209
Subproject commit 84cc4f393db0939c6246c9a579377f2540dac289

@ -1 +1 @@
Subproject commit 527d12247f1a486a1627f5e69b6c8e809e8adecb
Subproject commit 0b392a90e4001efb048980955b4a72e6b132f6fc

@ -1 +1 @@
Subproject commit 42e1281e505de90968263ab88d977873e17500b6
Subproject commit ddbc1147e127a727cfac4dbe0326b78e02dceb9e

@ -1 +1 @@
Subproject commit 6355942a1f4528004791d9f9af3a67d84a4b1b2e
Subproject commit d7fa1d81728cb225ccccafefdcd18c81e05918ba

View file

@ -194,8 +194,8 @@ export function typeOf(object: any): string {
* @returns {boolean}
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function isFunction(fn: any): fn is Function {
return typeOf(fn) === 'function';
export function isFunction(fn: any): fn is (...args: any[]) => any {
return typeOf(fn) === 'function' || typeOf(fn) === 'asyncfunction';
}
/**

@ -1 +1 @@
Subproject commit 4b193c33c3efe00ffc13b16839cffb5e339df526
Subproject commit 21cbdea6e5e61094b046f47e8cb423a817cec3ed

View file

@ -0,0 +1,63 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { isFunction } from '../../../src/components/utils';
function syncFunction(): void {}
async function asyncFunction(): Promise<void> {}
const syncArrowFunction = (): void => {};
const asyncArrowFunction = async (): Promise<void> => {};
describe('isFunction function', () => {
it('should recognise sync functions', () => {
/**
* Act
*/
const commonFunctionResult = isFunction(syncFunction);
const arrowFunctionResult = isFunction(syncArrowFunction);
/**
* Assert
*/
expect(commonFunctionResult).to.eq(true);
expect(arrowFunctionResult).to.eq(true);
});
it('should recognise async functions', () => {
/**
* Act
*/
const commonFunctionResult = isFunction(asyncFunction);
const arrowFunctionResult = isFunction(asyncArrowFunction);
/**
* Assert
*/
expect(commonFunctionResult).to.eq(true);
expect(arrowFunctionResult).to.eq(true);
});
it('should return false if it isn\'t a function', () => {
/**
* Arrange
*/
const obj = {};
const num = 123;
const str = '123';
/**
* Act
*/
const objResult = isFunction(obj);
const numResult = isFunction(num);
const strResult = isFunction(str);
/**
* Assert
*/
expect(objResult).to.eq(false);
expect(numResult).to.eq(false);
expect(strResult).to.eq(false);
});
});