mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 07:40:13 +08:00
Add Plugin Key to placeholder component. (#3652)
* Add Plugin Key to placeholder component. Key added to fix error duplicate plugin when using `Placeholder` component. * Add PluginKey import --------- Co-authored-by: Dominik <6538827+bdbch@users.noreply.github.com>
This commit is contained in:
parent
c8f8295146
commit
125caf4965
@ -1,6 +1,6 @@
|
|||||||
import { Editor, Extension } from '@tiptap/core'
|
import { Editor, Extension } from '@tiptap/core'
|
||||||
import { Node as ProsemirrorNode } from '@tiptap/pm/model'
|
import { Node as ProsemirrorNode } from '@tiptap/pm/model'
|
||||||
import { Plugin } from '@tiptap/pm/state'
|
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
||||||
import { Decoration, DecorationSet } from '@tiptap/pm/view'
|
import { Decoration, DecorationSet } from '@tiptap/pm/view'
|
||||||
|
|
||||||
export interface PlaceholderOptions {
|
export interface PlaceholderOptions {
|
||||||
@ -36,6 +36,7 @@ export const Placeholder = Extension.create<PlaceholderOptions>({
|
|||||||
addProseMirrorPlugins() {
|
addProseMirrorPlugins() {
|
||||||
return [
|
return [
|
||||||
new Plugin({
|
new Plugin({
|
||||||
|
key: new PluginKey('placeholder'),
|
||||||
props: {
|
props: {
|
||||||
decorations: ({ doc, selection }) => {
|
decorations: ({ doc, selection }) => {
|
||||||
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable
|
||||||
|
Loading…
Reference in New Issue
Block a user