@lobehub/editor 1.16.2 → 1.16.3
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.
|
@@ -30,15 +30,15 @@ export var useStyles = createStyles(function (_ref2, _ref3) {
|
|
|
30
30
|
lineHeight = _ref3$lineHeight === void 0 ? 1.8 : _ref3$lineHeight;
|
|
31
31
|
var __root = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n --lobe-markdown-font-size: ", "px;\n --lobe-markdown-header-multiple: ", ";\n --lobe-markdown-margin-multiple: ", ";\n --lobe-markdown-line-height: ", ";\n --lobe-markdown-border-radius: ", ";\n --lobe-markdown-border-color: ", ";\n\n position: relative;\n\n display: flex;\n flex-direction: column;\n\n width: 100%;\n max-width: 100%;\n height: 100%;\n\n font-size: var(--lobe-markdown-font-size);\n line-height: var(--lobe-markdown-line-height);\n word-break: break-word;\n\n @keyframes cursor-blink {\n to {\n visibility: hidden;\n }\n }\n\n [data-lexical-cursor='true'] {\n pointer-events: none;\n position: absolute;\n display: block;\n\n &::after {\n content: '';\n\n position: absolute;\n inset-block-start: -2px;\n\n display: block;\n\n width: 20px;\n border-block-start: 1px solid ", ";\n\n animation: cursor-blink 1.1s steps(2, start) infinite;\n }\n }\n "])), fontSize, headerMultiple, marginMultiple, lineHeight, token.borderRadiusLG, token.colorFillQuaternary, token.colorText);
|
|
32
32
|
var header = css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: max(\n calc(var(--lobe-markdown-header-multiple) * var(--lobe-markdown-margin-multiple) * 0.4em),\n var(--lobe-markdown-font-size)\n );\n font-weight: bold;\n line-height: 1.25;\n }\n\n h1 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 1.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h2 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + var(--lobe-markdown-header-multiple))\n );\n }\n\n h3 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.5 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h4 {\n font-size: calc(\n var(--lobe-markdown-font-size) * (1 + 0.25 * var(--lobe-markdown-header-multiple))\n );\n }\n\n h5,\n h6 {\n font-size: calc(var(--lobe-markdown-font-size) * 1);\n }\n "])));
|
|
33
|
-
var p = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n p {\n margin-block:
|
|
33
|
+
var p = css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n p {\n margin-block: 4px;\n line-height: var(--lobe-markdown-line-height);\n letter-spacing: 0.02em;\n\n &:not(:first-child) {\n margin-block-start: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n\n &:not(:last-child) {\n margin-block-end: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n }\n }\n "])));
|
|
34
34
|
var blockquote = css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .editor_quote {\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em);\n margin-inline: 0;\n padding-block: 0;\n padding-inline: 1em;\n border-inline-start: solid 4px ", ";\n\n color: ", ";\n }\n "])), token.colorBorder, token.colorTextSecondary);
|
|
35
35
|
var code = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n .editor_code {\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid var(--lobe-markdown-border-color);\n border-radius: 0.25em;\n\n font-family: ", ";\n font-size: 0.875em;\n line-height: 1;\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n }\n "])), token.fontFamilyCode, token.colorFillSecondary);
|
|
36
36
|
return {
|
|
37
37
|
blockquote: blockquote,
|
|
38
38
|
code: code,
|
|
39
39
|
header: header,
|
|
40
|
-
noHeader: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block:
|
|
41
|
-
noStyle: css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n --lobe-markdown-header-multiple: 0;\n --lobe-markdown-margin-multiple: 0;\n --lobe-markdown-line-height: 1.5;\n\n p {\n margin-block:
|
|
40
|
+
noHeader: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: 0;\n font-size: var(--lobe-markdown-font-size);\n font-weight: normal;\n line-height: var(--lobe-markdown-line-height);\n }\n "]))),
|
|
41
|
+
noStyle: css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n --lobe-markdown-header-multiple: 0;\n --lobe-markdown-margin-multiple: 0;\n --lobe-markdown-line-height: 1.5;\n\n p {\n margin-block: 4px;\n }\n "]))),
|
|
42
42
|
p: p,
|
|
43
43
|
root: __root,
|
|
44
44
|
variant: cx(header, p, blockquote, code)
|
|
@@ -120,12 +120,6 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
120
120
|
}, COMMAND_PRIORITY_CRITICAL));
|
|
121
121
|
this.register(editor.registerCommand(PASTE_COMMAND, function (event) {
|
|
122
122
|
var _this2$config$enableP, _this2$config;
|
|
123
|
-
// Check if markdown paste formatting is enabled (default: true)
|
|
124
|
-
var enablePasteMarkdown = (_this2$config$enableP = (_this2$config = _this2.config) === null || _this2$config === void 0 ? void 0 : _this2$config.enablePasteMarkdown) !== null && _this2$config$enableP !== void 0 ? _this2$config$enableP : true;
|
|
125
|
-
if (!enablePasteMarkdown) {
|
|
126
|
-
_this2.logger.debug('paste markdown formatting is disabled');
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
123
|
if (!(event instanceof ClipboardEvent)) return false;
|
|
130
124
|
var clipboardData = event.clipboardData;
|
|
131
125
|
if (!clipboardData) return false;
|
|
@@ -137,6 +131,23 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
137
131
|
// If there's no text content, let Lexical handle it
|
|
138
132
|
if (!text) return false;
|
|
139
133
|
|
|
134
|
+
// Check if markdown paste formatting is enabled (default: true)
|
|
135
|
+
var enablePasteMarkdown = (_this2$config$enableP = (_this2$config = _this2.config) === null || _this2$config === void 0 ? void 0 : _this2$config.enablePasteMarkdown) !== null && _this2$config$enableP !== void 0 ? _this2$config$enableP : true;
|
|
136
|
+
if (!enablePasteMarkdown) {
|
|
137
|
+
// Force plain text paste - ignore all formatting (like Cmd+Shift+V)
|
|
138
|
+
_this2.logger.debug('paste markdown formatting is disabled, inserting as plain text');
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
event.stopPropagation();
|
|
141
|
+
editor.update(function () {
|
|
142
|
+
var selection = $getSelection();
|
|
143
|
+
if (!$isRangeSelection(selection)) return;
|
|
144
|
+
|
|
145
|
+
// Simply insert the plain text
|
|
146
|
+
selection.insertText(text);
|
|
147
|
+
});
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
140
151
|
// If there's HTML content, it's a rich text paste
|
|
141
152
|
// Let Lexical's rich text handler process it
|
|
142
153
|
if (html && html.trim()) {
|
package/package.json
CHANGED