goodteditor-ui 1.0.50 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/index.d.ts +60 -0
  2. package/index.js +3 -3
  3. package/package.json +1 -1
  4. package/src/App.vue +3 -1
  5. package/src/components/ui/Popup.vue +27 -4
  6. package/src/components/ui/Tooltip.vue +26 -7
  7. package/src/components/ui/WysiwygEditor/WysiwygEditor.md +74 -0
  8. package/src/components/ui/{WysiwygEditor.vue → WysiwygEditor/WysiwygEditor.vue} +13 -16
  9. package/src/components/ui/WysiwygEditor/{WysiwygEditor.d.ts → constants.d.ts} +14 -5
  10. package/src/components/ui/WysiwygEditor/constants.js +29 -99
  11. package/src/components/ui/WysiwygEditor/index.d.ts +3 -4
  12. package/src/components/ui/WysiwygEditor/index.js +3 -4
  13. package/src/components/ui/WysiwygEditor/renders/Button.vue +4 -3
  14. package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +4 -3
  15. package/src/components/ui/WysiwygEditor/renders/Image.vue +5 -4
  16. package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +2 -1
  17. package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +2 -1
  18. package/src/components/ui/WysiwygEditor/renders/Link.vue +4 -3
  19. package/src/components/ui/WysiwygEditor/renders/Select.vue +2 -1
  20. package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +4 -3
  21. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.d.ts +20 -0
  22. package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +8 -1
  23. package/src/components/ui/WysiwygEditor/renders/mixins/index.d.ts +1 -0
  24. package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
  25. package/src/components/ui/WysiwygEditor/tools-and-commands.js +50 -49
  26. package/src/components/ui/WysiwygEditor/utils.js +20 -6
  27. package/src/components/ui/utils/Helpers.js +6 -0
  28. package/styleguide.config.js +7 -1
  29. package/src/components/ui/WysiwygEditor.md +0 -18
package/index.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ import Avatar from './src/components/ui/Avatar.vue';
2
+ import Badge from './src/components/ui/Badge.vue';
3
+ import Collapse from './src/components/ui/Collapse.vue';
4
+ import ColorPicker from './src/components/ui/ColorPicker.vue';
5
+ import Datalist from './src/components/ui/Datalist.vue';
6
+ import DatePicker from './src/components/ui/DatePicker.vue';
7
+ import FileSelector from './src/components/ui/FileSelector.vue';
8
+ import Image from './src/components/ui/Image.vue';
9
+ import InputAutocomplete from './src/components/ui/InputAutocomplete.vue';
10
+ import InputColorPicker from './src/components/ui/InputColorPicker.vue';
11
+ import InputDatePicker from './src/components/ui/InputDatePicker.vue';
12
+ import InputTags from './src/components/ui/InputTags.vue';
13
+ import InputTimePicker from './src/components/ui/InputTimePicker.vue';
14
+ import InputUnits from './src/components/ui/InputUnits.vue';
15
+ import Lazy from './src/components/ui/Lazy.vue';
16
+ import Pagination from './src/components/ui/Pagination.vue';
17
+ import Paginator from './src/components/ui/Paginator.vue';
18
+ import Popover from './src/components/ui/Popover.vue';
19
+ import Popup from './src/components/ui/Popup.vue';
20
+ import ResponsiveContainer from './src/components/ui/ResponsiveContainer.vue';
21
+ import Select from './src/components/ui/Select.vue';
22
+ import TimePicker from './src/components/ui/TimePicker.vue';
23
+ import Tooltip from './src/components/ui/Tooltip.vue';
24
+ import Grid from './src/components/ui/Grid.vue';
25
+ import { WysiwygEditor, WysiwygConsts, WysiwygRenderMixins } from './src/components/ui/WysiwygEditor';
26
+ // utils stuff
27
+ import FormComponent from './src/components/ui/utils/FormComponent';
28
+
29
+ const Utils = { FormComponent, ...WysiwygRenderMixins };
30
+ const Constants = { ...WysiwygConsts };
31
+
32
+ export {
33
+ Utils,
34
+ Constants,
35
+ Avatar,
36
+ Badge,
37
+ Collapse,
38
+ ColorPicker,
39
+ Datalist,
40
+ DatePicker,
41
+ FileSelector,
42
+ Image,
43
+ InputAutocomplete,
44
+ InputColorPicker,
45
+ InputDatePicker,
46
+ InputTags,
47
+ InputTimePicker,
48
+ InputUnits,
49
+ Lazy,
50
+ Pagination,
51
+ Paginator,
52
+ Popover,
53
+ Popup,
54
+ ResponsiveContainer,
55
+ Select,
56
+ TimePicker,
57
+ Tooltip,
58
+ Grid,
59
+ WysiwygEditor
60
+ };
package/index.js CHANGED
@@ -22,12 +22,12 @@ import Select from './src/components/ui/Select.vue';
22
22
  import TimePicker from './src/components/ui/TimePicker.vue';
