import './style/placeholder.css' ; import { Plugin } from 'prosemirror-state' ; import { Decoration , DecorationSet } from 'prosemirror-view' ; export const placeholder = ( ) : Plugin => new Plugin ( { props : { decorations : ( state ) => { const decorations = [ ] ; if ( state . doc . content . size === 2 ) { decorations . push ( Decoration . node ( 0 , 2 , { class : 'empty-node' , } ) ) ; } return DecorationSet . create ( state . doc , decorations ) ; } , } , } ) ;