1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-01 05:16:10 +01:00

Fix lint errors

This commit is contained in:
Samy Pessé 2016-11-01 16:46:21 +01:00
parent bc3fe73487
commit afc413f5c7
5 changed files with 6 additions and 14 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ examples/build.prod.js
node_modules
tmp
_book
perf/reference.json
perf/reference.json
npm-debug.log

View File

@ -52,11 +52,9 @@ function Plugin(options = {}) {
// a transform and normalize the selection if the document is the same
if (prevState && state.document == prevState.document) return state
console.time('onBeforeChange');
const newState = state.transform()
.normalizeWith(schema, prevState ? prevState.document : null)
.apply({ save: false })
console.timeEnd('onBeforeChange');
return newState
}

View File

@ -184,11 +184,9 @@ export function normalizeWith(transform, schema, prevDocument) {
*/
export function normalize(transform) {
console.time('normalize')
transform = transform
.normalizeDocument()
.normalizeSelection()
console.timeEnd('normalize')
return transform
}
@ -200,8 +198,7 @@ export function normalize(transform) {
*/
export function normalizeDocument(transform) {
const { state, prevState } = transform
const { document } = state
const { prevState } = transform
const { document: prevDocument } = prevState || {}
return transform.normalizeWith(defaultSchema, prevDocument)
@ -223,9 +220,7 @@ export function normalizeNodeByKey(transform, key) {
const node = document.key == key ? document : document.assertDescendant(key)
const prevNode = document.key == key ? prevDocument : prevDocument.getDescendant(key)
console.time('normalizeNodeByKey')
transform = transform.normalizeNodeWith(defaultSchema, node, prevNode)
console.timeEnd('normalizeNodeByKey')
return transform
}
@ -243,9 +238,8 @@ export function normalizeParentsByKey(transform, key) {
const { document: prevDocument } = prevState || {}
const node = document.key == key ? document : document.assertDescendant(key)
const prevNode = document.key == key ? prevDocument : prevDocument.getDescendant(key)
console.time('normalizeParentsByKey')
transform = transform.normalizeParentsWith(defaultSchema, node, prevNode)
console.timeEnd('normalizeParentsByKey')
return transform
}
@ -257,7 +251,6 @@ export function normalizeParentsByKey(transform, key) {
*/
export function normalizeSelection(transform) {
console.time('normalizeSelection')
let { state } = transform
let { document, selection } = state
selection = selection.normalize(document)
@ -281,6 +274,5 @@ export function normalizeSelection(transform) {
state = state.merge({ selection })
transform.state = state
console.timeEnd('normalizeSelection')
return transform
}

View File

@ -10,5 +10,5 @@ const __DEV__ = (
*/
export default function isDev() {
return __DEV__;
return __DEV__
}

View File

@ -16,6 +16,7 @@ const LEAF = {}
*
* @type {Object}
*/
const NO_SET = {}
/**