Skip to content

Commit 65dff8e

Browse files
authored
Support Copy Link for video attachments (#24833)
Creating a `<video>` tag with controls and title.
1 parent 268d121 commit 65dff8e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

web_src/js/features/common-global.js

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {showGlobalErrorMessage} from '../bootstrap.js';
77
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
88
import {svg} from '../svg.js';
99
import {hideElem, showElem, toggleElem} from '../utils/dom.js';
10+
import {htmlEscape} from 'escape-goat';
1011

1112
const {appUrl, csrfToken} = window.config;
1213

@@ -168,6 +169,8 @@ export function initGlobalDropzone() {
168169
let fileMarkdown = `[${file.name}](/attachments/${file.uuid})`;
169170
if (file.type.startsWith('image/')) {
170171
fileMarkdown = `!${fileMarkdown}`;
172+
} else if (file.type.startsWith('video/')) {
173+
fileMarkdown = `<video src="/attachments/${file.uuid}" title="${htmlEscape(file.name)}" controls></video>`;
171174
}
172175
navigator.clipboard.writeText(fileMarkdown);
173176
});

0 commit comments

Comments
 (0)