【问题标题】:ctrl + z, ctrl + y not working in slate.js editorctrl + z,ctrl + y 在 slate.js 编辑器中不起作用
【发布时间】:2022-11-11 02:53:37
【问题描述】:

ctrl z 在我的 slateJs 编辑器中不起作用,但在 slate example 中运行良好

    <Slate editor={editor} value={initialValue}>
      <Editable
        renderElement={renderElement}
        renderLeaf={renderLeaf}
        ...
        ...
        onKeyDown = {()=> {
          console.log('key pressed')
        }
      </Editable>
    </Slate>

【问题讨论】:

    标签: javascript frontend editor slate slate-react


    【解决方案1】:

    您必须使用 withHistory ,就像您给出的示例的来源一样:https://github.com/ianstormtaylor/slate/blob/main/site/examples/richtext.tsx#L28 默认撤消和重做行为

    【讨论】:

      猜你喜欢
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      • 2020-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      相关资源
      最近更新 更多