@lvce-editor/main-area-worker 9.56.1 → 9.57.0
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/dist/mainAreaWorkerMain.js +204 -64
- package/package.json +1 -1
|
@@ -488,7 +488,7 @@ const execute = (command, ...args) => {
|
|
|
488
488
|
|
|
489
489
|
const Two$1 = '2.0';
|
|
490
490
|
const callbacks = Object.create(null);
|
|
491
|
-
const get$
|
|
491
|
+
const get$3 = id => {
|
|
492
492
|
return callbacks[id];
|
|
493
493
|
};
|
|
494
494
|
const remove$1 = id => {
|
|
@@ -678,7 +678,7 @@ const warn = (...args) => {
|
|
|
678
678
|
console.warn(...args);
|
|
679
679
|
};
|
|
680
680
|
const resolve = (id, response) => {
|
|
681
|
-
const fn = get$
|
|
681
|
+
const fn = get$3(id);
|
|
682
682
|
if (!fn) {
|
|
683
683
|
console.log(response);
|
|
684
684
|
warn(`callback ${id} may already be disposed`);
|
|
@@ -1335,7 +1335,7 @@ const rpcs = Object.create(null);
|
|
|
1335
1335
|
const set$8 = (id, rpc) => {
|
|
1336
1336
|
rpcs[id] = rpc;
|
|
1337
1337
|
};
|
|
1338
|
-
const get$
|
|
1338
|
+
const get$2 = id => {
|
|
1339
1339
|
return rpcs[id];
|
|
1340
1340
|
};
|
|
1341
1341
|
const remove = id => {
|
|
@@ -1346,18 +1346,18 @@ const remove = id => {
|
|
|
1346
1346
|
const create$3 = rpcId => {
|
|
1347
1347
|
return {
|
|
1348
1348
|
async dispose() {
|
|
1349
|
-
const rpc = get$
|
|
1349
|
+
const rpc = get$2(rpcId);
|
|
1350
1350
|
await rpc.dispose();
|
|
1351
1351
|
},
|
|
1352
1352
|
// @ts-ignore
|
|
1353
1353
|
invoke(method, ...params) {
|
|
1354
|
-
const rpc = get$
|
|
1354
|
+
const rpc = get$2(rpcId);
|
|
1355
1355
|
// @ts-ignore
|
|
1356
1356
|
return rpc.invoke(method, ...params);
|
|
1357
1357
|
},
|
|
1358
1358
|
// @ts-ignore
|
|
1359
1359
|
invokeAndTransfer(method, ...params) {
|
|
1360
|
-
const rpc = get$
|
|
1360
|
+
const rpc = get$2(rpcId);
|
|
1361
1361
|
// @ts-ignore
|
|
1362
1362
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1363
1363
|
},
|
|
@@ -1499,6 +1499,9 @@ const confirm$1 = async (message, options) => {
|
|
|
1499
1499
|
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
1500
1500
|
return result;
|
|
1501
1501
|
};
|
|
1502
|
+
const getPreference = async key => {
|
|
1503
|
+
return await invoke$1('Preferences.get', key);
|
|
1504
|
+
};
|
|
1502
1505
|
|
|
1503
1506
|
const addClosedTabs = (state, entries) => {
|
|
1504
1507
|
const {
|
|
@@ -1735,7 +1738,7 @@ const withActiveEditorChangeAsync = fn => {
|
|
|
1735
1738
|
|
|
1736
1739
|
const registry = create$4();
|
|
1737
1740
|
const {
|
|
1738
|
-
get,
|
|
1741
|
+
get: get$1,
|
|
1739
1742
|
getCommandIds,
|
|
1740
1743
|
getKeys: getKeys$1,
|
|
1741
1744
|
registerCommands,
|
|
@@ -1984,7 +1987,7 @@ const handleCreate = async command => {
|
|
|
1984
1987
|
const {
|
|
1985
1988
|
newState: state,
|
|
1986
1989
|
oldState
|
|
1987
|
-
} = get(command.uid);
|
|
1990
|
+
} = get$1(command.uid);
|
|
1988
1991
|
const readyState = handleViewletReady(state, command.editorUid, title);
|
|
1989
1992
|
set$1(command.uid, oldState, readyState);
|
|
1990
1993
|
return readyState;
|
|
@@ -2600,7 +2603,7 @@ const diff2 = uid => {
|
|
|
2600
2603
|
const {
|
|
2601
2604
|
newState,
|
|
2602
2605
|
oldState
|
|
2603
|
-
} = get(uid);
|
|
2606
|
+
} = get$1(uid);
|
|
2604
2607
|
const result = diff(oldState, newState);
|
|
2605
2608
|
return result;
|
|
2606
2609
|
};
|
|
@@ -3123,7 +3126,7 @@ const startContentLoading = async (oldState, state, tabId, path, requestId) => {
|
|
|
3123
3126
|
} = state;
|
|
3124
3127
|
try {
|
|
3125
3128
|
const getLatestState = () => {
|
|
3126
|
-
return get(uid).newState;
|
|
3129
|
+
return get$1(uid).newState;
|
|
3127
3130
|
};
|
|
3128
3131
|
set$1(uid, oldState, state);
|
|
3129
3132
|
const newState = await loadTabContentAsync(tabId, path, requestId, getLatestState);
|
|
@@ -3303,7 +3306,7 @@ const getActiveEditorUid = state => {
|
|
|
3303
3306
|
};
|
|
3304
3307
|
|
|
3305
3308
|
const getComponentState = uid => {
|
|
3306
|
-
return get(uid).newState;
|
|
3309
|
+
return get$1(uid).newState;
|
|
3307
3310
|
};
|
|
3308
3311
|
|
|
3309
3312
|
const getMenuIds = () => {
|
|
@@ -3334,6 +3337,8 @@ const handleClickTogglePreview = async state => {
|
|
|
3334
3337
|
};
|
|
3335
3338
|
|
|
3336
3339
|
const CloseGroup = 'close-group';
|
|
3340
|
+
const ConfigureLargeFileLimit = 'configure-large-file-limit';
|
|
3341
|
+
const OpenLargeFile = 'open-large-file';
|
|
3337
3342
|
const OpenInTextEditor$1 = 'open-in-text-editor';
|
|
3338
3343
|
const RetryOpen = 'retry-open';
|
|
3339
3344
|
const RestoreClosedTab = 'restore-closed-tab';
|
|
@@ -3406,7 +3411,7 @@ const getCurrentState = state => {
|
|
|
3406
3411
|
const {
|
|
3407
3412
|
uid
|
|
3408
3413
|
} = state;
|
|
3409
|
-
const stateFromStore = get(uid);
|
|
3414
|
+
const stateFromStore = get$1(uid);
|
|
3410
3415
|
if (!stateFromStore) {
|
|
3411
3416
|
set$1(uid, state, state);
|
|
3412
3417
|
return state;
|
|
@@ -3526,6 +3531,36 @@ const getEditorInputTitle = editorInput => {
|
|
|
3526
3531
|
}
|
|
3527
3532
|
};
|
|
3528
3533
|
|
|
3534
|
+
const get = async key => {
|
|
3535
|
+
return getPreference(key);
|
|
3536
|
+
};
|
|
3537
|
+
|
|
3538
|
+
const defaultMaxFileSizeMb = 50;
|
|
3539
|
+
const bytesPerMegabyte = 1024 * 1024;
|
|
3540
|
+
const getMaxFileSize = async () => {
|
|
3541
|
+
try {
|
|
3542
|
+
const configuredLimit = await get('files.maxFileSizeMB');
|
|
3543
|
+
if (typeof configuredLimit === 'number' && Number.isFinite(configuredLimit) && configuredLimit > 0) {
|
|
3544
|
+
return configuredLimit * bytesPerMegabyte;
|
|
3545
|
+
}
|
|
3546
|
+
} catch {
|
|
3547
|
+
// Older renderer workers do not expose this preference yet.
|
|
3548
|
+
}
|
|
3549
|
+
return defaultMaxFileSizeMb * bytesPerMegabyte;
|
|
3550
|
+
};
|
|
3551
|
+
const getLargeFileSize = async (editorInput, forceOpen = false) => {
|
|
3552
|
+
if (editorInput.type !== 'editor' || forceOpen || !editorInput.uri.startsWith('file://')) {
|
|
3553
|
+
return undefined;
|
|
3554
|
+
}
|
|
3555
|
+
try {
|
|
3556
|
+
const [fileSize, maxFileSize] = await Promise.all([invoke$1('FileSystem.getFileSize', editorInput.uri), getMaxFileSize()]);
|
|
3557
|
+
return typeof fileSize === 'number' && fileSize > maxFileSize ? fileSize : undefined;
|
|
3558
|
+
} catch {
|
|
3559
|
+
// File systems without stat support should retain the existing open behavior.
|
|
3560
|
+
return undefined;
|
|
3561
|
+
}
|
|
3562
|
+
};
|
|
3563
|
+
|
|
3529
3564
|
const getUriTitle = (uri, homeDirUri) => {
|
|
3530
3565
|
if (!uri) {
|
|
3531
3566
|
return undefined;
|
|
@@ -3741,6 +3776,7 @@ const getStateWithTab = (currentState, editorInput, existingTab, shouldRetryExis
|
|
|
3741
3776
|
editorInput,
|
|
3742
3777
|
editorType,
|
|
3743
3778
|
errorMessage: '',
|
|
3779
|
+
fileSize: undefined,
|
|
3744
3780
|
loadingState: 'loading',
|
|
3745
3781
|
title,
|
|
3746
3782
|
uri,
|
|
@@ -3966,11 +4002,11 @@ const getActivePreviewEditorUid = state => {
|
|
|
3966
4002
|
const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
|
|
3967
4003
|
return activeTab?.isPreview ? activeTab.editorUid : -1;
|
|
3968
4004
|
};
|
|
3969
|
-
const shouldRetryExistingTab = (existingTab, editorInput) => {
|
|
4005
|
+
const shouldRetryExistingTab = (existingTab, editorInput, forceOpen) => {
|
|
3970
4006
|
if (!existingTab) {
|
|
3971
4007
|
return false;
|
|
3972
4008
|
}
|
|
3973
|
-
return existingTab.tab.loadingState === 'error' || editorInput.type === 'editor' && editorInput.forceText === true && existingTab.tab.editorInput?.type === 'binary';
|
|
4009
|
+
return existingTab.tab.loadingState === 'error' || forceOpen && existingTab.tab.loadingState === 'large' || editorInput.type === 'editor' && editorInput.forceText === true && existingTab.tab.editorInput?.type === 'binary';
|
|
3974
4010
|
};
|
|
3975
4011
|
const openInputWithContext = async (context, options) => {
|
|
3976
4012
|
const state = context.getState();
|
|
@@ -3985,7 +4021,7 @@ const openInputWithContext = async (context, options) => {
|
|
|
3985
4021
|
const editorType = getEditorInputEditorType(editorInput);
|
|
3986
4022
|
const currentState = state;
|
|
3987
4023
|
const existingTab = options.reuseExisting === false ? undefined : findTabByUri(currentState, uri);
|
|
3988
|
-
const shouldRetry = shouldRetryExistingTab(existingTab, editorInput);
|
|
4024
|
+
const shouldRetry = shouldRetryExistingTab(existingTab, editorInput, options.forceOpen === true);
|
|
3989
4025
|
if (existingTab && !shouldRetry) {
|
|
3990
4026
|
const switchedState = getExistingTabState(currentState, existingTab, preview);
|
|
3991
4027
|
await context.updateState(() => switchedState);
|
|
@@ -4020,6 +4056,17 @@ const openInputWithContext = async (context, options) => {
|
|
|
4020
4056
|
await context.updateState(() => binaryState);
|
|
4021
4057
|
return;
|
|
4022
4058
|
}
|
|
4059
|
+
const fileSize = await getLargeFileSize(editorInput, options.forceOpen === true);
|
|
4060
|
+
if (fileSize !== undefined) {
|
|
4061
|
+
const latestState = context.getState();
|
|
4062
|
+
const largeFileState = updateTab(latestState, tabId, {
|
|
4063
|
+
editorUid: -1,
|
|
4064
|
+
fileSize,
|
|
4065
|
+
loadingState: 'large'
|
|
4066
|
+
});
|
|
4067
|
+
await context.updateState(() => largeFileState);
|
|
4068
|
+
return;
|
|
4069
|
+
}
|
|
4023
4070
|
try {
|
|
4024
4071
|
const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput);
|
|
4025
4072
|
const stateAfterModuleId = context.getState();
|
|
@@ -4081,9 +4128,9 @@ const openInput = async (state, options) => {
|
|
|
4081
4128
|
} = state;
|
|
4082
4129
|
let currentState = getCurrentState(state);
|
|
4083
4130
|
const context = {
|
|
4084
|
-
getState: () => get(uid)?.newState ?? currentState,
|
|
4131
|
+
getState: () => get$1(uid)?.newState ?? currentState,
|
|
4085
4132
|
updateState: updater => {
|
|
4086
|
-
const storedState = get(uid);
|
|
4133
|
+
const storedState = get$1(uid);
|
|
4087
4134
|
const latestState = storedState?.newState ?? currentState;
|
|
4088
4135
|
currentState = updater(latestState);
|
|
4089
4136
|
set$1(uid, storedState?.oldState ?? state, currentState);
|
|
@@ -4114,6 +4161,56 @@ const openBinaryAsText = async state => {
|
|
|
4114
4161
|
});
|
|
4115
4162
|
};
|
|
4116
4163
|
|
|
4164
|
+
const openLargeFile = async state => {
|
|
4165
|
+
const activeTabData = getActiveTab(state);
|
|
4166
|
+
const editorInput = activeTabData?.tab.editorInput;
|
|
4167
|
+
if (!activeTabData || editorInput?.type !== 'editor') {
|
|
4168
|
+
return state;
|
|
4169
|
+
}
|
|
4170
|
+
return openInput(state, {
|
|
4171
|
+
editorInput,
|
|
4172
|
+
focus: false,
|
|
4173
|
+
forceOpen: true,
|
|
4174
|
+
preview: activeTabData.tab.isPreview
|
|
4175
|
+
});
|
|
4176
|
+
};
|
|
4177
|
+
|
|
4178
|
+
const getOptionUriOptions = options => {
|
|
4179
|
+
if (typeof options === 'string') {
|
|
4180
|
+
return options;
|
|
4181
|
+
}
|
|
4182
|
+
return options.uri;
|
|
4183
|
+
};
|
|
4184
|
+
|
|
4185
|
+
const getViewletContext = (options, viewletContext) => {
|
|
4186
|
+
if (viewletContext !== undefined || typeof options === 'string') {
|
|
4187
|
+
return viewletContext;
|
|
4188
|
+
}
|
|
4189
|
+
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'reuseExisting' && key !== 'uri'));
|
|
4190
|
+
return Object.keys(context).length === 0 ? undefined : context;
|
|
4191
|
+
};
|
|
4192
|
+
const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
4193
|
+
const uri = getOptionUriOptions(options);
|
|
4194
|
+
const preview = typeof options === 'string' ? false : options.preview ?? false;
|
|
4195
|
+
const reuseExisting = typeof options === 'string' ? true : options.reuseExisting ?? true;
|
|
4196
|
+
const context = getViewletContext(options, viewletContext);
|
|
4197
|
+
return {
|
|
4198
|
+
...(context !== undefined && {
|
|
4199
|
+
args: [context]
|
|
4200
|
+
}),
|
|
4201
|
+
editorInput: getNormalizedOpenEditorInput(uri),
|
|
4202
|
+
focus: typeof options === 'string' ? focus : options.focus,
|
|
4203
|
+
preview,
|
|
4204
|
+
reuseExisting
|
|
4205
|
+
};
|
|
4206
|
+
};
|
|
4207
|
+
const openUri = async (state, options, focus = true, viewletContext) => {
|
|
4208
|
+
return openInput(state, getOpenInputOptions(options, focus, viewletContext));
|
|
4209
|
+
};
|
|
4210
|
+
const openUriWithContext = async (context, options, focus = true, viewletContext) => {
|
|
4211
|
+
await openInputWithContext(context, getOpenInputOptions(options, focus, viewletContext));
|
|
4212
|
+
};
|
|
4213
|
+
|
|
4117
4214
|
const parseRawGroupId = rawGroupId => {
|
|
4118
4215
|
if (!rawGroupId) {
|
|
4119
4216
|
return undefined;
|
|
@@ -4308,42 +4405,6 @@ const restoreClosedTab = async state => {
|
|
|
4308
4405
|
return newState;
|
|
4309
4406
|
};
|
|
4310
4407
|
|
|
4311
|
-
const getOptionUriOptions = options => {
|
|
4312
|
-
if (typeof options === 'string') {
|
|
4313
|
-
return options;
|
|
4314
|
-
}
|
|
4315
|
-
return options.uri;
|
|
4316
|
-
};
|
|
4317
|
-
|
|
4318
|
-
const getViewletContext = (options, viewletContext) => {
|
|
4319
|
-
if (viewletContext !== undefined || typeof options === 'string') {
|
|
4320
|
-
return viewletContext;
|
|
4321
|
-
}
|
|
4322
|
-
const context = Object.fromEntries(Object.entries(options).filter(([key]) => key !== 'focus' && key !== 'preview' && key !== 'reuseExisting' && key !== 'uri'));
|
|
4323
|
-
return Object.keys(context).length === 0 ? undefined : context;
|
|
4324
|
-
};
|
|
4325
|
-
const getOpenInputOptions = (options, focus = true, viewletContext) => {
|
|
4326
|
-
const uri = getOptionUriOptions(options);
|
|
4327
|
-
const preview = typeof options === 'string' ? false : options.preview ?? false;
|
|
4328
|
-
const reuseExisting = typeof options === 'string' ? true : options.reuseExisting ?? true;
|
|
4329
|
-
const context = getViewletContext(options, viewletContext);
|
|
4330
|
-
return {
|
|
4331
|
-
...(context !== undefined && {
|
|
4332
|
-
args: [context]
|
|
4333
|
-
}),
|
|
4334
|
-
editorInput: getNormalizedOpenEditorInput(uri),
|
|
4335
|
-
focus: typeof options === 'string' ? focus : options.focus,
|
|
4336
|
-
preview,
|
|
4337
|
-
reuseExisting
|
|
4338
|
-
};
|
|
4339
|
-
};
|
|
4340
|
-
const openUri = async (state, options, focus = true, viewletContext) => {
|
|
4341
|
-
return openInput(state, getOpenInputOptions(options, focus, viewletContext));
|
|
4342
|
-
};
|
|
4343
|
-
const openUriWithContext = async (context, options, focus = true, viewletContext) => {
|
|
4344
|
-
await openInputWithContext(context, getOpenInputOptions(options, focus, viewletContext));
|
|
4345
|
-
};
|
|
4346
|
-
|
|
4347
4408
|
const retryOpen = async state => {
|
|
4348
4409
|
const activeTabData = getActiveTab(state);
|
|
4349
4410
|
if (!activeTabData) {
|
|
@@ -4563,8 +4624,12 @@ const handleClickAction = async (state, action, rawGroupId) => {
|
|
|
4563
4624
|
}
|
|
4564
4625
|
return closeEditorGroup$1(state, groupId);
|
|
4565
4626
|
}
|
|
4627
|
+
case ConfigureLargeFileLimit:
|
|
4628
|
+
return openUri(state, 'settings://');
|
|
4566
4629
|
case OpenInTextEditor$1:
|
|
4567
4630
|
return openBinaryAsText(state);
|
|
4631
|
+
case OpenLargeFile:
|
|
4632
|
+
return openLargeFile(state);
|
|
4568
4633
|
case RetryOpen:
|
|
4569
4634
|
return retryOpen(state);
|
|
4570
4635
|
case SplitRight$1:
|
|
@@ -5269,12 +5334,17 @@ const TextEditorError = 'TextEditor TextEditorError';
|
|
|
5269
5334
|
const EditorContentError = 'EditorContent EditorContentError';
|
|
5270
5335
|
const TextEditorBinary = 'TextEditor TextEditorError TextEditorBinary';
|
|
5271
5336
|
const EditorContentBinary = 'EditorContent EditorContentError EditorContentBinary';
|
|
5337
|
+
const TextEditorLargeFile = 'TextEditor TextEditorError TextEditorLargeFile';
|
|
5338
|
+
const EditorContentLargeFile = 'EditorContent EditorContentError EditorContentLargeFile';
|
|
5339
|
+
const EditorContentLargeFileActions = 'EditorContentLargeFileActions';
|
|
5340
|
+
const EditorLargeFileWarningIcon = 'MaskIcon MaskIconWarning EditorLargeFileWarningIcon';
|
|
5272
5341
|
const DragOverlay = 'DragOverlay';
|
|
5273
5342
|
const Main = 'Main';
|
|
5274
5343
|
const EDITOR_GROUPS_CONTAINER = 'editor-groups-container';
|
|
5275
5344
|
const TabIcon = 'TabIcon';
|
|
5276
5345
|
const TabTitle = 'TabTitle';
|
|
5277
5346
|
const Button = 'Button';
|
|
5347
|
+
const ButtonPrimary = 'ButtonPrimary';
|
|
5278
5348
|
const ButtonSecondary = 'ButtonSecondary';
|
|
5279
5349
|
const EditorContent = 'EditorContent';
|
|
5280
5350
|
const EditorTabCloseButton = 'EditorTabCloseButton';
|
|
@@ -5380,7 +5450,7 @@ const newFile = async state => {
|
|
|
5380
5450
|
// After viewlet is created, get the latest state and mark it as ready
|
|
5381
5451
|
const {
|
|
5382
5452
|
newState: latestState
|
|
5383
|
-
} = get(uid);
|
|
5453
|
+
} = get$1(uid);
|
|
5384
5454
|
const readyState = handleViewletReady(latestState, actualEditorUid, title);
|
|
5385
5455
|
return readyState;
|
|
5386
5456
|
};
|
|
@@ -6047,6 +6117,13 @@ const handleUriChange = async (state, oldUri, newUri) => {
|
|
|
6047
6117
|
layout: result.updatedLayout
|
|
6048
6118
|
};
|
|
6049
6119
|
};
|
|
6120
|
+
const handleUriChangeWithContext = async (context, oldUri, newUri) => {
|
|
6121
|
+
const state = context.getState();
|
|
6122
|
+
const newState = await handleUriChange(state, oldUri, newUri);
|
|
6123
|
+
if (newState !== state) {
|
|
6124
|
+
await context.updateState(() => newState);
|
|
6125
|
+
}
|
|
6126
|
+
};
|
|
6050
6127
|
|
|
6051
6128
|
const toFileUri = path => {
|
|
6052
6129
|
if (!path) {
|
|
@@ -6391,7 +6468,9 @@ const handleWorkspaceRefresh = async (state, refresh = {}) => {
|
|
|
6391
6468
|
const handleWorkspaceRefreshWithContext = async (context, refresh = {}) => {
|
|
6392
6469
|
const state = context.getState();
|
|
6393
6470
|
const newState = await handleWorkspaceRefresh(state, refresh);
|
|
6394
|
-
|
|
6471
|
+
if (newState !== state) {
|
|
6472
|
+
await context.updateState(() => newState);
|
|
6473
|
+
}
|
|
6395
6474
|
};
|
|
6396
6475
|
|
|
6397
6476
|
const hasActiveTextEditor = state => {
|
|
@@ -6458,6 +6537,7 @@ const CloseSaved = 'Close Saved';
|
|
|
6458
6537
|
const CloseToTheRight = 'Close To The Right';
|
|
6459
6538
|
const CopyPath = 'Copy Path';
|
|
6460
6539
|
const CopyRelativePath = 'Copy Relative Path';
|
|
6540
|
+
const ConfigureLimit = 'Configure Limit';
|
|
6461
6541
|
const FindFileReferences = 'Find File References';
|
|
6462
6542
|
const ReopenEditorWith = 'Reopen Editor With...';
|
|
6463
6543
|
const Share = 'Share';
|
|
@@ -6472,8 +6552,10 @@ const CopyIntoNewWindow = 'Copy into New Window';
|
|
|
6472
6552
|
const NewTextFile = 'New Text File';
|
|
6473
6553
|
const NewWindow = 'New Window';
|
|
6474
6554
|
const OpenFile = 'Open File';
|
|
6555
|
+
const OpenAnyway = 'Open Anyway';
|
|
6475
6556
|
const OpenInTextEditor = 'Open in Text Editor';
|
|
6476
6557
|
const BinaryFileNotDisplayed = 'The file is not displayed in the text editor because its contents are binary.';
|
|
6558
|
+
const LargeFileNotDisplayed = 'The file is not displayed in the text editor because it is very large';
|
|
6477
6559
|
const SplitDown = 'Split Down';
|
|
6478
6560
|
const SplitEditorGroup = 'Split Editor Group';
|
|
6479
6561
|
const SplitLeft = 'Split Left';
|
|
@@ -6491,6 +6573,15 @@ const openInTextEditor = () => {
|
|
|
6491
6573
|
const binaryFileNotDisplayed = () => {
|
|
6492
6574
|
return i18nString(BinaryFileNotDisplayed);
|
|
6493
6575
|
};
|
|
6576
|
+
const configureLimit = () => {
|
|
6577
|
+
return i18nString(ConfigureLimit);
|
|
6578
|
+
};
|
|
6579
|
+
const largeFileNotDisplayed = () => {
|
|
6580
|
+
return i18nString(LargeFileNotDisplayed);
|
|
6581
|
+
};
|
|
6582
|
+
const openAnyway = () => {
|
|
6583
|
+
return i18nString(OpenAnyway);
|
|
6584
|
+
};
|
|
6494
6585
|
const splitUp = () => {
|
|
6495
6586
|
return i18nString(SplitUp);
|
|
6496
6587
|
};
|
|
@@ -7398,7 +7489,7 @@ const editorContentBinaryNode = {
|
|
|
7398
7489
|
className: EditorContentBinary,
|
|
7399
7490
|
type: Div
|
|
7400
7491
|
};
|
|
7401
|
-
const paragraphNode$
|
|
7492
|
+
const paragraphNode$2 = {
|
|
7402
7493
|
childCount: 1,
|
|
7403
7494
|
type: P
|
|
7404
7495
|
};
|
|
@@ -7411,7 +7502,7 @@ const openInTextEditorButtonNode = {
|
|
|
7411
7502
|
type: Button$2
|
|
7412
7503
|
};
|
|
7413
7504
|
const renderBinary = () => {
|
|
7414
|
-
return [textEditorBinaryNode, editorContentBinaryNode, paragraphNode$
|
|
7505
|
+
return [textEditorBinaryNode, editorContentBinaryNode, paragraphNode$2, text(binaryFileNotDisplayed()), openInTextEditorButtonNode, text(openInTextEditor())];
|
|
7415
7506
|
};
|
|
7416
7507
|
|
|
7417
7508
|
const textEditorNode = {
|
|
@@ -7438,7 +7529,7 @@ const editorContentErrorNode = {
|
|
|
7438
7529
|
className: EditorContentError,
|
|
7439
7530
|
type: Div
|
|
7440
7531
|
};
|
|
7441
|
-
const paragraphNode = {
|
|
7532
|
+
const paragraphNode$1 = {
|
|
7442
7533
|
childCount: 1,
|
|
7443
7534
|
type: P
|
|
7444
7535
|
};
|
|
@@ -7451,7 +7542,53 @@ const retryButtonNode = {
|
|
|
7451
7542
|
type: Button$2
|
|
7452
7543
|
};
|
|
7453
7544
|
const renderError = errorMessage => {
|
|
7454
|
-
return [textEditorErrorNode, editorContentErrorNode, paragraphNode, text(`Error: ${errorMessage}`), retryButtonNode, text(retry())];
|
|
7545
|
+
return [textEditorErrorNode, editorContentErrorNode, paragraphNode$1, text(`Error: ${errorMessage}`), retryButtonNode, text(retry())];
|
|
7546
|
+
};
|
|
7547
|
+
|
|
7548
|
+
const formatFileSize = fileSize => {
|
|
7549
|
+
if (fileSize < 1024) {
|
|
7550
|
+
return `${fileSize} B`;
|
|
7551
|
+
}
|
|
7552
|
+
if (fileSize < 1024 * 1024) {
|
|
7553
|
+
return `${(fileSize / 1024).toFixed(2)} KB`;
|
|
7554
|
+
}
|
|
7555
|
+
return `${(fileSize / 1024 / 1024).toFixed(2)} MB`;
|
|
7556
|
+
};
|
|
7557
|
+
const button = (action, label, primary = false) => [{
|
|
7558
|
+
childCount: 1,
|
|
7559
|
+
className: mergeClassNames(Button, primary ? ButtonPrimary : ButtonSecondary),
|
|
7560
|
+
'data-action': action,
|
|
7561
|
+
name: action,
|
|
7562
|
+
onClick: HandleClickAction,
|
|
7563
|
+
type: Button$2
|
|
7564
|
+
}, text(label)];
|
|
7565
|
+
const textEditorLargeFileNode = {
|
|
7566
|
+
childCount: 1,
|
|
7567
|
+
className: TextEditorLargeFile,
|
|
7568
|
+
type: Div
|
|
7569
|
+
};
|
|
7570
|
+
const editorContentLargeFileNode = {
|
|
7571
|
+
childCount: 3,
|
|
7572
|
+
className: EditorContentLargeFile,
|
|
7573
|
+
type: Div
|
|
7574
|
+
};
|
|
7575
|
+
const warningIconNode = {
|
|
7576
|
+
ariaHidden: true,
|
|
7577
|
+
childCount: 0,
|
|
7578
|
+
className: EditorLargeFileWarningIcon,
|
|
7579
|
+
type: Div
|
|
7580
|
+
};
|
|
7581
|
+
const paragraphNode = {
|
|
7582
|
+
childCount: 1,
|
|
7583
|
+
type: P
|
|
7584
|
+
};
|
|
7585
|
+
const actionsNode = {
|
|
7586
|
+
childCount: 4,
|
|
7587
|
+
className: EditorContentLargeFileActions,
|
|
7588
|
+
type: Div
|
|
7589
|
+
};
|
|
7590
|
+
const renderLargeFile = fileSize => {
|
|
7591
|
+
return [textEditorLargeFileNode, editorContentLargeFileNode, warningIconNode, paragraphNode, text(`${largeFileNotDisplayed()} (${formatFileSize(fileSize)}).`), actionsNode, ...button(OpenLargeFile, openAnyway(), true), ...button(ConfigureLargeFileLimit, configureLimit())];
|
|
7455
7592
|
};
|
|
7456
7593
|
|
|
7457
7594
|
const textEditorLoadingNode = {
|
|
@@ -7490,6 +7627,9 @@ const renderEditor = tab => {
|
|
|
7490
7627
|
if (tab.loadingState === 'binary') {
|
|
7491
7628
|
return renderBinary();
|
|
7492
7629
|
}
|
|
7630
|
+
if (tab.loadingState === 'large' && tab.fileSize !== undefined) {
|
|
7631
|
+
return renderLargeFile(tab.fileSize);
|
|
7632
|
+
}
|
|
7493
7633
|
|
|
7494
7634
|
// Viewlet is ready - render a reference node
|
|
7495
7635
|
// Frontend will append the pre-created component at this position using the uid
|
|
@@ -8046,7 +8186,7 @@ const render2 = (uid, diffResult) => {
|
|
|
8046
8186
|
const {
|
|
8047
8187
|
newState,
|
|
8048
8188
|
oldState
|
|
8049
|
-
} = get(uid);
|
|
8189
|
+
} = get$1(uid);
|
|
8050
8190
|
set$1(uid, newState, newState);
|
|
8051
8191
|
const commands = applyRender(oldState, newState, diffResult);
|
|
8052
8192
|
if (!isConnected()) {
|
|
@@ -8262,7 +8402,7 @@ const saveEditorAndHandleSettingsChange = async tab => {
|
|
|
8262
8402
|
return editorState;
|
|
8263
8403
|
};
|
|
8264
8404
|
const getLatestStoredState = (uid, fallbackState, referenceTabId, referenceTabUri, allowMissingReference = false) => {
|
|
8265
|
-
const stateFromStore = get(uid);
|
|
8405
|
+
const stateFromStore = get$1(uid);
|
|
8266
8406
|
if (!stateFromStore) {
|
|
8267
8407
|
return fallbackState;
|
|
8268
8408
|
}
|
|
@@ -8617,7 +8757,7 @@ const resize = async (uid, dimensions) => {
|
|
|
8617
8757
|
if (loading) {
|
|
8618
8758
|
await loading;
|
|
8619
8759
|
}
|
|
8620
|
-
const instance = get(uid);
|
|
8760
|
+
const instance = get$1(uid);
|
|
8621
8761
|
if (!instance) {
|
|
8622
8762
|
return [];
|
|
8623
8763
|
}
|
|
@@ -8711,7 +8851,7 @@ const commandMap = {
|
|
|
8711
8851
|
'MainArea.handleTabsDragOver': wrapSerialCommand(handleTabsDragOver),
|
|
8712
8852
|
'MainArea.handleTabsWheel': wrapSerialCommand(handleTabsWheel),
|
|
8713
8853
|
'MainArea.handleTestWorkerMessagePort': handleTestWorkerMessagePort,
|
|
8714
|
-
'MainArea.handleUriChange':
|
|
8854
|
+
'MainArea.handleUriChange': wrapAsyncCommand(handleUriChangeWithContext),
|
|
8715
8855
|
'MainArea.handleWorkspaceChange': wrapSerialCommand(handleWorkspaceChange),
|
|
8716
8856
|
'MainArea.handleWorkspaceRefresh': wrapAsyncCommand(handleWorkspaceRefreshWithContext),
|
|
8717
8857
|
'MainArea.hasActiveTextEditor': wrapGetter(hasActiveTextEditor),
|
|
@@ -8797,7 +8937,7 @@ const refreshFileIcons = async () => {
|
|
|
8797
8937
|
const {
|
|
8798
8938
|
newState,
|
|
8799
8939
|
oldState
|
|
8800
|
-
} = get(uid);
|
|
8940
|
+
} = get$1(uid);
|
|
8801
8941
|
const updatedState = await handleIconThemeChange(newState);
|
|
8802
8942
|
set$1(uid, oldState, updatedState);
|
|
8803
8943
|
}
|