mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
[slate] Fix ObjectAndType interface: types -> type (#30388)
* Fix ObjectAndType interface: `types` -> `type` * Fix slate tests: use SchemaProperties The `Schema` class no longer exists, so `Schema.create` would not work.
This commit is contained in:
committed by
Pranav Senthilnathan
parent
72061aed07
commit
a7dfc6c9a8
Vendored
+1
-1
@@ -27,7 +27,7 @@ export interface RulesByNodeType {
|
||||
|
||||
export interface ObjectAndType {
|
||||
object?: string;
|
||||
types?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface Rules {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Value, Data, BlockJSON, Document, Editor, KeyUtils, Range, Point, Inline, Mark } from "slate";
|
||||
import { Block, Value, Data, BlockJSON, Document, Editor, KeyUtils, Range, Point, Inline, Mark, SchemaProperties } from "slate";
|
||||
|
||||
const data = Data.create({ foo: "bar " });
|
||||
const value = Value.create({ data });
|
||||
@@ -282,3 +282,36 @@ editor
|
||||
KeyUtils.setGenerator(() => "Test");
|
||||
KeyUtils.create();
|
||||
KeyUtils.resetGenerator();
|
||||
|
||||
const schema: SchemaProperties = {
|
||||
document: {
|
||||
nodes: [
|
||||
{
|
||||
match: [
|
||||
{ type: 'block-quote' },
|
||||
{ type: 'heading-one' },
|
||||
{ type: 'heading-two' },
|
||||
{ type: 'image' },
|
||||
{ type: 'paragraph' },
|
||||
{ type: 'bulleted-list' },
|
||||
{ type: 'numbered-list' },
|
||||
{ type: 'list-item' },
|
||||
],
|
||||
},
|
||||
],
|
||||
last: { type: 'paragraph' },
|
||||
normalize: (editor: Editor, { code, node }: any) => {
|
||||
switch (code) {
|
||||
case 'last_child_type_invalid': {
|
||||
const paragraph = Block.create('paragraph');
|
||||
return editor.insertNodeByKey(node.key, node.nodes.size, paragraph);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
blocks: {
|
||||
image: {
|
||||
isVoid: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user