@4399ywkf/editor 0.11.0 → 0.13.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.
@@ -2,12 +2,12 @@ import { useTiptapEditor, isExtensionAvailable, isNodeInSchema, Button, cn, getS
2
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';
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, Children, isValidElement, cloneElement } from 'react';
5
+ import { createContext, memo, forwardRef, useState, useCallback, useRef, useEffect, useMemo, lazy, useLayoutEffect, Suspense, useContext, useReducer, useId, Children, isValidElement, cloneElement } from 'react';
6
6
  import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
7
- import { createPortal } from 'react-dom';
8
- import { Extension, Node as Node$2, mergeAttributes as mergeAttributes$1, textblockTypeInputRule, InputRule, getChangedRanges, getTextSerializersFromSchema, getTextBetween, generateJSON, generateHTML } from '@tiptap/core';
7
+ import { createPortal, flushSync } from 'react-dom';
8
+ import { Extension, Node as Node$2, mergeAttributes as mergeAttributes$1, textblockTypeInputRule, Mark, InputRule, PasteRule, getChangedRanges, combineTransactionSteps, getTextSerializersFromSchema, getTextBetween, generateJSON, generateHTML } from '@tiptap/core';
9
9
  import { isChangeOrigin, Collaboration } from '@tiptap/extension-collaboration';
10
- import { Fragment, Slice, Mark, DOMSerializer } from '@tiptap/pm/model';
10
+ 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';
@@ -19,6 +19,7 @@ import { MarkdownManager, Markdown } from '@tiptap/markdown';
19
19
  import { Marked } from 'marked';
20
20
  import { shift, flip, offset, useMergeRefs, useFloating, autoUpdate, useTransitionStyles, useDismiss, useInteractions, FloatingPortal, size } from '@floating-ui/react';
21
21
  import { Doc } from 'yjs';
22
+ import { Decoration, DecorationSet } from '@tiptap/pm/view';
22
23
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
23
24
  import throttle from 'lodash.throttle';
24
25
  import { StarterKit } from '@tiptap/starter-kit';
@@ -34,7 +35,6 @@ import { gitHubEmojis, Emoji } from '@tiptap/extension-emoji';
34
35
  import { TableOfContents, getHierarchicalIndexes } from '@tiptap/extension-table-of-contents';
35
36
  import TiptapHorizontalRule from '@tiptap/extension-horizontal-rule';
36
37
  import { Heading as Heading$1 } from '@tiptap/extension-heading';
37
- import { Decoration, DecorationSet } from '@tiptap/pm/view';
38
38
  import { Image as Image$1 } from '@tiptap/extension-image';
39
39
  import { BlockMath, InlineMath } from '@tiptap/extension-mathematics';
40
40
  import { columnResizing, tableEditing, cellAround, TableMap, TableView, columnResizingPluginKey, CellSelection, mergeCells, splitCell, selectedRect, findTable, deleteCellSelection, selectionCell, isInTable, addRow, addColumn, deleteRow, deleteColumn, toggleHeader as toggleHeader$1, moveTableRow, moveTableColumn, addRowBefore, addRowAfter, addColumnBefore, addColumnAfter, rowIsHeader, columnIsHeader } from '@tiptap/pm/tables';
@@ -54,6 +54,7 @@ import { Paragraph } from '@tiptap/extension-paragraph';
54
54
  import { Blockquote } from '@tiptap/extension-blockquote';
55
55
  import { Code } from '@tiptap/extension-code';
56
56
  import { Highlight } from '@tiptap/extension-highlight';
57
+ import { Link } from '@tiptap/extension-link';
57
58
  import { Strike } from '@tiptap/extension-strike';
58
59
 
