WI slash only reload world if it was selected

41c709e291212291d3d1f61b5a25545258d0f5fb

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +8 -2Ignore whitespace
public/scripts/world-info.js+8 -2
@@ -885,9 +885,15 @@ function setWorldInfoSettings(settings, data) {
885885}
886886
887887function registerWorldInfoSlashCommands() {
888- function reloadEditor(file) {
888+ /**
889+ * Reloads the editor with the specified world info file
890+ * @param {string} file - The file to load in the editor
891+ * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected
892+ */
893+ function reloadEditor(file, loadIfNotSelected = false) {
894+ const currentIndex = $('#world_editor_select').val();
889895 const selectedIndex = world_names.indexOf(file);
890896 if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) {
891897 $('#world_editor_select').val(selectedIndex).trigger('change');
892898 }
893899 }