diff --git a/app/assets/javascripts/behaviors/markdown/editor_extensions.js b/app/assets/javascripts/behaviors/markdown/editor_extensions.js index 47e5fc65c48..8bd2145db1c 100644 --- a/app/assets/javascripts/behaviors/markdown/editor_extensions.js +++ b/app/assets/javascripts/behaviors/markdown/editor_extensions.js @@ -21,6 +21,7 @@ import Reference from './nodes/reference'; import TableOfContents from './nodes/table_of_contents'; import Video from './nodes/video'; +import Audio from './nodes/audio'; import BulletList from './nodes/bullet_list'; import OrderedList from './nodes/ordered_list'; @@ -78,6 +79,7 @@ export default [ new TableOfContents(), new Video(), + new Audio(), new BulletList(), new OrderedList(), diff --git a/app/assets/javascripts/behaviors/markdown/nodes/audio.js b/app/assets/javascripts/behaviors/markdown/nodes/audio.js new file mode 100644 index 00000000000..48ac408cf24 --- /dev/null +++ b/app/assets/javascripts/behaviors/markdown/nodes/audio.js @@ -0,0 +1,53 @@ +/* eslint-disable class-methods-use-this */ + +import { Node } from 'tiptap'; +import { defaultMarkdownSerializer } from 'prosemirror-markdown'; + +// Transforms generated HTML back to GFM for Banzai::Filter::AudioLinkFilter +export default class Audio extends Node { + get name() { + return 'audio'; + } + + get schema() { + return { + attrs: { + src: {}, + alt: { + default: null, + }, + }, + group: 'block', + draggable: true, + parseDOM: [ + { + tag: '.audio-container', + skip: true, + }, + { + tag: '.audio-container p', + priority: 51, + ignore: true, + }, + { + tag: 'audio[src]', + getAttrs: el => ({ src: el.getAttribute('src'), alt: el.dataset.title }), + }, + ], + toDOM: node => [ + 'audio', + { + src: node.attrs.src, + controls: true, + 'data-setup': '{}', + 'data-title': node.attrs.alt, + }, + ], + }; + } + + toMarkdown(state, node) { + defaultMarkdownSerializer.nodes.image(state, node); + state.closeBlock(node); + } +} diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index 9ea455069f3..07e4dde41d9 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -107,18 +107,18 @@ export default class BlobViewer { toggleCopyButtonState() { if (!this.copySourceBtn) return; if (this.simpleViewer.getAttribute('data-loaded')) { - this.copySourceBtn.setAttribute('title', __('Copy source to clipboard')); + this.copySourceBtn.setAttribute('title', __('Copy file contents')); this.copySourceBtn.classList.remove('disabled'); } else if (this.activeViewer === this.simpleViewer) { this.copySourceBtn.setAttribute( 'title', - __('Wait for the source to load to copy it to the clipboard'), + __('Wait for the file to load to copy its contents'), ); this.copySourceBtn.classList.add('disabled'); } else { this.copySourceBtn.setAttribute( 'title', - __('Switch to the source to copy it to the clipboard'), + __('Switch to the source to copy the file contents'), ); this.copySourceBtn.classList.add('disabled'); } diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index 4d3e759d8d4..b95f97077f6 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -294,7 +294,7 @@ export default { @@ -472,7 +472,7 @@ export default { diff --git a/app/assets/javascripts/clusters/components/knative_domain_editor.vue b/app/assets/javascripts/clusters/components/knative_domain_editor.vue index e26ef135bc5..25347b11b6c 100644 --- a/app/assets/javascripts/clusters/components/knative_domain_editor.vue +++ b/app/assets/javascripts/clusters/components/knative_domain_editor.vue @@ -103,7 +103,7 @@ export default { diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue index 761fd1583ed..43a7703f611 100644 --- a/app/assets/javascripts/diffs/components/commit_item.vue +++ b/app/assets/javascripts/diffs/components/commit_item.vue @@ -121,7 +121,7 @@ export default {
diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index bfcc726a030..665328eb234 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -209,7 +209,7 @@ export default { diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index 084f736911f..9ecb9324f8c 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -1,4 +1,7 @@