Skip to content

Commit

Permalink
repo: yarn upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Aug 31, 2020
1 parent 10e16fe commit e198c7c
Show file tree
Hide file tree
Showing 3 changed files with 2,353 additions and 2,300 deletions.
2 changes: 1 addition & 1 deletion packages/git/src/browser/git-repository-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class GitRepositoryProvider {
this.fileService.onDidFilesChange(_ => this.lazyRefresh());
}

protected lazyRefresh: () => Promise<void> = debounce(() => this.refresh(), 1000);
protected lazyRefresh: () => Promise<void> | undefined = debounce(() => this.refresh(), 1000);

/**
* Returns with the previously selected repository, or if no repository has been selected yet,
Expand Down
50 changes: 26 additions & 24 deletions packages/preview/src/browser/markdown/markdown-preview-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,23 @@ export class MarkdownPreviewHandler implements PreviewHandler {
: self.renderToken(tokens, index, options);
};
}
const originalImageRenderer = engine.renderer.rules['image'];
engine.renderer.rules['image'] = (tokens, index, options, env, self) => {
if (RenderContentParams.is(env)) {
const documentUri = env.originUri;
const token = tokens[index];
if (token.attrs) {
const srcAttr = token.attrs.find(a => a[0] === 'src');
if (srcAttr) {
const href = srcAttr[1];
srcAttr[1] = this.linkNormalizer.normalizeLink(documentUri, href);
const originalImageRenderer = engine.renderer.rules.image;
if (originalImageRenderer) {
engine.renderer.rules.image = (tokens, index, options, env, self) => {
if (RenderContentParams.is(env)) {
const documentUri = env.originUri;
const token = tokens[index];
if (token.attrs) {
const srcAttr = token.attrs.find(a => a[0] === 'src');
if (srcAttr) {
const href = srcAttr[1];
srcAttr[1] = this.linkNormalizer.normalizeLink(documentUri, href);
}
}
}
}
// tslint:disable-next-line:no-void-expression
return originalImageRenderer(tokens, index, options, env, self);
};
return originalImageRenderer(tokens, index, options, env, self);
};
}

const domParser = new DOMParser();

Expand Down Expand Up @@ -288,16 +289,17 @@ export class MarkdownPreviewHandler implements PreviewHandler {

for (const name of ['html_block', 'html_inline']) {
const originalRenderer = engine.renderer.rules[name];
engine.renderer.rules[name] = (tokens, index, options, env, self) => {
const currentToken = tokens[index];
const content = currentToken.content;
if (content.includes('<img') && RenderContentParams.is(env)) {
const documentUri = env.originUri;
currentToken.content = normalizeAllImgSrcInHTML(content, link => this.linkNormalizer.normalizeLink(documentUri, link));
}
// tslint:disable-next-line:no-void-expression
return originalRenderer(tokens, index, options, env, self);
};
if (originalRenderer) {
engine.renderer.rules[name] = (tokens, index, options, env, self) => {
const currentToken = tokens[index];
const content = currentToken.content;
if (content.includes('<img') && RenderContentParams.is(env)) {
const documentUri = env.originUri;
currentToken.content = normalizeAllImgSrcInHTML(content, link => this.linkNormalizer.normalizeLink(documentUri, link));
}
return originalRenderer(tokens, index, options, env, self);
};
}
}

anchor(engine, {});
Expand Down
Loading

0 comments on commit e198c7c

Please sign in to comment.