mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11:44 +02:00
more fixes, before adding components
This commit is contained in:
@@ -368,7 +368,6 @@ class Editor extends React.Component {
|
|||||||
|
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
if (!plugin.schema) continue
|
if (!plugin.schema) continue
|
||||||
debugger
|
|
||||||
const schema = Schema.create(plugin.schema)
|
const schema = Schema.create(plugin.schema)
|
||||||
rules = rules.concat(schema.rules)
|
rules = rules.concat(schema.rules)
|
||||||
}
|
}
|
||||||
|
@@ -1106,6 +1106,7 @@ memoize(Node, [
|
|||||||
'assertDescendant',
|
'assertDescendant',
|
||||||
'findDescendant',
|
'findDescendant',
|
||||||
'filterDescendants',
|
'filterDescendants',
|
||||||
|
'filterDescendantsDeep',
|
||||||
'getBlocks',
|
'getBlocks',
|
||||||
'getBlocksAtRange',
|
'getBlocksAtRange',
|
||||||
'getCharactersAtRange',
|
'getCharactersAtRange',
|
||||||
|
@@ -171,9 +171,7 @@ class Schema extends new Record(DEFAULTS) {
|
|||||||
|
|
||||||
const match = this.rules.find((rule) => {
|
const match = this.rules.find((rule) => {
|
||||||
if (!rule.match(object)) return
|
if (!rule.match(object)) return
|
||||||
debugger
|
|
||||||
if (!rule.validate) return
|
if (!rule.validate) return
|
||||||
debugger
|
|
||||||
reason = rule.validate(object)
|
reason = rule.validate(object)
|
||||||
return reason
|
return reason
|
||||||
})
|
})
|
||||||
@@ -324,11 +322,9 @@ function normalizeSpec(obj, giveReason) {
|
|||||||
return (node) => {
|
return (node) => {
|
||||||
for (const key in CHECKS) {
|
for (const key in CHECKS) {
|
||||||
const value = spec[key]
|
const value = spec[key]
|
||||||
debugger
|
|
||||||
|
|
||||||
if (value == null) continue
|
if (value == null) continue
|
||||||
|
|
||||||
debugger
|
|
||||||
const fail = CHECKS[key]
|
const fail = CHECKS[key]
|
||||||
const failure = fail(node, value)
|
const failure = fail(node, value)
|
||||||
|
|
||||||
|
@@ -374,14 +374,12 @@ class State extends new Record(DEFAULTS) {
|
|||||||
document.filterDescendantsDeep((node) => {
|
document.filterDescendantsDeep((node) => {
|
||||||
if (failure = node.validate(schema)) {
|
if (failure = node.validate(schema)) {
|
||||||
const { reason, rule } = failure
|
const { reason, rule } = failure
|
||||||
debugger
|
|
||||||
transform = rule.transform(transform, node, reason)
|
transform = rule.transform(transform, node, reason)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (failure = document.validate(schema)) {
|
if (failure = document.validate(schema)) {
|
||||||
const { reason, rule } = failure
|
const { reason, rule } = failure
|
||||||
debugger
|
|
||||||
transform = rule.transform(transform, document, reason)
|
transform = rule.transform(transform, document, reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user