toast-ui.vue-editor icon indicating copy to clipboard operation
toast-ui.vue-editor copied to clipboard

Question: Add toolbar button?

Open dantrevino opened this issue 5 years ago • 3 comments

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

dantrevino avatar Mar 13 '19 07:03 dantrevino

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);

sohee-lee7 avatar Mar 25 '19 10:03 sohee-lee7

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.

Screenshot from 2019-03-26 00-45-25 "Fullscreen" button at position 16 ^^^

Screenshot from 2019-03-26 00-46-02 "Fullscreen" button at position 17 ^^^ (no button)

default toolbar size: toolbar.getItems().length = 20

dantrevino avatar Mar 26 '19 07:03 dantrevino

@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.

sohee-lee7 avatar Apr 03 '19 01:04 sohee-lee7