@lvce-editor/editor-worker 10.1.0 → 10.2.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.
@@ -5368,6 +5368,25 @@ const goToTypeDefinition = async (editor, explicit = true) => {
5368
5368
  });
5369
5369
  };
5370
5370
 
5371
+ const isPersistentWidget = widgetId => {
5372
+ switch (widgetId) {
5373
+ case Find:
5374
+ return true;
5375
+ default:
5376
+ return false;
5377
+ }
5378
+ };
5379
+
5380
+ // TODO widgets should have a persistence property:
5381
+ // 1 = close by click (e.g. completion, hover, source-actions)
5382
+ // 2 = stay open on click (e.g. find)
5383
+ const closeWidgetsMaybe = widgets => {
5384
+ if (widgets.length === 0) {
5385
+ return widgets;
5386
+ }
5387
+ return widgets.filter(isPersistentWidget);
5388
+ };
5389
+
5371
5390
  const state$3 = {
5372
5391
  position: {
5373
5392
  rowIndex: 0,
@@ -5430,11 +5449,14 @@ const Ctrl = 1;
5430
5449
  const Alt = 2;
5431
5450
 
5432
5451
  const handleSingleClickDefault = (editor, position) => {
5452
+ // TODO avoid global variables, add them to editor state
5433
5453
  setPosition$1(position);
5454
+ const widgets = closeWidgetsMaybe(editor.widgets);
5434
5455
  return {
5435
5456
  ...editor,
5436
5457
  selections: new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]),
5437
- focused: true
5458
+ focused: true,
5459
+ widgets
5438
5460
  };
5439
5461
  };
5440
5462
  const getClickHandler = modifier => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Lvce Editor",
6
6
  "type": "module",