vuewrite 0.0.10 → 0.0.11
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.js +8 -2
- package/package.json +1 -1
package/dist/vuewrite.js
CHANGED
|
@@ -348,6 +348,12 @@ class TextEditorStore {
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
addNewLine() {
|
|
351
|
+
if (this.isCollapsed && this.selection.anchor.offset === 0) {
|
|
352
|
+
const index2 = this.blocks.findIndex((item) => item.id === this.selection.anchor.blockId);
|
|
353
|
+
const block2 = { id: uid(), text: "", styles: [] };
|
|
354
|
+
this.blocks.splice(index2, 0, block2);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
351
357
|
this.deleteSelected();
|
|
352
358
|
if (!this.currentBlock)
|
|
353
359
|
return;
|
|
@@ -538,7 +544,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
538
544
|
const emit = __emit;
|
|
539
545
|
const slot = computed(() => {
|
|
540
546
|
if (!props.block.type)
|
|
541
|
-
return null;
|
|
547
|
+
return props.slots["default"] ?? null;
|
|
542
548
|
return props.slots[props.block.type] ?? null;
|
|
543
549
|
});
|
|
544
550
|
const blockProps = {
|
|
@@ -707,7 +713,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
707
713
|
for (let i = 0; i < newValue.length; i++) {
|
|
708
714
|
store.blocks[i].text = newValue[i].text;
|
|
709
715
|
store.blocks[i].type = newValue[i].type;
|
|
710
|
-
store.blocks[i].
|
|
716
|
+
store.blocks[i].styles = newValue[i].styles ?? [];
|
|
711
717
|
}
|
|
712
718
|
}
|
|
713
719
|
}, { immediate: true });
|