@4399ywkf/editor 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { EditorConfigProvider, NotionEditor } from './chunk-ZULVQ2KX.js';
1
+ import { EditorConfigProvider, NotionEditor } from './chunk-I4FESO5C.js';
2
2
  import './chunk-MGSVKKK7.js';
3
3
  import './chunk-UD6MDBTN.js';
4
4
  import './chunk-ABMZOL26.js';
@@ -18,5 +18,5 @@ function DocView({ content, contentFormat, readOnly, room, className, onReady })
18
18
  }
19
19
 
20
20
  export { DocView as default };
21
- //# sourceMappingURL=DocView-MGCNDQLF.js.map
22
- //# sourceMappingURL=DocView-MGCNDQLF.js.map
21
+ //# sourceMappingURL=DocView-K6PKSJII.js.map
22
+ //# sourceMappingURL=DocView-K6PKSJII.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-MGCNDQLF.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-K6PKSJII.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
@@ -23278,6 +23278,18 @@ var BlockSpacing = Extension.create({
23278
23278
  };
23279
23279
  }
23280
23280
  });
23281
+
23282
+ // src/lib/scroll-parent.ts
23283
+ function scrollableAncestor(el, styleOf = (node) => getComputedStyle(node)) {
23284
+ const { body, documentElement } = el.ownerDocument;
23285
+ for (let p = el.parentElement; p && p !== documentElement; p = p.parentElement) {
23286
+ if (p === body && styleOf(documentElement).overflowY === "visible") return null;
23287
+ const { overflowY } = styleOf(p);
23288
+ if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight)
23289
+ return p;
23290
+ }
23291
+ return null;
23292
+ }
23281
23293
  function withOrder(item) {
23282
23294
  const order = item.editor && typeof item.pos === "number" ? headingOrderTextAt(item.editor.state, item.pos) : null;
23283
23295
  return order ? `${order} ${item.textContent}` : item.textContent;
@@ -23302,17 +23314,7 @@ function normalizeHeadingDepths(items) {
23302
23314
  }
23303
23315
  return depths;
23304
23316
  }
23305
- var getScrollableAncestor = (element) => {
23306
- let parent = element.parentElement;
23307
- while (parent) {
23308
- const { overflowY } = getComputedStyle(parent);
23309
- if ((overflowY === "auto" || overflowY === "scroll") && parent.scrollHeight > parent.clientHeight) {
23310
- return parent;
23311
- }
23312
- parent = parent.parentElement;
23313
- }
23314
- return window;
23315
- };
23317
+ var getScrollableAncestor = (element) => scrollableAncestor(element) ?? window;
23316
23318
  var isElementVisible = (element, topOffset) => {
23317
23319
  const rect = element.getBoundingClientRect();
23318
23320
  const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
@@ -27461,13 +27463,6 @@ function leafTextFor(editor) {
27461
27463
  }
27462
27464
  };
27463
27465
  }
27464
- function scrollParent(el) {
27465
- for (let p = el.parentElement; p; p = p.parentElement) {
27466
- const { overflowY } = getComputedStyle(p);
27467
- if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) return p;
27468
- }
27469
- return null;
27470
- }
27471
27466
  function scrollToMatch(view, from) {
27472
27467
  let rect;
27473
27468
  try {
@@ -27475,7 +27470,7 @@ function scrollToMatch(view, from) {
27475
27470
  } catch {
27476
27471
  return;
27477
27472
  }
27478
- const container = scrollParent(view.dom);
27473
+ const container = scrollableAncestor(view.dom);
27479
27474
  const top = container ? container.getBoundingClientRect().top : 0;
27480
27475
  const bottom = container ? container.getBoundingClientRect().bottom : window.innerHeight;
27481
27476
  if (rect.top > top + REVEAL_TOP && rect.bottom < bottom) return;
@@ -35457,15 +35452,7 @@ function stickyShift(m) {
35457
35452
  return Math.round(Math.min(shift3, max));
35458
35453
  }
35459
35454
  function scrollParentTop(el) {
35460
- let p = el.parentElement;
35461
- while (p) {
35462
- const { overflowY } = getComputedStyle(p);
35463
- if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) {
35464
- return p.getBoundingClientRect().top;
35465
- }
35466
- p = p.parentElement;
35467
- }
35468
- return 0;
35455
+ return scrollableAncestor(el)?.getBoundingClientRect().top ?? 0;
35469
35456
  }
35470
35457
  function defaultTopOffset() {
35471
35458
  const header = document.querySelector(".notion-like-editor-header");
@@ -51980,13 +51967,6 @@ function showSelectAllTip() {
51980
51967
  }
51981
51968
  });
51982
51969
  }
51983
- function scrollParent2(el) {
51984
- for (let cur = el.parentElement; cur; cur = cur.parentElement) {
51985
- const { overflowY } = getComputedStyle(cur);
51986
- if ((overflowY === "auto" || overflowY === "scroll") && cur.scrollHeight > cur.clientHeight) return cur;
51987
- }
51988
- return null;
51989
- }
51990
51970
  function marqueeView(view) {
51991
51971
  const boundary = view.dom.closest(".notion-like-editor-wrapper") ?? view.dom.parentElement ?? view.dom;
51992
51972
  let start = null;
@@ -52074,7 +52054,7 @@ function marqueeView(view) {
52074
52054
  if (!view.editable || e.button !== 0 || e.shiftKey || isMac4() && e.ctrlKey) return;
52075
52055
  if (!isMargin(e)) return;
52076
52056
  e.preventDefault();
52077
- scroller = scrollParent2(view.dom);
52057
+ scroller = scrollableAncestor(view.dom);
52078
52058
  start = { x: e.clientX, y: e.clientY, scrollTop: scrollTop() };
52079
52059
  pointer = { x: e.clientX, y: e.clientY };
52080
52060
  document.addEventListener("mousemove", onMove);
@@ -52943,5 +52923,5 @@ function ArticleViewer({
52943
52923
  }
52944
52924
 
52945
52925
  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-ZULVQ2KX.js.map
52947
- //# sourceMappingURL=chunk-ZULVQ2KX.js.map
52926
+ //# sourceMappingURL=chunk-I4FESO5C.js.map
52927
+ //# sourceMappingURL=chunk-I4FESO5C.js.map