@salesforcedevs/docs-components 0.0.8-edit → 0.0.9-edit
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/package.json
CHANGED
|
@@ -106,6 +106,9 @@ export default class EditFile extends LightningElement {
|
|
|
106
106
|
this.fileContent = data.data.content;
|
|
107
107
|
this.originalContent = data.data.content;
|
|
108
108
|
this.errorMessage = "";
|
|
109
|
+
|
|
110
|
+
// Set textarea value directly using ref
|
|
111
|
+
this.updateTextareaValue();
|
|
109
112
|
} else {
|
|
110
113
|
this.errorMessage = data.error || data.message || "Failed to load file content";
|
|
111
114
|
}
|
|
@@ -205,11 +208,29 @@ export default class EditFile extends LightningElement {
|
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
210
|
|
|
211
|
+
// Update textarea value using ref
|
|
212
|
+
private updateTextareaValue() {
|
|
213
|
+
// Use setTimeout to ensure DOM is updated
|
|
214
|
+
setTimeout(() => {
|
|
215
|
+
const textarea = this.template.querySelector('#file-content') as HTMLTextAreaElement;
|
|
216
|
+
if (textarea && this.fileContent !== undefined) {
|
|
217
|
+
textarea.value = this.fileContent;
|
|
218
|
+
}
|
|
219
|
+
}, 0);
|
|
220
|
+
}
|
|
221
|
+
|
|
208
222
|
connectedCallback() {
|
|
209
223
|
// Add escape key listener
|
|
210
224
|
document.addEventListener("keydown", this.handleKeyDown.bind(this));
|
|
211
225
|
}
|
|
212
226
|
|
|
227
|
+
renderedCallback() {
|
|
228
|
+
// Ensure textarea value is set correctly when component renders
|
|
229
|
+
if (this.isPopoverOpen && this.fileContent && !this.isLoading) {
|
|
230
|
+
this.updateTextareaValue();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
213
234
|
disconnectedCallback() {
|
|
214
235
|
// Remove escape key listener
|
|
215
236
|
document.removeEventListener("keydown", this.handleKeyDown.bind(this));
|