@monaco-neovim-wasm/lib 0.1.12 → 0.1.13

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.
@@ -971,6 +971,7 @@ class ce {
971
971
  recentNormalKeys = "";
972
972
  lastDelegatedInsertPrefix = null;
973
973
  lastDelegatedDotRepeat = null;
974
+ lastClipboardText = null;
974
975
  ignoreInsertExitCursor = null;
975
976
  ignoreMonacoCursorSyncToNvimUntil = 0;
976
977
  ignoreTextKeydownUntil = 0;
@@ -1572,7 +1573,9 @@ end)(unpack(_A))`;
1572
1573
  }
1573
1574
  handleClipboardCopy(t) {
1574
1575
  const e = (t ?? []).join(`
1575
- `), i = this.opts.clipboard;
1576
+ `);
1577
+ this.lastClipboardText = e;
1578
+ const i = this.opts.clipboard;
1576
1579
  if (i !== null) {
1577
1580
  if (i?.writeText) {
1578
1581
  i.writeText(e).catch(() => {
@@ -3234,29 +3237,36 @@ vim.rpcnotify(chan, "monaco_buf_enter", {
3234
3237
  return this.session ? this.session.call(t, e) : Promise.reject(new Error("session not started"));
3235
3238
  }
3236
3239
  doClipboardPaste(t) {
3237
- const e = (s) => {
3238
- const n = (s || "").split(/\r?\n/);
3239
- this.sendRpcResponse(t, null, [n, "v"]);
3240
- }, i = this.opts.clipboard;
3241
- if (i === null) {
3240
+ const e = (n) => {
3241
+ this.lastClipboardText = n == null ? "" : String(n);
3242
+ const r = (n || "").split(/\r?\n/);
3243
+ this.sendRpcResponse(t, null, [r, "v"]);
3244
+ }, i = () => {
3245
+ try {
3246
+ return typeof navigator < "u" && navigator?.webdriver || typeof window > "u" || typeof window.prompt != "function" ? null : window.prompt("Paste text");
3247
+ } catch {
3248
+ return null;
3249
+ }
3250
+ }, s = this.opts.clipboard;
3251
+ if (s === null) {
3242
3252
  e("");
3243
3253
  return;
3244
3254
  }
3245
- if (i?.readText) {
3246
- i.readText().then((s) => e(s || "")).catch(() => {
3247
- const s = window.prompt("Paste text");
3248
- e(s || "");
3255
+ if (s?.readText) {
3256
+ s.readText().then((n) => e(n || "")).catch(() => {
3257
+ const n = i();
3258
+ e(n ?? this.lastClipboardText ?? "");
3249
3259
  });
3250
3260
  return;
3251
3261
  }
3252
3262
  if (!navigator.clipboard?.readText) {
3253
- const s = window.prompt("Paste text");
3254
- e(s || "");
3263
+ const n = i();
3264
+ e(n ?? this.lastClipboardText ?? "");
3255
3265
  return;
3256
3266
  }
3257
- navigator.clipboard.readText().then((s) => e(s || "")).catch(() => {
3258
- const s = window.prompt("Paste text");
3259
- e(s || "");
3267
+ navigator.clipboard.readText().then((n) => e(n || "")).catch(() => {
3268
+ const n = i();
3269
+ e(n ?? this.lastClipboardText ?? "");
3260
3270
  });
3261
3271
  }
3262
3272
  updateCursor(t, e) {
@@ -181,6 +181,7 @@ export declare class MonacoNeovimClient {
181
181
  private recentNormalKeys;
182
182
  private lastDelegatedInsertPrefix;
183
183
  private lastDelegatedDotRepeat;
184
+ private lastClipboardText;
184
185
  private ignoreInsertExitCursor;
185
186
  private ignoreMonacoCursorSyncToNvimUntil;
186
187
  private ignoreTextKeydownUntil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monaco-neovim-wasm/lib",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Core library for running Neovim (WASM) behind Monaco via msgpack-RPC.",