1

Anyone know how create placeholder when input is empty in CodeMirror 6, i search docs but nothing special about this basic function like it

I search something but i found only to version 5 not 6

Raxon
  • 13
  • 3

1 Answers1

2
import { EditorView, placeholder } from '@codemirror/view'
import { EditorState } from "@codemirror/state"

const startState = EditorState.create({
  doc: 'Hello World',
  extensions: [placeholder('placeholder text')]
})

const view = new EditorView({
  state: startState,
  parent: document.body
})
zag2art
  • 4,869
  • 1
  • 29
  • 39