Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/js/tabs/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ cli.initialize = function (callback) {
self.cliBuffer = "";
self.startProcessing = false;

// Reset modal dialog reference since DOM gets rebuilt on tab switch
self.GUI.snippetPreviewWindow = null;

const enterKeyCode = 13;

function clearHistory() {
Expand Down Expand Up @@ -159,6 +162,7 @@ cli.initialize = function (callback) {
);
$("#snippetpreviewcontent a.confirm").click(() => executeSnippet(fileName));
}

previewArea.val(result);
self.GUI.snippetPreviewWindow.showModal();
}
Expand Down
14 changes: 9 additions & 5 deletions src/js/utils/initializeModalDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ export function initializeModalDialog(activationSelector, dialogSelector, messag
onClose && onClose();
});
// Handle activation button click
$(activationSelector).on("click", () => {
dialogElement.showModal();
// Reset any previous scrolling
dialogContainerElement.scroll(0, 0);
});
if (activationSelector) {
$(activationSelector).on("click", () => {
dialogElement.showModal();
// Reset any previous scrolling
if (dialogContainerElement) {
dialogContainerElement.scroll(0, 0);
}
});
}
// Return dialog element
return dialogElement;
}