@lobehub/editor 4.10.0 → 4.10.1

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.
Files changed (2) hide show
  1. package/es/index.js +7 -0
  2. package/package.json +1 -1
package/es/index.js CHANGED
@@ -2247,6 +2247,8 @@ init_helper();
2247
2247
  init_plugin();
2248
2248
  init_debug();
2249
2249
  const AUTO_COMPLETE_GUARD_LIMIT = 5e4;
2250
+ const CLEAR_PLACEHOLDER_BURST_LIMIT = 20;
2251
+ const CLEAR_PLACEHOLDER_BURST_WINDOW_MS = 1e3;
2250
2252
  const AutoCompletePlugin = class extends KernelPlugin {
2251
2253
  static {
2252
2254
  this.pluginName = "AutoCompletePlugin";
@@ -2263,6 +2265,7 @@ const AutoCompletePlugin = class extends KernelPlugin {
2263
2265
  this.currentSuggestion = null;
2264
2266
  this.markdownService = null;
2265
2267
  this.skipNextTextContentListener = false;
2268
+ this.clearPlaceholderCallTimestamps = [];
2266
2269
  this.delay = config?.delay ?? 1e3;
2267
2270
  kernel.registerNodes([PlaceholderNode, PlaceholderBlockNode]);
2268
2271
  if (config?.theme) kernel.registerThemes(config?.theme);
@@ -2500,6 +2503,10 @@ const AutoCompletePlugin = class extends KernelPlugin {
2500
2503
  });
2501
2504
  }
2502
2505
  clearPlaceholderNodes(editor) {
2506
+ const now = Date.now();
2507
+ this.clearPlaceholderCallTimestamps = this.clearPlaceholderCallTimestamps.filter((ts) => now - ts <= CLEAR_PLACEHOLDER_BURST_WINDOW_MS);
2508
+ if (this.clearPlaceholderCallTimestamps.length >= CLEAR_PLACEHOLDER_BURST_LIMIT) return;
2509
+ this.clearPlaceholderCallTimestamps.push(now);
2503
2510
  this.skipNextTextContentListener = true;
2504
2511
  this.currentSuggestion = null;
2505
2512
  this.placeholderNodes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/editor",
3
- "version": "4.10.0",
3
+ "version": "4.10.1",
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",