@seniorsistemas/angular-components 17.29.1-bugfix-ptfgap-1059-df2f86c9 → 17.29.1-bugfix-ptfgap-1059-3a1e3465

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.
@@ -4217,7 +4217,10 @@
4217
4217
  }
4218
4218
  };
4219
4219
  CoreFacade.prototype.setPayload = function (payload) {
4220
- this.setCode(this.getSafeCode(payload));
4220
+ var safeCode = this.getSafeCode(payload);
4221
+ // Força a atualização sem verificar _lastCodeEmitted,
4222
+ // mas preserva o cursor verificando no nível do editor
4223
+ this.setCodeWithCursorPreservation(safeCode);
4221
4224
  };
4222
4225
  CoreFacade.prototype.getOnCoreFinishLoadObservable = function () {
4223
4226
  return this.$onCoreFinishLoad.asObservable();
@@ -5706,6 +5709,29 @@
5706
5709
  this._codeReceivedBeforeViewCreation = code;
5707
5710
  }
5708
5711
  };
5712
+ CodeMirror6Core.prototype.setCodeWithCursorPreservation = function (code) {
5713
+ if (CodeMirror6Core._editorView) {
5714
+ var currentCode = CodeMirror6Core._editorView.state.doc.toString();
5715
+ // Só atualiza se o conteúdo for realmente diferente
5716
+ if (currentCode !== code) {
5717
+ var currentSelection = CodeMirror6Core._editorView.state.selection.main;
5718
+ CodeMirror6Core.updateEditorView({
5719
+ changes: {
5720
+ from: 0,
5721
+ to: CodeMirror6Core._editorView.state.doc.length,
5722
+ insert: code
5723
+ },
5724
+ selection: {
5725
+ anchor: Math.min(currentSelection.anchor, code.length),
5726
+ head: Math.min(currentSelection.head, code.length)
5727
+ }
5728
+ });
5729
+ }
5730
+ }
5731
+ else {
5732
+ this._codeReceivedBeforeViewCreation = code;
5733
+ }
5734
+ };
5709
5735
  CodeMirror6Core.$onCompletionItemsUpdate = new rxjs.Subject();
5710
5736
  CodeMirror6Core._ngUnsubscribe = new rxjs.Subject();
5711
5737
  CodeMirror6Core._editorView = null;