Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-02 18:11:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-02 18:11:35 +0300
commitbea3a92105825c1fcef145727ba87bee3e31daee (patch)
treedde3c9fa4425865a8d3b49f3aaf73c7d04e6c592 /app/assets/javascripts/notebook
parentbd1df17345c7fe8cbc19a9716b931acdbb7d0ce5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notebook')
-rw-r--r--app/assets/javascripts/notebook/cells/markdown.vue13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/assets/javascripts/notebook/cells/markdown.vue b/app/assets/javascripts/notebook/cells/markdown.vue
index 4bb35c919ed..1384c9c40b3 100644
--- a/app/assets/javascripts/notebook/cells/markdown.vue
+++ b/app/assets/javascripts/notebook/cells/markdown.vue
@@ -94,7 +94,16 @@ renderer.image = function image(href, title, text) {
const attachmentHeader = `attachment:`; // eslint-disable-line @gitlab/require-i18n-strings
if (!this.attachments || !href.startsWith(attachmentHeader)) {
- return this.originalImage(href, title, text);
+ let relativeHref = href;
+
+ // eslint-disable-next-line @gitlab/require-i18n-strings
+ if (!(href.startsWith('http') || href.startsWith('data:'))) {
+ // These are images within the repo. This will only work if the image
+ // is relative to the path where the file is located
+ relativeHref = this.relativeRawPath + href;
+ }
+
+ return this.originalImage(relativeHref, title, text);
}
let img = ``;
@@ -129,6 +138,7 @@ export default {
components: {
prompt: Prompt,
},
+ inject: ['relativeRawPath'],
props: {
cell: {
type: Object,
@@ -138,6 +148,7 @@ export default {
computed: {
markdown() {
renderer.attachments = this.cell.attachments;
+ renderer.relativeRawPath = this.relativeRawPath;
return sanitize(marked(this.cell.source.join('').replace(/\\/g, '\\\\')), markdownConfig);
},