
like the following
var editor = new tui.Editor({
el: document.querySelector('#editSection'),
previewStyle: 'vertical',
height: '400px',
initialEditType: 'markdown',
useCommandShortcut: true,
initialValue: content,
exts: ['scrollSync', 'uml', 'chart', 'mark', 'table', 'taskCounter'],
toolbarItems: [
'heading',
'bold',
'divider',
'indent',
'outdent',
{
type: 'button',
options: {
name: 'test',
className: 'custom-button-1',
event: 'lol',
tooltip: 'custom button 1'
}
},
{
type: 'button',
options: {
$el: $('<div style="float:left;width:100px;font-size: 10px;text-align:center;line-height: 30px">custom element</div>'),
name: 'test2',
className: 'custom-button-2',
command: 'CustomCommand',
tooltip: 'custom button 2'
}
}
]
});
to make Customize toolbar work (click a button that I build. to make bold text)
//... some not relate code here
this.editor = new Editor({
el: document.querySelector("#content"),
initialEditType: "wysiwyg",
hideModeSwitch: true,
language: 'zh',
toolbarItems: [
'heading',
'bold',
'italic',
'strike',
'divider',
'hr',
'quote',
'divider',
'ul',
'ol',
// 'task',
// 'indent',
// 'outdent',
// 'divider',
// 'table',
'image',
'link',
// 'divider',
// 'code',
// 'codeblock'
],
// We just remove some menu item here.
});
//... some not relate code here
take Vue for example
<button @click='my_bold'>My Bold Button<button>
my_bold(){
this.editor.exec('Bold')
}
exec is from Doc: http://nhnent.github.io/tui.editor/api/latest/CommandManager.html
this work.
So what you guys think? would you guys add more example?
Thanks.
Yes. I should write a document for this. (maybe you can help on this ๐ )
Thanks for a good example @1c7
I'll mark it as a help wanted.
Feel free to send a PR for it. any of you.
@kyuwoo-choi no problem, Thanks for reply! also thank you for building this text editor.
I am not sure If I have time to PR, but I may.
Thanks again~
you guys can close this issue anytime
Good Job @1c7
Thanks for the contribution ๐
@kyuwoo-choi you are welcome~
glad you like it haha
Most helpful comment
Yes. I should write a document for this. (maybe you can help on this ๐ )
Thanks for a good example @1c7
I'll mark it as a
help wanted.Feel free to send a PR for it. any of you.