diff --git a/src/webviews/rebase/rebaseEditor.ts b/src/webviews/rebase/rebaseEditor.ts
index 2e0ae45..58db9de 100644
--- a/src/webviews/rebase/rebaseEditor.ts
+++ b/src/webviews/rebase/rebaseEditor.ts
@@ -503,21 +503,16 @@ export class RebaseEditorProvider implements CustomTextEditorProvider, Disposabl
const root = context.panel.webview.asWebviewUri(this.container.context.extensionUri).toString();
const webRoot = context.panel.webview.asWebviewUri(webRootUri).toString();
- const html = content
- .replace(/#{(head|body|endOfBody|placement)}/i, (_substring, token) => {
+ const html = content.replace(
+ /#{(head|body|endOfBody|placement|cspSource|cspNonce|root|webroot)}/i,
+ (_substring, token) => {
switch (token) {
case 'endOfBody':
- return ``;
case 'placement':
return 'editor';
- default:
- return '';
- }
- })
- .replace(/#{(cspSource|cspNonce|root|webroot)}/g, (_substring, token) => {
- switch (token) {
case 'cspSource':
return cspSource;
case 'cspNonce':
@@ -529,7 +524,8 @@ export class RebaseEditorProvider implements CustomTextEditorProvider, Disposabl
default:
return '';
}
- });
+ },
+ );
return html;
}
diff --git a/src/webviews/webviewBase.ts b/src/webviews/webviewBase.ts
index 5de1d83..80a9c42 100644
--- a/src/webviews/webviewBase.ts
+++ b/src/webviews/webviewBase.ts
@@ -203,27 +203,24 @@ export abstract class WebviewBase implements Disposable {
const root = webview.asWebviewUri(this.container.context.extensionUri).toString();
const webRoot = webview.asWebviewUri(webRootUri).toString();
- const html = content
- .replace(/#{(head|body|endOfBody|placement)}/i, (_substring, token) => {
+ const html = content.replace(
+ /#{(head|body|endOfBody|placement|cspSource|cspNonce|root|webroot)}/g,
+ (_substring, token) => {
switch (token) {
case 'head':
return head ?? '';
case 'body':
return body ?? '';
case 'endOfBody':
- return bootstrap != null
- ? `${endOfBody ?? ''}`
- : endOfBody ?? '';
+ return `${
+ bootstrap != null
+ ? ``
+ : ''
+ }${endOfBody ?? ''}`;
case 'placement':
return 'editor';
- default:
- return '';
- }
- })
- .replace(/#{(cspSource|cspNonce|root|webroot)}/g, (_substring, token) => {
- switch (token) {
case 'cspSource':
return cspSource;
case 'cspNonce':
@@ -235,7 +232,8 @@ export abstract class WebviewBase implements Disposable {
default:
return '';
}
- });
+ },
+ );
return html;
}
diff --git a/src/webviews/webviewViewBase.ts b/src/webviews/webviewViewBase.ts
index 5b06c63..0f191a1 100644
--- a/src/webviews/webviewViewBase.ts
+++ b/src/webviews/webviewViewBase.ts
@@ -208,27 +208,24 @@ export abstract class WebviewViewBase implements WebviewViewProvider, Dis
const root = webview.asWebviewUri(this.container.context.extensionUri).toString();
const webRoot = webview.asWebviewUri(webRootUri).toString();
- const html = content
- .replace(/#{(head|body|endOfBody|placement)}/i, (_substring, token) => {
+ const html = content.replace(
+ /#{(head|body|endOfBody|placement|cspSource|cspNonce|root|webroot)}/g,
+ (_substring, token) => {
switch (token) {
case 'head':
return head ?? '';
case 'body':
return body ?? '';
case 'endOfBody':
- return bootstrap != null
- ? `${endOfBody ?? ''}`
- : endOfBody ?? '';
+ return `${
+ bootstrap != null
+ ? ``
+ : ''
+ }${endOfBody ?? ''}`;
case 'placement':
return 'view';
- default:
- return '';
- }
- })
- .replace(/#{(cspSource|cspNonce|root|webroot)}/g, (_substring, token) => {
- switch (token) {
case 'cspSource':
return cspSource;
case 'cspNonce':
@@ -240,7 +237,8 @@ export abstract class WebviewViewBase implements WebviewViewProvider, Dis
default:
return '';
}
- });
+ },
+ );
return html;
}