goodteditor-ui 1.0.17 → 1.0.19
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.
- package/index.js +2 -0
- package/package.json +15 -2
- package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +119 -0
- package/src/components/ui/WysiwygEditor/constants.js +255 -0
- package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -0
- package/src/components/ui/WysiwygEditor/extensions/code.js +13 -0
- package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -0
- package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -0
- package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -0
- package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/image.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -0
- package/src/components/ui/WysiwygEditor/extensions/index.js +32 -0
- package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/link.js +16 -0
- package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -0
- package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -0
- package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/table.js +29 -0
- package/src/components/ui/WysiwygEditor/extensions/text-align.js +5 -0
- package/src/components/ui/WysiwygEditor/extensions/text-style.js +15 -0
- package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -0
- package/src/components/ui/WysiwygEditor/index.d.ts +4 -0
- package/src/components/ui/WysiwygEditor/index.js +4 -0
- package/src/components/ui/WysiwygEditor/renders/Button.vue +26 -0
- package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +42 -0
- package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +33 -0
- package/src/components/ui/WysiwygEditor/renders/InputBrowse.vue +35 -0
- package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +37 -0
- package/src/components/ui/WysiwygEditor/renders/Select.vue +45 -0
- package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +50 -0
- package/src/components/ui/WysiwygEditor/renders/index.d.ts +7 -0
- package/src/components/ui/WysiwygEditor/renders/index.js +7 -0
- package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -0
- package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -0
- package/src/components/ui/WysiwygEditor/tools-and-commands.js +709 -0
- package/src/components/ui/WysiwygEditor/utils.js +72 -0
- package/src/components/ui/WysiwygEditor.md +18 -0
- package/src/components/ui/WysiwygEditor.vue +260 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Link as LinkToExtend } from '@tiptap/extension-link';
|
|
2
|
+
|
|
3
|
+
export const Link = LinkToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: 'color-link cursor-pointer'
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ListItem as ListItemToExtend } from '@tiptap/extension-list-item';
|
|
2
|
+
|
|
3
|
+
export const ListItem = ListItemToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OrderedList as OrderedListToExtend } from '@tiptap/extension-ordered-list';
|
|
2
|
+
|
|
3
|
+
export const OrderedList = OrderedListToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Paragraph as ParagraphToExtend } from '@tiptap/extension-paragraph';
|
|
2
|
+
import { NodeType } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const Paragraph = ParagraphToExtend.extend({
|
|
5
|
+
addAttributes() {
|
|
6
|
+
return {
|
|
7
|
+
...this.parent?.(),
|
|
8
|
+
class: {
|
|
9
|
+
default: 'p'
|
|
10
|
+
},
|
|
11
|
+
style: {
|
|
12
|
+
default: null
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
addCommands() {
|
|
17
|
+
return {
|
|
18
|
+
...this.parent?.(),
|
|
19
|
+
setParagraphClass: (className) => ({ commands }) =>
|
|
20
|
+
commands.updateAttributes(NodeType.PARAGRAPH, { class: className })
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Strike as StrikeToExtend } from '@tiptap/extension-strike';
|
|
2
|
+
|
|
3
|
+
export const Strike = StrikeToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TableHeader as TableHeaderToExtend } from '@tiptap/extension-table-header';
|
|
2
|
+
|
|
3
|
+
export const TableHeader = TableHeaderToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TableRow as TableRowToExtend } from '@tiptap/extension-table-row';
|
|
2
|
+
|
|
3
|
+
export const TableRow = TableRowToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Table as TableToExtend } from '@tiptap/extension-table';
|
|
2
|
+
import { NodeType } from '../constants';
|
|
3
|
+
|
|
4
|
+
export const Table = TableToExtend.extend({
|
|
5
|
+
addAttributes() {
|
|
6
|
+
return {
|
|
7
|
+
...this.parent?.(),
|
|
8
|
+
class: {
|
|
9
|
+
default: 'table table-vtop table-borders table-zebra w-100'
|
|
10
|
+
},
|
|
11
|
+
style: null
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
addCommands() {
|
|
15
|
+
return {
|
|
16
|
+
...this.parent?.(),
|
|
17
|
+
toggleTableAlignment: (className, tableClassNames) => ({ commands }) => {
|
|
18
|
+
const classNames = tableClassNames.replace(/table-v(top|bot|mid)\s?/, '');
|
|
19
|
+
return commands.updateAttributes(NodeType.TABLE, { class: `${classNames} ${className}` });
|
|
20
|
+
},
|
|
21
|
+
toggleTableClass: (className, tableClassNames) => ({ commands }) => {
|
|
22
|
+
const classNames = tableClassNames.includes(className)
|
|
23
|
+
? tableClassNames.split(' ').filter((name) => name !== className).join(' ')
|
|
24
|
+
: `${tableClassNames} ${className}`;
|
|
25
|
+
return commands.updateAttributes(NodeType.TABLE, { class: classNames });
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TextStyle as TextStyleToExtend } from '@tiptap/extension-text-style';
|
|
2
|
+
|
|
3
|
+
export const TextStyle = TextStyleToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Underline as UnderlineToExtend } from '@tiptap/extension-underline';
|
|
2
|
+
|
|
3
|
+
export const Underline = UnderlineToExtend.extend({
|
|
4
|
+
addAttributes() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
class: {
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
style: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
:class="{ 'btn-outline': !isActive, 'btn-primary': isActive }"
|
|
4
|
+
:title="title"
|
|
5
|
+
:disabled="!isEnabled"
|
|
6
|
+
class="btn btn-small btn-icon"
|
|
7
|
+
@click.stop="onClick">
|
|
8
|
+
<div class="icon">
|
|
9
|
+
<i :class="icon" class="mdi"></i>
|
|
10
|
+
</div>
|
|
11
|
+
</button>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { useRender } from './mixins';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
mixins: [useRender()],
|
|
19
|
+
methods: {
|
|
20
|
+
onClick() {
|
|
21
|
+
this.tool.exec();
|
|
22
|
+
this.emitExecuted();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :data-popover="popoverTargetId">
|
|
3
|
+
<button
|
|
4
|
+
:title="title"
|
|
5
|
+
class="btn btn-small btn-outline btn-icon"
|
|
6
|
+
@click="togglePopover">
|
|
7
|
+
<div class="icon">
|
|
8
|
+
<i class="mdi" :class="icon"></i>
|
|
9
|
+
</div>
|
|
10
|
+
</button>
|
|
11
|
+
<popover :show.sync="popoverShow" v-bind="popoverOptions">
|
|
12
|
+
<color-picker class="pull-left" v-bind="{ value, showSubmit: true }" @submit="onSubmit" />
|
|
13
|
+
</popover>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import ColorPicker from '../../ColorPicker.vue';
|
|
19
|
+
import Popover from '../../Popover.vue';
|
|
20
|
+
import WithPopover from '../../utils/WithPopover';
|
|
21
|
+
import { useRender } from './mixins';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
components: { ColorPicker, Popover },
|
|
25
|
+
mixins: [useRender(), WithPopover],
|
|
26
|
+
computed: {
|
|
27
|
+
value() {
|
|
28
|
+
return this.tool.getValue();
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
onSubmit({ rgba }) {
|
|
33
|
+
const { r: red, g: green, b: blue, a: alpha } = rgba;
|
|
34
|
+
const color = `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
35
|
+
|
|
36
|
+
this.tool.exec(color);
|
|
37
|
+
this.popoverShow = false;
|
|
38
|
+
this.emitExecuted();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input-autocomplete
|
|
3
|
+
v-bind="{ value, options: tool.options, title, disabled: !isEnabled, size: 'small' }"
|
|
4
|
+
class="autocomplete-tool"
|
|
5
|
+
@input="onInput" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import InputAutocomplete from '../../InputAutocomplete.vue';
|
|
10
|
+
import { useRender } from './mixins';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
components: { InputAutocomplete },
|
|
14
|
+
mixins: [useRender()],
|
|
15
|
+
computed: {
|
|
16
|
+
value() {
|
|
17
|
+
return this.tool.getValue() ?? '';
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
onInput(value) {
|
|
22
|
+
this.tool.exec(value);
|
|
23
|
+
this.emitExecuted();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.autocomplete-tool {
|
|
31
|
+
width: 10rem;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-control form-control-icon-right w-12-12">
|
|
3
|
+
<input-autocomplete
|
|
4
|
+
v-bind="{ value, title, disabled: !isEnabled, size: 'small' }"
|
|
5
|
+
@change="onChange" />
|
|
6
|
+
<div class="icon">
|
|
7
|
+
<i class="mdi mdi-folder cursor-pointer color-grey" @click="browse" />
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import InputAutocomplete from '../../InputAutocomplete.vue';
|
|
14
|
+
import { useRender } from './mixins';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: { InputAutocomplete },
|
|
18
|
+
mixins: [useRender()],
|
|
19
|
+
computed: {
|
|
20
|
+
value() {
|
|
21
|
+
return this.tool.getValue();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
onChange(value) {
|
|
26
|
+
this.tool.exec(value);
|
|
27
|
+
this.emitExecuted();
|
|
28
|
+
},
|
|
29
|
+
async browse() {
|
|
30
|
+
await this.tool.exec();
|
|
31
|
+
this.emitExecuted();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input-units
|
|
3
|
+
v-bind="{ value, units, title, size: 'small', disabled: !isEnabled }"
|
|
4
|
+
class="input-units-tool"
|
|
5
|
+
@change="onChange" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import InputUnits from '../../InputUnits.vue';
|
|
10
|
+
|
|
11
|
+
import { useRender } from './mixins';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
components: { InputUnits },
|
|
15
|
+
mixins: [useRender()],
|
|
16
|
+
computed: {
|
|
17
|
+
value() {
|
|
18
|
+
return this.tool.getValue();
|
|
19
|
+
},
|
|
20
|
+
units() {
|
|
21
|
+
return this.tool?.units ?? [];
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
onChange(value) {
|
|
26
|
+
this.tool.exec(value);
|
|
27
|
+
this.emitExecuted();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.input-units-tool {
|
|
35
|
+
width: 4rem;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-select
|
|
3
|
+
v-bind="{ value, options, valueObjects, title, disabled: !isEnabled, size: 'small' }"
|
|
4
|
+
class="select-tool"
|
|
5
|
+
@change="onChange" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import UiSelect from '../../Select.vue';
|
|
10
|
+
import { useRender } from './mixins';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
components: { UiSelect },
|
|
14
|
+
mixins: [useRender()],
|
|
15
|
+
computed: {
|
|
16
|
+
value() {
|
|
17
|
+
return this.tool.getValue(this.options);
|
|
18
|
+
},
|
|
19
|
+
options() {
|
|
20
|
+
const { options = [] } = this.tool;
|
|
21
|
+
|
|
22
|
+
return options.map((option) => typeof option === 'string'
|
|
23
|
+
? { value: option, label: option }
|
|
24
|
+
: { value: option, label: option.title }
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
valueObjects() {
|
|
28
|
+
const [option] = this.options;
|
|
29
|
+
return typeof option.value === 'object';
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onChange(option) {
|
|
34
|
+
this.tool.exec(this.valueObjects ? option.value : option);
|
|
35
|
+
this.emitExecuted();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.select-tool {
|
|
43
|
+
width: 7.5rem;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :data-popover="popoverTargetId">
|
|
3
|
+
<button
|
|
4
|
+
:title="title"
|
|
5
|
+
class="btn btn-small btn-outline btn-icon"
|
|
6
|
+
@click="togglePopover">
|
|
7
|
+
<div class="icon">
|
|
8
|
+
<i class="mdi" :class="icon"></i>
|
|
9
|
+
</div>
|
|
10
|
+
</button>
|
|
11
|
+
<popover :show.sync="popoverShow" v-bind="popoverOptions">
|
|
12
|
+
<ui-datalist
|
|
13
|
+
class="w-100 pull-left"
|
|
14
|
+
v-bind="{ size: 'small', options: tool.options }"
|
|
15
|
+
@click.native.stop>
|
|
16
|
+
<template #option="{ option, index }">
|
|
17
|
+
<li :key="index" class="list-item" >
|
|
18
|
+
<component :is="option.render" :tool="option" @command-executed="onCommandExecuted" />
|
|
19
|
+
</li>
|
|
20
|
+
</template>
|
|
21
|
+
</ui-datalist>
|
|
22
|
+
</popover>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import Popover from '../../Popover.vue';
|
|
28
|
+
import UiDatalist from '../../Datalist.vue';
|
|
29
|
+
import WithPopover from '../../utils/WithPopover';
|
|
30
|
+
import { useRender } from './mixins';
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
components: { Popover, UiDatalist },
|
|
34
|
+
mixins: [useRender(), WithPopover],
|
|
35
|
+
methods: {
|
|
36
|
+
onCommandExecuted() {
|
|
37
|
+
this.popoverShow = false;
|
|
38
|
+
this.emitExecuted();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
.list-item {
|
|
46
|
+
display: inline-block !important;
|
|
47
|
+
padding: 0.25rem !important;
|
|
48
|
+
min-height: calc(var(--line-height)*1rem);
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
2
|
+
export { default as Select } from './Select.vue';
|
|
3
|
+
export { default as InputUnits } from './InputUnits.vue';
|
|
4
|
+
export { default as ColorPicker } from './ColorPicker.vue';
|
|
5
|
+
export { default as ToolbarPopover } from './ToolbarPopover.vue';
|
|
6
|
+
export { default as InputAuto } from './InputAuto.vue';
|
|
7
|
+
export { default as InputBrowse } from './InputBrowse.vue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Button } from './Button.vue';
|
|
2
|
+
export { default as Select } from './Select.vue';
|
|
3
|
+
export { default as InputUnits } from './InputUnits.vue';
|
|
4
|
+
export { default as ColorPicker } from './ColorPicker.vue';
|
|
5
|
+
export { default as ToolbarPopover } from './ToolbarPopover.vue';
|
|
6
|
+
export { default as InputAuto } from './InputAuto.vue';
|
|
7
|
+
export { default as InputBrowse } from './InputBrowse.vue';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const useRender = () => ({
|
|
2
|
+
props: {
|
|
3
|
+
tool: {
|
|
4
|
+
type: Object,
|
|
5
|
+
default: null
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
computed: {
|
|
9
|
+
icon() {
|
|
10
|
+
const { tool } = this;
|
|
11
|
+
|
|
12
|
+
if (tool == null) {
|
|
13
|
+
return 'mdi-help-box';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return [null, undefined, ''].includes(tool.icon) ? 'mdi-help-box' : `mdi-${tool.icon}`;
|
|
17
|
+
},
|
|
18
|
+
title() {
|
|
19
|
+
const { tool } = this;
|
|
20
|
+
|
|
21
|
+
if (tool == null) {
|
|
22
|
+
return 'Unknown tool';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return tool.title ?? tool.name ?? 'Unknown tool';
|
|
26
|
+
},
|
|
27
|
+
isActive() {
|
|
28
|
+
return this.tool.isActive();
|
|
29
|
+
},
|
|
30
|
+
isEnabled() {
|
|
31
|
+
return this.tool.isEnabled();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
emitExecuted() {
|
|
36
|
+
this.$emit('command-executed');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRender } from './RenderMixin';
|