mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 02:49:56 +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) {
|
||||
if (!plugin.schema) continue
|
||||
debugger
|
||||
const schema = Schema.create(plugin.schema)
|
||||
rules = rules.concat(schema.rules)
|
||||
}
|
||||
|
@@ -1106,6 +1106,7 @@ memoize(Node, [
|
||||
'assertDescendant',
|
||||
'findDescendant',
|
||||
'filterDescendants',
|
||||
'filterDescendantsDeep',
|
||||
'getBlocks',
|
||||
'getBlocksAtRange',
|
||||
'getCharactersAtRange',
|
||||
|
@@ -171,9 +171,7 @@ class Schema extends new Record(DEFAULTS) {
|
||||
|
||||
const match = this.rules.find((rule) => {
|
||||
if (!rule.match(object)) return
|
||||
debugger
|
||||
if (!rule.validate) return
|
||||
debugger
|
||||
reason = rule.validate(object)
|
||||
return reason
|
||||
})
|
||||
@@ -324,11 +322,9 @@ function normalizeSpec(obj, giveReason) {
|
||||
return (node) => {
|
||||
for (const key in CHECKS) {
|
||||
const value = spec[key]
|
||||
debugger
|
||||
|
||||
if (value == null) continue
|
||||
|
||||
debugger
|
||||
const fail = CHECKS[key]
|
||||
const failure = fail(node, value)
|
||||
|
||||
|
@@ -374,14 +374,12 @@ class State extends new Record(DEFAULTS) {
|
||||
document.filterDescendantsDeep((node) => {
|
||||
if (failure = node.validate(schema)) {
|
||||
const { reason, rule } = failure
|
||||
debugger
|
||||
transform = rule.transform(transform, node, reason)
|
||||
}
|
||||
})
|
||||
|
||||
if (failure = document.validate(schema)) {
|
||||
const { reason, rule } = failure
|
||||
debugger
|
||||
transform = rule.transform(transform, document, reason)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user