@4399ywkf/editor 0.8.1 → 0.9.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/README.md +45 -27
- package/dist/{DocView-WEKRSKRU.js → DocView-R4E7QINT.js} +3 -3
- package/dist/{DocView-WEKRSKRU.js.map → DocView-R4E7QINT.js.map} +1 -1
- package/dist/SheetView-YFK7BUS5.js +3 -0
- package/dist/{SheetView-SDBRSTVS.js.map → SheetView-YFK7BUS5.js.map} +1 -1
- package/dist/{chunk-KRP5V7VF.js → chunk-2DI4FJPC.js} +10 -3
- package/dist/chunk-2DI4FJPC.js.map +1 -0
- package/dist/{chunk-DGUNVCOM.js → chunk-3QTRZBIK.js} +111 -26
- package/dist/chunk-3QTRZBIK.js.map +1 -0
- package/dist/chunk-JWHQF2CZ.js +257 -0
- package/dist/chunk-JWHQF2CZ.js.map +1 -0
- package/dist/{chunk-WF7PIIFR.js → chunk-JZ67Q3QI.js} +4 -4
- package/dist/chunk-JZ67Q3QI.js.map +1 -0
- package/dist/{chunk-SGLNT6Z2.js → chunk-OGRGQQ3D.js} +422 -192
- package/dist/chunk-OGRGQQ3D.js.map +1 -0
- package/dist/{chunk-SBTKDJAL.js → chunk-SDVGDHC4.js} +45 -3
- package/dist/chunk-SDVGDHC4.js.map +1 -0
- package/dist/{chunk-HPSPOM2O.js → chunk-XB6FEC4I.js} +3 -3
- package/dist/chunk-XB6FEC4I.js.map +1 -0
- package/dist/{csv-parse-D0zTBvDB.d.ts → csv-parse-DXlwzoZ6.d.ts} +28 -1
- package/dist/csv.d.ts +2 -2
- package/dist/csv.js +4 -4
- package/dist/doc.d.ts +15 -5
- package/dist/doc.js +1 -1
- package/dist/import-O7RUERND.js +6 -0
- package/dist/{import-GVZDLWA2.js.map → import-O7RUERND.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pdf.d.ts +1 -1
- package/dist/pptx.d.ts +1 -1
- package/dist/{registry-CYKivRDh.d.ts → registry-BQ5T1Yko.d.ts} +9 -16
- package/dist/sheet-runtime.d.ts +10 -8
- package/dist/sheet-runtime.js +6 -14
- package/dist/sheet-runtime.js.map +1 -1
- package/dist/sheet.d.ts +4 -3
- package/dist/sheet.js +1 -1
- package/dist/style.css +58 -1
- package/dist/xlsx.d.ts +12 -11
- package/dist/xlsx.js +121 -32
- package/dist/xlsx.js.map +1 -1
- package/package.json +47 -3
- package/dist/SheetView-SDBRSTVS.js +0 -3
- package/dist/chunk-DGUNVCOM.js.map +0 -1
- package/dist/chunk-HPSPOM2O.js.map +0 -1
- package/dist/chunk-KRP5V7VF.js.map +0 -1
- package/dist/chunk-SBTKDJAL.js.map +0 -1
- package/dist/chunk-SGLNT6Z2.js.map +0 -1
- package/dist/chunk-SYCK6Y5F.js +0 -89
- package/dist/chunk-SYCK6Y5F.js.map +0 -1
- package/dist/chunk-WF7PIIFR.js.map +0 -1
- package/dist/import-GVZDLWA2.js +0 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useTiptapEditor, isExtensionAvailable, isNodeInSchema, Button, cn, getSelectionBoundingRect, isSelectionValid, getSelectedNodesOfType, selectCurrentBlockContent, Popover, PopoverTrigger, PopoverContent, isValidPosition, updateNodesAttr, parseShortcutKeys, isMarkInSchema, isNodeTypeSelected, SR_ONLY,
|
|
1
|
+
import { useTiptapEditor, isExtensionAvailable, isNodeInSchema, Button, cn, getSelectionBoundingRect, isSelectionValid, getSelectedNodesOfType, selectCurrentBlockContent, Popover, PopoverTrigger, PopoverContent, isValidPosition, updateNodesAttr, parseShortcutKeys, isMarkInSchema, isNodeTypeSelected, SR_ONLY, selectionWithinConvertibleTypes, getSelectedBlockNodes, findNodePosition, sanitizeUrl, clamp, focusNextNode, getAvatar, getUrlParam, handleImageUpload, getNodeDisplayName, isTextSelectionValid, AIButton, getElementOverflowPosition } from './chunk-QMYT5WXO.js';
|
|
2
2
|
import { createCodeHighlighter, getCodeBlockTitle, resolveShikiTheme } from './chunk-ZY5KLA7T.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createContext, memo, forwardRef, useState, useCallback, useRef, useEffect, useMemo, useLayoutEffect, useContext, Children, isValidElement, cloneElement } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
6
6
|
import { PluginKey, Plugin, TextSelection, Selection, NodeSelection } from '@tiptap/pm/state';
|
|
7
|
-
import { Node,
|
|
7
|
+
import { Node, ReactNodeViewRenderer, mergeAttributes, Extension as Extension$1, NodeViewWrapper, NodeViewContent, useEditorState, EditorContext, EditorContent, useEditor, isNodeSelection } from '@tiptap/react';
|
|
8
8
|
import { Extension, mergeAttributes as mergeAttributes$1, Node as Node$1, generateJSON, generateHTML } from '@tiptap/core';
|
|
9
9
|
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
10
10
|
import { CodeBlock } from '@tiptap/extension-code-block';
|
|
@@ -272,6 +272,253 @@ var UiState = Extension.create({
|
|
|
272
272
|
this.storage = { ...defaultUiState };
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
|
+
|
|
276
|
+
// src/lib/resizable-width.ts
|
|
277
|
+
function computeResizedWidth({
|
|
278
|
+
handleUsed,
|
|
279
|
+
initialWidth,
|
|
280
|
+
initialClientX,
|
|
281
|
+
clientX,
|
|
282
|
+
align = "left",
|
|
283
|
+
minWidth,
|
|
284
|
+
maxWidth
|
|
285
|
+
}) {
|
|
286
|
+
const multiplier = align === "center" ? 2 : 1;
|
|
287
|
+
const delta = handleUsed === "left" ? (initialClientX - clientX) * multiplier : (clientX - initialClientX) * multiplier;
|
|
288
|
+
return Math.min(Math.max(initialWidth + delta, minWidth), maxWidth);
|
|
289
|
+
}
|
|
290
|
+
function parseWidthAttr(value) {
|
|
291
|
+
const n = typeof value === "number" ? value : Number.parseInt(String(value ?? ""), 10);
|
|
292
|
+
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
293
|
+
}
|
|
294
|
+
function useResizableWidth({
|
|
295
|
+
editor,
|
|
296
|
+
nodeName,
|
|
297
|
+
getPos,
|
|
298
|
+
initialWidth,
|
|
299
|
+
minWidth,
|
|
300
|
+
maxWidth,
|
|
301
|
+
align = "left",
|
|
302
|
+
onResize
|
|
303
|
+
}) {
|
|
304
|
+
const [resizeParams, setResizeParams] = useState();
|
|
305
|
+
const [width, setWidth] = useState(initialWidth);
|
|
306
|
+
const [hovering, setHovering] = useState(false);
|
|
307
|
+
const isResizingRef = useRef(false);
|
|
308
|
+
const containerRef = useRef(null);
|
|
309
|
+
const leftHandleRef = useRef(null);
|
|
310
|
+
const rightHandleRef = useRef(null);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (!isResizingRef.current) setWidth(initialWidth);
|
|
313
|
+
}, [initialWidth]);
|
|
314
|
+
const editable = !!editor?.isEditable;
|
|
315
|
+
const showHandles = hovering && editable;
|
|
316
|
+
const windowMouseMoveHandler = useCallback(
|
|
317
|
+
(event) => {
|
|
318
|
+
if (!resizeParams || !editor) return;
|
|
319
|
+
const clientX = "touches" in event ? event.touches[0]?.clientX ?? 0 : event.clientX;
|
|
320
|
+
const next = computeResizedWidth({
|
|
321
|
+
...resizeParams,
|
|
322
|
+
clientX,
|
|
323
|
+
align,
|
|
324
|
+
minWidth,
|
|
325
|
+
maxWidth: editor.view.dom?.firstElementChild?.clientWidth || maxWidth
|
|
326
|
+
});
|
|
327
|
+
setWidth(next);
|
|
328
|
+
if (containerRef.current) {
|
|
329
|
+
containerRef.current.style.width = `${next}px`;
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
[editor, align, maxWidth, minWidth, resizeParams]
|
|
333
|
+
);
|
|
334
|
+
const windowMouseUpHandler = useCallback(
|
|
335
|
+
(event) => {
|
|
336
|
+
if (!editor) return;
|
|
337
|
+
const target = "touches" in event ? document.elementFromPoint(
|
|
338
|
+
event.changedTouches[0]?.clientX ?? 0,
|
|
339
|
+
event.changedTouches[0]?.clientY ?? 0
|
|
340
|
+
) : event.target;
|
|
341
|
+
const isInsideContainer = target && containerRef.current?.contains(target);
|
|
342
|
+
if ((!isInsideContainer || !editor.isEditable) && hovering) {
|
|
343
|
+
setHovering(false);
|
|
344
|
+
}
|
|
345
|
+
if (!resizeParams) return;
|
|
346
|
+
const wasNodeSelection = editor.state.selection instanceof NodeSelection && editor.state.selection.node.type.name === nodeName;
|
|
347
|
+
setResizeParams(void 0);
|
|
348
|
+
if (width !== void 0) onResize(width);
|
|
349
|
+
const pos = getPos();
|
|
350
|
+
if (isValidPosition(pos) && wasNodeSelection) {
|
|
351
|
+
editor.chain().focus().setNodeSelection(pos).run();
|
|
352
|
+
}
|
|
353
|
+
isResizingRef.current = false;
|
|
354
|
+
},
|
|
355
|
+
[editor, getPos, hovering, nodeName, onResize, resizeParams, width]
|
|
356
|
+
);
|
|
357
|
+
const startResize = useCallback(
|
|
358
|
+
(handleUsed, clientX) => {
|
|
359
|
+
setResizeParams({
|
|
360
|
+
handleUsed,
|
|
361
|
+
initialWidth: containerRef.current?.clientWidth ?? minWidth,
|
|
362
|
+
initialClientX: clientX
|
|
363
|
+
});
|
|
364
|
+
isResizingRef.current = true;
|
|
365
|
+
},
|
|
366
|
+
[minWidth]
|
|
367
|
+
);
|
|
368
|
+
const handleProps = (side) => ({
|
|
369
|
+
ref: side === "left" ? leftHandleRef : rightHandleRef,
|
|
370
|
+
onMouseDown: (event) => {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
event.stopPropagation();
|
|
373
|
+
startResize(side, event.clientX);
|
|
374
|
+
},
|
|
375
|
+
onTouchStart: (event) => {
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
const touch = event.touches[0];
|
|
378
|
+
if (touch) startResize(side, touch.clientX);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
const wrapperProps = {
|
|
382
|
+
onMouseEnter: () => {
|
|
383
|
+
if (editor?.isEditable) setHovering(true);
|
|
384
|
+
},
|
|
385
|
+
onMouseLeave: (event) => {
|
|
386
|
+
if (event.relatedTarget === leftHandleRef.current || event.relatedTarget === rightHandleRef.current || resizeParams)
|
|
387
|
+
return;
|
|
388
|
+
if (editor?.isEditable) setHovering(false);
|
|
389
|
+
},
|
|
390
|
+
onTouchStart: () => {
|
|
391
|
+
if (editor?.isEditable) setHovering(true);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
if (!resizeParams) return;
|
|
396
|
+
window.addEventListener("mousemove", windowMouseMoveHandler);
|
|
397
|
+
window.addEventListener("touchmove", windowMouseMoveHandler, {
|
|
398
|
+
passive: false
|
|
399
|
+
});
|
|
400
|
+
return () => {
|
|
401
|
+
window.removeEventListener("mousemove", windowMouseMoveHandler);
|
|
402
|
+
window.removeEventListener("touchmove", windowMouseMoveHandler);
|
|
403
|
+
};
|
|
404
|
+
}, [resizeParams, windowMouseMoveHandler]);
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!resizeParams && !hovering) return;
|
|
407
|
+
window.addEventListener("mouseup", windowMouseUpHandler);
|
|
408
|
+
window.addEventListener("touchend", windowMouseUpHandler);
|
|
409
|
+
return () => {
|
|
410
|
+
window.removeEventListener("mouseup", windowMouseUpHandler);
|
|
411
|
+
window.removeEventListener("touchend", windowMouseUpHandler);
|
|
412
|
+
};
|
|
413
|
+
}, [resizeParams, hovering, windowMouseUpHandler]);
|
|
414
|
+
return {
|
|
415
|
+
width,
|
|
416
|
+
isResizing: !!resizeParams,
|
|
417
|
+
showHandles,
|
|
418
|
+
containerRef,
|
|
419
|
+
wrapperProps,
|
|
420
|
+
leftHandleProps: handleProps("left"),
|
|
421
|
+
rightHandleProps: handleProps("right")
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
var VIDEO_MIN_WIDTH = 200;
|
|
425
|
+
var VIDEO_MAX_WIDTH = 800;
|
|
426
|
+
function VideoPlayer({
|
|
427
|
+
src,
|
|
428
|
+
title,
|
|
429
|
+
poster,
|
|
430
|
+
naturalSize,
|
|
431
|
+
onNaturalSize,
|
|
432
|
+
fillContainer
|
|
433
|
+
}) {
|
|
434
|
+
return (
|
|
435
|
+
// biome-ignore lint/a11y/useMediaCaption: 节点没有字幕字段,上传的视频也不带字幕文件;要加字幕时在这里补 <track>
|
|
436
|
+
/* @__PURE__ */ jsx(
|
|
437
|
+
"video",
|
|
438
|
+
{
|
|
439
|
+
className: "tiptap-video-player",
|
|
440
|
+
controls: true,
|
|
441
|
+
preload: "metadata",
|
|
442
|
+
src,
|
|
443
|
+
title,
|
|
444
|
+
poster,
|
|
445
|
+
style: naturalSize ? {
|
|
446
|
+
aspectRatio: `${naturalSize.width} / ${naturalSize.height}`,
|
|
447
|
+
// 没设宽度时按视频原始宽度显示。这个像素宽必须写在 <video> 上而不是外层 div:
|
|
448
|
+
// 带百分比 max-width 的 video 是「可压缩替换元素」,算最小内容宽时按 0 计;
|
|
449
|
+
// 写在 div 上会被当成最小宽度,把编辑器正文列(grid 轨道)整个撑宽、溢出外框。
|
|
450
|
+
width: fillContainer ? void 0 : `${naturalSize.width}px`
|
|
451
|
+
} : void 0,
|
|
452
|
+
onLoadedMetadata: (e) => {
|
|
453
|
+
const { videoWidth, videoHeight } = e.currentTarget;
|
|
454
|
+
if (videoWidth > 0 && videoHeight > 0) {
|
|
455
|
+
onNaturalSize?.({ width: videoWidth, height: videoHeight });
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function VideoNodeView({ editor, node, getPos, updateAttributes }) {
|
|
463
|
+
const [naturalSize, setNaturalSize] = useState();
|
|
464
|
+
const align = node.attrs["data-align"] ?? "left";
|
|
465
|
+
const {
|
|
466
|
+
width,
|
|
467
|
+
isResizing,
|
|
468
|
+
showHandles,
|
|
469
|
+
containerRef,
|
|
470
|
+
wrapperProps,
|
|
471
|
+
leftHandleProps,
|
|
472
|
+
rightHandleProps
|
|
473
|
+
} = useResizableWidth({
|
|
474
|
+
editor,
|
|
475
|
+
nodeName: "video",
|
|
476
|
+
getPos,
|
|
477
|
+
initialWidth: parseWidthAttr(node.attrs.width),
|
|
478
|
+
minWidth: VIDEO_MIN_WIDTH,
|
|
479
|
+
maxWidth: VIDEO_MAX_WIDTH,
|
|
480
|
+
align,
|
|
481
|
+
// 只存宽度,高度交给视频比例:清掉老数据里的 height,免得拖完画面被拉变形
|
|
482
|
+
onResize: (w) => updateAttributes({ width: w, height: null })
|
|
483
|
+
});
|
|
484
|
+
return /* @__PURE__ */ jsx(
|
|
485
|
+
NodeViewWrapper,
|
|
486
|
+
{
|
|
487
|
+
...wrapperProps,
|
|
488
|
+
"data-align": align,
|
|
489
|
+
"data-width": width,
|
|
490
|
+
className: "tiptap-video",
|
|
491
|
+
children: /* @__PURE__ */ jsxs(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
ref: containerRef,
|
|
495
|
+
className: "tiptap-video-container",
|
|
496
|
+
"data-resizing": isResizing || void 0,
|
|
497
|
+
style: { width: width ? `${width}px` : "fit-content" },
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ jsx(
|
|
500
|
+
VideoPlayer,
|
|
501
|
+
{
|
|
502
|
+
src: node.attrs.src,
|
|
503
|
+
title: node.attrs.title ?? void 0,
|
|
504
|
+
poster: node.attrs.poster ?? void 0,
|
|
505
|
+
naturalSize,
|
|
506
|
+
onNaturalSize: setNaturalSize,
|
|
507
|
+
fillContainer: !!width
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
showHandles && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
511
|
+
/* @__PURE__ */ jsx("div", { ...leftHandleProps, className: "tiptap-video-handle tiptap-video-handle-left" }),
|
|
512
|
+
/* @__PURE__ */ jsx("div", { ...rightHandleProps, className: "tiptap-video-handle tiptap-video-handle-right" })
|
|
513
|
+
] })
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/components/tiptap-node/video-node/video-node-extension.ts
|
|
275
522
|
var Video = Node.create({
|
|
276
523
|
name: "video",
|
|
277
524
|
group: "block",
|
|
@@ -287,7 +534,8 @@ var Video = Node.create({
|
|
|
287
534
|
title: { default: null },
|
|
288
535
|
width: { default: null },
|
|
289
536
|
height: { default: null },
|
|
290
|
-
poster: { default: null }
|
|
537
|
+
poster: { default: null },
|
|
538
|
+
"data-align": { default: null }
|
|
291
539
|
};
|
|
292
540
|
},
|
|
293
541
|
parseHTML() {
|
|
@@ -299,9 +547,10 @@ var Video = Node.create({
|
|
|
299
547
|
return {
|
|
300
548
|
src: el.getAttribute("src"),
|
|
301
549
|
title: el.getAttribute("title"),
|
|
302
|
-
width: el.getAttribute("width"),
|
|
550
|
+
width: parseWidthAttr(el.getAttribute("width")) ?? null,
|
|
303
551
|
height: el.getAttribute("height"),
|
|
304
|
-
poster: el.getAttribute("poster")
|
|
552
|
+
poster: el.getAttribute("poster"),
|
|
553
|
+
"data-align": el.getAttribute("data-align")
|
|
305
554
|
};
|
|
306
555
|
}
|
|
307
556
|
}
|
|
@@ -317,6 +566,7 @@ var Video = Node.create({
|
|
|
317
566
|
if (node.attrs.width) attrs.width = node.attrs.width;
|
|
318
567
|
if (node.attrs.height) attrs.height = node.attrs.height;
|
|
319
568
|
if (node.attrs.poster) attrs.poster = node.attrs.poster;
|
|
569
|
+
if (node.attrs["data-align"]) attrs["data-align"] = node.attrs["data-align"];
|
|
320
570
|
return [
|
|
321
571
|
"video",
|
|
322
572
|
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, attrs)
|
|
@@ -332,22 +582,12 @@ var Video = Node.create({
|
|
|
332
582
|
// 这里加 NodeView:只读(editable=false)时 stopEvent 返回 true,让 PM 忽略视频内部
|
|
333
583
|
// DOM 事件,原生控件(播放/进度/全屏)才能正常工作;编辑器(可编辑)时返回 false,
|
|
334
584
|
// PM 照常处理节点选中/拖拽,编辑行为不变。
|
|
585
|
+
// 可编辑时还要拦下缩放把手上的事件:不然 PM 把按住把手当成选中 / 拖动整个节点。
|
|
586
|
+
// atom 节点的 DOM 变化 ReactNodeView 默认就忽略,不用再写 ignoreMutation。
|
|
335
587
|
addNodeView() {
|
|
336
|
-
return (
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
dom.setAttribute("preload", "metadata");
|
|
340
|
-
if (node.attrs.src) dom.setAttribute("src", node.attrs.src);
|
|
341
|
-
if (node.attrs.title) dom.setAttribute("title", node.attrs.title);
|
|
342
|
-
if (node.attrs.width) dom.setAttribute("width", String(node.attrs.width));
|
|
343
|
-
if (node.attrs.height) dom.setAttribute("height", String(node.attrs.height));
|
|
344
|
-
if (node.attrs.poster) dom.setAttribute("poster", node.attrs.poster);
|
|
345
|
-
return {
|
|
346
|
-
dom,
|
|
347
|
-
stopEvent: () => !this.editor.isEditable,
|
|
348
|
-
ignoreMutation: () => true
|
|
349
|
-
};
|
|
350
|
-
};
|
|
588
|
+
return ReactNodeViewRenderer(VideoNodeView, {
|
|
589
|
+
stopEvent: ({ event }) => !this.editor.isEditable || event.target instanceof Element && event.target.closest(".tiptap-video-handle") !== null
|
|
590
|
+
});
|
|
351
591
|
}
|
|
352
592
|
});
|
|
353
593
|
var Audio = Node.create({
|
|
@@ -1230,8 +1470,8 @@ var PasteDropMedia = Extension$1.create({
|
|
|
1230
1470
|
},
|
|
1231
1471
|
addCommands() {
|
|
1232
1472
|
return {
|
|
1233
|
-
uploadMediaFile: (file) => ({ editor }) => {
|
|
1234
|
-
runMediaUpload(editor, file, editor.state.selection.from, this.options);
|
|
1473
|
+
uploadMediaFile: (file, range) => ({ editor }) => {
|
|
1474
|
+
runMediaUpload(editor, file, range ?? editor.state.selection.from, this.options);
|
|
1235
1475
|
return true;
|
|
1236
1476
|
}
|
|
1237
1477
|
};
|
|
@@ -4409,7 +4649,7 @@ function ImageNodeView(props) {
|
|
|
4409
4649
|
alt: node.attrs.alt || "",
|
|
4410
4650
|
editor,
|
|
4411
4651
|
align: node.attrs["data-align"],
|
|
4412
|
-
initialWidth: node.attrs.width,
|
|
4652
|
+
initialWidth: parseWidthAttr(node.attrs.width),
|
|
4413
4653
|
showCaption: node.attrs.showCaption,
|
|
4414
4654
|
hasContent,
|
|
4415
4655
|
nodeSize: node.nodeSize,
|
|
@@ -4434,14 +4674,16 @@ var ResizableImage = ({
|
|
|
4434
4674
|
onUpdateAttributes,
|
|
4435
4675
|
getPos
|
|
4436
4676
|
}) => {
|
|
4437
|
-
const
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4677
|
+
const { width, isResizing, showHandles, containerRef, wrapperProps, leftHandleProps, rightHandleProps } = useResizableWidth({
|
|
4678
|
+
editor,
|
|
4679
|
+
nodeName: "image",
|
|
4680
|
+
getPos,
|
|
4681
|
+
initialWidth,
|
|
4682
|
+
minWidth,
|
|
4683
|
+
maxWidth,
|
|
4684
|
+
align,
|
|
4685
|
+
onResize: (w) => onImageResize?.(w)
|
|
4686
|
+
});
|
|
4445
4687
|
const imageRef = useRef(null);
|
|
4446
4688
|
useEffect(() => {
|
|
4447
4689
|
if (!editor || !showCaption) return;
|
|
@@ -4463,7 +4705,7 @@ var ResizableImage = ({
|
|
|
4463
4705
|
}, [editor, showCaption, hasContent, getPos, nodeSize, onUpdateAttributes]);
|
|
4464
4706
|
const handleImageClick = useCallback(
|
|
4465
4707
|
(event) => {
|
|
4466
|
-
if (!editor || !getPos ||
|
|
4708
|
+
if (!editor || !getPos || isResizing) return;
|
|
4467
4709
|
if (!editor.isEditable) return;
|
|
4468
4710
|
event.preventDefault();
|
|
4469
4711
|
event.stopPropagation();
|
|
@@ -4472,135 +4714,20 @@ var ResizableImage = ({
|
|
|
4472
4714
|
editor.chain().focus().setNodeSelection(pos).run();
|
|
4473
4715
|
}
|
|
4474
4716
|
},
|
|
4475
|
-
[editor, getPos,
|
|
4476
|
-
);
|
|
4477
|
-
const windowMouseMoveHandler = useCallback(
|
|
4478
|
-
(event) => {
|
|
4479
|
-
if (!resizeParams || !editor || !isMountedRef.current) return;
|
|
4480
|
-
const clientX = "touches" in event ? event.touches[0]?.clientX ?? 0 : event.clientX;
|
|
4481
|
-
const isLeftHandle = resizeParams.handleUsed === "left";
|
|
4482
|
-
const multiplier = align === "center" ? 2 : 1;
|
|
4483
|
-
const delta = isLeftHandle ? (resizeParams.initialClientX - clientX) * multiplier : (clientX - resizeParams.initialClientX) * multiplier;
|
|
4484
|
-
const newWidth = resizeParams.initialWidth + delta;
|
|
4485
|
-
const effectiveMaxWidth = editor.view.dom?.firstElementChild?.clientWidth || maxWidth;
|
|
4486
|
-
const clampedWidth = Math.min(
|
|
4487
|
-
Math.max(newWidth, minWidth),
|
|
4488
|
-
effectiveMaxWidth
|
|
4489
|
-
);
|
|
4490
|
-
setWidth(clampedWidth);
|
|
4491
|
-
if (wrapperRef.current) {
|
|
4492
|
-
wrapperRef.current.style.width = `${clampedWidth}px`;
|
|
4493
|
-
}
|
|
4494
|
-
},
|
|
4495
|
-
[editor, align, maxWidth, minWidth, resizeParams]
|
|
4496
|
-
);
|
|
4497
|
-
const windowMouseUpHandler = useCallback(
|
|
4498
|
-
(event) => {
|
|
4499
|
-
if (!editor || !isMountedRef.current) return;
|
|
4500
|
-
const target = "touches" in event ? document.elementFromPoint(
|
|
4501
|
-
event.changedTouches[0]?.clientX ?? 0,
|
|
4502
|
-
event.changedTouches[0]?.clientY ?? 0
|
|
4503
|
-
) : event.target;
|
|
4504
|
-
const isInsideWrapper = target && wrapperRef.current?.contains(target);
|
|
4505
|
-
if ((!isInsideWrapper || !editor.isEditable) && showHandles && isMountedRef.current) {
|
|
4506
|
-
setShowHandles(false);
|
|
4507
|
-
}
|
|
4508
|
-
if (!resizeParams) return;
|
|
4509
|
-
const wasNodeSelection = editor.state.selection instanceof NodeSelection && editor.state.selection.node.type.name === "image";
|
|
4510
|
-
if (isMountedRef.current) {
|
|
4511
|
-
setResizeParams(void 0);
|
|
4512
|
-
}
|
|
4513
|
-
onImageResize?.(width);
|
|
4514
|
-
const pos = getPos();
|
|
4515
|
-
if (isValidPosition(pos) && wasNodeSelection && isMountedRef.current) {
|
|
4516
|
-
editor.chain().focus().setNodeSelection(pos).run();
|
|
4517
|
-
}
|
|
4518
|
-
isResizingRef.current = false;
|
|
4519
|
-
},
|
|
4520
|
-
[editor, getPos, onImageResize, resizeParams, showHandles, width]
|
|
4717
|
+
[editor, getPos, isResizing]
|
|
4521
4718
|
);
|
|
4522
|
-
const startResize = useCallback(
|
|
4523
|
-
(handleUsed, clientX) => {
|
|
4524
|
-
setResizeParams({
|
|
4525
|
-
handleUsed,
|
|
4526
|
-
initialWidth: wrapperRef.current?.clientWidth ?? minWidth,
|
|
4527
|
-
initialClientX: clientX
|
|
4528
|
-
});
|
|
4529
|
-
isResizingRef.current = true;
|
|
4530
|
-
},
|
|
4531
|
-
[minWidth]
|
|
4532
|
-
);
|
|
4533
|
-
const leftResizeHandleMouseDownHandler = (event) => {
|
|
4534
|
-
event.preventDefault();
|
|
4535
|
-
event.stopPropagation();
|
|
4536
|
-
startResize("left", event.clientX);
|
|
4537
|
-
};
|
|
4538
|
-
const leftResizeHandleTouchStartHandler = (event) => {
|
|
4539
|
-
event.preventDefault();
|
|
4540
|
-
const touch = event.touches[0];
|
|
4541
|
-
if (touch) startResize("left", touch.clientX);
|
|
4542
|
-
};
|
|
4543
|
-
const rightResizeHandleMouseDownHandler = (event) => {
|
|
4544
|
-
event.preventDefault();
|
|
4545
|
-
event.stopPropagation();
|
|
4546
|
-
startResize("right", event.clientX);
|
|
4547
|
-
};
|
|
4548
|
-
const rightResizeHandleTouchStartHandler = (event) => {
|
|
4549
|
-
event.preventDefault();
|
|
4550
|
-
const touch = event.touches[0];
|
|
4551
|
-
if (touch) startResize("right", touch.clientX);
|
|
4552
|
-
};
|
|
4553
|
-
const wrapperMouseEnterHandler = () => {
|
|
4554
|
-
if (editor?.isEditable && isMountedRef.current) setShowHandles(true);
|
|
4555
|
-
};
|
|
4556
|
-
const wrapperMouseLeaveHandler = (event) => {
|
|
4557
|
-
if (!isMountedRef.current) return;
|
|
4558
|
-
if (event.relatedTarget === leftResizeHandleRef.current || event.relatedTarget === rightResizeHandleRef.current || resizeParams)
|
|
4559
|
-
return;
|
|
4560
|
-
if (editor?.isEditable) setShowHandles(false);
|
|
4561
|
-
};
|
|
4562
|
-
const wrapperTouchStartHandler = () => {
|
|
4563
|
-
if (editor?.isEditable && isMountedRef.current) setShowHandles(true);
|
|
4564
|
-
};
|
|
4565
|
-
useEffect(() => {
|
|
4566
|
-
if (!resizeParams) return;
|
|
4567
|
-
window.addEventListener("mousemove", windowMouseMoveHandler);
|
|
4568
|
-
window.addEventListener("touchmove", windowMouseMoveHandler, {
|
|
4569
|
-
passive: false
|
|
4570
|
-
});
|
|
4571
|
-
return () => {
|
|
4572
|
-
window.removeEventListener("mousemove", windowMouseMoveHandler);
|
|
4573
|
-
window.removeEventListener("touchmove", windowMouseMoveHandler);
|
|
4574
|
-
};
|
|
4575
|
-
}, [resizeParams, windowMouseMoveHandler]);
|
|
4576
|
-
useEffect(() => {
|
|
4577
|
-
if (!resizeParams && !showHandles) return;
|
|
4578
|
-
window.addEventListener("mouseup", windowMouseUpHandler);
|
|
4579
|
-
window.addEventListener("touchend", windowMouseUpHandler);
|
|
4580
|
-
return () => {
|
|
4581
|
-
window.removeEventListener("mouseup", windowMouseUpHandler);
|
|
4582
|
-
window.removeEventListener("touchend", windowMouseUpHandler);
|
|
4583
|
-
};
|
|
4584
|
-
}, [resizeParams, showHandles, windowMouseUpHandler]);
|
|
4585
|
-
useEffect(() => {
|
|
4586
|
-
return () => {
|
|
4587
|
-
isMountedRef.current = false;
|
|
4588
|
-
};
|
|
4589
|
-
}, []);
|
|
4590
4719
|
const shouldShowCaption = showCaption || hasContent;
|
|
4591
4720
|
return /* @__PURE__ */ jsx(
|
|
4592
4721
|
NodeViewWrapper,
|
|
4593
4722
|
{
|
|
4594
|
-
|
|
4595
|
-
onMouseLeave: wrapperMouseLeaveHandler,
|
|
4596
|
-
onTouchStart: wrapperTouchStartHandler,
|
|
4723
|
+
...wrapperProps,
|
|
4597
4724
|
"data-align": align,
|
|
4598
4725
|
"data-width": width,
|
|
4599
4726
|
className: "tiptap-image",
|
|
4600
4727
|
children: /* @__PURE__ */ jsxs(
|
|
4601
4728
|
"div",
|
|
4602
4729
|
{
|
|
4603
|
-
ref:
|
|
4730
|
+
ref: containerRef,
|
|
4604
4731
|
className: "tiptap-image-container",
|
|
4605
4732
|
style: { width: width ? `${width}px` : "fit-content" },
|
|
4606
4733
|
children: [
|
|
@@ -4618,25 +4745,9 @@ var ResizableImage = ({
|
|
|
4618
4745
|
style: { cursor: editor?.isEditable ? "pointer" : "zoom-in" }
|
|
4619
4746
|
}
|
|
4620
4747
|
),
|
|
4621
|
-
showHandles &&
|
|
4622
|
-
/* @__PURE__ */ jsx(
|
|
4623
|
-
|
|
4624
|
-
{
|
|
4625
|
-
ref: leftResizeHandleRef,
|
|
4626
|
-
className: "tiptap-image-handle tiptap-image-handle-left",
|
|
4627
|
-
onMouseDown: leftResizeHandleMouseDownHandler,
|
|
4628
|
-
onTouchStart: leftResizeHandleTouchStartHandler
|
|
4629
|
-
}
|
|
4630
|
-
),
|
|
4631
|
-
/* @__PURE__ */ jsx(
|
|
4632
|
-
"div",
|
|
4633
|
-
{
|
|
4634
|
-
ref: rightResizeHandleRef,
|
|
4635
|
-
className: "tiptap-image-handle tiptap-image-handle-right",
|
|
4636
|
-
onMouseDown: rightResizeHandleMouseDownHandler,
|
|
4637
|
-
onTouchStart: rightResizeHandleTouchStartHandler
|
|
4638
|
-
}
|
|
4639
|
-
)
|
|
4748
|
+
showHandles && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4749
|
+
/* @__PURE__ */ jsx("div", { ...leftHandleProps, className: "tiptap-image-handle tiptap-image-handle-left" }),
|
|
4750
|
+
/* @__PURE__ */ jsx("div", { ...rightHandleProps, className: "tiptap-image-handle tiptap-image-handle-right" })
|
|
4640
4751
|
] })
|
|
4641
4752
|
] }),
|
|
4642
4753
|
editor?.isEditable && shouldShowCaption && /* @__PURE__ */ jsx(
|
|
@@ -16027,7 +16138,11 @@ function getFileExtension(url, contentType) {
|
|
|
16027
16138
|
"image/gif": ".gif",
|
|
16028
16139
|
"image/webp": ".webp",
|
|
16029
16140
|
"image/svg+xml": ".svg",
|
|
16030
|
-
"image/bmp": ".bmp"
|
|
16141
|
+
"image/bmp": ".bmp",
|
|
16142
|
+
"video/mp4": ".mp4",
|
|
16143
|
+
"video/webm": ".webm",
|
|
16144
|
+
"video/quicktime": ".mov",
|
|
16145
|
+
"video/ogg": ".ogv"
|
|
16031
16146
|
};
|
|
16032
16147
|
return mimeMap[contentType.toLowerCase()] || ".jpg";
|
|
16033
16148
|
}
|
|
@@ -16101,14 +16216,11 @@ function openInNewTab(url) {
|
|
|
16101
16216
|
return false;
|
|
16102
16217
|
}
|
|
16103
16218
|
}
|
|
16104
|
-
async function
|
|
16105
|
-
if (!editor || !canDownloadImage(editor)) return false;
|
|
16106
|
-
const imageData = getSelectedImageData(editor);
|
|
16107
|
-
if (!imageData?.src) return false;
|
|
16219
|
+
async function downloadMediaUrl(src, filename, resolveFileUrl, downloadMethod = "auto") {
|
|
16108
16220
|
try {
|
|
16109
|
-
let resolvedUrl =
|
|
16221
|
+
let resolvedUrl = src;
|
|
16110
16222
|
if (resolveFileUrl) {
|
|
16111
|
-
resolvedUrl = await resolveFileUrl(
|
|
16223
|
+
resolvedUrl = await resolveFileUrl(src);
|
|
16112
16224
|
}
|
|
16113
16225
|
const baseUrl = window.location.href;
|
|
16114
16226
|
const sanitizedUrl = sanitizeUrl(resolvedUrl, baseUrl);
|
|
@@ -16116,38 +16228,31 @@ async function downloadSelectedImage(editor, filename, resolveFileUrl, downloadM
|
|
|
16116
16228
|
console.error("Invalid or unsafe URL after sanitization");
|
|
16117
16229
|
return false;
|
|
16118
16230
|
}
|
|
16119
|
-
const generatedFilename = filename || imageData.alt || imageData.title || `image-${Date.now()}`;
|
|
16120
16231
|
switch (downloadMethod) {
|
|
16121
16232
|
case "open":
|
|
16122
16233
|
return openInNewTab(sanitizedUrl);
|
|
16123
16234
|
case "download":
|
|
16124
16235
|
if (sanitizedUrl.startsWith(window.location.origin) || sanitizedUrl.startsWith("data:")) {
|
|
16125
|
-
return tryDirectDownload(sanitizedUrl,
|
|
16236
|
+
return tryDirectDownload(sanitizedUrl, filename);
|
|
16126
16237
|
} else {
|
|
16127
|
-
const success = await tryFetchDownload(
|
|
16128
|
-
sanitizedUrl,
|
|
16129
|
-
generatedFilename
|
|
16130
|
-
);
|
|
16238
|
+
const success = await tryFetchDownload(sanitizedUrl, filename);
|
|
16131
16239
|
return success || openInNewTab(sanitizedUrl);
|
|
16132
16240
|
}
|
|
16133
16241
|
case "auto":
|
|
16134
16242
|
default:
|
|
16135
16243
|
if (sanitizedUrl.startsWith("data:") || sanitizedUrl.startsWith(window.location.origin)) {
|
|
16136
|
-
return tryDirectDownload(sanitizedUrl,
|
|
16244
|
+
return tryDirectDownload(sanitizedUrl, filename);
|
|
16137
16245
|
} else {
|
|
16138
|
-
const fetchSuccess = await tryFetchDownload(
|
|
16139
|
-
sanitizedUrl,
|
|
16140
|
-
generatedFilename
|
|
16141
|
-
);
|
|
16246
|
+
const fetchSuccess = await tryFetchDownload(sanitizedUrl, filename);
|
|
16142
16247
|
if (fetchSuccess) return true;
|
|
16143
16248
|
return openInNewTab(sanitizedUrl);
|
|
16144
16249
|
}
|
|
16145
16250
|
}
|
|
16146
16251
|
} catch (error) {
|
|
16147
|
-
console.error("Failed to download
|
|
16252
|
+
console.error("Failed to download media:", error);
|
|
16148
16253
|
try {
|
|
16149
16254
|
const baseUrl = window.location.href;
|
|
16150
|
-
const sanitizedUrl = sanitizeUrl(
|
|
16255
|
+
const sanitizedUrl = sanitizeUrl(src, baseUrl);
|
|
16151
16256
|
if (sanitizedUrl !== "#") {
|
|
16152
16257
|
return openInNewTab(sanitizedUrl);
|
|
16153
16258
|
}
|
|
@@ -16156,6 +16261,18 @@ async function downloadSelectedImage(editor, filename, resolveFileUrl, downloadM
|
|
|
16156
16261
|
return false;
|
|
16157
16262
|
}
|
|
16158
16263
|
}
|
|
16264
|
+
async function downloadSelectedImage(editor, filename, resolveFileUrl, downloadMethod = "auto") {
|
|
16265
|
+
if (!editor || !canDownloadImage(editor)) return false;
|
|
16266
|
+
const imageData = getSelectedImageData(editor);
|
|
16267
|
+
if (!imageData?.src) return false;
|
|
16268
|
+
const generatedFilename = filename || imageData.alt || imageData.title || `image-${Date.now()}`;
|
|
16269
|
+
return downloadMediaUrl(
|
|
16270
|
+
imageData.src,
|
|
16271
|
+
generatedFilename,
|
|
16272
|
+
resolveFileUrl,
|
|
16273
|
+
downloadMethod
|
|
16274
|
+
);
|
|
16275
|
+
}
|
|
16159
16276
|
function shouldShowDownloadButton(props) {
|
|
16160
16277
|
const { editor, hideWhenUnavailable } = props;
|
|
16161
16278
|
if (!editor) return false;
|
|
@@ -22125,6 +22242,115 @@ function ImageNodeFloating({
|
|
|
22125
22242
|
/* @__PURE__ */ jsx(DeleteNodeButton, {})
|
|
22126
22243
|
] });
|
|
22127
22244
|
}
|
|
22245
|
+
function getSelectedVideo(editor) {
|
|
22246
|
+
const { selection } = editor.state;
|
|
22247
|
+
if (!(selection instanceof NodeSelection) || selection.node.type.name !== "video") return null;
|
|
22248
|
+
return { node: selection.node, from: selection.from, to: selection.to };
|
|
22249
|
+
}
|
|
22250
|
+
function videoFilename(src, title) {
|
|
22251
|
+
if (title) return title;
|
|
22252
|
+
try {
|
|
22253
|
+
const last = new URL(src, window.location.href).pathname.split("/").pop();
|
|
22254
|
+
if (last) return decodeURIComponent(last);
|
|
22255
|
+
} catch {
|
|
22256
|
+
}
|
|
22257
|
+
return `video-${Date.now()}`;
|
|
22258
|
+
}
|
|
22259
|
+
function VideoDownloadButton({ editor }) {
|
|
22260
|
+
const handleClick = async () => {
|
|
22261
|
+
const video = getSelectedVideo(editor);
|
|
22262
|
+
const src = video?.node.attrs.src;
|
|
22263
|
+
if (!src) return;
|
|
22264
|
+
await downloadMediaUrl(src, videoFilename(src, video?.node.attrs.title ?? null));
|
|
22265
|
+
};
|
|
22266
|
+
return /* @__PURE__ */ jsx(
|
|
22267
|
+
Button,
|
|
22268
|
+
{
|
|
22269
|
+
type: "button",
|
|
22270
|
+
variant: "ghost",
|
|
22271
|
+
role: "button",
|
|
22272
|
+
tabIndex: -1,
|
|
22273
|
+
"aria-label": "下载视频",
|
|
22274
|
+
tooltip: "下载视频",
|
|
22275
|
+
onClick: handleClick,
|
|
22276
|
+
children: /* @__PURE__ */ jsx(ArrowDownToLineIcon, { className: "tiptap-button-icon" })
|
|
22277
|
+
}
|
|
22278
|
+
);
|
|
22279
|
+
}
|
|
22280
|
+
function VideoReplaceButton({ editor }) {
|
|
22281
|
+
const [pending, setPending] = useState(false);
|
|
22282
|
+
const available = isExtensionAvailable(editor, ["pasteDropMedia"]);
|
|
22283
|
+
const handleClick = async () => {
|
|
22284
|
+
if (!available || pending) return;
|
|
22285
|
+
try {
|
|
22286
|
+
setPending(true);
|
|
22287
|
+
const files = await pickFile("video/*", false);
|
|
22288
|
+
const file = files[0];
|
|
22289
|
+
const video = getSelectedVideo(editor);
|
|
22290
|
+
if (!file || !video) return;
|
|
22291
|
+
editor.chain().focus().run();
|
|
22292
|
+
editor.commands.uploadMediaFile(file, { from: video.from, to: video.to });
|
|
22293
|
+
} finally {
|
|
22294
|
+
setPending(false);
|
|
22295
|
+
}
|
|
22296
|
+
};
|
|
22297
|
+
return /* @__PURE__ */ jsx(
|
|
22298
|
+
Button,
|
|
22299
|
+
{
|
|
22300
|
+
type: "button",
|
|
22301
|
+
variant: "ghost",
|
|
22302
|
+
role: "button",
|
|
22303
|
+
tabIndex: -1,
|
|
22304
|
+
disabled: !available || pending,
|
|
22305
|
+
"data-disabled": !available || pending,
|
|
22306
|
+
"aria-label": "替换",
|
|
22307
|
+
tooltip: "替换",
|
|
22308
|
+
onClick: handleClick,
|
|
22309
|
+
children: /* @__PURE__ */ jsx(RefreshCcwIcon, { className: "tiptap-button-icon" })
|
|
22310
|
+
}
|
|
22311
|
+
);
|
|
22312
|
+
}
|
|
22313
|
+
function VideoNodeFloating({ editor: providedEditor }) {
|
|
22314
|
+
const { editor } = useTiptapEditor(providedEditor);
|
|
22315
|
+
const visible = isNodeTypeSelected(editor, ["video"]);
|
|
22316
|
+
if (!editor || !editor.isEditable || !visible) {
|
|
22317
|
+
return null;
|
|
22318
|
+
}
|
|
22319
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
22320
|
+
/* @__PURE__ */ jsx(
|
|
22321
|
+
ImageAlignButton,
|
|
22322
|
+
{
|
|
22323
|
+
align: "left",
|
|
22324
|
+
extensionName: "video",
|
|
22325
|
+
tooltip: "视频左对齐",
|
|
22326
|
+
"aria-label": "视频左对齐"
|
|
22327
|
+
}
|
|
22328
|
+
),
|
|
22329
|
+
/* @__PURE__ */ jsx(
|
|
22330
|
+
ImageAlignButton,
|
|
22331
|
+
{
|
|
22332
|
+
align: "center",
|
|
22333
|
+
extensionName: "video",
|
|
22334
|
+
tooltip: "视频居中对齐",
|
|
22335
|
+
"aria-label": "视频居中对齐"
|
|
22336
|
+
}
|
|
22337
|
+
),
|
|
22338
|
+
/* @__PURE__ */ jsx(
|
|
22339
|
+
ImageAlignButton,
|
|
22340
|
+
{
|
|
22341
|
+
align: "right",
|
|
22342
|
+
extensionName: "video",
|
|
22343
|
+
tooltip: "视频右对齐",
|
|
22344
|
+
"aria-label": "视频右对齐"
|
|
22345
|
+
}
|
|
22346
|
+
),
|
|
22347
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
22348
|
+
/* @__PURE__ */ jsx(VideoDownloadButton, { editor }),
|
|
22349
|
+
/* @__PURE__ */ jsx(VideoReplaceButton, { editor }),
|
|
22350
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
22351
|
+
/* @__PURE__ */ jsx(DeleteNodeButton, {})
|
|
22352
|
+
] });
|
|
22353
|
+
}
|
|
22128
22354
|
var TOOLBAR_VIEWS = {
|
|
22129
22355
|
MAIN: "main",
|
|
22130
22356
|
HIGHLIGHTER: "highlighter",
|
|
@@ -22416,6 +22642,7 @@ function MainToolbarContent({
|
|
|
22416
22642
|
}
|
|
22417
22643
|
),
|
|
22418
22644
|
/* @__PURE__ */ jsx(ImageNodeFloating, {}),
|
|
22645
|
+
/* @__PURE__ */ jsx(VideoNodeFloating, {}),
|
|
22419
22646
|
/* @__PURE__ */ jsx(ScriptGroup, {}),
|
|
22420
22647
|
/* @__PURE__ */ jsx(AlignmentGroup, {}),
|
|
22421
22648
|
/* @__PURE__ */ jsx(IndentGroup, {}),
|
|
@@ -22509,7 +22736,10 @@ function NotionToolbarFloating() {
|
|
|
22509
22736
|
/* @__PURE__ */ jsx(MarkButton, { type: "code", hideWhenUnavailable: true })
|
|
22510
22737
|
] }),
|
|
22511
22738
|
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
22512
|
-
/* @__PURE__ */
|
|
22739
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
22740
|
+
/* @__PURE__ */ jsx(ImageNodeFloating, {}),
|
|
22741
|
+
/* @__PURE__ */ jsx(VideoNodeFloating, {})
|
|
22742
|
+
] }),
|
|
22513
22743
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
22514
22744
|
/* @__PURE__ */ jsx(
|
|
22515
22745
|
LinkPopover,
|
|
@@ -23513,5 +23743,5 @@ function ArticleViewer({ content, contentFormat, codeBlock, placeholder = "" })
|
|
|
23513
23743
|
}
|
|
23514
23744
|
|
|
23515
23745
|
export { ApiParamExtension, ArticleViewer, Audio, CalloutExtension, CodeBlockExtension, CodeGroupExtension, CollabContext, CollabProvider, Column, Columns, DEFAULT_MAX_FILE_SIZES, DetailsExtension, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditorConfigProvider, EditorContentArea, EditorProvider, FileAttachment, FloatingElement, HIDE_FLOATING_META, LoadingSpinner, MediaUploadButton, MediaUploadPlaceholder, NotionEditor, NotionEditorContent, PasteDropMedia, Separator, Spacer, Toolbar, ToolbarGroup, ToolbarSeparator, UiState, UserContext, UserProvider, Video, defaultUiState, detectMediaKind, findSelectionPosition, getEditorMarkdown, hasContentAbove, markHideFloatingOnNext, parseEditorContent, pickFile, renderHighlightedHTML, resolveMaxSize, runMediaUpload, selectNodeAndHideFloating, serializeEditorMarkdown, useCollab, useCollaboration, useComposedRef, useCursorVisibility, useEditorConfig, useElementRect, useFloatingElement, useFloatingToolbarVisibility, useIsBreakpoint, useIsomorphicLayoutEffect, useMenuNavigation, useOnClickOutside, useThrottledCallback, useUiEditorState, useUnmount, useUser, useWindowSize, use_ui_editor_state_default };
|
|
23516
|
-
//# sourceMappingURL=chunk-
|
|
23517
|
-
//# sourceMappingURL=chunk-
|
|
23746
|
+
//# sourceMappingURL=chunk-OGRGQQ3D.js.map
|
|
23747
|
+
//# sourceMappingURL=chunk-OGRGQQ3D.js.map
|