@lvce-editor/main-area-worker 9.73.2 → 9.74.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.
@@ -2064,6 +2064,9 @@ const getLoadFileErrorMessage = error => {
2064
2064
  }
2065
2065
  return error.message;
2066
2066
  };
2067
+ const isBinaryFileError = error => {
2068
+ return error instanceof Error && error.name === 'BinaryFileError';
2069
+ };
2067
2070
  const loadTabContentAsync = async (tabId, path, requestId, getLatestState) => {
2068
2071
  try {
2069
2072
  await loadFileContent(path);
@@ -2101,6 +2104,16 @@ const loadTabContentAsync = async (tabId, path, requestId, getLatestState) => {
2101
2104
  if (latestTab.loadingState !== 'loading') {
2102
2105
  return latestState;
2103
2106
  }
2107
+ if (isBinaryFileError(error)) {
2108
+ return updateTab(latestState, tabId, {
2109
+ editorInput: {
2110
+ type: 'binary',
2111
+ uri: path
2112
+ },
2113
+ errorMessage: undefined,
2114
+ loadingState: 'binary'
2115
+ });
2116
+ }
2104
2117
  const errorMessage = getLoadFileErrorMessage(error);
2105
2118
  return updateTab(latestState, tabId, {
2106
2119
  errorMessage,
@@ -4101,7 +4114,7 @@ const NewTextFile = 'New Text File';
4101
4114
  const NewWindow = 'New Window';
4102
4115
  const OpenFile = 'Open File';
4103
4116
  const OpenAnyway = 'Open Anyway';
4104
- const OpenInTextEditor = 'Open in Text Editor';
4117
+ const OpenInTextEditor = 'Reopen with Text Editor';
4105
4118
  const BinaryFileNotDisplayed = 'The file is not displayed in the text editor because its contents are binary.';
4106
4119
  const LargeFileNotDisplayed = 'The file is not displayed in the text editor because it is very large';
4107
4120
  const SplitDown = 'Split Down';
@@ -5621,6 +5634,9 @@ const getViewletArgs = options => {
5621
5634
  return [{
5622
5635
  ...context,
5623
5636
  focus: options.focus,
5637
+ ...(options.editorInput.type === 'editor' && options.editorInput.forceText === true && {
5638
+ forceText: true
5639
+ }),
5624
5640
  ...(options.forceOpen === true && {
5625
5641
  largeFile: true
5626
5642
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.73.2",
3
+ "version": "9.74.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",