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

24 lines
461 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
2020-11-16 22:40:05 +08:00
declare global {
namespace Tiptap {
interface AllExtensions {
Editable: typeof Editable,
}
2020-11-16 17:03:21 +08:00
}
}