@lobehub/editor 1.13.0 → 1.14.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.
@@ -13,7 +13,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
13
13
  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; }
14
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
15
  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); }
16
- import { $setSelection } from 'lexical';
16
+ import { $setSelection, TextNode } from 'lexical';
17
17
  import { INodeHelper } from "../../../editor-kernel/inode/helper";
18
18
  import { KernelPlugin } from "../../../editor-kernel/plugin";
19
19
  import { $createCursorNode, cursorNodeSerialized } from "../../common";
@@ -44,6 +44,11 @@ export var CodePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
44
44
  this.register(registerCodeInline(editor, this.kernel, {
45
45
  enableHotkey: (_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.enableHotkey
46
46
  }));
47
+ this.register(editor.registerNodeTransform(TextNode, function (node) {
48
+ if (node.hasFormat('code')) {
49
+ node.replace($createCodeNode(node.getTextContent())).insertAfter($createCursorNode());
50
+ }
51
+ }));
47
52
  var markdownService = this.kernel.requireService(IMarkdownShortCutService);
48
53
  if (!markdownService) {
49
54
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/editor",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
5
5
  "keywords": [
6
6
  "lobehub",