FEATURE: image resizing discoverability (#6804)

This commit is contained in:
Maja Komel
2019-02-27 11:46:16 +01:00
committed by Régis Hanol
parent f68a7a16a4
commit 7d2ea2d4dd
6 changed files with 279 additions and 6 deletions

View File

@@ -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"]);
}
}
}

View File

@@ -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);