@4399ywkf/editor 0.11.0 → 0.12.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-KUVYBQ66.js → DocView-5LI4KWEZ.js} +3 -3
- package/dist/{DocView-KUVYBQ66.js.map → DocView-5LI4KWEZ.js.map} +1 -1
- package/dist/{chunk-6MZAYCF6.js → chunk-SV3LH2TC.js} +229 -16
- package/dist/chunk-SV3LH2TC.js.map +1 -0
- package/dist/doc-standalone.js +225 -13
- package/dist/doc-standalone.js.map +1 -1
- package/dist/doc.d.ts +28 -6
- package/dist/doc.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-6MZAYCF6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorConfigProvider, NotionEditor } from './chunk-
|
|
1
|
+
import { EditorConfigProvider, NotionEditor } from './chunk-SV3LH2TC.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-5LI4KWEZ.js.map
|
|
22
|
+
//# sourceMappingURL=DocView-5LI4KWEZ.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-5LI4KWEZ.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"]}
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { createContext, memo, forwardRef, useState, useCallback, useRef, useEffect, useMemo, lazy, useLayoutEffect, Suspense, useContext, useReducer, Children, isValidElement, cloneElement } from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
7
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';
|
|
8
|
+
import { Extension, Node as Node$2, mergeAttributes as mergeAttributes$1, textblockTypeInputRule, InputRule, PasteRule, getChangedRanges, combineTransactionSteps, getTextSerializersFromSchema, getTextBetween, generateJSON, generateHTML } from '@tiptap/core';
|
|
9
9
|
import { isChangeOrigin, Collaboration } from '@tiptap/extension-collaboration';
|
|
10
10
|
import { Fragment, Slice, Mark, DOMSerializer } from '@tiptap/pm/model';
|
|
11
11
|
import { PluginKey, Plugin, TextSelection, Selection, NodeSelection, SelectionRange } from '@tiptap/pm/state';
|
|
@@ -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 = {
|
|
@@ -26599,6 +26600,16 @@ function containerPasteText(data, slice, schema) {
|
|
|
26599
26600
|
if (/\sdata-pm-slice=/.test(html)) return sliceLines(slice, schema);
|
|
26600
26601
|
return text || null;
|
|
26601
26602
|
}
|
|
26603
|
+
function resolveMarkConflicts(nodes, schema) {
|
|
26604
|
+
return nodes.map((node) => {
|
|
26605
|
+
const out = { ...node };
|
|
26606
|
+
if (node.marks?.length) {
|
|
26607
|
+
out.marks = node.marks.reduce((set, json) => schema.markFromJSON(json).addToSet(set), Mark.none).map((mark) => mark.toJSON());
|
|
26608
|
+
}
|
|
26609
|
+
if (node.content) out.content = resolveMarkConflicts(node.content, schema);
|
|
26610
|
+
return out;
|
|
26611
|
+
});
|
|
26612
|
+
}
|
|
26602
26613
|
function isComposing(view, event) {
|
|
26603
26614
|
if (event?.isComposing) return true;
|
|
26604
26615
|
return Boolean(view.composing);
|
|
@@ -26635,20 +26646,26 @@ function createCodeGroupInputPlugin(editor) {
|
|
|
26635
26646
|
if (!text || !containsCompleteContainer(text)) return false;
|
|
26636
26647
|
const manager = editor.markdown;
|
|
26637
26648
|
if (!manager) return false;
|
|
26638
|
-
let
|
|
26649
|
+
let content;
|
|
26639
26650
|
try {
|
|
26640
|
-
json = manager.parse(text.replace(/\r\n?/g, "\n"));
|
|
26651
|
+
const json = manager.parse(text.replace(/\r\n?/g, "\n"));
|
|
26652
|
+
if (!json.content?.length) return false;
|
|
26653
|
+
content = resolveMarkConflicts(json.content, state.schema);
|
|
26641
26654
|
} catch {
|
|
26642
26655
|
return false;
|
|
26643
26656
|
}
|
|
26644
|
-
if (!json.content?.length) return false;
|
|
26645
26657
|
stopYjsCapturing(view.state);
|
|
26646
26658
|
view.dispatch(closeHistory(view.state.tr));
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26659
|
+
let inserted = false;
|
|
26660
|
+
try {
|
|
26661
|
+
inserted = editor.commands.insertContentAt(
|
|
26662
|
+
{ from: state.selection.from, to: state.selection.to },
|
|
26663
|
+
content,
|
|
26664
|
+
{ updateSelection: true }
|
|
26665
|
+
);
|
|
26666
|
+
} catch (error) {
|
|
26667
|
+
console.warn("Markdown 粘贴转换失败,按普通粘贴处理", error);
|
|
26668
|
+
}
|
|
26652
26669
|
stopYjsCapturing(view.state);
|
|
26653
26670
|
view.dispatch(closeHistory(view.state.tr));
|
|
26654
26671
|
return inserted;
|
|
@@ -33709,6 +33726,12 @@ function normalizeEditorContent(content, contentFormat, extensions, options = {}
|
|
|
33709
33726
|
}
|
|
33710
33727
|
return result.json;
|
|
33711
33728
|
}
|
|
33729
|
+
function resolveEditorContentUpdate(content, contentFormat, extensions, options = {}) {
|
|
33730
|
+
if (content === void 0) return { kind: "ignore" };
|
|
33731
|
+
if (content === null || content === "") return { kind: "clear" };
|
|
33732
|
+
const json = normalizeEditorContent(content, contentFormat, extensions, options);
|
|
33733
|
+
return json ? { kind: "set", json } : { kind: "ignore" };
|
|
33734
|
+
}
|
|
33712
33735
|
function defaultOnError(message) {
|
|
33713
33736
|
console.error(`[editor] 内容未载入:${message}`);
|
|
33714
33737
|
}
|
|
@@ -50750,15 +50773,141 @@ function createRichMarkdownExtensions() {
|
|
|
50750
50773
|
});
|
|
50751
50774
|
return { MarkdownParagraph, MarkdownHeading };
|
|
50752
50775
|
}
|
|
50776
|
+
|
|
50777
|
+
// src/lib/im-input.ts
|
|
50778
|
+
function createMessageInputKeyHandler({
|
|
50779
|
+
getEditor,
|
|
50780
|
+
getSendKey,
|
|
50781
|
+
onSend
|
|
50782
|
+
}) {
|
|
50783
|
+
return (view, event) => {
|
|
50784
|
+
if (!onSend || event.defaultPrevented || event.isComposing || event.keyCode === 229 || view.composing) {
|
|
50785
|
+
return false;
|
|
50786
|
+
}
|
|
50787
|
+
const editor = getEditor();
|
|
50788
|
+
if (!editor || editor.isDestroyed || !editor.isEditable) return false;
|
|
50789
|
+
if (event.key !== "Enter" || event.shiftKey || event.altKey) return false;
|
|
50790
|
+
const modifier = event.metaKey || event.ctrlKey;
|
|
50791
|
+
const sendKey = getSendKey();
|
|
50792
|
+
const shouldSend = sendKey === "enter" ? !modifier : sendKey === "mod-enter" ? modifier : false;
|
|
50793
|
+
if (!shouldSend) return false;
|
|
50794
|
+
event.preventDefault();
|
|
50795
|
+
onSend(editor);
|
|
50796
|
+
return true;
|
|
50797
|
+
};
|
|
50798
|
+
}
|
|
50753
50799
|
var isMac3 = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
50754
50800
|
var FeishuStrike = Strike.extend({
|
|
50755
50801
|
addKeyboardShortcuts() {
|
|
50756
50802
|
return { "Mod-Shift-x": () => this.editor.commands.toggleStrike() };
|
|
50757
50803
|
}
|
|
50758
50804
|
});
|
|
50805
|
+
function partialLinkRuns(block, start, code, link) {
|
|
50806
|
+
const out = [];
|
|
50807
|
+
let from = -1;
|
|
50808
|
+
let to = -1;
|
|
50809
|
+
let links = [];
|
|
50810
|
+
const flush = () => {
|
|
50811
|
+
const first = links[0];
|
|
50812
|
+
if (from >= 0 && links.some(Boolean) && !links.every((m) => m && first && m.eq(first))) {
|
|
50813
|
+
out.push([from, to]);
|
|
50814
|
+
}
|
|
50815
|
+
from = -1;
|
|
50816
|
+
links = [];
|
|
50817
|
+
};
|
|
50818
|
+
block.forEach((child, offset6) => {
|
|
50819
|
+
if (!child.isText || !code.isInSet(child.marks)) {
|
|
50820
|
+
flush();
|
|
50821
|
+
return;
|
|
50822
|
+
}
|
|
50823
|
+
if (from < 0) from = start + offset6;
|
|
50824
|
+
to = start + offset6 + child.nodeSize;
|
|
50825
|
+
links.push(link.isInSet(child.marks));
|
|
50826
|
+
});
|
|
50827
|
+
flush();
|
|
50828
|
+
return out;
|
|
50829
|
+
}
|
|
50830
|
+
function inlineCodeLinkPlugin() {
|
|
50831
|
+
return new Plugin({
|
|
50832
|
+
key: new PluginKey("inlineCodeLink"),
|
|
50833
|
+
appendTransaction(transactions, oldState, newState) {
|
|
50834
|
+
const { code, link } = newState.schema.marks;
|
|
50835
|
+
if (!code || !link || !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
50836
|
+
const changed = getChangedRanges(combineTransactionSteps(oldState.doc, [...transactions]));
|
|
50837
|
+
const seen = /* @__PURE__ */ new Set();
|
|
50838
|
+
const ranges = [];
|
|
50839
|
+
for (const { newRange } of changed) {
|
|
50840
|
+
newState.doc.nodesBetween(newRange.from, newRange.to, (node, pos) => {
|
|
50841
|
+
if (!node.isTextblock) return true;
|
|
50842
|
+
if (!seen.has(pos)) {
|
|
50843
|
+
seen.add(pos);
|
|
50844
|
+
ranges.push(...partialLinkRuns(node, pos + 1, code, link));
|
|
50845
|
+
}
|
|
50846
|
+
return false;
|
|
50847
|
+
});
|
|
50848
|
+
}
|
|
50849
|
+
if (!ranges.length) return null;
|
|
50850
|
+
const tr = newState.tr;
|
|
50851
|
+
for (const [from, to] of ranges) tr.removeMark(from, to, link);
|
|
50852
|
+
return tr;
|
|
50853
|
+
}
|
|
50854
|
+
});
|
|
50855
|
+
}
|
|
50759
50856
|
var FeishuCode = Code.extend({
|
|
50857
|
+
excludes: "bold italic underline strike textStyle highlight superscript subscript code",
|
|
50760
50858
|
addKeyboardShortcuts() {
|
|
50761
50859
|
return { [isMac3() ? "Mod-Ctrl-c" : "Ctrl-Shift-c"]: () => this.editor.commands.toggleCode() };
|
|
50860
|
+
},
|
|
50861
|
+
addProseMirrorPlugins() {
|
|
50862
|
+
return [...this.parent?.() ?? [], inlineCodeLinkPlugin()];
|
|
50863
|
+
}
|
|
50864
|
+
});
|
|
50865
|
+
function selectionIsAllCode(state) {
|
|
50866
|
+
const { code } = state.schema.marks;
|
|
50867
|
+
const { from, to, empty } = state.selection;
|
|
50868
|
+
if (!code || empty) return false;
|
|
50869
|
+
let hasText = false;
|
|
50870
|
+
let allCode = true;
|
|
50871
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
50872
|
+
if (!node.isText) return true;
|
|
50873
|
+
hasText = true;
|
|
50874
|
+
if (!code.isInSet(node.marks)) allCode = false;
|
|
50875
|
+
return false;
|
|
50876
|
+
});
|
|
50877
|
+
return hasText && allCode;
|
|
50878
|
+
}
|
|
50879
|
+
var FeishuLink = Link.extend({
|
|
50880
|
+
addPasteRules() {
|
|
50881
|
+
return (this.parent?.() ?? []).map(
|
|
50882
|
+
(rule) => new PasteRule({
|
|
50883
|
+
find: rule.find,
|
|
50884
|
+
handler: (props) => {
|
|
50885
|
+
const { code } = props.state.schema.marks;
|
|
50886
|
+
if (code && props.state.doc.rangeHasMark(props.range.from, props.range.to, code)) {
|
|
50887
|
+
return null;
|
|
50888
|
+
}
|
|
50889
|
+
return rule.handler(props);
|
|
50890
|
+
}
|
|
50891
|
+
})
|
|
50892
|
+
);
|
|
50893
|
+
},
|
|
50894
|
+
// Link 的插件里只有「选中文字后粘贴网址 → 给选区加链接」这一个有 handlePaste。选中的全是行内代码时
|
|
50895
|
+
// 跳过它,按普通粘贴替换文字(放开链接之前就是这样),不给代码挂一个看不出来的链接
|
|
50896
|
+
addProseMirrorPlugins() {
|
|
50897
|
+
return (this.parent?.() ?? []).map((plugin) => {
|
|
50898
|
+
const handlePaste = plugin.props.handlePaste;
|
|
50899
|
+
if (!handlePaste) return plugin;
|
|
50900
|
+
return new Plugin({
|
|
50901
|
+
...plugin.spec,
|
|
50902
|
+
props: {
|
|
50903
|
+
...plugin.spec.props,
|
|
50904
|
+
handlePaste(view, event, slice) {
|
|
50905
|
+
if (selectionIsAllCode(view.state)) return false;
|
|
50906
|
+
return handlePaste.call(this, view, event, slice);
|
|
50907
|
+
}
|
|
50908
|
+
}
|
|
50909
|
+
});
|
|
50910
|
+
});
|
|
50762
50911
|
}
|
|
50763
50912
|
});
|
|
50764
50913
|
var FeishuBlockquote = Blockquote.extend({
|
|
@@ -51225,6 +51374,11 @@ function EditorProvider(props) {
|
|
|
51225
51374
|
hideFloatingToolbar = false,
|
|
51226
51375
|
embedded = false,
|
|
51227
51376
|
richMarkdown = false,
|
|
51377
|
+
sendKey,
|
|
51378
|
+
onSend,
|
|
51379
|
+
onUpdate,
|
|
51380
|
+
onSelectionUpdate,
|
|
51381
|
+
onEditorDestroy,
|
|
51228
51382
|
onEditorReady,
|
|
51229
51383
|
extensions: extraExtensions,
|
|
51230
51384
|
pageHeader = false,
|
|
@@ -51251,6 +51405,16 @@ function EditorProvider(props) {
|
|
|
51251
51405
|
return found;
|
|
51252
51406
|
}, []);
|
|
51253
51407
|
const editorConfig = useEditorConfig();
|
|
51408
|
+
const onSendRef = useRef(onSend);
|
|
51409
|
+
onSendRef.current = onSend;
|
|
51410
|
+
const sendKeyRef = useRef(sendKey);
|
|
51411
|
+
sendKeyRef.current = sendKey;
|
|
51412
|
+
const onUpdateRef = useRef(onUpdate);
|
|
51413
|
+
onUpdateRef.current = onUpdate;
|
|
51414
|
+
const onSelectionUpdateRef = useRef(onSelectionUpdate);
|
|
51415
|
+
onSelectionUpdateRef.current = onSelectionUpdate;
|
|
51416
|
+
const onEditorDestroyRef = useRef(onEditorDestroy);
|
|
51417
|
+
onEditorDestroyRef.current = onEditorDestroy;
|
|
51254
51418
|
const [mathBus] = useState(createMathEditBus);
|
|
51255
51419
|
const onUpload = editorConfig?.upload?.onUpload ?? handleImageUpload;
|
|
51256
51420
|
const onUploadError = editorConfig?.upload?.onError ?? // 宿主没给 onError 时按飞书弹提示(「上传图片大小不能超过 20 MB」「图片格式仅支持 …」等)
|
|
@@ -51280,7 +51444,8 @@ function EditorProvider(props) {
|
|
|
51280
51444
|
dropcursor: {
|
|
51281
51445
|
width: 2
|
|
51282
51446
|
},
|
|
51283
|
-
|
|
51447
|
+
// 换成粘贴规则跳过行内代码的版本(feishu-keymap 的 FeishuLink)
|
|
51448
|
+
link: false
|
|
51284
51449
|
}),
|
|
51285
51450
|
...richMarkdownExtensions ? [richMarkdownExtensions.MarkdownParagraph] : [],
|
|
51286
51451
|
// 代码块 / 分组 / 高亮 / Markdown / 直接输入:顺序固定,且在协同与 UniqueID 之前
|
|
@@ -51299,6 +51464,7 @@ function EditorProvider(props) {
|
|
|
51299
51464
|
richMarkdownExtensions ? richMarkdownExtensions.MarkdownHeading : Heading,
|
|
51300
51465
|
FeishuStrike,
|
|
51301
51466
|
FeishuCode,
|
|
51467
|
+
FeishuLink.configure({ openOnClick: false }),
|
|
51302
51468
|
FeishuBlockquote,
|
|
51303
51469
|
// ⌘⌥S 分割线、⌘⌥H 套用上次颜色、Alt+C 切换待办(规格 §33)
|
|
51304
51470
|
FeishuKeymap,
|
|
@@ -51515,6 +51681,14 @@ function EditorProvider(props) {
|
|
|
51515
51681
|
const [initialContent] = useState(
|
|
51516
51682
|
() => provider ? void 0 : normalizeEditorContent(content, contentFormat, extensions) ?? void 0
|
|
51517
51683
|
);
|
|
51684
|
+
const messageInputKeyHandler = useMemo(
|
|
51685
|
+
() => createMessageInputKeyHandler({
|
|
51686
|
+
getEditor: () => editorRef.current,
|
|
51687
|
+
getSendKey: () => sendKeyRef.current,
|
|
51688
|
+
onSend: (current) => onSendRef.current?.(current)
|
|
51689
|
+
}),
|
|
51690
|
+
[]
|
|
51691
|
+
);
|
|
51518
51692
|
const editor = useEditor({
|
|
51519
51693
|
immediatelyRender: false,
|
|
51520
51694
|
// 只读模式:禁用编辑。扩展集保持不变,自定义节点仍走各自 NodeView 渲染
|
|
@@ -51524,10 +51698,18 @@ function EditorProvider(props) {
|
|
|
51524
51698
|
editorProps: {
|
|
51525
51699
|
attributes: {
|
|
51526
51700
|
class: "notion-like-editor"
|
|
51527
|
-
}
|
|
51701
|
+
},
|
|
51702
|
+
handleKeyDown: messageInputKeyHandler
|
|
51703
|
+
},
|
|
51704
|
+
onUpdate: ({ editor: current }) => onUpdateRef.current?.(current),
|
|
51705
|
+
onSelectionUpdate: ({ editor: current }) => onSelectionUpdateRef.current?.(current),
|
|
51706
|
+
onDestroy: () => {
|
|
51707
|
+
const current = editorRef.current;
|
|
51708
|
+
if (current) onEditorDestroyRef.current?.(current);
|
|
51528
51709
|
},
|
|
51529
51710
|
extensions
|
|
51530
51711
|
});
|
|
51712
|
+
editorRef.current = editor;
|
|
51531
51713
|
useEffect(() => {
|
|
51532
51714
|
if (!editor) return;
|
|
51533
51715
|
editorRef.current = editor;
|
|
@@ -51561,9 +51743,20 @@ function EditorProvider(props) {
|
|
|
51561
51743
|
useEffect(() => {
|
|
51562
51744
|
if (provider) return;
|
|
51563
51745
|
if (!editor) return;
|
|
51564
|
-
|
|
51565
|
-
|
|
51566
|
-
if (
|
|
51746
|
+
const update = resolveEditorContentUpdate(content, contentFormat, editor.extensionManager.extensions);
|
|
51747
|
+
if (update.kind === "ignore") return;
|
|
51748
|
+
if (update.kind === "clear") {
|
|
51749
|
+
if (editor.isEmpty) return;
|
|
51750
|
+
let cancelled2 = false;
|
|
51751
|
+
queueMicrotask(() => {
|
|
51752
|
+
if (cancelled2 || editor.isDestroyed) return;
|
|
51753
|
+
editor.commands.clearContent(false);
|
|
51754
|
+
});
|
|
51755
|
+
return () => {
|
|
51756
|
+
cancelled2 = true;
|
|
51757
|
+
};
|
|
51758
|
+
}
|
|
51759
|
+
const next = update.json;
|
|
51567
51760
|
if (isSameDocument(editor.getJSON(), next)) return;
|
|
51568
51761
|
let cancelled = false;
|
|
51569
51762
|
queueMicrotask(() => {
|
|
@@ -51679,6 +51872,11 @@ function NotionEditor({
|
|
|
51679
51872
|
hideFloatingToolbar = false,
|
|
51680
51873
|
embedded = false,
|
|
51681
51874
|
richMarkdown = false,
|
|
51875
|
+
sendKey,
|
|
51876
|
+
onSend,
|
|
51877
|
+
onUpdate,
|
|
51878
|
+
onSelectionUpdate,
|
|
51879
|
+
onEditorDestroy,
|
|
51682
51880
|
onEditorReady,
|
|
51683
51881
|
extensions,
|
|
51684
51882
|
pageHeader,
|
|
@@ -51706,6 +51904,11 @@ function NotionEditor({
|
|
|
51706
51904
|
hideFloatingToolbar,
|
|
51707
51905
|
embedded,
|
|
51708
51906
|
richMarkdown,
|
|
51907
|
+
sendKey,
|
|
51908
|
+
onSend,
|
|
51909
|
+
onUpdate,
|
|
51910
|
+
onSelectionUpdate,
|
|
51911
|
+
onEditorDestroy,
|
|
51709
51912
|
onEditorReady,
|
|
51710
51913
|
extensions,
|
|
51711
51914
|
pageHeader,
|
|
@@ -51730,6 +51933,11 @@ function NotionEditorContent({
|
|
|
51730
51933
|
hideFloatingToolbar = false,
|
|
51731
51934
|
embedded = false,
|
|
51732
51935
|
richMarkdown = false,
|
|
51936
|
+
sendKey,
|
|
51937
|
+
onSend,
|
|
51938
|
+
onUpdate,
|
|
51939
|
+
onSelectionUpdate,
|
|
51940
|
+
onEditorDestroy,
|
|
51733
51941
|
onEditorReady,
|
|
51734
51942
|
extensions,
|
|
51735
51943
|
pageHeader,
|
|
@@ -51762,6 +51970,11 @@ function NotionEditorContent({
|
|
|
51762
51970
|
hideFloatingToolbar,
|
|
51763
51971
|
embedded,
|
|
51764
51972
|
richMarkdown,
|
|
51973
|
+
sendKey,
|
|
51974
|
+
onSend,
|
|
51975
|
+
onUpdate,
|
|
51976
|
+
onSelectionUpdate,
|
|
51977
|
+
onEditorDestroy,
|
|
51765
51978
|
onEditorReady,
|
|
51766
51979
|
extensions,
|
|
51767
51980
|
pageHeader,
|
|
@@ -51803,5 +52016,5 @@ function ArticleViewer({
|
|
|
51803
52016
|
}
|
|
51804
52017
|
|
|
51805
52018
|
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-
|
|
51807
|
-
//# sourceMappingURL=chunk-
|
|
52019
|
+
//# sourceMappingURL=chunk-SV3LH2TC.js.map
|
|
52020
|
+
//# sourceMappingURL=chunk-SV3LH2TC.js.map
|