@4399ywkf/editor 0.14.0 → 0.14.2

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.
@@ -1,4 +1,4 @@
1
- import { EditorConfigProvider, NotionEditor } from './chunk-6BJB4YWS.js';
1
+ import { EditorConfigProvider, NotionEditor } from './chunk-ZLEGKX2U.js';
2
2
  import './chunk-MGSVKKK7.js';
3
3
  import './chunk-UD6MDBTN.js';
4
4
  import './chunk-ABMZOL26.js';
@@ -18,5 +18,5 @@ function DocView({ content, contentFormat, readOnly, room, className, onReady })
18
18
  }
19
19
 
20
20
  export { DocView as default };
21
- //# sourceMappingURL=DocView-FYAAUPSK.js.map
22
- //# sourceMappingURL=DocView-FYAAUPSK.js.map
21
+ //# sourceMappingURL=DocView-VTKFMW46.js.map
22
+ //# sourceMappingURL=DocView-VTKFMW46.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-FYAAUPSK.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-VTKFMW46.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
@@ -1,8 +1,8 @@
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, handleImageUpload, focusNextNode, getAvatar, getUrlParam, isTextSelectionValid, AIButton, getElementOverflowPosition, getNodeDisplayName } from './chunk-MGSVKKK7.js';
2
- import { resolveCalloutLook, MARKDOWN_SEQ_PATTERN, markdownSeqFor, attrsForMenuAction, AUTO_NUMBER_MAX_LEVEL, AUTO, HIGHLIGHT_SWATCHES, BLOCK_BACKGROUND_SWATCHES, defaultReminder, normalizeReminder, reminderText, reminderColor, LEGACY_SWATCHES, TEXT_SWATCHES, createCodeHighlighter, swatchValue, resolveCodeLanguage, getCodeBlockTitle, CALLOUT_EMOJIS, CALLOUT_BORDER_SWATCHES, FEISHU_DEFAULT_CALLOUT, orderText, resolveShikiTheme, filterCodeLanguages, pairedBorderFor, computeHeadingOrders, notifyOptions, withDate, withWholeDay, withTime, formatTime, withNotify, withNotifyOffset, reminderFullText, remindUsersLine, calendarDays, TIME_SLOTS, parseTimeInput, resolveColorToHex, numberMenuState, MAX_SEQ_VALUE } from './chunk-UD6MDBTN.js';
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, getAvatar, getUrlParam, handleImageUpload, isTextSelectionValid, AIButton, focusNextNode, getElementOverflowPosition, getNodeDisplayName } from './chunk-MGSVKKK7.js';
2
+ import { resolveCalloutLook, MARKDOWN_SEQ_PATTERN, markdownSeqFor, attrsForMenuAction, AUTO_NUMBER_MAX_LEVEL, AUTO, HIGHLIGHT_SWATCHES, BLOCK_BACKGROUND_SWATCHES, defaultReminder, normalizeReminder, reminderText, reminderColor, LEGACY_SWATCHES, TEXT_SWATCHES, createCodeHighlighter, swatchValue, resolveCodeLanguage, orderText, resolveShikiTheme, computeHeadingOrders, resolveColorToHex, getCodeBlockTitle, CALLOUT_EMOJIS, CALLOUT_BORDER_SWATCHES, FEISHU_DEFAULT_CALLOUT, numberMenuState, MAX_SEQ_VALUE, filterCodeLanguages, pairedBorderFor, notifyOptions, withDate, withWholeDay, withTime, formatTime, withNotify, withNotifyOffset, reminderFullText, remindUsersLine, calendarDays, TIME_SLOTS, parseTimeInput } from './chunk-UD6MDBTN.js';
3
3
  import { normalizeDiagram, defaultDiagram, toMermaid, DEFAULT_DIAGRAM_HEIGHT, clampDiagramHeight, toOutline, SHAPE_SIZE } from './chunk-ABMZOL26.js';
4
4
  import * as React from 'react';
5
- import { createContext, memo, forwardRef, useState, useCallback, useRef, useEffect, useMemo, lazy, useLayoutEffect, Suspense, useContext, useReducer, useId, Children, isValidElement, cloneElement } from 'react';
5
+ import { createContext, memo, forwardRef, useState, useCallback, useRef, useEffect, useMemo, lazy, useLayoutEffect, useContext, Suspense, useReducer, useId, Children, isValidElement, cloneElement } from 'react';
6
6
  import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
7
  import { createPortal, flushSync } from 'react-dom';
