vite-plugin-opencode-assistant 1.0.55 → 1.0.57

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.
@@ -297,9 +297,12 @@ const __vue_sfc__ = /* @__PURE__ */ _defineComponent({
297
297
  showNotification("\u5DF2\u6E05\u9664\u6240\u6709\u9009\u4E2D\u5143\u7D20");
298
298
  };
299
299
  const handleSelectModeChange = (val) => {
300
- var _a2;
300
+ var _a2, _b;
301
301
  selectMode.value = val;
302
- const isSplit = (_a2 = widgetRef.value) == null ? void 0 : _a2.isSplitMode;
302
+ (_a2 = widgetRef.value) == null ? void 0 : _a2.sendMessageToIframe("OPENCODE_SELECT_MODE_CHANGE", {
303
+ selectMode: val
304
+ });
305
+ const isSplit = (_b = widgetRef.value) == null ? void 0 : _b.isSplitMode;
303
306
  if (val && !isSplit && open.value) {
304
307
  open.value = false;
305
308
  }
@@ -97,6 +97,13 @@ function generateBridgeScript(options) {
97
97
  }
98
98
  }
99
99
 
100
+ // === \u9009\u62E9\u6A21\u5F0F\u72B6\u6001 ===
101
+ let isInSelectMode = false;
102
+
103
+ function handleSelectModeChange(selectMode) {
104
+ isInSelectMode = selectMode;
105
+ }
106
+
100
107
  // === \u6D88\u606F\u76D1\u542C ===
101
108
  window.addEventListener("message", function(event) {
102
109
  if (event.data && event.data.type === "OPENCODE_SET_THEME") {
@@ -114,11 +121,32 @@ function generateBridgeScript(options) {
114
121
  if (event.data && event.data.type === "prompt-dock-visibility-change") {
115
122
  handlePromptDockVisibilityChange(event.data.visible);
116
123
  }
124
+
125
+ if (event.data && event.data.type === "OPENCODE_SELECT_MODE_CHANGE") {
126
+ handleSelectModeChange(event.data.selectMode);
127
+ }
117
128
  });
118
129
 
119
130
  // === \u952E\u76D8\u4E8B\u4EF6\u8F6C\u53D1\uFF08\u7528\u4E8E\u9000\u51FA\u9009\u62E9\u6A21\u5F0F\uFF09 ===
120
131
  window.addEventListener("keydown", function(event) {
121
132
  if (event.key === "Escape" || (event.ctrlKey && event.key.toLowerCase() === "p")) {
133
+ // \u9009\u62E9\u6A21\u5F0F\u5F00\u542F\u65F6\uFF0C\u4F18\u5148\u9000\u51FA\u9009\u62E9\u6A21\u5F0F\uFF0C\u963B\u6B62 iframe \u5185\u7684\u5176\u4ED6 ESC \u5904\u7406\uFF08\u5982\u4E2D\u6B62\u4F1A\u8BDD\uFF09
134
+ if (isInSelectMode) {
135
+ event.preventDefault();
136
+ event.stopPropagation();
137
+ if (window.parent !== window) {
138
+ window.parent.postMessage({
139
+ type: "OPENCODE_KEYDOWN",
140
+ key: event.key,
141
+ ctrlKey: event.ctrlKey,
142
+ metaKey: event.metaKey,
143
+ shiftKey: event.shiftKey,
144
+ altKey: event.altKey
145
+ }, "*");
146
+ }
147
+ return;
148
+ }
149
+
122
150
  if (window.parent !== window) {
123
151
  window.parent.postMessage({
124
152
  type: "OPENCODE_KEYDOWN",
@@ -328,9 +328,12 @@ const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)({
328
328
  showNotification("\u5DF2\u6E05\u9664\u6240\u6709\u9009\u4E2D\u5143\u7D20");
329
329
  };
330
330
  const handleSelectModeChange = (val) => {
331
- var _a2;
331
+ var _a2, _b;
332
332
  selectMode.value = val;
333
- const isSplit = (_a2 = widgetRef.value) == null ? void 0 : _a2.isSplitMode;
333
+ (_a2 = widgetRef.value) == null ? void 0 : _a2.sendMessageToIframe("OPENCODE_SELECT_MODE_CHANGE", {
334
+ selectMode: val
335
+ });
336
+ const isSplit = (_b = widgetRef.value) == null ? void 0 : _b.isSplitMode;
334
337
  if (val && !isSplit && open.value) {
335
338
  open.value = false;
336
339
  }