Improvements for Content Copy (#21842)
It now supports copying Markdown, SVG and Images (not in Firefox currently because of lacking [`ClipboardItem`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem) support, but can be enabled in `about:config` and works). It will fetch the data if in a rendered view or when it's an image. Followup to https://github.com/go-gitea/gitea/pull/21629.
This commit is contained in:
parent
e4eaa68a2b
commit
c2fb27beb4
12 changed files with 144 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
|||
import {expect, test} from 'vitest';
|
||||
import {
|
||||
basename, extname, isObject, uniq, stripTags, joinPaths, parseIssueHref,
|
||||
prettyNumber, parseUrl, translateMonth, translateDay
|
||||
prettyNumber, parseUrl, translateMonth, translateDay, blobToDataURI,
|
||||
} from './utils.js';
|
||||
|
||||
test('basename', () => {
|
||||
|
@ -131,3 +131,8 @@ test('translateDay', () => {
|
|||
expect(translateDay(5)).toEqual('pt.');
|
||||
document.documentElement.lang = originalLang;
|
||||
});
|
||||
|
||||
test('blobToDataURI', async () => {
|
||||
const blob = new Blob([JSON.stringify({test: true})], {type: 'application/json'});
|
||||
expect(await blobToDataURI(blob)).toEqual('data:application/json;base64,eyJ0ZXN0Ijp0cnVlfQ==');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue