@lobehub/editor 1.18.0 → 1.18.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.
|
@@ -126,8 +126,8 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
126
126
|
if (!clipboardData) return false;
|
|
127
127
|
|
|
128
128
|
// Get clipboard content
|
|
129
|
-
var text = clipboardData.getData('text/plain');
|
|
130
|
-
var html = clipboardData.getData('text/html');
|
|
129
|
+
var text = clipboardData.getData('text/plain').trimEnd();
|
|
130
|
+
var html = clipboardData.getData('text/html').trimEnd();
|
|
131
131
|
|
|
132
132
|
// If there's no text content, let Lexical handle it
|
|
133
133
|
if (!text) return false;
|
|
@@ -7,11 +7,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
16
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
17
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
18
|
import { createElement, memo, useMemo } from 'react';
|
|
13
19
|
import { ReactEditor } from "../../editor-kernel/react/react-editor";
|
|
14
20
|
import { ReactEditorContent, ReactPlainText } from "../../plugins/common";
|
|
21
|
+
import { ReactMarkdownPlugin } from "../../plugins/markdown";
|
|
15
22
|
import { ReactMentionPlugin } from "../../plugins/mention";
|
|
16
23
|
import { ReactSlashOption, ReactSlashPlugin } from "../../plugins/slash";
|
|
17
24
|
import { useEditorContent } from "../EditorProvider";
|
|
@@ -54,7 +61,7 @@ var Editor = /*#__PURE__*/memo(function (_ref) {
|
|
|
54
61
|
var markdownWriter = mentionOption.markdownWriter,
|
|
55
62
|
restMentionOption = _objectWithoutProperties(mentionOption, _excluded);
|
|
56
63
|
var memoPlugins = useMemo(function () {
|
|
57
|
-
return plugins.map(function (plugin, index) {
|
|
64
|
+
return [enablePasteMarkdown && ReactMarkdownPlugin].concat(_toConsumableArray(plugins)).filter(Boolean).map(function (plugin, index) {
|
|
58
65
|
var withNoProps = typeof plugin === 'function';
|
|
59
66
|
if (withNoProps) return /*#__PURE__*/createElement(plugin, {
|
|
60
67
|
key: index
|
|
@@ -63,7 +70,7 @@ var Editor = /*#__PURE__*/memo(function (_ref) {
|
|
|
63
70
|
key: index
|
|
64
71
|
}, plugin[1]));
|
|
65
72
|
});
|
|
66
|
-
}, [plugins]);
|
|
73
|
+
}, [plugins, enablePasteMarkdown, ReactMarkdownPlugin]);
|
|
67
74
|
var memoMention = useMemo(function () {
|
|
68
75
|
if (!enableMention) return;
|
|
69
76
|
return /*#__PURE__*/_jsx(ReactMentionPlugin, {
|
package/package.json
CHANGED