nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.16k stars 1.75k forks source link

Is there a way to set line break for a placeholder option? #1247

Closed djbicycle closed 3 years ago

djbicycle commented 3 years ago

Summary

I know there is a option for placeholder in editor, but I cannot find a way to set link break in the content of the placeholder. I tried for a line break, but it doesn't work. Is there any way to do that?

Version

@toast-ui/editor: 2.4.0 @toast-ui/vue-editor: 2.4.0

Additional Content

I tried for a line break, but it doesn't work <editor :initialValue="value" ref="refEditor" :options="editorOptions" initialEditType="wysiwyg" /> editorOptions: { placeholder: "line1 &#13;&#10; line2" },

seonim-ryu commented 3 years ago

@djbicycle First, put a newline character between the text you want to newline.

const editor = new Editor({
  // ...
  initialEditType: 'wysiwyg',
  placeholder: 'line1 \n line2'
});

Then, you need to customize it. You can add a style to the CSS selector as follows.

.tui-editor-contents-placeholder::before {
  white-space: pre;
}

wwe

djbicycle commented 3 years ago

@djbicycle First, put a newline character between the text you want to newline.

const editor = new Editor({
  // ...
  initialEditType: 'wysiwyg',
  placeholder: 'line1 \n line2'
});

Then, you need to customize it. You can add a style to the CSS selector as follows.

.tui-editor-contents-placeholder::before {
  white-space: pre;
}

wwe

It works, thank you!