diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/repo/components/blob_viewer_switch.vue | 10 | ||||
-rw-r--r-- | app/assets/javascripts/repo/components/source_copy_button.vue | 17 |
2 files changed, 19 insertions, 8 deletions
diff --git a/app/assets/javascripts/repo/components/blob_viewer_switch.vue b/app/assets/javascripts/repo/components/blob_viewer_switch.vue index 0b4379773a6..29efecb3235 100644 --- a/app/assets/javascripts/repo/components/blob_viewer_switch.vue +++ b/app/assets/javascripts/repo/components/blob_viewer_switch.vue @@ -16,6 +16,12 @@ richTooltip() { return `Display ${this.activeFile.rich.switcherTitle}`; }, + simpleIconClass() { + return `fa-${this.activeFile.simple.icon}`; + }, + richIconClass() { + return `fa-${this.activeFile.rich.icon}`; + }, }, methods: { ...mapActions([ @@ -44,7 +50,7 @@ > <i class="fa" - :class="'fa-' + activeFile.simple.icon" + :class="simpleIconClass" aria-hidden="true" > </i> @@ -63,7 +69,7 @@ > <i class="fa" - :class="'fa-' + activeFile.rich.icon" + :class="richIconClass" aria-hidden="true" > </i> diff --git a/app/assets/javascripts/repo/components/source_copy_button.vue b/app/assets/javascripts/repo/components/source_copy_button.vue index 3a21c214fa1..672bf01ef76 100644 --- a/app/assets/javascripts/repo/components/source_copy_button.vue +++ b/app/assets/javascripts/repo/components/source_copy_button.vue @@ -29,10 +29,10 @@ 'changeFileViewer', ]), clickCopy(e) { - if (this.activeFile.currentViewer !== 'simple') { + if (this.activeFile.currentViewer !== 'simple' && this.activeFile.simple.html !== '') { e.stopPropagation(); - this.changeFileViewer({ + return this.changeFileViewer({ file: this.activeFile, type: 'simple', }).then(() => { @@ -43,8 +43,13 @@ setTimeout(() => { this.$refs.clipboardBtn.click(); }); - }).catch(() => {}); + }); + } else if (this.activeFile.currentViewer !== 'simple' && this.activeFile.simple.html === '') { + e.stopPropagation(); + return false; } + + return true; }, }, }; @@ -61,9 +66,9 @@ :title="copySourceButtonTitle" :aria-label="copySourceButtonTitle" data-container="body" - :data-clipboard-target="blobContentElementSelector" - @click="clickCopy($event)" - ref="clipboardBtn" + :data-clipboard-target="blobContentElementSelector" + @click="clickCopy($event)" + ref="clipboardBtn" > <i aria-hidden="true" |