未验证 提交 99af99de 编写于 作者: F Fatih Acet

Handle onDidChangeViewState to resurrect the content

上级 0c198574
......@@ -64,18 +64,15 @@ const createPanel = issuable => {
});
};
async function create(issuable) {
const panel = createPanel(issuable);
const html = replaceResources();
panel.webview.html = html;
async function handleCreate(panel, issuable) {
const discussions = await gitLabService.fetchDiscussions(issuable);
panel.webview.postMessage({ type: 'issuableFetch', issuable, discussions });
panel.webview.onDidReceiveMessage(async message => {
if (message.command === 'renderMarkdown') {
let rendered = await gitLabService.renderMarkdown(message.markdown);
rendered = rendered.replace(/ src=".*" alt/gim, ' alt').replace(/" data-src/gim, '" src');
rendered = (rendered || '')
.replace(/ src=".*" alt/gim, ' alt')
.replace(/" data-src/gim, '" src');
panel.webview.postMessage({
type: 'markdownRendered',
......@@ -87,5 +84,17 @@ async function create(issuable) {
});
}
async function create(issuable) {
const panel = createPanel(issuable);
const html = replaceResources();
panel.webview.html = html;
panel.onDidChangeViewState(() => {
handleCreate(panel, issuable);
});
handleCreate(panel, issuable);
}
exports.addDeps = addDeps;
exports.create = create;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册