vuewrite 0.0.12 → 0.0.14
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 +5 -1
- package/dist/vuewrite.js +13 -4
- 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";
|
|
@@ -249,6 +251,7 @@ type?: string;
|
|
|
249
251
|
decorator?: Decorator | undefined;
|
|
250
252
|
parser?: TextParser | undefined;
|
|
251
253
|
styles?: Style[] | undefined;
|
|
254
|
+
preventMultiline?: boolean | undefined;
|
|
252
255
|
}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_TypePropsToRuntimeProps_2<{
|
|
253
256
|
modelValue: {
|
|
254
257
|
text: string;
|
|
@@ -258,6 +261,7 @@ type?: string;
|
|
|
258
261
|
decorator?: Decorator | undefined;
|
|
259
262
|
parser?: TextParser | undefined;
|
|
260
263
|
styles?: Style[] | undefined;
|
|
264
|
+
preventMultiline?: boolean | undefined;
|
|
261
265
|
}>>>, {}, {}>;
|
|
262
266
|
|
|
263
267
|
declare type TextParser = (text: string) => Style[];
|
package/dist/vuewrite.js
CHANGED
|
@@ -535,6 +535,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
535
535
|
props: {
|
|
536
536
|
block: {},
|
|
537
537
|
slots: {},
|
|
538
|
+
static: { type: Boolean },
|
|
538
539
|
decorator: { type: Function },
|
|
539
540
|
parser: {}
|
|
540
541
|
},
|
|
@@ -553,12 +554,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
553
554
|
const renderBlockPart = (text, styles) => {
|
|
554
555
|
if (!props.decorator)
|
|
555
556
|
return text;
|
|
557
|
+
let elementTag = "span";
|
|
556
558
|
const attrs = {};
|
|
557
559
|
for (let style of styles) {
|
|
558
560
|
const partProps = props.decorator(style);
|
|
559
561
|
if (!partProps)
|
|
560
562
|
continue;
|
|
561
|
-
const { class: _class, style: _style, ...otherProps } = partProps;
|
|
563
|
+
const { class: _class, style: _style, tag, ...otherProps } = partProps;
|
|
562
564
|
Object.assign(attrs, otherProps);
|
|
563
565
|
if (_class) {
|
|
564
566
|
attrs.class = attrs.class ? attrs.class + " " + _class : _class;
|
|
@@ -566,10 +568,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
566
568
|
if (_style) {
|
|
567
569
|
attrs.style = attrs.style ? attrs.style + " " + _style : _style;
|
|
568
570
|
}
|
|
571
|
+
if (tag) {
|
|
572
|
+
elementTag = tag;
|
|
573
|
+
}
|
|
569
574
|
}
|
|
570
575
|
if (Object.keys(attrs).length === 0)
|
|
571
576
|
return text;
|
|
572
|
-
return h(
|
|
577
|
+
return h(elementTag, attrs, text);
|
|
573
578
|
};
|
|
574
579
|
const instance = getCurrentInstance();
|
|
575
580
|
const getRef = () => {
|
|
@@ -586,6 +591,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
586
591
|
const cacheNodes = [];
|
|
587
592
|
let cacheEl = null;
|
|
588
593
|
const cleanTree = (count) => {
|
|
594
|
+
if (props.static === true)
|
|
595
|
+
return;
|
|
589
596
|
const el = getRef();
|
|
590
597
|
if (!el)
|
|
591
598
|
return;
|
|
@@ -926,7 +933,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
926
933
|
modelValue: {},
|
|
927
934
|
decorator: { type: Function },
|
|
928
935
|
parser: {},
|
|
929
|
-
styles: {}
|
|
936
|
+
styles: {},
|
|
937
|
+
preventMultiline: { type: Boolean }
|
|
930
938
|
},
|
|
931
939
|
setup(__props) {
|
|
932
940
|
const props = __props;
|
|
@@ -945,7 +953,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
945
953
|
block,
|
|
946
954
|
slots: unref(slots),
|
|
947
955
|
decorator: props.decorator,
|
|
948
|
-
parser: props.parser
|
|
956
|
+
parser: props.parser,
|
|
957
|
+
static: ""
|
|
949
958
|
}, null, 8, ["block", "slots", "decorator", "parser"]);
|
|
950
959
|
}), 128))
|
|
951
960
|
]);
|