From 0f17abeee6df1a8b40c6c96413a158918ec45d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 21 Jun 2019 22:36:48 +0200 Subject: [PATCH] add dynamic empty text option for placeholder extension --- examples/Components/Routes/Title/index.vue | 19 +++++++++++-------- .../src/extensions/Placeholder.js | 4 +++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/Components/Routes/Title/index.vue b/examples/Components/Routes/Title/index.vue index ce0bcd4f..13d59c9d 100644 --- a/examples/Components/Routes/Title/index.vue +++ b/examples/Components/Routes/Title/index.vue @@ -17,18 +17,21 @@ export default { data() { return { editor: new Editor({ + autoFocus: true, extensions: [ new Doc(), new Title(), new Placeholder({ - emptyNodeClass: 'is-empty', - emptyNodeText: 'Write something …', + showOnlyCurrent: false, + emptyNodeText: node => { + if (node.type.name === 'title') { + return 'Give me a name' + } + + return 'Write something' + }, }), ], - content: ` -

This is a fixed title.

-

With ProseMirror you can force a document layout. Try to remove this title it – it's not possible.

- `, }), } }, @@ -39,8 +42,8 @@ export default {