mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 12:57:31 -05:00
Clean up webview click handler
This commit is contained in:
@@ -47,13 +47,15 @@ import { Position } from 'vs/platform/editor/common/editor';
|
||||
import { IListService } from 'vs/platform/list/browser/listService';
|
||||
|
||||
function renderBody(body: string): string {
|
||||
const nonce = new Date().getTime() + '' + new Date().getMilliseconds();
|
||||
return `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="${ require.toUrl('./media/markdown.css')}" >
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src http: https: data:; media-src http: https: data:; script-src 'none'; style-src 'nonce-${nonce}'; child-src 'none'; frame-src 'none';">
|
||||
<link rel="stylesheet" type="text/css" href="${require.toUrl('./media/markdown.css')}" nonce="${nonce}" >
|
||||
</head>
|
||||
<body>${ body}</body>
|
||||
<body>${body}</body>
|
||||
</html>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
// bubble out link-clicks
|
||||
if (newFrame.contentDocument.body) {
|
||||
newFrame.contentDocument.body.addEventListener("click", handleInnerClick);
|
||||
newFrame.contentDocument.body.addEventListener('click', handleInnerClick);
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
@@ -176,4 +176,4 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||
|
||||
// signal ready
|
||||
ipcRenderer.sendToHost('webview-ready', process.pid);
|
||||
});
|
||||
});
|
||||
@@ -21,13 +21,15 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
|
||||
|
||||
function renderBody(body: string): string {
|
||||
const nonce = new Date().getTime() + '' + new Date().getMilliseconds();
|
||||
return `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="${ require.toUrl('./media/markdown.css')}" >
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src http: https: data:; media-src http: https: data:; script-src 'none'; style-src 'nonce-${nonce}'; child-src 'none'; frame-src 'none';">
|
||||
<link rel="stylesheet" type="text/css" href="${require.toUrl('./media/markdown.css')}" nonce="${nonce}" >
|
||||
</head>
|
||||
<body>${ body}</body>
|
||||
<body>${body}</body>
|
||||
</html>`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user