vuewrite 0.0.14 → 0.0.15

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.
Files changed (2) hide show
  1. package/dist/vuewrite.js +33 -47
  2. package/package.json +1 -1
package/dist/vuewrite.js CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { getCurrentScope, onScopeDispose, unref, watch, nextTick, reactive, computed, ref, defineComponent, getCurrentInstance, openBlock, createBlock, resolveDynamicComponent, createElementBlock, normalizeProps, mergeProps, h, useSlots, isProxy, toRaw, onMounted, Fragment, renderList, renderSlot, createCommentVNode } from "vue";
7
+ import { getCurrentScope, onScopeDispose, unref, watch, nextTick, reactive, computed, ref, defineComponent, getCurrentInstance, h, useSlots, isProxy, toRaw, onMounted, openBlock, createElementBlock, Fragment, renderList, createBlock, renderSlot, createCommentVNode } from "vue";
8
8
  function tryOnScopeDispose(fn) {
9
9
  if (getCurrentScope()) {
10
10
  onScopeDispose(fn);
@@ -530,19 +530,10 @@ class TextEditorStore {
530
530
  }
531
531
  let uidCounter = 0;
532
532
  const uid = () => (uidCounter++).toString();
533
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
534
- __name: "TextEditorBlock",
535
- props: {
536
- block: {},
537
- slots: {},
538
- static: { type: Boolean },
539
- decorator: { type: Function },
540
- parser: {}
541
- },
533
+ const _sfc_main$2 = defineComponent({
534
+ props: ["block", "slots", "static", "decorator", "parser"],
542
535
  emits: ["postrender"],
543
- setup(__props, { emit: __emit }) {
544
- const props = __props;
545
- const emit = __emit;
536
+ setup(props, { emit }) {
546
537
  const slot = computed(() => {
547
538
  if (!props.block.type)
548
539
  return props.slots["default"] ?? null;
@@ -551,31 +542,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
551
542
  const blockProps = {
552
543
  "data-vw-block-id": props.block.id
553
544
  };
554
- const renderBlockPart = (text, styles) => {
555
- if (!props.decorator)
556
- return text;
557
- let elementTag = "span";
558
- const attrs = {};
559
- for (let style of styles) {
560
- const partProps = props.decorator(style);
561
- if (!partProps)
562
- continue;
563
- const { class: _class, style: _style, tag, ...otherProps } = partProps;
564
- Object.assign(attrs, otherProps);
565
- if (_class) {
566
- attrs.class = attrs.class ? attrs.class + " " + _class : _class;
567
- }
568
- if (_style) {
569
- attrs.style = attrs.style ? attrs.style + " " + _style : _style;
570
- }
571
- if (tag) {
572
- elementTag = tag;
573
- }
574
- }
575
- if (Object.keys(attrs).length === 0)
576
- return text;
577
- return h(elementTag, attrs, text);
578
- };
579
545
  const instance = getCurrentInstance();
580
546
  const getRef = () => {
581
547
  if (!instance)
@@ -674,15 +640,35 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
674
640
  cleanTree(blocks.length);
675
641
  return blocks;
676
642
  };
677
- return (_ctx, _cache) => {
678
- return slot.value ? (openBlock(), createBlock(resolveDynamicComponent(slot.value), {
679
- key: 0,
680
- content,
681
- props: blockProps,
682
- block: _ctx.block
683
- }, null, 8, ["block"])) : (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 1 }, blockProps)), [
684
- (openBlock(), createBlock(resolveDynamicComponent(content)))
685
- ], 16));
643
+ const renderBlockPart = (text, styles) => {
644
+ if (!props.decorator)
645
+ return text;
646
+ let elementTag = "span";
647
+ const attrs = {};
648
+ for (let style of styles) {
649
+ const partProps = props.decorator(style);
650
+ if (!partProps)
651
+ continue;
652
+ const { class: _class, style: _style, tag, ...otherProps } = partProps;
653
+ Object.assign(attrs, otherProps);
654
+ if (_class) {
655
+ attrs.class = attrs.class ? attrs.class + " " + _class : _class;
656
+ }
657
+ if (_style) {
658
+ attrs.style = attrs.style ? attrs.style + " " + _style : _style;
659
+ }
660
+ if (tag) {
661
+ elementTag = tag;
662
+ }
663
+ }
664
+ if (Object.keys(attrs).length === 0)
665
+ return text;
666
+ return h(elementTag, attrs, text);
667
+ };
668
+ return () => {
669
+ if (slot.value)
670
+ return h(slot.value, { content, props: blockProps, block: props.block });
671
+ return h("div", blockProps, [content()]);
686
672
  };
687
673
  }
688
674
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vuewrite",
3
3
  "description": "Rich Text Editor based on Vue3 reactivity",
4
4
  "private": false,
5
- "version": "0.0.14",
5
+ "version": "0.0.15",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "author": "den59k",