8
8
  import { Extension, Node as Node$2, mergeAttributes as mergeAttributes$1, textblockTypeInputRule, Mark, InputRule, PasteRule, getChangedRanges, combineTransactionSteps, getTextSerializersFromSchema, getTextBetween, generateJSON, generateHTML } from '@tiptap/core';
@@ -11,7 +11,7 @@ import { Fragment, Slice, Mark as Mark$1, DOMSerializer } from '@tiptap/pm/model
11
11
  import { PluginKey, Plugin, TextSelection, Selection, NodeSelection, SelectionRange } from '@tiptap/pm/state';
12
12
  import { createGlobalStyle, useTheme } from 'antd-style';
13
13
  import { serialize, compile, stringify } from 'stylis';
14
- import { Node as Node$1, ReactNodeViewRenderer, mergeAttributes, Extension as Extension$1, NodeViewWrapper, NodeViewContent, useEditorState, EditorContext, EditorContent, useEditor, isNodeSelection } from '@tiptap/react';
14
+ import { Node as Node$1, mergeAttributes, Extension as Extension$1, ReactNodeViewRenderer as ReactNodeViewRenderer$1, useEditorState, EditorContext, EditorContent, useEditor, isNodeSelection, NodeViewWrapper, NodeViewContent } from '@tiptap/react';
15
15
  import { useHotkeys } from 'react-hotkeys-hook';
16
16
  import { canJoin, ReplaceStep, Mapping } from '@tiptap/pm/transform';
17
17
  import { CodeBlock } from '@tiptap/extension-code-block';
@@ -31,7 +31,7 @@ import { Superscript } from '@tiptap/extension-superscript';
31
31
  import { Subscript } from '@tiptap/extension-subscript';
32
32
  import { TextAlign } from '@tiptap/extension-text-align';
33
33
  import { UniqueID } from '@tiptap/extension-unique-id';
34
- import { gitHubEmojis, Emoji } from '@tiptap/extension-emoji';
34
+ import { Emoji, gitHubEmojis } from '@tiptap/extension-emoji';
35
35
  import { TableOfContents, getHierarchicalIndexes } from '@tiptap/extension-table-of-contents';
36
36
  import TiptapHorizontalRule from '@tiptap/extension-horizontal-rule';
37
37
  import { Heading as Heading$1 } from '@tiptap/extension-heading';
