diff --git a/packages/slate-schema/test/validations/children/match/invalid-many.js b/packages/slate-schema/test/validations/children/match/invalid-many.js new file mode 100644 index 000000000..f0fdcc03a --- /dev/null +++ b/packages/slate-schema/test/validations/children/match/invalid-many.js @@ -0,0 +1,32 @@ +/** @jsx jsx */ + +import { jsx } from 'slate-hyperscript' + +export const schema = [ + { + for: 'node', + match: { a: true }, + validate: { + children: [{ match: { b: true } }], + }, + }, +] + +export const input = ( + + + one + two + three + four + + +) + +export const output = ( + + + one + + +) diff --git a/packages/slate-schema/test/validations/children/max/invalid-many.js b/packages/slate-schema/test/validations/children/max/invalid-many.js new file mode 100644 index 000000000..e9ea77cdd --- /dev/null +++ b/packages/slate-schema/test/validations/children/max/invalid-many.js @@ -0,0 +1,30 @@ +/** @jsx jsx */ + +import { jsx } from 'slate-hyperscript' + +export const schema = [ + { + for: 'node', + match: { a: true }, + validate: { + children: [{ match: 'text', max: 1 }], + }, + }, +] + +export const input = ( + + + one + two + + +) + +export const output = ( + + + + + +) diff --git a/packages/slate/src/interfaces/editor/transforms/general.ts b/packages/slate/src/interfaces/editor/transforms/general.ts index 4aecce673..3f8af20ba 100755 --- a/packages/slate/src/interfaces/editor/transforms/general.ts +++ b/packages/slate/src/interfaces/editor/transforms/general.ts @@ -40,7 +40,7 @@ export const GeneralTransforms = { } Editor.withoutNormalizing(editor, () => { - const max = getDirtyPaths(editor).length * 42 // HACK: better way to do editor? + const max = getDirtyPaths(editor).length * 42 // HACK: better way? let m = 0 while (getDirtyPaths(editor).length !== 0) {