@zipify/wysiwyg 3.4.2 → 3.5.0-1
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/dist/cli.js +1 -1
- package/dist/wysiwyg.css +15 -10
- package/dist/wysiwyg.mjs +658 -530
- package/example/AiComponent.vue +27 -0
- package/example/ExampleApp.vue +5 -1
- package/lib/Wysiwyg.vue +7 -0
- package/lib/assets/icons/sparkles.svg +3 -0
- package/lib/components/toolbar/Toolbar.vue +7 -1
- package/lib/components/toolbar/controls/AiControl.vue +75 -0
- package/lib/components/toolbar/controls/index.js +1 -0
- package/lib/components/toolbar/layouts/ToolbarDesktop.vue +18 -2
- package/package.json +6 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :toggler="toggler" focus-first-control>
|
|
3
|
+
Modal content
|
|
4
|
+
</Modal>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { Modal } from '../lib/components/base';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'AiComponent',
|
|
12
|
+
|
|
13
|
+
components: {
|
|
14
|
+
Modal
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
editor: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
toggler: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
</script>
|
package/example/ExampleApp.vue
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
:page-blocks="pageBlocks"
|
|
43
43
|
:active="isActive"
|
|
44
44
|
:readonly="isReadonly"
|
|
45
|
+
:ai-component="aiComponent"
|
|
45
46
|
@update-favorite-colors="updateFavoriteColors"
|
|
46
47
|
/>
|
|
47
48
|
<pre class="zw-content-structure" v-html="structurePreview" />
|
|
@@ -54,6 +55,7 @@ import { Wysiwyg } from '../lib/entryLib';
|
|
|
54
55
|
import { FONTS } from './fonts';
|
|
55
56
|
import { PRESETS, renderPresetVariable } from './presets';
|
|
56
57
|
import { PAGE_BLOCKS } from './pageBlocks';
|
|
58
|
+
import AiComponent from './AiComponent';
|
|
57
59
|
|
|
58
60
|
function getInitialContent() {
|
|
59
61
|
const data = sessionStorage.getItem('wswg-data');
|
|
@@ -75,6 +77,7 @@ export default {
|
|
|
75
77
|
},
|
|
76
78
|
|
|
77
79
|
setup() {
|
|
80
|
+
const aiComponent = ref(AiComponent);
|
|
78
81
|
const wswgRef = ref(null);
|
|
79
82
|
const content = ref(getInitialContent());
|
|
80
83
|
const presets = ref(PRESETS);
|
|
@@ -135,7 +138,8 @@ export default {
|
|
|
135
138
|
presets,
|
|
136
139
|
isActive,
|
|
137
140
|
pageBlocks,
|
|
138
|
-
isReadonly
|
|
141
|
+
isReadonly,
|
|
142
|
+
aiComponent
|
|
139
143
|
};
|
|
140
144
|
}
|
|
141
145
|
};
|
package/lib/Wysiwyg.vue
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:toolbar="toolbar"
|
|
5
5
|
:device="device"
|
|
6
6
|
:popup-mode="popupMode"
|
|
7
|
+
:ai-component="aiComponent"
|
|
7
8
|
ref="toolbarRef"
|
|
8
9
|
/>
|
|
9
10
|
|
|
@@ -132,6 +133,12 @@ export default {
|
|
|
132
133
|
window: {
|
|
133
134
|
required: false,
|
|
134
135
|
default: () => window
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
aiComponent: {
|
|
139
|
+
type: Object,
|
|
140
|
+
required: false,
|
|
141
|
+
default: null
|
|
135
142
|
}
|
|
136
143
|
},
|
|
137
144
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 20 20">
|
|
2
|
+
<path fill="#FFBA00" d="m13.8 4-.7 1.5-1.5.7 1.5.7.7 1.5.7-1.5 1.5-.7-1.5-.7m-6.1.1L7 8.6 4 10l3 1.4 1.4 3 1.3-3 3-1.4-3-1.4m4.1 3-.7 1.5-1.5.7 1.5.7.7 1.5.7-1.5 1.5-.7-1.5-.7"/>
|
|
3
|
+
</svg>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<keep-alive>
|
|
3
3
|
<transition name="zw-toolbar-" duration="150">
|
|
4
4
|
<div class="zw-toolbar" :style="toolbarStyles" ref="toolbarRef" v-if="isVisible">
|
|
5
|
-
<component :is="layoutComponent" />
|
|
5
|
+
<component :is="layoutComponent" :ai-component="aiComponent" />
|
|
6
6
|
</div>
|
|
7
7
|
</transition>
|
|
8
8
|
</keep-alive>
|
|
@@ -30,6 +30,12 @@ export default {
|
|
|
30
30
|
popupMode: {
|
|
31
31
|
type: Boolean,
|
|
32
32
|
required: true
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
aiComponent: {
|
|
36
|
+
type: Object,
|
|
37
|
+
required: false,
|
|
38
|
+
default: null
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="wrapperRef">
|
|
3
|
+
<Button icon skin="toolbar" :active="isActive" @click="toggler.open" v-tooltip.lg="'Zipify AI is in Beta. Please check your text for inaccuracies'">
|
|
4
|
+
<Icon name="sparkles" size="28px" />
|
|
5
|
+
<span class="zw-ai-control__caption">AI</span>
|
|
6
|
+
</Button>
|
|
7
|
+
|
|
8
|
+
<component
|
|
9
|
+
:is="aiComponent"
|
|
10
|
+
:ref="modalRef"
|
|
11
|
+
:editor="editor"
|
|
12
|
+
:toggler="toggler"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { inject, ref, unref, computed } from 'vue';
|
|
19
|
+
import { Button, Icon, useModalToggler } from '../../base';
|
|
20
|
+
import { InjectionTokens } from '../../../injectionTokens';
|
|
21
|
+
import { tooltip } from '../../../directives';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'AiControl',
|
|
25
|
+
|
|
26
|
+
components: {
|
|
27
|
+
Button,
|
|
28
|
+
Icon
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
directives: {
|
|
32
|
+
tooltip
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
props: {
|
|
36
|
+
aiComponent: {
|
|
37
|
+
type: Object,
|
|
38
|
+
required: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
setup() {
|
|
43
|
+
const editor = inject(InjectionTokens.EDITOR);
|
|
44
|
+
const wrapperRef = ref(null);
|
|
45
|
+
const modalRef = ref(null);
|
|
46
|
+
|
|
47
|
+
const onBeforeOpened = () => {};
|
|
48
|
+
|
|
49
|
+
const toggler = useModalToggler({
|
|
50
|
+
onBeforeOpened: () => onBeforeOpened(),
|
|
51
|
+
wrapperRef,
|
|
52
|
+
modalRef
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const isActive = computed(() => unref(toggler.isOpened));
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
editor,
|
|
59
|
+
wrapperRef,
|
|
60
|
+
modalRef,
|
|
61
|
+
toggler,
|
|
62
|
+
isActive
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<style scoped>
|
|
70
|
+
.zw-ai-control__caption {
|
|
71
|
+
padding-left: var(--zw-offset-xxs);
|
|
72
|
+
padding-right: var(--zw-offset-xs);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
|
|
@@ -14,3 +14,4 @@ export { default as LineHeightControl } from './LineHeightControl';
|
|
|
14
14
|
export { default as ListControl } from './ListControl';
|
|
15
15
|
export { default as RemoveFormatControl } from './RemoveFormatControl';
|
|
16
16
|
export { LinkControl } from './link';
|
|
17
|
+
export { default as AiControl } from './AiControl';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<ToolbarRow>
|
|
4
|
+
<template v-if="aiComponent">
|
|
5
|
+
<AiControl
|
|
6
|
+
:ai-component="aiComponent"
|
|
7
|
+
/>
|
|
8
|
+
<ToolbarDivider vertical />
|
|
9
|
+
</template>
|
|
4
10
|
<StylePresetControl />
|
|
5
11
|
<ToolbarDivider vertical />
|
|
6
12
|
<FontFamilyControl />
|
|
@@ -64,7 +70,8 @@ import {
|
|
|
64
70
|
UnderlineControl,
|
|
65
71
|
ListControl,
|
|
66
72
|
RemoveFormatControl,
|
|
67
|
-
LinkControl
|
|
73
|
+
LinkControl,
|
|
74
|
+
AiControl
|
|
68
75
|
} from '../controls';
|
|
69
76
|
|
|
70
77
|
export default {
|
|
@@ -89,7 +96,16 @@ export default {
|
|
|
89
96
|
LineHeightControl,
|
|
90
97
|
ListControl,
|
|
91
98
|
RemoveFormatControl,
|
|
92
|
-
LinkControl
|
|
99
|
+
LinkControl,
|
|
100
|
+
AiControl
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
props: {
|
|
104
|
+
aiComponent: {
|
|
105
|
+
type: Object,
|
|
106
|
+
required: false,
|
|
107
|
+
default: null
|
|
108
|
+
}
|
|
93
109
|
}
|
|
94
110
|
};
|
|
95
111
|
</script>
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-1",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "dist/wysiwyg.mjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/wysiwyg.mjs",
|
|
8
|
+
"./dist/*": "./dist/*",
|
|
9
|
+
"./components": "./lib/components/base/index.js"
|
|
10
|
+
},
|
|
6
11
|
"bin": {
|
|
7
12
|
"zipify-wysiwyg": "bin/cli"
|
|
8
13
|
},
|