vuewrite 0.0.12 → 0.0.13
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 +3 -1
- package/dist/vuewrite.js +6 -2
- package/package.json +1 -1
package/dist/vuewrite.d.ts
CHANGED
|
@@ -43,7 +43,9 @@ export declare type Block = {
|
|
|
43
43
|
editable?: boolean;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export declare type Decorator = (style: Style) => HTMLAttributes
|
|
46
|
+
export declare type Decorator = (style: Style) => HTMLAttributes & {
|
|
47
|
+
tag?: string;
|
|
48
|
+
} | undefined;
|
|
47
49
|
|
|
48
50
|
declare type HistoryAction = {
|
|
49
51
|
type: "insertText" | "setText";
|
package/dist/vuewrite.js
CHANGED
|
@@ -553,12 +553,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
553
553
|
const renderBlockPart = (text, styles) => {
|
|
554
554
|
if (!props.decorator)
|
|
555
555
|
return text;
|
|
556
|
+
let elementTag = "span";
|
|
556
557
|
const attrs = {};
|
|
557
558
|
for (let style of styles) {
|
|
558
559
|
const partProps = props.decorator(style);
|
|
559
560
|
if (!partProps)
|
|
560
561
|
continue;
|
|
561
|
-
const { class: _class, style: _style, ...otherProps } = partProps;
|
|
562
|
+
const { class: _class, style: _style, tag, ...otherProps } = partProps;
|
|
562
563
|
Object.assign(attrs, otherProps);
|
|
563
564
|
if (_class) {
|
|
564
565
|
attrs.class = attrs.class ? attrs.class + " " + _class : _class;
|
|
@@ -566,10 +567,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
566
567
|
if (_style) {
|
|
567
568
|
attrs.style = attrs.style ? attrs.style + " " + _style : _style;
|
|
568
569
|
}
|
|
570
|
+
if (tag) {
|
|
571
|
+
elementTag = tag;
|
|
572
|
+
}
|
|
569
573
|
}
|
|
570
574
|
if (Object.keys(attrs).length === 0)
|
|
571
575
|
return text;
|
|
572
|
-
return h(
|
|
576
|
+
return h(elementTag, attrs, text);
|
|
573
577
|
};
|
|
574
578
|
const instance = getCurrentInstance();
|
|
575
579
|
const getRef = () => {
|