refac: placeholder
This commit is contained in:
@@ -171,6 +171,18 @@
|
|||||||
|
|
||||||
export let className = 'input-prose';
|
export let className = 'input-prose';
|
||||||
export let placeholder = 'Type here...';
|
export let placeholder = 'Type here...';
|
||||||
|
let _placeholder = placeholder;
|
||||||
|
|
||||||
|
$: if (placeholder !== _placeholder) {
|
||||||
|
setPlaceholder();
|
||||||
|
}
|
||||||
|
|
||||||
|
const setPlaceholder = () => {
|
||||||
|
_placeholder = placeholder;
|
||||||
|
if (editor) {
|
||||||
|
editor?.view.dispatch(editor.state.tr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export let richText = true;
|
export let richText = true;
|
||||||
export let link = false;
|
export let link = false;
|
||||||
@@ -971,7 +983,7 @@
|
|||||||
StarterKit.configure({
|
StarterKit.configure({
|
||||||
link: link
|
link: link
|
||||||
}),
|
}),
|
||||||
Placeholder.configure({ placeholder }),
|
Placeholder.configure({ placeholder: () => _placeholder }),
|
||||||
SelectionDecoration,
|
SelectionDecoration,
|
||||||
|
|
||||||
...(richText
|
...(richText
|
||||||
|
|||||||
Reference in New Issue
Block a user