@zipify/wysiwyg 3.5.2-ai-prototype → 3.5.4-ai-prototype
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 +23 -22
- package/dist/wysiwyg.mjs +81 -14
- package/lib/components/floatingMenu/FloatingMenuControl.vue +20 -2
- package/lib/components/toolbar/controls/aiComponent/AiControl.vue +9 -3
- package/lib/components/toolbar/controls/aiComponent/AiSettings.vue +76 -60
- package/lib/components/toolbar/controls/aiComponent/AiSuggestionItem.vue +14 -3
- package/package.json +1 -1
package/dist/wysiwyg.css
CHANGED
|
@@ -647,60 +647,61 @@
|
|
|
647
647
|
color: rgb(var(--zw-color-white));
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
.zw-ai-component__suggestion[data-v-
|
|
650
|
+
.zw-ai-component__suggestion[data-v-6652f513] {
|
|
651
651
|
font-size: 14px;
|
|
652
652
|
margin-bottom: 8px;
|
|
653
653
|
padding: 16px 8px;
|
|
654
654
|
color: #CDD1DC;
|
|
655
655
|
border-radius: 2px;
|
|
656
656
|
}
|
|
657
|
-
.zw-ai-component-suggestion__request[data-v-
|
|
657
|
+
.zw-ai-component-suggestion__request[data-v-6652f513] {
|
|
658
658
|
font-size: 12px;
|
|
659
659
|
color: #666;
|
|
660
660
|
}
|
|
661
|
-
.zw-ai-component-suggestion__button[data-v-
|
|
661
|
+
.zw-ai-component-suggestion__button[data-v-6652f513] {
|
|
662
662
|
font-size: 14px;
|
|
663
663
|
padding: 4px 8px;
|
|
664
664
|
background-color: #A4A4A4;
|
|
665
665
|
color: #FFF;
|
|
666
666
|
border-radius: 2px;
|
|
667
|
+
margin-right: 8px;
|
|
667
668
|
}
|
|
668
|
-
.zw-ai-component-suggestion__button[data-v-
|
|
669
|
+
.zw-ai-component-suggestion__button[data-v-6652f513]:hover {
|
|
669
670
|
opacity: 0.8;
|
|
670
671
|
background-color: #3AAA35;
|
|
671
672
|
}
|
|
672
673
|
|
|
673
|
-
.zw-selectors[data-v-
|
|
674
|
+
.zw-selectors[data-v-869120f8] {
|
|
674
675
|
display: flex;
|
|
675
676
|
}
|
|
676
|
-
.zw-ai__dropdown[data-v-
|
|
677
|
+
.zw-ai__dropdown[data-v-869120f8] {
|
|
677
678
|
width: 100%;
|
|
678
679
|
}
|
|
679
680
|
|
|
680
|
-
.zw-suggestion-modal[data-v-
|
|
681
|
+
.zw-suggestion-modal[data-v-e7ed0c94] {
|
|
681
682
|
width: 500px;
|
|
682
683
|
}
|
|
683
|
-
.zw-link-modal__body[data-v-
|
|
684
|
+
.zw-link-modal__body[data-v-e7ed0c94] {
|
|
684
685
|
padding: var(--zw-offset-sm);
|
|
685
686
|
}
|
|
686
|
-
.zw-generated-text__suggestion[data-v-
|
|
687
|
+
.zw-generated-text__suggestion[data-v-e7ed0c94] {
|
|
687
688
|
font-size: 14px;
|
|
688
689
|
color: #908E8E;
|
|
689
690
|
}
|
|
690
|
-
.zw-ai-component__send-button[data-v-
|
|
691
|
+
.zw-ai-component__send-button[data-v-e7ed0c94] {
|
|
691
692
|
position: absolute;
|
|
692
693
|
top: 50%;
|
|
693
694
|
transform: translateY(-50%);
|
|
694
695
|
right: 16px;
|
|
695
696
|
}
|
|
696
|
-
.zw-ai-component__icon[data-v-
|
|
697
|
+
.zw-ai-component__icon[data-v-e7ed0c94] {
|
|
697
698
|
color: #CDD1DC;
|
|
698
699
|
}
|
|
699
|
-
.zw-ai-component__send-button:hover .zw-ai-component__icon[data-v-
|
|
700
|
+
.zw-ai-component__send-button:hover .zw-ai-component__icon[data-v-e7ed0c94] {
|
|
700
701
|
color: #878DA2;
|
|
701
702
|
transition: color 0.1s ease-in-out;
|
|
702
703
|
}
|
|
703
|
-
.zw-field__label[data-v-
|
|
704
|
+
.zw-field__label[data-v-e7ed0c94] {
|
|
704
705
|
display: inline-block;
|
|
705
706
|
font-size: var(--zw-font-size-xxs);
|
|
706
707
|
padding-bottom: var(--zw-offset-xxs);
|
|
@@ -811,27 +812,27 @@
|
|
|
811
812
|
opacity: 0.8;
|
|
812
813
|
}
|
|
813
814
|
|
|
814
|
-
.zw-floating-menu__button[data-v-
|
|
815
|
+
.zw-floating-menu__button[data-v-62b796d5] {
|
|
815
816
|
padding: 2px;
|
|
816
817
|
background-color: rgba(255, 252, 252, 1);
|
|
817
818
|
border-radius: 50%;
|
|
818
819
|
box-shadow: 0 0 0 0 1px #878DA2;
|
|
819
820
|
}
|
|
820
|
-
.zw-link-modal[data-v-
|
|
821
|
+
.zw-link-modal[data-v-62b796d5] {
|
|
821
822
|
width: 450px;
|
|
822
823
|
background-color: #FCFCFC;
|
|
823
824
|
border-radius: 8px;
|
|
824
825
|
box-shadow: 0 0 0 0.5px #878DA2, 0 0 2px 0.5px rgba(135, 141, 162, 0.5), 0 1px 8px 0.5px rgba(135, 141, 162, 0.1), 0 2px 12px 0.5px rgba(135, 141, 162, 0.1), 0 4px 20 0.5px rgba(135, 141, 162, 0.25);
|
|
825
826
|
}
|
|
826
|
-
.zw-link-modal__body[data-v-
|
|
827
|
+
.zw-link-modal__body[data-v-62b796d5] {
|
|
827
828
|
padding: var(--zw-offset-sm);
|
|
828
829
|
}
|
|
829
|
-
.zw-link-form__body[data-v-
|
|
830
|
+
.zw-link-form__body[data-v-62b796d5] {
|
|
830
831
|
overscroll-behavior: contain;
|
|
831
832
|
overflow: auto;
|
|
832
833
|
max-height: max(min(calc(1051.21px - calc(calc(3.5px * 16) + 47.9844px) - calc(0.25px * 16)), calc(34.75px * 16)), calc(10px * 16));
|
|
833
834
|
}
|
|
834
|
-
.zw-ai-component__selected-text[data-v-
|
|
835
|
+
.zw-ai-component__selected-text[data-v-62b796d5] {
|
|
835
836
|
font-size: 14px;
|
|
836
837
|
margin-bottom: 8px;
|
|
837
838
|
padding: 16px 8px;
|
|
@@ -839,7 +840,7 @@
|
|
|
839
840
|
border: 0.5px solid #000;
|
|
840
841
|
border-radius: 2px;
|
|
841
842
|
}
|
|
842
|
-
.zw-ai-component__input[data-v-
|
|
843
|
+
.zw-ai-component__input[data-v-62b796d5] {
|
|
843
844
|
width: 100%;
|
|
844
845
|
min-height: 40px;
|
|
845
846
|
border: 1px solid #E9E9E9;
|
|
@@ -847,16 +848,16 @@
|
|
|
847
848
|
padding: 8px;
|
|
848
849
|
font-size: 14px;
|
|
849
850
|
}
|
|
850
|
-
.zw-ai-component__send-button[data-v-
|
|
851
|
+
.zw-ai-component__send-button[data-v-62b796d5] {
|
|
851
852
|
position: absolute;
|
|
852
853
|
top: 50%;
|
|
853
854
|
transform: translateY(-50%);
|
|
854
855
|
right: 16px;
|
|
855
856
|
}
|
|
856
|
-
.zw-ai-component__icon[data-v-
|
|
857
|
+
.zw-ai-component__icon[data-v-62b796d5] {
|
|
857
858
|
color: #CDD1DC;
|
|
858
859
|
}
|
|
859
|
-
.zw-ai-component__send-button:hover .zw-ai-component__icon[data-v-
|
|
860
|
+
.zw-ai-component__send-button:hover .zw-ai-component__icon[data-v-62b796d5] {
|
|
860
861
|
color: #878DA2;
|
|
861
862
|
transition: color 0.1s ease-in-out;
|
|
862
863
|
}
|
package/dist/wysiwyg.mjs
CHANGED
|
@@ -27774,10 +27774,40 @@ var render$e = function __render__38() {
|
|
|
27774
27774
|
},
|
|
27775
27775
|
on: {
|
|
27776
27776
|
"click": function click($event) {
|
|
27777
|
-
return _vm.sendAction("Rewrite text");
|
|
27777
|
+
return _vm.sendAction($event, "Rewrite text");
|
|
27778
27778
|
}
|
|
27779
27779
|
}
|
|
27780
|
-
}, [_vm._v("
|
|
27780
|
+
}, [_vm._v(" Rewrite ")]) : _vm._e(), !_vm.isLoading ? _c("Button", {
|
|
27781
|
+
staticClass: "zw-ai-component-suggestion__button",
|
|
27782
|
+
attrs: {
|
|
27783
|
+
"type": "button"
|
|
27784
|
+
},
|
|
27785
|
+
on: {
|
|
27786
|
+
"click": function click($event) {
|
|
27787
|
+
return _vm.sendAction($event, "Simplify it");
|
|
27788
|
+
}
|
|
27789
|
+
}
|
|
27790
|
+
}, [_vm._v(" Simplify it ")]) : _vm._e(), !_vm.isLoading ? _c("Button", {
|
|
27791
|
+
staticClass: "zw-ai-component-suggestion__button",
|
|
27792
|
+
attrs: {
|
|
27793
|
+
"type": "button"
|
|
27794
|
+
},
|
|
27795
|
+
on: {
|
|
27796
|
+
"click": function click($event) {
|
|
27797
|
+
return _vm.sendAction($event, "Shorten it");
|
|
27798
|
+
}
|
|
27799
|
+
}
|
|
27800
|
+
}, [_vm._v(" Shorten it ")]) : _vm._e(), !_vm.isLoading ? _c("Button", {
|
|
27801
|
+
staticClass: "zw-ai-component-suggestion__button",
|
|
27802
|
+
attrs: {
|
|
27803
|
+
"type": "button"
|
|
27804
|
+
},
|
|
27805
|
+
on: {
|
|
27806
|
+
"click": function click($event) {
|
|
27807
|
+
return _vm.sendAction($event, "Make it exciting");
|
|
27808
|
+
}
|
|
27809
|
+
}
|
|
27810
|
+
}, [_vm._v(" Make it exciting ")]) : _vm._e()], 1);
|
|
27781
27811
|
};
|
|
27782
27812
|
var staticRenderFns$e = [];
|
|
27783
27813
|
const AiSuggestionItem_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
@@ -27794,7 +27824,8 @@ const __vue2_script$e = {
|
|
|
27794
27824
|
},
|
|
27795
27825
|
setup(props, { emit }) {
|
|
27796
27826
|
const isLoading = computed(() => props.suggestion.state === "loading");
|
|
27797
|
-
const sendAction = (action) => {
|
|
27827
|
+
const sendAction = (event, action) => {
|
|
27828
|
+
event.stopPropagation();
|
|
27798
27829
|
emit("action", action);
|
|
27799
27830
|
};
|
|
27800
27831
|
return {
|
|
@@ -27810,7 +27841,7 @@ var __component__$e = /* @__PURE__ */ normalizeComponent(
|
|
|
27810
27841
|
staticRenderFns$e,
|
|
27811
27842
|
false,
|
|
27812
27843
|
__vue2_injectStyles$e,
|
|
27813
|
-
"
|
|
27844
|
+
"6652f513",
|
|
27814
27845
|
null,
|
|
27815
27846
|
null
|
|
27816
27847
|
);
|
|
@@ -27826,7 +27857,7 @@ var render$d = function __render__39() {
|
|
|
27826
27857
|
var _vm = this;
|
|
27827
27858
|
var _h = _vm.$createElement;
|
|
27828
27859
|
var _c = _vm._self._c || _h;
|
|
27829
|
-
return _c("div", {
|
|
27860
|
+
return _c("div", [_c("h4", [_vm._v("Settings")]), _c("div", {
|
|
27830
27861
|
staticClass: "zw-selectors"
|
|
27831
27862
|
}, [_c("div", {
|
|
27832
27863
|
staticClass: "zw-ai__dropdown zw-margin-right--xs"
|
|
@@ -27906,7 +27937,16 @@ var render$d = function __render__39() {
|
|
|
27906
27937
|
})];
|
|
27907
27938
|
}
|
|
27908
27939
|
}])
|
|
27909
|
-
})], 1)])
|
|
27940
|
+
})], 1)]), _c("Checkbox", {
|
|
27941
|
+
staticClass: "zw-margin-bottom--sm",
|
|
27942
|
+
attrs: {
|
|
27943
|
+
"label": "Use block context",
|
|
27944
|
+
"value": _vm.settings.useBlockContext
|
|
27945
|
+
},
|
|
27946
|
+
on: {
|
|
27947
|
+
"input": _vm.changUseBlockContext
|
|
27948
|
+
}
|
|
27949
|
+
})], 1);
|
|
27910
27950
|
};
|
|
27911
27951
|
var staticRenderFns$d = [];
|
|
27912
27952
|
const AiSettings_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
@@ -27915,7 +27955,8 @@ const __vue2_script$d = {
|
|
|
27915
27955
|
components: {
|
|
27916
27956
|
FieldLabel,
|
|
27917
27957
|
Dropdown,
|
|
27918
|
-
DropdownOption
|
|
27958
|
+
DropdownOption,
|
|
27959
|
+
Checkbox
|
|
27919
27960
|
},
|
|
27920
27961
|
props: {
|
|
27921
27962
|
value: {
|
|
@@ -27928,7 +27969,8 @@ const __vue2_script$d = {
|
|
|
27928
27969
|
return {
|
|
27929
27970
|
tone: props.value.tone,
|
|
27930
27971
|
textStyle: props.value.textStyle,
|
|
27931
|
-
textLength: props.value.textLength
|
|
27972
|
+
textLength: props.value.textLength,
|
|
27973
|
+
useBlockContext: props.value.useBlockContext
|
|
27932
27974
|
};
|
|
27933
27975
|
});
|
|
27934
27976
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
@@ -27947,6 +27989,10 @@ const __vue2_script$d = {
|
|
|
27947
27989
|
settings.value.textLength = value;
|
|
27948
27990
|
emit("input", settings.value);
|
|
27949
27991
|
};
|
|
27992
|
+
const changUseBlockContext = (value) => {
|
|
27993
|
+
settings.value.useBlockContext = value;
|
|
27994
|
+
emit("input", settings.value);
|
|
27995
|
+
};
|
|
27950
27996
|
return {
|
|
27951
27997
|
tones,
|
|
27952
27998
|
textStyles,
|
|
@@ -27954,6 +28000,7 @@ const __vue2_script$d = {
|
|
|
27954
28000
|
changeTone,
|
|
27955
28001
|
changeTextStyle,
|
|
27956
28002
|
changeTextLength,
|
|
28003
|
+
changUseBlockContext,
|
|
27957
28004
|
settings
|
|
27958
28005
|
};
|
|
27959
28006
|
}
|
|
@@ -27965,7 +28012,7 @@ var __component__$d = /* @__PURE__ */ normalizeComponent(
|
|
|
27965
28012
|
staticRenderFns$d,
|
|
27966
28013
|
false,
|
|
27967
28014
|
__vue2_injectStyles$d,
|
|
27968
|
-
"
|
|
28015
|
+
"869120f8",
|
|
27969
28016
|
null,
|
|
27970
28017
|
null
|
|
27971
28018
|
);
|
|
@@ -28029,6 +28076,9 @@ var render$c = function __render__40() {
|
|
|
28029
28076
|
}) : _vm.lastSuggestions ? _c("AiSuggestionItem", {
|
|
28030
28077
|
attrs: {
|
|
28031
28078
|
"suggestion": _vm.lastSuggestions
|
|
28079
|
+
},
|
|
28080
|
+
on: {
|
|
28081
|
+
"action": _vm.onAction
|
|
28032
28082
|
}
|
|
28033
28083
|
}) : _vm._e(), _c("label", {
|
|
28034
28084
|
staticClass: "zw-field__label"
|
|
@@ -28099,7 +28149,8 @@ const __vue2_script$c = {
|
|
|
28099
28149
|
const settings = ref({
|
|
28100
28150
|
tone: "",
|
|
28101
28151
|
textLength: "500",
|
|
28102
|
-
textStyle: ""
|
|
28152
|
+
textStyle: "",
|
|
28153
|
+
useBlockContext: false
|
|
28103
28154
|
});
|
|
28104
28155
|
if (localStorage.getItem("ai-settings")) {
|
|
28105
28156
|
settings.value = JSON.parse(localStorage.getItem("ai-settings"));
|
|
@@ -28147,7 +28198,8 @@ const __vue2_script$c = {
|
|
|
28147
28198
|
suggestions.value.push(result);
|
|
28148
28199
|
};
|
|
28149
28200
|
const applyText = () => {
|
|
28150
|
-
editor.commands.
|
|
28201
|
+
editor.commands.clearContent(true);
|
|
28202
|
+
editor.commands.insertContent(lastSuggestions.value.content);
|
|
28151
28203
|
toggler.close();
|
|
28152
28204
|
suggestions.value = [];
|
|
28153
28205
|
prompt.value = "";
|
|
@@ -28176,7 +28228,7 @@ var __component__$c = /* @__PURE__ */ normalizeComponent(
|
|
|
28176
28228
|
staticRenderFns$c,
|
|
28177
28229
|
false,
|
|
28178
28230
|
__vue2_injectStyles$c,
|
|
28179
|
-
"
|
|
28231
|
+
"e7ed0c94",
|
|
28180
28232
|
null,
|
|
28181
28233
|
null
|
|
28182
28234
|
);
|
|
@@ -29385,6 +29437,17 @@ const __vue2_script$1 = {
|
|
|
29385
29437
|
const prompt = ref("");
|
|
29386
29438
|
const isLoading = ref(false);
|
|
29387
29439
|
const selectedText = computed(() => editor.commands.getSelectedText());
|
|
29440
|
+
const settings = ref({
|
|
29441
|
+
tone: "",
|
|
29442
|
+
textLength: "500",
|
|
29443
|
+
textStyle: ""
|
|
29444
|
+
});
|
|
29445
|
+
if (localStorage.getItem("ai-settings")) {
|
|
29446
|
+
settings.value = JSON.parse(localStorage.getItem("ai-settings"));
|
|
29447
|
+
}
|
|
29448
|
+
watch(settings, () => {
|
|
29449
|
+
localStorage.setItem("ai-settings", JSON.stringify(settings.value));
|
|
29450
|
+
});
|
|
29388
29451
|
const iconName = computed(() => {
|
|
29389
29452
|
return unref(isLoading) ? "loading" : "send";
|
|
29390
29453
|
});
|
|
@@ -29406,7 +29469,11 @@ const __vue2_script$1 = {
|
|
|
29406
29469
|
isLoading.value = true;
|
|
29407
29470
|
const lastSuggestions = suggestions.value[suggestions.value.length - 1];
|
|
29408
29471
|
const context = lastSuggestions ? lastSuggestions.content : selectedText.value;
|
|
29409
|
-
const result = await editor.commands.generateText({
|
|
29472
|
+
const result = await editor.commands.generateText({
|
|
29473
|
+
prompt: prompt.value,
|
|
29474
|
+
instructions: unref(settings),
|
|
29475
|
+
context
|
|
29476
|
+
});
|
|
29410
29477
|
isLoading.value = false;
|
|
29411
29478
|
suggestions.value.push(result);
|
|
29412
29479
|
};
|
|
@@ -29439,7 +29506,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
|
29439
29506
|
staticRenderFns$1,
|
|
29440
29507
|
false,
|
|
29441
29508
|
__vue2_injectStyles$1,
|
|
29442
|
-
"
|
|
29509
|
+
"62b796d5",
|
|
29443
29510
|
null,
|
|
29444
29511
|
null
|
|
29445
29512
|
);
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script>
|
|
53
|
-
import { inject, ref, unref, computed } from 'vue';
|
|
53
|
+
import { inject, ref, unref, computed, watch } from 'vue';
|
|
54
54
|
import { FloatingMenu } from '@tiptap/vue-2';
|
|
55
55
|
import { Button, Icon, Modal, useModalToggler } from '../base';
|
|
56
56
|
import { InjectionTokens } from '../../injectionTokens';
|
|
@@ -83,6 +83,20 @@ export default {
|
|
|
83
83
|
|
|
84
84
|
const selectedText = computed(() => editor.commands.getSelectedText());
|
|
85
85
|
|
|
86
|
+
const settings = ref({
|
|
87
|
+
tone: '',
|
|
88
|
+
textLength: '500',
|
|
89
|
+
textStyle: ''
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (localStorage.getItem('ai-settings')) {
|
|
93
|
+
settings.value = JSON.parse(localStorage.getItem('ai-settings'));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
watch(settings, () => {
|
|
97
|
+
localStorage.setItem('ai-settings', JSON.stringify(settings.value));
|
|
98
|
+
});
|
|
99
|
+
|
|
86
100
|
const iconName = computed(() => {
|
|
87
101
|
return unref(isLoading) ? 'loading' : 'send';
|
|
88
102
|
});
|
|
@@ -111,7 +125,11 @@ export default {
|
|
|
111
125
|
|
|
112
126
|
const context = lastSuggestions ? lastSuggestions.content : selectedText.value;
|
|
113
127
|
|
|
114
|
-
const result = await editor.commands.generateText({
|
|
128
|
+
const result = await editor.commands.generateText({
|
|
129
|
+
prompt: prompt.value,
|
|
130
|
+
instructions: unref(settings),
|
|
131
|
+
context
|
|
132
|
+
});
|
|
115
133
|
|
|
116
134
|
isLoading.value = false;
|
|
117
135
|
suggestions.value.push(result);
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
<Icon v-if="isLoading" auto-color class="zw-ai-component__icon" name="loading" size="32px" />
|
|
12
12
|
|
|
13
|
-
<AiSuggestionItem
|
|
13
|
+
<AiSuggestionItem
|
|
14
|
+
v-else-if="lastSuggestions"
|
|
15
|
+
:suggestion="lastSuggestions"
|
|
16
|
+
@action="onAction"
|
|
17
|
+
/>
|
|
14
18
|
|
|
15
19
|
<label class="zw-field__label">
|
|
16
20
|
{{ textAreaLabel }}
|
|
@@ -70,7 +74,8 @@ export default {
|
|
|
70
74
|
const settings = ref({
|
|
71
75
|
tone: '',
|
|
72
76
|
textLength: '500',
|
|
73
|
-
textStyle: ''
|
|
77
|
+
textStyle: '',
|
|
78
|
+
useBlockContext: false
|
|
74
79
|
});
|
|
75
80
|
|
|
76
81
|
if (localStorage.getItem('ai-settings')) {
|
|
@@ -133,7 +138,8 @@ export default {
|
|
|
133
138
|
};
|
|
134
139
|
|
|
135
140
|
const applyText = () => {
|
|
136
|
-
editor.commands.
|
|
141
|
+
editor.commands.clearContent(true);
|
|
142
|
+
editor.commands.insertContent(lastSuggestions.value.content);
|
|
137
143
|
toggler.close();
|
|
138
144
|
suggestions.value = [];
|
|
139
145
|
prompt.value = '';
|
|
@@ -1,73 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<h4>Settings</h4>
|
|
4
|
+
<div class="zw-selectors ">
|
|
5
|
+
<div class="zw-ai__dropdown zw-margin-right--xs">
|
|
6
|
+
<FieldLabel class="zw-margin-bottom--xxs">
|
|
7
|
+
Tone
|
|
8
|
+
</FieldLabel>
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
<Dropdown
|
|
11
|
+
class="zw-margin-bottom--sm"
|
|
12
|
+
color="gray"
|
|
13
|
+
:value="settings.tone"
|
|
14
|
+
:options="tones"
|
|
15
|
+
@change="changeTone"
|
|
16
|
+
>
|
|
17
|
+
<template #option="{ option }">
|
|
18
|
+
<DropdownOption
|
|
19
|
+
class="zw-link-modal-dropdown__option"
|
|
20
|
+
:option="option"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
</Dropdown>
|
|
24
|
+
</div>
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
<div class="zw-ai__dropdown zw-margin-right--xs ">
|
|
27
|
+
<FieldLabel class="zw-margin-bottom--xxs">
|
|
28
|
+
Text Style
|
|
29
|
+
</FieldLabel>
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
<Dropdown
|
|
32
|
+
class="zw-margin-bottom--sm"
|
|
33
|
+
color="gray"
|
|
34
|
+
:value="settings.textStyle"
|
|
35
|
+
:options="textStyles"
|
|
36
|
+
@change="changeTextStyle"
|
|
37
|
+
>
|
|
38
|
+
<template #option="{ option }">
|
|
39
|
+
<DropdownOption
|
|
40
|
+
class="zw-link-modal-dropdown__option"
|
|
41
|
+
:option="option"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
</Dropdown>
|
|
45
|
+
</div>
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
<div class="zw-ai__dropdown">
|
|
48
|
+
<FieldLabel class="zw-margin-bottom--xxs">
|
|
49
|
+
Length
|
|
50
|
+
</FieldLabel>
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
<Dropdown
|
|
53
|
+
class="zw-margin-bottom--sm"
|
|
54
|
+
color="gray"
|
|
55
|
+
:value="settings.textLength"
|
|
56
|
+
:options="textLength"
|
|
57
|
+
@change="changeTextLength"
|
|
58
|
+
>
|
|
59
|
+
<template #option="{ option }">
|
|
60
|
+
<DropdownOption
|
|
61
|
+
class="zw-link-modal-dropdown__option"
|
|
62
|
+
:option="option"
|
|
63
|
+
/>
|
|
64
|
+
</template>
|
|
65
|
+
</Dropdown>
|
|
66
|
+
</div>
|
|
64
67
|
</div>
|
|
68
|
+
<Checkbox
|
|
69
|
+
class="zw-margin-bottom--sm"
|
|
70
|
+
label="Use block context"
|
|
71
|
+
:value="settings.useBlockContext"
|
|
72
|
+
@input="changUseBlockContext"
|
|
73
|
+
/>
|
|
65
74
|
</div>
|
|
66
75
|
</template>
|
|
67
76
|
|
|
68
77
|
<script>
|
|
69
78
|
import { computed, inject } from 'vue';
|
|
70
|
-
import { FieldLabel, Dropdown, DropdownOption } from '../../../base';
|
|
79
|
+
import { FieldLabel, Dropdown, DropdownOption, Checkbox } from '../../../base';
|
|
71
80
|
import { InjectionTokens } from '../../../../injectionTokens';
|
|
72
81
|
|
|
73
82
|
export default {
|
|
@@ -76,7 +85,8 @@ export default {
|
|
|
76
85
|
components: {
|
|
77
86
|
FieldLabel,
|
|
78
87
|
Dropdown,
|
|
79
|
-
DropdownOption
|
|
88
|
+
DropdownOption,
|
|
89
|
+
Checkbox
|
|
80
90
|
},
|
|
81
91
|
|
|
82
92
|
props: {
|
|
@@ -91,7 +101,8 @@ export default {
|
|
|
91
101
|
return {
|
|
92
102
|
tone: props.value.tone,
|
|
93
103
|
textStyle: props.value.textStyle,
|
|
94
|
-
textLength: props.value.textLength
|
|
104
|
+
textLength: props.value.textLength,
|
|
105
|
+
useBlockContext: props.value.useBlockContext
|
|
95
106
|
};
|
|
96
107
|
});
|
|
97
108
|
|
|
@@ -112,6 +123,10 @@ export default {
|
|
|
112
123
|
settings.value.textLength = value;
|
|
113
124
|
emit('input', settings.value);
|
|
114
125
|
};
|
|
126
|
+
const changUseBlockContext = (value) => {
|
|
127
|
+
settings.value.useBlockContext = value;
|
|
128
|
+
emit('input', settings.value);
|
|
129
|
+
};
|
|
115
130
|
|
|
116
131
|
return {
|
|
117
132
|
tones,
|
|
@@ -120,6 +135,7 @@ export default {
|
|
|
120
135
|
changeTone,
|
|
121
136
|
changeTextStyle,
|
|
122
137
|
changeTextLength,
|
|
138
|
+
changUseBlockContext,
|
|
123
139
|
settings
|
|
124
140
|
};
|
|
125
141
|
}
|
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
<p :class="{'zw-margin-bottom--sm': !isLoading }" v-html="suggestion.content" />
|
|
7
7
|
|
|
8
|
-
<Button type="button" v-if="!isLoading" @click="sendAction('Rewrite text')" class="zw-ai-component-suggestion__button">
|
|
9
|
-
|
|
8
|
+
<Button type="button" v-if="!isLoading" @click="sendAction($event, 'Rewrite text')" class="zw-ai-component-suggestion__button">
|
|
9
|
+
Rewrite
|
|
10
|
+
</Button>
|
|
11
|
+
<Button type="button" v-if="!isLoading" @click="sendAction($event, 'Simplify it')" class="zw-ai-component-suggestion__button">
|
|
12
|
+
Simplify it
|
|
13
|
+
</Button>
|
|
14
|
+
<Button type="button" v-if="!isLoading" @click="sendAction($event, 'Shorten it')" class="zw-ai-component-suggestion__button">
|
|
15
|
+
Shorten it
|
|
16
|
+
</Button>
|
|
17
|
+
<Button type="button" v-if="!isLoading" @click="sendAction($event, 'Make it exciting')" class="zw-ai-component-suggestion__button">
|
|
18
|
+
Make it exciting
|
|
10
19
|
</Button>
|
|
11
20
|
</div>
|
|
12
21
|
</template>
|
|
@@ -32,7 +41,8 @@ export default {
|
|
|
32
41
|
setup(props, { emit }) {
|
|
33
42
|
const isLoading = computed(() => props.suggestion.state === 'loading');
|
|
34
43
|
|
|
35
|
-
const sendAction = (action) => {
|
|
44
|
+
const sendAction = (event, action) => {
|
|
45
|
+
event.stopPropagation();
|
|
36
46
|
emit('action', action);
|
|
37
47
|
};
|
|
38
48
|
|
|
@@ -64,6 +74,7 @@ export default {
|
|
|
64
74
|
background-color: #A4A4A4;
|
|
65
75
|
color: #FFF;
|
|
66
76
|
border-radius: 2px;
|
|
77
|
+
margin-right: 8px;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
.zw-ai-component-suggestion__button:hover {
|