提交 3b16023c 编写于 作者: M Matt Bierner

Clean up webview click handler

上级 511ab6c4
......@@ -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);
});
});
\ No newline at end of file
......@@ -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>`;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册