mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-25 16:20:49 +02:00
Optimize isText
, isElement
, isNodeList
and isEditor
(#5859)
* Remove the `isPlainObject` check from `isText` and `isElement` for performance * Optimise `isElement`, `isNodeList` and `isText` further * Update changeset * Fix changeset * Refactor object check into `isObject`
This commit is contained in:
@@ -13,9 +13,6 @@
|
||||
"files": [
|
||||
"dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-plain-object": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "^7.23.2",
|
||||
"slate": "^0.114.0",
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { isPlainObject } from 'is-plain-object'
|
||||
import { Element, createEditor as makeEditor } from 'slate'
|
||||
import { Element, createEditor as makeEditor, isObject } from 'slate'
|
||||
import {
|
||||
createAnchor,
|
||||
createCursor,
|
||||
@@ -86,7 +85,7 @@ const createFactory = <T extends HyperscriptCreators>(creators: T) => {
|
||||
attributes = {}
|
||||
}
|
||||
|
||||
if (!isPlainObject(attributes)) {
|
||||
if (!isObject(attributes)) {
|
||||
children = [attributes].concat(children)
|
||||
attributes = {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user