@lvce-editor/main-area-worker 9.56.2 → 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 +201 -63
- 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) {
|
|
@@ -6460,6 +6537,7 @@ const CloseSaved = 'Close Saved';
|
|
|
6460
6537
|
const CloseToTheRight = 'Close To The Right';
|
|
6461
6538
|
const CopyPath = 'Copy Path';
|
|
6462
6539
|
const CopyRelativePath = 'Copy Relative Path';
|
|
6540
|
+
const ConfigureLimit = 'Configure Limit';
|
|
6463
6541
|
const FindFileReferences = 'Find File References';
|
|
6464
6542
|
const ReopenEditorWith = 'Reopen Editor With...';
|
|
6465
6543
|
const Share = 'Share';
|
|
@@ -6474,8 +6552,10 @@ const CopyIntoNewWindow = 'Copy into New Window';
|
|
|
6474
6552
|
const NewTextFile = 'New Text File';
|
|
6475
6553
|
const NewWindow = 'New Window';
|
|
6476
6554
|
const OpenFile = 'Open File';
|
|
6555
|
+
const OpenAnyway = 'Open Anyway';
|
|
6477
6556
|
const OpenInTextEditor = 'Open in Text Editor';
|
|
6478
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';
|
|
6479
6559
|
const SplitDown = 'Split Down';
|
|
6480
6560
|
const SplitEditorGroup = 'Split Editor Group';
|
|
6481
6561
|
const SplitLeft = 'Split Left';
|
|
@@ -6493,6 +6573,15 @@ const openInTextEditor = () => {
|
|
|
6493
6573
|
const binaryFileNotDisplayed = () => {
|
|
6494
6574
|
return i18nString(BinaryFileNotDisplayed);
|
|
6495
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
|
+
};
|
|
6496
6585
|
const splitUp = () => {
|
|
6497
6586
|
return i18nString(SplitUp);
|
|
6498
6587
|
};
|
|
@@ -7400,7 +7489,7 @@ const editorContentBinaryNode = {
|
|
|
7400
7489
|
className: EditorContentBinary,
|
|
7401
7490
|
type: Div
|
|
7402
7491
|
};
|
|
7403
|
-
const paragraphNode$
|
|
7492
|
+
const paragraphNode$2 = {
|
|
7404
7493
|
childCount: 1,
|
|
7405
7494
|
type: P
|
|
7406
7495
|
};
|
|
@@ -7413,7 +7502,7 @@ const openInTextEditorButtonNode = {
|
|
|
7413
7502
|
type: Button$2
|
|
7414
7503
|
};
|
|
7415
7504
|
const renderBinary = () => {
|
|
7416
|
-
return [textEditorBinaryNode, editorContentBinaryNode, paragraphNode$
|
|
7505
|
+
return [textEditorBinaryNode, editorContentBinaryNode, paragraphNode$2, text(binaryFileNotDisplayed()), openInTextEditorButtonNode, text(openInTextEditor())];
|
|
7417
7506
|
};
|
|
7418
7507
|
|
|
7419
7508
|
const textEditorNode = {
|
|
@@ -7440,7 +7529,7 @@ const editorContentErrorNode = {
|
|
|
7440
7529
|
className: EditorContentError,
|
|
7441
7530
|
type: Div
|
|
7442
7531
|
};
|
|
7443
|
-
const paragraphNode = {
|
|
7532
|
+
const paragraphNode$1 = {
|
|
7444
7533
|
childCount: 1,
|
|
7445
7534
|
type: P
|
|
7446
7535
|
};
|
|
@@ -7453,7 +7542,53 @@ const retryButtonNode = {
|
|
|
7453
7542
|
type: Button$2
|
|
7454
7543
|
};
|
|
7455
7544
|
const renderError = errorMessage => {
|
|
7456
|
-
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())];
|
|
7457
7592
|
};
|
|
7458
7593
|
|
|
7459
7594
|
const textEditorLoadingNode = {
|
|
@@ -7492,6 +7627,9 @@ const renderEditor = tab => {
|
|
|
7492
7627
|
if (tab.loadingState === 'binary') {
|
|
7493
7628
|
return renderBinary();
|
|
7494
7629
|
}
|
|
7630
|
+
if (tab.loadingState === 'large' && tab.fileSize !== undefined) {
|
|
7631
|
+
return renderLargeFile(tab.fileSize);
|
|
7632
|
+
}
|
|
7495
7633
|
|
|
7496
7634
|
// Viewlet is ready - render a reference node
|
|
7497
7635
|
// Frontend will append the pre-created component at this position using the uid
|
|
@@ -8048,7 +8186,7 @@ const render2 = (uid, diffResult) => {
|
|
|
8048
8186
|
const {
|
|
8049
8187
|
newState,
|
|
8050
8188
|
oldState
|
|
8051
|
-
} = get(uid);
|
|
8189
|
+
} = get$1(uid);
|
|
8052
8190
|
set$1(uid, newState, newState);
|
|
8053
8191
|
const commands = applyRender(oldState, newState, diffResult);
|
|
8054
8192
|
if (!isConnected()) {
|
|
@@ -8264,7 +8402,7 @@ const saveEditorAndHandleSettingsChange = async tab => {
|
|
|
8264
8402
|
return editorState;
|
|
8265
8403
|
};
|
|
8266
8404
|
const getLatestStoredState = (uid, fallbackState, referenceTabId, referenceTabUri, allowMissingReference = false) => {
|
|
8267
|
-
const stateFromStore = get(uid);
|
|
8405
|
+
const stateFromStore = get$1(uid);
|
|
8268
8406
|
if (!stateFromStore) {
|
|
8269
8407
|
return fallbackState;
|
|
8270
8408
|
}
|
|
@@ -8619,7 +8757,7 @@ const resize = async (uid, dimensions) => {
|
|
|
8619
8757
|
if (loading) {
|
|
8620
8758
|
await loading;
|
|
8621
8759
|
}
|
|
8622
|
-
const instance = get(uid);
|
|
8760
|
+
const instance = get$1(uid);
|
|
8623
8761
|
if (!instance) {
|
|
8624
8762
|
return [];
|
|
8625
8763
|
}
|
|
@@ -8713,7 +8851,7 @@ const commandMap = {
|
|
|
8713
8851
|
'MainArea.handleTabsDragOver': wrapSerialCommand(handleTabsDragOver),
|
|
8714
8852
|
'MainArea.handleTabsWheel': wrapSerialCommand(handleTabsWheel),
|
|
8715
8853
|
'MainArea.handleTestWorkerMessagePort': handleTestWorkerMessagePort,
|
|
8716
|
-
'MainArea.handleUriChange':
|
|
8854
|
+
'MainArea.handleUriChange': wrapAsyncCommand(handleUriChangeWithContext),
|
|
8717
8855
|
'MainArea.handleWorkspaceChange': wrapSerialCommand(handleWorkspaceChange),
|
|
8718
8856
|
'MainArea.handleWorkspaceRefresh': wrapAsyncCommand(handleWorkspaceRefreshWithContext),
|
|
8719
8857
|
'MainArea.hasActiveTextEditor': wrapGetter(hasActiveTextEditor),
|
|
@@ -8799,7 +8937,7 @@ const refreshFileIcons = async () => {
|
|
|
8799
8937
|
const {
|
|
8800
8938
|
newState,
|
|
8801
8939
|
oldState
|
|
8802
|
-
} = get(uid);
|
|
8940
|
+
} = get$1(uid);
|
|
8803
8941
|
const updatedState = await handleIconThemeChange(newState);
|
|
8804
8942
|
set$1(uid, oldState, updatedState);
|
|
8805
8943
|
}
|