mbeditor 0.14.1 → 0.14.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/app/assets/javascripts/mbeditor/application.js +5 -1
- data/app/assets/javascripts/mbeditor/collaboration_identity.js +4 -2
- data/app/assets/javascripts/mbeditor/collaboration_service.js +74 -2
- data/app/assets/javascripts/mbeditor/components/AiRoundTripModal.js +452 -0
- data/app/assets/javascripts/mbeditor/components/ChangelogView.js +1 -1
- data/app/assets/javascripts/mbeditor/components/CombinedFileView.js +44 -29
- data/app/assets/javascripts/mbeditor/components/DiffViewer.js +2 -1
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +33 -27
- data/app/assets/javascripts/mbeditor/components/FileHistoryPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/components/FileTree.js +144 -4
- data/app/assets/javascripts/mbeditor/components/GitPanel.js +1 -1
- data/app/assets/javascripts/mbeditor/components/ImportConflictModal.js +7 -68
- data/app/assets/javascripts/mbeditor/components/ImportDialog.js +2 -16
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +368 -471
- data/app/assets/javascripts/mbeditor/components/ModalDialog.js +203 -0
- data/app/assets/javascripts/mbeditor/components/PastePlaceModal.js +1 -9
- data/app/assets/javascripts/mbeditor/components/Popover.js +88 -0
- data/app/assets/javascripts/mbeditor/components/PopupMenu.js +166 -0
- data/app/assets/javascripts/mbeditor/components/ProblemsPanel.js +8 -4
- data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +5 -7
- data/app/assets/javascripts/mbeditor/components/SettingsModal.js +3 -14
- data/app/assets/javascripts/mbeditor/components/ShortcutHelp.js +5 -26
- data/app/assets/javascripts/mbeditor/components/TabBar.js +15 -32
- data/app/assets/javascripts/mbeditor/components/TestResultsPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/editor_plugins.js +3 -23
- data/app/assets/javascripts/mbeditor/file_service.js +1 -1
- data/app/assets/javascripts/mbeditor/git_service.js +0 -7
- data/app/assets/javascripts/mbeditor/patch_select.js +156 -0
- data/app/assets/javascripts/mbeditor/tab_manager.js +22 -0
- data/app/assets/stylesheets/mbeditor/application.css +7 -110
- data/app/assets/stylesheets/mbeditor/editor.css +200 -194
- data/app/assets/stylesheets/mbeditor/glass.css +1 -1
- data/app/channels/mbeditor/collaboration_channel.rb +24 -5
- data/app/controllers/mbeditor/editors_controller.rb +75 -38
- data/app/controllers/mbeditor/git_controller.rb +1 -12
- data/app/services/mbeditor/ai_bundle_service.rb +181 -0
- data/app/services/mbeditor/archive_service.rb +43 -6
- data/app/services/mbeditor/availability_probe.rb +2 -2
- data/app/services/mbeditor/code_search_service.rb +1 -3
- data/app/services/mbeditor/collaboration_doc_store.rb +37 -1
- data/app/services/mbeditor/exclusion_matcher.rb +0 -4
- data/app/services/mbeditor/file_import_service.rb +4 -1
- data/app/services/mbeditor/file_operation_service.rb +3 -3
- data/app/services/mbeditor/git_service.rb +11 -45
- data/app/services/mbeditor/js_definition_service.rb +1 -0
- data/app/services/mbeditor/model_graph_service.rb +1 -0
- data/app/services/mbeditor/patch_apply_service.rb +185 -0
- data/app/services/mbeditor/rails_related_files_service.rb +1 -1
- data/app/services/mbeditor/redmine_config_error.rb +6 -0
- data/app/services/mbeditor/redmine_disabled_error.rb +10 -0
- data/app/services/mbeditor/redmine_service.rb +0 -8
- data/app/services/mbeditor/ruby_definition_service.rb +1 -0
- data/app/services/mbeditor/schema_service.rb +1 -0
- data/app/services/mbeditor/test_runner_service.rb +1 -1
- data/lib/mbeditor/rack/silence_ping_request.rb +14 -14
- data/lib/mbeditor/route_map.rb +5 -2
- data/lib/mbeditor/ruby_lsp_client.rb +7 -26
- data/lib/mbeditor/version.rb +1 -1
- data/public/monaco-editor/VERSIONS +2 -1
- data/public/monaco-editor/monaco.js +226 -226
- metadata +11 -4
- data/app/assets/javascripts/mbeditor/components/CommitGraph.js +0 -65
- data/app/services/mbeditor/git_commit_graph_service.rb +0 -62
|
@@ -64,8 +64,6 @@ var PRETTIER_PARSERS = {
|
|
|
64
64
|
html: 'html', vue: 'vue',
|
|
65
65
|
md: 'markdown', markdown: 'markdown'
|
|
66
66
|
};
|
|
67
|
-
var SUPPORTED_PRETTIER_EXTS = Object.keys(PRETTIER_PARSERS);
|
|
68
|
-
|
|
69
67
|
function prettierParserFor(path) {
|
|
70
68
|
return PRETTIER_PARSERS[String(path || '').split('.').pop().toLowerCase()] || null;
|
|
71
69
|
}
|
|
@@ -438,22 +436,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
438
436
|
var historyPanelPath = _useState21[0];
|
|
439
437
|
var setHistoryPanelPath = _useState21[1];
|
|
440
438
|
|
|
441
|
-
var _useState23 = useState(false);
|
|
442
|
-
var isNavigating = _useState23[0];
|
|
443
|
-
var setIsNavigating = _useState23[1];
|
|
444
|
-
|
|
445
|
-
var _useState25 = useState(false);
|
|
446
|
-
var isReviewOpen = _useState25[0];
|
|
447
|
-
var setIsReviewOpen = _useState25[1];
|
|
448
|
-
|
|
449
|
-
var _useState27 = useState(null);
|
|
450
|
-
var selectedCommit = _useState27[0];
|
|
451
|
-
var setSelectedCommit = _useState27[1];
|
|
452
|
-
|
|
453
|
-
var _useState29 = useState(null);
|
|
454
|
-
var commitDetailFiles = _useState29[0];
|
|
455
|
-
var setCommitDetailFiles = _useState29[1];
|
|
456
|
-
|
|
457
439
|
var _useStateCFI = useState(0);
|
|
458
440
|
var conflictFileIndex = _useStateCFI[0];
|
|
459
441
|
var setConflictFileIndex = _useStateCFI[1];
|
|
@@ -633,6 +615,9 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
633
615
|
var setImportConflict = _useStateImportConflict[1];
|
|
634
616
|
|
|
635
617
|
// { initialFolder } while the upload dialog is open, null otherwise.
|
|
618
|
+
var _useStateAiModal = useState(false);
|
|
619
|
+
var showAiModal = _useStateAiModal[0];
|
|
620
|
+
var setShowAiModal = _useStateAiModal[1];
|
|
636
621
|
var _useStateImportDialog = useState(null);
|
|
637
622
|
var importDialog = _useStateImportDialog[0];
|
|
638
623
|
var setImportDialog = _useStateImportDialog[1];
|
|
@@ -1269,9 +1254,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1269
1254
|
});
|
|
1270
1255
|
};
|
|
1271
1256
|
|
|
1272
|
-
var runRubyLint = function runRubyLint(tab
|
|
1273
|
-
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
|
1274
|
-
|
|
1257
|
+
var runRubyLint = function runRubyLint(tab) {
|
|
1275
1258
|
if (!tab || (!isRubyPath(tab.path) && !tab.path.endsWith('.haml'))) return Promise.resolve(null);
|
|
1276
1259
|
|
|
1277
1260
|
// An empty buffer has no offenses, and answering that here rather than over
|
|
@@ -1284,19 +1267,9 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1284
1267
|
// its squiggles.
|
|
1285
1268
|
if (!String(tab.content || '').trim()) {
|
|
1286
1269
|
applyMarkersForTab(tab.id, []);
|
|
1287
|
-
if (options.showStatus) EditorStore.setStatus('No RuboCop offenses!', 'success');
|
|
1288
1270
|
return Promise.resolve({ markers: [] });
|
|
1289
1271
|
}
|
|
1290
1272
|
|
|
1291
|
-
if (options.showLoading) {
|
|
1292
|
-
setLoading(function (prev) {
|
|
1293
|
-
return _extends({}, prev, { lint: true });
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
if (options.showStatus) {
|
|
1297
|
-
EditorStore.setStatus('Linting...', 'info');
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
1273
|
var startedAt = Date.now();
|
|
1301
1274
|
|
|
1302
1275
|
// ruby-lsp answers diagnostics for Ruby files when it's available: same
|
|
@@ -1325,35 +1298,21 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1325
1298
|
if (audit) audit.rec(audit.EV.LINT, _auditExt(tab.path), Date.now() - startedAt, nextMarkers.length);
|
|
1326
1299
|
applyMarkersForTab(tab.id, nextMarkers);
|
|
1327
1300
|
|
|
1328
|
-
if (options.showStatus) {
|
|
1329
|
-
var count = res.summary && res.summary.offense_count || 0;
|
|
1330
|
-
EditorStore.setStatus(count === 0 ? 'No RuboCop offenses!' : "Found " + count + " offenses", count === 0 ? 'success' : 'warning');
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
1301
|
return res;
|
|
1334
|
-
})["catch"](function (
|
|
1302
|
+
})["catch"](function () {
|
|
1335
1303
|
_recErr('LINT');
|
|
1336
|
-
if (options.showStatus) {
|
|
1337
|
-
EditorStore.setStatus('Lint failed: ' + err.message, 'error');
|
|
1338
|
-
}
|
|
1339
1304
|
return null;
|
|
1340
|
-
})["finally"](function () {
|
|
1341
|
-
if (options.showLoading) {
|
|
1342
|
-
setLoading(function (prev) {
|
|
1343
|
-
return _extends({}, prev, { lint: false });
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
1305
|
});
|
|
1347
1306
|
};
|
|
1348
1307
|
|
|
1349
|
-
var _debouncedAutoLint = useRef(window._.debounce(function (tab
|
|
1308
|
+
var _debouncedAutoLint = useRef(window._.debounce(function (tab) {
|
|
1350
1309
|
if (!tab) return;
|
|
1351
1310
|
if (isRubyPath(tab.path)) {
|
|
1352
|
-
runRubyLint(tab
|
|
1311
|
+
runRubyLint(tab);
|
|
1353
1312
|
return;
|
|
1354
1313
|
}
|
|
1355
1314
|
if (tab.path.endsWith('.haml')) {
|
|
1356
|
-
runRubyLint(tab
|
|
1315
|
+
runRubyLint(tab);
|
|
1357
1316
|
return;
|
|
1358
1317
|
}
|
|
1359
1318
|
|
|
@@ -1696,10 +1655,12 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1696
1655
|
setShowLogPanel(function (prev) { return !prev; });
|
|
1697
1656
|
}
|
|
1698
1657
|
// Ctrl+Shift+Z is handled in capture phase below so Monaco cannot swallow it.
|
|
1658
|
+
// The context menu closes itself on Esc now (popover light dismiss).
|
|
1659
|
+
// setCollabOverflowOpen, called here before, never existed: every Esc
|
|
1660
|
+
// threw a ReferenceError after the setters above had run.
|
|
1699
1661
|
if (e.key === 'Escape') {
|
|
1700
|
-
setContextMenu(null);
|
|
1701
1662
|
setShowHelp(false);
|
|
1702
|
-
|
|
1663
|
+
setCollabOverflowAnchor(null);
|
|
1703
1664
|
}
|
|
1704
1665
|
};
|
|
1705
1666
|
|
|
@@ -1846,7 +1807,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1846
1807
|
// Already in a Monaco editor — let Monaco's own binding handle it.
|
|
1847
1808
|
if (ae.closest('.monaco-editor')) return;
|
|
1848
1809
|
// Don't hijack Find while typing in another input region.
|
|
1849
|
-
if (ae.closest('.ide-sidebar, .git-panel,
|
|
1810
|
+
if (ae.closest('.ide-sidebar, .git-panel, dialog, input, textarea, [contenteditable="true"]')) return;
|
|
1850
1811
|
}
|
|
1851
1812
|
e.preventDefault();
|
|
1852
1813
|
e.stopPropagation();
|
|
@@ -2089,40 +2050,53 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2089
2050
|
// still deferring, or degraded to local, holds its own buffer — a peer save
|
|
2090
2051
|
// is an external change for it, handled by the files_changed path.
|
|
2091
2052
|
if (typeof CollaborationService === 'undefined' || !CollaborationService.isAttached(path)) return;
|
|
2092
|
-
|
|
2093
|
-
var st = EditorStore.getState();
|
|
2094
|
-
var changed = false;
|
|
2095
|
-
var newPanes = st.panes.map(function (p) {
|
|
2096
|
-
return Object.assign({}, p, {
|
|
2097
|
-
tabs: p.tabs.map(function (t) {
|
|
2098
|
-
if (t.path !== path || !t.dirty) return t;
|
|
2099
|
-
changed = true;
|
|
2100
|
-
return Object.assign({}, t, { dirty: false, cleanContent: t.content });
|
|
2101
|
-
})
|
|
2102
|
-
});
|
|
2103
|
-
});
|
|
2104
|
-
if (changed) EditorStore.setState({ panes: newPanes });
|
|
2105
|
-
|
|
2106
|
-
// The CRDT kept our buffer identical to what the peer just wrote, so the
|
|
2107
|
-
// buffer is the new on-disk truth — refresh the external-change baseline.
|
|
2108
|
-
var _savedTab = null;
|
|
2109
|
-
newPanes.forEach(function (p) {
|
|
2110
|
-
p.tabs.forEach(function (t) { if (t.path === path) _savedTab = t; });
|
|
2111
|
-
});
|
|
2112
|
-
if (_savedTab && typeof _savedTab.content === 'string') {
|
|
2113
|
-
lastDiskContentRef.current[path] = _savedTab.content.replace(/\r\n/g, '\n');
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
// Reset the AVI clean baseline so undo past this peer's save shows dirty correctly.
|
|
2117
|
-
var _modelEntry = window.__mbeditorModels && window.__mbeditorModels[path];
|
|
2118
|
-
if (_modelEntry && _modelEntry.model && !_modelEntry.model.isDisposed()) {
|
|
2119
|
-
_modelEntry.cleanVersionId = _modelEntry.model.getAlternativeVersionId();
|
|
2120
|
-
}
|
|
2053
|
+
markCollabTabsClean(path);
|
|
2121
2054
|
}
|
|
2122
2055
|
WebSocketService.onFileSaved(handleFileSaved);
|
|
2123
2056
|
return function () { WebSocketService.offFileSaved(handleFileSaved); };
|
|
2124
2057
|
}, []);
|
|
2125
2058
|
|
|
2059
|
+
// An attached tab's buffer now equals disk (a peer saved it, or an external
|
|
2060
|
+
// write converged through the shared doc): clear dirty, rebaseline. content,
|
|
2061
|
+
// when given, is the new disk text and replaces tab.content, which lags the
|
|
2062
|
+
// model by the 250 ms content sync and is never synced for a background tab.
|
|
2063
|
+
function markCollabTabsClean(path, content) {
|
|
2064
|
+
var st = EditorStore.getState();
|
|
2065
|
+
var changed = false;
|
|
2066
|
+
var newPanes = st.panes.map(function (p) {
|
|
2067
|
+
return Object.assign({}, p, {
|
|
2068
|
+
tabs: p.tabs.map(function (t) {
|
|
2069
|
+
if (t.path !== path) return t;
|
|
2070
|
+
var next = typeof content === 'string' ? content : t.content;
|
|
2071
|
+
if (!t.dirty && t.content === next) return t;
|
|
2072
|
+
changed = true;
|
|
2073
|
+
return Object.assign({}, t, { dirty: false, content: next, cleanContent: next });
|
|
2074
|
+
})
|
|
2075
|
+
});
|
|
2076
|
+
});
|
|
2077
|
+
// The banner asked about disk content the buffer now holds.
|
|
2078
|
+
var reloads = st.pendingReloads || [];
|
|
2079
|
+
var keptReloads = reloads.filter(function (r) { return r.path !== path; });
|
|
2080
|
+
var update = {};
|
|
2081
|
+
if (changed) update.panes = newPanes;
|
|
2082
|
+
if (keptReloads.length !== reloads.length) update.pendingReloads = keptReloads;
|
|
2083
|
+
if (update.panes || update.pendingReloads) EditorStore.setState(update);
|
|
2084
|
+
|
|
2085
|
+
var _savedTab = null;
|
|
2086
|
+
newPanes.forEach(function (p) {
|
|
2087
|
+
p.tabs.forEach(function (t) { if (t.path === path) _savedTab = t; });
|
|
2088
|
+
});
|
|
2089
|
+
if (_savedTab && typeof _savedTab.content === 'string') {
|
|
2090
|
+
lastDiskContentRef.current[path] = _savedTab.content.replace(/\r\n/g, '\n');
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
// Reset the AVI clean baseline so undo past this point shows dirty correctly.
|
|
2094
|
+
var _modelEntry = window.__mbeditorModels && window.__mbeditorModels[path];
|
|
2095
|
+
if (_modelEntry && _modelEntry.model && !_modelEntry.model.isDisposed()) {
|
|
2096
|
+
_modelEntry.cleanVersionId = _modelEntry.model.getAlternativeVersionId();
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2126
2100
|
// onlyPaths: when the trigger names the files that changed (the
|
|
2127
2101
|
// files_changed push always does — it only ever announces mbeditor's own
|
|
2128
2102
|
// writes), restrict the check to open tabs on those paths. The old
|
|
@@ -2157,16 +2131,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2157
2131
|
fileTabs.forEach(function (pt) {
|
|
2158
2132
|
var savedAt = recentSavesRef.current[pt.tab.path];
|
|
2159
2133
|
if (savedAt && Date.now() - savedAt < 3000) return;
|
|
2160
|
-
// A collaboratively-bound file's live buffer is the shared CRDT, kept
|
|
2161
|
-
// converged across peers and reconciled with disk on save (file_saved).
|
|
2162
|
-
// Re-applying an external on-disk snapshot over it would silently clobber
|
|
2163
|
-
// everyone's shared state, so skip detection here — the CRDT is authoritative
|
|
2164
|
-
// while peers are editing. Intentional local edits (Format/Load) still flow
|
|
2165
|
-
// through the binding and are unaffected.
|
|
2166
|
-
if (typeof CollaborationService !== 'undefined' &&
|
|
2167
|
-
CollaborationService.isAttached(pt.tab.path)) {
|
|
2168
|
-
return;
|
|
2169
|
-
}
|
|
2170
2134
|
FileService.getFile(pt.tab.path, { allowMissing: true }).then(function (data) {
|
|
2171
2135
|
if (!data || typeof data.content !== 'string') return;
|
|
2172
2136
|
// Re-read the tab: the snapshot above predates the fetch, and edits or
|
|
@@ -2180,7 +2144,18 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2180
2144
|
if (savedAgain && Date.now() - savedAgain < 3000) return;
|
|
2181
2145
|
pt = { paneId: pt.paneId, tab: liveTab };
|
|
2182
2146
|
var serverNorm = data.content.replace(/\r\n/g, '\n');
|
|
2183
|
-
|
|
2147
|
+
// An attached tab's buffer is the shared doc, which a peer may have
|
|
2148
|
+
// changed without this tab's content catching up; read the model.
|
|
2149
|
+
var attached = typeof CollaborationService !== 'undefined' &&
|
|
2150
|
+
CollaborationService.isAttached(pt.tab.path);
|
|
2151
|
+
var _m = attached && window.__mbeditorModels && window.__mbeditorModels[pt.tab.path];
|
|
2152
|
+
var liveText = _m && _m.model && !_m.model.isDisposed() ? _m.model.getValue() : pt.tab.content;
|
|
2153
|
+
var tabNorm = (liveText || '').replace(/\r\n/g, '\n');
|
|
2154
|
+
if (attached && serverNorm === tabNorm) {
|
|
2155
|
+
// The shared doc already carries the write (another client applied it).
|
|
2156
|
+
markCollabTabsClean(pt.tab.path, data.content);
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2184
2159
|
|
|
2185
2160
|
// Did the file on disk actually change? Compare disk against the last
|
|
2186
2161
|
// disk content we saw, never against the buffer — a dirty buffer
|
|
@@ -2192,11 +2167,27 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2192
2167
|
var prevDisk = lastDiskContentRef.current[pt.tab.path];
|
|
2193
2168
|
lastDiskContentRef.current[pt.tab.path] = serverNorm;
|
|
2194
2169
|
if (serverNorm === tabNorm) return;
|
|
2195
|
-
|
|
2170
|
+
// An attached tab's dirty flag only moves while its editor is mounted,
|
|
2171
|
+
// so peer edits to a background tab leave it "clean". Unsaved shared
|
|
2172
|
+
// edits are the text differing from the last disk content we know.
|
|
2173
|
+
var dirty = pt.tab.dirty;
|
|
2174
|
+
if (attached && !dirty) {
|
|
2175
|
+
dirty = tabNorm !== (prevDisk !== undefined ? prevDisk : (pt.tab.content || '').replace(/\r\n/g, '\n'));
|
|
2176
|
+
}
|
|
2177
|
+
if (prevDisk === undefined && dirty && !attached) return;
|
|
2196
2178
|
if (prevDisk === undefined) prevDisk = tabNorm;
|
|
2197
2179
|
if (serverNorm === prevDisk) return;
|
|
2198
2180
|
|
|
2199
|
-
if (!
|
|
2181
|
+
if (!dirty && attached) {
|
|
2182
|
+
// Never set the tab content here: EditorPanel would push the whole
|
|
2183
|
+
// file through the binding on every client and duplicate it. The
|
|
2184
|
+
// baseline only advances once the shared doc converges, so a write
|
|
2185
|
+
// that never lands is retried by the next check.
|
|
2186
|
+
lastDiskContentRef.current[pt.tab.path] = prevDisk;
|
|
2187
|
+
CollaborationService.applyDiskContent(pt.tab.path, data.content, function () {
|
|
2188
|
+
markCollabTabsClean(pt.tab.path, data.content);
|
|
2189
|
+
});
|
|
2190
|
+
} else if (!dirty) {
|
|
2200
2191
|
EditorStore.setState({
|
|
2201
2192
|
panes: EditorStore.getState().panes.map(function (p) {
|
|
2202
2193
|
if (p.id !== pt.paneId) return p;
|
|
@@ -2237,6 +2228,11 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2237
2228
|
serverContent: data.content
|
|
2238
2229
|
}])
|
|
2239
2230
|
});
|
|
2231
|
+
if (attached) {
|
|
2232
|
+
CollaborationService.whenContentMatches(pt.tab.path, data.content, function () {
|
|
2233
|
+
markCollabTabsClean(pt.tab.path, data.content);
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2240
2236
|
}
|
|
2241
2237
|
}
|
|
2242
2238
|
})["catch"](function () {});
|
|
@@ -2292,7 +2288,13 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2292
2288
|
GitService.fetchStatus()["catch"](function () {});
|
|
2293
2289
|
};
|
|
2294
2290
|
var intervalId = setInterval(refresh, 5000);
|
|
2295
|
-
|
|
2291
|
+
// files_changed pushes are dropped while hidden, so catch the open tabs up
|
|
2292
|
+
// here. The check writes state only for a tab whose disk content moved.
|
|
2293
|
+
var onVisible = function () {
|
|
2294
|
+
if (document.hidden) return;
|
|
2295
|
+
fullRefresh();
|
|
2296
|
+
checkOpenTabsForExternalChanges();
|
|
2297
|
+
};
|
|
2296
2298
|
document.addEventListener('visibilitychange', onVisible);
|
|
2297
2299
|
window.addEventListener('focus', fullRefresh);
|
|
2298
2300
|
return function () {
|
|
@@ -2474,10 +2476,15 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2474
2476
|
return tab.dirty;
|
|
2475
2477
|
}).length;
|
|
2476
2478
|
|
|
2477
|
-
if (dirtyCount === 0) return true;
|
|
2479
|
+
if (dirtyCount === 0) return Promise.resolve(true);
|
|
2478
2480
|
|
|
2479
2481
|
var dirtyLabel = dirtyCount === 1 ? "1 unsaved editor has changes." : dirtyCount + " unsaved editors have changes.";
|
|
2480
|
-
return window.confirm(
|
|
2482
|
+
return window.MbeditorDialogs.confirm({
|
|
2483
|
+
title: "Close " + scopeLabel + "?",
|
|
2484
|
+
message: dirtyLabel + " Their changes will be lost.",
|
|
2485
|
+
confirmLabel: "Close without saving",
|
|
2486
|
+
danger: true
|
|
2487
|
+
});
|
|
2481
2488
|
};
|
|
2482
2489
|
|
|
2483
2490
|
var handleCloseAllEditors = function handleCloseAllEditors() {
|
|
@@ -2485,13 +2492,14 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2485
2492
|
return pane.tabs;
|
|
2486
2493
|
});
|
|
2487
2494
|
if (allTabs.length === 0) return;
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
+
confirmBulkClose(allTabs, "all editors").then(function (ok) {
|
|
2496
|
+
if (!ok) return;
|
|
2497
|
+
TabManager.closeAllTabs();
|
|
2498
|
+
forgetClosedTabs();
|
|
2499
|
+
setClosingTabId(null);
|
|
2500
|
+
setClosingPaneId(null);
|
|
2501
|
+
EditorStore.setStatus("Closed " + allTabs.length + " editor" + (allTabs.length === 1 ? "" : "s"), "info");
|
|
2502
|
+
});
|
|
2495
2503
|
};
|
|
2496
2504
|
|
|
2497
2505
|
var handleCloseEditorsInGroup = function handleCloseEditorsInGroup(paneId) {
|
|
@@ -2499,13 +2507,14 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2499
2507
|
return p.id === paneId;
|
|
2500
2508
|
});
|
|
2501
2509
|
if (!pane || pane.tabs.length === 0) return;
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2510
|
+
confirmBulkClose(pane.tabs, "all editors in Group " + paneId).then(function (ok) {
|
|
2511
|
+
if (!ok) return;
|
|
2512
|
+
TabManager.closeAllTabsInPane(paneId);
|
|
2513
|
+
forgetClosedTabs();
|
|
2514
|
+
setClosingTabId(null);
|
|
2515
|
+
setClosingPaneId(null);
|
|
2516
|
+
EditorStore.setStatus("Closed " + pane.tabs.length + " editor" + (pane.tabs.length === 1 ? "" : "s") + " in Group " + paneId, "info");
|
|
2517
|
+
});
|
|
2509
2518
|
};
|
|
2510
2519
|
|
|
2511
2520
|
var handleCloseOtherTabs = function handleCloseOtherTabs(paneId, keepId) {
|
|
@@ -2513,10 +2522,12 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2513
2522
|
if (!pane) return;
|
|
2514
2523
|
var others = pane.tabs.filter(function (t) { return t.id !== keepId; });
|
|
2515
2524
|
if (others.length === 0) return;
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2525
|
+
confirmBulkClose(others, "other editors").then(function (ok) {
|
|
2526
|
+
if (!ok) return;
|
|
2527
|
+
TabManager.closeOtherTabsInPane(paneId, keepId);
|
|
2528
|
+
forgetClosedTabs();
|
|
2529
|
+
EditorStore.setStatus("Closed " + others.length + " editor" + (others.length === 1 ? "" : "s"), "info");
|
|
2530
|
+
});
|
|
2520
2531
|
};
|
|
2521
2532
|
|
|
2522
2533
|
var handleCloseSavedTabs = function handleCloseSavedTabs(paneId) {
|
|
@@ -2534,9 +2545,18 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2534
2545
|
// Returns a promise that rejects with {cancelled: true} when the user backs
|
|
2535
2546
|
// out, so close-flows can abort instead of discarding.
|
|
2536
2547
|
var saveUntitledTab = function saveUntitledTab(paneId, tab, opts) {
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2548
|
+
return window.MbeditorDialogs.prompt({
|
|
2549
|
+
title: 'Save as',
|
|
2550
|
+
message: 'Path relative to the workspace root:',
|
|
2551
|
+
value: tab.name + '.txt',
|
|
2552
|
+
confirmLabel: 'Save'
|
|
2553
|
+
}).then(function (input) {
|
|
2554
|
+
if (!input || !input.trim()) return Promise.reject({ cancelled: true });
|
|
2555
|
+
return writeUntitledTab(paneId, tab, opts, input.trim().replace(/^\/+/, ''));
|
|
2556
|
+
});
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
var writeUntitledTab = function writeUntitledTab(paneId, tab, opts, newPath) {
|
|
2540
2560
|
var startedAt = Date.now();
|
|
2541
2561
|
return FileService.saveFile(newPath, tab.content).then(function () {
|
|
2542
2562
|
var audit = window.MbeditorAudit;
|
|
@@ -2710,6 +2730,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2710
2730
|
};
|
|
2711
2731
|
|
|
2712
2732
|
var RAILS_MAX_RESOURCES = 10;
|
|
2733
|
+
var RAILS_CONVENTION_PATH = /^(app\/(controllers|models|views|helpers)|test|spec)\//;
|
|
2713
2734
|
|
|
2714
2735
|
// Map resource label → representative path (capped at RAILS_MAX_RESOURCES, focused pane first)
|
|
2715
2736
|
// Memoised: all three of these walk every tab in every pane and were rebuilt
|
|
@@ -2725,15 +2746,21 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2725
2746
|
return a.id === p.activeTabId ? -1 : b.id === p.activeTabId ? 1 : 0;
|
|
2726
2747
|
});
|
|
2727
2748
|
tabs.forEach(function(t) {
|
|
2728
|
-
if (Object.keys(deps).length >= RAILS_MAX_RESOURCES) return;
|
|
2729
2749
|
if (!t.path || t.path.startsWith('mbeditor://')) return;
|
|
2730
2750
|
var label = resourceLabelFromPath(t.path);
|
|
2731
|
-
if (
|
|
2751
|
+
if (!label) return;
|
|
2752
|
+
if (!deps[label]) {
|
|
2753
|
+
if (Object.keys(deps).length < RAILS_MAX_RESOURCES) deps[label] = t.path;
|
|
2754
|
+
} else if (!RAILS_CONVENTION_PATH.test(deps[label]) && RAILS_CONVENTION_PATH.test(t.path)) {
|
|
2755
|
+
// A custom-path file's lookup returns only its custom group; a
|
|
2756
|
+
// conventional file's returns controller, model, views and custom.
|
|
2757
|
+
deps[label] = t.path;
|
|
2758
|
+
}
|
|
2732
2759
|
});
|
|
2733
2760
|
});
|
|
2734
2761
|
return deps;
|
|
2735
2762
|
}, [state.panes, state.focusedPaneId, customPaths]);
|
|
2736
|
-
var railsResourceDepStr = Object.keys(railsResourceDeps).sort().join('|');
|
|
2763
|
+
var railsResourceDepStr = Object.keys(railsResourceDeps).sort().map(function(k) { return k + '=' + railsResourceDeps[k]; }).join('|');
|
|
2737
2764
|
|
|
2738
2765
|
var railsOverflow = useMemo(function() {
|
|
2739
2766
|
var all = {};
|
|
@@ -2757,6 +2784,14 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2757
2784
|
return set;
|
|
2758
2785
|
}, [state.panes]);
|
|
2759
2786
|
|
|
2787
|
+
var openPaths = useMemo(function() {
|
|
2788
|
+
var set = {};
|
|
2789
|
+
state.panes.forEach(function(p) {
|
|
2790
|
+
p.tabs.forEach(function(t) { if (t.path) set[t.path] = true; });
|
|
2791
|
+
});
|
|
2792
|
+
return set;
|
|
2793
|
+
}, [state.panes]);
|
|
2794
|
+
|
|
2760
2795
|
useEffect(function() {
|
|
2761
2796
|
if (activeSidebarTab !== 'rails') return;
|
|
2762
2797
|
var labels = Object.keys(railsResourceDeps);
|
|
@@ -2804,7 +2839,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2804
2839
|
var _presenceFileFor = function (tab) {
|
|
2805
2840
|
if (!tab || !tab.path) return null;
|
|
2806
2841
|
var p = tab.path;
|
|
2807
|
-
if (tab.isDiff || tab.isCombinedDiff || tab.
|
|
2842
|
+
if (tab.isDiff || tab.isCombinedDiff || tab.isPreview || tab.isChangelog || tab.isCombinedView) return null;
|
|
2808
2843
|
if (p.indexOf('diff://') === 0 || p.indexOf('combined-diff://') === 0 || p.indexOf('mbeditor://') === 0) return null;
|
|
2809
2844
|
if (p.indexOf('::preview') !== -1) return null;
|
|
2810
2845
|
return p;
|
|
@@ -3096,9 +3131,9 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3096
3131
|
// the popover — so the close is delayed and cancelled by either one's
|
|
3097
3132
|
// onMouseEnter. Click still toggles it directly, which is what makes it
|
|
3098
3133
|
// reachable without a mouse at all.
|
|
3099
|
-
// The anchor, not a boolean:
|
|
3100
|
-
//
|
|
3101
|
-
// painted under the editor whatever its z-index.
|
|
3134
|
+
// The anchor, not a boolean: it is positioned from the button's rect. It
|
|
3135
|
+
// renders as a manual popover (top layer) — as an ordinary child of the
|
|
3136
|
+
// title bar it was painted under the editor whatever its z-index.
|
|
3102
3137
|
var _useStateOverflow = useState(null);
|
|
3103
3138
|
var collabOverflowAnchor = _useStateOverflow[0];
|
|
3104
3139
|
var setCollabOverflowAnchor = _useStateOverflow[1];
|
|
@@ -3130,7 +3165,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3130
3165
|
var setActiveEOL = _useState31e[1];
|
|
3131
3166
|
|
|
3132
3167
|
useEffect(function () {
|
|
3133
|
-
if (!gitAvailable || !activeTab || activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView ||
|
|
3168
|
+
if (!gitAvailable || !activeTab || activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView || !activeTab.path || activeTab.path.indexOf('://') >= 0) {
|
|
3134
3169
|
setActiveFileCommit(null);
|
|
3135
3170
|
return;
|
|
3136
3171
|
}
|
|
@@ -3152,7 +3187,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3152
3187
|
// buffer for '\r' there was pure waste — typing cannot change the line ending.
|
|
3153
3188
|
useEffect(function () {
|
|
3154
3189
|
if (!activeTab || typeof activeTab.content !== 'string' ||
|
|
3155
|
-
activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView || activeTab.
|
|
3190
|
+
activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView || activeTab.isPreview) {
|
|
3156
3191
|
setActiveEOL(null);
|
|
3157
3192
|
return;
|
|
3158
3193
|
}
|
|
@@ -3167,7 +3202,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3167
3202
|
|
|
3168
3203
|
useEffect(function () {
|
|
3169
3204
|
if (!activeTab || typeof activeTab.content !== 'string') return;
|
|
3170
|
-
if (activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView
|
|
3205
|
+
if (activeTab.isDiff || activeTab.isCombinedDiff || activeTab.isCombinedView) return;
|
|
3171
3206
|
if (isRubyPath(activeTab.path) && !rubocopAvailable) return;
|
|
3172
3207
|
if (activeTab.path.endsWith('.haml') && !hamlLintAvailable) return;
|
|
3173
3208
|
|
|
@@ -3177,63 +3212,13 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3177
3212
|
return;
|
|
3178
3213
|
}
|
|
3179
3214
|
|
|
3180
|
-
_debouncedAutoLint(activeTab
|
|
3215
|
+
_debouncedAutoLint(activeTab);
|
|
3181
3216
|
|
|
3182
3217
|
return function () {
|
|
3183
3218
|
_debouncedAutoLint.cancel();
|
|
3184
3219
|
};
|
|
3185
3220
|
}, [focusedPane ? focusedPane.id : null, activeTab ? activeTab.id : null, activeTab ? activeTab.content : null, rubocopAvailable, hamlLintAvailable, editorPrefs.rubocopLintEnabled]);
|
|
3186
3221
|
|
|
3187
|
-
var handleOpenCommitGraph = function handleOpenCommitGraph() {
|
|
3188
|
-
var paneId = state.focusedPaneId || 1;
|
|
3189
|
-
var tabId = 'mbeditor://commit-graph';
|
|
3190
|
-
|
|
3191
|
-
var pane = state.panes.find(function(p) { return p.id === paneId; });
|
|
3192
|
-
var existing = pane && pane.tabs.find(function(t) { return t.id === tabId; });
|
|
3193
|
-
if (existing) {
|
|
3194
|
-
TabManager.switchTab(paneId, tabId);
|
|
3195
|
-
return;
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
var newTab = {
|
|
3199
|
-
id: tabId,
|
|
3200
|
-
path: tabId,
|
|
3201
|
-
name: 'Commit Graph',
|
|
3202
|
-
dirty: false,
|
|
3203
|
-
content: '', // not used
|
|
3204
|
-
isCommitGraph: true
|
|
3205
|
-
};
|
|
3206
|
-
|
|
3207
|
-
var newPanes = state.panes.map(function(p) {
|
|
3208
|
-
if (p.id === paneId) {
|
|
3209
|
-
return Object.assign({}, p, { tabs: p.tabs.concat(newTab), activeTabId: tabId });
|
|
3210
|
-
}
|
|
3211
|
-
return p;
|
|
3212
|
-
});
|
|
3213
|
-
|
|
3214
|
-
EditorStore.setState({ panes: newPanes, focusedPaneId: paneId, activeTabId: tabId });
|
|
3215
|
-
|
|
3216
|
-
// Fetch data asynchronously
|
|
3217
|
-
GitService.fetchCommitGraph().then(function(data) {
|
|
3218
|
-
var s = EditorStore.getState();
|
|
3219
|
-
var p = s.panes.find(function(p) { return p.id === paneId; });
|
|
3220
|
-
if (!p) return;
|
|
3221
|
-
var t = p.tabs.find(function(t) { return t.id === tabId; });
|
|
3222
|
-
if (t) {
|
|
3223
|
-
var newPanes2 = s.panes.map(function(p2) {
|
|
3224
|
-
if (p2.id === paneId) {
|
|
3225
|
-
var newTabs = p2.tabs.map(function(t2) {
|
|
3226
|
-
return t2.id === tabId ? Object.assign({}, t2, { commits: data.commits }) : t2;
|
|
3227
|
-
});
|
|
3228
|
-
return Object.assign({}, p2, { tabs: newTabs });
|
|
3229
|
-
}
|
|
3230
|
-
return p2;
|
|
3231
|
-
});
|
|
3232
|
-
EditorStore.setState({ panes: newPanes2 });
|
|
3233
|
-
}
|
|
3234
|
-
});
|
|
3235
|
-
};
|
|
3236
|
-
|
|
3237
3222
|
// Format-on-save helper: returns a Promise resolving to the formatted
|
|
3238
3223
|
// content, or null when no formatter applies / formatting fails (the save
|
|
3239
3224
|
// then proceeds with the original content — saving must never be blocked
|
|
@@ -3451,6 +3436,14 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3451
3436
|
}
|
|
3452
3437
|
|
|
3453
3438
|
function handleDiscardAndReload(reload) {
|
|
3439
|
+
// Every peer sees this banner; see applyDiskContent for why only one may write.
|
|
3440
|
+
if (typeof CollaborationService !== 'undefined' && CollaborationService.applyDiskContent(
|
|
3441
|
+
reload.path, reload.serverContent,
|
|
3442
|
+
function () { markCollabTabsClean(reload.path, reload.serverContent); }
|
|
3443
|
+
)) {
|
|
3444
|
+
dismissPendingReload(reload);
|
|
3445
|
+
return;
|
|
3446
|
+
}
|
|
3454
3447
|
EditorStore.setState({
|
|
3455
3448
|
panes: EditorStore.getState().panes.map(function (p) {
|
|
3456
3449
|
if (p.id !== reload.paneId) return p;
|
|
@@ -3507,7 +3500,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3507
3500
|
});
|
|
3508
3501
|
});
|
|
3509
3502
|
Promise.allSettled(promises).then(function (results) {
|
|
3510
|
-
var saved = dirtyTabs.filter(function (
|
|
3503
|
+
var saved = dirtyTabs.filter(function (_tab, i) { return results[i].status === "fulfilled"; });
|
|
3511
3504
|
// Object.create(null): these keys are file paths, and a file called
|
|
3512
3505
|
// "constructor" would otherwise test as present against Object.prototype
|
|
3513
3506
|
// and have its tab marked clean without ever being written.
|
|
@@ -3607,7 +3600,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3607
3600
|
setTreeData(_treeUpdater(data || []));
|
|
3608
3601
|
checkOpenTabsForExternalChanges();
|
|
3609
3602
|
EditorStore.setStatus("Workspace refreshed", "success");
|
|
3610
|
-
})["catch"](function (
|
|
3603
|
+
})["catch"](function () {
|
|
3611
3604
|
EditorStore.setStatus("Failed to refresh workspace", "error");
|
|
3612
3605
|
})["finally"](function () {
|
|
3613
3606
|
setLoading(function (prev) {
|
|
@@ -3988,11 +3981,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
3988
3981
|
EditorStore.setState({ searchResults: [], searchHasMore: false });
|
|
3989
3982
|
};
|
|
3990
3983
|
|
|
3991
|
-
var execSearch = function execSearch(e) {
|
|
3992
|
-
e.preventDefault();
|
|
3993
|
-
_debouncedSearch(searchQuery);
|
|
3994
|
-
};
|
|
3995
|
-
|
|
3996
3984
|
var handleReplaceAll = function handleReplaceAll() {
|
|
3997
3985
|
if (!searchQuery.trim()) {
|
|
3998
3986
|
EditorStore.setStatus("Enter a search query first", "error");
|
|
@@ -4003,7 +3991,11 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4003
3991
|
if (matchCount > 0) {
|
|
4004
3992
|
confirmMsg += " (" + matchCount + (searchHasMore ? "+" : "") + " match" + (matchCount !== 1 ? "es" : "") + " across files)";
|
|
4005
3993
|
}
|
|
4006
|
-
|
|
3994
|
+
window.MbeditorDialogs.confirm({ title: "Replace all", message: confirmMsg, confirmLabel: "Replace all", danger: true })
|
|
3995
|
+
.then(function (ok) { if (ok) runReplaceAll(); });
|
|
3996
|
+
};
|
|
3997
|
+
|
|
3998
|
+
var runReplaceAll = function runReplaceAll() {
|
|
4007
3999
|
|
|
4008
4000
|
setReplaceLoading(true);
|
|
4009
4001
|
EditorStore.setStatus("Replacing…", "info");
|
|
@@ -4105,16 +4097,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4105
4097
|
document.body.style.userSelect = 'none';
|
|
4106
4098
|
};
|
|
4107
4099
|
|
|
4108
|
-
var handleSelectCommit = function handleSelectCommit(commit) {
|
|
4109
|
-
setSelectedCommit(commit);
|
|
4110
|
-
setCommitDetailFiles(null);
|
|
4111
|
-
GitService.fetchCommitDetail(commit.hash).then(function (data) {
|
|
4112
|
-
setCommitDetailFiles(data.files || []);
|
|
4113
|
-
}).catch(function () {
|
|
4114
|
-
setCommitDetailFiles([]);
|
|
4115
|
-
});
|
|
4116
|
-
};
|
|
4117
|
-
|
|
4118
4100
|
var handleToggleSection = function handleToggleSection(sectionKey, isCollapsed) {
|
|
4119
4101
|
setCollapsedSections(function (prev) {
|
|
4120
4102
|
return _extends({}, prev, _defineProperty({}, sectionKey, isCollapsed));
|
|
@@ -4308,6 +4290,10 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4308
4290
|
(n.children || []).forEach(walk);
|
|
4309
4291
|
};
|
|
4310
4292
|
(actsOnSelection(node) ? Array.from(selectedPaths) : [node.path]).forEach(function (p) { walk(byPath[p]); });
|
|
4293
|
+
openCombinedTab(files);
|
|
4294
|
+
};
|
|
4295
|
+
|
|
4296
|
+
var openCombinedTab = function openCombinedTab(files) {
|
|
4311
4297
|
if (!files.length) { EditorStore.setStatus('No files to show', 'info'); return; }
|
|
4312
4298
|
var total = files.length;
|
|
4313
4299
|
var id = 'mbeditor://combined/' + Date.now();
|
|
@@ -4321,6 +4307,22 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4321
4307
|
});
|
|
4322
4308
|
};
|
|
4323
4309
|
|
|
4310
|
+
// Every plain file tab across both panes, in tab order. Virtual tabs (diffs,
|
|
4311
|
+
// previews, settings, other combined views) carry a scheme or a flag.
|
|
4312
|
+
var handleOpenEditorsCombined = function handleOpenEditorsCombined() {
|
|
4313
|
+
var seen = {};
|
|
4314
|
+
var files = [];
|
|
4315
|
+
EditorStore.getState().panes.forEach(function (p) {
|
|
4316
|
+
p.tabs.forEach(function (t) {
|
|
4317
|
+
if (!t.path || t.isSettings || t.isUntitled || t.isImage || t.isDiff || t.isCombinedDiff || t.isCombinedView || t.isChangelog || t.isPreview) return;
|
|
4318
|
+
if (t.path.indexOf('://') !== -1 || /::preview$/.test(t.path) || seen[t.path]) return;
|
|
4319
|
+
seen[t.path] = true;
|
|
4320
|
+
files.push(t.path);
|
|
4321
|
+
});
|
|
4322
|
+
});
|
|
4323
|
+
openCombinedTab(files);
|
|
4324
|
+
};
|
|
4325
|
+
|
|
4324
4326
|
var handleDownloadFile = function handleDownloadFile(node) {
|
|
4325
4327
|
if (!node) return;
|
|
4326
4328
|
var isMultiSelect = actsOnSelection(node);
|
|
@@ -4394,7 +4396,9 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4394
4396
|
};
|
|
4395
4397
|
|
|
4396
4398
|
var openContextMenu = function openContextMenu(e, node) {
|
|
4397
|
-
|
|
4399
|
+
// e.keyboard: opened by Shift+F10 / the menu key (FileTree), so focus
|
|
4400
|
+
// starts on the first item instead of the menu itself.
|
|
4401
|
+
setContextMenu({ x: e.clientX, y: e.clientY, node: node, keyboard: !!e.keyboard });
|
|
4398
4402
|
if (!actsOnSelection(node)) handleNodeSelect(node);
|
|
4399
4403
|
};
|
|
4400
4404
|
|
|
@@ -4824,8 +4828,15 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4824
4828
|
});
|
|
4825
4829
|
|
|
4826
4830
|
var label = pathsToDelete.length === 1 ? pathsToDelete[0] : pathsToDelete.length + ' items';
|
|
4827
|
-
|
|
4828
|
-
|
|
4831
|
+
window.MbeditorDialogs.confirm({
|
|
4832
|
+
title: 'Delete ' + label + '?',
|
|
4833
|
+
message: 'This cannot be undone.',
|
|
4834
|
+
confirmLabel: 'Delete',
|
|
4835
|
+
danger: true
|
|
4836
|
+
}).then(function (ok) { if (ok) runDelete(pathsToDelete, label); });
|
|
4837
|
+
};
|
|
4838
|
+
|
|
4839
|
+
var runDelete = function runDelete(pathsToDelete, label) {
|
|
4829
4840
|
|
|
4830
4841
|
// Computed against the pre-delete tree, since the deleted paths' siblings
|
|
4831
4842
|
// are only known before the tree is refreshed.
|
|
@@ -4860,10 +4871,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
4860
4871
|
|
|
4861
4872
|
var projectSectionTitle = deriveProjectRootName().toUpperCase();
|
|
4862
4873
|
var selectedTreePath = selectedTreeNode ? selectedTreeNode.path : null;
|
|
4863
|
-
var isRuby = activeTab && isRubyPath(activeTab.path);
|
|
4864
|
-
var isHaml = activeTab && activeTab.path.endsWith('.haml');
|
|
4865
|
-
var isPrettierable = activeTab && SUPPORTED_PRETTIER_EXTS.includes(activeTab.path.split('.').pop().toLowerCase());
|
|
4866
|
-
var rubocopLintOn = editorPrefs.rubocopLintEnabled !== false;
|
|
4867
4874
|
var canLintAndFormat = !!activeTab;
|
|
4868
4875
|
var hasGitBranch = !!(state.gitBranch && state.gitBranch.trim());
|
|
4869
4876
|
|
|
@@ -5220,6 +5227,13 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5220
5227
|
)
|
|
5221
5228
|
),
|
|
5222
5229
|
React.createElement("div", { className: "statusbar-sep" }),
|
|
5230
|
+
React.createElement(
|
|
5231
|
+
"button",
|
|
5232
|
+
{ type: "button", className: "statusbar-btn", onClick: function () { return setShowAiModal(true); }, title: "Export project for AI / apply an AI diff" },
|
|
5233
|
+
React.createElement("i", { className: "fas fa-robot" }),
|
|
5234
|
+
!toolbarIconOnly && " AI"
|
|
5235
|
+
),
|
|
5236
|
+
React.createElement("div", { className: "statusbar-sep" }),
|
|
5223
5237
|
React.createElement(
|
|
5224
5238
|
"button",
|
|
5225
5239
|
{ type: "button", className: "statusbar-btn", onClick: function () { return setShowHelp(true); }, title: "Keyboard shortcuts & help" },
|
|
@@ -5248,8 +5262,9 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5248
5262
|
)
|
|
5249
5263
|
),
|
|
5250
5264
|
collabOverflowOpen && React.createElement(
|
|
5251
|
-
|
|
5265
|
+
window.Popover,
|
|
5252
5266
|
{
|
|
5267
|
+
mode: "manual",
|
|
5253
5268
|
className: "collab-overflow-popover",
|
|
5254
5269
|
style: { top: collabOverflowAnchor.top + 'px', right: collabOverflowAnchor.right + 'px' },
|
|
5255
5270
|
onMouseEnter: cancelOverflowClose,
|
|
@@ -5287,8 +5302,8 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5287
5302
|
var idle = typeof stats.idle === 'number' ? stats.idle : null;
|
|
5288
5303
|
|
|
5289
5304
|
return React.createElement(
|
|
5290
|
-
|
|
5291
|
-
{ className: 'collab-hovercard', style: { top: collabHover.top + 'px', right: collabHover.right + 'px' } },
|
|
5305
|
+
window.Popover,
|
|
5306
|
+
{ mode: 'manual', className: 'collab-hovercard', style: { top: collabHover.top + 'px', right: collabHover.right + 'px' } },
|
|
5292
5307
|
React.createElement(
|
|
5293
5308
|
'div',
|
|
5294
5309
|
{ className: 'collab-hovercard-name' },
|
|
@@ -5322,12 +5337,14 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5322
5337
|
collabDiagOpen && (function () {
|
|
5323
5338
|
var d = CollaborationService.diagnostics();
|
|
5324
5339
|
return React.createElement(
|
|
5325
|
-
|
|
5326
|
-
{
|
|
5327
|
-
|
|
5328
|
-
'
|
|
5329
|
-
|
|
5330
|
-
|
|
5340
|
+
window.ModalDialog,
|
|
5341
|
+
{
|
|
5342
|
+
className: 'mbeditor-collab-diag',
|
|
5343
|
+
dialogClassName: 'mb-dialog-light',
|
|
5344
|
+
labelledBy: 'mb-collab-diag-title',
|
|
5345
|
+
onDismiss: function () { setCollabDiagOpen(false); }
|
|
5346
|
+
},
|
|
5347
|
+
React.createElement('div', { className: 'mbeditor-collab-diag-title', id: 'mb-collab-diag-title' }, 'Pair programming status'),
|
|
5331
5348
|
React.createElement(
|
|
5332
5349
|
'ul',
|
|
5333
5350
|
{ className: 'mbeditor-collab-diag-list' },
|
|
@@ -5356,7 +5373,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5356
5373
|
type: 'button', className: 'ide-model-graph-btn',
|
|
5357
5374
|
onClick: function () { setCollabDiagOpen(false); }
|
|
5358
5375
|
}, 'Close')
|
|
5359
|
-
)
|
|
5360
5376
|
);
|
|
5361
5377
|
})(),
|
|
5362
5378
|
showHelp && React.createElement(ShortcutHelp, { onClose: function () { return setShowHelp(false); } }),
|
|
@@ -5463,6 +5479,12 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5463
5479
|
actions: React.createElement(
|
|
5464
5480
|
SectionActionGroup,
|
|
5465
5481
|
{ ariaLabel: "Open editor actions" },
|
|
5482
|
+
React.createElement(SidebarActionButton, {
|
|
5483
|
+
title: "Open all in Combined View",
|
|
5484
|
+
ariaLabel: "Open all open editors in Combined View",
|
|
5485
|
+
iconClass: "fas fa-layer-group",
|
|
5486
|
+
onClick: handleOpenEditorsCombined
|
|
5487
|
+
}),
|
|
5466
5488
|
React.createElement(SidebarActionButton, {
|
|
5467
5489
|
title: "Close all editors",
|
|
5468
5490
|
ariaLabel: "Close all open editors",
|
|
@@ -5952,6 +5974,19 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5952
5974
|
});
|
|
5953
5975
|
}
|
|
5954
5976
|
if (allFiles.length === 0) return null;
|
|
5977
|
+
var openAllBtn = React.createElement(
|
|
5978
|
+
'button',
|
|
5979
|
+
{
|
|
5980
|
+
className: 'rails-schema-btn',
|
|
5981
|
+
title: 'Open all ' + label + ' files',
|
|
5982
|
+
onClick: (function(files) { return function(e) {
|
|
5983
|
+
e.stopPropagation();
|
|
5984
|
+
setShowModelGraphView(false);
|
|
5985
|
+
files.forEach(function(f) { TabManager.openTab(f.path, f.name, null, null, false); });
|
|
5986
|
+
}; })(allFiles)
|
|
5987
|
+
},
|
|
5988
|
+
React.createElement('i', { className: 'fas fa-folder-open' })
|
|
5989
|
+
);
|
|
5955
5990
|
var schemaBtn = React.createElement(
|
|
5956
5991
|
'button',
|
|
5957
5992
|
{
|
|
@@ -5974,7 +6009,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5974
6009
|
key: label,
|
|
5975
6010
|
title: label.toUpperCase(),
|
|
5976
6011
|
isCollapsed: !!railsGroupsCollapsed[label],
|
|
5977
|
-
actions: schemaBtn,
|
|
6012
|
+
actions: React.createElement(React.Fragment, null, openAllBtn, schemaBtn),
|
|
5978
6013
|
onToggle: (function(captured) { return function(isCollapsed) {
|
|
5979
6014
|
setRailsGroupsCollapsed(function(prev) {
|
|
5980
6015
|
var next = Object.assign({}, prev);
|
|
@@ -5990,7 +6025,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
5990
6025
|
return React.createElement(
|
|
5991
6026
|
"div", {
|
|
5992
6027
|
key: f.path,
|
|
5993
|
-
className: "rails-group-item",
|
|
6028
|
+
className: "rails-group-item" + (openPaths[f.path] ? " rails-group-item-open" : ""),
|
|
5994
6029
|
onClick: (function(file) { return function() { handleSelectFile(file.path, file.name); }; })(f),
|
|
5995
6030
|
title: f.path
|
|
5996
6031
|
},
|
|
@@ -6131,12 +6166,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6131
6166
|
)
|
|
6132
6167
|
);
|
|
6133
6168
|
} else if (pActiveTab) {
|
|
6134
|
-
if (pActiveTab.
|
|
6135
|
-
content = React.createElement(window.CommitGraph || CommitGraph, {
|
|
6136
|
-
commits: pActiveTab.commits || [],
|
|
6137
|
-
onSelectCommit: handleSelectCommit
|
|
6138
|
-
});
|
|
6139
|
-
} else if (pActiveTab.isChangelog) {
|
|
6169
|
+
if (pActiveTab.isChangelog) {
|
|
6140
6170
|
content = React.createElement(ChangelogView, {
|
|
6141
6171
|
changelogState: changelogState,
|
|
6142
6172
|
onLoad: function() {
|
|
@@ -6173,7 +6203,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6173
6203
|
paneId: pane.id,
|
|
6174
6204
|
markers: markers[pActiveTab.id] || [],
|
|
6175
6205
|
gitAvailable: gitAvailable,
|
|
6176
|
-
treeData: treeData,
|
|
6177
6206
|
testResult: testResult,
|
|
6178
6207
|
testPanelFile: testPanelFile,
|
|
6179
6208
|
testInlineVisible: testInlineVisible,
|
|
@@ -6214,7 +6243,10 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6214
6243
|
{
|
|
6215
6244
|
className: "ide-pane " + (isFocused ? 'focused' : '') + " " + (isDropTarget ? 'drop-target' : ''),
|
|
6216
6245
|
style: { flexBasis: flexBasis, flexShrink: 0, flexGrow: 0, display: 'flex', flexDirection: 'column', minWidth: 0 },
|
|
6217
|
-
|
|
6246
|
+
// Mousedown, not click: focusing re-renders the app, and doing that
|
|
6247
|
+
// during a click's capture phase reverts a checkbox before React
|
|
6248
|
+
// sees it change, so its onChange never fires.
|
|
6249
|
+
onMouseDownCapture: function () {
|
|
6218
6250
|
return TabManager.focusPane(pane.id);
|
|
6219
6251
|
},
|
|
6220
6252
|
onDragOver: function (e) {
|
|
@@ -6414,8 +6446,7 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6414
6446
|
onClose: function () { return setShowGitPanel(false); },
|
|
6415
6447
|
onOpenFile: openFileFromGitPanel,
|
|
6416
6448
|
onOpenDiff: TabManager.openDiffTab,
|
|
6417
|
-
onOpenAllChanges: function(scope, label) { TabManager.openCombinedDiffTab(scope, label); }
|
|
6418
|
-
onSelectCommit: handleSelectCommit
|
|
6449
|
+
onOpenAllChanges: function(scope, label) { TabManager.openCombinedDiffTab(scope, label); }
|
|
6419
6450
|
})
|
|
6420
6451
|
),
|
|
6421
6452
|
),
|
|
@@ -6565,21 +6596,13 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6565
6596
|
),
|
|
6566
6597
|
|
|
6567
6598
|
// File History Panel overlay
|
|
6568
|
-
historyPanelPath && React.createElement(
|
|
6569
|
-
React.Fragment,
|
|
6570
|
-
null,
|
|
6571
|
-
React.createElement("div", {
|
|
6572
|
-
style: { position: 'fixed', inset: 0, zIndex: 9800, background: 'rgba(0,0,0,0.55)' },
|
|
6573
|
-
onClick: function() { setHistoryPanelPath(null); }
|
|
6574
|
-
}),
|
|
6575
|
-
React.createElement(window.FileHistoryPanel || FileHistoryPanel, {
|
|
6599
|
+
historyPanelPath && React.createElement(window.FileHistoryPanel || FileHistoryPanel, {
|
|
6576
6600
|
path: historyPanelPath,
|
|
6577
6601
|
onClose: function () { return setHistoryPanelPath(null); },
|
|
6578
6602
|
onSelectCommit: function (hash, path) {
|
|
6579
6603
|
TabManager.openDiffTab(path, path.split('/').pop(), hash + '^', hash, null);
|
|
6580
6604
|
}
|
|
6581
|
-
})
|
|
6582
|
-
),
|
|
6605
|
+
}),
|
|
6583
6606
|
|
|
6584
6607
|
// Test Results Panel overlay — closing hides the dialog but keeps testResult for inline markers
|
|
6585
6608
|
(testPanelOpen || testLoading) && React.createElement(window.TestResultsPanel || TestResultsPanel, {
|
|
@@ -6597,98 +6620,25 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6597
6620
|
} : null
|
|
6598
6621
|
}),
|
|
6599
6622
|
|
|
6600
|
-
// Commit Detail overlay (shown when a commit row is clicked in CommitGraph)
|
|
6601
|
-
selectedCommit && React.createElement(
|
|
6602
|
-
React.Fragment,
|
|
6603
|
-
null,
|
|
6604
|
-
React.createElement("div", {
|
|
6605
|
-
style: { position: 'fixed', inset: 0, zIndex: 9000, background: 'rgba(0,0,0,0.45)' },
|
|
6606
|
-
onClick: function() { setSelectedCommit(null); setCommitDetailFiles(null); }
|
|
6607
|
-
}),
|
|
6608
|
-
React.createElement(
|
|
6609
|
-
"div",
|
|
6610
|
-
{ className: "ide-commit-detail-panel" },
|
|
6611
|
-
React.createElement(
|
|
6612
|
-
"div",
|
|
6613
|
-
{ className: "ide-commit-detail-header" },
|
|
6614
|
-
React.createElement(
|
|
6615
|
-
"div",
|
|
6616
|
-
null,
|
|
6617
|
-
React.createElement("div", { className: "ide-commit-detail-title" }, selectedCommit.title),
|
|
6618
|
-
React.createElement(
|
|
6619
|
-
"div",
|
|
6620
|
-
{ className: "ide-commit-detail-meta" },
|
|
6621
|
-
React.createElement("span", { className: "commit-hash" }, selectedCommit.hash.slice(0, 7)),
|
|
6622
|
-
" \xB7 ",
|
|
6623
|
-
selectedCommit.author,
|
|
6624
|
-
" \xB7 ",
|
|
6625
|
-
selectedCommit.date ? new Date(selectedCommit.date).toLocaleString() : ""
|
|
6626
|
-
)
|
|
6627
|
-
),
|
|
6628
|
-
React.createElement(
|
|
6629
|
-
"button",
|
|
6630
|
-
{ className: "git-header-btn", onClick: function() { setSelectedCommit(null); setCommitDetailFiles(null); }, title: "Close" },
|
|
6631
|
-
React.createElement("i", { className: "fas fa-times" })
|
|
6632
|
-
)
|
|
6633
|
-
),
|
|
6634
|
-
commitDetailFiles === null
|
|
6635
|
-
? React.createElement("div", { className: "git-empty", 'aria-busy': 'true' }, "Loading…")
|
|
6636
|
-
: commitDetailFiles.length === 0
|
|
6637
|
-
? React.createElement("div", { className: "git-empty" }, "No file changes found.")
|
|
6638
|
-
: React.createElement(
|
|
6639
|
-
"div",
|
|
6640
|
-
{ className: "git-list" },
|
|
6641
|
-
commitDetailFiles.map(function(f, i) {
|
|
6642
|
-
var name = (f.path || '').split('/').pop() || f.path;
|
|
6643
|
-
return React.createElement(
|
|
6644
|
-
"div",
|
|
6645
|
-
{ key: i, className: "git-file-item" },
|
|
6646
|
-
React.createElement(
|
|
6647
|
-
"div",
|
|
6648
|
-
{ className: "git-file-info", onClick: function() { openFileFromGitPanel(f.path, name); } },
|
|
6649
|
-
React.createElement("span", { className: "git-status-badge git-" + (f.status || 'M'), title: f.status }, f.status),
|
|
6650
|
-
React.createElement("span", { className: "git-file-path", title: f.path }, f.path)
|
|
6651
|
-
),
|
|
6652
|
-
React.createElement(
|
|
6653
|
-
"div",
|
|
6654
|
-
{ className: "git-file-actions" },
|
|
6655
|
-
React.createElement(
|
|
6656
|
-
"button",
|
|
6657
|
-
{
|
|
6658
|
-
className: "git-action-btn",
|
|
6659
|
-
title: "View Diff",
|
|
6660
|
-
onClick: function(e) {
|
|
6661
|
-
e.stopPropagation();
|
|
6662
|
-
TabManager.openDiffTab(f.path, name, selectedCommit.hash + '^', selectedCommit.hash, null);
|
|
6663
|
-
}
|
|
6664
|
-
},
|
|
6665
|
-
React.createElement("i", { className: "fas fa-exchange-alt" })
|
|
6666
|
-
)
|
|
6667
|
-
)
|
|
6668
|
-
);
|
|
6669
|
-
})
|
|
6670
|
-
)
|
|
6671
|
-
)
|
|
6672
|
-
),
|
|
6673
|
-
|
|
6674
6623
|
// Modals & Panels
|
|
6675
6624
|
state.isQuickOpenVisible && React.createElement(window.QuickOpenDialog || QuickOpenDialog, {
|
|
6676
|
-
|
|
6625
|
+
// Focus the opened file's editor. A line jump does that itself
|
|
6626
|
+
// (gotoLine); without one, closing Quick Open would leave focus on
|
|
6627
|
+
// <body>. Only here: handleSelectFile also serves follow mode, which must
|
|
6628
|
+
// not pull focus out of whatever the user is typing in.
|
|
6629
|
+
onSelect: function (path, name, line, col, endCol) {
|
|
6630
|
+
handleSelectFile(path, name, line, col, endCol);
|
|
6631
|
+
if (!line) TabManager.requestFocus(path);
|
|
6632
|
+
},
|
|
6677
6633
|
showFolders: !!(editorPrefs.quickOpenShowFolders),
|
|
6678
6634
|
onSelectFolder: handleOpenFolderInExplorer,
|
|
6679
6635
|
onClose: function () { return setQuickOpen(false); }
|
|
6680
6636
|
}),
|
|
6637
|
+
// No onDismiss: neither Esc nor the backdrop may silently pick one of
|
|
6638
|
+
// restore/discard, so this dialog closes only through its buttons.
|
|
6681
6639
|
draftRestoreOffer && React.createElement(
|
|
6682
|
-
|
|
6683
|
-
{
|
|
6684
|
-
className: "ide-draft-restore-overlay",
|
|
6685
|
-
role: "dialog",
|
|
6686
|
-
"aria-modal": "true",
|
|
6687
|
-
"aria-label": "Restore unsaved drafts"
|
|
6688
|
-
},
|
|
6689
|
-
React.createElement(
|
|
6690
|
-
"div",
|
|
6691
|
-
{ className: "ide-draft-restore-dialog" },
|
|
6640
|
+
window.ModalDialog,
|
|
6641
|
+
{ className: "ide-draft-restore-dialog", label: "Restore unsaved drafts" },
|
|
6692
6642
|
React.createElement("div", { className: "ide-draft-restore-title" },
|
|
6693
6643
|
React.createElement("i", { className: "fas fa-save", style: { marginRight: 8 } }),
|
|
6694
6644
|
"Unsaved drafts found"
|
|
@@ -6733,119 +6683,82 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6733
6683
|
"Discard drafts"
|
|
6734
6684
|
)
|
|
6735
6685
|
)
|
|
6736
|
-
)
|
|
6737
6686
|
),
|
|
6687
|
+
// A PopupMenu: a popover, so outside clicks and Esc close it natively
|
|
6688
|
+
// (onDismiss) where a full-screen click-catcher div used to, with buttons
|
|
6689
|
+
// that arrow keys move between. Keyed by position so a second right-click
|
|
6690
|
+
// mounts a fresh menu rather than moving the open one.
|
|
6738
6691
|
contextMenu && React.createElement(
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
}
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
),
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
),
|
|
6791
|
-
React.createElement(
|
|
6792
|
-
"div",
|
|
6793
|
-
{ className: "context-menu-item context-menu-item-danger", onClick: function () {
|
|
6794
|
-
return handleContextMenuAction('delete');
|
|
6795
|
-
} },
|
|
6796
|
-
React.createElement("i", { className: "far fa-trash-alt context-menu-icon" }),
|
|
6797
|
-
" " + deleteMenuLabel(contextMenu.node)
|
|
6798
|
-
),
|
|
6799
|
-
React.createElement("div", { className: "context-menu-divider" }),
|
|
6800
|
-
contextMenu.node && (actsOnSelection(contextMenu.node) || contextMenu.node.type === 'folder') && React.createElement(
|
|
6801
|
-
"div",
|
|
6802
|
-
{ className: "context-menu-item", onClick: function () {
|
|
6803
|
-
return handleContextMenuAction('combinedView');
|
|
6804
|
-
} },
|
|
6805
|
-
React.createElement("i", { className: "fas fa-layer-group context-menu-icon" }),
|
|
6806
|
-
" Open in Combined View"
|
|
6807
|
-
),
|
|
6808
|
-
contextMenu.node && React.createElement(
|
|
6809
|
-
"div",
|
|
6810
|
-
{ className: "context-menu-item", onClick: function () {
|
|
6811
|
-
return handleContextMenuAction('download');
|
|
6812
|
-
} },
|
|
6813
|
-
React.createElement("i", { className: "fas fa-download context-menu-icon" }),
|
|
6814
|
-
" " + downloadMenuLabel(contextMenu.node)
|
|
6815
|
-
),
|
|
6816
|
-
React.createElement(
|
|
6817
|
-
"div",
|
|
6818
|
-
{ className: "context-menu-item", onClick: function () {
|
|
6819
|
-
return handleContextMenuAction('upload');
|
|
6820
|
-
} },
|
|
6821
|
-
React.createElement("i", { className: "fas fa-upload context-menu-icon" }),
|
|
6822
|
-
" Upload Files Here..."
|
|
6823
|
-
),
|
|
6824
|
-
React.createElement("div", { className: "context-menu-divider" }),
|
|
6825
|
-
React.createElement(
|
|
6826
|
-
"div",
|
|
6827
|
-
{ className: "context-menu-item", onClick: function () {
|
|
6828
|
-
return handleContextMenuAction('copyPath');
|
|
6829
|
-
} },
|
|
6830
|
-
React.createElement("i", { className: "fas fa-copy context-menu-icon" }),
|
|
6831
|
-
" Copy Path"
|
|
6832
|
-
)
|
|
6833
|
-
)
|
|
6692
|
+
window.PopupMenu,
|
|
6693
|
+
{
|
|
6694
|
+
key: contextMenu.x + ',' + contextMenu.y,
|
|
6695
|
+
label: contextMenu.node ? contextMenu.node.name : 'Explorer',
|
|
6696
|
+
keyboard: contextMenu.keyboard,
|
|
6697
|
+
className: "context-menu",
|
|
6698
|
+
popoverRef: contextMenuRef,
|
|
6699
|
+
style: { left: contextMenu.x, top: contextMenu.y },
|
|
6700
|
+
onDismiss: closeContextMenu,
|
|
6701
|
+
onClick: function (e) { e.stopPropagation(); },
|
|
6702
|
+
onContextMenu: function (e) { e.preventDefault(); }
|
|
6703
|
+
},
|
|
6704
|
+
contextMenu.node && contextMenu.node.type === 'file' && React.createElement(window.MenuItem, {
|
|
6705
|
+
icon: "far fa-file-code", label: "Open",
|
|
6706
|
+
onClick: function () { return handleContextMenuAction('open'); }
|
|
6707
|
+
}),
|
|
6708
|
+
React.createElement(window.MenuItem, {
|
|
6709
|
+
icon: "far fa-file", label: "New File",
|
|
6710
|
+
onClick: function () { return handleContextMenuAction('newFile'); }
|
|
6711
|
+
}),
|
|
6712
|
+
React.createElement(window.MenuItem, {
|
|
6713
|
+
icon: "far fa-folder", label: "New Folder",
|
|
6714
|
+
onClick: function () { return handleContextMenuAction('newFolder'); }
|
|
6715
|
+
}),
|
|
6716
|
+
React.createElement(window.MenuSeparator),
|
|
6717
|
+
React.createElement(window.MenuItem, {
|
|
6718
|
+
icon: "fas fa-pen", label: "Rename",
|
|
6719
|
+
onClick: function () { return handleContextMenuAction('rename'); }
|
|
6720
|
+
}),
|
|
6721
|
+
React.createElement(window.MenuItem, {
|
|
6722
|
+
icon: "far fa-trash-alt", label: deleteMenuLabel(contextMenu.node), danger: true,
|
|
6723
|
+
onClick: function () { return handleContextMenuAction('delete'); }
|
|
6724
|
+
}),
|
|
6725
|
+
React.createElement(window.MenuSeparator),
|
|
6726
|
+
contextMenu.node && (actsOnSelection(contextMenu.node) || contextMenu.node.type === 'folder') && React.createElement(window.MenuItem, {
|
|
6727
|
+
icon: "fas fa-layer-group", label: "Open in Combined View",
|
|
6728
|
+
onClick: function () { return handleContextMenuAction('combinedView'); }
|
|
6729
|
+
}),
|
|
6730
|
+
contextMenu.node && React.createElement(window.MenuItem, {
|
|
6731
|
+
icon: "fas fa-download", label: downloadMenuLabel(contextMenu.node),
|
|
6732
|
+
onClick: function () { return handleContextMenuAction('download'); }
|
|
6733
|
+
}),
|
|
6734
|
+
React.createElement(window.MenuItem, {
|
|
6735
|
+
icon: "fas fa-upload", label: "Upload Files Here...",
|
|
6736
|
+
onClick: function () { return handleContextMenuAction('upload'); }
|
|
6737
|
+
}),
|
|
6738
|
+
React.createElement(window.MenuSeparator),
|
|
6739
|
+
React.createElement(window.MenuItem, {
|
|
6740
|
+
icon: "fas fa-copy", label: "Copy Path",
|
|
6741
|
+
onClick: function () { return handleContextMenuAction('copyPath'); }
|
|
6742
|
+
})
|
|
6834
6743
|
),
|
|
6744
|
+
// Esc and the backdrop mean Cancel: the tab stays open with its edits.
|
|
6745
|
+
// Save on an untitled tab opens the Save As prompt on top of this one;
|
|
6746
|
+
// both are modal <dialog>s, and the top layer stacks the later one above.
|
|
6835
6747
|
closingTabId && React.createElement(
|
|
6836
|
-
|
|
6837
|
-
{
|
|
6748
|
+
window.ModalDialog,
|
|
6749
|
+
{
|
|
6750
|
+
className: "schema-modal mb-confirm",
|
|
6751
|
+
labelledBy: "mb-unsaved-title",
|
|
6752
|
+
onDismiss: function () { setClosingTabId(null); setClosingPaneId(null); }
|
|
6753
|
+
},
|
|
6838
6754
|
React.createElement(
|
|
6839
|
-
"div",
|
|
6840
|
-
{ className: "
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
"Unsaved Changes"
|
|
6845
|
-
),
|
|
6755
|
+
"div", { className: "schema-modal-header" },
|
|
6756
|
+
React.createElement("div", { className: "schema-modal-title", id: "mb-unsaved-title" }, "Unsaved changes")
|
|
6757
|
+
),
|
|
6758
|
+
React.createElement(
|
|
6759
|
+
"div", { className: "schema-modal-body" },
|
|
6846
6760
|
React.createElement(
|
|
6847
|
-
"p",
|
|
6848
|
-
{ style: { color: '#ccc', margin: '16px 0', fontSize: '13px' } },
|
|
6761
|
+
"p", { className: "mb-confirm-message" },
|
|
6849
6762
|
"Do you want to save the changes you made to ",
|
|
6850
6763
|
React.createElement(
|
|
6851
6764
|
"strong",
|
|
@@ -6856,47 +6769,37 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6856
6769
|
return t.id === closingTabId;
|
|
6857
6770
|
}) || {}).name
|
|
6858
6771
|
),
|
|
6859
|
-
"?"
|
|
6772
|
+
"? Your changes will be lost if you don't save them."
|
|
6773
|
+
)
|
|
6774
|
+
),
|
|
6775
|
+
React.createElement(
|
|
6776
|
+
"div", { className: "import-conflict-actions" },
|
|
6777
|
+
React.createElement(
|
|
6778
|
+
"button",
|
|
6779
|
+
{ type: "button", className: "import-conflict-btn",
|
|
6780
|
+
onClick: function () { setClosingTabId(null); setClosingPaneId(null); } },
|
|
6781
|
+
"Cancel"
|
|
6860
6782
|
),
|
|
6861
6783
|
React.createElement(
|
|
6862
|
-
"
|
|
6863
|
-
{
|
|
6864
|
-
|
|
6784
|
+
"button",
|
|
6785
|
+
{ type: "button", className: "import-conflict-btn import-conflict-btn-danger",
|
|
6786
|
+
onClick: function () { return confirmCloseTab(false); } },
|
|
6787
|
+
"Don't Save"
|
|
6865
6788
|
),
|
|
6866
6789
|
React.createElement(
|
|
6867
|
-
"
|
|
6868
|
-
{
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
{
|
|
6872
|
-
onClick: function () {
|
|
6873
|
-
return confirmCloseTab(true);
|
|
6874
|
-
},
|
|
6875
|
-
style: { padding: '6px 16px', background: '#0e639c', color: '#fff', border: 'none', borderRadius: '4px', cursor: 'pointer' } },
|
|
6876
|
-
"Save"
|
|
6877
|
-
),
|
|
6878
|
-
React.createElement(
|
|
6879
|
-
"button",
|
|
6880
|
-
{
|
|
6881
|
-
onClick: function () {
|
|
6882
|
-
return confirmCloseTab(false);
|
|
6883
|
-
},
|
|
6884
|
-
style: { padding: '6px 16px', background: 'transparent', color: '#ccc', border: '1px solid #666', borderRadius: '4px', cursor: 'pointer' } },
|
|
6885
|
-
"Don't Save"
|
|
6886
|
-
),
|
|
6887
|
-
React.createElement(
|
|
6888
|
-
"button",
|
|
6889
|
-
{
|
|
6890
|
-
onClick: function () {
|
|
6891
|
-
return setClosingTabId(null);
|
|
6892
|
-
},
|
|
6893
|
-
style: { padding: '6px 16px', background: 'transparent', color: '#888', border: 'none', cursor: 'pointer' } },
|
|
6894
|
-
"Cancel"
|
|
6895
|
-
)
|
|
6790
|
+
"button",
|
|
6791
|
+
{ type: "button", className: "import-conflict-btn import-conflict-btn-primary", "data-autofocus": true,
|
|
6792
|
+
onClick: function () { return confirmCloseTab(true); } },
|
|
6793
|
+
"Save"
|
|
6896
6794
|
)
|
|
6897
6795
|
)
|
|
6898
6796
|
),
|
|
6899
6797
|
|
|
6798
|
+
showAiModal && React.createElement(AiRoundTripModal, {
|
|
6799
|
+
treeData: treeData,
|
|
6800
|
+
onClose: function () { setShowAiModal(false); }
|
|
6801
|
+
}),
|
|
6802
|
+
|
|
6900
6803
|
/* ── Upload dialog ─────────────────────────────────────────────────── */
|
|
6901
6804
|
importDialog && React.createElement(ImportDialog, {
|
|
6902
6805
|
initialFolder: importDialog.initialFolder,
|
|
@@ -6925,17 +6828,12 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
6925
6828
|
|
|
6926
6829
|
/* ── Schema modal ──────────────────────────────────────────────────── */
|
|
6927
6830
|
schemaModal && React.createElement(
|
|
6928
|
-
|
|
6831
|
+
window.ModalDialog,
|
|
6929
6832
|
{
|
|
6930
|
-
className: 'schema-modal
|
|
6931
|
-
|
|
6833
|
+
className: 'schema-modal',
|
|
6834
|
+
label: 'Schema for ' + schemaModal.label,
|
|
6835
|
+
onDismiss: function() { setSchemaModal(null); }
|
|
6932
6836
|
},
|
|
6933
|
-
React.createElement(
|
|
6934
|
-
'div',
|
|
6935
|
-
{
|
|
6936
|
-
className: 'schema-modal',
|
|
6937
|
-
onClick: function(e) { e.stopPropagation(); }
|
|
6938
|
-
},
|
|
6939
6837
|
/* Header */
|
|
6940
6838
|
React.createElement(
|
|
6941
6839
|
'div', { className: 'schema-modal-header' },
|
|
@@ -7010,7 +6908,6 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
7010
6908
|
)
|
|
7011
6909
|
]
|
|
7012
6910
|
)
|
|
7013
|
-
)
|
|
7014
6911
|
)
|
|
7015
6912
|
);
|
|
7016
6913
|
};
|