23
23
  import Tooltip from './src/components/ui/Tooltip.vue';
24
24
  import Grid from './src/components/ui/Grid.vue';
25
- import WysiwygEditor, { ToolType as WysiwygTool } from './src/components/ui/WysiwygEditor.vue';
25
+ import { WysiwygEditor, WysiwygConsts, WysiwygRenderMixins } from './src/components/ui/WysiwygEditor';
26
26
  // utils stuff
27
27
  import FormComponent from './src/components/ui/utils/FormComponent';
28
28
 
29
- const Utils = { FormComponent };
30
- const Constants = { WysiwygTool };
29
+ const Utils = { FormComponent, ...WysiwygRenderMixins };
30
+ const Constants = { ...WysiwygConsts };
31
31
 
32
32
  export {
33
33
  Utils,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -12,7 +12,9 @@
12
12
 
13
13
  <script>
14
14
  import UiSelect from './components/ui/Select.vue';
15
- import * as Components from './../index';
15
+ import * as Exports from './../index';
16
+
17
+ const { Utils, Constants, ...Components } = Exports;
16
18
 
17
19
  export default {
18
20
  name: 'App',
@@ -6,7 +6,7 @@
6
6
  v-if="visible"
7
7
  >
8
8
  <div class="popup-dialog" v-bind="dialog">
9
- <!--
9
+ <!--
10
10
  @slot Custom close slot
11
11
  @binding {Function} close closes the popup
12
12
  -->
@@ -15,8 +15,8 @@
15
15
  <i class="mdi mdi-close" style="font-size: 1.25rem"></i>
16
16
  </div>
17
17
  </slot>
18
- <div class="popup-dialog-body" :class="{ 'pad-none': !usePadding }">
19
- <!--
18
+ <div class="popup-dialog-body" :style="dialogBody.style" :class="dialogBodyClass">
19
+ <!--
20
20
  @slot Custom body slot
21
21
  @binding {Function} close closes the popup
22
22
  -->
@@ -27,7 +27,7 @@
27
27
  :class="{ 'pad-none': !usePadding }"
28
28
  v-if="$scopedSlots.footer"
29
29
  >
30
- <!--
30
+ <!--
31
31
  @slot Custom footer slot
32
32
  @binding {Function} close closes the popup
33
33
  -->
@@ -89,6 +89,16 @@ export default {
89
89
  return { class: {}, style: {} };
90
90
  },
91
91
  },
92
+ /**
93
+ * Popup dialog body options for styling css/style
94
+ * { class:any style:any }
95
+ */
96
+ dialogBody: {
97
+ type: Object,
98
+ default() {
99
+ return { class: {}, style: {} };
100
+ },
101
+ },
92
102
  /**
93
103
  * Whether to show the close button
94
104
  */
@@ -111,6 +121,19 @@ export default {
111
121
  default: 'scroll-hide',
112
122
  },
113
123
  },