59
60
  var DEFAULT_MAX_FILE_SIZES = {
@@ -302,7 +303,7 @@ var readOnlyGuardKey = new PluginKey("readOnlyGuard");
302
303
  var IDENTITY_ATTRS = /* @__PURE__ */ new Set(["id", "data-toc-id"]);
303
304
  function onlyIdsChanged(a, b) {
304
305
  if (a.type !== b.type || a.childCount !== b.childCount || a.text !== b.text) return false;
305
- if (!Mark.sameSet(a.marks, b.marks) || !sameAttrsExceptId(a.attrs, b.attrs)) return false;
306
+ if (!Mark$1.sameSet(a.marks, b.marks) || !sameAttrsExceptId(a.attrs, b.attrs)) return false;
306
307
  for (let i = 0; i < a.childCount; i += 1) {
307
308
  if (!onlyIdsChanged(a.child(i), b.child(i))) return false;
308
309
  }
@@ -841,8 +842,8 @@ function feishuSurface(token, isDark) {
841
842
  codeHeaderBg: "rgba(31, 35, 41, 0.04)",
842
843
  codeDividerColor: "#dee0e3",
843
844
  calloutBordered: true,
844
- tableBorderColor: "rgba(47, 50, 55, 0.2)",
845
- // 迁移前 --tt-gray-light-a-300
845
+ tableBorderColor: "#dee0e3",
846
+ // 飞书知识库 docx 实测单元格边框 N300
846
847
  tableHeaderBg: "rgba(15, 22, 36, 0.05)",
847
848
  // 迁移前 --tt-gray-light-a-100
848
849
  tableRadius: 0,
@@ -2061,7 +2062,7 @@ ${isDark ? `:root .tt-block-marquee {
2061
2062
  `;
2062
2063
 
2063
2064
  // src/components/tiptap-node/blockquote-node/blockquote-node.style.ts
2064
- var blockquoteNodeStyles = ({ isDark }) => `
2065
+ var blockquoteNodeStyles = ({ isDark, pick }) => `
2065
2066
  .tiptap.ProseMirror {
2066
2067
  /* 对齐飞书引用块:竖条 N400(#bbbfc4)、文字 N600(#646a73) */
2067
2068
  /* (与 new-editor 编辑态 app 层的 --udtoken-quote-bar-bg/--text-caption 同源同值) */
@@ -2078,11 +2079,11 @@ var blockquoteNodeStyles = ({ isDark }) => `
2078
2079
  BLOCKQUOTE
2079
2080
  ===================== */
2080
2081
  .tiptap.ProseMirror {
2081
- /* 对齐飞书:2px 竖条 + 12px 缩进 + 灰色文字,块上下 16px */
2082
+ /* 对齐飞书:2px 竖条 + 12px 缩进 + 灰色文字;飞书风块上下 8px(知识库 docx 实测) */
2082
2083
  blockquote {
2083
2084
  position: relative;
2084
2085
  padding-left: 12px;
2085
- margin: 16px 0;
2086
+ margin: ${pick("8px 0 8px 2px", "16px 0")};
2086
2087
  color: var(--blockquote-text-color);
2087
2088
 
2088
2089
  p {
@@ -2093,7 +2094,7 @@ var blockquoteNodeStyles = ({ isDark }) => `
2093
2094
  &.is-empty::before {
2094
2095
  position: absolute;
2095
2096
  bottom: 0;
2096
- left: 0;
2097
+ left: ${pick("-2px", "0")};
2097
2098
  top: 0;
2098
2099
  height: 100%;
2099
2100
  width: 2px;
@@ -3285,7 +3286,7 @@ var cardStyles = ({ surface, gray }) => `
3285
3286
  `;
3286
3287
 
3287
3288
  // src/components/tiptap-node/code-block-node/code-block-node.style.ts
3288
- var codeBlockStyles = ({ token, surface, gray }) => {
3289
+ var codeBlockStyles = ({ token, surface, gray, pick }) => {
3289
3290
  const text = gray(800);
3290
3291
  const muted = gray(600);
3291
3292
  return `
@@ -3334,8 +3335,9 @@ var codeBlockStyles = ({ token, surface, gray }) => {
3334
3335
  .tiptap-code-block {
3335
3336
  position: relative;
3336
3337
  margin: 16px 0;
3338
+ padding-bottom: ${pick("2px", "0")};
3337
3339
  border: 1px solid ${surface.blockBorderColor};
3338
- border-radius: ${surface.blockRadius}px;
3340
+ border-radius: ${pick("8px", `${surface.blockRadius}px`)};
3339
3341
  background-color: ${surface.codeBg};
3340
3342
  color: ${text};
3341
3343
 
@@ -3365,16 +3367,16 @@ var codeBlockStyles = ({ token, surface, gray }) => {
3365
3367
  align-items: center;
3366
3368
  justify-content: space-between;
3367
3369
  gap: 8px;
3368
- height: 24px;
3369
- padding: 4px 8px 0;
3370
+ height: ${pick("32px", "24px")};
3371
+ padding: ${pick("8px 8px 0 12px", "4px 8px 0")};
3370
3372
  border-radius: ${surface.blockRadius}px ${surface.blockRadius}px 0 0;
3371
3373
  background: transparent;
3372
- font-size: 12px;
3373
- line-height: 20px;
3374
- color: ${muted};
3374
+ font-size: ${pick("14px", "12px")};
3375
+ line-height: ${pick("22px", "20px")};
3376
+ color: ${pick("#646a73", muted)};
3375
3377
  user-select: none;
3376
- opacity: 0;
3377
- pointer-events: none;
3378
+ opacity: ${pick("1", "0")};
3379
+ pointer-events: ${pick("auto", "none")};
3378
3380
  transition: opacity 0.15s;
3379
3381
  }
3380
3382
 
@@ -3385,9 +3387,14 @@ var codeBlockStyles = ({ token, surface, gray }) => {
3385
3387
  }
3386
3388
 
3387
3389
  .tiptap-code-block > pre {
3388
- margin-top: 24px;
3389
- padding-top: 4px;
3390
- min-height: 53px;
3390
+ margin-top: ${pick("32px", "24px")};
3391
+ padding-top: ${pick("8px", "4px")};${pick(
3392
+ `
3393
+ padding-right: 20px;
3394
+ padding-bottom: 24px;`,
3395
+ ""
3396
+ )}
3397
+ min-height: ${pick("61px", "53px")};
3391
3398
  max-height: 1958px;
3392
3399
  overflow-y: auto;
3393
3400
  box-sizing: border-box;
@@ -3560,14 +3567,14 @@ var codeBlockStyles = ({ token, surface, gray }) => {
3560
3567
 
3561
3568
  /* 行号:数字由 ::before 画,不进文档文本,复制不会带上 */
3562
3569
  .tiptap-code-block__pre.has-line-numbers {
3563
- padding-left: 3.5em;
3570
+ padding-left: ${pick("59px", "3.5em")};
3564
3571
  }
3565
3572
 
3566
3573
  .tt-code-line-number {
3567
3574
  display: inline-block;
3568
- width: 2.5em;
3569
- margin-left: -3.5em;
3570
- margin-right: 1em;
3575
+ width: ${pick("45px", "2.5em")};
3576
+ margin-left: ${pick("-59px", "-3.5em")};
3577
+ margin-right: ${pick("14px", "1em")};
3571
3578
  text-align: right;
3572
3579
  color: ${muted};
3573
3580
  opacity: 0.7;
@@ -3879,7 +3886,7 @@ var codeGroupStyles = ({ token, surface, gray }) => `
3879
3886
  `;
3880
3887
 
3881
3888
  // src/components/tiptap-node/collapsible-node/collapsible-node.style.ts
3882
- var collapsibleStyles = ({ token, surface, isDark, gray }) => `
3889
+ var collapsibleStyles = ({ token, surface, isDark, gray, pick }) => `
3883
3890
  .tiptap.ProseMirror {
3884
3891
  .tt-collapsible { position: relative; margin: 12px 0; }
3885
3892
  .tt-collapsible__header { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 32px; user-select: none; }
@@ -3921,8 +3928,9 @@ var collapsibleStyles = ({ token, surface, isDark, gray }) => `
3921
3928
  display: flex;
3922
3929
  align-items: flex-start;
3923
3930
  gap: 8px;
3924
- margin: 12px 0;
3925
- padding: 12px 16px;
3931
+ /* 飞书知识库 docx:内边距 16,块下 16(上沿跟随前一块的 8px) */
3932
+ margin: ${pick("8px 0 16px", "12px 0")};
3933
+ padding: ${pick("16px", "12px 16px")};
3926
3934
  /* 飞书描边、Notion 只铺底色 */
3927
3935
  border: 1px solid ${surface.calloutBordered ? "var(--callout-border, var(--tt-color-callout-border-orange))" : "transparent"};
3928
3936
  border-radius: ${surface.cardRadius}px;
@@ -4309,8 +4317,9 @@ var columnNodeStyles = ({ pick, surface, isDark }) => `
4309
4317
  [data-type="columns"],
4310
4318
  .tiptap-columns {
4311
4319
  display: grid;
4312
- gap: 1rem;
4313
- margin: 0.5em 0;
4320
+ /* 飞书知识库 docx 实测:列间距 24,分栏块上下 16,列内首块不带上外边距 */
4321
+ gap: ${pick("24px", "1rem")};
4322
+ margin: ${pick("16px 0", "0.5em 0")};
4314
4323
  }
4315
4324
 
4316
4325
  [data-type="columns"].layout-column,
@@ -4333,6 +4342,18 @@ var columnNodeStyles = ({ pick, surface, isDark }) => `
4333
4342
  [data-type="column"] {
4334
4343
  min-width: 0; /* 防止内容撑破网格列 */
4335
4344
  }
4345
+ ${pick(`
4346
+ /* 列是 grid 项,块的外边距出不了列;飞书列内首块不带上外边距、末块不带下外边距(图片的外边距在里层) */
4347
+ [data-type="column"] > :first-child,
4348
+ [data-type="column"] > :first-child > .tiptap-image,
4349
+ [data-type="column"] > .ProseMirror-widget:first-child + * {
4350
+ margin-top: 0;
4351
+ }
4352
+
4353
+ [data-type="column"] > :last-child,
4354
+ [data-type="column"] > :last-child > .tiptap-image {
4355
+ margin-bottom: 0;
4356
+ }`, "")}
4336
4357
 
4337
4358
  /* React NodeView 在 grid 容器和列之间多包了一层 contentDOM,让它不参与布局,列才是 grid 的子项 */
4338
4359
  .tiptap-columns > [data-node-view-content-react] {
@@ -4351,7 +4372,7 @@ var columnNodeStyles = ({ pick, surface, isDark }) => `
4351
4372
  /* 飞书按容器宽度(不足 578px)决定是否堆叠,所以用容器查询 */
4352
4373
  .tiptap-columns-wrapper {
4353
4374
  position: relative;
4354
- margin: 0.5em 0;
4375
+ margin: ${pick("16px 0", "0.5em 0")};
4355
4376
  container-type: inline-size;
4356
4377
 
4357
4378
  .tiptap-columns {
@@ -6082,6 +6103,7 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6082
6103
  /* 标题字号/行高/字重/间距对齐飞书文档(帮助中心文章页实测值): */
6083
6104
  /* h1 26/36 600 · h2 22/30 600 · h3 20/28 600 · h4 18/26 500 · h5/h6 16/26 500, */
6084
6105
  /* margin-top 等于自身字号,margin-bottom 8px(h1 为 10px)。 */
6106
+ /* 飞书风另按知识库 docx 实测:h1–h3 字重 500(加粗文字才 700)、行高 1.4、字距 -0.02em。 */
6085
6107
  .tiptap.ProseMirror {
6086
6108
  h1,
6087
6109
  h2,
@@ -6092,6 +6114,7 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6092
6114
  position: relative;
6093
6115
  color: inherit;
6094
6116
  font-style: inherit;
6117
+ letter-spacing: ${pick("-0.02em", "normal")};
6095
6118
  }
6096
6119
 
6097
6120
  > h1:first-child,
@@ -6109,18 +6132,28 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6109
6132
  margin-top: 0;
6110
6133
  }
6111
6134
 
6112
- h1 {
6135
+ ${pick(` /* 飞书标题底色是 6px 圆角的蒙层 */
6136
+ h1[style*="background-color"],
6137
+ h2[style*="background-color"],
6138
+ h3[style*="background-color"],
6139
+ h4[style*="background-color"],
6140
+ h5[style*="background-color"],
6141
+ h6[style*="background-color"] {
6142
+ border-radius: 6px;
6143
+ }
6144
+
6145
+ `, "")} h1 {
6113
6146
  font-size: 26px;
6114
- line-height: 36px;
6115
- font-weight: 600;
6147
+ line-height: ${pick("36.4px", "36px")};
6148
+ font-weight: ${pick("500", "600")};
6116
6149
  margin-top: 26px;
6117
6150
  margin-bottom: 10px;
6118
6151
  }
6119
6152
 
6120
6153
  h2 {
6121
6154
  font-size: 22px;
6122
- line-height: 30px;
6123
- font-weight: 600;
6155
+ line-height: ${pick("30.8px", "30px")};
6156
+ font-weight: ${pick("500", "600")};
6124
6157
  margin-top: 22px;
6125
6158
  margin-bottom: 8px;
6126
6159
  }
@@ -6128,14 +6161,14 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6128
6161
  h3 {
6129
6162
  font-size: 20px;
6130
6163
  line-height: 28px;
6131
- font-weight: 600;
6164
+ font-weight: ${pick("500", "600")};
6132
6165
  margin-top: 20px;
6133
6166
  margin-bottom: 8px;
6134
6167
  }
6135
6168
 
6136
6169
  h4 {
6137
6170
  font-size: 18px;
6138
- line-height: 26px;
6171
+ line-height: ${pick("25.2px", "26px")};
6139
6172
  font-weight: 500;
6140
6173
  margin-top: 18px;
6141
6174
  margin-bottom: 8px;
@@ -6155,6 +6188,7 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6155
6188
  .tiptap.ProseMirror {
6156
6189
  [data-heading-level] {
6157
6190
  position: relative;
6191
+ letter-spacing: ${pick("-0.02em", "normal")};
6158
6192
  font-size: 16px;
6159
6193
  line-height: 26px;
6160
6194
  font-weight: 500;
@@ -6368,7 +6402,7 @@ var headingNodeStyles = ({ pick, surface, isDark }) => `
6368
6402
  `;
6369
6403
 
6370
6404
  // src/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.style.ts
6371
- var horizontalRuleNodeStyles = ({ isDark }) => `
6405
+ var horizontalRuleNodeStyles = ({ isDark, pick }) => `
6372
6406
  .tiptap.ProseMirror {
6373
6407
  --horizontal-rule-color: var(--tt-gray-light-a-200);
6374
6408
 
@@ -6383,15 +6417,17 @@ var horizontalRuleNodeStyles = ({ isDark }) => `
6383
6417
  .tiptap.ProseMirror {
6384
6418
  hr {
6385
6419
  border: none;
6386
- height: 1px;
6420
+ height: 1px;${pick(`
6421
+ margin: 0;`, "")}
6387
6422
  background-color: var(--horizontal-rule-color);
6388
6423
  }
6389
6424
 
6425
+ /* 飞书分割线块:上下 8px、内边距 12px,整块高 25px */
6390
6426
  [data-type="horizontalRule"] {
6391
- margin-top: 2.25em;
6392
- margin-bottom: 2.25em;
6393
- padding-top: 0.75rem;
6394
- padding-bottom: 0.75rem;
6427
+ margin-top: ${pick("8px", "2.25em")};
6428
+ margin-bottom: ${pick("8px", "2.25em")};
6429
+ padding-top: ${pick("12px", "0.75rem")};
6430
+ padding-bottom: ${pick("12px", "0.75rem")};
6395
6431
  }
6396
6432
  }
6397
6433
  `;
@@ -6455,7 +6491,7 @@ ${isDark ? `:root {
6455
6491
  .tiptap-image {
6456
6492
  display: flex;
6457
6493
  width: 100%;
6458
- margin: 1.5rem 0;
6494
+ margin: ${pick("16px 0", "1.5rem 0")};
6459
6495
 
6460
6496
  &[data-align="right"] {
6461
6497
  text-align: right;
@@ -6496,6 +6532,11 @@ ${isDark ? `:root {
6496
6532
  border-radius: var(--tt-radius-xs, 0.25rem);
6497
6533
  }
6498
6534
 
6535
+ /* 加载前按节点记的宽高比占位(见 image-transform.tsx),给个浅底,别是一块看不见的空白 */
6536
+ .tiptap-image-img[data-pending] {
6537
+ background: var(${isDark ? "--tt-gray-dark-a-100" : "--tt-gray-light-a-100"});
6538
+ }
6539
+
6499
6540
  .tiptap-image-handle {
6500
6541
  position: absolute;
6501
6542
  top: 50%;
@@ -6524,7 +6565,7 @@ ${isDark ? `:root {
6524
6565
  width: 100%;
6525
6566
  white-space: break-spaces;
6526
6567
  word-break: break-word;
6527
- margin-top: 1rem;
6568
+ margin-top: ${pick("8px", "1rem")};
6528
6569
  outline: none;
6529
6570
  position: relative;
6530
6571
 
@@ -8137,6 +8178,8 @@ var listNodeStyles = ({ pick, surface, isDark }) => `
8137
8178
  ul:not([data-type="taskList"]) > li::marker {
8138
8179
  color: var(--tt-list-marker-color);
8139
8180
  font-size: 1.2em;
8181
+ /* 放大后的 bullet 若沿用 1.625 行高(31px)会把每行撑高 3px */
8182
+ line-height: 1;
8140
8183
  }
8141
8184
 
8142
8185
  ul:not([data-type="taskList"]) {
@@ -8878,7 +8921,7 @@ var mermaidNodeStyles = ({ pick, surface }) => `
8878
8921
  `;
8879
8922
 
8880
8923
  // src/components/tiptap-templates/notion-like/notion-like-editor-header.style.ts
8881
- var notionLikeEditorHeaderStyles = ({ surface, pick, isDark }) => `
8924
+ var notionLikeEditorHeaderStyles = ({ token, surface, pick, isDark }) => `
8882
8925
  :root {
8883
8926
  --tt-notion-like-editor-header-border: var(--tt-gray-light-a-200);
8884
8927
  --tt-notion-like-editor-header-bg: var(--white);
@@ -8895,7 +8938,9 @@ ${isDark ? `:root {
8895
8938
  width: 100%;
8896
8939
  display: flex;
8897
8940
  align-items: center;
8898
- height: 3rem;
8941
+ min-height: 3rem;
8942
+ box-sizing: border-box;
8943
+ gap: 0.5rem;
8899
8944
  padding: 0.5rem 0.75rem;
8900
8945
  z-index: 50;
8901
8946
  background-color: var(--tt-notion-like-editor-header-bg);
@@ -8905,14 +8950,189 @@ ${isDark ? `:root {
8905
8950
  display: flex;
8906
8951
  align-items: center;
8907
8952
  flex-direction: row;
8953
+ flex-shrink: 0;
8954
+ gap: 0.25rem;
8955
+ }
8956
+
8957
+ &-feedback {
8958
+ display: flex;
8959
+ align-items: center;
8960
+ flex-shrink: 0;
8961
+ gap: 0.375rem;
8962
+ }
8963
+
8964
+ button:focus-visible {
8965
+ outline: 2px solid ${surface.accentColor};
8966
+ outline-offset: 2px;
8967
+ }
8968
+ }
8969
+
8970
+ .notion-like-editor-save-state {
8971
+ display: flex;
8972
+ align-items: center;
8973
+ gap: 0.375rem;
8974
+ color: ${surface.textSecondary};
8975
+ font-size: 0.75rem;
8976
+ line-height: 1.5rem;
8977
+ white-space: nowrap;
8978
+
8979
+ &[data-save-state="error"] {
8980
+ color: ${token.colorError};
8981
+ }
8982
+
8983
+ &[data-save-state="offline"] {
8984
+ color: ${token.colorWarningText};
8985
+ }
8986
+
8987
+ &-indicator {
8988
+ width: 0.375rem;
8989
+ height: 0.375rem;
8990
+ border-radius: 50%;
8991
+ background: currentColor;
8992
+ }
8993
+
8994
+ &[data-save-state="saving"] &-indicator {
8995
+ width: 0.625rem;
8996
+ height: 0.625rem;
8997
+ box-sizing: border-box;
8998
+ border: 1px solid currentColor;
8999
+ border-right-color: transparent;
9000
+ background: transparent;
9001
+ animation: notion-like-editor-saving 0.8s linear infinite;
9002
+ }
9003
+ }
9004
+
9005
+ .notion-like-editor-header .notion-like-editor-share {
9006
+ padding-inline: 0.875rem;
9007
+ color: ${token.colorTextLightSolid};
9008
+ background: ${surface.accentColor};
9009
+
9010
+ &:hover {
9011
+ color: ${token.colorTextLightSolid};
9012
+ background: ${token.colorPrimaryHover};
9013
+ }
9014
+ }
9015
+
9016
+ .notion-like-editor-comment-count {
9017
+ min-width: 0.75rem;
9018
+ font-variant-numeric: tabular-nums;
9019
+ }
9020
+
9021
+ .notion-like-editor-menu {
9022
+ height: auto;
9023
+ min-width: 11rem;
9024
+ max-width: calc(100vw - 1rem);
9025
+ padding: 0.375rem;
9026
+ border: 1px solid ${surface.floatBorderColor};
9027
+ border-radius: ${surface.floatRadius}px;
9028
+ color: ${surface.colorText};
9029
+ background: ${surface.floatBg};
9030
+ box-shadow: ${surface.floatShadow};
9031
+ z-index: 60;
9032
+
9033
+ .tiptap-menu-group {
9034
+ display: block;
9035
+ }
9036
+
9037
+ .tiptap-menu-group-label {
9038
+ margin-top: 0.25rem;
9039
+ color: ${surface.textSecondary};
9040
+ }
9041
+
9042
+ &-item {
9043
+ display: flex;
9044
+ align-items: center;
9045
+ justify-content: flex-start;
8908
9046
  gap: 0.5rem;
9047
+ min-height: 2rem;
9048
+ padding: 0.375rem 0.5rem;
9049
+ border-radius: ${surface.itemRadius}px;
9050
+ font-size: 0.875rem;
9051
+ line-height: 1.25rem;
9052
+ cursor: pointer;
9053
+ outline: none;
9054
+
9055
+ &:hover,
9056
+ &[data-active-item] {
9057
+ background: ${surface.itemHoverBg};
9058
+ }
9059
+
9060
+ &:focus-visible {
9061
+ outline: 2px solid ${surface.accentColor};
9062
+ outline-offset: -2px;
9063
+ }
9064
+
9065
+ .tiptap-button-icon,
9066
+ .tiptap-menu-item-check {
9067
+ width: 1rem;
9068
+ height: 1rem;
9069
+ }
9070
+
9071
+ .tiptap-menu-item-check {
9072
+ margin-left: auto;
9073
+ }
9074
+ }
9075
+
9076
+ &-separator {
9077
+ margin: 0.375rem 0;
9078
+ border: 0;
9079
+ border-top: 1px solid ${surface.dividerColor};
9080
+ }
9081
+
9082
+ &-note {
9083
+ padding: 0.375rem 0.5rem;
9084
+ color: ${surface.textSecondary};
9085
+ font-size: 0.75rem;
9086
+ line-height: 1.25rem;
9087
+ }
9088
+ }
9089
+
9090
+ @keyframes notion-like-editor-saving {
9091
+ to { transform: rotate(360deg); }
9092
+ }
9093
+
9094
+ @media (prefers-reduced-motion: reduce) {
9095
+ .notion-like-editor-save-state-indicator {
9096
+ animation: none !important;
9097
+ }
9098
+ }
9099
+
9100
+ @media (max-width: 640px) {
9101
+ .notion-like-editor-header {
9102
+ flex-wrap: wrap;
9103
+ padding-inline: 0.5rem;
9104
+
9105
+ &-feedback {
9106
+ flex-basis: 100%;
9107
+ }
9108
+
9109
+ &-actions {
9110
+ margin-left: auto;
9111
+ }
8909
9112
  }
8910
9113
  }
8911
9114
  `;
8912
9115
 
8913
9116
  // src/components/tiptap-templates/notion-like/notion-like-editor.style.ts
8914
- var notionLikeEditorStyles = ({ surface }) => `
8915
- /* 正文字体栈对齐飞书文档(feishu.cn 文章页实测值),纯系统字体、无外网字体依赖 */
9117
+ var ARTICLE_FONT_STACK = '"Segoe UI Emoji", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "PingFang SC", Roboto, "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Hiragino Sans", "Lucida Grande", sans-serif';
9118
+ var DOCX_FONT_STACK = 'TTChineseQuote, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Tahoma, "PingFang SC", "Microsoft Yahei", Arial, "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
9119
+ var CHINESE_QUOTE_FACES = [
9120
+ ["400", 'local("PingFangSC-Regular"), local("PingFang SC"), local("Microsoft YaHei"), local("Hiragino Sans GB")'],
9121
+ ["500", 'local("PingFangSC-Medium"), local("PingFang SC Medium"), local("Microsoft YaHei"), local("Hiragino Sans GB")'],
9122
+ ["600", 'local("PingFangSC-Semibold"), local("PingFang SC Semibold"), local("Microsoft YaHei Bold"), local("Hiragino Sans GB W6")'],
9123
+ ["700", 'local("PingFangSC-Semibold"), local("PingFang SC Semibold"), local("Microsoft YaHei Bold"), local("Hiragino Sans GB W6")']
9124
+ ].map(
9125
+ ([weight, src]) => `@font-face {
9126
+ font-family: TTChineseQuote;
9127
+ font-weight: ${weight};
9128
+ src: ${src};
9129
+ unicode-range: U+2018, U+2019, U+201A, U+201C, U+201D, U+201E;
9130
+ }`
9131
+ ).join("\n");
9132
+ var notionLikeEditorStyles = ({ surface, pick }) => `
9133
+ ${pick(CHINESE_QUOTE_FACES, "")}
9134
+
9135
+ /* 正文字体栈对齐飞书(Notion 风沿用 feishu.cn 文章页实测值,飞书风用知识库 docx 实测值),纯系统字体、无外网字体依赖 */
8916
9136
  /* (原 Google Fonts 的 DM Sans/Inter 在内网/无外网环境加载失败,中文全靠 sans-serif 兜底)。 */
8917
9137
  /* "Segoe UI Emoji" 放最前是飞书的做法:Windows 上 emoji 走彩色字体,文本字符自动落到后面的正文字体。 */
8918
9138
  /* 正文色读表面 token surface.colorText(src/theme/editor-theme.ts:Notion #2c2c2b / 飞书 N900 #1f2329)。 */
@@ -8923,7 +9143,7 @@ var notionLikeEditorStyles = ({ surface }) => `
8923
9143
  /* Helvetica Neue 的 0.517,整站文字缩小 1.7%,切换文章(编辑器卸载再挂载)时全站字体抖一下。 */
8924
9144
  /* 页面底色、overscroll 归宿主管;独立整页编辑器的宿主页面自己设。 */
8925
9145
  .notion-like-editor-wrapper {
8926
- font-family: "Segoe UI Emoji", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "PingFang SC", Roboto, "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Hiragino Sans", "Lucida Grande", sans-serif;
9146
+ font-family: ${pick(DOCX_FONT_STACK, ARTICLE_FONT_STACK)};
8927
9147
  color: ${surface.colorText};
8928
9148
  font-weight: 400;
8929
9149
  font-style: normal;
@@ -8952,7 +9172,10 @@ var notionLikeEditorStyles = ({ surface }) => `
8952
9172
  }
8953
9173
 
8954
9174
  .tiptap.ProseMirror {
8955
- font-family: "Segoe UI Emoji", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "PingFang SC", Roboto, "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Hiragino Sans", "Lucida Grande", sans-serif;
9175
+ font-family: ${pick(DOCX_FONT_STACK, ARTICLE_FONT_STACK)};${pick(`
9176
+ /* 飞书 docx 正文:行尾放不下的空格也折到下一行(break-spaces),长串在任意处断行 */
9177
+ white-space: break-spaces;
9178
+ word-break: break-word;`, "")}
8956
9179
  /* 正文基准对齐飞书文档:16px / 1.625 / #1f2329。 */
8957
9180
  /* 字号必须显式定在编辑器根上:li>p、td/th p 等不走 paragraph-node.scss 的 */
8958
9181
  /* p:not(:first-child) 字号声明,全靠这里继承;不写会继承宿主容器字号 */
@@ -8974,7 +9197,7 @@ var notionLikeEditorStyles = ({ surface }) => `
8974
9197
  /* 用 :not() 写在原规则上而不是后面再覆盖一遍——两个类同特异性,靠源序决胜负太脆。 */
8975
9198
  @media screen and (max-width: 480px) {
8976
9199
  .notion-like-editor-wrapper:not(.notion-like-editor-wrapper--embedded) {
8977
- width: 100vw;
9200
+ width: 100%;
8978
9201
  height: 100vh;
8979
9202
  overflow: auto;
8980
9203
  }
@@ -9306,17 +9529,22 @@ var orderedListNumberMenuStyles = ({ surface, pick }) => `
9306
9529
  // src/components/tiptap-node/page-header-node/page-header-node.style.ts
9307
9530
  var pageHeaderNodeStyles = ({ surface, pick, isDark }) => `
9308
9531
  /* 文档页头:封面 → 添加图标 / 添加封面 → 图标 + 标题,尺寸对齐飞书(标题 40px / 粗体,封面高 200px) */
9532
+ ${pick(`.notion-like-editor-layout {
9533
+ container-type: inline-size;
9534
+ }`, "")}
9535
+
9309
9536
  .tiptap.ProseMirror {
9310
9537
  .tt-page-header {
9311
9538
  position: relative;
9312
9539
  margin: 0 0 16px;
9313
9540
  }
9314
9541
 
9315
- /* 封面横向铺满正文列,左右多出正文内边距那一截,和飞书一样贴边 */
9542
+ /* 封面横向铺满正文列,左右多出正文内边距那一截,和飞书一样贴边;
9543
+ 飞书风按知识库 docx:横跨整个编辑器布局区(不止正文列),高度由宿主用 --tt-page-cover-height 给 */
9316
9544
  .tt-page-header__cover {
9317
9545
  position: relative;
9318
- height: 200px;
9319
- margin: -3rem -3rem 0;
9546
+ height: var(--tt-page-cover-height, 200px);
9547
+ margin: ${pick("-3rem calc(50% - 50cqw) 0", "-3rem -3rem 0")};
9320
9548
  user-select: none;
9321
9549
 
9322
9550
  &[data-repositioning="true"] {
@@ -9358,6 +9586,21 @@ var pageHeaderNodeStyles = ({ surface, pick, isDark }) => `
9358
9586
  align-items: baseline;
9359
9587
  }
9360
9588
 
9589
+ /* 飞书知识库 docx:封面下 20px 内边距 + 28px「添加图标 / 封面」行,只读时这行也占位 */
9590
+ ${pick(`.tt-page-header__cover + .tt-page-header__title-row {
9591
+ margin-top: 48px;
9592
+ }
9593
+
9594
+ .tt-page-header__add {
9595
+ margin: 20px 0 0;
9596
+ }
9597
+
9598
+ /* 页头下第一块不再叠加自身上外边距,和飞书一样从页头底部固定间距开始 */
9599
+ > .node-pageHeader + *,
9600
+ > [data-page-header] + * {
9601
+ margin-top: 0;
9602
+ }`, "")}
9603
+
9361
9604
  .tt-page-header__title-row > .tt-page-header__title {
9362
9605
  flex: 1;
9363
9606
  min-width: 0;
@@ -9368,7 +9611,7 @@ var pageHeaderNodeStyles = ({ surface, pick, isDark }) => `
9368
9611
  flex: none;
9369
9612
  margin-right: 6px;
9370
9613
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
9371
- font-size: 40px;
9614
+ font-size: ${pick("34px", "40px")};
9372
9615
  line-height: 1;
9373
9616
 
9374
9617
  button,
@@ -9376,8 +9619,8 @@ var pageHeaderNodeStyles = ({ surface, pick, isDark }) => `
9376
9619
  display: flex;
9377
9620
  align-items: center;
9378
9621
  justify-content: center;
9379
- width: 1.18em;
9380
- height: 1.18em;
9622
+ width: ${pick("40px", "1.18em")};
9623
+ height: ${pick("40px", "1.18em")};
9381
9624
  padding: 0;
9382
9625
  border: none;
9383
9626
  border-radius: ${pick("6px", `${surface.inputRadius}px`)};
@@ -9432,9 +9675,9 @@ var pageHeaderNodeStyles = ({ surface, pick, isDark }) => `
9432
9675
  }
9433
9676
 
9434
9677
  .tt-page-header__title {
9435
- font-size: 40px;
9436
- line-height: 52px;
9437
- font-weight: 700;
9678
+ font-size: ${pick("34px", "40px")};
9679
+ line-height: ${pick("55.25px", "52px")};
9680
+ font-weight: ${pick("500", "700")};
9438
9681
  color: var(--tt-color-text);
9439
9682
  word-break: break-word;
9440
9683
  }
@@ -9717,6 +9960,11 @@ var paragraphNodeStyles = ({ isDark }) => `
9717
9960
  /* 段距对齐飞书(每个段落行 margin 8px,首段 0);字号/行高统一继承编辑器根 */
9718
9961
  /* (notion-like-editor.scss 的 16px/1.625),这里不再重复声明——重复声明会让 */
9719
9962
  /* 被 :not() 排除的 li>p、td/th p 与普通段落走上不同的字号来源。 */
9963
+ /* 浏览器默认 p 有 1em 下边距:不清掉的话段距变 16px、列表项间距变 16~24px */
9964
+ p {
9965
+ margin-bottom: 0;
9966
+ }
9967
+
9720
9968
  p:not(:first-child):not(td p):not(th p) {
9721
9969
  margin-top: 8px;
9722
9970
  }
@@ -11615,6 +11863,15 @@ var syncedBlockStyles = ({ surface, pick, isDark }) => `
11615
11863
  linear-gradient(135deg, rgb(var(--tt-synced-a)), rgb(var(--tt-synced-b)), rgb(var(--tt-synced-c)));
11616
11864
  }
11617
11865
 
11866
+ /* 飞书只读同步块:内容紧贴内边距,首块不带上外边距、末块不带下外边距 */
11867
+ ${pick(`.tt-synced-block__content > * > :first-child {
11868
+ margin-top: 0;
11869
+ }
11870
+
11871
+ .tt-synced-block__content > * > :last-child {
11872
+ margin-bottom: 0;
11873
+ }`, "")}
11874
+
11618
11875
  &.ProseMirror-selectednode,
11619
11876
  .tt-block-selected > & {
11620
11877
  border-color: #245bdb;
@@ -12254,10 +12511,25 @@ var tableInsertBarsStyles = ({ pick, surface }) => `
12254
12511
  `;
12255
12512
 
12256
12513
  // src/components/tiptap-node/table-node/styles/table-node.style.ts
12257
- var tableStyles = ({ token, surface }) => `
12514
+ var tableStyles = ({ token, surface, pick }) => `
12515
+ /* 飞书知识库 docx:表格上沿距前一块 29.5(扣掉包裹层留给手柄的 16 内边距);
12516
+ 下沿是「表格 + 2 + max(24, 下一块上外边距)」,只读时没有「添加行」按钮,底部内边距让给外边距去折叠 */
12258
12517
  .tiptap [data-content-type="table"] {
12259
- margin-block: var(--tt-table-margin-block);
12518
+ margin-block: ${pick("13.5px 2px", "var(--tt-table-margin-block)")};
12260
12519
  }
12520
+ ${pick(
12521
+ `
12522
+ .notion-like-editor-wrapper--readonly .tiptap [data-content-type="table"] {
12523
+ margin-block-end: 24px;
12524
+ }
12525
+
12526
+ .notion-like-editor-wrapper--readonly .tiptap [data-content-type="table"] .tableWrapper {
12527
+ margin-left: 0;
12528
+ padding-inline: 0;
12529
+ padding-block-end: 2px;
12530
+ }`,
12531
+ ""
12532
+ )}
12261
12533
 
12262
12534
  .tiptap [data-content-type="table"] .tableWrapper {
12263
12535
  padding-block-start: var(--tt-table-pad-block-start);
@@ -12280,7 +12552,7 @@ var tableStyles = ({ token, surface }) => `
12280
12552
  border: 1px solid ${surface.tableBorderColor};
12281
12553
  padding: var(--tt-table-cell-padding);
12282
12554
  }
12283
- ${surface.tableRadius ? roundedTable(surface.tableRadius, surface.tableBorderColor) : ""}
12555
+ ${surface.tableRadius ? roundedTable(surface.tableRadius, surface.tableBorderColor) : squareTable(surface.tableBorderColor)}
12284
12556
  /* 单元格里的段落没走正文段距(被 :not(td p) 排除),会吃到浏览器默认的上下 1em,行高撑到 75px */
12285
12557
  .tiptap th > p,
12286
12558
  .tiptap td > p {
@@ -12486,6 +12758,43 @@ function roundedTable(radius, color) {
12486
12758
  }
12487
12759
  `;
12488
12760
  }
12761
+ function squareTable(color) {
12762
+ return `
12763
+ .tiptap table {
12764
+ border-collapse: separate;
12765
+ border-spacing: 0;
12766
+ border: 0;
12767
+ border-radius: 0;
12768
+ table-layout: fixed;
12769
+ }
12770
+
12771
+ .tiptap th,
12772
+ .tiptap td {
12773
+ border: 0;
12774
+ border-right: 1px solid ${color};
12775
+ border-bottom: 1px solid ${color};
12776
+ font-size: 14px;
12777
+ line-height: 23px;
12778
+ }
12779
+
12780
+ .tiptap tr:first-child > * {
12781
+ border-top: 1px solid ${color};
12782
+ }
12783
+
12784
+ .tiptap tr > :first-child {
12785
+ box-shadow: inset 1px 0 0 ${color};
12786
+ }
12787
+
12788
+ /* 单元格里的标题等块:首块不带上外边距、末块不带下外边距 */
12789
+ .tiptap :is(td, th) > :first-child {
12790
+ margin-top: 0;
12791
+ }
12792
+
12793
+ .tiptap :is(td, th) > :last-child {
12794
+ margin-bottom: 0;
12795
+ }
12796
+ `;
12797
+ }
12489
12798
 
12490
12799
  // src/components/tiptap-ui-primitive/textarea/textarea.style.ts
12491
12800
  var textareaStyles = ({ surface, pick, isDark }) => `
@@ -12692,7 +13001,7 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12692
13001
  --toc-progress-width-base: 1rem; /* Base width for progress lines (16px) */
12693
13002
  --toc-progress-width-min: 0.25rem; /* Minimum width for progress lines (4px) */
12694
13003
  /* 目录最高到视口底部(sticky top 130px,再留出底部边距) */
12695
- --toc-max-height: calc(100vh - 130px - 3rem);
13004
+ --toc-max-height: calc(100dvh - 130px - 4rem);
12696
13005
 
12697
13006
  ${isDark ? `:root & {
12698
13007
  --tt-toc-sidebar-line-bg: var(--tt-gray-dark-200);
@@ -12745,6 +13054,38 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12745
13054
  padding-bottom: 0.75rem;
12746
13055
  }
12747
13056
 
13057
+ &-toggle {
13058
+ display: inline-flex;
13059
+ align-items: center;
13060
+ justify-content: center;
13061
+ align-self: flex-end;
13062
+ gap: 0.25rem;
13063
+ min-height: 2rem;
13064
+ margin-bottom: 0.5rem;
13065
+ padding: 0.375rem;
13066
+ border: 1px solid ${pick("var(--tt-toc-sidebar-border-color)", surface.floatBorderColor)};
13067
+ border-radius: ${pick("var(--tt-radius-md)", `${surface.itemRadius}px`)};
13068
+ background: ${pick("var(--tt-toc-sidebar-bg)", surface.floatBg)};
13069
+ color: var(--tt-toc-sidebar-text-color);
13070
+ font: inherit;
13071
+ font-size: 0.75rem;
13072
+ line-height: 1;
13073
+ white-space: nowrap;
13074
+ cursor: pointer;
13075
+
13076
+ &:hover,
13077
+ &[aria-pressed="true"] {
13078
+ color: var(--tt-toc-sidebar-text-active-color);
13079
+ background: ${pick("var(--tt-toc-sidebar-bg-hover-color)", surface.itemHoverBg)};
13080
+ }
13081
+ }
13082
+
13083
+ &-toggle:focus-visible,
13084
+ &-item:focus-visible {
13085
+ outline: 2px solid var(--tt-toc-sidebar-text-active-color);
13086
+ outline-offset: 2px;
13087
+ }
13088
+
12748
13089
  /* =========================
12749
13090
  Progress bar column
12750
13091
  ========================= */
@@ -12815,12 +13156,15 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12815
13156
  ========================= */
12816
13157
  &-nav {
12817
13158
  position: absolute;
12818
- top: -0.625rem;
13159
+ top: 2.5rem;
12819
13160
  right: 0;
13161
+ width: min(17rem, calc(100vw - 2rem));
13162
+ box-sizing: border-box;
12820
13163
  padding-inline: 0.625rem;
12821
13164
  pointer-events: none;
12822
13165
  transform: translateX(10px);
12823
13166
  opacity: 0;
13167
+ visibility: hidden;
12824
13168
  display: flex;
12825
13169
  transition:
12826
13170
  transform 0.3s ease,
@@ -12843,6 +13187,7 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12843
13187
  margin-right: -0.625rem;
12844
13188
  max-height: var(--toc-max-height);
12845
13189
  width: 100%;
13190
+ box-sizing: border-box;
12846
13191
  overflow: auto;
12847
13192
  padding: var(--padding);
12848
13193
  scroll-margin: 0.25rem;
@@ -12869,7 +13214,9 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12869
13214
  text-overflow: ellipsis;
12870
13215
  user-select: none;
12871
13216
  cursor: pointer;
12872
- transition: all 0.15s ease;
13217
+ transition:
13218
+ background-color 0.15s ease,
13219
+ color 0.15s ease;
12873
13220
 
12874
13221
  /* Central calculation: Base * (Depth - 1) * Factor */
12875
13222
  margin-inline-start: calc(
@@ -12925,22 +13272,39 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12925
13272
  Interactions / media
12926
13273
  ========================= */
12927
13274
 
12928
- /* Pointer-hover devices */
12929
- @media (hover: hover) {
12930
- &-wrapper:hover &-nav {
12931
- pointer-events: auto;
12932
- transform: translateX(0);
12933
- opacity: 1;
12934
- }
13275
+ &--expanded &-nav,
13276
+ &-wrapper:focus-within &-nav[aria-hidden="false"] {
13277
+ pointer-events: auto;
13278
+ transform: translateX(0);
13279
+ opacity: 1;
13280
+ visibility: visible;
12935
13281
  }
12936
13282
 
12937
- /* Touch devices */
12938
- @media (hover: none) {
12939
- &-nav {
12940
- pointer-events: auto;
12941
- transform: translateX(0);
12942
- opacity: 1;
12943
- }
13283
+ &--pinned &-wrapper {
13284
+ width: 100%;
13285
+ max-width: 15rem;
13286
+ margin-left: 0;
13287
+ }
13288
+
13289
+ &--pinned &-inner {
13290
+ width: 100%;
13291
+ box-sizing: border-box;
13292
+ margin-right: 0;
13293
+ padding-right: 0.75rem;
13294
+ }
13295
+
13296
+ &--pinned &-progress {
13297
+ display: none;
13298
+ }
13299
+
13300
+ &--pinned &-nav {
13301
+ position: static;
13302
+ width: 100%;
13303
+ padding-inline: 0;
13304
+ }
13305
+
13306
+ &--pinned &-popover {
13307
+ margin-right: 0;
12944
13308
  }
12945
13309
 
12946
13310
  /* Mobile */
@@ -12950,6 +13314,23 @@ var tocSidebarStyles = ({ pick, surface, isDark }) => `
12950
13314
  }
12951
13315
  }
12952
13316
  }
13317
+
13318
+ @media screen and (min-width: 769px) {
13319
+ .notion-like-editor-layout:has(> .toc-sidebar--pinned) {
13320
+ --margin-left-width: minmax(1rem, 1fr);
13321
+ --margin-right-width: minmax(15rem, 1fr);
13322
+
13323
+ > .notion-like-editor-content {
13324
+ min-width: 0;
13325
+ }
13326
+ }
13327
+ }
13328
+
13329
+ @media screen and (min-width: 769px) and (max-width: 1024px) {
13330
+ .notion-like-editor-layout:has(> .toc-sidebar:not(.toc-sidebar--pinned)) {
13331
+ --margin-right-width: minmax(5rem, 1fr);
13332
+ }
13333
+ }
12953
13334
  `;
12954
13335
 
12955
13336
  // src/components/tiptap-ui-primitive/toolbar/toolbar.style.ts
@@ -13001,6 +13382,7 @@ var toolbarStyles = ({ token, surface, isDark, gray }) => `
13001
13382
  @media (max-width: 480px) {
13002
13383
  position: absolute;
13003
13384
  top: auto;
13385
+ inset-inline: 0;
13004
13386
  height: calc(var(--tt-toolbar-height) + var(--tt-safe-area-bottom));
13005
13387
  border-top: 1px solid ${isDark ? gray(50) : gray(100)};
13006
13388
  border-bottom: none;
@@ -14275,6 +14657,48 @@ function parseWidthAttr(value) {
14275
14657
  const n = typeof value === "number" ? value : Number.parseInt(String(value ?? ""), 10);
14276
14658
  return Number.isFinite(n) && n > 0 ? n : void 0;
14277
14659
  }
14660
+
14661
+ // src/lib/lazy-media.ts
14662
+ var ROOT_MARGIN = "800px 0px";
14663
+ function release(el) {
14664
+ if (!el.hasAttribute("src")) return;
14665
+ el.pause();
14666
+ el.removeAttribute("src");
14667
+ el.load();
14668
+ }
14669
+ function attachLazyMedia(el, src) {
14670
+ const load2 = () => {
14671
+ if (src && el.getAttribute("src") !== src) el.setAttribute("src", src);
14672
+ };
14673
+ if (typeof IntersectionObserver === "undefined") {
14674
+ load2();
14675
+ return () => release(el);
14676
+ }
14677
+ const observer = new IntersectionObserver(
14678
+ (entries) => {
14679
+ const near = entries.some((entry) => entry.isIntersecting);
14680
+ if (near) load2();
14681
+ else if (el.paused) release(el);
14682
+ },
14683
+ { rootMargin: ROOT_MARGIN }
14684
+ );
14685
+ observer.observe(el);
14686
+ return () => {
14687
+ observer.disconnect();
14688
+ release(el);
14689
+ };
14690
+ }
14691
+
14692
+ // src/hooks/use-lazy-media.ts
14693
+ function useLazyMedia(src) {
14694
+ const ref = useRef(null);
14695
+ useEffect(() => {
14696
+ const el = ref.current;
14697
+ if (!el) return;
14698
+ return attachLazyMedia(el, src);
14699
+ }, [src]);
14700
+ return ref;
14701
+ }
14278
14702
  function useResizableWidth({
14279
14703
  editor,
14280
14704
  nodeName,
@@ -14657,6 +15081,16 @@ function useImageDownload(config) {
14657
15081
  Icon: ArrowDownToLineIcon
14658
15082
  };
14659
15083
  }
15084
+
15085
+ // src/lib/media-size.ts
15086
+ function parseSizeHint(width, height) {
15087
+ const w = Number.parseFloat(String(width ?? ""));
15088
+ const h = Number.parseFloat(String(height ?? ""));
15089
+ return w > 0 && h > 0 ? { width: w, height: h } : void 0;
15090
+ }
15091
+ function heightForWidth(width, size4) {
15092
+ return size4 ? Math.round(width * size4.height / size4.width) : null;
15093
+ }
14660
15094
  var VIDEO_MIN_WIDTH = 200;
14661
15095
  var VIDEO_MAX_WIDTH = 800;
14662
15096
  function VideoPlayer({
@@ -14666,27 +15100,31 @@ function VideoPlayer({
14666
15100
  naturalSize,
14667
15101
  onNaturalSize,
14668
15102
  fillContainer,
14669
- noDownload
15103
+ noDownload,
15104
+ sizeHint
14670
15105
  }) {
15106
+ const size4 = naturalSize ?? sizeHint;
15107
+ const ratio = size4 ? `${size4.width} / ${size4.height}` : "16 / 9";
15108
+ const ref = useLazyMedia(src);
14671
15109
  return (
14672
15110
  // biome-ignore lint/a11y/useMediaCaption: 节点没有字幕字段,上传的视频也不带字幕文件;要加字幕时在这里补 <track>
14673
15111
  /* @__PURE__ */ jsx(
14674
15112
  "video",
14675
15113
  {
15114
+ ref,
14676
15115
  className: "tiptap-video-player",
14677
15116
  controls: true,
14678
15117
  controlsList: noDownload ? "nodownload" : void 0,
14679
15118
  preload: "metadata",
14680
- src,
14681
15119
  title,
14682
15120
  poster,
14683
- style: naturalSize ? {
14684
- aspectRatio: `${naturalSize.width} / ${naturalSize.height}`,
15121
+ style: {
15122
+ aspectRatio: ratio,
14685
15123
  // 没设宽度时按视频原始宽度显示。这个像素宽必须写在 <video> 上而不是外层 div:
14686
15124
  // 带百分比 max-width 的 video 是「可压缩替换元素」,算最小内容宽时按 0 计;
14687
15125
  // 写在 div 上会被当成最小宽度,把编辑器正文列(grid 轨道)整个撑宽、溢出外框。
14688
- width: fillContainer ? void 0 : `${naturalSize.width}px`
14689
- } : void 0,
15126
+ width: fillContainer || !size4 ? void 0 : `${size4.width}px`
15127
+ },
14690
15128
  onLoadedMetadata: (e) => {
14691
15129
  const { videoWidth, videoHeight } = e.currentTarget;
14692
15130
  if (videoWidth > 0 && videoHeight > 0) {
@@ -14699,6 +15137,7 @@ function VideoPlayer({
14699
15137
  }
14700
15138
  function VideoNodeView({ editor, node, getPos, updateAttributes }) {
14701
15139
  const [naturalSize, setNaturalSize] = useState();
15140
+ const sizeHint = parseSizeHint(node.attrs.width, node.attrs.height);
14702
15141
  const align = node.attrs["data-align"] ?? "left";
14703
15142
  const canDownload = getDocPermissions(editor).download;
14704
15143
  const {
@@ -14717,8 +15156,8 @@ function VideoNodeView({ editor, node, getPos, updateAttributes }) {
14717
15156
  minWidth: VIDEO_MIN_WIDTH,
14718
15157
  maxWidth: VIDEO_MAX_WIDTH,
14719
15158
  align,
14720
- // 只存宽度,高度交给视频比例:清掉老数据里的 height,免得拖完画面被拉变形
14721
- onResize: (w) => updateAttributes({ width: w, height: null })
15159
+ // height 只当宽高比用(不当像素高度,不会拉变形):按比例同步写回,下次打开视频加载前也能按真实比例占位
15160
+ onResize: (w) => updateAttributes({ width: w, height: heightForWidth(w, naturalSize ?? sizeHint) })
14722
15161
  });
14723
15162
  return /* @__PURE__ */ jsx(
14724
15163
  NodeViewWrapper,
@@ -14743,6 +15182,7 @@ function VideoNodeView({ editor, node, getPos, updateAttributes }) {
14743
15182
  poster: node.attrs.poster ?? void 0,
14744
15183
  naturalSize,
14745
15184
  onNaturalSize: setNaturalSize,
15185
+ sizeHint,
14746
15186
  fillContainer: !!width,
14747
15187
  noDownload: !canDownload
14748
15188
  }
@@ -14810,7 +15250,10 @@ var Video = Node$1.create({
14810
15250
  renderHTML({ node, HTMLAttributes }) {
14811
15251
  const attrs = {
14812
15252
  controls: "true",
14813
- preload: "metadata",
15253
+ // renderHTML 只用于序列化(getHTML、复制、导出)和 tiptap 卸载时的过渡 DOM,编辑器里的播放器是节点视图。
15254
+ // 这些 DOM 即使不插入文档,带 src + preload=metadata 也会各自创建播放器,Chrome 每页上限 1000 个;
15255
+ // preload="none" 不创建播放器,点播放时照常加载(见 lib/lazy-media.ts)
15256
+ preload: "none",
14814
15257
  src: node.attrs.src
14815
15258
  };
14816
15259
  if (node.attrs.title) attrs.title = node.attrs.title;
@@ -14873,7 +15316,10 @@ var Audio = Node$1.create({
14873
15316
  renderHTML({ node, HTMLAttributes }) {
14874
15317
  const attrs = {
14875
15318
  controls: "true",
14876
- preload: "metadata",
15319
+ // renderHTML 只用于序列化(getHTML、复制、导出)和 tiptap 卸载时的过渡 DOM,编辑器里的播放器是节点视图。
15320
+ // 这些 DOM 即使不插入文档,带 src + preload=metadata 也会各自创建播放器,Chrome 每页上限 1000 个;
15321
+ // preload="none" 不创建播放器,点播放时照常加载(见 lib/lazy-media.ts)
15322
+ preload: "none",
14877
15323
  src: node.attrs.src
14878
15324
  };
14879
15325
  if (node.attrs.title) attrs.title = node.attrs.title;
@@ -14887,18 +15333,19 @@ var Audio = Node$1.create({
14887
15333
  addNodeView() {
14888
15334
  return ({ node, HTMLAttributes, editor }) => {
14889
15335
  const dom = document.createElement("audio");
14890
- const attrs = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
15336
+ const { src: _src, ...attrs } = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
14891
15337
  controls: "true",
14892
15338
  preload: "metadata",
14893
- src: node.attrs.src,
14894
15339
  ...node.attrs.title ? { title: node.attrs.title } : {}
14895
15340
  });
14896
15341
  for (const [k, v] of Object.entries(attrs)) if (v != null && v !== false) dom.setAttribute(k, String(v));
14897
15342
  if (!getDocPermissions(editor).download) dom.setAttribute("controlslist", "nodownload");
15343
+ const detach = attachLazyMedia(dom, node.attrs.src);
14898
15344
  return {
14899
15345
  dom,
14900
15346
  stopEvent: () => !editor.isEditable,
14901
- ignoreMutation: () => true
15347
+ ignoreMutation: () => true,
15348
+ destroy: detach
14902
15349
  };
14903
15350
  };
14904
15351
  },
@@ -15274,10 +15721,10 @@ function FilePreview({
15274
15721
  body = /* @__PURE__ */ jsx("img", { className: "tt-file-preview__media", src: file.src, alt: file.name });
15275
15722
  } else if (kind === "video") {
15276
15723
  sized = false;
15277
- body = /* @__PURE__ */ jsx("video", { className: "tt-file-preview__media", src: file.src, controls: true, preload: "metadata" });
15724
+ body = /* @__PURE__ */ jsx(PreviewVideo, { src: file.src });
15278
15725
  } else if (kind === "audio") {
15279
15726
  sized = false;
15280
- body = /* @__PURE__ */ jsx("audio", { className: "tt-file-preview__audio", src: file.src, controls: true, preload: "metadata" });
15727
+ body = /* @__PURE__ */ jsx(PreviewAudio, { src: file.src });
15281
15728
  } else if (kind === "text") {
15282
15729
  body = /* @__PURE__ */ jsx(TextPreview, { src: file.src, name: file.name });
15283
15730
  } else {
@@ -15342,6 +15789,14 @@ function useFullscreen() {
15342
15789
  }, []);
15343
15790
  return on;
15344
15791
  }
15792
+ function PreviewVideo({ src }) {
15793
+ const ref = useLazyMedia(src);
15794
+ return /* @__PURE__ */ jsx("video", { ref, className: "tt-file-preview__media", controls: true, preload: "metadata" });
15795
+ }
15796
+ function PreviewAudio({ src }) {
15797
+ const ref = useLazyMedia(src);
15798
+ return /* @__PURE__ */ jsx("audio", { ref, className: "tt-file-preview__audio", controls: true, preload: "metadata" });
15799
+ }
15345
15800
  var FileAttachmentSchema = Node$2.create({
15346
15801
  name: "fileAttachment",
15347
15802
  group: "block",
@@ -16997,6 +17452,34 @@ function containsCompleteContainer(text, names = ALL_CONTAINER_NAMES) {
16997
17452
  }
16998
17453
  return false;
16999
17454
  }
17455
+ var HEADING_RE = /^ {0,3}#{1,6}[ \t]+\S/;
17456
+ var LIST_RE = /^ {0,3}(?:[-*+]|\d{1,9}[.)])[ \t]+\S/;
17457
+ var QUOTE_RE = /^ {0,3}>/;
17458
+ var LINK_RE = /\[[^\]\n]+\]\([^)\s]+\)/;
17459
+ var TABLE_DELIMITER_RE = /^ {0,3}\|?[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)*\|?[ \t]*$/;
17460
+ function looksLikeMarkdown(text) {
17461
+ const lines = text.replace(/\r\n?/g, "\n").split("\n");
17462
+ const kinds = /* @__PURE__ */ new Set();
17463
+ let fence = null;
17464
+ for (let i = 0; i < lines.length; i += 1) {
17465
+ const line = lines[i];
17466
+ if (fence) {
17467
+ if (isFenceClose(line, fence)) return true;
17468
+ continue;
17469
+ }
17470
+ fence = matchFenceOpen(line);
17471
+ if (fence) continue;
17472
+ if (i > 0 && line.includes("|") && line.includes("-") && TABLE_DELIMITER_RE.test(line)) {
17473
+ if (lines[i - 1].includes("|")) return true;
17474
+ }
17475
+ if (HEADING_RE.test(line)) kinds.add("heading");
17476
+ else if (LIST_RE.test(line)) kinds.add("list");
17477
+ else if (QUOTE_RE.test(line)) kinds.add("quote");
17478
+ if (LINK_RE.test(line)) kinds.add("link");
17479
+ if (kinds.size >= 2) return true;
17480
+ }
17481
+ return false;
17482
+ }
17000
17483
  var REQUIRED_WORDS = /* @__PURE__ */ new Set(["必选", "required"]);
17001
17484
  var DEFAULT_WORDS = /* @__PURE__ */ new Set(["默认", "default"]);
17002
17485
  function tokenizeInfo(info) {
@@ -20275,73 +20758,198 @@ function CollabProvider({
20275
20758
  );
20276
20759
  return /* @__PURE__ */ jsx(CollabContext.Provider, { value, children });
20277
20760
  }
20278
- var PageWidthIcon = () => /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
20279
- /* @__PURE__ */ jsx("path", { d: "M3 4v16M21 4v16" }),
20280
- /* @__PURE__ */ jsx("path", { d: "M7 12h10M10 9l-3 3 3 3M14 9l3 3-3 3" })
20281
- ] });
20282
- function WidthModeMenu(props = {}) {
20283
- const ctx = useWidthMode();
20284
- const mode = props.mode ?? ctx.mode;
20285
- const setMode = props.onChange ?? ctx.setMode;
20286
- const [open, setOpen] = useState(false);
20287
- const ref = useRef(null);
20288
- useEffect(() => {
20289
- if (!open) return;
20290
- const onDown = (e) => {
20291
- if (!ref.current?.contains(e.target)) setOpen(false);
20292
- };
20293
- const onKey = (e) => {
20294
- if (e.key === "Escape") setOpen(false);
20295
- };
20296
- document.addEventListener("mousedown", onDown);
20297
- document.addEventListener("keydown", onKey);
20298
- return () => {
20299
- document.removeEventListener("mousedown", onDown);
20300
- document.removeEventListener("keydown", onKey);
20761
+
20762
+ // src/components/tiptap-extension/comment-thread/comment-thread.style.ts
20763
+ var commentThreadFocusStyle = `
20764
+ [data-comment-thread-interactive]:focus-visible {
20765
+ outline: 2px solid var(--tt-brand-color-500, #3370ff);
20766
+ outline-offset: 2px;
20767
+ }
20768
+ `;
20769
+
20770
+ // src/components/tiptap-extension/comment-thread/comment-thread.ts
20771
+ var commentThreadInteractivityKey = new PluginKey(
20772
+ "commentThreadInteractivity"
20773
+ );
20774
+ function refreshCommentThreadInteractivity(editor, interactive) {
20775
+ if (editor.isDestroyed) return;
20776
+ editor.view.dispatch(
20777
+ editor.state.tr.setMeta(commentThreadInteractivityKey, interactive ?? true).setMeta("addToHistory", false)
20778
+ );
20779
+ }
20780
+ function getCommentSelection(state) {
20781
+ const { selection, doc } = state;
20782
+ if (!(selection instanceof TextSelection) || selection.empty || selection.$from.parent.type.spec.code)
20783
+ return null;
20784
+ const { from, to } = selection;
20785
+ const text = doc.textBetween(from, to, "\n");
20786
+ return text.trim() ? { from, to, text } : null;
20787
+ }
20788
+ function canWriteComment(editor) {
20789
+ const storage = editor.storage;
20790
+ return editor.isEditable && !storage.readOnlyGuard?.locked;
20791
+ }
20792
+ var CommentThread = Mark.create({
20793
+ name: "commentThread",
20794
+ priority: 1100,
20795
+ excludes: "",
20796
+ inclusive: false,
20797
+ addOptions() {
20798
+ return { onSelectThread: void 0, isInteractive: void 0 };
20799
+ },
20800
+ addAttributes() {
20801
+ return {
20802
+ threadId: {
20803
+ default: null,
20804
+ parseHTML: (element) => element.getAttribute("data-comment-thread"),
20805
+ renderHTML: (attributes) => ({ "data-comment-thread": attributes.threadId })
20806
+ }
20301
20807
  };
20302
- }, [open]);
20303
- return /* @__PURE__ */ jsxs("div", { className: "tt-width-mode", ref, children: [
20304
- /* @__PURE__ */ jsx(
20305
- "button",
20808
+ },
20809
+ parseHTML() {
20810
+ return [
20306
20811
  {
20307
- type: "button",
20308
- className: "tt-width-mode__btn",
20309
- "aria-label": WIDTH_MODE_MENU_TITLE,
20310
- title: WIDTH_MODE_MENU_TITLE,
20311
- "aria-haspopup": "menu",
20312
- "aria-expanded": open,
20313
- onClick: () => setOpen((o) => !o),
20314
- children: /* @__PURE__ */ jsx(PageWidthIcon, {})
20812
+ tag: "span[data-comment-thread]",
20813
+ getAttrs: (element) => element.getAttribute("data-comment-thread")?.trim() ? null : false
20315
20814
  }
20316
- ),
20317
- open ? /* @__PURE__ */ jsxs("div", { className: "tt-width-mode__menu", role: "menu", "aria-label": WIDTH_MODE_MENU_TITLE, children: [
20318
- /* @__PURE__ */ jsx("div", { className: "tt-width-mode__header", children: WIDTH_MODE_MENU_HEADER }),
20319
- /* @__PURE__ */ jsx("div", { className: "tt-width-mode__items", children: WIDTH_MODE_ITEMS.map((item) => /* @__PURE__ */ jsxs(
20320
- "button",
20321
- {
20322
- type: "button",
20323
- role: "menuitemradio",
20324
- "aria-checked": item.mode === mode,
20325
- className: `tt-width-mode__item tt-width-mode__item--${item.mode}`,
20326
- onClick: () => {
20327
- setOpen(false);
20328
- if (item.mode !== mode) setMode(item.mode);
20815
+ ];
20816
+ },
20817
+ renderHTML({ HTMLAttributes }) {
20818
+ return [
20819
+ "span",
20820
+ {
20821
+ ...HTMLAttributes,
20822
+ style: "background-color: var(--tt-color-highlight-yellow, rgba(255, 246, 122, 0.4)); border-radius: 2px; box-decoration-break: clone;"
20823
+ },
20824
+ 0
20825
+ ];
20826
+ },
20827
+ addCommands() {
20828
+ return {
20829
+ setCommentThread: (threadId) => ({ editor, tr, dispatch }) => {
20830
+ if (!canWriteComment(editor) || !threadId.trim()) return false;
20831
+ const selection = getCommentSelection(tr);
20832
+ if (!selection) return false;
20833
+ let supported = false;
20834
+ tr.doc.nodesBetween(selection.from, selection.to, (node, pos, parent) => {
20835
+ if (!node.isText || !parent?.type.allowsMarkType(this.type) || node.marks.some((mark) => mark.type.excludes(this.type)))
20836
+ return;
20837
+ supported = true;
20838
+ if (dispatch)
20839
+ tr.addMark(
20840
+ Math.max(pos, selection.from),
20841
+ Math.min(pos + node.nodeSize, selection.to),
20842
+ this.type.create({ threadId })
20843
+ );
20844
+ });
20845
+ return supported;
20846
+ },
20847
+ unsetCommentThread: (threadId) => ({ editor, tr, dispatch }) => {
20848
+ if (!canWriteComment(editor) || !threadId.trim()) return false;
20849
+ const storedMarks = tr.storedMarks;
20850
+ let found = Boolean(
20851
+ storedMarks?.some(
20852
+ (mark) => mark.type === this.type && mark.attrs.threadId === threadId
20853
+ )
20854
+ );
20855
+ tr.doc.descendants((node, pos) => {
20856
+ for (const mark of node.marks) {
20857
+ if (mark.type !== this.type || mark.attrs.threadId !== threadId) continue;
20858
+ found = true;
20859
+ if (dispatch) tr.removeMark(pos, pos + node.nodeSize, mark);
20860
+ }
20861
+ });
20862
+ if (dispatch && storedMarks && found)
20863
+ tr.setStoredMarks(
20864
+ storedMarks.filter(
20865
+ (mark) => mark.type !== this.type || mark.attrs.threadId !== threadId
20866
+ )
20867
+ );
20868
+ return found;
20869
+ }
20870
+ };
20871
+ },
20872
+ addProseMirrorPlugins() {
20873
+ const isInteractive = () => Boolean(this.options.onSelectThread) && (this.options.isInteractive?.() ?? true);
20874
+ const decorations = (state) => {
20875
+ if (!isInteractive()) return DecorationSet.empty;
20876
+ const ranges = [];
20877
+ state.doc.descendants((node, pos) => {
20878
+ if (!node.isText || node.marks.some((mark2) => mark2.type.name === "link")) return;
20879
+ const mark = node.marks.filter((mark2) => mark2.type === this.type).at(-1);
20880
+ const threadId = mark?.attrs.threadId;
20881
+ if (typeof threadId !== "string" || !threadId.trim()) return;
20882
+ const previous = ranges.at(-1);
20883
+ if (previous?.to === pos && previous.threadId === threadId) previous.to += node.nodeSize;
20884
+ else ranges.push({ from: pos, to: pos + node.nodeSize, threadId });
20885
+ });
20886
+ return DecorationSet.create(
20887
+ state.doc,
20888
+ ranges.map(
20889
+ ({ from, to, threadId }) => Decoration.inline(from, to, {
20890
+ nodeName: "span",
20891
+ "data-comment-thread-interactive": threadId,
20892
+ role: "button",
20893
+ tabindex: "0",
20894
+ "aria-label": "查看评论"
20895
+ })
20896
+ )
20897
+ );
20898
+ };
20899
+ const threadTarget = (view, event) => {
20900
+ const element = event.target;
20901
+ if (element?.closest?.("a[href]")) return null;
20902
+ const target = element?.closest?.(
20903
+ "[data-comment-thread-interactive], span[data-comment-thread]"
20904
+ );
20905
+ return target && view.dom.contains(target) ? target : null;
20906
+ };
20907
+ return [
20908
+ new Plugin({
20909
+ key: commentThreadInteractivityKey,
20910
+ state: {
20911
+ init: (_config, state) => decorations(state),
20912
+ apply: (tr, previous, _oldState, state) => tr.docChanged || tr.getMeta(commentThreadInteractivityKey) !== void 0 ? decorations(state) : previous
20913
+ },
20914
+ props: {
20915
+ decorations: (state) => commentThreadInteractivityKey.getState(state),
20916
+ handleClick: (view, _pos, event) => {
20917
+ if (!isInteractive() || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || !view.state.selection.empty)
20918
+ return false;
20919
+ const target = threadTarget(view, event);
20920
+ const threadId = target?.getAttribute("data-comment-thread-interactive") ?? target?.getAttribute("data-comment-thread");
20921
+ if (!threadId?.trim()) return false;
20922
+ event.preventDefault();
20923
+ this.options.onSelectThread?.(threadId);
20924
+ return true;
20329
20925
  },
20330
- children: [
20331
- /* @__PURE__ */ jsxs("span", { className: "tt-width-mode__icon", "aria-hidden": "true", children: [
20332
- /* @__PURE__ */ jsx("span", {}),
20333
- /* @__PURE__ */ jsx("span", {}),
20334
- /* @__PURE__ */ jsx("span", {}),
20335
- /* @__PURE__ */ jsx("span", {})
20336
- ] }),
20337
- /* @__PURE__ */ jsx("span", { className: "tt-width-mode__name", children: item.name })
20338
- ]
20926
+ handleDOMEvents: {
20927
+ keydown: (view, event) => {
20928
+ if (event.defaultPrevented || event.key !== "Enter" && event.key !== " " || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
20929
+ return false;
20930
+ const target = threadTarget(view, event);
20931
+ if (!target || target !== view.root.activeElement) return false;
20932
+ const threadId = target.getAttribute("data-comment-thread-interactive") ?? target.getAttribute("data-comment-thread");
20933
+ if (!threadId?.trim()) return false;
20934
+ event.preventDefault();
20935
+ if (isInteractive()) this.options.onSelectThread?.(threadId);
20936
+ return true;
20937
+ }
20938
+ }
20339
20939
  },
20340
- item.mode
20341
- )) })
20342
- ] }) : null
20343
- ] });
20344
- }
20940
+ view: (view) => {
20941
+ const style = view.dom.ownerDocument.createElement("style");
20942
+ style.setAttribute("data-comment-thread-style", "");
20943
+ style.textContent = commentThreadFocusStyle;
20944
+ const root = view.dom.getRootNode();
20945
+ const container = root.nodeType === 9 ? view.dom.ownerDocument.head : root;
20946
+ container.appendChild(style);
20947
+ return { destroy: () => style.remove() };
20948
+ }
20949
+ })
20950
+ ];
20951
+ }
20952
+ });
20345
20953
  function DropdownMenu({
20346
20954
  ...props
20347
20955
  }) {
@@ -21689,7 +22297,7 @@ function dragCrop(start, handle, dx, dy) {
21689
22297
  if (handle.includes("s")) y1 = Math.max(y0 + MIN_CROP_SIZE, Math.min(1, y1 + dy));
21690
22298
  return [x0, y0, x1, y1];
21691
22299
  }
21692
- var ImageFrame = forwardRef(function ImageFrame2({ src, alt, crop, rotation, onClick, cursor }, ref) {
22300
+ var ImageFrame = forwardRef(function ImageFrame2({ src, alt, crop, rotation, onClick, cursor, sizeHint }, ref) {
21693
22301
  const [natural, setNatural] = useState(null);
21694
22302
  const [failed, setFailed] = useState(false);
21695
22303
  const [attempt, setAttempt] = useState(0);
@@ -21709,6 +22317,7 @@ var ImageFrame = forwardRef(function ImageFrame2({ src, alt, crop, rotation, onC
21709
22317
  "div",
21710
22318
  {
21711
22319
  className: "tiptap-image-error",
22320
+ style: sizeHint ? { aspectRatio: `${sizeHint.width} / ${sizeHint.height}`, minHeight: 0 } : void 0,
21712
22321
  contentEditable: false,
21713
22322
  draggable: false,
21714
22323
  onClick: (e) => {
@@ -21744,8 +22353,13 @@ var ImageFrame = forwardRef(function ImageFrame2({ src, alt, crop, rotation, onC
21744
22353
  "img",
21745
22354
  {
21746
22355
  ref,
22356
+ loading: "lazy",
22357
+ decoding: "async",
21747
22358
  src,
21748
22359
  alt,
22360
+ width: sizeHint?.width,
22361
+ height: sizeHint?.height,
22362
+ "data-pending": natural ? void 0 : "",
21749
22363
  className: "tiptap-image-img",
21750
22364
  contentEditable: false,
21751
22365
  draggable: false,
@@ -21761,8 +22375,9 @@ var ImageFrame = forwardRef(function ImageFrame2({ src, alt, crop, rotation, onC
21761
22375
  attempt
21762
22376
  )
21763
22377
  );
21764
- if (plain || !natural) return img();
21765
- const layout = frameLayout(natural, crop ?? [0, 0, 1, 1], rotation);
22378
+ const size4 = natural ?? sizeHint;
22379
+ if (plain || !size4) return img();
22380
+ const layout = frameLayout(size4, crop ?? [0, 0, 1, 1], rotation);
21766
22381
  return /* @__PURE__ */ jsx("div", { className: "tiptap-image-frame", style: { aspectRatio: String(layout.aspect) }, children: /* @__PURE__ */ jsx(
21767
22382
  "div",
21768
22383
  {
@@ -21894,11 +22509,12 @@ function ImageNodeView(props) {
21894
22509
  showCaption: node.attrs.showCaption,
21895
22510
  hasContent,
21896
22511
  nodeSize: node.nodeSize,
21897
- onImageResize: (width) => updateAttributes({ width }),
22512
+ onImageResize: (width, size4) => updateAttributes({ width, height: width ? heightForWidth(width, size4) : null }),
21898
22513
  onUpdateAttributes: updateAttributes,
21899
22514
  getPos,
21900
22515
  crop: node.attrs.crop ? normalizeCrop(node.attrs.crop) : null,
21901
- rotation: normalizeRotation(node.attrs.rotation)
22516
+ rotation: normalizeRotation(node.attrs.rotation),
22517
+ sizeHint: parseSizeHint(node.attrs.width, node.attrs.height)
21902
22518
  }
21903
22519
  );
21904
22520
  }
@@ -21917,7 +22533,8 @@ var ResizableImage = ({
21917
22533
  onUpdateAttributes,
21918
22534
  getPos,
21919
22535
  crop = null,
21920
- rotation = 0
22536
+ rotation = 0,
22537
+ sizeHint
21921
22538
  }) => {
21922
22539
  const [cropping, setCropping] = useState(false);
21923
22540
  const submitCropRef = useRef(null);
@@ -21950,7 +22567,11 @@ var ResizableImage = ({
21950
22567
  minWidth,
21951
22568
  maxWidth,
21952
22569
  align,
21953
- onResize: (w) => onImageResize?.(w)
22570
+ onResize: (w) => {
22571
+ const img = imageRef.current;
22572
+ const natural = img?.naturalWidth && img.naturalHeight ? { width: img.naturalWidth, height: img.naturalHeight } : void 0;
22573
+ onImageResize?.(w, natural ?? sizeHint);
22574
+ }
21954
22575
  });
21955
22576
  const imageRef = useRef(null);
21956
22577
  useEffect(() => {
@@ -22034,7 +22655,8 @@ var ResizableImage = ({
22034
22655
  crop,
22035
22656
  rotation,
22036
22657
  onClick: handleImageClick,
22037
- cursor: editor?.isEditable ? "pointer" : "zoom-in"
22658
+ cursor: editor?.isEditable ? "pointer" : "zoom-in",
22659
+ sizeHint
22038
22660
  }
22039
22661
  ),
22040
22662
  showHandles && !cropping && /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -22042,11 +22664,12 @@ var ResizableImage = ({
22042
22664
  /* @__PURE__ */ jsx("div", { ...rightHandleProps, className: "tiptap-image-handle tiptap-image-handle-right" })
22043
22665
  ] })
22044
22666
  ] }),
22045
- (editor?.isEditable ? shouldShowCaption : hasContent) && /* @__PURE__ */ jsx(
22667
+ /* @__PURE__ */ jsx(
22046
22668
  NodeViewContent,
22047
22669
  {
22048
22670
  as: "div",
22049
22671
  className: "tiptap-image-caption",
22672
+ hidden: !(editor?.isEditable ? shouldShowCaption : hasContent),
22050
22673
  "data-placeholder": "输入图片描述"
22051
22674
  }
22052
22675
  )
@@ -22200,13 +22823,16 @@ var Image2 = Image$1.extend({
22200
22823
  renderHTML({ node }) {
22201
22824
  const { src, alt, title, width, height, showCaption } = node.attrs;
22202
22825
  const align = node.attrs["data-align"];
22203
- const imgAttrs = buildImageHTMLAttributes({
22204
- src,
22205
- alt,
22206
- title,
22207
- width,
22208
- height
22209
- });
22826
+ const imgAttrs = {
22827
+ loading: "lazy",
22828
+ ...buildImageHTMLAttributes({
22829
+ src,
22830
+ alt,
22831
+ title,
22832
+ width,
22833
+ height
22834
+ })
22835
+ };
22210
22836
  const rotation = normalizeRotation(node.attrs.rotation);
22211
22837
  const crop = formatCropAttr(node.attrs.crop);
22212
22838
  if (rotation) {
@@ -26485,6 +27111,68 @@ function replaceAllMatches(tr, matches, text) {
26485
27111
  }
26486
27112
  return count;
26487
27113
  }
27114
+ function idConfig(editor) {
27115
+ const ext = editor.extensionManager.extensions.find((e) => e.name === "uniqueID");
27116
+ const options = ext?.options;
27117
+ if (!options || !Array.isArray(options.types) || !options.attributeName || !options.generateID)
27118
+ return null;
27119
+ return options;
27120
+ }
27121
+ function fillFragment(fragment, config) {
27122
+ let changed = false;
27123
+ const nodes = [];
27124
+ fragment.forEach((node) => {
27125
+ let next = node;
27126
+ const content = node.isText ? node.content : fillFragment(node.content, config);
27127
+ if (config.types.includes(node.type.name) && node.attrs[config.attributeName] == null) {
27128
+ const id = config.generateID({ node, pos: -1 });
27129
+ next = node.type.create({ ...node.attrs, [config.attributeName]: id }, content, node.marks);
27130
+ } else if (content !== node.content) {
27131
+ next = node.copy(content);
27132
+ }
27133
+ if (next !== node) changed = true;
27134
+ nodes.push(next);
27135
+ });
27136
+ return changed ? Fragment.from(nodes) : fragment;
27137
+ }
27138
+ function fillJSON(nodes, config) {
27139
+ return nodes.map((node) => {
27140
+ const out = { ...node };
27141
+ if (node.type && config.types.includes(node.type) && node.attrs?.[config.attributeName] == null) {
27142
+ out.attrs = {
27143
+ ...node.attrs,
27144
+ [config.attributeName]: config.generateID({ node: null, pos: -1 })
27145
+ };
27146
+ }
27147
+ if (node.content) out.content = fillJSON(node.content, config);
27148
+ return out;
27149
+ });
27150
+ }
27151
+ function withNodeIds(editor, content) {
27152
+ const config = idConfig(editor);
27153
+ return config ? fillJSON(content, config) : content;
27154
+ }
27155
+ var PasteNodeIds = Extension.create({
27156
+ name: "pasteNodeIds",
27157
+ addProseMirrorPlugins() {
27158
+ const editor = this.editor;
27159
+ return [
27160
+ new Plugin({
27161
+ key: new PluginKey("pasteNodeIds"),
27162
+ props: {
27163
+ transformPasted(slice) {
27164
+ const config = idConfig(editor);
27165
+ if (!config) return slice;
27166
+ const content = fillFragment(slice.content, config);
27167
+ return content === slice.content ? slice : new Slice(content, slice.openStart, slice.openEnd);
27168
+ }
27169
+ }
27170
+ })
27171
+ ];
27172
+ }
27173
+ });
27174
+
27175
+ // src/components/tiptap-node/code-block-node/code-group-input.ts
26488
27176
  var codeGroupInputPluginKey = new PluginKey("codeGroupInput");
26489
27177
  var OPENER_RE3 = /^ {0,3}:::[ \t]*code-group[ \t]*$/;
26490
27178
  var CLOSER_RE2 = /^ {0,3}:::[ \t]*$/;
@@ -26599,6 +27287,26 @@ function containerPasteText(data, slice, schema) {
26599
27287
  if (/\sdata-pm-slice=/.test(html)) return sliceLines(slice, schema);
26600
27288
  return text || null;
26601
27289
  }
27290
+ function isMarkdownPaste(data, text) {
27291
+ if (/\sdata-pm-slice=/.test(data.getData("text/html"))) return false;
27292
+ let mode = null;
27293
+ try {
27294
+ mode = JSON.parse(data.getData("vscode-editor-data") || "null")?.mode;
27295
+ } catch {
27296
+ }
27297
+ if (mode && mode !== "markdown") return false;
27298
+ return looksLikeMarkdown(text);
27299
+ }
27300
+ function resolveMarkConflicts(nodes, schema) {
27301
+ return nodes.map((node) => {
27302
+ const out = { ...node };
27303
+ if (node.marks?.length) {
27304
+ out.marks = node.marks.reduce((set, json) => schema.markFromJSON(json).addToSet(set), Mark$1.none).map((mark) => mark.toJSON());
27305
+ }
27306
+ if (node.content) out.content = resolveMarkConflicts(node.content, schema);
27307
+ return out;
27308
+ });
27309
+ }
26602
27310
  function isComposing(view, event) {
26603
27311
  if (event?.isComposing) return true;
26604
27312
  return Boolean(view.composing);
@@ -26632,23 +27340,29 @@ function createCodeGroupInputPlugin(editor) {
26632
27340
  if (!data) return false;
26633
27341
  if (view.input?.shiftKey) return false;
26634
27342
  const text = containerPasteText(data, slice, state.schema);
26635
- if (!text || !containsCompleteContainer(text)) return false;
27343
+ if (!text || !(containsCompleteContainer(text) || isMarkdownPaste(data, text))) return false;
26636
27344
  const manager = editor.markdown;
26637
27345
  if (!manager) return false;
26638
- let json;
27346
+ let content;
26639
27347
  try {
26640
- json = manager.parse(text.replace(/\r\n?/g, "\n"));
27348
+ const json = manager.parse(text.replace(/\r\n?/g, "\n"));
27349
+ if (!json.content?.length) return false;
27350
+ content = withNodeIds(editor, resolveMarkConflicts(json.content, state.schema));
26641
27351
  } catch {
26642
27352
  return false;
26643
27353
  }
26644
- if (!json.content?.length) return false;
26645
27354
  stopYjsCapturing(view.state);
26646
27355
  view.dispatch(closeHistory(view.state.tr));
26647
- const inserted = editor.commands.insertContentAt(
26648
- { from: state.selection.from, to: state.selection.to },
26649
- json.content,
26650
- { updateSelection: true }
26651
- );
27356
+ let inserted = false;
27357
+ try {
27358
+ inserted = editor.commands.insertContentAt(
27359
+ { from: state.selection.from, to: state.selection.to },
27360
+ content,
27361
+ { updateSelection: true }
27362
+ );
27363
+ } catch (error) {
27364
+ console.warn("Markdown 粘贴转换失败,按普通粘贴处理", error);
27365
+ }
26652
27366
  stopYjsCapturing(view.state);
26653
27367
  view.dispatch(closeHistory(view.state.tr));
26654
27368
  return inserted;
@@ -33709,6 +34423,12 @@ function normalizeEditorContent(content, contentFormat, extensions, options = {}
33709
34423
  }
33710
34424
  return result.json;
33711
34425
  }
34426
+ function resolveEditorContentUpdate(content, contentFormat, extensions, options = {}) {
34427
+ if (content === void 0) return { kind: "ignore" };
34428
+ if (content === null || content === "") return { kind: "clear" };
34429
+ const json = normalizeEditorContent(content, contentFormat, extensions, options);
34430
+ return json ? { kind: "set", json } : { kind: "ignore" };
34431
+ }
33712
34432
  function defaultOnError(message) {
33713
34433
  console.error(`[editor] 内容未载入:${message}`);
33714
34434
  }
@@ -35088,6 +35808,9 @@ function ComboboxItem2({ className, ...props }) {
35088
35808
  }
35089
35809
  );
35090
35810
  }
35811
+ function MenuProvider2({ ...props }) {
35812
+ return /* @__PURE__ */ jsx(Ariakit2.MenuProvider, { ...props });
35813
+ }
35091
35814
  function Menu2({
35092
35815
  children,
35093
35816
  trigger,
@@ -35204,6 +35927,31 @@ function MenuGroupLabel2({
35204
35927
  }
35205
35928
  );
35206
35929
  }
35930
+ function MenuSeparator2({
35931
+ className,
35932
+ ...props
35933
+ }) {
35934
+ return /* @__PURE__ */ jsx(
35935
+ Ariakit2.MenuSeparator,
35936
+ {
35937
+ "data-slot": "tiptap-menu-separator",
35938
+ className: cn("tiptap-menu-separator", className),
35939
+ ...props
35940
+ }
35941
+ );
35942
+ }
35943
+ function MenuItemCheck2({
35944
+ className,
35945
+ ...props
35946
+ }) {
35947
+ return /* @__PURE__ */ jsx(
35948
+ Ariakit2.MenuItemCheck,
35949
+ {
35950
+ ...props,
35951
+ className: cn("tiptap-menu-item-check", className)
35952
+ }
35953
+ );
35954
+ }
35207
35955
  function MenuItemRadio2({
35208
35956
  className,
35209
35957
  ...props
@@ -46830,90 +47578,8 @@ var DragContextMenu = ({
46830
47578
  }
46831
47579
  );
46832
47580
  };
46833
- var SunIcon = memo(({ className, ...props }) => {
46834
- return /* @__PURE__ */ jsxs(
46835
- "svg",
46836
- {
46837
- width: "24",
46838
- height: "24",
46839
- className,
46840
- viewBox: "0 0 24 24",
46841
- fill: "currentColor",
46842
- xmlns: "http://www.w3.org/2000/svg",
46843
- ...props,
46844
- children: [
46845
- /* @__PURE__ */ jsx(
46846
- "path",
46847
- {
46848
- d: "M12 1C12.5523 1 13 1.44772 13 2V4C13 4.55228 12.5523 5 12 5C11.4477 5 11 4.55228 11 4V2C11 1.44772 11.4477 1 12 1Z",
46849
- fill: "currentColor"
46850
- }
46851
- ),
46852
- /* @__PURE__ */ jsx(
46853
- "path",
46854
- {
46855
- fillRule: "evenodd",
46856
- clipRule: "evenodd",
46857
- d: "M7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12ZM12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9Z",
46858
- fill: "currentColor"
46859
- }
46860
- ),
46861
- /* @__PURE__ */ jsx(
46862
- "path",
46863
- {
46864
- d: "M13 20C13 19.4477 12.5523 19 12 19C11.4477 19 11 19.4477 11 20V22C11 22.5523 11.4477 23 12 23C12.5523 23 13 22.5523 13 22V20Z",
46865
- fill: "currentColor"
46866
- }
46867
- ),
46868
- /* @__PURE__ */ jsx(
46869
- "path",
46870
- {
46871
- d: "M4.22282 4.22289C4.61335 3.83236 5.24651 3.83236 5.63704 4.22289L7.04704 5.63289C7.43756 6.02341 7.43756 6.65658 7.04704 7.0471C6.65651 7.43762 6.02335 7.43762 5.63283 7.0471L4.22282 5.6371C3.8323 5.24658 3.8323 4.61341 4.22282 4.22289Z",
46872
- fill: "currentColor"
46873
- }
46874
- ),
46875
- /* @__PURE__ */ jsx(
46876
- "path",
46877
- {
46878
- d: "M18.367 16.9529C17.9765 16.5623 17.3433 16.5623 16.9528 16.9529C16.5623 17.3434 16.5623 17.9766 16.9528 18.3671L18.3628 19.7771C18.7533 20.1676 19.3865 20.1676 19.777 19.7771C20.1675 19.3866 20.1675 18.7534 19.777 18.3629L18.367 16.9529Z",
46879
- fill: "currentColor"
46880
- }
46881
- ),
46882
- /* @__PURE__ */ jsx(
46883
- "path",
46884
- {
46885
- d: "M1 12C1 11.4477 1.44772 11 2 11H4C4.55228 11 5 11.4477 5 12C5 12.5523 4.55228 13 4 13H2C1.44772 13 1 12.5523 1 12Z",
46886
- fill: "currentColor"
46887
- }
46888
- ),
46889
- /* @__PURE__ */ jsx(
46890
- "path",
46891
- {
46892
- d: "M20 11C19.4477 11 19 11.4477 19 12C19 12.5523 19.4477 13 20 13H22C22.5523 13 23 12.5523 23 12C23 11.4477 22.5523 11 22 11H20Z",
46893
- fill: "currentColor"
46894
- }
46895
- ),
46896
- /* @__PURE__ */ jsx(
46897
- "path",
46898
- {
46899
- d: "M7.04704 16.9529C7.43756 17.3434 7.43756 17.9766 7.04704 18.3671L5.63704 19.7771C5.24651 20.1676 4.61335 20.1676 4.22282 19.7771C3.8323 19.3866 3.8323 18.7534 4.22283 18.3629L5.63283 16.9529C6.02335 16.5623 6.65651 16.5623 7.04704 16.9529Z",
46900
- fill: "currentColor"
46901
- }
46902
- ),
46903
- /* @__PURE__ */ jsx(
46904
- "path",
46905
- {
46906
- d: "M19.777 5.6371C20.1675 5.24657 20.1675 4.61341 19.777 4.22289C19.3865 3.83236 18.7533 3.83236 18.3628 4.22289L16.9528 5.63289C16.5623 6.02341 16.5623 6.65658 16.9528 7.0471C17.3433 7.43762 17.9765 7.43762 18.367 7.0471L19.777 5.6371Z",
46907
- fill: "currentColor"
46908
- }
46909
- )
46910
- ]
46911
- }
46912
- );
46913
- });
46914
- SunIcon.displayName = "SunIcon";
46915
- var MoonStarIcon = memo(({ className, ...props }) => {
46916
- return /* @__PURE__ */ jsxs(
47581
+ var MessageSquareIcon = memo(({ className, ...props }) => {
47582
+ return /* @__PURE__ */ jsx(
46917
47583
  "svg",
46918
47584
  {
46919
47585
  width: "24",
@@ -46923,54 +47589,19 @@ var MoonStarIcon = memo(({ className, ...props }) => {
46923
47589
  fill: "currentColor",
46924
47590
  xmlns: "http://www.w3.org/2000/svg",
46925
47591
  ...props,
46926
- children: [
46927
- /* @__PURE__ */ jsx(
46928
- "path",
46929
- {
46930
- fillRule: "evenodd",
46931
- clipRule: "evenodd",
46932
- d: "M12 2C10.0222 2 8.08879 2.58649 6.4443 3.6853C4.79981 4.78412 3.51809 6.3459 2.76121 8.17317C2.00433 10.0004 1.8063 12.0111 2.19215 13.9509C2.578 15.8907 3.53041 17.6725 4.92894 19.0711C6.32746 20.4696 8.10929 21.422 10.0491 21.8079C11.9889 22.1937 13.9996 21.9957 15.8268 21.2388C17.6541 20.4819 19.2159 19.2002 20.3147 17.5557C21.4135 15.9112 22 13.9778 22 12C22 11.5955 21.7564 11.2309 21.3827 11.0761C21.009 10.9213 20.5789 11.0069 20.2929 11.2929C19.287 12.2988 17.9226 12.864 16.5 12.864C15.0774 12.864 13.713 12.2988 12.7071 11.2929C11.7012 10.287 11.136 8.92261 11.136 7.5C11.136 6.07739 11.7012 4.71304 12.7071 3.70711C12.9931 3.42111 13.0787 2.99099 12.9239 2.61732C12.7691 2.24364 12.4045 2 12 2ZM7.55544 5.34824C8.27036 4.87055 9.05353 4.51389 9.87357 4.28778C9.39271 5.27979 9.13604 6.37666 9.13604 7.5C9.13604 9.45304 9.91189 11.3261 11.2929 12.7071C12.6739 14.0881 14.547 14.864 16.5 14.864C17.6233 14.864 18.7202 14.6073 19.7122 14.1264C19.4861 14.9465 19.1295 15.7296 18.6518 16.4446C17.7727 17.7602 16.5233 18.7855 15.0615 19.391C13.5997 19.9965 11.9911 20.155 10.4393 19.8463C8.88743 19.5376 7.46197 18.7757 6.34315 17.6569C5.22433 16.538 4.4624 15.1126 4.15372 13.5607C3.84504 12.0089 4.00347 10.4003 4.60897 8.93853C5.21447 7.47672 6.23985 6.22729 7.55544 5.34824Z",
46933
- fill: "currentColor"
46934
- }
46935
- ),
46936
- /* @__PURE__ */ jsx(
46937
- "path",
46938
- {
46939
- d: "M19 2C19.5523 2 20 2.44772 20 3V4H21C21.5523 4 22 4.44772 22 5C22 5.55228 21.5523 6 21 6H20V7C20 7.55228 19.5523 8 19 8C18.4477 8 18 7.55228 18 7V6H17C16.4477 6 16 5.55228 16 5C16 4.44772 16.4477 4 17 4H18V3C18 2.44772 18.4477 2 19 2Z",
46940
- fill: "currentColor"
46941
- }
46942
- )
46943
- ]
47592
+ children: /* @__PURE__ */ jsx(
47593
+ "path",
47594
+ {
47595
+ fillRule: "evenodd",
47596
+ clipRule: "evenodd",
47597
+ d: "M5 5C4.73478 5 4.48043 5.10536 4.29289 5.29289C4.10536 5.48043 4 5.73478 4 6V19.5858L6.29289 17.2929C6.48043 17.1054 6.73478 17 7 17H19C19.2652 17 19.5196 16.8946 19.7071 16.7071C19.8946 16.5196 20 16.2652 20 16V6C20 5.73478 19.8946 5.48043 19.7071 5.29289C19.5196 5.10536 19.2652 5 19 5H5ZM2.87868 3.87868C3.44129 3.31607 4.20435 3 5 3H19C19.7957 3 20.5587 3.31607 21.1213 3.87868C21.6839 4.44129 22 5.20435 22 6V16C22 16.7957 21.6839 17.5587 21.1213 18.1213C20.5587 18.6839 19.7957 19 19 19H7.41421L3.70711 22.7071C3.42111 22.9931 2.99099 23.0787 2.61732 22.9239C2.24364 22.7691 2 22.4045 2 22V6C2 5.20435 2.31607 4.44129 2.87868 3.87868Z",
47598
+ fill: "currentColor"
47599
+ }
47600
+ )
46944
47601
  }
46945
47602
  );
46946
47603
  });
46947
- MoonStarIcon.displayName = "MoonStarIcon";
46948
- function ThemeToggle() {
46949
- const [isDarkMode, setIsDarkMode] = useState(false);
46950
- useEffect(() => {
46951
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
46952
- const handleChange = () => setIsDarkMode(mediaQuery.matches);
46953
- mediaQuery.addEventListener("change", handleChange);
46954
- return () => mediaQuery.removeEventListener("change", handleChange);
46955
- }, []);
46956
- useEffect(() => {
46957
- const initialDarkMode = !!document.querySelector('meta[name="color-scheme"][content="dark"]') || window.matchMedia("(prefers-color-scheme: dark)").matches;
46958
- setIsDarkMode(initialDarkMode);
46959
- }, []);
46960
- useEffect(() => {
46961
- document.documentElement.classList.toggle("dark", isDarkMode);
46962
- }, [isDarkMode]);
46963
- const toggleDarkMode = () => setIsDarkMode((isDark) => !isDark);
46964
- return /* @__PURE__ */ jsx(
46965
- Button,
46966
- {
46967
- onClick: toggleDarkMode,
46968
- "aria-label": `Switch to ${isDarkMode ? "light" : "dark"} mode`,
46969
- variant: "ghost",
46970
- children: isDarkMode ? /* @__PURE__ */ jsx(MoonStarIcon, { className: "tiptap-button-icon" }) : /* @__PURE__ */ jsx(SunIcon, { className: "tiptap-button-icon" })
46971
- }
46972
- );
46973
- }
47604
+ MessageSquareIcon.displayName = "MessageSquareIcon";
46974
47605
  var PrinterIcon = memo(({ className, ...props }) => {
46975
47606
  return /* @__PURE__ */ jsxs(
46976
47607
  "svg",
@@ -47217,40 +47848,199 @@ function CollaborationUsers() {
47217
47848
  ] }) }, user.id)) }) })
47218
47849
  ] });
47219
47850
  }
47220
- function PrintButton() {
47851
+ var SAVE_STATE_LABELS = {
47852
+ unsaved: "未保存",
47853
+ saving: "正在保存",
47854
+ saved: "已保存",
47855
+ error: "保存失败",
47856
+ offline: "离线"
47857
+ };
47858
+ function DocumentViewModeMenu() {
47859
+ const { mode, canEdit, setMode } = useViewMode();
47860
+ const [open, setOpen] = useState(false);
47861
+ if (!canEdit) return null;
47862
+ const current = VIEW_MODE_ITEMS.find((item) => item.mode === mode) ?? VIEW_MODE_ITEMS[0];
47863
+ return /* @__PURE__ */ jsx(MenuProvider2, { placement: "bottom-start", open, setOpen, children: /* @__PURE__ */ jsxs(MenuContext.Provider, { value: { isRootMenu: true, open }, children: [
47864
+ /* @__PURE__ */ jsxs(
47865
+ MenuButton2,
47866
+ {
47867
+ render: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost" }),
47868
+ "aria-label": `文档模式:${current.name}`,
47869
+ children: [
47870
+ /* @__PURE__ */ jsx("span", { children: current.name }),
47871
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "tiptap-button-dropdown-small", "aria-hidden": "true" })
47872
+ ]
47873
+ }
47874
+ ),
47875
+ /* @__PURE__ */ jsx(
47876
+ MenuContent,
47877
+ {
47878
+ className: "notion-like-editor-menu",
47879
+ "aria-label": "文档模式",
47880
+ composite: true,
47881
+ modal: false,
47882
+ portal: true,
47883
+ preventBodyScroll: false,
47884
+ children: VIEW_MODE_ITEMS.map((item) => /* @__PURE__ */ jsxs(
47885
+ MenuItemRadio2,
47886
+ {
47887
+ className: "notion-like-editor-menu-item",
47888
+ name: "document-view-mode",
47889
+ value: item.mode,
47890
+ checked: item.mode === mode,
47891
+ "aria-label": item.name,
47892
+ hideOnClick: true,
47893
+ onClick: () => {
47894
+ if (item.mode !== mode) setMode(item.mode, "user");
47895
+ },
47896
+ children: [
47897
+ /* @__PURE__ */ jsx("span", { children: item.name }),
47898
+ /* @__PURE__ */ jsx(MenuItemCheck2, {})
47899
+ ]
47900
+ },
47901
+ item.mode
47902
+ ))
47903
+ }
47904
+ )
47905
+ ] }) });
47906
+ }
47907
+ function DocumentMoreMenu() {
47221
47908
  const { editor } = useTiptapEditor();
47222
- if (!editor || !getDocPermissions(editor).print) return null;
47223
- return /* @__PURE__ */ jsx(
47224
- Button,
47225
- {
47226
- type: "button",
47227
- variant: "ghost",
47228
- tabIndex: -1,
47229
- "aria-label": "打印",
47230
- tooltip: "打印",
47231
- shortcutKeys: "mod+p",
47232
- onClick: () => editor.commands.printDocument(),
47233
- children: /* @__PURE__ */ jsx(PrinterIcon, { className: "tiptap-button-icon" })
47234
- }
47235
- );
47909
+ const documentConfig = useEditorConfig()?.document;
47910
+ const { mode, setMode } = useWidthMode();
47911
+ const [open, setOpen] = useState(false);
47912
+ const theme = useTheme();
47913
+ const isDark = isDarkAntdToken(theme, theme.isDarkMode);
47914
+ return /* @__PURE__ */ jsx(MenuProvider2, { placement: "bottom-end", open, setOpen, children: /* @__PURE__ */ jsxs(MenuContext.Provider, { value: { isRootMenu: true, open }, children: [
47915
+ /* @__PURE__ */ jsx(MenuButton2, { render: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost" }), "aria-label": "更多操作", children: /* @__PURE__ */ jsx(MoreVerticalIcon, { className: "tiptap-button-icon", "aria-hidden": "true" }) }),
47916
+ /* @__PURE__ */ jsxs(
47917
+ MenuContent,
47918
+ {
47919
+ className: "notion-like-editor-menu",
47920
+ "aria-label": "更多操作",
47921
+ composite: true,
47922
+ modal: false,
47923
+ portal: true,
47924
+ preventBodyScroll: false,
47925
+ children: [
47926
+ /* @__PURE__ */ jsxs(MenuGroup2, { children: [
47927
+ /* @__PURE__ */ jsx(MenuGroupLabel2, { children: "页宽设置" }),
47928
+ WIDTH_MODE_ITEMS.map((item) => /* @__PURE__ */ jsxs(
47929
+ MenuItemRadio2,
47930
+ {
47931
+ className: "notion-like-editor-menu-item",
47932
+ name: "document-width",
47933
+ value: item.mode,
47934
+ checked: item.mode === mode,
47935
+ hideOnClick: true,
47936
+ onClick: () => {
47937
+ if (item.mode !== mode) setMode(item.mode);
47938
+ },
47939
+ children: [
47940
+ /* @__PURE__ */ jsx("span", { children: item.name }),
47941
+ /* @__PURE__ */ jsx(MenuItemCheck2, {})
47942
+ ]
47943
+ },
47944
+ item.mode
47945
+ ))
47946
+ ] }),
47947
+ editor && getDocPermissions(editor).print && typeof editor.commands.printDocument === "function" ? /* @__PURE__ */ jsxs(
47948
+ MenuItem3,
47949
+ {
47950
+ className: "notion-like-editor-menu-item",
47951
+ "aria-label": "打印",
47952
+ onClick: () => {
47953
+ if (getDocPermissions(editor).print) editor.commands.printDocument();
47954
+ },
47955
+ children: [
47956
+ /* @__PURE__ */ jsx(PrinterIcon, { className: "tiptap-button-icon", "aria-hidden": "true" }),
47957
+ /* @__PURE__ */ jsx("span", { children: "打印" })
47958
+ ]
47959
+ }
47960
+ ) : null,
47961
+ documentConfig?.onOpenHistory ? /* @__PURE__ */ jsx(
47962
+ MenuItem3,
47963
+ {
47964
+ className: "notion-like-editor-menu-item",
47965
+ onClick: documentConfig.onOpenHistory,
47966
+ children: "历史记录"
47967
+ }
47968
+ ) : null,
47969
+ /* @__PURE__ */ jsx(MenuSeparator2, { className: "notion-like-editor-menu-separator" }),
47970
+ /* @__PURE__ */ jsxs("div", { className: "notion-like-editor-menu-note", children: [
47971
+ "主题:跟随宿主(",
47972
+ isDark ? "深色" : "浅色",
47973
+ ")"
47974
+ ] })
47975
+ ]
47976
+ }
47977
+ )
47978
+ ] }) });
47236
47979
  }
47237
47980
  function NotionEditorHeader() {
47981
+ const documentConfig = useEditorConfig()?.document;
47982
+ const saveState = documentConfig?.saveState;
47983
+ const commentCount = documentConfig?.commentCount;
47238
47984
  return /* @__PURE__ */ jsxs("header", { className: "notion-like-editor-header", children: [
47985
+ saveState ? /* @__PURE__ */ jsxs("div", { className: "notion-like-editor-header-feedback", children: [
47986
+ /* @__PURE__ */ jsxs(
47987
+ "output",
47988
+ {
47989
+ className: "notion-like-editor-save-state",
47990
+ "data-save-state": saveState,
47991
+ "aria-live": "polite",
47992
+ "aria-atomic": "true",
47993
+ children: [
47994
+ /* @__PURE__ */ jsx("span", { className: "notion-like-editor-save-state-indicator", "aria-hidden": "true" }),
47995
+ /* @__PURE__ */ jsx("span", { children: SAVE_STATE_LABELS[saveState] })
47996
+ ]
47997
+ }
47998
+ ),
47999
+ saveState === "error" && documentConfig?.onRetrySave ? /* @__PURE__ */ jsx(
48000
+ Button,
48001
+ {
48002
+ type: "button",
48003
+ variant: "ghost",
48004
+ size: "small",
48005
+ "aria-label": "重试保存",
48006
+ onClick: documentConfig.onRetrySave,
48007
+ children: "重试"
48008
+ }
48009
+ ) : null
48010
+ ] }) : null,
47239
48011
  /* @__PURE__ */ jsx(Spacer, {}),
47240
48012
  /* @__PURE__ */ jsxs("div", { className: "notion-like-editor-header-actions", children: [
47241
- /* @__PURE__ */ jsx(ViewModeSwitch, {}),
47242
- /* @__PURE__ */ jsx(Separator, {}),
48013
+ /* @__PURE__ */ jsx(DocumentViewModeMenu, {}),
47243
48014
  /* @__PURE__ */ jsxs(ButtonGroup, { children: [
47244
- /* @__PURE__ */ jsx(ButtonGroup, { children: /* @__PURE__ */ jsx(UndoRedoButton, { action: "undo" }) }),
47245
- /* @__PURE__ */ jsx(ButtonGroup, { children: /* @__PURE__ */ jsx(UndoRedoButton, { action: "redo" }) })
48015
+ /* @__PURE__ */ jsx(UndoRedoButton, { action: "undo", tabIndex: 0 }),
48016
+ /* @__PURE__ */ jsx(UndoRedoButton, { action: "redo", tabIndex: 0 })
47246
48017
  ] }),
47247
48018
  /* @__PURE__ */ jsx(Separator, {}),
47248
- /* @__PURE__ */ jsx(WidthModeMenu, {}),
47249
- /* @__PURE__ */ jsx(PrintButton, {}),
47250
- /* @__PURE__ */ jsx(Separator, {}),
47251
- /* @__PURE__ */ jsx(ThemeToggle, {}),
47252
- /* @__PURE__ */ jsx(Separator, {}),
47253
- /* @__PURE__ */ jsx(CollaborationUsers, {})
48019
+ /* @__PURE__ */ jsx(CollaborationUsers, {}),
48020
+ documentConfig?.onOpenComments ? /* @__PURE__ */ jsxs(
48021
+ Button,
48022
+ {
48023
+ type: "button",
48024
+ variant: "ghost",
48025
+ "aria-label": commentCount === void 0 ? "评论" : `评论(${commentCount})`,
48026
+ onClick: documentConfig.onOpenComments,
48027
+ children: [
48028
+ /* @__PURE__ */ jsx(MessageSquareIcon, { className: "tiptap-button-icon", "aria-hidden": "true" }),
48029
+ commentCount !== void 0 ? /* @__PURE__ */ jsx("span", { className: "notion-like-editor-comment-count", "aria-hidden": "true", children: commentCount }) : null
48030
+ ]
48031
+ }
48032
+ ) : null,
48033
+ documentConfig?.onShare ? /* @__PURE__ */ jsx(
48034
+ Button,
48035
+ {
48036
+ type: "button",
48037
+ variant: "primary",
48038
+ className: "notion-like-editor-share",
48039
+ onClick: documentConfig.onShare,
48040
+ children: "分享"
48041
+ }
48042
+ ) : null,
48043
+ /* @__PURE__ */ jsx(DocumentMoreMenu, {})
47254
48044
  ] })
47255
48045
  ] });
47256
48046
  }
@@ -49902,9 +50692,33 @@ function MainToolbarContent({
49902
50692
  toolbarViews,
49903
50693
  onViewChange
49904
50694
  }) {
50695
+ const comments = useEditorConfig()?.comments;
50696
+ const commentSelection = useEditorState({
50697
+ editor,
50698
+ selector: ({ editor: current }) => current ? getCommentSelection(current.state) : null
50699
+ });
50700
+ const commentSelectionRef = useRef(null);
49905
50701
  const hasSelection = hasTextSelection(editor);
49906
50702
  const hasContent = (editor?.getText().length ?? 0) > 0;
49907
50703
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
50704
+ comments && editor?.isEditable && commentSelection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
50705
+ Button,
50706
+ {
50707
+ type: "button",
50708
+ variant: "ghost",
50709
+ "aria-label": "添加评论",
50710
+ onMouseDown: (event) => {
50711
+ event.preventDefault();
50712
+ commentSelectionRef.current = getCommentSelection(editor.state);
50713
+ },
50714
+ onClick: () => {
50715
+ const selection = commentSelectionRef.current ?? commentSelection;
50716
+ commentSelectionRef.current = null;
50717
+ if (editor.isEditable && selection) comments.onCreateComment(selection);
50718
+ },
50719
+ children: "添加评论"
50720
+ }
50721
+ ) }),
49908
50722
  /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
49909
50723
  /* @__PURE__ */ jsx(SlashCommandTriggerButton, {}),
49910
50724
  /* @__PURE__ */ jsx(MoreActionsDropdown, { editor }),
@@ -49999,6 +50813,12 @@ function MobileToolbar({ editor: providedEditor }) {
49999
50813
  }
50000
50814
  function NotionToolbarFloating() {
50001
50815
  const { editor } = useTiptapEditor();
50816
+ const comments = useEditorConfig()?.comments;
50817
+ const commentSelection = useEditorState({
50818
+ editor,
50819
+ selector: ({ editor: current }) => current ? getCommentSelection(current.state) : null
50820
+ });
50821
+ const commentSelectionRef = useRef(null);
50002
50822
  const isMobile = useIsBreakpoint("max", 480);
50003
50823
  const { lockDragHandle, commentInputVisible } = useUiEditorState(editor);
50004
50824
  const linkPanelOpen = useEditorState({
@@ -50037,6 +50857,24 @@ function NotionToolbarFloating() {
50037
50857
  /* @__PURE__ */ jsx(VideoNodeFloating, {})
50038
50858
  ] }),
50039
50859
  /* @__PURE__ */ jsx(MoreOptions, { hideWhenUnavailable: true }),
50860
+ comments && editor?.isEditable && commentSelection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
50861
+ Button,
50862
+ {
50863
+ type: "button",
50864
+ variant: "ghost",
50865
+ "aria-label": "添加评论",
50866
+ onMouseDown: (event) => {
50867
+ event.preventDefault();
50868
+ commentSelectionRef.current = getCommentSelection(editor.state);
50869
+ },
50870
+ onClick: () => {
50871
+ const selection = commentSelectionRef.current ?? commentSelection;
50872
+ commentSelectionRef.current = null;
50873
+ if (editor.isEditable && selection) comments.onCreateComment(selection);
50874
+ },
50875
+ children: "添加评论"
50876
+ }
50877
+ ) }),
50040
50878
  editor?.isEditable && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
50041
50879
  Button,
50042
50880
  {
@@ -50211,6 +51049,13 @@ function TocSidebar({
50211
51049
  }) {
50212
51050
  const { tocContent, navigateToHeading, normalizeHeadingDepths: normalizeHeadingDepths2 } = useToc();
50213
51051
  const hasRestoredHashRef = useRef(false);
51052
+ const navigationId = useId();
51053
+ const toggleRef = useRef(null);
51054
+ const [isPinned, setIsPinned] = useState(false);
51055
+ const [isHovered, setIsHovered] = useState(false);
51056
+ const [hasFocus, setHasFocus] = useState(false);
51057
+ const [isDismissed, setIsDismissed] = useState(false);
51058
+ const isExpanded = !isDismissed && (isPinned || isHovered || hasFocus);
50214
51059
  const lastClickTimeRef = useRef(null);
50215
51060
  const [manualActiveId, setManualActiveId] = useState(null);
50216
51061
  const headingList = useMemo(
@@ -50305,7 +51150,7 @@ function TocSidebar({
50305
51150
  const popoverRef = useRef(null);
50306
51151
  useEffect(() => {
50307
51152
  if (!activeContentId) return;
50308
- for (const box of [progressRef.current, popoverRef.current]) {
51153
+ for (const box of [isPinned ? null : progressRef.current, isExpanded ? popoverRef.current : null]) {
50309
51154
  const el = box?.querySelector(`[data-toc-id="${CSS.escape(activeContentId)}"]`);
50310
51155
  if (!box || !el) continue;
50311
51156
  const top = el.offsetTop - box.offsetTop;
@@ -50313,60 +51158,154 @@ function TocSidebar({
50313
51158
  if (top < box.scrollTop) box.scrollTop = top;
50314
51159
  else if (bottom > box.scrollTop + box.clientHeight) box.scrollTop = bottom - box.clientHeight;
50315
51160
  }
50316
- }, [activeContentId]);
51161
+ }, [activeContentId, isExpanded, isPinned]);
50317
51162
  const hasHeadings = headingList.length > 0;
50318
- return /* @__PURE__ */ jsx("div", { ref: sidebarRef, className: cn("toc-sidebar", className), ...props, children: /* @__PURE__ */ jsx("div", { className: "toc-sidebar-wrapper", children: /* @__PURE__ */ jsxs("div", { className: "toc-sidebar-inner", children: [
50319
- /* @__PURE__ */ jsx("div", { ref: progressRef, className: "toc-sidebar-progress", children: visibleHeadings.map((item) => {
50320
- const depth = depthById.get(item.id) ?? 1;
50321
- const isActive = activeContentId === item.id;
50322
- return /* @__PURE__ */ jsx(
50323
- "div",
51163
+ const closeSidebar = () => {
51164
+ setIsPinned(false);
51165
+ setIsDismissed(true);
51166
+ toggleRef.current?.focus({ preventScroll: true });
51167
+ };
51168
+ return /* @__PURE__ */ jsx(
51169
+ "div",
51170
+ {
51171
+ ref: sidebarRef,
51172
+ className: cn(
51173
+ "toc-sidebar",
51174
+ hasHeadings && isPinned && "toc-sidebar--pinned",
51175
+ hasHeadings && isExpanded && "toc-sidebar--expanded",
51176
+ className
51177
+ ),
51178
+ ...props,
51179
+ children: /* @__PURE__ */ jsx(
51180
+ "aside",
50324
51181
  {
50325
- "data-toc-id": item.id,
50326
- className: cn(
50327
- "toc-sidebar-progress-line",
50328
- isActive && "toc-sidebar-progress-line--active"
50329
- ),
50330
- "data-depth": depth,
50331
- style: { "--toc-depth": depth }
50332
- },
50333
- item.id
50334
- );
50335
- }) }),
50336
- /* @__PURE__ */ jsx(
50337
- "nav",
50338
- {
50339
- className: cn(
50340
- "toc-sidebar-nav",
50341
- !hasHeadings && "toc-sidebar-nav--hidden"
50342
- ),
50343
- "aria-label": "目录",
50344
- children: /* @__PURE__ */ jsx("div", { ref: popoverRef, className: "toc-sidebar-popover", children: visibleHeadings.map((item) => {
50345
- const depth = depthById.get(item.id) ?? 1;
50346
- const isActive = activeContentId === item.id;
50347
- return /* @__PURE__ */ jsx(
50348
- "a",
50349
- {
50350
- "data-toc-id": item.id,
50351
- title: item.textContent,
50352
- href: `#${item.id}`,
50353
- rel: "noopener noreferrer",
50354
- className: cn(
50355
- "toc-sidebar-item notranslate",
50356
- isActive && "toc-sidebar-item--active"
50357
- ),
50358
- "data-depth": depth,
50359
- style: { "--toc-depth": depth },
50360
- onClick: (e) => handleContentClick(e, item),
50361
- "aria-current": isActive ? "location" : void 0,
50362
- children: withOrder(item)
50363
- },
50364
- item.id
50365
- );
50366
- }) })
50367
- }
50368
- )
50369
- ] }) }) });
51182
+ className: "toc-sidebar-wrapper",
51183
+ "aria-label": "文档目录",
51184
+ onMouseEnter: () => {
51185
+ setIsHovered(true);
51186
+ setIsDismissed(false);
51187
+ },
51188
+ onMouseLeave: () => setIsHovered(false),
51189
+ onFocusCapture: (event) => {
51190
+ setHasFocus(true);
51191
+ if (!event.currentTarget.contains(event.relatedTarget)) setIsDismissed(false);
51192
+ },
51193
+ onBlurCapture: (event) => {
51194
+ if (!event.currentTarget.contains(event.relatedTarget)) setHasFocus(false);
51195
+ },
51196
+ onKeyDownCapture: (event) => {
51197
+ if (event.key === "Escape" && isExpanded) {
51198
+ event.preventDefault();
51199
+ event.stopPropagation();
51200
+ closeSidebar();
51201
+ } else if (isDismissed && event.key === "Tab" && !event.shiftKey && event.target === toggleRef.current) {
51202
+ flushSync(() => setIsDismissed(false));
51203
+ }
51204
+ },
51205
+ children: /* @__PURE__ */ jsxs("div", { className: "toc-sidebar-inner", children: [
51206
+ hasHeadings && /* @__PURE__ */ jsxs(
51207
+ "button",
51208
+ {
51209
+ ref: toggleRef,
51210
+ type: "button",
51211
+ className: "toc-sidebar-toggle",
51212
+ "aria-label": isPinned ? "收起目录" : "固定目录",
51213
+ title: isPinned ? "收起目录" : "固定目录",
51214
+ "aria-controls": navigationId,
51215
+ "aria-pressed": isPinned,
51216
+ "aria-expanded": isExpanded,
51217
+ onClick: () => {
51218
+ if (isPinned) closeSidebar();
51219
+ else {
51220
+ setIsDismissed(false);
51221
+ setIsPinned(true);
51222
+ }
51223
+ },
51224
+ children: [
51225
+ /* @__PURE__ */ jsx(
51226
+ "svg",
51227
+ {
51228
+ width: "14",
51229
+ height: "14",
51230
+ viewBox: "0 0 24 24",
51231
+ fill: "none",
51232
+ stroke: "currentColor",
51233
+ strokeWidth: "1.8",
51234
+ "aria-hidden": "true",
51235
+ focusable: "false",
51236
+ children: /* @__PURE__ */ jsx("path", { d: "M4 5h16M4 12h16M4 19h10" })
51237
+ }
51238
+ ),
51239
+ isPinned ? "收起目录" : "目录"
51240
+ ]
51241
+ }
51242
+ ),
51243
+ /* @__PURE__ */ jsx(
51244
+ "div",
51245
+ {
51246
+ ref: progressRef,
51247
+ className: "toc-sidebar-progress",
51248
+ "aria-hidden": "true",
51249
+ tabIndex: -1,
51250
+ children: visibleHeadings.map((item) => {
51251
+ const depth = depthById.get(item.id) ?? 1;
51252
+ const isActive = activeContentId === item.id;
51253
+ return /* @__PURE__ */ jsx(
51254
+ "div",
51255
+ {
51256
+ "data-toc-id": item.id,
51257
+ className: cn(
51258
+ "toc-sidebar-progress-line",
51259
+ isActive && "toc-sidebar-progress-line--active"
51260
+ ),
51261
+ "data-depth": depth,
51262
+ style: { "--toc-depth": depth }
51263
+ },
51264
+ item.id
51265
+ );
51266
+ })
51267
+ }
51268
+ ),
51269
+ /* @__PURE__ */ jsx(
51270
+ "nav",
51271
+ {
51272
+ id: navigationId,
51273
+ className: cn(
51274
+ "toc-sidebar-nav",
51275
+ !hasHeadings && "toc-sidebar-nav--hidden"
51276
+ ),
51277
+ "aria-label": "目录",
51278
+ "aria-hidden": !hasHeadings || !isExpanded,
51279
+ children: /* @__PURE__ */ jsx("div", { ref: popoverRef, className: "toc-sidebar-popover", tabIndex: -1, children: visibleHeadings.map((item) => {
51280
+ const depth = depthById.get(item.id) ?? 1;
51281
+ const isActive = activeContentId === item.id;
51282
+ return /* @__PURE__ */ jsx(
51283
+ "a",
51284
+ {
51285
+ "data-toc-id": item.id,
51286
+ title: item.textContent,
51287
+ href: `#${item.id}`,
51288
+ rel: "noopener noreferrer",
51289
+ className: cn(
51290
+ "toc-sidebar-item notranslate",
51291
+ isActive && "toc-sidebar-item--active"
51292
+ ),
51293
+ "data-depth": depth,
51294
+ style: { "--toc-depth": depth },
51295
+ onClick: (e) => handleContentClick(e, item),
51296
+ "aria-current": isActive ? "location" : void 0,
51297
+ children: withOrder(item)
51298
+ },
51299
+ item.id
51300
+ );
51301
+ }) })
51302
+ }
51303
+ )
51304
+ ] })
51305
+ }
51306
+ )
51307
+ }
51308
+ );
50370
51309
  }
50371
51310
  var ListNormalizationExtension = Extension.create({
50372
51311
  name: "listNormalization",
@@ -50750,15 +51689,141 @@ function createRichMarkdownExtensions() {
50750
51689
  });
50751
51690
  return { MarkdownParagraph, MarkdownHeading };
50752
51691
  }
51692
+
51693
+ // src/lib/im-input.ts
51694
+ function createMessageInputKeyHandler({
51695
+ getEditor,
51696
+ getSendKey,
51697
+ onSend
51698
+ }) {
51699
+ return (view, event) => {
51700
+ if (!onSend || event.defaultPrevented || event.isComposing || event.keyCode === 229 || view.composing) {
51701
+ return false;
51702
+ }
51703
+ const editor = getEditor();
51704
+ if (!editor || editor.isDestroyed || !editor.isEditable) return false;
51705
+ if (event.key !== "Enter" || event.shiftKey || event.altKey) return false;
51706
+ const modifier = event.metaKey || event.ctrlKey;
51707
+ const sendKey = getSendKey();
51708
+ const shouldSend = sendKey === "enter" ? !modifier : sendKey === "mod-enter" ? modifier : false;
51709
+ if (!shouldSend) return false;
51710
+ event.preventDefault();
51711
+ onSend(editor);
51712
+ return true;
51713
+ };
51714
+ }
50753
51715
  var isMac3 = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
50754
51716
  var FeishuStrike = Strike.extend({
50755
51717
  addKeyboardShortcuts() {
50756
51718
  return { "Mod-Shift-x": () => this.editor.commands.toggleStrike() };
50757
51719
  }
50758
51720
  });
51721
+ function partialLinkRuns(block, start, code, link) {
51722
+ const out = [];
51723
+ let from = -1;
51724
+ let to = -1;
51725
+ let links = [];
51726
+ const flush = () => {
51727
+ const first = links[0];
51728
+ if (from >= 0 && links.some(Boolean) && !links.every((m) => m && first && m.eq(first))) {
51729
+ out.push([from, to]);
51730
+ }
51731
+ from = -1;
51732
+ links = [];
51733
+ };
51734
+ block.forEach((child, offset6) => {
51735
+ if (!child.isText || !code.isInSet(child.marks)) {
51736
+ flush();
51737
+ return;
51738
+ }
51739
+ if (from < 0) from = start + offset6;
51740
+ to = start + offset6 + child.nodeSize;
51741
+ links.push(link.isInSet(child.marks));
51742
+ });
51743
+ flush();
51744
+ return out;
51745
+ }
51746
+ function inlineCodeLinkPlugin() {
51747
+ return new Plugin({
51748
+ key: new PluginKey("inlineCodeLink"),
51749
+ appendTransaction(transactions, oldState, newState) {
51750
+ const { code, link } = newState.schema.marks;
51751
+ if (!code || !link || !transactions.some((tr2) => tr2.docChanged)) return null;
51752
+ const changed = getChangedRanges(combineTransactionSteps(oldState.doc, [...transactions]));
51753
+ const seen = /* @__PURE__ */ new Set();
51754
+ const ranges = [];
51755
+ for (const { newRange } of changed) {
51756
+ newState.doc.nodesBetween(newRange.from, newRange.to, (node, pos) => {
51757
+ if (!node.isTextblock) return true;
51758
+ if (!seen.has(pos)) {
51759
+ seen.add(pos);
51760
+ ranges.push(...partialLinkRuns(node, pos + 1, code, link));
51761
+ }
51762
+ return false;
51763
+ });
51764
+ }
51765
+ if (!ranges.length) return null;
51766
+ const tr = newState.tr;
51767
+ for (const [from, to] of ranges) tr.removeMark(from, to, link);
51768
+ return tr;
51769
+ }
51770
+ });
51771
+ }
50759
51772
  var FeishuCode = Code.extend({
51773
+ excludes: "bold italic underline strike textStyle highlight superscript subscript code",
50760
51774
  addKeyboardShortcuts() {
50761
51775
  return { [isMac3() ? "Mod-Ctrl-c" : "Ctrl-Shift-c"]: () => this.editor.commands.toggleCode() };
51776
+ },
51777
+ addProseMirrorPlugins() {
51778
+ return [...this.parent?.() ?? [], inlineCodeLinkPlugin()];
51779
+ }
51780
+ });
51781
+ function selectionIsAllCode(state) {
51782
+ const { code } = state.schema.marks;
51783
+ const { from, to, empty } = state.selection;
51784
+ if (!code || empty) return false;
51785
+ let hasText = false;
51786
+ let allCode = true;
51787
+ state.doc.nodesBetween(from, to, (node) => {
51788
+ if (!node.isText) return true;
51789
+ hasText = true;
51790
+ if (!code.isInSet(node.marks)) allCode = false;
51791
+ return false;
51792
+ });
51793
+ return hasText && allCode;
51794
+ }
51795
+ var FeishuLink = Link.extend({
51796
+ addPasteRules() {
51797
+ return (this.parent?.() ?? []).map(
51798
+ (rule) => new PasteRule({
51799
+ find: rule.find,
51800
+ handler: (props) => {
51801
+ const { code } = props.state.schema.marks;
51802
+ if (code && props.state.doc.rangeHasMark(props.range.from, props.range.to, code)) {
51803
+ return null;
51804
+ }
51805
+ return rule.handler(props);
51806
+ }
51807
+ })
51808
+ );
51809
+ },
51810
+ // Link 的插件里只有「选中文字后粘贴网址 → 给选区加链接」这一个有 handlePaste。选中的全是行内代码时
51811
+ // 跳过它,按普通粘贴替换文字(放开链接之前就是这样),不给代码挂一个看不出来的链接
51812
+ addProseMirrorPlugins() {
51813
+ return (this.parent?.() ?? []).map((plugin) => {
51814
+ const handlePaste = plugin.props.handlePaste;
51815
+ if (!handlePaste) return plugin;
51816
+ return new Plugin({
51817
+ ...plugin.spec,
51818
+ props: {
51819
+ ...plugin.spec.props,
51820
+ handlePaste(view, event, slice) {
51821
+ if (selectionIsAllCode(view.state)) return false;
51822
+ return handlePaste.call(this, view, event, slice);
51823
+ }
51824
+ }
51825
+ });
51826
+ });
50762
51827
  }
50763
51828
  });
50764
51829
  var FeishuBlockquote = Blockquote.extend({
@@ -51225,6 +52290,11 @@ function EditorProvider(props) {
51225
52290
  hideFloatingToolbar = false,
51226
52291
  embedded = false,
51227
52292
  richMarkdown = false,
52293
+ sendKey,
52294
+ onSend,
52295
+ onUpdate,
52296
+ onSelectionUpdate,
52297
+ onEditorDestroy,
51228
52298
  onEditorReady,
51229
52299
  extensions: extraExtensions,
51230
52300
  pageHeader = false,
@@ -51251,6 +52321,18 @@ function EditorProvider(props) {
51251
52321
  return found;
51252
52322
  }, []);
51253
52323
  const editorConfig = useEditorConfig();
52324
+ const editorConfigRef = useRef(editorConfig);
52325
+ editorConfigRef.current = editorConfig;
52326
+ const onSendRef = useRef(onSend);
52327
+ onSendRef.current = onSend;
52328
+ const sendKeyRef = useRef(sendKey);
52329
+ sendKeyRef.current = sendKey;
52330
+ const onUpdateRef = useRef(onUpdate);
52331
+ onUpdateRef.current = onUpdate;
52332
+ const onSelectionUpdateRef = useRef(onSelectionUpdate);
52333
+ onSelectionUpdateRef.current = onSelectionUpdate;
52334
+ const onEditorDestroyRef = useRef(onEditorDestroy);
52335
+ onEditorDestroyRef.current = onEditorDestroy;
51254
52336
  const [mathBus] = useState(createMathEditBus);
51255
52337
  const onUpload = editorConfig?.upload?.onUpload ?? handleImageUpload;
51256
52338
  const onUploadError = editorConfig?.upload?.onError ?? // 宿主没给 onError 时按飞书弹提示(「上传图片大小不能超过 20 MB」「图片格式仅支持 …」等)
@@ -51280,7 +52362,8 @@ function EditorProvider(props) {
51280
52362
  dropcursor: {
51281
52363
  width: 2
51282
52364
  },
51283
- link: { openOnClick: false }
52365
+ // 换成粘贴规则跳过行内代码的版本(feishu-keymap 的 FeishuLink)
52366
+ link: false
51284
52367
  }),
51285
52368
  ...richMarkdownExtensions ? [richMarkdownExtensions.MarkdownParagraph] : [],
51286
52369
  // 代码块 / 分组 / 高亮 / Markdown / 直接输入:顺序固定,且在协同与 UniqueID 之前
@@ -51299,6 +52382,7 @@ function EditorProvider(props) {
51299
52382
  richMarkdownExtensions ? richMarkdownExtensions.MarkdownHeading : Heading,
51300
52383
  FeishuStrike,
51301
52384
  FeishuCode,
52385
+ FeishuLink.configure({ openOnClick: false }),
51302
52386
  FeishuBlockquote,
51303
52387
  // ⌘⌥S 分割线、⌘⌥H 套用上次颜色、Alt+C 切换待办(规格 §33)
51304
52388
  FeishuKeymap,
@@ -51398,6 +52482,10 @@ function EditorProvider(props) {
51398
52482
  FindReplace,
51399
52483
  PrintDocument,
51400
52484
  ReadOnlyGuard,
52485
+ CommentThread.configure({
52486
+ isInteractive: () => Boolean(editorConfigRef.current?.comments?.onSelectThread),
52487
+ onSelectThread: (threadId) => editorConfigRef.current?.comments?.onSelectThread?.(threadId)
52488
+ }),
51401
52489
  Color,
51402
52490
  FeishuTaskList,
51403
52491
  TaskItem.configure({ nested: true }),
@@ -51503,6 +52591,7 @@ function EditorProvider(props) {
51503
52591
  ],
51504
52592
  filterTransaction: (transaction) => !isChangeOrigin(transaction)
51505
52593
  }),
52594
+ PasteNodeIds,
51506
52595
  // 不挂 Typography:飞书没有任何排版替换(MD 规则全集 vT 里没有),它会把中文文档里的
51507
52596
  // 引号、`--`、`1*2` 改写掉
51508
52597
  UiState,
@@ -51515,6 +52604,14 @@ function EditorProvider(props) {
51515
52604
  const [initialContent] = useState(
51516
52605
  () => provider ? void 0 : normalizeEditorContent(content, contentFormat, extensions) ?? void 0
51517
52606
  );
52607
+ const messageInputKeyHandler = useMemo(
52608
+ () => createMessageInputKeyHandler({
52609
+ getEditor: () => editorRef.current,
52610
+ getSendKey: () => sendKeyRef.current,
52611
+ onSend: (current) => onSendRef.current?.(current)
52612
+ }),
52613
+ []
52614
+ );
51518
52615
  const editor = useEditor({
51519
52616
  immediatelyRender: false,
51520
52617
  // 只读模式:禁用编辑。扩展集保持不变,自定义节点仍走各自 NodeView 渲染
@@ -51524,10 +52621,22 @@ function EditorProvider(props) {
51524
52621
  editorProps: {
51525
52622
  attributes: {
51526
52623
  class: "notion-like-editor"
51527
- }
52624
+ },
52625
+ handleKeyDown: messageInputKeyHandler
52626
+ },
52627
+ onUpdate: ({ editor: current }) => onUpdateRef.current?.(current),
52628
+ onSelectionUpdate: ({ editor: current }) => onSelectionUpdateRef.current?.(current),
52629
+ onDestroy: () => {
52630
+ const current = editorRef.current;
52631
+ if (current) onEditorDestroyRef.current?.(current);
51528
52632
  },
51529
52633
  extensions
51530
52634
  });
52635
+ editorRef.current = editor;
52636
+ const canSelectComment = Boolean(editorConfig?.comments?.onSelectThread);
52637
+ useEffect(() => {
52638
+ if (editor) refreshCommentThreadInteractivity(editor, canSelectComment);
52639
+ }, [editor, canSelectComment]);
51531
52640
  useEffect(() => {
51532
52641
  if (!editor) return;
51533
52642
  editorRef.current = editor;
@@ -51561,9 +52670,20 @@ function EditorProvider(props) {
51561
52670
  useEffect(() => {
51562
52671
  if (provider) return;
51563
52672
  if (!editor) return;
51564
- if (content === void 0 || content === null || content === "") return;
51565
- const next = normalizeEditorContent(content, contentFormat, editor.extensionManager.extensions);
51566
- if (!next) return;
52673
+ const update = resolveEditorContentUpdate(content, contentFormat, editor.extensionManager.extensions);
52674
+ if (update.kind === "ignore") return;
52675
+ if (update.kind === "clear") {
52676
+ if (editor.isEmpty) return;
52677
+ let cancelled2 = false;
52678
+ queueMicrotask(() => {
52679
+ if (cancelled2 || editor.isDestroyed) return;
52680
+ editor.commands.clearContent(false);
52681
+ });
52682
+ return () => {
52683
+ cancelled2 = true;
52684
+ };
52685
+ }
52686
+ const next = update.json;
51567
52687
  if (isSameDocument(editor.getJSON(), next)) return;
51568
52688
  let cancelled = false;
51569
52689
  queueMicrotask(() => {
@@ -51679,6 +52799,11 @@ function NotionEditor({
51679
52799
  hideFloatingToolbar = false,
51680
52800
  embedded = false,
51681
52801
  richMarkdown = false,
52802
+ sendKey,
52803
+ onSend,
52804
+ onUpdate,
52805
+ onSelectionUpdate,
52806
+ onEditorDestroy,
51682
52807
  onEditorReady,
51683
52808
  extensions,
51684
52809
  pageHeader,
@@ -51706,6 +52831,11 @@ function NotionEditor({
51706
52831
  hideFloatingToolbar,
51707
52832
  embedded,
51708
52833
  richMarkdown,
52834
+ sendKey,
52835
+ onSend,
52836
+ onUpdate,
52837
+ onSelectionUpdate,
52838
+ onEditorDestroy,
51709
52839
  onEditorReady,
51710
52840
  extensions,
51711
52841
  pageHeader,
@@ -51730,6 +52860,11 @@ function NotionEditorContent({
51730
52860
  hideFloatingToolbar = false,
51731
52861
  embedded = false,
51732
52862
  richMarkdown = false,
52863
+ sendKey,
52864
+ onSend,
52865
+ onUpdate,
52866
+ onSelectionUpdate,
52867
+ onEditorDestroy,
51733
52868
  onEditorReady,
51734
52869
  extensions,
51735
52870
  pageHeader,
@@ -51762,6 +52897,11 @@ function NotionEditorContent({
51762
52897
  hideFloatingToolbar,
51763
52898
  embedded,
51764
52899
  richMarkdown,
52900
+ sendKey,
52901
+ onSend,
52902
+ onUpdate,
52903
+ onSelectionUpdate,
52904
+ onEditorDestroy,
51765
52905
  onEditorReady,
51766
52906
  extensions,
51767
52907
  pageHeader,
@@ -51802,6 +52942,6 @@ function ArticleViewer({
51802
52942
  ] });
51803
52943
  }
51804
52944
 
51805
- export { ApiParamExtension, ArticleViewer, Audio, CalloutExtension, CodeBlockExtension, CodeGroupExtension, CollabContext, CollabProvider, Column, Columns, 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, WidthModeMenu, countDocument, countRange, countText, defaultUiState, detectMediaKind, findSelectionPosition, getDocPermissions, getEditorMarkdown, hasContentAbove, markHideFloatingOnNext, parseEditorContent, pickFile, printDocument, 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 };
51806
- //# sourceMappingURL=chunk-6MZAYCF6.js.map
51807
- //# sourceMappingURL=chunk-6MZAYCF6.js.map
52945
+ 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 };
52946
+ //# sourceMappingURL=chunk-MKJY3LFJ.js.map
52947
+ //# sourceMappingURL=chunk-MKJY3LFJ.js.map