@mekari/pixel3-rich-text-editor 0.1.3-dev.0 → 0.1.3-dev.1
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/{chunk-47IOAHWN.mjs → chunk-FCLBNBXD.mjs} +21 -14
- package/dist/{chunk-UD5PDCGC.mjs → chunk-RX7ZEE2M.mjs} +89 -52
- package/dist/{chunk-ZYSEHV5N.mjs → chunk-T7RFFPSJ.mjs} +1 -1
- package/dist/editor-toolbar.js +109 -65
- package/dist/editor-toolbar.mjs +2 -2
- package/dist/extensions/index.js +21 -14
- package/dist/extensions/index.mjs +1 -1
- package/dist/extensions/single-extension.d.mts +11 -1
- package/dist/extensions/single-extension.d.ts +11 -1
- package/dist/extensions/single-extension.js +21 -14
- package/dist/extensions/single-extension.mjs +1 -1
- package/dist/index.js +109 -65
- package/dist/index.mjs +3 -3
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/rich-text-editor.types.d.mts +1 -0
- package/dist/modules/rich-text-editor.types.d.ts +1 -0
- package/dist/rich-text-editor.js +109 -65
- package/dist/rich-text-editor.mjs +3 -3
- package/package.json +12 -12
|
@@ -34,14 +34,13 @@ var SingleExtention = defineComponent({
|
|
|
34
34
|
},
|
|
35
35
|
editor: {
|
|
36
36
|
type: Object
|
|
37
|
+
},
|
|
38
|
+
isDisabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
37
41
|
}
|
|
38
42
|
},
|
|
39
|
-
setup({
|
|
40
|
-
name,
|
|
41
|
-
tooltipLabel,
|
|
42
|
-
onClick,
|
|
43
|
-
editor
|
|
44
|
-
}) {
|
|
43
|
+
setup(props) {
|
|
45
44
|
const iconMap = {
|
|
46
45
|
bold: _createVNode(BoldIcon, null, null),
|
|
47
46
|
italic: _createVNode(ItalicIcon, null, null),
|
|
@@ -60,14 +59,22 @@ var SingleExtention = defineComponent({
|
|
|
60
59
|
variable: _createVNode(VariableIcon, null, null),
|
|
61
60
|
location: _createVNode(LocationIcon, null, null)
|
|
62
61
|
};
|
|
63
|
-
return () =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
return () => {
|
|
63
|
+
var _a;
|
|
64
|
+
return _withDirectives(_createVNode("button", {
|
|
65
|
+
"class": {
|
|
66
|
+
"is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
|
|
67
|
+
},
|
|
68
|
+
"style": props.isDisabled ? {
|
|
69
|
+
opacity: "0.4",
|
|
70
|
+
cursor: "not-allowed"
|
|
71
|
+
} : void 0,
|
|
72
|
+
"disabled": props.isDisabled,
|
|
73
|
+
"onClick": props.isDisabled ? void 0 : props.onClick
|
|
74
|
+
}, [props.name && iconMap[props.name]]), [[_resolveDirective("tooltip"), {
|
|
75
|
+
label: props.tooltipLabel
|
|
76
|
+
}]]);
|
|
77
|
+
};
|
|
71
78
|
}
|
|
72
79
|
});
|
|
73
80
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-COZ45QUD.mjs";
|
|
7
7
|
import {
|
|
8
8
|
SingleExtention
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FCLBNBXD.mjs";
|
|
10
10
|
import {
|
|
11
11
|
AlignExtention
|
|
12
12
|
} from "./chunk-YWVVMJGP.mjs";
|
|
@@ -40,77 +40,102 @@ var EditorToolbar = defineComponent({
|
|
|
40
40
|
type: Function
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
setup({
|
|
44
|
-
editor,
|
|
45
|
-
options,
|
|
46
|
-
validateLink,
|
|
47
|
-
transformLink
|
|
48
|
-
}, {
|
|
43
|
+
setup(props, {
|
|
49
44
|
emit
|
|
50
45
|
}) {
|
|
51
46
|
const items = ["heading", "bold", "italic", "underline", "strike", "blockquote", "bulletList", "orderedList", "textColor", "fillColor", "textLink", "align", "undo", "redo", "clear", "image", "file", "audio", "mention", "variable", "location"];
|
|
52
|
-
const
|
|
47
|
+
const getItemOptions = /* @__PURE__ */ __name(() => ({
|
|
53
48
|
heading: {
|
|
54
49
|
tooltipLabel: "Text style",
|
|
55
|
-
editor
|
|
50
|
+
editor: props.editor
|
|
56
51
|
},
|
|
57
52
|
bold: {
|
|
58
53
|
tooltipLabel: "Bold",
|
|
59
|
-
onClick: () =>
|
|
54
|
+
onClick: () => {
|
|
55
|
+
var _a;
|
|
56
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBold().run();
|
|
57
|
+
}
|
|
60
58
|
},
|
|
61
59
|
italic: {
|
|
62
60
|
tooltipLabel: "Italic",
|
|
63
|
-
onClick: () =>
|
|
61
|
+
onClick: () => {
|
|
62
|
+
var _a;
|
|
63
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleItalic().run();
|
|
64
|
+
}
|
|
64
65
|
},
|
|
65
66
|
underline: {
|
|
66
67
|
tooltipLabel: "Underline",
|
|
67
|
-
onClick: () =>
|
|
68
|
+
onClick: () => {
|
|
69
|
+
var _a;
|
|
70
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleUnderline().run();
|
|
71
|
+
}
|
|
68
72
|
},
|
|
69
73
|
strike: {
|
|
70
74
|
tooltipLabel: "Strike",
|
|
71
|
-
onClick: () =>
|
|
75
|
+
onClick: () => {
|
|
76
|
+
var _a;
|
|
77
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleStrike().run();
|
|
78
|
+
}
|
|
72
79
|
},
|
|
73
80
|
blockquote: {
|
|
74
81
|
tooltipLabel: "Blockquote",
|
|
75
|
-
onClick: () =>
|
|
82
|
+
onClick: () => {
|
|
83
|
+
var _a;
|
|
84
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBlockquote().run();
|
|
85
|
+
}
|
|
76
86
|
},
|
|
77
87
|
bulletList: {
|
|
78
88
|
tooltipLabel: "Bullet list",
|
|
79
|
-
onClick: () =>
|
|
89
|
+
onClick: () => {
|
|
90
|
+
var _a;
|
|
91
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBulletList().run();
|
|
92
|
+
}
|
|
80
93
|
},
|
|
81
94
|
orderedList: {
|
|
82
95
|
tooltipLabel: "Number list",
|
|
83
|
-
onClick: () =>
|
|
96
|
+
onClick: () => {
|
|
97
|
+
var _a;
|
|
98
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleOrderedList().run();
|
|
99
|
+
}
|
|
84
100
|
},
|
|
85
101
|
textColor: {
|
|
86
102
|
tooltipLabel: "Text color",
|
|
87
|
-
editor,
|
|
103
|
+
editor: props.editor,
|
|
88
104
|
type: "text"
|
|
89
105
|
},
|
|
90
106
|
fillColor: {
|
|
91
107
|
tooltipLabel: "Fill color",
|
|
92
|
-
editor,
|
|
108
|
+
editor: props.editor,
|
|
93
109
|
type: "fill"
|
|
94
110
|
},
|
|
95
111
|
textLink: {
|
|
96
112
|
tooltipLabel: "Insert link",
|
|
97
|
-
editor
|
|
113
|
+
editor: props.editor
|
|
98
114
|
},
|
|
99
115
|
align: {
|
|
100
116
|
tooltipLabel: "Text alignment",
|
|
101
|
-
editor
|
|
117
|
+
editor: props.editor
|
|
102
118
|
},
|
|
103
119
|
undo: {
|
|
104
120
|
tooltipLabel: "Undo",
|
|
105
|
-
onClick: () =>
|
|
121
|
+
onClick: () => {
|
|
122
|
+
var _a;
|
|
123
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().undo().run();
|
|
124
|
+
}
|
|
106
125
|
},
|
|
107
126
|
redo: {
|
|
108
127
|
tooltipLabel: "Redo",
|
|
109
|
-
onClick: () =>
|
|
128
|
+
onClick: () => {
|
|
129
|
+
var _a;
|
|
130
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().redo().run();
|
|
131
|
+
}
|
|
110
132
|
},
|
|
111
133
|
clear: {
|
|
112
134
|
tooltipLabel: "Reset format",
|
|
113
|
-
onClick: () =>
|
|
135
|
+
onClick: () => {
|
|
136
|
+
var _a;
|
|
137
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().unsetAllMarks().run();
|
|
138
|
+
}
|
|
114
139
|
},
|
|
115
140
|
image: {
|
|
116
141
|
tooltipLabel: "Add image",
|
|
@@ -126,19 +151,21 @@ var EditorToolbar = defineComponent({
|
|
|
126
151
|
},
|
|
127
152
|
mention: {
|
|
128
153
|
tooltipLabel: "Mention",
|
|
129
|
-
editor,
|
|
154
|
+
editor: props.editor,
|
|
130
155
|
onClick: () => {
|
|
156
|
+
var _a;
|
|
131
157
|
;
|
|
132
|
-
(editor == null ? void 0 :
|
|
158
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("@").run();
|
|
133
159
|
emit("clickMention");
|
|
134
160
|
}
|
|
135
161
|
},
|
|
136
162
|
variable: {
|
|
137
163
|
tooltipLabel: "Insert variable",
|
|
138
|
-
editor,
|
|
164
|
+
editor: props.editor,
|
|
139
165
|
onClick: () => {
|
|
166
|
+
var _a;
|
|
140
167
|
;
|
|
141
|
-
(editor == null ? void 0 :
|
|
168
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("{").run();
|
|
142
169
|
emit("clickVariable");
|
|
143
170
|
}
|
|
144
171
|
},
|
|
@@ -146,7 +173,7 @@ var EditorToolbar = defineComponent({
|
|
|
146
173
|
tooltipLabel: "Add location",
|
|
147
174
|
onClick: () => emit("clickLocation")
|
|
148
175
|
}
|
|
149
|
-
};
|
|
176
|
+
}), "getItemOptions");
|
|
150
177
|
const getResolvedItem = /* @__PURE__ */ __name((option) => {
|
|
151
178
|
if (typeof option === "string") {
|
|
152
179
|
return {
|
|
@@ -155,17 +182,20 @@ var EditorToolbar = defineComponent({
|
|
|
155
182
|
}
|
|
156
183
|
return {
|
|
157
184
|
item: option.value,
|
|
158
|
-
tooltip: option.tooltip
|
|
185
|
+
tooltip: option.tooltip,
|
|
186
|
+
disabled: option.disabled
|
|
159
187
|
};
|
|
160
188
|
}, "getResolvedItem");
|
|
161
189
|
const renderExtension = /* @__PURE__ */ __name((option) => {
|
|
162
190
|
const {
|
|
163
191
|
item,
|
|
164
|
-
tooltip
|
|
192
|
+
tooltip,
|
|
193
|
+
disabled
|
|
165
194
|
} = getResolvedItem(option);
|
|
166
195
|
if (!items.includes(item))
|
|
167
196
|
return null;
|
|
168
197
|
const resolvedItem = item;
|
|
198
|
+
const itemOptions = getItemOptions();
|
|
169
199
|
const resolvedOptions = itemOptions[resolvedItem];
|
|
170
200
|
if (!resolvedOptions)
|
|
171
201
|
return null;
|
|
@@ -174,33 +204,34 @@ var EditorToolbar = defineComponent({
|
|
|
174
204
|
case "heading":
|
|
175
205
|
return _createVNode(HeadingExtention, {
|
|
176
206
|
"tooltipLabel": tooltipLabel,
|
|
177
|
-
"editor": editor
|
|
207
|
+
"editor": props.editor
|
|
178
208
|
}, null);
|
|
179
209
|
case "align":
|
|
180
210
|
return _createVNode(AlignExtention, {
|
|
181
211
|
"tooltipLabel": tooltipLabel,
|
|
182
|
-
"editor": editor
|
|
212
|
+
"editor": props.editor
|
|
183
213
|
}, null);
|
|
184
214
|
case "textColor":
|
|
185
215
|
case "fillColor":
|
|
186
216
|
return _createVNode(ColorExtension, {
|
|
187
217
|
"tooltipLabel": tooltipLabel,
|
|
188
|
-
"editor": editor,
|
|
218
|
+
"editor": props.editor,
|
|
189
219
|
"type": resolvedOptions.type
|
|
190
220
|
}, null);
|
|
191
221
|
case "textLink":
|
|
192
222
|
return _createVNode(LinkExtension, {
|
|
193
223
|
"tooltipLabel": tooltipLabel,
|
|
194
|
-
"editor": editor,
|
|
195
|
-
"validateLink": validateLink,
|
|
196
|
-
"transformLink": transformLink
|
|
224
|
+
"editor": props.editor,
|
|
225
|
+
"validateLink": props.validateLink,
|
|
226
|
+
"transformLink": props.transformLink
|
|
197
227
|
}, null);
|
|
198
228
|
default:
|
|
199
229
|
return _createVNode(SingleExtention, {
|
|
200
230
|
"name": resolvedItem,
|
|
201
231
|
"tooltipLabel": tooltipLabel,
|
|
202
232
|
"onClick": resolvedOptions.onClick,
|
|
203
|
-
"editor": editor
|
|
233
|
+
"editor": props.editor,
|
|
234
|
+
"isDisabled": disabled
|
|
204
235
|
}, null);
|
|
205
236
|
}
|
|
206
237
|
}, "renderExtension");
|
|
@@ -212,21 +243,27 @@ var EditorToolbar = defineComponent({
|
|
|
212
243
|
}
|
|
213
244
|
}
|
|
214
245
|
}, {
|
|
215
|
-
default: () =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
246
|
+
default: () => {
|
|
247
|
+
var _a;
|
|
248
|
+
return [_createVNode("div", {
|
|
249
|
+
"class": css({
|
|
250
|
+
display: "flex",
|
|
251
|
+
alignItems: "stretch",
|
|
252
|
+
gap: "1"
|
|
253
|
+
})
|
|
254
|
+
}, [(_a = props.options) == null ? void 0 : _a.map((option, index) => {
|
|
255
|
+
var _a2, _b;
|
|
256
|
+
return _createVNode(_Fragment, null, [option.map((item) => {
|
|
257
|
+
const resolvedItem = typeof item === "string" ? item : item.value;
|
|
258
|
+
if (items.includes(resolvedItem)) {
|
|
259
|
+
return renderExtension(item);
|
|
260
|
+
}
|
|
261
|
+
}), index !== ((_b = (_a2 = props.options) == null ? void 0 : _a2.length) != null ? _b : 0) - 1 && _createVNode(MpDivider, {
|
|
262
|
+
"id": "divider-toolbar",
|
|
263
|
+
"orientation": "vertical"
|
|
264
|
+
}, null)]);
|
|
265
|
+
})])];
|
|
266
|
+
}
|
|
230
267
|
});
|
|
231
268
|
}
|
|
232
269
|
});
|
package/dist/editor-toolbar.js
CHANGED
|
@@ -724,14 +724,13 @@ var SingleExtention = (0, import_vue8.defineComponent)({
|
|
|
724
724
|
},
|
|
725
725
|
editor: {
|
|
726
726
|
type: Object
|
|
727
|
+
},
|
|
728
|
+
isDisabled: {
|
|
729
|
+
type: Boolean,
|
|
730
|
+
default: false
|
|
727
731
|
}
|
|
728
732
|
},
|
|
729
|
-
setup({
|
|
730
|
-
name,
|
|
731
|
-
tooltipLabel,
|
|
732
|
-
onClick,
|
|
733
|
-
editor
|
|
734
|
-
}) {
|
|
733
|
+
setup(props) {
|
|
735
734
|
const iconMap = {
|
|
736
735
|
bold: (0, import_vue7.createVNode)(BoldIcon, null, null),
|
|
737
736
|
italic: (0, import_vue7.createVNode)(ItalicIcon, null, null),
|
|
@@ -750,14 +749,22 @@ var SingleExtention = (0, import_vue8.defineComponent)({
|
|
|
750
749
|
variable: (0, import_vue7.createVNode)(VariableIcon, null, null),
|
|
751
750
|
location: (0, import_vue7.createVNode)(LocationIcon, null, null)
|
|
752
751
|
};
|
|
753
|
-
return () =>
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
752
|
+
return () => {
|
|
753
|
+
var _a;
|
|
754
|
+
return (0, import_vue7.withDirectives)((0, import_vue7.createVNode)("button", {
|
|
755
|
+
"class": {
|
|
756
|
+
"is-active": props.name && ((_a = props.editor) == null ? void 0 : _a.isActive(props.name))
|
|
757
|
+
},
|
|
758
|
+
"style": props.isDisabled ? {
|
|
759
|
+
opacity: "0.4",
|
|
760
|
+
cursor: "not-allowed"
|
|
761
|
+
} : void 0,
|
|
762
|
+
"disabled": props.isDisabled,
|
|
763
|
+
"onClick": props.isDisabled ? void 0 : props.onClick
|
|
764
|
+
}, [props.name && iconMap[props.name]]), [[(0, import_vue7.resolveDirective)("tooltip"), {
|
|
765
|
+
label: props.tooltipLabel
|
|
766
|
+
}]]);
|
|
767
|
+
};
|
|
761
768
|
}
|
|
762
769
|
});
|
|
763
770
|
|
|
@@ -1395,77 +1402,102 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1395
1402
|
type: Function
|
|
1396
1403
|
}
|
|
1397
1404
|
},
|
|
1398
|
-
setup({
|
|
1399
|
-
editor,
|
|
1400
|
-
options,
|
|
1401
|
-
validateLink,
|
|
1402
|
-
transformLink
|
|
1403
|
-
}, {
|
|
1405
|
+
setup(props, {
|
|
1404
1406
|
emit
|
|
1405
1407
|
}) {
|
|
1406
1408
|
const items = ["heading", "bold", "italic", "underline", "strike", "blockquote", "bulletList", "orderedList", "textColor", "fillColor", "textLink", "align", "undo", "redo", "clear", "image", "file", "audio", "mention", "variable", "location"];
|
|
1407
|
-
const
|
|
1409
|
+
const getItemOptions = /* @__PURE__ */ __name(() => ({
|
|
1408
1410
|
heading: {
|
|
1409
1411
|
tooltipLabel: "Text style",
|
|
1410
|
-
editor
|
|
1412
|
+
editor: props.editor
|
|
1411
1413
|
},
|
|
1412
1414
|
bold: {
|
|
1413
1415
|
tooltipLabel: "Bold",
|
|
1414
|
-
onClick: () =>
|
|
1416
|
+
onClick: () => {
|
|
1417
|
+
var _a;
|
|
1418
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBold().run();
|
|
1419
|
+
}
|
|
1415
1420
|
},
|
|
1416
1421
|
italic: {
|
|
1417
1422
|
tooltipLabel: "Italic",
|
|
1418
|
-
onClick: () =>
|
|
1423
|
+
onClick: () => {
|
|
1424
|
+
var _a;
|
|
1425
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleItalic().run();
|
|
1426
|
+
}
|
|
1419
1427
|
},
|
|
1420
1428
|
underline: {
|
|
1421
1429
|
tooltipLabel: "Underline",
|
|
1422
|
-
onClick: () =>
|
|
1430
|
+
onClick: () => {
|
|
1431
|
+
var _a;
|
|
1432
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleUnderline().run();
|
|
1433
|
+
}
|
|
1423
1434
|
},
|
|
1424
1435
|
strike: {
|
|
1425
1436
|
tooltipLabel: "Strike",
|
|
1426
|
-
onClick: () =>
|
|
1437
|
+
onClick: () => {
|
|
1438
|
+
var _a;
|
|
1439
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleStrike().run();
|
|
1440
|
+
}
|
|
1427
1441
|
},
|
|
1428
1442
|
blockquote: {
|
|
1429
1443
|
tooltipLabel: "Blockquote",
|
|
1430
|
-
onClick: () =>
|
|
1444
|
+
onClick: () => {
|
|
1445
|
+
var _a;
|
|
1446
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBlockquote().run();
|
|
1447
|
+
}
|
|
1431
1448
|
},
|
|
1432
1449
|
bulletList: {
|
|
1433
1450
|
tooltipLabel: "Bullet list",
|
|
1434
|
-
onClick: () =>
|
|
1451
|
+
onClick: () => {
|
|
1452
|
+
var _a;
|
|
1453
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleBulletList().run();
|
|
1454
|
+
}
|
|
1435
1455
|
},
|
|
1436
1456
|
orderedList: {
|
|
1437
1457
|
tooltipLabel: "Number list",
|
|
1438
|
-
onClick: () =>
|
|
1458
|
+
onClick: () => {
|
|
1459
|
+
var _a;
|
|
1460
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().toggleOrderedList().run();
|
|
1461
|
+
}
|
|
1439
1462
|
},
|
|
1440
1463
|
textColor: {
|
|
1441
1464
|
tooltipLabel: "Text color",
|
|
1442
|
-
editor,
|
|
1465
|
+
editor: props.editor,
|
|
1443
1466
|
type: "text"
|
|
1444
1467
|
},
|
|
1445
1468
|
fillColor: {
|
|
1446
1469
|
tooltipLabel: "Fill color",
|
|
1447
|
-
editor,
|
|
1470
|
+
editor: props.editor,
|
|
1448
1471
|
type: "fill"
|
|
1449
1472
|
},
|
|
1450
1473
|
textLink: {
|
|
1451
1474
|
tooltipLabel: "Insert link",
|
|
1452
|
-
editor
|
|
1475
|
+
editor: props.editor
|
|
1453
1476
|
},
|
|
1454
1477
|
align: {
|
|
1455
1478
|
tooltipLabel: "Text alignment",
|
|
1456
|
-
editor
|
|
1479
|
+
editor: props.editor
|
|
1457
1480
|
},
|
|
1458
1481
|
undo: {
|
|
1459
1482
|
tooltipLabel: "Undo",
|
|
1460
|
-
onClick: () =>
|
|
1483
|
+
onClick: () => {
|
|
1484
|
+
var _a;
|
|
1485
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().undo().run();
|
|
1486
|
+
}
|
|
1461
1487
|
},
|
|
1462
1488
|
redo: {
|
|
1463
1489
|
tooltipLabel: "Redo",
|
|
1464
|
-
onClick: () =>
|
|
1490
|
+
onClick: () => {
|
|
1491
|
+
var _a;
|
|
1492
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().redo().run();
|
|
1493
|
+
}
|
|
1465
1494
|
},
|
|
1466
1495
|
clear: {
|
|
1467
1496
|
tooltipLabel: "Reset format",
|
|
1468
|
-
onClick: () =>
|
|
1497
|
+
onClick: () => {
|
|
1498
|
+
var _a;
|
|
1499
|
+
return ((_a = props.editor) == null ? void 0 : _a.chain()).focus().unsetAllMarks().run();
|
|
1500
|
+
}
|
|
1469
1501
|
},
|
|
1470
1502
|
image: {
|
|
1471
1503
|
tooltipLabel: "Add image",
|
|
@@ -1481,19 +1513,21 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1481
1513
|
},
|
|
1482
1514
|
mention: {
|
|
1483
1515
|
tooltipLabel: "Mention",
|
|
1484
|
-
editor,
|
|
1516
|
+
editor: props.editor,
|
|
1485
1517
|
onClick: () => {
|
|
1518
|
+
var _a;
|
|
1486
1519
|
;
|
|
1487
|
-
(editor == null ? void 0 :
|
|
1520
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("@").run();
|
|
1488
1521
|
emit("clickMention");
|
|
1489
1522
|
}
|
|
1490
1523
|
},
|
|
1491
1524
|
variable: {
|
|
1492
1525
|
tooltipLabel: "Insert variable",
|
|
1493
|
-
editor,
|
|
1526
|
+
editor: props.editor,
|
|
1494
1527
|
onClick: () => {
|
|
1528
|
+
var _a;
|
|
1495
1529
|
;
|
|
1496
|
-
(editor == null ? void 0 :
|
|
1530
|
+
((_a = props.editor) == null ? void 0 : _a.chain()).focus().insertContent("{").run();
|
|
1497
1531
|
emit("clickVariable");
|
|
1498
1532
|
}
|
|
1499
1533
|
},
|
|
@@ -1501,7 +1535,7 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1501
1535
|
tooltipLabel: "Add location",
|
|
1502
1536
|
onClick: () => emit("clickLocation")
|
|
1503
1537
|
}
|
|
1504
|
-
};
|
|
1538
|
+
}), "getItemOptions");
|
|
1505
1539
|
const getResolvedItem = /* @__PURE__ */ __name((option) => {
|
|
1506
1540
|
if (typeof option === "string") {
|
|
1507
1541
|
return {
|
|
@@ -1510,17 +1544,20 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1510
1544
|
}
|
|
1511
1545
|
return {
|
|
1512
1546
|
item: option.value,
|
|
1513
|
-
tooltip: option.tooltip
|
|
1547
|
+
tooltip: option.tooltip,
|
|
1548
|
+
disabled: option.disabled
|
|
1514
1549
|
};
|
|
1515
1550
|
}, "getResolvedItem");
|
|
1516
1551
|
const renderExtension = /* @__PURE__ */ __name((option) => {
|
|
1517
1552
|
const {
|
|
1518
1553
|
item,
|
|
1519
|
-
tooltip
|
|
1554
|
+
tooltip,
|
|
1555
|
+
disabled
|
|
1520
1556
|
} = getResolvedItem(option);
|
|
1521
1557
|
if (!items.includes(item))
|
|
1522
1558
|
return null;
|
|
1523
1559
|
const resolvedItem = item;
|
|
1560
|
+
const itemOptions = getItemOptions();
|
|
1524
1561
|
const resolvedOptions = itemOptions[resolvedItem];
|
|
1525
1562
|
if (!resolvedOptions)
|
|
1526
1563
|
return null;
|
|
@@ -1529,33 +1566,34 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1529
1566
|
case "heading":
|
|
1530
1567
|
return (0, import_vue15.createVNode)(HeadingExtention, {
|
|
1531
1568
|
"tooltipLabel": tooltipLabel,
|
|
1532
|
-
"editor": editor
|
|
1569
|
+
"editor": props.editor
|
|
1533
1570
|
}, null);
|
|
1534
1571
|
case "align":
|
|
1535
1572
|
return (0, import_vue15.createVNode)(AlignExtention, {
|
|
1536
1573
|
"tooltipLabel": tooltipLabel,
|
|
1537
|
-
"editor": editor
|
|
1574
|
+
"editor": props.editor
|
|
1538
1575
|
}, null);
|
|
1539
1576
|
case "textColor":
|
|
1540
1577
|
case "fillColor":
|
|
1541
1578
|
return (0, import_vue15.createVNode)(ColorExtension, {
|
|
1542
1579
|
"tooltipLabel": tooltipLabel,
|
|
1543
|
-
"editor": editor,
|
|
1580
|
+
"editor": props.editor,
|
|
1544
1581
|
"type": resolvedOptions.type
|
|
1545
1582
|
}, null);
|
|
1546
1583
|
case "textLink":
|
|
1547
1584
|
return (0, import_vue15.createVNode)(LinkExtension, {
|
|
1548
1585
|
"tooltipLabel": tooltipLabel,
|
|
1549
|
-
"editor": editor,
|
|
1550
|
-
"validateLink": validateLink,
|
|
1551
|
-
"transformLink": transformLink
|
|
1586
|
+
"editor": props.editor,
|
|
1587
|
+
"validateLink": props.validateLink,
|
|
1588
|
+
"transformLink": props.transformLink
|
|
1552
1589
|
}, null);
|
|
1553
1590
|
default:
|
|
1554
1591
|
return (0, import_vue15.createVNode)(SingleExtention, {
|
|
1555
1592
|
"name": resolvedItem,
|
|
1556
1593
|
"tooltipLabel": tooltipLabel,
|
|
1557
1594
|
"onClick": resolvedOptions.onClick,
|
|
1558
|
-
"editor": editor
|
|
1595
|
+
"editor": props.editor,
|
|
1596
|
+
"isDisabled": disabled
|
|
1559
1597
|
}, null);
|
|
1560
1598
|
}
|
|
1561
1599
|
}, "renderExtension");
|
|
@@ -1567,21 +1605,27 @@ var EditorToolbar = (0, import_vue16.defineComponent)({
|
|
|
1567
1605
|
}
|
|
1568
1606
|
}
|
|
1569
1607
|
}, {
|
|
1570
|
-
default: () =>
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1608
|
+
default: () => {
|
|
1609
|
+
var _a;
|
|
1610
|
+
return [(0, import_vue15.createVNode)("div", {
|
|
1611
|
+
"class": (0, import_css6.css)({
|
|
1612
|
+
display: "flex",
|
|
1613
|
+
alignItems: "stretch",
|
|
1614
|
+
gap: "1"
|
|
1615
|
+
})
|
|
1616
|
+
}, [(_a = props.options) == null ? void 0 : _a.map((option, index) => {
|
|
1617
|
+
var _a2, _b;
|
|
1618
|
+
return (0, import_vue15.createVNode)(import_vue15.Fragment, null, [option.map((item) => {
|
|
1619
|
+
const resolvedItem = typeof item === "string" ? item : item.value;
|
|
1620
|
+
if (items.includes(resolvedItem)) {
|
|
1621
|
+
return renderExtension(item);
|
|
1622
|
+
}
|
|
1623
|
+
}), index !== ((_b = (_a2 = props.options) == null ? void 0 : _a2.length) != null ? _b : 0) - 1 && (0, import_vue15.createVNode)(import_pixel3_divider.MpDivider, {
|
|
1624
|
+
"id": "divider-toolbar",
|
|
1625
|
+
"orientation": "vertical"
|
|
1626
|
+
}, null)]);
|
|
1627
|
+
})])];
|
|
1628
|
+
}
|
|
1585
1629
|
});
|
|
1586
1630
|
}
|
|
1587
1631
|
});
|
package/dist/editor-toolbar.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorToolbar
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RX7ZEE2M.mjs";
|
|
4
4
|
import "./chunk-HIHIKPNN.mjs";
|
|
5
5
|
import "./chunk-X2CB42A3.mjs";
|
|
6
6
|
import "./chunk-COZ45QUD.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FCLBNBXD.mjs";
|
|
8
8
|
import "./chunk-ENKUUZPM.mjs";
|
|
9
9
|
import "./chunk-76GEEOAG.mjs";
|
|
10
10
|
import "./chunk-YWVVMJGP.mjs";
|