@lobehub/editor 1.20.2 → 1.20.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.
|
@@ -258,28 +258,36 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
258
258
|
// No markdown detected - plain text is already inserted
|
|
259
259
|
_this2.logger.debug('no markdown patterns detected, keeping as plain text');
|
|
260
260
|
}
|
|
261
|
-
if (clipboardData.types.includes('text/html') && clipboardData.types.includes('text/rtf')) {
|
|
262
|
-
// Code detected - insert as code block
|
|
263
|
-
_this2.logger.debug("code like, inserting as code block");
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
event.stopPropagation();
|
|
266
|
-
editor.update(function () {
|
|
267
|
-
var selection = $getSelection();
|
|
268
|
-
if (!$isRangeSelection(selection)) return;
|
|
269
|
-
|
|
270
|
-
// Create code block node with detected language
|
|
271
|
-
var codeNode = $createCodeNode('plaintext');
|
|
272
|
-
selection.insertNodes([codeNode]);
|
|
273
261
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
262
|
+
// word 一类富文本编辑器会同时包含 text/html 和 text/rtf 类型的内容
|
|
263
|
+
// if (
|
|
264
|
+
// clipboardData.types.includes('text/html') &&
|
|
265
|
+
// clipboardData.types.includes('text/rtf')
|
|
266
|
+
// ) {
|
|
267
|
+
// // Code detected - insert as code block
|
|
268
|
+
// this.logger.debug(`code like, inserting as code block`);
|
|
269
|
+
//
|
|
270
|
+
// event.preventDefault();
|
|
271
|
+
// event.stopPropagation();
|
|
272
|
+
//
|
|
273
|
+
// editor.update(() => {
|
|
274
|
+
// const selection = $getSelection();
|
|
275
|
+
// if (!$isRangeSelection(selection)) return;
|
|
276
|
+
//
|
|
277
|
+
// // Create code block node with detected language
|
|
278
|
+
// const codeNode = $createCodeNode('plaintext');
|
|
279
|
+
// selection.insertNodes([codeNode]);
|
|
280
|
+
//
|
|
281
|
+
// // Insert the code text into the code block
|
|
282
|
+
// codeNode.select();
|
|
283
|
+
// const codeSelection = $getSelection();
|
|
284
|
+
// if ($isRangeSelection(codeSelection)) {
|
|
285
|
+
// codeSelection.insertText(text);
|
|
286
|
+
// }
|
|
287
|
+
// });
|
|
288
|
+
//
|
|
289
|
+
// return true; // Command handled
|
|
290
|
+
// }
|
|
283
291
|
|
|
284
292
|
// Force plain text paste for external content
|
|
285
293
|
event.preventDefault();
|
package/package.json
CHANGED