@lobehub/editor 4.9.8 → 4.9.9
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/es/{ReactSlashPlugin-BZ0TZ1oy.js → ReactSlashPlugin-DEcBg9nL.js} +44 -44
- package/es/headless.js +733 -33
- package/es/index.js +219 -218
- package/es/react.js +1 -1
- package/package.json +1 -1
|
@@ -21078,6 +21078,49 @@ function registerCodeInlineCommand(editor) {
|
|
|
21078
21078
|
}, COMMAND_PRIORITY_EDITOR);
|
|
21079
21079
|
}
|
|
21080
21080
|
//#endregion
|
|
21081
|
+
//#region src/plugins/link/utils/index.ts
|
|
21082
|
+
const SUPPORTED_URL_PROTOCOLS = new Set([
|
|
21083
|
+
"http:",
|
|
21084
|
+
"https:",
|
|
21085
|
+
"mailto:",
|
|
21086
|
+
"sms:",
|
|
21087
|
+
"tel:"
|
|
21088
|
+
]);
|
|
21089
|
+
function sanitizeUrl(url) {
|
|
21090
|
+
try {
|
|
21091
|
+
const parsedUrl = new URL(url);
|
|
21092
|
+
if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) return "about:blank";
|
|
21093
|
+
} catch {
|
|
21094
|
+
return url;
|
|
21095
|
+
}
|
|
21096
|
+
return url;
|
|
21097
|
+
}
|
|
21098
|
+
const urlRegExp = /* @__PURE__ */ new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\w$&+,:;=-]+@)?[\d.A-Za-z-]+|(?:www.|[\w$&+,:;=-]+@)[\d.A-Za-z-]+)((?:\/[%+./~\w-_]*)?\??[\w%&+.;=@-]*#?\w*)?)/);
|
|
21099
|
+
function validateUrl(url) {
|
|
21100
|
+
return url === "https://" || urlRegExp.test(url);
|
|
21101
|
+
}
|
|
21102
|
+
function extractUrlFromText(text) {
|
|
21103
|
+
const match = urlRegExp.exec(text);
|
|
21104
|
+
if (!match) return null;
|
|
21105
|
+
const raw = match[0];
|
|
21106
|
+
const start = match.index ?? text.indexOf(raw);
|
|
21107
|
+
const trimmed = raw.replace(/[)\],.;:]+$/u, "");
|
|
21108
|
+
return {
|
|
21109
|
+
index: start,
|
|
21110
|
+
length: trimmed.length,
|
|
21111
|
+
url: trimmed
|
|
21112
|
+
};
|
|
21113
|
+
}
|
|
21114
|
+
function getSelectedNode(selection) {
|
|
21115
|
+
const anchor = selection.anchor;
|
|
21116
|
+
const focus = selection.focus;
|
|
21117
|
+
const anchorNode = selection.anchor.getNode();
|
|
21118
|
+
const focusNode = selection.focus.getNode();
|
|
21119
|
+
if (anchorNode === focusNode) return anchorNode;
|
|
21120
|
+
if (selection.isBackward()) return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
21121
|
+
else return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
|
|
21122
|
+
}
|
|
21123
|
+
//#endregion
|
|
21081
21124
|
//#region src/plugins/list/plugin/checkList.ts
|
|
21082
21125
|
/**
|
|
21083
21126
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -22091,49 +22134,6 @@ function useLexicalNodeSelection(key) {
|
|
|
22091
22134
|
];
|
|
22092
22135
|
}
|
|
22093
22136
|
//#endregion
|
|
22094
|
-
//#region src/plugins/link/utils/index.ts
|
|
22095
|
-
const SUPPORTED_URL_PROTOCOLS = new Set([
|
|
22096
|
-
"http:",
|
|
22097
|
-
"https:",
|
|
22098
|
-
"mailto:",
|
|
22099
|
-
"sms:",
|
|
22100
|
-
"tel:"
|
|
22101
|
-
]);
|
|
22102
|
-
function sanitizeUrl(url) {
|
|
22103
|
-
try {
|
|
22104
|
-
const parsedUrl = new URL(url);
|
|
22105
|
-
if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) return "about:blank";
|
|
22106
|
-
} catch {
|
|
22107
|
-
return url;
|
|
22108
|
-
}
|
|
22109
|
-
return url;
|
|
22110
|
-
}
|
|
22111
|
-
const urlRegExp = /* @__PURE__ */ new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\w$&+,:;=-]+@)?[\d.A-Za-z-]+|(?:www.|[\w$&+,:;=-]+@)[\d.A-Za-z-]+)((?:\/[%+./~\w-_]*)?\??[\w%&+.;=@-]*#?\w*)?)/);
|
|
22112
|
-
function validateUrl(url) {
|
|
22113
|
-
return url === "https://" || urlRegExp.test(url);
|
|
22114
|
-
}
|
|
22115
|
-
function extractUrlFromText(text) {
|
|
22116
|
-
const match = urlRegExp.exec(text);
|
|
22117
|
-
if (!match) return null;
|
|
22118
|
-
const raw = match[0];
|
|
22119
|
-
const start = match.index ?? text.indexOf(raw);
|
|
22120
|
-
const trimmed = raw.replace(/[)\],.;:]+$/u, "");
|
|
22121
|
-
return {
|
|
22122
|
-
index: start,
|
|
22123
|
-
length: trimmed.length,
|
|
22124
|
-
url: trimmed
|
|
22125
|
-
};
|
|
22126
|
-
}
|
|
22127
|
-
function getSelectedNode(selection) {
|
|
22128
|
-
const anchor = selection.anchor;
|
|
22129
|
-
const focus = selection.focus;
|
|
22130
|
-
const anchorNode = selection.anchor.getNode();
|
|
22131
|
-
const focusNode = selection.focus.getNode();
|
|
22132
|
-
if (anchorNode === focusNode) return anchorNode;
|
|
22133
|
-
if (selection.isBackward()) return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
22134
|
-
else return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
|
|
22135
|
-
}
|
|
22136
|
-
//#endregion
|
|
22137
22137
|
//#region src/plugins/link-highlight/command/index.ts
|
|
22138
22138
|
const INSERT_LINK_HIGHLIGHT_COMMAND = createCommand("INSERT_LINK_HIGHLIGHT_COMMAND");
|
|
22139
22139
|
function registerLinkHighlightCommand(editor) {
|
|
@@ -22947,4 +22947,4 @@ const ReactSlashPlugin = ({ children, anchorClassName, getPopupContainer, placem
|
|
|
22947
22947
|
};
|
|
22948
22948
|
ReactSlashPlugin.displayName = "ReactSlashPlugin";
|
|
22949
22949
|
//#endregion
|
|
22950
|
-
export { detectLanguage as A, INodePlugin as B, ReactPlainText as C, useTranslation as D, ReactMarkdownPlugin as E, GET_MARKDOWN_SELECTION_COMMAND as F, idToChar as G, $cloneNode as H, INSERT_MARKDOWN_COMMAND as I, useLexicalEditor as J, INSERT_HEADING_COMMAND as K, isPunctuationChar as L, MARKDOWN_READER_LEVEL_HIGH as M, MARKDOWN_READER_LEVEL_NORMAL as N, MarkdownPlugin as O, MARKDOWN_WRITER_LEVEL_MAX as P, ILitexmlService as R, registerCodeInlineCommand as S, CommonPlugin as T, $parseSerializedNodeImpl as U, INodeService as V, charToId as W, useLexicalComposerContext as X, ReactEditor as Y, LexicalErrorBoundary as Z,
|
|
22950
|
+
export { detectLanguage as A, INodePlugin as B, ReactPlainText as C, useTranslation as D, ReactMarkdownPlugin as E, GET_MARKDOWN_SELECTION_COMMAND as F, idToChar as G, $cloneNode as H, INSERT_MARKDOWN_COMMAND as I, useLexicalEditor as J, INSERT_HEADING_COMMAND as K, isPunctuationChar as L, MARKDOWN_READER_LEVEL_HIGH as M, MARKDOWN_READER_LEVEL_NORMAL as N, MarkdownPlugin as O, MARKDOWN_WRITER_LEVEL_MAX as P, ILitexmlService as R, registerCodeInlineCommand as S, CommonPlugin as T, $parseSerializedNodeImpl as U, INodeService as V, charToId as W, useLexicalComposerContext as X, ReactEditor as Y, LexicalErrorBoundary as Z, extractUrlFromText as _, ReactMentionPlugin as a, validateUrl as b, INSERT_LINK_HIGHLIGHT_COMMAND as c, bundledLanguagesInfo$1 as d, CodeblockPlugin as f, registerCheckList as g, INSERT_CHECK_LIST_COMMAND as h, SlashPlugin as i, IMarkdownShortCutService as j, detectCodeLanguage as k, registerLinkHighlightCommand as l, getCodeLanguageByInput as m, ReactSlashOption as n, MentionPlugin as o, UPDATE_CODEBLOCK_LANG as p, INSERT_QUOTE_COMMAND as q, SlashMenu as r, INSERT_MENTION_COMMAND as s, ReactSlashPlugin as t, useLexicalNodeSelection as u, getSelectedNode as v, ReactEditorContent as w, INSERT_CODEINLINE_COMMAND as x, sanitizeUrl as y, LitexmlService as z };
|