| 1150 | }, |
| 1151 | |
| 1152 | async closeAllFiles(options = {}) { |
| 1153 | if (this.loading) return; |
| 1154 | const requestedIds = Array.isArray(options.tabIds) && options.tabIds.length |
| 1155 | ? options.tabIds |
| 1156 | : this.visibleTabs().map((tab) => tab.tab_id); |
| 1157 | const tabs = requestedIds.map((id) => this.tabs.find((tab) => tab.tab_id === id)).filter(Boolean); |
| 1158 | if (!tabs.length) return; |
| 1159 | |
| 1160 | const dirtyTabs = tabs.filter((tab) => this.isTabDirty(tab)); |
| 1161 | if (dirtyTabs.length && options.confirm !== false) { |
| 1162 | this.beginCloseConfirmation("all", tabs.map((tab) => tab.tab_id)); |
| 1163 | return; |
| 1164 | } |
| 1165 | |
| 1166 | this.pendingClose = null; |
| 1167 | for (const tab of [...tabs]) { |
| 1168 | const current = this.tabs.find((item) => item.tab_id === tab.tab_id); |
| 1169 | if (!current) continue; |
| 1170 | const closed = await this.closeTabNow(current, { |
| 1171 | save: options.save === true && this.isTabDirty(current), |
| 1172 | }); |
| 1173 | if (!closed) break; |
| 1174 | } |
| 1175 | }, |
| 1176 | |
| 1177 | scheduleSourceEditorInit() { |
| 1178 | if (!this.isSourceMode()) return; |