@4399ywkf/editor 0.13.1 → 0.14.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.
- package/dist/{DocView-MGCNDQLF.js → DocView-FYAAUPSK.js} +3 -3
- package/dist/{DocView-MGCNDQLF.js.map → DocView-FYAAUPSK.js.map} +1 -1
- package/dist/{chunk-ZULVQ2KX.js → chunk-6BJB4YWS.js} +51 -43
- package/dist/chunk-6BJB4YWS.js.map +1 -0
- package/dist/doc-standalone.js +78 -71
- package/dist/doc-standalone.js.map +1 -1
- package/dist/doc.d.ts +27 -5
- package/dist/doc.js +17 -19
- package/dist/doc.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZULVQ2KX.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorConfigProvider, NotionEditor } from './chunk-
|
|
1
|
+
import { EditorConfigProvider, NotionEditor } from './chunk-6BJB4YWS.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-
|
|
22
|
-
//# sourceMappingURL=DocView-
|
|
21
|
+
//# sourceMappingURL=DocView-FYAAUPSK.js.map
|
|
22
|
+
//# sourceMappingURL=DocView-FYAAUPSK.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-
|
|
1
|
+
{"version":3,"sources":["../src/views/DocView.tsx"],"names":[],"mappings":";;;;;;AAMe,SAAR,OAAA,CAAyB,EAAE,OAAA,EAAS,aAAA,EAAe,UAAU,IAAA,EAAM,SAAA,EAAW,SAAQ,EAAsB;AACjH,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EACH,8BAAC,oBAAA,EAAA,EAAqB,MAAA,EAAQ,EAAC,EAC7B,QAAA,kBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,MAAM,IAAA,IAAQ,SAAA;AAAA,MACd,OAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA,EAAe,CAAC,MAAA,KAAmB,OAAA,GAAU,MAAM;AAAA;AAAA,KAEvD,CAAA,EACF,CAAA;AAEJ","file":"DocView-FYAAUPSK.js","sourcesContent":["import type { Editor } from \"@tiptap/react\"\nimport { EditorConfigProvider } from \"../contexts/editor-config-context\"\nimport { NotionEditor } from \"../components/tiptap-templates/notion-like/notion-like-editor\"\nimport type { DocumentViewProps } from \"../registry\"\n\n/** doc 通道:云文档与本地 doc 是同一套 tiptap,不做区分 */\nexport default function DocView({ content, contentFormat, readOnly, room, className, onReady }: DocumentViewProps) {\n return (\n <div className={className}>\n <EditorConfigProvider config={{}}>\n <NotionEditor\n room={room ?? \"default\"}\n content={content as string}\n contentFormat={contentFormat}\n readOnly={readOnly}\n onEditorReady={(editor: Editor) => onReady?.(editor)}\n />\n </EditorConfigProvider>\n </div>\n )\n}\n"]}
|
|
@@ -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 =
|
|
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
|
-
|
|
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 =
|
|
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);
|
|
@@ -52231,7 +52211,12 @@ function LoadingSpinner({ text = "Connecting..." }) {
|
|
|
52231
52211
|
/* @__PURE__ */ jsx("div", { className: "spinner-loading-text", children: text })
|
|
52232
52212
|
] }) });
|
|
52233
52213
|
}
|
|
52234
|
-
function EditorContentArea({
|
|
52214
|
+
function EditorContentArea({
|
|
52215
|
+
hideFloatingToolbar = false,
|
|
52216
|
+
hideSlashMenu = false,
|
|
52217
|
+
hideDragHandle = false,
|
|
52218
|
+
hideEmojiMenu = false
|
|
52219
|
+
}) {
|
|
52235
52220
|
const { editor } = useContext(EditorContext);
|
|
52236
52221
|
useScrollToHash();
|
|
52237
52222
|
if (!editor) {
|
|
@@ -52257,10 +52242,10 @@ function EditorContentArea({ hideFloatingToolbar = false }) {
|
|
|
52257
52242
|
/* @__PURE__ */ jsx(FindReplacePanel, { editor }),
|
|
52258
52243
|
/* @__PURE__ */ jsx(WordCountBadge, { editor }),
|
|
52259
52244
|
isEditable && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
52260
|
-
/* @__PURE__ */ jsx(DragContextMenu, {}),
|
|
52261
|
-
/* @__PURE__ */ jsx(EmojiDropdownMenu, {}),
|
|
52245
|
+
!hideDragHandle && /* @__PURE__ */ jsx(DragContextMenu, {}),
|
|
52246
|
+
!hideEmojiMenu && /* @__PURE__ */ jsx(EmojiDropdownMenu, {}),
|
|
52262
52247
|
/* @__PURE__ */ jsx(MentionDropdownMenu, {}),
|
|
52263
|
-
/* @__PURE__ */ jsx(SlashDropdownMenu, {}),
|
|
52248
|
+
!hideSlashMenu && /* @__PURE__ */ jsx(SlashDropdownMenu, {}),
|
|
52264
52249
|
!hideFloatingToolbar && /* @__PURE__ */ jsx(NotionToolbarFloating, {}),
|
|
52265
52250
|
/* @__PURE__ */ jsx(MathEditorPopover, { editor }),
|
|
52266
52251
|
/* @__PURE__ */ jsx(LinkPastePanel, { editor }),
|
|
@@ -52288,6 +52273,9 @@ function EditorProvider(props) {
|
|
|
52288
52273
|
permissions,
|
|
52289
52274
|
hideHeader = false,
|
|
52290
52275
|
hideFloatingToolbar = false,
|
|
52276
|
+
hideSlashMenu = false,
|
|
52277
|
+
hideDragHandle = false,
|
|
52278
|
+
hideEmojiMenu = false,
|
|
52291
52279
|
embedded = false,
|
|
52292
52280
|
richMarkdown = false,
|
|
52293
52281
|
sendKey,
|
|
@@ -52766,7 +52754,15 @@ function EditorProvider(props) {
|
|
|
52766
52754
|
/* @__PURE__ */ jsx(ReadModeSelectionBar, { editor }),
|
|
52767
52755
|
!readOnly && !hideHeader && /* @__PURE__ */ jsx(NotionEditorHeader, {}),
|
|
52768
52756
|
/* @__PURE__ */ jsxs("div", { className: "notion-like-editor-layout", "data-width-mode": widthModeValue, children: [
|
|
52769
|
-
/* @__PURE__ */ jsx(
|
|
52757
|
+
/* @__PURE__ */ jsx(
|
|
52758
|
+
EditorContentArea,
|
|
52759
|
+
{
|
|
52760
|
+
hideFloatingToolbar,
|
|
52761
|
+
hideSlashMenu,
|
|
52762
|
+
hideDragHandle,
|
|
52763
|
+
hideEmojiMenu
|
|
52764
|
+
}
|
|
52765
|
+
),
|
|
52770
52766
|
!embedded && /* @__PURE__ */ jsx(TocSidebar, { topOffset: 48 })
|
|
52771
52767
|
] }),
|
|
52772
52768
|
isEditable && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
@@ -52797,6 +52793,9 @@ function NotionEditor({
|
|
|
52797
52793
|
readOnly = false,
|
|
52798
52794
|
hideHeader = false,
|
|
52799
52795
|
hideFloatingToolbar = false,
|
|
52796
|
+
hideSlashMenu = false,
|
|
52797
|
+
hideDragHandle = false,
|
|
52798
|
+
hideEmojiMenu = false,
|
|
52800
52799
|
embedded = false,
|
|
52801
52800
|
richMarkdown = false,
|
|
52802
52801
|
sendKey,
|
|
@@ -52829,6 +52828,9 @@ function NotionEditor({
|
|
|
52829
52828
|
permissions,
|
|
52830
52829
|
hideHeader,
|
|
52831
52830
|
hideFloatingToolbar,
|
|
52831
|
+
hideSlashMenu,
|
|
52832
|
+
hideDragHandle,
|
|
52833
|
+
hideEmojiMenu,
|
|
52832
52834
|
embedded,
|
|
52833
52835
|
richMarkdown,
|
|
52834
52836
|
sendKey,
|
|
@@ -52858,6 +52860,9 @@ function NotionEditorContent({
|
|
|
52858
52860
|
permissions,
|
|
52859
52861
|
hideHeader = false,
|
|
52860
52862
|
hideFloatingToolbar = false,
|
|
52863
|
+
hideSlashMenu = false,
|
|
52864
|
+
hideDragHandle = false,
|
|
52865
|
+
hideEmojiMenu = false,
|
|
52861
52866
|
embedded = false,
|
|
52862
52867
|
richMarkdown = false,
|
|
52863
52868
|
sendKey,
|
|
@@ -52895,6 +52900,9 @@ function NotionEditorContent({
|
|
|
52895
52900
|
permissions,
|
|
52896
52901
|
hideHeader,
|
|
52897
52902
|
hideFloatingToolbar,
|
|
52903
|
+
hideSlashMenu,
|
|
52904
|
+
hideDragHandle,
|
|
52905
|
+
hideEmojiMenu,
|
|
52898
52906
|
embedded,
|
|
52899
52907
|
richMarkdown,
|
|
52900
52908
|
sendKey,
|
|
@@ -52943,5 +52951,5 @@ function ArticleViewer({
|
|
|
52943
52951
|
}
|
|
52944
52952
|
|
|
52945
52953
|
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-
|
|
52947
|
-
//# sourceMappingURL=chunk-
|
|
52954
|
+
//# sourceMappingURL=chunk-6BJB4YWS.js.map
|
|
52955
|
+
//# sourceMappingURL=chunk-6BJB4YWS.js.map
|