124
+ computed: {
125
+ dialogBodyClass() {
126
+ const { dialogBody, usePadding } = this;
127
+
128
+ if (usePadding) {
129
+ return dialogBody.class;
130
+ }
131
+
132
+ return Array.isArray(dialogBody.class)
133
+ ? [dialogBody.class, 'pad-none']
134
+ : { ...dialogBody.class, 'pad-none': true };
135
+ },
136
+ },
114
137
  watch: {
115
138
  visible: {
116
139
  handler(val) {
@@ -7,12 +7,12 @@
7
7
  @mouseenter.native="onPopoverMouseEnter"
8
8
  @mouseleave.native="onPopoverMouseLeave"
9
9
  >
10
- <!--
10
+ <!--
11
11
  @slot Tooltip slot
12
12
  -->
13
13
  <slot name="tooltip">
14
14
  <div class="tooltip">
15
- <!--
15
+ <!--
16
16
  @slot Tooltip content slot
17
17
  -->
18
18
  <slot></slot>
@@ -28,7 +28,7 @@
28
28
  </style>
29
29
  <script>
30
30
  import UiPopover from './Popover.vue';
31
- import { Position } from './utils/Helpers';
31
+ import { Position, TriggerOn } from './utils/Helpers';
32
32
  import WithPopover from './utils/WithPopover';
33
33
 
34
34
  export default {
@@ -59,17 +59,33 @@ export default {
59
59
  return [0, 5];
60
60
  },
61
61
  },
62
+ /**
63
+ * Conditions to trigger tooltip
64
+ * @default mousemove
65
+ * @values mousemove,click
66
+ */
67
+ triggerOn: {
68
+ type: String,
69
+ default: TriggerOn.MOUSE_MOVE
70
+ }
62
71
  },
63
72
  data() {
64
73
  return {
65
- targetEvents: {
66
- mouseenter: this.onTargetMouseEnter,
67
- mouseleave: this.onTargetMouseLeave,
68
- },
69
74
  timeout: null,
70
75
  };
71
76
  },
72
77
  computed: {
78
+ targetEvents() {
79
+ if (this.triggerOn === TriggerOn.MOUSE_MOVE) {
80
+ return {
81
+ mouseenter: this.onTargetMouseEnter,
82
+ mouseleave: this.onTargetMouseLeave,
83
+ };
84
+ }
85
+ return {
86
+ click: this.onTargetClick,
87
+ };
88
+ },
73
89
  targetBinds() {
74
90
  return {
75
91
  'data-popover': this.popoverTargetId,
@@ -102,6 +118,9 @@ export default {
102
118
  onTargetMouseLeave(e) {
103
119
  this.setShow(false);
104
120
  },
121
+ onTargetClick(e) {
122
+ this.setShow(!this.popoverShow);
123
+ },
105
124
  onPopoverMouseEnter(e) {
106
125
  this.setShow(true);
107
126
  },
@@ -0,0 +1,74 @@
1
+ Simple example
2
+ ```vue
3
+ <template>
4
+ <div class="pad-l5">
5
+ <ui-wysiwyg-editor v-model="model"></ui-wysiwyg-editor>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ import UiWysiwygEditor from './WysiwygEditor.vue';
10
+ export default {
11
+ components: { UiWysiwygEditor },
12
+ data: () => ({
13
+ model: `<p>This WYSIWYG is based on
14
+ <a target="_blank" rel="noopener noreferrer nofollow" href="https://tiptap.dev/" class="color-link">tiptap</a>
15
+ editor framework.</p>`
16
+ })
17
+ };
18
+ </script>
19
+ ```
20
+
21
+ Advanced example. Using custom tool groups, bubble menu and 'change' event instead of 'input'
22
+
23
+ ```vue
24
+ <template>
25
+ <div class="pad-l5">
26
+ <ui-wysiwyg-editor
27
+ v-bind="{
28
+ value: model,
29
+ tools,
30
+ focusVisible: false,
31
+ bubbleMenu: { isEnabled: true}
32
+ }"
33
+ @change="onChange"></ui-wysiwyg-editor>
34
+ </div>
35
+ </template>
36
+ <script>
37
+ import UiWysiwygEditor from './WysiwygEditor.vue';
38
+ import { createTool, ToolType } from './constants';
39
+
40
+ export default {
41
+ components: { UiWysiwygEditor },
42
+ data: () => ({
43
+ model: `<p><strong>select text</strong> to see a formatting menu pop up</p>`,
44
+ tools: [
45
+ {
46
+ title: '',
47
+ group: [
48
+ ToolType.UNDO,
49
+ ToolType.REDO,
50
+ ToolType.PARAGRAPH_STYLE,
51
+ ToolType.TEXT_COLOR,
52
+ createTool({
53
+ name: ToolType.HORIZONTAL_RULE,
54
+ icon: 'minus',
55
+ title: 'Вертикальный разделитель',
56
+ exec() {
57
+ this.editor.chain().focus().setHorizontalRule().run();
58
+ },
59
+ isEnabled() {
60
+ return this.editor.can().setHorizontalRule();
61
+ }
62
+ })
63
+ ]
64
+ }
65
+ ]
66
+ }),
67
+ methods: {
68
+ onChange(value) {
69
+ this.model = value;
70
+ }
71
+ }
72
+ };
73
+ </script>
74
+ ```
@@ -17,7 +17,7 @@
17
17
  :key="groupIndex"
18
18
  class="col col-vmid col-auto">
19
19
  <div class="d-flex flex-col flex-v-center">
20
- <div class="group-header">
20
+ <div v-if="resolveGroupTitle(title, groupIndex) !== ''" class="group-header">
21
21
  <!--
22
22
  @slot Group header slot
23
23
  @binding {number} groupIndex index of the tools group
@@ -60,19 +60,17 @@
60
60
  <script>
61
61
  import { Editor, EditorContent } from '@tiptap/vue-2';
62
62
 
63
- import { debounce } from './utils/Helpers';
64
- import Grid from './Grid.vue';
65
- import { resolveExtensions } from './WysiwygEditor/extensions';
66
- import { buildToolGroups, bindContext } from './WysiwygEditor/utils';
67
- import { DefaultTools } from './WysiwygEditor/constants';
68
-
69
- export { ToolType } from './WysiwygEditor/constants';
63
+ import { debounce } from '../utils/Helpers';
64
+ import Grid from '../Grid.vue';
65
+ import { resolveExtensions } from './extensions';
66
+ import { buildToolGroups, bindContext } from './utils';
67
+ import { DefaultTools } from './constants';
70
68
 
71
69
  /**
72
70
  * @typedef {Omit<import('@tiptap/extension-bubble-menu').BubbleMenuOptions, 'element'>} BubbleMenuOptions
73
71
  * @property {boolean} isEnabled
74
72
  * @typedef {import('vue').PropOptions.<BubbleMenuOptions>} BubbleMenuOptionsProp
75
- * @typedef {import('./WysiwygEditor/WysiwygEditor').ToolDef} Tool
73
+ * @typedef {import('./constants').ITool} ITool
76
74
  */
77
75
 
78
76
  export default {
@@ -89,11 +87,11 @@ export default {
89
87
  default: '',
90
88
  },
91
89
  /**
92
- * array of using tools: { title: string, group: string[] }
90
+ * array of using tools: { title: string, group: Array<string|ITool> }
93
91
  */
94
92
  tools: {
95
93
  type: Array,
96
- default: () => [],
94
+ default: () => DefaultTools,
97
95
  validator: (tools) => tools.every((tool) => typeof tool === 'object' && Array.isArray(tool) === false)
98
96
  },
99
97
  /**
@@ -136,11 +134,10 @@ export default {
136
134
  return this.editor?.getHTML() ?? '';
137
135
  },
138
136
  /**
139
- * @return {{title: string, group: Tool[]}[]}
137
+ * @return {{title: string, group: ITool[]}[]}
140
138
  */
141
139
  toolGroups() {
142
- const tools = this.tools.length === 0 ? DefaultTools : this.tools;
143
- return buildToolGroups(tools);
140
+ return buildToolGroups(this.tools);
144
141
  },
145
142
  editorClass() {
146
143
  const classes = ['pad-3', 'scroll-y'];
@@ -231,8 +228,8 @@ export default {
231
228
  this.caretPosition = transaction.curSelection.to;
232
229
  },
233
230
  /**
234
- * @param {Tool} tool
235
- * @return Tool
231
+ * @param {ITool} tool
232
+ * @return {ITool}
236
233
  */
237
234
  buildToolBinds(tool) {
238
235
  const { editor, toolGroups } = this;
@@ -20,15 +20,15 @@ export type Render = Readonly<{
20
20
  IMAGE: Image;
21
21
  }>;
22
22
 
23
- export type CommandDef = {
23
+ export interface ICommand {
24
24
  name: String;
25
25
  title: String;
26
26
  exec: () => void;
27
27
  isActive: () => Boolean;
28
28
  isEnabled: () => Boolean;
29
- };
29
+ }
30
30
 
31
- export type ToolDef = {
31
+ export interface ITool {
32
32
  name: String;
33
33
  render: Render;
34
34
  title: String;
@@ -37,9 +37,9 @@ export type ToolDef = {
37
37
  isActive: () => Boolean;
38
38
  isEnabled: () => Boolean;
39
39
  getValue?: () => String | Record<String, any>;
40
- options?: Array<String | ToolDef | CommandDef>;
40
+ options?: Array<String | ITool | ICommand>;
41
41
  units?: Array<String>
42
- };
42
+ }
43
43
 
44
44
  export type NodeType = Readonly<{
45
45
  BLOCKQUOTE: 'blockquote',
@@ -126,3 +126,12 @@ export type ToolType = Readonly<{
126
126
  TOGGLE_ZEBRA: 'toggleZebra',
127
127
  INSERT_IMAGE: 'insertImage'
128
128
  }>;
129
+
130
+ export type DefaultTools = Array<{
131
+ title: string,
132
+ group: Array<string|ITool>
133
+ }>;
134
+
135
+ export function createTool(toolOptions: Partial<ITool>): ITool;
136
+
137
+ export function createCommand(commandOptions: Partial<ICommand>): ICommand;
@@ -10,13 +10,13 @@ import {
10
10
  } from './renders';
11
11
 
12
12
  /**
13
- * @typedef {import('./WysiwygEditor').NodeType} NodeType
14
- * @typedef {import('./WysiwygEditor').MarkType} MarkType
15
- * @typedef {import('./WysiwygEditor').CommandType} CommandType
16
- * @typedef {import('./WysiwygEditor').ToolType} ToolType
17
- * @typedef {import('./WysiwygEditor').Render} Render
18
- * @typedef {import('./WysiwygEditor').CommandDef} Command
19
- * @typedef {import('./WysiwygEditor').ToolDef} Tool
13
+ * @typedef {import('./constants').NodeType} NodeType
14
+ * @typedef {import('./constants').MarkType} MarkType
15
+ * @typedef {import('./constants').CommandType} CommandType
16
+ * @typedef {import('./constants').ToolType} ToolType
17
+ * @typedef {import('./constants').Render} Render
18
+ * @typedef {import('./constants').ICommand} ICommand
19
+ * @typedef {import('./constants').ITool} ITool
20
20
  */
21
21
 
22
22
  /**
@@ -129,16 +129,16 @@ export const ToolType = Object.freeze({
129
129
  });
130
130
 
131
131
  /**
132
- * @param {Command} command
133
- * @return Command
132
+ * @param {Partial<ICommand>} command
133
+ * @return {ICommand}
134
134
  */
135
135
  export const createCommand = ({
136
- name,
137
- title = 'Unknown command',
138
- exec = () => {},
139
- isActive = () => false,
140
- isEnabled = () => true
141
- }) => ({
136
+ name = '',
137
+ title = 'Unknown command',
138
+ exec = () => {},
139
+ isActive = () => false,
140
+ isEnabled = () => true
141
+ }) => ({
142
142
  name,
143
143
  title,
144
144
  exec,
@@ -161,97 +161,27 @@ export const Render = Object.freeze({
161
161
  });
162
162
 
163
163
  /**
164
- * @param {Tool} tool
165
- * @return Tool
164
+ * @param {Partial<ITool>} tool
165
+ * @return {ITool}
166
166
  */
167
- export const createBaseTool = ({
168
- name,
169
- render = Render.BUTTON,
170
- title = 'Unknown tool',
171
- icon = 'help-circle-outline',
172
- exec = () => {},
173
- isActive = () => false,
174
- isEnabled = () => true
175
- }) => ({
167
+ export const createTool = ({
168
+ name = '',
169
+ render = Render.BUTTON,
170
+ title = 'Unknown tool',
171
+ icon = 'help-circle-outline',
172
+ exec = () => {},
173
+ isActive = () => false,
174
+ isEnabled = () => true,
175
+ ...optionalRest
176
+ }) => ({
176
177
  name,
177
178
  render,
178
179
  title,
179
180
  icon,
180
181
  exec,
181
182
  isActive,
182
- isEnabled
183
- });
184
-
185
- /**
186
- * @param {Tool} toolOptions
187
- * @return Tool
188
- */
189
- export const createButtonTool = (toolOptions) => createBaseTool(toolOptions);
190
-
191
- /**
192
- * @param {Tool} tool
193
- * @return Tool
194
- */
195
- export const createSelectTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
196
- ...createBaseTool({ render: Render.SELECT, ...toolOptions }),
197
- getValue,
198
- options
199
- });
200
-
201
- /**
202
- * @param {Tool} tool
203
- * @return Tool
204
- */
205
- export const createColorPickerTool = ({ getValue = () => null, ...toolOptions }) => ({
206
- ...createBaseTool({ render: Render.COLOR_PICKER, ...toolOptions }),
207
- getValue
208
- });
209
-
210
- /**
211
- * @param {Tool} tool
212
- * @return Tool
213
- */
214
- export const createInputUnitsTool = ({ getValue = () => null, units = [], ...toolOptions }) => ({
215
- ...createBaseTool({ render: Render.INPUT_UNITS, ...toolOptions }),
216
- getValue,
217
- units
218
- });
219
-
220
- /**
221
- * @param {Tool} tool
222
- * @return Tool
223
- */
224
- export const createToolbarPopoverTool = ({ options = [], ...toolOptions }) => ({
225
- ...createBaseTool({ render: Render.TOOLBAR_POPOVER, ...toolOptions }),
226
- options
227
- });
228
-
229
- /**
230
- * @param {Tool} tool
231
- * @return Tool
232
- */
233
- export const createInputAutoTool = ({ getValue = () => null, options = [], ...toolOptions }) => ({
234
- ...createBaseTool({ render: Render.INPUT_AUTO, ...toolOptions }),
235
- getValue,
236
- options
237
- });
238
-
239
- /**
240
- * @param {Tool} tool
241
- * @return Tool
242
- */
243
- export const createImageTool = ({ getValue = () => null, ...toolOptions }) => ({
244
- ...createBaseTool({ render: Render.IMAGE, ...toolOptions }),
245
- getValue
246
- });
247
-
248
- /**
249
- * @param {Tool} tool
250
- * @return Tool
251
- */
252
- export const createLinkTool = ({ getValue = () => null, ...toolOptions }) => ({
253
- ...createBaseTool({ render: Render.LINK, ...toolOptions }),
254
- getValue
183
+ isEnabled,
184
+ ...optionalRest
255
185
  });
256
186
 
257
187
  export const DefaultTools = [
@@ -1,4 +1,3 @@
1
- export { default as WysiwygEditor } from '../WysiwygEditor.vue';
2
- export * from './constants'
3
- export * from './utils'
4
- export * from './tools-and-commands';
1
+ export { default as WysiwygEditor } from './WysiwygEditor.vue';
2
+ export * as WysiwygConsts from './constants';
3
+ export * as WysiwygRenderMixins from './renders/mixins';
@@ -1,4 +1,3 @@
1
- export { default as WysiwygEditor } from '../WysiwygEditor.vue';
2
- export * from './constants'
3
- export * from './utils'
4
- export * from './tools-and-commands';
1
+ export { default as WysiwygEditor } from './WysiwygEditor.vue';
2
+ export * as WysiwygConsts from './constants';
3
+ export * as WysiwygRenderMixins from './renders/mixins';
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <div :title="title">
3
3
  <button
4
- :class="{ 'btn-outline': !isActive, 'btn-primary': isActive }"
4
+ :class="{ 'btn-outline': !isActive }"
5
5
  :disabled="!isEnabled"
6
- class="btn btn-small btn-icon"
6
+ class="btn btn-small btn-icon btn-primary"
7
7
  @click.stop="onClick">
8
8
  <div class="icon">
9
9
  <i :class="icon" class="mdi"></i>
@@ -14,11 +14,12 @@
14
14
  </template>
15
15
 
16
16
  <script>
17
- import { useRender } from './mixins';
17
+ import { useRender, RenderMixinTypes } from './mixins';
18
18
 
19
19
  export default {
20
20
  mixins: [useRender()],
21
21
  methods: {
22
+ ...RenderMixinTypes,
22
23
  onClick() {
23
24
  this.tool.exec();
24
25
  this.emitExecuted();
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div :data-popover="popoverTargetId" :title="title">
3
3
  <button
4
- :class="{ 'btn-outline': !popoverShow, 'btn-primary': popoverShow }"
5
- class="btn btn-small btn-icon"
4
+ :class="{ 'btn-outline': !popoverShow }"
5
+ class="btn btn-small btn-icon btn-primary"
6
6
  @click="togglePopover">
7
7
  <div class="icon">
8
8
  <i class="mdi" :class="icon"></i>
@@ -18,7 +18,7 @@
18
18
  import ColorPicker from '../../ColorPicker.vue';
19
19
  import Popover from '../../Popover.vue';
20
20
  import WithPopover from '../../utils/WithPopover';
21
- import { useRender } from './mixins';
21
+ import { useRender, RenderMixinTypes } from './mixins';
22
22
 
23
23
  export default {
24
24
  components: { ColorPicker, Popover },
@@ -29,6 +29,7 @@ export default {
29
29
  }
30
30
  },
31
31
  methods: {
32
+ ...RenderMixinTypes,
32
33
  onSubmit({ rgba }) {
33
34
  const { r: red, g: green, b: blue, a: alpha } = rgba;
34
35
  const color = `rgba(${red}, ${green}, ${blue}, ${alpha})`;