Skip to content

Commit

Permalink
Make resource viewer take whole webview width, prevent extension name…
Browse files Browse the repository at this point in the history
… '..' (#426)
  • Loading branch information
tjcouch-sil authored Sep 12, 2023
2 parents 0ff5c93 + 938617a commit 5709ed3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extensions/src/resource-viewer/resource-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { IWebViewProvider } from 'shared/models/web-view-provider.model';
import type { SavedWebViewDefinition, WebViewDefinition } from 'shared/data/web-view.model';
import type { ExecutionActivationContext } from 'extension-host/extension-types/extension-activation-context.model';
import resourceViewerWebView from './resource-viewer.web-view?inline';
import resourceViewerWebViewStyles from './resource-viewer.web-view.scss?inline';

const { logger } = papi;
logger.info('Resource Viewer is importing!');
Expand All @@ -22,6 +23,7 @@ const resourceWebViewProvider: IWebViewProvider = {
...savedWebView,
title: 'Resource Viewer',
content: resourceViewerWebView,
styles: resourceViewerWebViewStyles,
};
},
};
Expand Down
5 changes: 5 additions & 0 deletions extensions/src/resource-viewer/resource-viewer.web-view.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This class is built into the `usxeditor` library. We just need to override it
/* stylelint-disable-next-line selector-class-pattern */
.usxEditor {
width: auto !important;
}
2 changes: 2 additions & 0 deletions src/extension-host/services/extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ let availableExtensions: ExtensionInfo[];
/** Parse string extension manifest into an object and perform any transformations needed */
function parseManifest(extensionManifestJson: string): ExtensionManifest {
const extensionManifest = JSON.parse(extensionManifestJson) as ExtensionManifest;
if (extensionManifest.name.includes('..'))
throw new Error('Extension name must not include `..`!');
// Replace ts with js so people can list their source code ts name but run the transpiled js
if (extensionManifest.main && extensionManifest.main.toLowerCase().endsWith('.ts'))
extensionManifest.main = `${extensionManifest.main.slice(0, -3)}.js`;
Expand Down

0 comments on commit 5709ed3

Please sign in to comment.