@mantine-vue/tiptap 3.1.0 → 3.3.0
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/cjs/index.cjs +462 -15
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +449 -16
- package/esm/index.mjs.map +1 -1
- package/lib/RichTextEditor.context.d.ts +2 -2
- package/lib/RichTextEditor.d.ts +17 -0
- package/lib/RichTextEditor.types.d.ts +19 -2
- package/lib/RichTextEditorControl/RichTextEditorDetailsControl.d.ts +3 -0
- package/lib/RichTextEditorControl/RichTextEditorDetailsControl.types.d.ts +11 -0
- package/lib/RichTextEditorControl/RichTextEditorDetailsControl.vue.d.ts +202 -0
- package/lib/RichTextEditorControl/RichTextEditorInvisibleCharactersControl.d.ts +3 -0
- package/lib/RichTextEditorControl/RichTextEditorInvisibleCharactersControl.types.d.ts +11 -0
- package/lib/RichTextEditorControl/RichTextEditorInvisibleCharactersControl.vue.d.ts +202 -0
- package/lib/RichTextEditorControl/RichTextEditorTableInsertControl.d.ts +3 -0
- package/lib/RichTextEditorControl/RichTextEditorTableInsertControl.types.d.ts +21 -0
- package/lib/RichTextEditorControl/RichTextEditorTableInsertControl.vue.d.ts +209 -0
- package/lib/RichTextEditorControl/controls.d.ts +88 -0
- package/lib/RichTextEditorControl/index.d.ts +3 -0
- package/lib/icons/Icons.d.ts +14 -0
- package/lib/index.d.mts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/labels.d.ts +17 -1
- package/package.json +3 -3
- package/styles.css +276 -108
- package/styles.layer.css +276 -108
package/cjs/index.cjs
CHANGED
|
@@ -64,6 +64,21 @@ var DEFAULT_LABELS = {
|
|
|
64
64
|
tasksControlLabel: "Task list",
|
|
65
65
|
tasksSinkLabel: "Decrease task level",
|
|
66
66
|
tasksLiftLabel: "Increase task level",
|
|
67
|
+
tableInsertControlLabel: "Insert table",
|
|
68
|
+
tableInsertLabel: (columns, rows) => `Insert ${columns} × ${rows} table`,
|
|
69
|
+
tableDeleteControlLabel: "Delete table",
|
|
70
|
+
tableColumnBeforeControlLabel: "Add column before",
|
|
71
|
+
tableColumnAfterControlLabel: "Add column after",
|
|
72
|
+
tableColumnDeleteControlLabel: "Delete column",
|
|
73
|
+
tableRowBeforeControlLabel: "Add row before",
|
|
74
|
+
tableRowAfterControlLabel: "Add row after",
|
|
75
|
+
tableRowDeleteControlLabel: "Delete row",
|
|
76
|
+
tableToggleHeaderRowControlLabel: "Toggle header row",
|
|
77
|
+
tableToggleHeaderColumnControlLabel: "Toggle header column",
|
|
78
|
+
tableMergeCellsControlLabel: "Merge cells",
|
|
79
|
+
tableSplitCellControlLabel: "Split cell",
|
|
80
|
+
detailsControlLabel: "Toggle collapsible section",
|
|
81
|
+
invisibleCharactersControlLabel: "Toggle invisible characters",
|
|
67
82
|
linkEditorInputLabel: "Enter URL",
|
|
68
83
|
linkEditorInputPlaceholder: "https://example.com/",
|
|
69
84
|
linkEditorExternalLink: "Open link in a new tab",
|
|
@@ -80,19 +95,23 @@ var DEFAULT_LABELS = {
|
|
|
80
95
|
//#region src/RichTextEditor.context.ts
|
|
81
96
|
var [provideRichTextEditorContext, useRichTextEditorContext] = (0, _mantine_vue_core.createSafeContext)("RichTextEditor component was not found in tree");
|
|
82
97
|
var RichTextEditor_module_default = {
|
|
83
|
-
root: "
|
|
84
|
-
Typography: "
|
|
85
|
-
content: "
|
|
86
|
-
linkEditorDropdown: "
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
root: "_root_1avnr_1",
|
|
99
|
+
Typography: "_Typography_1avnr_19",
|
|
100
|
+
content: "_content_1avnr_47",
|
|
101
|
+
linkEditorDropdown: "_linkEditorDropdown_1avnr_292",
|
|
102
|
+
tableInsertDropdown: "_tableInsertDropdown_1avnr_296",
|
|
103
|
+
tableInsertGrid: "_tableInsertGrid_1avnr_301",
|
|
104
|
+
tableInsertCell: "_tableInsertCell_1avnr_307",
|
|
105
|
+
tableInsertLabel: "_tableInsertLabel_1avnr_324",
|
|
106
|
+
control: "_control_1avnr_331",
|
|
107
|
+
controlIcon: "_controlIcon_1avnr_406",
|
|
108
|
+
controlsGroup: "_controlsGroup_1avnr_411",
|
|
109
|
+
linkEditor: "_linkEditor_1avnr_292",
|
|
110
|
+
linkEditorInput: "_linkEditorInput_1avnr_440",
|
|
111
|
+
linkEditorExternalControl: "_linkEditorExternalControl_1avnr_446",
|
|
112
|
+
linkEditorSave: "_linkEditorSave_1avnr_476",
|
|
113
|
+
toolbar: "_toolbar_1avnr_481",
|
|
114
|
+
taskList: "_taskList_1avnr_515"
|
|
96
115
|
};
|
|
97
116
|
//#endregion
|
|
98
117
|
//#region src/RichTextEditor.vue
|
|
@@ -756,6 +775,73 @@ var IconBraces = createIcon("IconBraces", [
|
|
|
756
775
|
path("M10 11l-2 2 2 2"),
|
|
757
776
|
path("M14 11l2 2-2 2")
|
|
758
777
|
]);
|
|
778
|
+
var IconTablePlus = createIcon("IconTablePlus", [
|
|
779
|
+
path("M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5"),
|
|
780
|
+
path("M3 10h18"),
|
|
781
|
+
path("M10 3v18"),
|
|
782
|
+
path("M16 19h6"),
|
|
783
|
+
path("M19 16v6")
|
|
784
|
+
]);
|
|
785
|
+
var IconTableOff = createIcon("IconTableOff", [
|
|
786
|
+
path("M7 3h12a2 2 0 0 1 2 2v12m-.585 3.413a1.994 1.994 0 0 1 -1.415 .587h-14a2 2 0 0 1 -2 -2v-14c0 -.55 .223 -1.05 .583 -1.412"),
|
|
787
|
+
path("M3 10h7m4 0h7"),
|
|
788
|
+
path("M10 3v3m0 4v11"),
|
|
789
|
+
path("M3 3l18 18")
|
|
790
|
+
]);
|
|
791
|
+
var IconColumnInsertLeft = createIcon("IconColumnInsertLeft", [
|
|
792
|
+
path("M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"),
|
|
793
|
+
path("M5 12l4 0"),
|
|
794
|
+
path("M7 10l0 4")
|
|
795
|
+
]);
|
|
796
|
+
var IconColumnInsertRight = createIcon("IconColumnInsertRight", [
|
|
797
|
+
path("M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"),
|
|
798
|
+
path("M15 12l4 0"),
|
|
799
|
+
path("M17 10l0 4")
|
|
800
|
+
]);
|
|
801
|
+
var IconColumnRemove = createIcon("IconColumnRemove", [
|
|
802
|
+
path("M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"),
|
|
803
|
+
path("M16 10l4 4"),
|
|
804
|
+
path("M16 14l4 -4")
|
|
805
|
+
]);
|
|
806
|
+
var IconRowInsertTop = createIcon("IconRowInsertTop", [
|
|
807
|
+
path("M4 18v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z"),
|
|
808
|
+
path("M12 9v-4"),
|
|
809
|
+
path("M10 7l4 0")
|
|
810
|
+
]);
|
|
811
|
+
var IconRowInsertBottom = createIcon("IconRowInsertBottom", [
|
|
812
|
+
path("M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"),
|
|
813
|
+
path("M12 15l0 4"),
|
|
814
|
+
path("M14 17l-4 0")
|
|
815
|
+
]);
|
|
816
|
+
var IconRowRemove = createIcon("IconRowRemove", [
|
|
817
|
+
path("M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"),
|
|
818
|
+
path("M10 16l4 4"),
|
|
819
|
+
path("M10 20l4 -4")
|
|
820
|
+
]);
|
|
821
|
+
var IconTableHeaderRow = createIcon("IconTableHeaderRow", [path("M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"), path("M4 9l16 0")]);
|
|
822
|
+
var IconTableHeaderColumn = createIcon("IconTableHeaderColumn", [path("M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"), path("M9 4l0 16")]);
|
|
823
|
+
var IconTableMergeCells = createIcon("IconTableMergeCells", [
|
|
824
|
+
path("M18 10h-4v-4"),
|
|
825
|
+
path("M20 4l-6 6"),
|
|
826
|
+
path("M6 14h4v4"),
|
|
827
|
+
path("M10 14l-6 6")
|
|
828
|
+
]);
|
|
829
|
+
var IconTableSplitCell = createIcon("IconTableSplitCell", [
|
|
830
|
+
path("M12 4l0 16"),
|
|
831
|
+
path("M8 8l-4 4l4 4"),
|
|
832
|
+
path("M16 16l4 -4l-4 -4")
|
|
833
|
+
]);
|
|
834
|
+
var IconDetails = createIcon("IconDetails", [
|
|
835
|
+
path("M8 5l3 3l-3 3"),
|
|
836
|
+
path("M15 8l4 0"),
|
|
837
|
+
path("M5 15l14 0"),
|
|
838
|
+
path("M5 19l14 0")
|
|
839
|
+
]);
|
|
840
|
+
var IconPilcrow = createIcon("IconPilcrow", [
|
|
841
|
+
path("M13 4v16"),
|
|
842
|
+
path("M17 4v16"),
|
|
843
|
+
path("M19 4h-9.5a4.5 4.5 0 0 0 0 9h3.5")
|
|
844
|
+
]);
|
|
759
845
|
//#endregion
|
|
760
846
|
//#region src/RichTextEditorControl/RichTextEditorColorPickerControl.vue
|
|
761
847
|
var RichTextEditorColorPickerControl_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -1086,7 +1172,7 @@ var RichTextEditorSourceCodeControl_default = /* @__PURE__ */ (0, vue.defineComp
|
|
|
1086
1172
|
function toggleSourceCode() {
|
|
1087
1173
|
if (!isSafeEditor(ctx.editor)) return;
|
|
1088
1174
|
if (active.value) ctx.editor.commands.setContent(ctx.editor.getText(), { emitUpdate: true });
|
|
1089
|
-
else ctx.editor.commands.setContent(`<textarea>${ctx.editor.getHTML()}</textarea
|
|
1175
|
+
else ctx.editor.commands.setContent(`<textarea>${ctx.editor.getHTML()}</textarea>`, { emitUpdate: false });
|
|
1090
1176
|
active.value = !active.value;
|
|
1091
1177
|
ctx.onSourceCodeTextSwitch?.(active.value);
|
|
1092
1178
|
}
|
|
@@ -1116,6 +1202,273 @@ var RichTextEditorSourceCodeControl_default = /* @__PURE__ */ (0, vue.defineComp
|
|
|
1116
1202
|
//#region src/RichTextEditorControl/RichTextEditorSourceCodeControl.ts
|
|
1117
1203
|
var RichTextEditorSourceCodeControl = (0, _mantine_vue_core.factory)(RichTextEditorSourceCodeControl_default, { classes: RichTextEditor_module_default });
|
|
1118
1204
|
//#endregion
|
|
1205
|
+
//#region src/RichTextEditorControl/RichTextEditorTableInsertControl.vue
|
|
1206
|
+
var RichTextEditorTableInsertControl_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
1207
|
+
name: "RichTextEditorTableInsertControl",
|
|
1208
|
+
inheritAttrs: false,
|
|
1209
|
+
__name: "RichTextEditorTableInsertControl",
|
|
1210
|
+
props: {
|
|
1211
|
+
maxColumns: { default: 10 },
|
|
1212
|
+
maxRows: { default: 10 },
|
|
1213
|
+
withHeaderRow: {
|
|
1214
|
+
type: Boolean,
|
|
1215
|
+
default: true
|
|
1216
|
+
},
|
|
1217
|
+
popoverProps: { default: void 0 },
|
|
1218
|
+
icon: { default: void 0 },
|
|
1219
|
+
classNames: {},
|
|
1220
|
+
styles: {},
|
|
1221
|
+
vars: {},
|
|
1222
|
+
unstyled: { type: Boolean },
|
|
1223
|
+
active: { type: Boolean },
|
|
1224
|
+
interactive: { type: Boolean },
|
|
1225
|
+
disabled: {
|
|
1226
|
+
type: Boolean,
|
|
1227
|
+
default: void 0
|
|
1228
|
+
},
|
|
1229
|
+
variant: {}
|
|
1230
|
+
},
|
|
1231
|
+
setup(__props) {
|
|
1232
|
+
const props = __props;
|
|
1233
|
+
const attrs = (0, vue.useAttrs)();
|
|
1234
|
+
const ctx = useRichTextEditorContext();
|
|
1235
|
+
const opened = (0, vue.ref)(false);
|
|
1236
|
+
const selected = (0, vue.ref)({
|
|
1237
|
+
columns: 0,
|
|
1238
|
+
rows: 0
|
|
1239
|
+
});
|
|
1240
|
+
const commandDisabled = useEditorSelector(() => ctx.editor, (editor) => !isSafeEditor(editor) || !editor.can().insertTable?.());
|
|
1241
|
+
const disabled = (0, vue.computed)(() => props.disabled || commandDisabled.value);
|
|
1242
|
+
const cells = (0, vue.computed)(() => Array.from({ length: props.maxRows * props.maxColumns }, (_, index) => ({
|
|
1243
|
+
row: Math.floor(index / props.maxColumns) + 1,
|
|
1244
|
+
column: index % props.maxColumns + 1
|
|
1245
|
+
})));
|
|
1246
|
+
const stylesApi = (0, vue.computed)(() => ({
|
|
1247
|
+
classNames: props.classNames,
|
|
1248
|
+
styles: props.styles
|
|
1249
|
+
}));
|
|
1250
|
+
function close() {
|
|
1251
|
+
opened.value = false;
|
|
1252
|
+
selected.value = {
|
|
1253
|
+
columns: 0,
|
|
1254
|
+
rows: 0
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
function insertTable(columns, rows) {
|
|
1258
|
+
close();
|
|
1259
|
+
if (isSafeEditor(ctx.editor)) ctx.editor.chain().focus().insertTable({
|
|
1260
|
+
rows,
|
|
1261
|
+
cols: columns,
|
|
1262
|
+
withHeaderRow: props.withHeaderRow
|
|
1263
|
+
}).run();
|
|
1264
|
+
}
|
|
1265
|
+
return (_ctx, _cache) => {
|
|
1266
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Popover), (0, vue.mergeProps)({
|
|
1267
|
+
opened: opened.value,
|
|
1268
|
+
"within-portal": true,
|
|
1269
|
+
"trap-focus": true,
|
|
1270
|
+
shadow: "md",
|
|
1271
|
+
position: "bottom-end"
|
|
1272
|
+
}, props.popoverProps, { onChange: _cache[2] || (_cache[2] = (value) => !value && close()) }), {
|
|
1273
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Popover).Target, null, {
|
|
1274
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(RichTextEditorControlBase_default, (0, vue.mergeProps)((0, vue.unref)(attrs), {
|
|
1275
|
+
active: opened.value,
|
|
1276
|
+
disabled: disabled.value,
|
|
1277
|
+
variant: props.variant ?? (0, vue.unref)(ctx).variant,
|
|
1278
|
+
"aria-label": (0, vue.unref)(ctx).labels.tableInsertControlLabel,
|
|
1279
|
+
title: (0, vue.unref)(ctx).labels.tableInsertControlLabel,
|
|
1280
|
+
onClick: _cache[0] || (_cache[0] = ($event) => opened.value ? close() : opened.value = true)
|
|
1281
|
+
}), {
|
|
1282
|
+
icon: (0, vue.withCtx)((iconProps) => [(0, vue.renderSlot)(_ctx.$slots, "icon", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), () => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(props.icon ?? (0, vue.unref)(IconTablePlus)), (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), null, 16))])]),
|
|
1283
|
+
_: 3
|
|
1284
|
+
}, 16, [
|
|
1285
|
+
"active",
|
|
1286
|
+
"disabled",
|
|
1287
|
+
"variant",
|
|
1288
|
+
"aria-label",
|
|
1289
|
+
"title"
|
|
1290
|
+
])]),
|
|
1291
|
+
_: 3
|
|
1292
|
+
}), (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Popover).Dropdown, (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("tableInsertDropdown", stylesApi.value))), {
|
|
1293
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)((0, vue.unref)(ctx).getStyles("tableInsertGrid", stylesApi.value), {
|
|
1294
|
+
style: { "--rte-table-insert-columns": props.maxColumns },
|
|
1295
|
+
onMouseleave: _cache[1] || (_cache[1] = ($event) => selected.value = {
|
|
1296
|
+
columns: 0,
|
|
1297
|
+
rows: 0
|
|
1298
|
+
})
|
|
1299
|
+
}), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(cells.value, (cell) => {
|
|
1300
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({ key: `${cell.row}-${cell.column}` }, { ref_for: true }, (0, vue.unref)(ctx).getStyles("tableInsertCell", stylesApi.value), {
|
|
1301
|
+
"data-active": cell.column <= selected.value.columns && cell.row <= selected.value.rows || void 0,
|
|
1302
|
+
"aria-label": (0, vue.unref)(ctx).labels.tableInsertLabel(cell.column, cell.row),
|
|
1303
|
+
onMouseenter: ($event) => selected.value = {
|
|
1304
|
+
columns: cell.column,
|
|
1305
|
+
rows: cell.row
|
|
1306
|
+
},
|
|
1307
|
+
onFocus: ($event) => selected.value = {
|
|
1308
|
+
columns: cell.column,
|
|
1309
|
+
rows: cell.row
|
|
1310
|
+
},
|
|
1311
|
+
onClick: ($event) => insertTable(cell.column, cell.row)
|
|
1312
|
+
}), null, 16, [
|
|
1313
|
+
"data-active",
|
|
1314
|
+
"aria-label",
|
|
1315
|
+
"onMouseenter",
|
|
1316
|
+
"onFocus",
|
|
1317
|
+
"onClick"
|
|
1318
|
+
]);
|
|
1319
|
+
}), 128))], 16), (0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(ctx).getStyles("tableInsertLabel", stylesApi.value))), (0, vue.toDisplayString)(selected.value.columns ? `${selected.value.columns} × ${selected.value.rows}` : (0, vue.unref)(ctx).labels.tableInsertControlLabel), 17)]),
|
|
1320
|
+
_: 1
|
|
1321
|
+
}, 16)]),
|
|
1322
|
+
_: 3
|
|
1323
|
+
}, 16, ["opened"]);
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/RichTextEditorControl/RichTextEditorDetailsControl.vue
|
|
1329
|
+
var RichTextEditorDetailsControl_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
1330
|
+
name: "RichTextEditorDetailsControl",
|
|
1331
|
+
inheritAttrs: false,
|
|
1332
|
+
__name: "RichTextEditorDetailsControl",
|
|
1333
|
+
props: {
|
|
1334
|
+
icon: { default: void 0 },
|
|
1335
|
+
classNames: {},
|
|
1336
|
+
styles: {},
|
|
1337
|
+
vars: {},
|
|
1338
|
+
unstyled: { type: Boolean },
|
|
1339
|
+
active: {
|
|
1340
|
+
type: Boolean,
|
|
1341
|
+
default: void 0
|
|
1342
|
+
},
|
|
1343
|
+
interactive: {
|
|
1344
|
+
type: Boolean,
|
|
1345
|
+
default: true
|
|
1346
|
+
},
|
|
1347
|
+
disabled: {
|
|
1348
|
+
type: Boolean,
|
|
1349
|
+
default: void 0
|
|
1350
|
+
},
|
|
1351
|
+
variant: {}
|
|
1352
|
+
},
|
|
1353
|
+
setup(__props) {
|
|
1354
|
+
const props = __props;
|
|
1355
|
+
const attrs = (0, vue.useAttrs)();
|
|
1356
|
+
const ctx = useRichTextEditorContext();
|
|
1357
|
+
const state = useEditorSelector(() => ctx.editor, (editor) => {
|
|
1358
|
+
const safeEditor = isSafeEditor(editor) ? editor : null;
|
|
1359
|
+
if (!safeEditor) return {
|
|
1360
|
+
active: false,
|
|
1361
|
+
disabled: true
|
|
1362
|
+
};
|
|
1363
|
+
const commands = safeEditor.can();
|
|
1364
|
+
const canSet = Boolean(commands.setDetails?.());
|
|
1365
|
+
const canUnset = Boolean(commands.unsetDetails?.());
|
|
1366
|
+
return {
|
|
1367
|
+
active: canUnset,
|
|
1368
|
+
disabled: !canSet && !canUnset
|
|
1369
|
+
};
|
|
1370
|
+
});
|
|
1371
|
+
const active = (0, vue.computed)(() => props.active ?? state.value.active);
|
|
1372
|
+
const disabled = (0, vue.computed)(() => props.disabled || state.value.disabled);
|
|
1373
|
+
function toggle() {
|
|
1374
|
+
if (!isSafeEditor(ctx.editor)) return;
|
|
1375
|
+
const chain = ctx.editor.chain().focus();
|
|
1376
|
+
if (ctx.editor.can().unsetDetails?.()) chain.unsetDetails().run();
|
|
1377
|
+
else chain.setDetails().run();
|
|
1378
|
+
}
|
|
1379
|
+
return (_ctx, _cache) => {
|
|
1380
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(RichTextEditorControlBase_default, (0, vue.mergeProps)((0, vue.unref)(attrs), {
|
|
1381
|
+
active: active.value,
|
|
1382
|
+
disabled: disabled.value,
|
|
1383
|
+
interactive: props.interactive,
|
|
1384
|
+
variant: props.variant ?? (0, vue.unref)(ctx).variant,
|
|
1385
|
+
"aria-label": (0, vue.unref)(ctx).labels.detailsControlLabel,
|
|
1386
|
+
title: (0, vue.unref)(ctx).labels.detailsControlLabel,
|
|
1387
|
+
onClick: toggle
|
|
1388
|
+
}), {
|
|
1389
|
+
icon: (0, vue.withCtx)((iconProps) => [(0, vue.renderSlot)(_ctx.$slots, "icon", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), () => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(props.icon ?? (0, vue.unref)(IconDetails)), (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), null, 16))])]),
|
|
1390
|
+
_: 3
|
|
1391
|
+
}, 16, [
|
|
1392
|
+
"active",
|
|
1393
|
+
"disabled",
|
|
1394
|
+
"interactive",
|
|
1395
|
+
"variant",
|
|
1396
|
+
"aria-label",
|
|
1397
|
+
"title"
|
|
1398
|
+
]);
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/RichTextEditorControl/RichTextEditorInvisibleCharactersControl.vue
|
|
1404
|
+
var RichTextEditorInvisibleCharactersControl_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
1405
|
+
name: "RichTextEditorInvisibleCharactersControl",
|
|
1406
|
+
inheritAttrs: false,
|
|
1407
|
+
__name: "RichTextEditorInvisibleCharactersControl",
|
|
1408
|
+
props: {
|
|
1409
|
+
icon: { default: void 0 },
|
|
1410
|
+
classNames: {},
|
|
1411
|
+
styles: {},
|
|
1412
|
+
vars: {},
|
|
1413
|
+
unstyled: { type: Boolean },
|
|
1414
|
+
active: {
|
|
1415
|
+
type: Boolean,
|
|
1416
|
+
default: void 0
|
|
1417
|
+
},
|
|
1418
|
+
interactive: {
|
|
1419
|
+
type: Boolean,
|
|
1420
|
+
default: true
|
|
1421
|
+
},
|
|
1422
|
+
disabled: {
|
|
1423
|
+
type: Boolean,
|
|
1424
|
+
default: void 0
|
|
1425
|
+
},
|
|
1426
|
+
variant: {}
|
|
1427
|
+
},
|
|
1428
|
+
setup(__props) {
|
|
1429
|
+
const props = __props;
|
|
1430
|
+
const attrs = (0, vue.useAttrs)();
|
|
1431
|
+
const ctx = useRichTextEditorContext();
|
|
1432
|
+
const state = useEditorSelector(() => ctx.editor, (editor) => {
|
|
1433
|
+
const safeEditor = isSafeEditor(editor) ? editor : null;
|
|
1434
|
+
if (!safeEditor) return {
|
|
1435
|
+
active: false,
|
|
1436
|
+
disabled: true
|
|
1437
|
+
};
|
|
1438
|
+
return {
|
|
1439
|
+
active: Boolean(safeEditor.storage.invisibleCharacters?.visibility?.()),
|
|
1440
|
+
disabled: !safeEditor.can().toggleInvisibleCharacters?.()
|
|
1441
|
+
};
|
|
1442
|
+
});
|
|
1443
|
+
const active = (0, vue.computed)(() => props.active ?? state.value.active);
|
|
1444
|
+
const disabled = (0, vue.computed)(() => props.disabled || state.value.disabled);
|
|
1445
|
+
function toggle() {
|
|
1446
|
+
if (isSafeEditor(ctx.editor)) ctx.editor.chain().focus().toggleInvisibleCharacters().run();
|
|
1447
|
+
}
|
|
1448
|
+
return (_ctx, _cache) => {
|
|
1449
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(RichTextEditorControlBase_default, (0, vue.mergeProps)((0, vue.unref)(attrs), {
|
|
1450
|
+
active: active.value,
|
|
1451
|
+
disabled: disabled.value,
|
|
1452
|
+
interactive: props.interactive,
|
|
1453
|
+
variant: props.variant ?? (0, vue.unref)(ctx).variant,
|
|
1454
|
+
"aria-label": (0, vue.unref)(ctx).labels.invisibleCharactersControlLabel,
|
|
1455
|
+
title: (0, vue.unref)(ctx).labels.invisibleCharactersControlLabel,
|
|
1456
|
+
onClick: toggle
|
|
1457
|
+
}), {
|
|
1458
|
+
icon: (0, vue.withCtx)((iconProps) => [(0, vue.renderSlot)(_ctx.$slots, "icon", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), () => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(props.icon ?? (0, vue.unref)(IconPilcrow)), (0, vue.normalizeProps)((0, vue.guardReactiveProps)(iconProps)), null, 16))])]),
|
|
1459
|
+
_: 3
|
|
1460
|
+
}, 16, [
|
|
1461
|
+
"active",
|
|
1462
|
+
"disabled",
|
|
1463
|
+
"interactive",
|
|
1464
|
+
"variant",
|
|
1465
|
+
"aria-label",
|
|
1466
|
+
"title"
|
|
1467
|
+
]);
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
//#endregion
|
|
1119
1472
|
//#region src/RichTextEditorControl/controls.ts
|
|
1120
1473
|
var BoldControl = createControl({
|
|
1121
1474
|
label: "boldControlLabel",
|
|
@@ -1349,6 +1702,72 @@ var TaskListLiftControl = createControl({
|
|
|
1349
1702
|
},
|
|
1350
1703
|
isDisabled: (editor) => !editor?.can().liftListItem("taskItem")
|
|
1351
1704
|
});
|
|
1705
|
+
var TableDeleteControl = createControl({
|
|
1706
|
+
label: "tableDeleteControlLabel",
|
|
1707
|
+
icon: IconTableOff,
|
|
1708
|
+
operation: { name: "deleteTable" },
|
|
1709
|
+
isDisabled: (editor) => !editor.can().deleteTable?.()
|
|
1710
|
+
});
|
|
1711
|
+
var TableColumnBeforeControl = createControl({
|
|
1712
|
+
label: "tableColumnBeforeControlLabel",
|
|
1713
|
+
icon: IconColumnInsertLeft,
|
|
1714
|
+
operation: { name: "addColumnBefore" },
|
|
1715
|
+
isDisabled: (editor) => !editor.can().addColumnBefore?.()
|
|
1716
|
+
});
|
|
1717
|
+
var TableColumnAfterControl = createControl({
|
|
1718
|
+
label: "tableColumnAfterControlLabel",
|
|
1719
|
+
icon: IconColumnInsertRight,
|
|
1720
|
+
operation: { name: "addColumnAfter" },
|
|
1721
|
+
isDisabled: (editor) => !editor.can().addColumnAfter?.()
|
|
1722
|
+
});
|
|
1723
|
+
var TableColumnDeleteControl = createControl({
|
|
1724
|
+
label: "tableColumnDeleteControlLabel",
|
|
1725
|
+
icon: IconColumnRemove,
|
|
1726
|
+
operation: { name: "deleteColumn" },
|
|
1727
|
+
isDisabled: (editor) => !editor.can().deleteColumn?.()
|
|
1728
|
+
});
|
|
1729
|
+
var TableRowBeforeControl = createControl({
|
|
1730
|
+
label: "tableRowBeforeControlLabel",
|
|
1731
|
+
icon: IconRowInsertTop,
|
|
1732
|
+
operation: { name: "addRowBefore" },
|
|
1733
|
+
isDisabled: (editor) => !editor.can().addRowBefore?.()
|
|
1734
|
+
});
|
|
1735
|
+
var TableRowAfterControl = createControl({
|
|
1736
|
+
label: "tableRowAfterControlLabel",
|
|
1737
|
+
icon: IconRowInsertBottom,
|
|
1738
|
+
operation: { name: "addRowAfter" },
|
|
1739
|
+
isDisabled: (editor) => !editor.can().addRowAfter?.()
|
|
1740
|
+
});
|
|
1741
|
+
var TableRowDeleteControl = createControl({
|
|
1742
|
+
label: "tableRowDeleteControlLabel",
|
|
1743
|
+
icon: IconRowRemove,
|
|
1744
|
+
operation: { name: "deleteRow" },
|
|
1745
|
+
isDisabled: (editor) => !editor.can().deleteRow?.()
|
|
1746
|
+
});
|
|
1747
|
+
var TableToggleHeaderRowControl = createControl({
|
|
1748
|
+
label: "tableToggleHeaderRowControlLabel",
|
|
1749
|
+
icon: IconTableHeaderRow,
|
|
1750
|
+
operation: { name: "toggleHeaderRow" },
|
|
1751
|
+
isDisabled: (editor) => !editor.can().toggleHeaderRow?.()
|
|
1752
|
+
});
|
|
1753
|
+
var TableToggleHeaderColumnControl = createControl({
|
|
1754
|
+
label: "tableToggleHeaderColumnControlLabel",
|
|
1755
|
+
icon: IconTableHeaderColumn,
|
|
1756
|
+
operation: { name: "toggleHeaderColumn" },
|
|
1757
|
+
isDisabled: (editor) => !editor.can().toggleHeaderColumn?.()
|
|
1758
|
+
});
|
|
1759
|
+
var TableMergeCellsControl = createControl({
|
|
1760
|
+
label: "tableMergeCellsControlLabel",
|
|
1761
|
+
icon: IconTableMergeCells,
|
|
1762
|
+
operation: { name: "mergeCells" },
|
|
1763
|
+
isDisabled: (editor) => !editor.can().mergeCells?.()
|
|
1764
|
+
});
|
|
1765
|
+
var TableSplitCellControl = createControl({
|
|
1766
|
+
label: "tableSplitCellControlLabel",
|
|
1767
|
+
icon: IconTableSplitCell,
|
|
1768
|
+
operation: { name: "splitCell" },
|
|
1769
|
+
isDisabled: (editor) => !editor.can().splitCell?.()
|
|
1770
|
+
});
|
|
1352
1771
|
//#endregion
|
|
1353
1772
|
//#region src/RichTextEditorControlsGroup/RichTextEditorControlsGroup.vue
|
|
1354
1773
|
var RichTextEditorControlsGroup_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -1482,7 +1901,21 @@ var RichTextEditor = (0, _mantine_vue_core.factory)(RichTextEditor_default, {
|
|
|
1482
1901
|
TaskList: TaskListControl,
|
|
1483
1902
|
TaskListSink: TaskListSinkControl,
|
|
1484
1903
|
TaskListLift: TaskListLiftControl,
|
|
1485
|
-
SourceCode: RichTextEditorSourceCodeControl
|
|
1904
|
+
SourceCode: RichTextEditorSourceCodeControl,
|
|
1905
|
+
TableInsert: RichTextEditorTableInsertControl_default,
|
|
1906
|
+
TableDelete: TableDeleteControl,
|
|
1907
|
+
TableColumnBefore: TableColumnBeforeControl,
|
|
1908
|
+
TableColumnAfter: TableColumnAfterControl,
|
|
1909
|
+
TableColumnDelete: TableColumnDeleteControl,
|
|
1910
|
+
TableRowBefore: TableRowBeforeControl,
|
|
1911
|
+
TableRowAfter: TableRowAfterControl,
|
|
1912
|
+
TableRowDelete: TableRowDeleteControl,
|
|
1913
|
+
TableToggleHeaderRow: TableToggleHeaderRowControl,
|
|
1914
|
+
TableToggleHeaderColumn: TableToggleHeaderColumnControl,
|
|
1915
|
+
TableMergeCells: TableMergeCellsControl,
|
|
1916
|
+
TableSplitCell: TableSplitCellControl,
|
|
1917
|
+
Details: RichTextEditorDetailsControl_default,
|
|
1918
|
+
InvisibleCharacters: RichTextEditorInvisibleCharactersControl_default
|
|
1486
1919
|
});
|
|
1487
1920
|
//#endregion
|
|
1488
1921
|
//#region src/extensions/Link.ts
|
|
@@ -1531,11 +1964,25 @@ exports.RichTextEditorColorControl = RichTextEditorColorControl;
|
|
|
1531
1964
|
exports.RichTextEditorColorPickerControl = RichTextEditorColorPickerControl;
|
|
1532
1965
|
exports.RichTextEditorControl = RichTextEditorControl;
|
|
1533
1966
|
exports.RichTextEditorControlBase = RichTextEditorControlBase;
|
|
1967
|
+
exports.RichTextEditorDetailsControl = RichTextEditorDetailsControl_default;
|
|
1968
|
+
exports.RichTextEditorInvisibleCharactersControl = RichTextEditorInvisibleCharactersControl_default;
|
|
1534
1969
|
exports.RichTextEditorLinkControl = RichTextEditorLinkControl;
|
|
1535
1970
|
exports.RichTextEditorSourceCodeControl = RichTextEditorSourceCodeControl;
|
|
1971
|
+
exports.RichTextEditorTableInsertControl = RichTextEditorTableInsertControl_default;
|
|
1536
1972
|
exports.StrikeThroughControl = StrikeThroughControl;
|
|
1537
1973
|
exports.SubscriptControl = SubscriptControl;
|
|
1538
1974
|
exports.SuperscriptControl = SuperscriptControl;
|
|
1975
|
+
exports.TableColumnAfterControl = TableColumnAfterControl;
|
|
1976
|
+
exports.TableColumnBeforeControl = TableColumnBeforeControl;
|
|
1977
|
+
exports.TableColumnDeleteControl = TableColumnDeleteControl;
|
|
1978
|
+
exports.TableDeleteControl = TableDeleteControl;
|
|
1979
|
+
exports.TableMergeCellsControl = TableMergeCellsControl;
|
|
1980
|
+
exports.TableRowAfterControl = TableRowAfterControl;
|
|
1981
|
+
exports.TableRowBeforeControl = TableRowBeforeControl;
|
|
1982
|
+
exports.TableRowDeleteControl = TableRowDeleteControl;
|
|
1983
|
+
exports.TableSplitCellControl = TableSplitCellControl;
|
|
1984
|
+
exports.TableToggleHeaderColumnControl = TableToggleHeaderColumnControl;
|
|
1985
|
+
exports.TableToggleHeaderRowControl = TableToggleHeaderRowControl;
|
|
1539
1986
|
exports.TaskListControl = TaskListControl;
|
|
1540
1987
|
exports.TaskListLiftControl = TaskListLiftControl;
|
|
1541
1988
|
exports.TaskListSinkControl = TaskListSinkControl;
|