1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 02:19:52 +02:00

docs: Fix lint maybe.

This commit is contained in:
Sunny Hirai
2021-10-10 21:22:32 -07:00
parent 8a81b0ea3d
commit 8e02c65184

View File

@@ -8,14 +8,12 @@ interface Editor {
children: Node[] children: Node[]
selection: Range | null selection: Range | null
operations: Operation[] operations: Operation[]
marks: Record<string, any> | null marks: Omit<Text, 'text'> | null
// Schema-specific node behaviors. // Schema-specific node behaviors.
isInline: (element: Element) => boolean isInline: (element: Element) => boolean
isVoid: (element: Element) => boolean isVoid: (element: Element) => boolean
normalizeNode: (entry: NodeEntry) => void normalizeNode: (entry: NodeEntry) => void
onChange: () => void onChange: () => void
// Overrideable core actions. // Overrideable core actions.
addMark: (key: string, value: any) => void addMark: (key: string, value: any) => void
apply: (operation: Operation) => void apply: (operation: Operation) => void
@@ -49,7 +47,7 @@ For example, if you want to define link elements that are inline nodes:
```javascript ```javascript
const { isInline } = editor const { isInline } = editor
editor.isInline = (element) => { editor.isInline = element => {
return element.type === 'link' ? true : isInline(element) return element.type === 'link' ? true : isInline(element)
} }
``` ```
@@ -59,7 +57,7 @@ Or maybe you want to override the `insertText` behavior to "linkify" URLs:
```javascript ```javascript
const { insertText } = editor const { insertText } = editor
editor.insertText = (text) => { editor.insertText = text => {
if (isUrl(text)) { if (isUrl(text)) {
// ... // ...
return return
@@ -74,7 +72,7 @@ Or you can even define custom "normalizations" that take place to ensure that li
```javascript ```javascript
const { normalizeNode } = editor const { normalizeNode } = editor
editor.normalizeNode = (entry) => { editor.normalizeNode = entry => {
const [node, path] = entry const [node, path] = entry
if (Element.isElement(node) && node.type === 'link') { if (Element.isElement(node) && node.type === 'link') {