toast-ui.vue-editor
toast-ui.vue-editor copied to clipboard
Question: Add toolbar button?
Version
1.0.4
Test Environment
Chrome 72, Linux
Current Behavior
When implementing via a SFC, how can I add a toolbar button, as described here: https://github.com/nhnent/tui.editor/issues/317#issuecomment-450781457
Expected Behavior
Looking to customize toolbar
First get ui
instance of tui.editor using $refs
and then get toolbar
instance.
Using addButton
method of toolbar
, you can add customized button.
const ui = this.$refs.editorRef.invoke('getUI');
const toolbar = ui.getToolbar();
toolbar.addButton({
name: 'fullscreen',
tooltip: 'fullscreen',
$el: $('<button type="button"><!-- iCon--></button>')
}, 1);
Thank you this is helpful. How can I add to the end of the toolbar? I see that addButton takes an index, but if I addButton
to position toolbar.getItems().length I do not see a button. Even addButton({...}, toolbar.getItems().length - 3)
does not show up, but when I use length-4, the icon suddenly shows up between the </>
and CB
buttons.
"Fullscreen" button at position 16 ^^^
"Fullscreen" button at position 17 ^^^ (no button)
default toolbar size: toolbar.getItems().length = 20
@dantrevino Sorry for late reply. This is a bug of tui.editor so I make issue at the issue of tui.editor. https://github.com/nhnent/tui.editor/issues/458 Please wait a little while for handle tui.editor issue.