@aquera/ngx-smart-table 0.0.17-patch-0.2 → 0.0.17-patch-0.3
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.
- package/esm2020/lib/editors/nile-code-editor.mjs +26 -3
- package/fesm2015/aquera-ngx-smart-table.mjs +35 -12
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -1
- package/fesm2020/aquera-ngx-smart-table.mjs +25 -2
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -1
- package/lib/editors/nile-code-editor.d.ts +5 -0
- package/package.json +1 -1
|
@@ -4990,6 +4990,29 @@ class NileCodeEditor {
|
|
|
4990
4990
|
// Silently handle any errors
|
|
4991
4991
|
}
|
|
4992
4992
|
}
|
|
4993
|
+
/**
|
|
4994
|
+
* Read the live value directly from CodeMirror's internal state,
|
|
4995
|
+
* bypassing debounced nile-change events and the possibly-stale .value property.
|
|
4996
|
+
*/
|
|
4997
|
+
getLiveEditorValue() {
|
|
4998
|
+
if (!this.editor)
|
|
4999
|
+
return '';
|
|
5000
|
+
try {
|
|
5001
|
+
const shadowRoot = this.editor.shadowRoot;
|
|
5002
|
+
if (shadowRoot) {
|
|
5003
|
+
const cmEditor = shadowRoot.querySelector('.cm-editor');
|
|
5004
|
+
if (cmEditor?.cmView?.view) {
|
|
5005
|
+
return cmEditor.cmView.view.state.doc.toString();
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
catch {
|
|
5010
|
+
// Fall through to other methods
|
|
5011
|
+
}
|
|
5012
|
+
if (this.trackedValue !== null)
|
|
5013
|
+
return this.trackedValue;
|
|
5014
|
+
return this.editor.value ?? '';
|
|
5015
|
+
}
|
|
4993
5016
|
/**
|
|
4994
5017
|
* Open the full editor dialog
|
|
4995
5018
|
*/
|
|
@@ -5016,7 +5039,7 @@ class NileCodeEditor {
|
|
|
5016
5039
|
// Create full editor
|
|
5017
5040
|
this.dialogEditor = document.createElement('nile-code-editor');
|
|
5018
5041
|
const minLines = this.options?.dialogMinLines ?? 20;
|
|
5019
|
-
const currentValue = this.
|
|
5042
|
+
const currentValue = this.getLiveEditorValue();
|
|
5020
5043
|
const currentLineCount = (currentValue.match(/\n/g) || []).length + 1;
|
|
5021
5044
|
const paddingLines = Math.max(0, minLines - currentLineCount);
|
|
5022
5045
|
this.dialogEditor.value = currentValue + '\n'.repeat(paddingLines);
|
|
@@ -5363,7 +5386,7 @@ class NileCodeEditor {
|
|
|
5363
5386
|
getCurrentValue() {
|
|
5364
5387
|
if (!this.editor)
|
|
5365
5388
|
return '';
|
|
5366
|
-
const value =
|
|
5389
|
+
const value = this.getLiveEditorValue();
|
|
5367
5390
|
return value.replace(/\n+$/, '');
|
|
5368
5391
|
}
|
|
5369
5392
|
/**
|