@4399ywkf/editor 0.9.0 → 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/dist/doc.d.ts CHANGED
@@ -1076,13 +1076,23 @@ interface PasteDropMediaOptions {
1076
1076
  /**
1077
1077
  * 统一入口:插入进度占位 → 上传(带进度/取消)→ 成功替换为真实节点 / 失败移除 / 取消 abort。
1078
1078
  * 同时被 plugin(paste/drop)和 addCommands(slash 菜单 / 工具栏)调用。
1079
+ * insertPos 传区间时占位直接替换该区间(浮动菜单「替换」用:占位顶掉原节点,失败可撤销找回)。
1079
1080
  */
1080
- declare const runMediaUpload: (editor: Editor, file: File, insertPos: number, options: PasteDropMediaOptions) => void;
1081
+ declare const runMediaUpload: (editor: Editor, file: File, insertPos: number | {
1082
+ from: number;
1083
+ to: number;
1084
+ }, options: PasteDropMediaOptions) => void;
1081
1085
  declare module "@tiptap/react" {
1082
1086
  interface Commands<ReturnType> {
1083
1087
  pasteDropMedia: {
1084
- /** slash 菜单 / 工具栏可调用:把 file 走跟 paste/drop 完全一样的流程插入到当前选区。 */
1085
- uploadMediaFile: (file: File) => ReturnType;
1088
+ /**
1089
+ * slash 菜单 / 工具栏可调用:把 file 走跟 paste/drop 完全一样的流程插入到当前选区。
1090
+ * 传 range 时替换该区间(如选中的视频节点)。
1091
+ */
1092
+ uploadMediaFile: (file: File, range?: {
1093
+ from: number;
1094
+ to: number;
1095
+ }) => ReturnType;
1086
1096
  };
1087
1097
  }
1088
1098
  }
@@ -1102,8 +1112,8 @@ declare module "@tiptap/react" {
1102
1112
  }
1103
1113
  }
1104
1114
  /**
1105
- * 块级 atom:原生 <video controls> 播放器。
1106
- * 不带自定义 NodeView,浏览器原生播放足够;将来要"自动播放/封面/字幕"再扩展。
1115
+ * 块级 atom:原生 <video controls> 播放器,编辑态可拖左右把手改宽度(只存 width,高度随视频比例)。
1116
+ * 播放器本体在 video-node-view.tsx 的 VideoPlayer,将来要"自动播放/封面/字幕"在那里扩展。
1107
1117
  */
1108
1118
  declare const Video: Node$1<VideoOptions, any>;
1109
1119
 
package/dist/doc.js CHANGED
@@ -1,4 +1,4 @@
1
- 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, FileAttachment, FloatingElement, HIDE_FLOATING_META, LoadingSpinner, MediaUploadButton, MediaUploadPlaceholder, NotionEditor, NotionEditorContent, EditorProvider as NotionEditorInner, 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, use_ui_editor_state_default as useUiEditorStateDefault, useUnmount, useUser, useWindowSize } from './chunk-SGLNT6Z2.js';
1
+ 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, FileAttachment, FloatingElement, HIDE_FLOATING_META, LoadingSpinner, MediaUploadButton, MediaUploadPlaceholder, NotionEditor, NotionEditorContent, EditorProvider as NotionEditorInner, 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, use_ui_editor_state_default as useUiEditorStateDefault, useUnmount, useUser, useWindowSize } from './chunk-OGRGQQ3D.js';
2
2
  export { Button, MAC_SYMBOLS, MAX_FILE_SIZE, Popover, PopoverContent, PopoverTrigger, SR_ONLY, clamp, cn, findNodeAtPosition, findNodePosition, focusNextNode, formatShortcutKey, getAvatar, getElementOverflowPosition, getNodeDisplayName, getSelectedBlockNodes, getSelectedNodesOfType, getSelectionBoundingRect, getUrlParam, handleImageUpload, isAllowedUri, isExtensionAvailable, isMac, isMarkInSchema, isNodeInSchema, isNodeTypeSelected, isSelectionValid, isTextSelectionValid, isValidPosition, parseShortcutKeys, removeEmptyParagraphs, sanitizeUrl, selectCurrentBlockContent, selectionWithinConvertibleTypes, updateNodesAttr, useTiptapEditor } from './chunk-QMYT5WXO.js';
3
3
  import './chunk-ZY5KLA7T.js';
4
4
  import { useState, useEffect } from 'react';
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ registerFormat({
31
31
  importExtensions: [".docx", ".md", ".html"],
32
32
  exportFormats: ["docx", "html", "json", "markdown"]
33
33
  },
34
- load: () => import('./DocView-WEKRSKRU.js')
34
+ load: () => import('./DocView-R4E7QINT.js')
35
35
  });
