mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: image resizing discoverability (#6804)
This commit is contained in:
@@ -168,6 +168,13 @@ function renderImage(tokens, idx, options, env, slf) {
|
||||
if (token.attrIndex("height") === -1) {
|
||||
token.attrs.push(["height", height]);
|
||||
}
|
||||
|
||||
if (
|
||||
options.discourse.previewing &&
|
||||
match[6] !== "x" &&
|
||||
match[4] !== "x"
|
||||
)
|
||||
token.attrs.push(["class", "resizable"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ function rule(state) {
|
||||
}
|
||||
|
||||
export function setup(helper) {
|
||||
const opts = helper.getOptions();
|
||||
if (opts.previewing) helper.whiteList(["img.resizable"]);
|
||||
helper.whiteList(["img[data-orig-src]"]);
|
||||
helper.registerPlugin(md => {
|
||||
md.core.ruler.push("image-protocol", rule);
|
||||
|
||||
Reference in New Issue
Block a user