vuewrite 0.0.5-a → 0.0.6
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/vuewrite.d.ts +12 -4
- package/dist/vuewrite.js +12 -7
- package/package.json +1 -1
package/dist/vuewrite.d.ts
CHANGED
|
@@ -43,8 +43,12 @@ export declare type Style = {
|
|
|
43
43
|
export declare const TextEditor: __VLS_WithTemplateSlots<DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
44
44
|
decorator?: Decorator | undefined;
|
|
45
45
|
single?: boolean | undefined;
|
|
46
|
-
modelValue?: string |
|
|
47
|
-
|
|
46
|
+
modelValue?: string | {
|
|
47
|
+
text: string;
|
|
48
|
+
styles?: Style[] | undefined;
|
|
49
|
+
type?: string | undefined;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
styles?: Style[] | undefined;
|
|
48
52
|
autofocus?: boolean | undefined;
|
|
49
53
|
autoselect?: boolean | undefined;
|
|
50
54
|
}>, {
|
|
@@ -84,8 +88,12 @@ keydown: (...args: any[]) => void;
|
|
|
84
88
|
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
85
89
|
decorator?: Decorator | undefined;
|
|
86
90
|
single?: boolean | undefined;
|
|
87
|
-
modelValue?: string |
|
|
88
|
-
|
|
91
|
+
modelValue?: string | {
|
|
92
|
+
text: string;
|
|
93
|
+
styles?: Style[] | undefined;
|
|
94
|
+
type?: string | undefined;
|
|
95
|
+
}[] | undefined;
|
|
96
|
+
styles?: Style[] | undefined;
|
|
89
97
|
autofocus?: boolean | undefined;
|
|
90
98
|
autoselect?: boolean | undefined;
|
|
91
99
|
}>>> & {
|
package/dist/vuewrite.js
CHANGED
|
@@ -566,7 +566,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
566
566
|
}
|
|
567
567
|
store.blocks.length = newValue.length;
|
|
568
568
|
for (let i = 0; i < newValue.length; i++) {
|
|
569
|
-
store.blocks[i].text = newValue[i];
|
|
569
|
+
store.blocks[i].text = newValue[i].text;
|
|
570
|
+
store.blocks[i].type = newValue[i].type;
|
|
571
|
+
store.blocks[i].text = newValue[i].text;
|
|
570
572
|
}
|
|
571
573
|
}
|
|
572
574
|
}, { immediate: true });
|
|
@@ -577,20 +579,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
577
579
|
for (let i = 0; i < store.blocks.length; i++) {
|
|
578
580
|
if (newStyles.length <= i)
|
|
579
581
|
break;
|
|
580
|
-
|
|
581
|
-
store.blocks[i].styles = style;
|
|
582
|
+
store.blocks[i].styles = newStyles;
|
|
582
583
|
}
|
|
583
584
|
}, { immediate: true });
|
|
584
585
|
watch(() => store.blocks, () => {
|
|
585
586
|
if (props.single) {
|
|
586
587
|
modelValue = store.blocks[0].text;
|
|
587
588
|
styles = store.blocks[0].styles;
|
|
589
|
+
emit("update:styles", styles);
|
|
590
|
+
emit("update:modelValue", modelValue);
|
|
588
591
|
} else {
|
|
589
|
-
modelValue = store.blocks.map((item) =>
|
|
590
|
-
|
|
592
|
+
modelValue = store.blocks.map((item) => ({
|
|
593
|
+
type: item.type,
|
|
594
|
+
text: item.text,
|
|
595
|
+
styles: item.styles.length === 0 ? void 0 : item.styles
|
|
596
|
+
}));
|
|
597
|
+
emit("update:modelValue", modelValue);
|
|
591
598
|
}
|
|
592
|
-
emit("update:modelValue", modelValue);
|
|
593
|
-
emit("update:styles", styles);
|
|
594
599
|
}, { deep: true });
|
|
595
600
|
const onKeyDown = (e) => {
|
|
596
601
|
emit("keydown", e);
|