@jvs-milkdown/crepe 1.2.5 → 1.2.8
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/lib/cjs/builder.js +2 -0
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +6 -2
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +2 -0
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +2 -0
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +3 -4
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +2 -0
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +2 -0
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +2 -0
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +4 -1
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +2 -0
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +242 -7
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +1243 -967
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +2 -0
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +6 -2
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +2 -0
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +2 -0
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +3 -4
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +2 -0
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +2 -0
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +2 -0
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +4 -1
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +2 -0
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +242 -7
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +1314 -1038
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/table.css +11 -7
- package/lib/theme/common/toolbar.css +6 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/locale.d.ts +2 -0
- package/lib/types/core/locale.d.ts.map +1 -1
- package/lib/types/feature/attachment/view/components/attachment-block.d.ts.map +1 -1
- package/lib/types/feature/attachment/view/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/api.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts +9 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/document-header.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/index.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/menu-bar.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/outline-panel.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/shortcut-help-modal.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/view-menu-state.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +1 -1
- package/lib/types/feature/index.d.ts.map +1 -1
- package/lib/types/feature/latex/inline-tooltip/component.d.ts.map +1 -1
- package/lib/types/feature/latex/inline-tooltip/view.d.ts.map +1 -1
- package/lib/types/feature/loader.d.ts.map +1 -1
- package/lib/types/feature/placeholder/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/color.d.ts +1 -1
- package/lib/types/feature/toolbar/color.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/font.d.ts +1 -1
- package/lib/types/feature/toolbar/highlight-mark.d.ts +1 -1
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/underline.d.ts +1 -1
- package/lib/types/icons/crop.d.ts +1 -1
- package/lib/types/icons/crop.d.ts.map +1 -1
- package/lib/types/icons/format-painter.d.ts +2 -0
- package/lib/types/icons/format-painter.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +1 -0
- package/lib/types/icons/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/locale.ts +2 -0
- package/src/feature/attachment/view/components/attachment-block.tsx +12 -7
- package/src/feature/attachment/view/index.ts +1 -0
- package/src/feature/block-edit/handle/component.tsx +5 -4
- package/src/feature/block-edit/handle/index.ts +1 -0
- package/src/feature/block-edit/index.ts +4 -1
- package/src/feature/block-edit/menu/api.ts +6 -1
- package/src/feature/block-edit/menu/component.tsx +49 -46
- package/src/feature/block-edit/menu/index.ts +1 -0
- package/src/feature/fixed-toolbar/component.tsx +3 -2
- package/src/feature/fixed-toolbar/config.ts +201 -146
- package/src/feature/fixed-toolbar/document-header.tsx +22 -12
- package/src/feature/fixed-toolbar/index.ts +2 -1
- package/src/feature/fixed-toolbar/menu-bar.tsx +15 -10
- package/src/feature/fixed-toolbar/outline-panel.tsx +17 -16
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +3 -2
- package/src/feature/fixed-toolbar/view-menu-state.ts +1 -0
- package/src/feature/index.ts +2 -2
- package/src/feature/latex/inline-tooltip/component.tsx +3 -2
- package/src/feature/latex/inline-tooltip/view.ts +1 -0
- package/src/feature/loader.ts +1 -1
- package/src/feature/placeholder/index.ts +2 -1
- package/src/feature/toolbar/color.ts +77 -73
- package/src/feature/toolbar/component.tsx +321 -35
- package/src/feature/toolbar/index.ts +1 -0
- package/src/icons/align-center.ts +1 -1
- package/src/icons/bold.ts +1 -1
- package/src/icons/bullet-list.ts +1 -1
- package/src/icons/crop.ts +1 -4
- package/src/icons/divider.ts +1 -1
- package/src/icons/format-painter.ts +5 -0
- package/src/icons/h2.ts +1 -1
- package/src/icons/index.ts +1 -0
- package/src/icons/ordered-list.ts +1 -1
- package/src/icons/quote.ts +1 -1
- package/src/icons/strikethrough.ts +1 -1
- package/src/icons/text.ts +0 -1
- package/src/theme/common/table.css +11 -7
- package/src/theme/common/toolbar.css +6 -6
- package/src/feature/table/test.ts +0 -9
|
@@ -31,6 +31,7 @@ const zhCN = {
|
|
|
31
31
|
"toolbar.heading": "\u6807\u9898",
|
|
32
32
|
"toolbar.formatting": "\u683C\u5F0F",
|
|
33
33
|
"toolbar.function": "\u529F\u80FD",
|
|
34
|
+
"toolbar.formatPainter": "\u683C\u5F0F\u5237",
|
|
34
35
|
// menu bar
|
|
35
36
|
"menuBar.file": "\u6587\u4EF6",
|
|
36
37
|
"menuBar.edit": "\u7F16\u8F91",
|
|
@@ -184,6 +185,7 @@ const enUS = {
|
|
|
184
185
|
"toolbar.heading": "Heading",
|
|
185
186
|
"toolbar.formatting": "Formatting",
|
|
186
187
|
"toolbar.function": "Function",
|
|
188
|
+
"toolbar.formatPainter": "Format Painter",
|
|
187
189
|
"menuBar.file": "File",
|
|
188
190
|
"menuBar.edit": "Edit",
|
|
189
191
|
"menuBar.view": "View",
|
|
@@ -1014,6 +1016,12 @@ const splitCellIcon = `
|
|
|
1014
1016
|
</svg>
|
|
1015
1017
|
`;
|
|
1016
1018
|
|
|
1019
|
+
const formatPainterIcon = `
|
|
1020
|
+
<svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
|
|
1021
|
+
<path d="M454.698667 302.506667H323.84q-23.04 0-41.6 13.824-18.517333 13.824-25.130667 35.968l-31.36 104.704q-10.112 33.621333 10.794667 61.738666 11.52 15.445333 27.221333 22.442667 0.853333 46.165333-0.810666 105.6-1.408 51.84-58.368 138.496-23.338667 35.413333-3.413334 72.96 20.053333 37.76 62.677334 37.76h477.994666q39.509333 0 69.077334-26.325333 29.738667-26.453333 34.090666-65.962667 10.24-93.738667 10.24-155.946667 0-57.088-8.618666-103.68 20.949333-6.058667 35.285333-25.344 20.864-28.117333 10.837333-61.738666l-31.36-104.704q-6.656-22.144-25.173333-35.968-18.517333-13.781333-41.6-13.781334h-130.858667V197.802667q0-28.885333-20.437333-49.365334Q622.933333 128 594.090667 128H524.373333q-28.842667 0-49.237333 20.48-20.437333 20.437333-20.437333 49.322667v104.746666z m68.992 41.728q0.682667-3.370667 0.682666-6.784V197.802667h69.717334V337.493333q0 3.413333 0.64 6.826667 0.682667 3.370667 2.005333 6.528 1.28 3.2 3.2 6.058667 1.92 2.816 4.352 5.248 2.389333 2.474667 5.248 4.352 2.901333 1.92 6.058667 3.242666 3.157333 1.322667 6.528 1.962667 3.328 0.682667 6.826666 0.682667h165.674667l31.36 104.746666H292.48l31.36-104.746666h165.717333q3.413333 0 6.826667-0.64 3.328-0.682667 6.528-2.005334 3.157333-1.322667 5.973333-3.242666 2.858667-1.877333 5.290667-4.352 2.432-2.432 4.309333-5.248 1.92-2.901333 3.242667-6.058667 1.322667-3.157333 1.962667-6.570667z m252.501333 202.666666q9.429333 43.648 9.429333 100.864 0 58.368-9.813333 148.352-1.450667 12.757333-11.093333 21.376-9.813333 8.704-22.826667 8.704h-100.309333q22.058667-81.493333 22.058666-174.592h-69.674666q0 94.421333-24.96 174.592h-121.514667q41.941333-81.450667 41.941333-174.592H419.754667q0 94.378667-52.992 174.592H263.808q-0.725333 0-1.109333-0.725333-0.469333-0.981333 0.042666-1.749333 67.968-103.253333 69.888-175.018667 1.536-56.533333 0.938667-101.802667H776.106667z" fill="currentColor" p-id="11997"></path>
|
|
1022
|
+
</svg>
|
|
1023
|
+
`;
|
|
1024
|
+
|
|
1017
1025
|
function keepAlive(..._args) {
|
|
1018
1026
|
}
|
|
1019
1027
|
|
|
@@ -2296,7 +2304,7 @@ defineComponent({
|
|
|
2296
2304
|
});
|
|
2297
2305
|
return () => {
|
|
2298
2306
|
var _a, _b, _c;
|
|
2299
|
-
show.value;
|
|
2307
|
+
void show.value;
|
|
2300
2308
|
const api = ctx.get(menuAPI.key);
|
|
2301
2309
|
const showListMenu = (api == null ? void 0 : api.getMode()) === "list" || !(api == null ? void 0 : api.isProgrammatic()) || filter.value !== "";
|
|
2302
2310
|
if (showListMenu) {
|
|
@@ -3042,7 +3050,9 @@ defineComponent({
|
|
|
3042
3050
|
var _a2;
|
|
3043
3051
|
e.preventDefault();
|
|
3044
3052
|
e.stopPropagation();
|
|
3045
|
-
(_a2 = host.value) == null ? void 0 : _a2.querySelectorAll(`[data-index="${item.index}"]`).forEach(
|
|
3053
|
+
(_a2 = host.value) == null ? void 0 : _a2.querySelectorAll(`[data-index="${item.index}"]`).forEach(
|
|
3054
|
+
(el) => el.classList.remove("active")
|
|
3055
|
+
);
|
|
3046
3056
|
runByIndexForAddBelow(item.index);
|
|
3047
3057
|
}
|
|
3048
3058
|
},
|
|
@@ -4090,6 +4100,10 @@ const activeIconMap = {
|
|
|
4090
4100
|
// [highLineCodeIcon]: highLineCodeIconActive,
|
|
4091
4101
|
};
|
|
4092
4102
|
keepAlive(h, Fragment);
|
|
4103
|
+
const formatPainterStates = /* @__PURE__ */ new WeakMap();
|
|
4104
|
+
const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
|
|
4105
|
+
const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
|
|
4106
|
+
const cursorStyleEls = /* @__PURE__ */ new WeakMap();
|
|
4093
4107
|
const Toolbar = defineComponent({
|
|
4094
4108
|
props: {
|
|
4095
4109
|
ctx: { type: Object, required: true },
|
|
@@ -4120,6 +4134,184 @@ const Toolbar = defineComponent({
|
|
|
4120
4134
|
const tableMenuPos = ref({ top: 0, left: 0 });
|
|
4121
4135
|
const tableHoverIndices = ref({ r: 0, c: 0 });
|
|
4122
4136
|
let hideTableTimer = null;
|
|
4137
|
+
let formatPainterState = formatPainterStates.get(ctx);
|
|
4138
|
+
if (!formatPainterState) {
|
|
4139
|
+
formatPainterState = ref(null);
|
|
4140
|
+
formatPainterStates.set(ctx, formatPainterState);
|
|
4141
|
+
}
|
|
4142
|
+
let formatPainterIgnore = formatPainterIgnoreNext.get(ctx);
|
|
4143
|
+
if (!formatPainterIgnore) {
|
|
4144
|
+
formatPainterIgnore = { value: false };
|
|
4145
|
+
formatPainterIgnoreNext.set(ctx, formatPainterIgnore);
|
|
4146
|
+
}
|
|
4147
|
+
let formatPainterHandler = formatPainterHandlers.get(ctx);
|
|
4148
|
+
if (!formatPainterHandler) {
|
|
4149
|
+
formatPainterHandler = (ev) => {
|
|
4150
|
+
if (!formatPainterState.value) return;
|
|
4151
|
+
if (formatPainterIgnore.value) {
|
|
4152
|
+
formatPainterIgnore.value = false;
|
|
4153
|
+
return;
|
|
4154
|
+
}
|
|
4155
|
+
const currentView = ctx.get(editorViewCtx);
|
|
4156
|
+
const targetElement = ev.target instanceof Element ? ev.target : ev.target.parentElement;
|
|
4157
|
+
if (targetElement && targetElement.closest(".milkdown-toolbar, .milkdown-fixed-toolbar")) {
|
|
4158
|
+
return;
|
|
4159
|
+
}
|
|
4160
|
+
setTimeout(() => {
|
|
4161
|
+
if (!formatPainterState.value) return;
|
|
4162
|
+
const { state: curState, dispatch } = currentView;
|
|
4163
|
+
const { selection: curSelection, tr } = curState;
|
|
4164
|
+
const {
|
|
4165
|
+
marks: savedMarks,
|
|
4166
|
+
align: savedAlign,
|
|
4167
|
+
isPersistent
|
|
4168
|
+
} = formatPainterState.value;
|
|
4169
|
+
let applied = false;
|
|
4170
|
+
if (!curSelection.empty) {
|
|
4171
|
+
savedMarks.forEach((m) => {
|
|
4172
|
+
tr.addMark(curSelection.from, curSelection.to, m);
|
|
4173
|
+
});
|
|
4174
|
+
if (savedAlign) {
|
|
4175
|
+
curState.doc.nodesBetween(
|
|
4176
|
+
curSelection.from,
|
|
4177
|
+
curSelection.to,
|
|
4178
|
+
(node, pos) => {
|
|
4179
|
+
if (node.type.name === "paragraph" || node.type.name === "heading") {
|
|
4180
|
+
tr.setNodeMarkup(pos, null, {
|
|
4181
|
+
...node.attrs,
|
|
4182
|
+
align: savedAlign
|
|
4183
|
+
});
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
);
|
|
4187
|
+
}
|
|
4188
|
+
dispatch(tr);
|
|
4189
|
+
applied = true;
|
|
4190
|
+
} else {
|
|
4191
|
+
if (savedMarks.length > 0) {
|
|
4192
|
+
const $pos = curSelection.$from;
|
|
4193
|
+
if ($pos.parent.isTextblock) {
|
|
4194
|
+
const text = $pos.parent.textContent;
|
|
4195
|
+
const offset = $pos.parentOffset;
|
|
4196
|
+
let start = offset;
|
|
4197
|
+
let end = offset;
|
|
4198
|
+
const isWordChar = (char) => !/[\s,.\-!?;:()[\]{}"'“”‘’,。!?;:()【】《》、\n\r]/.test(
|
|
4199
|
+
char
|
|
4200
|
+
);
|
|
4201
|
+
while (start > 0 && isWordChar(text[start - 1])) start--;
|
|
4202
|
+
while (end < text.length && isWordChar(text[end])) end++;
|
|
4203
|
+
if (start < end) {
|
|
4204
|
+
savedMarks.forEach((m) => {
|
|
4205
|
+
tr.addMark($pos.start() + start, $pos.start() + end, m);
|
|
4206
|
+
});
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
if (savedAlign) {
|
|
4211
|
+
const pos = curSelection.$from.before(curSelection.$from.depth);
|
|
4212
|
+
const node = curState.doc.nodeAt(pos);
|
|
4213
|
+
if (node && (node.type.name === "paragraph" || node.type.name === "heading")) {
|
|
4214
|
+
tr.setNodeMarkup(pos, null, {
|
|
4215
|
+
...node.attrs,
|
|
4216
|
+
align: savedAlign
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
tr.setStoredMarks(savedMarks);
|
|
4221
|
+
dispatch(tr);
|
|
4222
|
+
applied = true;
|
|
4223
|
+
}
|
|
4224
|
+
if (applied && !isPersistent) {
|
|
4225
|
+
formatPainterState.value = null;
|
|
4226
|
+
document.removeEventListener("pointerup", formatPainterHandler);
|
|
4227
|
+
}
|
|
4228
|
+
}, 50);
|
|
4229
|
+
};
|
|
4230
|
+
formatPainterHandlers.set(ctx, formatPainterHandler);
|
|
4231
|
+
}
|
|
4232
|
+
const toggleFormatPainter = (isPersistent) => {
|
|
4233
|
+
const view = ctx.get(editorViewCtx);
|
|
4234
|
+
const { state } = view;
|
|
4235
|
+
const { selection } = state;
|
|
4236
|
+
let marks = [];
|
|
4237
|
+
if (selection.empty) {
|
|
4238
|
+
marks = state.storedMarks ? [...state.storedMarks] : [...selection.$from.marks()];
|
|
4239
|
+
} else {
|
|
4240
|
+
let foundMarks = null;
|
|
4241
|
+
state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
4242
|
+
if (foundMarks) return false;
|
|
4243
|
+
if (node.isInline) {
|
|
4244
|
+
foundMarks = [...node.marks];
|
|
4245
|
+
return false;
|
|
4246
|
+
}
|
|
4247
|
+
return void 0;
|
|
4248
|
+
});
|
|
4249
|
+
marks = foundMarks || [];
|
|
4250
|
+
}
|
|
4251
|
+
let align = null;
|
|
4252
|
+
let foundAlign = null;
|
|
4253
|
+
state.doc.nodesBetween(selection.from, selection.to, (node) => {
|
|
4254
|
+
if (foundAlign) return false;
|
|
4255
|
+
if (node.isBlock && (node.type.name === "paragraph" || node.type.name === "heading")) {
|
|
4256
|
+
foundAlign = node.attrs.align || null;
|
|
4257
|
+
return false;
|
|
4258
|
+
}
|
|
4259
|
+
return void 0;
|
|
4260
|
+
});
|
|
4261
|
+
if (!foundAlign) {
|
|
4262
|
+
const parent = selection.$from.parent;
|
|
4263
|
+
if (parent && (parent.type.name === "paragraph" || parent.type.name === "heading")) {
|
|
4264
|
+
foundAlign = parent.attrs.align || null;
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
align = foundAlign;
|
|
4268
|
+
formatPainterState.value = { marks, align, isPersistent };
|
|
4269
|
+
document.removeEventListener("pointerup", formatPainterHandler);
|
|
4270
|
+
setTimeout(() => {
|
|
4271
|
+
document.addEventListener("pointerup", formatPainterHandler);
|
|
4272
|
+
}, 0);
|
|
4273
|
+
};
|
|
4274
|
+
const handleFormatPainterClick = (e) => {
|
|
4275
|
+
e.preventDefault();
|
|
4276
|
+
e.stopPropagation();
|
|
4277
|
+
if (formatPainterState.value) {
|
|
4278
|
+
formatPainterState.value = null;
|
|
4279
|
+
document.removeEventListener("pointerup", formatPainterHandler);
|
|
4280
|
+
} else {
|
|
4281
|
+
formatPainterIgnore.value = true;
|
|
4282
|
+
toggleFormatPainter(false);
|
|
4283
|
+
}
|
|
4284
|
+
};
|
|
4285
|
+
const handleFormatPainterDblClick = (e) => {
|
|
4286
|
+
e.preventDefault();
|
|
4287
|
+
e.stopPropagation();
|
|
4288
|
+
toggleFormatPainter(true);
|
|
4289
|
+
};
|
|
4290
|
+
watch(
|
|
4291
|
+
() => formatPainterState.value,
|
|
4292
|
+
(newVal) => {
|
|
4293
|
+
if (newVal) {
|
|
4294
|
+
let cursorStyleEl = cursorStyleEls.get(ctx);
|
|
4295
|
+
if (!cursorStyleEl) {
|
|
4296
|
+
cursorStyleEl = document.createElement("style");
|
|
4297
|
+
const encodedSvg = encodeURIComponent(
|
|
4298
|
+
formatPainterIcon.replace(/currentColor/g, "#363B4C")
|
|
4299
|
+
);
|
|
4300
|
+
cursorStyleEl.innerHTML = `.milkdown .ProseMirror, .milkdown .ProseMirror * { cursor: url("data:image/svg+xml;utf8,${encodedSvg}") 0 16, auto !important; }`;
|
|
4301
|
+
document.head.appendChild(cursorStyleEl);
|
|
4302
|
+
cursorStyleEls.set(ctx, cursorStyleEl);
|
|
4303
|
+
}
|
|
4304
|
+
} else {
|
|
4305
|
+
const cursorStyleEl = cursorStyleEls.get(ctx);
|
|
4306
|
+
if (cursorStyleEl) {
|
|
4307
|
+
cursorStyleEl.remove();
|
|
4308
|
+
cursorStyleEls.delete(ctx);
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4312
|
+
);
|
|
4313
|
+
onUnmounted(() => {
|
|
4314
|
+
});
|
|
4123
4315
|
const toolbarContainerRef = ref(null);
|
|
4124
4316
|
const overflowVisibleCount = ref(Infinity);
|
|
4125
4317
|
const totalSectionCount = ref(Infinity);
|
|
@@ -4826,7 +5018,7 @@ const Toolbar = defineComponent({
|
|
|
4826
5018
|
position: "relative",
|
|
4827
5019
|
display: isSectionOverflowed(0) ? "none" : "flex",
|
|
4828
5020
|
alignItems: "center",
|
|
4829
|
-
padding: "0
|
|
5021
|
+
padding: "0 6px",
|
|
4830
5022
|
flexShrink: 0
|
|
4831
5023
|
}
|
|
4832
5024
|
},
|
|
@@ -4845,6 +5037,49 @@ const Toolbar = defineComponent({
|
|
|
4845
5037
|
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
4846
5038
|
)
|
|
4847
5039
|
),
|
|
5040
|
+
/* @__PURE__ */ h(
|
|
5041
|
+
"div",
|
|
5042
|
+
{
|
|
5043
|
+
style: {
|
|
5044
|
+
position: "relative",
|
|
5045
|
+
display: isSectionOverflowed(0) ? "none" : "flex",
|
|
5046
|
+
flexShrink: 0
|
|
5047
|
+
}
|
|
5048
|
+
},
|
|
5049
|
+
/* @__PURE__ */ h(
|
|
5050
|
+
"button",
|
|
5051
|
+
{
|
|
5052
|
+
type: "button",
|
|
5053
|
+
class: clsx(
|
|
5054
|
+
"toolbar-item",
|
|
5055
|
+
formatPainterState.value && "active"
|
|
5056
|
+
),
|
|
5057
|
+
onPointerdown: (e) => {
|
|
5058
|
+
e.preventDefault();
|
|
5059
|
+
handleFormatPainterClick(e);
|
|
5060
|
+
},
|
|
5061
|
+
onDblclick: handleFormatPainterDblClick,
|
|
5062
|
+
title: i18n(ctx, "toolbar.formatPainter") || "Format Painter",
|
|
5063
|
+
style: {
|
|
5064
|
+
display: "flex",
|
|
5065
|
+
alignItems: "center",
|
|
5066
|
+
justifyContent: "center",
|
|
5067
|
+
backgroundColor: formatPainterState.value ? "var(--crepe-color-selected, var(--crepe-color-hover))" : void 0
|
|
5068
|
+
}
|
|
5069
|
+
},
|
|
5070
|
+
/* @__PURE__ */ h(
|
|
5071
|
+
"span",
|
|
5072
|
+
{
|
|
5073
|
+
style: {
|
|
5074
|
+
display: "inline-flex",
|
|
5075
|
+
alignItems: "center",
|
|
5076
|
+
"--toolbar-icon-color": formatPainterState.value ? "var(--crepe-color-primary)" : "#363B4C"
|
|
5077
|
+
},
|
|
5078
|
+
innerHTML: formatPainterIcon
|
|
5079
|
+
}
|
|
5080
|
+
)
|
|
5081
|
+
)
|
|
5082
|
+
),
|
|
4848
5083
|
/* @__PURE__ */ h(
|
|
4849
5084
|
"div",
|
|
4850
5085
|
{
|
|
@@ -4867,7 +5102,7 @@ const Toolbar = defineComponent({
|
|
|
4867
5102
|
position: "relative",
|
|
4868
5103
|
display: isSectionOverflowed(2) ? "none" : "flex",
|
|
4869
5104
|
alignItems: "center",
|
|
4870
|
-
padding: "0
|
|
5105
|
+
padding: "0 6px",
|
|
4871
5106
|
minWidth: "50px",
|
|
4872
5107
|
flexShrink: 0
|
|
4873
5108
|
}
|
|
@@ -4909,7 +5144,7 @@ const Toolbar = defineComponent({
|
|
|
4909
5144
|
position: "relative",
|
|
4910
5145
|
display: isSectionOverflowed(3) ? "none" : "flex",
|
|
4911
5146
|
alignItems: "center",
|
|
4912
|
-
padding: "0
|
|
5147
|
+
padding: "0 6px",
|
|
4913
5148
|
minWidth: "40px",
|
|
4914
5149
|
flexShrink: 0
|
|
4915
5150
|
}
|
|
@@ -4950,7 +5185,7 @@ const Toolbar = defineComponent({
|
|
|
4950
5185
|
position: "relative",
|
|
4951
5186
|
display: isSectionOverflowed(5) ? "none" : "flex",
|
|
4952
5187
|
alignItems: "center",
|
|
4953
|
-
padding: "0
|
|
5188
|
+
padding: "0 6px",
|
|
4954
5189
|
flexShrink: 0
|
|
4955
5190
|
}
|
|
4956
5191
|
},
|
|
@@ -5987,7 +6222,7 @@ const Toolbar = defineComponent({
|
|
|
5987
6222
|
ctx && checkActive(item.active) ? activeIconMap[item.icon] || item.icon : item.icon,
|
|
5988
6223
|
item.label,
|
|
5989
6224
|
ctx ? checkActive(item.active) : false,
|
|
5990
|
-
isTable ? void 0 : (
|
|
6225
|
+
isTable ? void 0 : (_e) => {
|
|
5991
6226
|
item.onRun(ctx);
|
|
5992
6227
|
showOverflowMenu.value = false;
|
|
5993
6228
|
},
|