From 3360e119a454a1630862206c0e68a36a9b2e04bf Mon Sep 17 00:00:00 2001 From: 0biWanKenobi Date: Sat, 4 Dec 2021 21:43:57 +0100 Subject: [PATCH 1/2] feat(toolbar): support custom content for buttons before: > we could use custom text, or > we could use a menu w/ one of the provided icons after: - we can provide a template for custom toolbar items; - the template name is dynamically computed from the `toolbar` prop; - each `toolbar` prop has two new settings: - `slot`: true if we want to render a custom template - `preventNativeClick`: defaults to `true`, can be set to `false` to allow eg. a `select` to work properly - tooltip works even w/ custom templates; this is possible by listening to `mousenter` event, instead of `mouseover` --- dev/App.vue | 81 +++++++++++++++++++++------ dev/main.js | 6 +- package.json | 1 - src/base-editor.vue | 15 +++++ src/codemirror-editor.vue | 13 +++++ src/components/container.vue | 32 ++++++++++- src/components/toolbar-item/index.vue | 30 ++++++---- src/components/toolbar.vue | 9 ++- 8 files changed, 152 insertions(+), 35 deletions(-) diff --git a/dev/App.vue b/dev/App.vue index 6f7ba2bb..73c2aab1 100644 --- a/dev/App.vue +++ b/dev/App.vue @@ -11,7 +11,31 @@ @save="handleSave" @copy-code-success="handleCopyCodeSuccess" ref="editor" - /> + :toolbar="customToolbar" + left-toolbar="undo redo | myButton my2ndButton" + > + + + +