@@ -4300,6 +4300,28 @@ ${isDark ? `:root {
4300
4300
  width: 230px;
4301
4301
  box-sizing: border-box;
4302
4302
 
4303
+ /* 卡片是 align-items: center 的纵向 flex,body 不拉满就按内容宽度居中,内容一宽就两边溢出 */
4304
+ > .tiptap-card-body {
4305
+ align-self: stretch;
4306
+ }
4307
+
4308
+ /* 一行 8 个要塞进 216px(230 - 边框 - 内边距):通用按钮 min-width 32px 会撑到 282px,色块改 24px、按列均分 */
4309
+ .tiptap-card-item-group > [data-slot="tiptap-button-group"] {
4310
+ display: grid;
4311
+ grid-template-columns: repeat(8, 1fr);
4312
+ justify-items: center;
4313
+ width: 100%;
4314
+ gap: 0;
4315
+ }
4316
+
4317
+ .tiptap-card-item-group > [data-slot="tiptap-button-group"] > [data-slot="tiptap-button-group"] > .tiptap-button {
4318
+ min-width: 0;
4319
+ width: 24px;
4320
+ height: 24px;
4321
+ padding: 0;
4322
+ justify-content: center;
4323
+ }
4324
+
4303
4325
  .tt-text-color-panel__reset {
4304
4326
  width: 100%;
4305
4327
  justify-content: center;
@@ -13951,9 +13973,27 @@ function editorComponentCss(ctx) {
13951
13973
  return COMPONENT_STYLES.map((fn) => fn(ctx)).join("\n");
13952
13974
  }
13953
13975
  var SSR_PSEUDO_FLAG = "/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */";
13976
+ var PSEUDO = /:(?:first|nth|nth-last)-child/;
13977
+ function markUnsafePseudo(flat) {
13978
+ const parts = [];
13979
+ let segStart = 0;
13980
+ for (let i = 0; i < flat.length; i++) {
13981
+ const ch = flat.charCodeAt(i);
13982
+ if (ch !== 123 && ch !== 125) continue;
13983
+ const seg = flat.slice(segStart, i);
13984
+ parts.push(ch === 123 && PSEUDO.test(seg) ? `${seg} ${SSR_PSEUDO_FLAG} {` : seg + flat[i]);
13985
+ segStart = i + 1;
13986
+ }
13987
+ parts.push(flat.slice(segStart));
13988
+ return parts.join("");
13989
+ }
13990
+ var cache;
13954
13991
  function prepareForEmotion(css) {
13992
+ if (cache?.input === css) return cache.output;
13955
13993
  const flat = serialize(compile(css), stringify).replace(/\n/g, " ");
13956
- return flat.replace(/([^{}]*:(?:first|nth|nth-last)-child[^{}]*)\{/g, `$1 ${SSR_PSEUDO_FLAG} {`);
13994
+ const output = markUnsafePseudo(flat);
13995
+ cache = { input: css, output };
13996
+ return output;
13957
13997
  }
13958
13998
 
13959
13999
  // src/theme/style-context.ts
@@ -14638,6 +14678,30 @@ var getColorFromLocalStorage = () => {
14638
14678
  var getUserIdFromLocalStorage = () => {
14639
14679
  return getFromLocalStorage("_tiptap_user_id", () => uuid());
14640
14680
  };
14681
+ function isReactRenderMutation(mutation, dom, contentDOM) {
14682
+ if (mutation.type !== "childList" || !dom || !contentDOM) return false;
14683
+ if (contentDOM.contains(mutation.target)) return false;
14684
+ if (mutation.target === dom) return true;
14685
+ const changed = [
14686
+ ...Array.from(mutation.addedNodes ?? []),
14687
+ ...Array.from(mutation.removedNodes ?? [])
14688
+ ];
14689
+ return changed.includes(contentDOM);
14690
+ }
14691
+ function guardReactRenderMutations(view) {
14692
+ const v = view;
14693
+ const original = v.ignoreMutation;
14694
+ if (typeof original !== "function") return view;
14695
+ v.ignoreMutation = (mutation) => {
14696
+ if (isReactRenderMutation(mutation, v.dom, v.contentDOM)) return true;
14697
+ return original.call(view, mutation);
14698
+ };
14699
+ return view;
14700
+ }
14701
+ function ReactNodeViewRenderer(component, options) {
14702
+ const create = ReactNodeViewRenderer$1(component, options);
14703
+ return (props) => guardReactRenderMutations(create(props));
14704
+ }
14641
14705
 
14642
14706
  // src/lib/resizable-width.ts
14643
14707
  function computeResizedWidth({
@@ -52951,5 +53015,5 @@ function ArticleViewer({
52951
53015
  }
52952
53016
 
52953
53017
  export { ApiParamExtension, ArticleViewer, Audio, CalloutExtension, CodeBlockExtension, CodeGroupExtension, CollabContext, CollabProvider, Column, Columns, CommentThread, DEFAULT_DOC_PERMISSIONS, DEFAULT_MAX_FILE_SIZES, DOC_WIDTHS, DetailsExtension, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditorConfigProvider, EditorContentArea, EditorProvider, EditorThemeStyle, FileAttachment, FileInline, FloatingElement, HIDE_FLOATING_META, LoadingSpinner, MediaUploadButton, MediaUploadPlaceholder, NotionEditor, NotionEditorContent, PasteDropMedia, Separator, Spacer, Toolbar, ToolbarGroup, ToolbarSeparator, UiState, UserContext, UserProvider, VIEW_MODE_TOAST, Video, ViewModeSwitch, WIDTH_MODE_ITEMS, WIDTH_MODE_MENU_HEADER, WIDTH_MODE_MENU_TITLE, countDocument, countRange, countText, defaultUiState, detectMediaKind, findSelectionPosition, getDocPermissions, getEditorMarkdown, hasContentAbove, markHideFloatingOnNext, parseEditorContent, pickFile, printDocument, refreshCommentThreadInteractivity, renderHighlightedHTML, resolveEditorTheme, resolveMaxSize, runMediaUpload, selectNodeAndHideFloating, serializeEditorMarkdown, useCollab, useCollaboration, useComposedRef, useCursorVisibility, useEditorConfig, useElementRect, useFloatingElement, useFloatingToolbarVisibility, useIsBreakpoint, useIsomorphicLayoutEffect, useMenuNavigation, useOnClickOutside, useThrottledCallback, useUiEditorState, useUnmount, useUser, useViewMode, useWidthMode, useWindowSize, use_ui_editor_state_default };
52954
- //# sourceMappingURL=chunk-6BJB4YWS.js.map
52955
- //# sourceMappingURL=chunk-6BJB4YWS.js.map
53018
+ //# sourceMappingURL=chunk-ZLEGKX2U.js.map
53019
+ //# sourceMappingURL=chunk-ZLEGKX2U.js.map