mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: Extend plugin API for uploads (#8440)
* DEV: Add API to alter uploads Markdown * DEV: Extract data attributes from image / download Markdown For example '[test|attachment|hello=world]' will generate an 'a' element with a data attribute: 'data-hello=world'. This commit also makes MarkdownIt to transform '|attachment' into 'class="attachment"'. This transformation used to be a part of the process which resolves short URLs (i.e. upload://). * DEV: Export imageNameFromFileName
This commit is contained in:
@ -7,6 +7,7 @@ import {
|
||||
applyCachedInlineOnebox,
|
||||
deleteCachedInlineOnebox
|
||||
} from "pretty-text/inline-oneboxer";
|
||||
import { extractDataAttribute } from "pretty-text/engines/discourse-markdown-it";
|
||||
|
||||
QUnit.module("lib:pretty-text");
|
||||
|
||||
@ -1365,3 +1366,11 @@ QUnit.test("emoji - emojiSet", assert => {
|
||||
`<p><img src="/images/emoji/twitter/smile.png?v=${v}" title=":smile:" class="emoji" alt=":smile:"></p>`
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("extractDataAttribute", assert => {
|
||||
assert.deepEqual(extractDataAttribute("foo="), ["data-foo", ""]);
|
||||
assert.deepEqual(extractDataAttribute("foo=bar"), ["data-foo", "bar"]);
|
||||
|
||||
assert.notOk(extractDataAttribute("foo?=bar"));
|
||||
assert.notOk(extractDataAttribute("https://discourse.org/?q=hello"));
|
||||
});
|
||||
|
Reference in New Issue
Block a user