tiptap/packages/core/src/extensions/editable.ts

22 lines
445 B
TypeScript
Raw Normal View History

2020-11-03 05:43:54 +08:00
import { Plugin, PluginKey } from 'prosemirror-state'
2020-11-16 06:25:25 +08:00
import { Extension } from '../Extension'
2020-11-03 05:43:54 +08:00
2020-11-16 06:25:25 +08:00
export const Editable = Extension.create({
2020-11-03 05:43:54 +08:00
addProseMirrorPlugins() {
return [
new Plugin({
key: new PluginKey('editable'),
props: {
editable: () => this.editor.options.editable,
},
}),
]
},
})
2020-11-05 00:25:25 +08:00
declare module '@tiptap/core' {
interface AllExtensions {
Editable: typeof Editable,
2020-11-16 17:03:21 +08:00
}
}