smoothly 0.3.48 → 0.3.49

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.
@@ -701,6 +701,12 @@ exports.Action = void 0;
701
701
  return formatter.format(StateEditor_1.StateEditor.copy(result));
702
702
  }
703
703
  Action.apply = apply;
704
+ function paste(formatter, state, pasted) {
705
+ const result = State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(state)));
706
+ replace(result, pasted);
707
+ return formatter.format(StateEditor_1.StateEditor.copy(result));
708
+ }
709
+ Action.paste = paste;
704
710
  function ctrlArrow(formatter, state, action) {
705
711
  let cursorPosition = Selection_1.Selection.getCursor(state.selection);
706
712
  let stalkPosition = Selection_1.Selection.getStalker(state.selection);
@@ -21527,8 +21533,7 @@ const SmoothlyInput = class {
21527
21533
  let pasted = event.clipboardData ? event.clipboardData.getData("text") : "";
21528
21534
  const backend = event.target;
21529
21535
  pasted = this.expiresAutocompleteFix(backend, pasted);
21530
- for (const letter of pasted)
21531
- this.processKey({ key: letter }, backend);
21536
+ this.processPaste(pasted, backend);
21532
21537
  }
21533
21538
  onInput(event) {
21534
21539
  var _a;
@@ -21560,6 +21565,12 @@ const SmoothlyInput = class {
21560
21565
  : value;
21561
21566
  return value;
21562
21567
  }
21568
+ processPaste(pasted, backend) {
21569
+ if (!this.readonly) {
21570
+ const after = dist.Action.paste(this.formatter, this.state, pasted);
21571
+ this.updateBackend(after, backend);
21572
+ }
21573
+ }
21563
21574
  processKey(event, backend) {
21564
21575
  if (!this.readonly) {
21565
21576
  const after = dist.Action.apply(this.formatter, this.state, event);
@@ -143,8 +143,7 @@ export class SmoothlyInput {
143
143
  let pasted = event.clipboardData ? event.clipboardData.getData("text") : "";
144
144
  const backend = event.target;
145
145
  pasted = this.expiresAutocompleteFix(backend, pasted);
146
- for (const letter of pasted)
147
- this.processKey({ key: letter }, backend);
146
+ this.processPaste(pasted, backend);
148
147
  }
149
148
  onInput(event) {
150
149
  var _a;
@@ -176,6 +175,12 @@ export class SmoothlyInput {
176
175
  : value;
177
176
  return value;
178
177
  }
178
+ processPaste(pasted, backend) {
179
+ if (!this.readonly) {
180
+ const after = Action.paste(this.formatter, this.state, pasted);
181
+ this.updateBackend(after, backend);
182
+ }
183
+ }
179
184
  processKey(event, backend) {
180
185
  if (!this.readonly) {
181
186
  const after = Action.apply(this.formatter, this.state, event);
@@ -26454,6 +26454,12 @@ exports.Action = void 0;
26454
26454
  return formatter.format(StateEditor_1.StateEditor.copy(result));
26455
26455
  }
26456
26456
  Action.apply = apply;
26457
+ function paste(formatter, state, pasted) {
26458
+ const result = State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(state)));
26459
+ replace(result, pasted);
26460
+ return formatter.format(StateEditor_1.StateEditor.copy(result));
26461
+ }
26462
+ Action.paste = paste;
26457
26463
  function ctrlArrow(formatter, state, action) {
26458
26464
  let cursorPosition = Selection_1.Selection.getCursor(state.selection);
26459
26465
  let stalkPosition = Selection_1.Selection.getStalker(state.selection);
@@ -47299,8 +47305,7 @@ const SmoothlyInput$1 = class extends HTMLElement {
47299
47305
  let pasted = event.clipboardData ? event.clipboardData.getData("text") : "";
47300
47306
  const backend = event.target;
47301
47307
  pasted = this.expiresAutocompleteFix(backend, pasted);
47302
- for (const letter of pasted)
47303
- this.processKey({ key: letter }, backend);
47308
+ this.processPaste(pasted, backend);
47304
47309
  }
47305
47310
  onInput(event) {
47306
47311
  var _a;
@@ -47332,6 +47337,12 @@ const SmoothlyInput$1 = class extends HTMLElement {
47332
47337
  : value;
47333
47338
  return value;
47334
47339
  }
47340
+ processPaste(pasted, backend) {
47341
+ if (!this.readonly) {
47342
+ const after = dist.Action.paste(this.formatter, this.state, pasted);
47343
+ this.updateBackend(after, backend);
47344
+ }
47345
+ }
47335
47346
  processKey(event, backend) {
47336
47347
  if (!this.readonly) {
47337
47348
  const after = dist.Action.apply(this.formatter, this.state, event);
@@ -697,6 +697,12 @@ exports.Action = void 0;
697
697
  return formatter.format(StateEditor_1.StateEditor.copy(result));
698
698
  }
699
699
  Action.apply = apply;
700
+ function paste(formatter, state, pasted) {
701
+ const result = State_1.State.copy(formatter.unformat(StateEditor_1.StateEditor.copy(state)));
702
+ replace(result, pasted);
703
+ return formatter.format(StateEditor_1.StateEditor.copy(result));
704
+ }
705
+ Action.paste = paste;
700
706
  function ctrlArrow(formatter, state, action) {
701
707
  let cursorPosition = Selection_1.Selection.getCursor(state.selection);
702
708
  let stalkPosition = Selection_1.Selection.getStalker(state.selection);
@@ -21523,8 +21529,7 @@ const SmoothlyInput = class {
21523
21529
  let pasted = event.clipboardData ? event.clipboardData.getData("text") : "";
21524
21530
  const backend = event.target;
21525
21531
  pasted = this.expiresAutocompleteFix(backend, pasted);
21526
- for (const letter of pasted)
21527
- this.processKey({ key: letter }, backend);
21532
+ this.processPaste(pasted, backend);
21528
21533
  }
21529
21534
  onInput(event) {
21530
21535
  var _a;
@@ -21556,6 +21561,12 @@ const SmoothlyInput = class {
21556
21561
  : value;
21557
21562
  return value;
21558
21563
  }
21564
+ processPaste(pasted, backend) {
21565
+ if (!this.readonly) {
21566
+ const after = dist.Action.paste(this.formatter, this.state, pasted);
21567
+ this.updateBackend(after, backend);
21568
+ }
21569
+ }
21559
21570
  processKey(event, backend) {
21560
21571
  if (!this.readonly) {
21561
21572
  const after = dist.Action.apply(this.formatter, this.state, event);