36
36
  registerFormat({
37
37
  format: "sheet",
package/dist/style.css CHANGED
@@ -2785,6 +2785,7 @@
2785
2785
  }
2786
2786
 
2787
2787
  /* components/tiptap-node/video-node/video-node.scss */
2788
+ @charset "UTF-8";
2788
2789
  .tiptap.ProseMirror video {
2789
2790
  display: block;
2790
2791
  max-width: 100%;
@@ -2793,10 +2794,66 @@
2793
2794
  border-radius: 6px;
2794
2795
  background: #000;
2795
2796
  outline: none;
2797
+ /* 直出 HTML(不跑 tiptap)里的对齐:VideoNodeView 用外层 flex 对齐,这里只管裸 <video> */
2798
+ }
2799
+ .tiptap.ProseMirror video[data-align=center] {
2800
+ margin-inline: auto;
2801
+ }
2802
+ .tiptap.ProseMirror video[data-align=right] {
2803
+ margin-inline-start: auto;
2804
+ }
2805
+ .tiptap.ProseMirror .tiptap-video {
2806
+ display: flex;
2807
+ width: 100%;
2808
+ margin: 0.75em 0;
2809
+ }
2810
+ .tiptap.ProseMirror .tiptap-video[data-align=center] {
2811
+ justify-content: center;
2796
2812
  }
2797
- .tiptap.ProseMirror video.ProseMirror-selectednode {
2813
+ .tiptap.ProseMirror .tiptap-video[data-align=right] {
2814
+ justify-content: flex-end;
2815
+ }
2816
+ .tiptap.ProseMirror .tiptap-video-container {
2817
+ position: relative;
2818
+ /* 行内 width 是编辑时拖出来的像素宽,没有上限:放进手机阅读列会顶破页面,所以钳到列宽。
2819
+ min-width:0 同 image-node-view.scss:flex 子项默认 min-width:auto 会拿视频固有宽当下限。 */
2820
+ max-width: 100%;
2821
+ min-width: 0;
2822
+ border-radius: 6px;
2823
+ }
2824
+ .tiptap.ProseMirror .tiptap-video-player {
2825
+ width: 100%;
2826
+ margin: 0;
2827
+ /* 宽高比由 VideoPlayer 按视频自身分辨率写在行内;比例不同的封面图在框里留黑边 */
2828
+ object-fit: contain;
2829
+ }
2830
+ .tiptap.ProseMirror {
2831
+ /* 拖把手时鼠标常停在视频上松开:Chrome 的 <video controls> 会吞掉这次 pointerup/mouseup,
2832
+ resize 收不了尾、宽度写不回节点。拖动期间让视频不接鼠标,事件落到外层容器照常冒泡。 */
2833
+ }
2834
+ .tiptap.ProseMirror .tiptap-video-container[data-resizing] .tiptap-video-player {
2835
+ pointer-events: none;
2836
+ }
2837
+ .tiptap.ProseMirror .ProseMirror-selectednode .tiptap-video-container {
2798
2838
  box-shadow: 0 0 0 2px var(--tt-brand-color-500, #3b82f6);
2799
2839
  }
2840
+ .tiptap.ProseMirror .tiptap-video-handle {
2841
+ position: absolute;
2842
+ top: 50%;
2843
+ width: 0.375rem;
2844
+ height: 3rem;
2845
+ background-color: var(--tiptap-image-handle-bg, var(--tt-brand-color-600));
2846
+ border-radius: 1.875rem;
2847
+ cursor: ew-resize;
2848
+ transform: translateY(-50%);
2849
+ z-index: 10;
2850
+ }
2851
+ .tiptap.ProseMirror .tiptap-video-handle.tiptap-video-handle-left {
2852
+ left: 4px;
2853
+ }
2854
+ .tiptap.ProseMirror .tiptap-video-handle.tiptap-video-handle-right {
2855
+ right: 4px;
2856
+ }
2800
2857
 
2801
2858
  /* components/tiptap-templates/notion-like/notion-like-editor-header.scss */
2802
2859
  :root {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4399ywkf/editor",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "4399 多格式文档编辑器:doc(tiptap) / sheet(univer) / pdf / pptx,含 docx·xlsx·csv 双向导入导出与 AI 可驱动的结构化编辑面(./doc-runtime、./sheet-runtime)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -193,7 +193,7 @@
193
193
  "scripts": {
194
194
  "build": "tsup && node scripts/build-styles.mjs",
195
195
  "dev": "tsup --watch",
196
- "test": "node --experimental-strip-types --test src/docx/*.test.ts src/doc-runtime/*.test.ts src/sheet-runtime/*.test.ts src/xlsx/*.test.ts src/*.test.ts src/plugins/**/*.test.ts src/components/tiptap-node/code-block-node/*.test.ts src/components/tiptap-templates/notion-like/*.test.ts src/components/tiptap-node/collapsible-node/*.test.ts",
196
+ "test": "node --experimental-strip-types --test src/docx/*.test.ts src/doc-runtime/*.test.ts src/sheet-runtime/*.test.ts src/xlsx/*.test.ts src/*.test.ts src/lib/*.test.ts src/plugins/**/*.test.ts src/components/tiptap-node/code-block-node/*.test.ts src/components/tiptap-templates/notion-like/*.test.ts src/components/tiptap-node/collapsible-node/*.test.ts",
197
197
  "typecheck": "tsc --noEmit"
198
198
  }
199
199
  }