testomatio-editor-blocks 0.4.9 → 0.4.11

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.
@@ -81,7 +81,20 @@ export const snippetBlock = createReactBlockSpec({
81
81
  });
82
82
  }, [block.id, editor]);
83
83
  const handleFieldFocus = useCallback(() => {
84
- editor.setSelection(block.id, block.id);
84
+ var _a, _b, _c;
85
+ const selection = editor.getSelection();
86
+ const blocks = (_a = selection === null || selection === void 0 ? void 0 : selection.blocks) !== null && _a !== void 0 ? _a : [];
87
+ const firstId = (_b = blocks[0]) === null || _b === void 0 ? void 0 : _b.id;
88
+ const lastId = (_c = blocks[blocks.length - 1]) === null || _c === void 0 ? void 0 : _c.id;
89
+ if (firstId === block.id && lastId === block.id) {
90
+ return;
91
+ }
92
+ try {
93
+ editor.setSelection(block.id, block.id);
94
+ }
95
+ catch {
96
+ //
97
+ }
85
98
  }, [editor, block.id]);
86
99
  if (!hasSnippets) {
87
100
  return (_jsx("div", { className: "bn-teststep bn-snippet", "data-block-id": block.id, children: _jsx("p", { className: "bn-snippet__empty", children: "No snippets in this project." }) }));
@@ -1253,7 +1253,7 @@ html.dark .bn-step-image-preview__content {
1253
1253
  }
1254
1254
 
1255
1255
  .bn-step-suggestion__title {
1256
- font-weight: 600;
1256
+ font-weight: 400;
1257
1257
  font-size: 0.95rem;
1258
1258
  }
1259
1259
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testomatio-editor-blocks",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Custom BlockNote schema, markdown conversion helpers, and UI for Testomatio-style test cases and steps.",
5
5
  "type": "module",
6
6
  "main": "./package/index.js",
@@ -148,7 +148,18 @@ export const snippetBlock = createReactBlockSpec(
148
148
  );
149
149
 
150
150
  const handleFieldFocus = useCallback(() => {
151
- editor.setSelection(block.id, block.id);
151
+ const selection = editor.getSelection();
152
+ const blocks = selection?.blocks ?? [];
153
+ const firstId = blocks[0]?.id;
154
+ const lastId = blocks[blocks.length - 1]?.id;
155
+ if (firstId === block.id && lastId === block.id) {
156
+ return;
157
+ }
158
+ try {
159
+ editor.setSelection(block.id, block.id);
160
+ } catch {
161
+ //
162
+ }
152
163
  }, [editor, block.id]);
153
164
 
154
165
  if (!hasSnippets) {
@@ -1253,7 +1253,7 @@ html.dark .bn-step-image-preview__content {
1253
1253
  }
1254
1254
 
1255
1255
  .bn-step-suggestion__title {
1256
- font-weight: 600;
1256
+ font-weight: 400;
1257
1257
  font-size: 0.95rem;
1258
1258
  }
1259
1259