Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EditorComponent

因为slate实际上是编辑rootchildren,所以root的property要单独处理。

Hierarchy

Index

Constructors

Properties

context: any

If using the new style context, re-declare this in your class to be the React.ContextType of your static contextType. Should be used with type annotation or static contextType.

static contextType = MyContext
// For TS pre-3.7:
context!: React.ContextType<typeof MyContext>
// For TS 3.7 and above:
declare context: React.ContextType<typeof MyContext>
see

https://reactjs.org/docs/context.html

refs: {}

Type declaration

state: Readonly<{ root_children: Descendant[] & NonLeafNode[]; root_property: Omit<AbstractNode, "children">; slate: <internal>.ReactEditor }>
update_debounce: DoSomething<<internal>.Node[]>
contextType?: <internal>.Context<any>

If set, this.context will be set at runtime to the current value of the given Context.

Usage:

type MyContext = number
const Ctx = React.createContext<MyContext>(0)

class Foo extends React.Component {
static contextType = Ctx
context!: React.ContextType<typeof Ctx>
render () {
return <>My context's value: {this.context}</>;
}
}
see

https://reactjs.org/docs/context.html#classcontexttype

Methods

  • UNSAFE_componentWillMount(): void
  • add_nodes<NT>(nodes: NT | NT[], path: number[]): void
  • Type Parameters

    Parameters

    • nodes: NT | NT[]
    • path: number[]

    Returns void

  • add_nodes_after<NT, TT>(nodes: NT | NT[], target_node: TT): void
  • add_nodes_before<NT, TT>(nodes: NT | NT[], target_node: TT): void
  • add_nodes_here<NT>(nodes: NT | NT[]): void
  • Type Parameters

    Parameters

    • nodes: NT | NT[]

    Returns void

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    Returns void

  • componentDidMount(): void
  • Called immediately after a component is mounted. Setting state here will trigger re-rendering.

    Returns void

  • componentWillMount(): void
  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

  • delete_concept_node<NT>(node: NT): void
  • delete_node_by_path<NT>(path: number[]): void
  • Type Parameters

    Parameters

    • path: number[]

    Returns void

  • delete_nodes_by_paths<NT>(paths: number[][]): void
  • Type Parameters

    Parameters

    • paths: number[][]

    Returns void

  • forceUpdate(callback?: (() => void)): void
  • Parameters

    • Optional callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns any

  • Returns EditorCore

  • Returns EditorCore

  • root_childrenroot_property组合成一棵树。

    Returns Readonly<AbstractNode>

  • move_concept_node<NT>(node_from: NT, posto: number[]): void
  • move_node_by_path<NT>(posf: number[], posto: number[]): void
  • Type Parameters

    Parameters

    • posf: number[]
    • posto: number[]

    Returns void

  • new_concept_node(type: "inline" | "group" | "structure" | "support", sec_ccpt: string): void
  • 在当前位置新建一个指定概念的节点。

    Parameters

    • type: "inline" | "group" | "structure" | "support"
    • sec_ccpt: string

    Returns void

  • onFocusChange(): void
  • 改变光标位置的回调。

    Returns void

  • 按键按下的回调。

    Parameters

    Returns void

  • 按键按下弹起的回调。

    Parameters

    Returns void

  • 按键弹起的回调。

    Parameters

    Returns void

  • onUpdate(v: any): void
  • 节点树更新时的回调。

    Parameters

    • v: any

    Returns void

  • replace_nodes<NT, ST>(father_node: NT, nodes: ST[]): void
  • set_node<NT>(node: NT, new_val: Partial<NT>): void
  • set_node_by_path<NT>(path: number[], new_val: Partial<NT>): void
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

  • unwrap_node<NT>(node: NT): void
  • 当 slate 改变 value 时通知自身的函数。

    Parameters

    Returns void

  • use_tree_op_mixin(): void
  • Returns void

  • wrap_nodes<NT>(node: NT, from: BasePoint, to: BasePoint, options: { split?: boolean; match?: any }): void
  • Type Parameters

    Parameters

    • node: NT
    • from: BasePoint
    • to: BasePoint
    • options: { split?: boolean; match?: any }
      • Optional split?: boolean
      • match?:function
        • match(n: NT): boolean
        • Parameters

          • n: NT

          Returns boolean

    Returns void

  • wrap_selected_nodes<NT>(node: NT, options: { split?: boolean; match?: any }): void
  • Type Parameters

    Parameters

    • node: NT
    • options: { split?: boolean; match?: any }
      • Optional split?: boolean
      • match?:function
        • match(n: NT): boolean
        • Parameters

          • n: NT

          Returns boolean

    Returns void

Generated using TypeDoc