mirror of
https://github.com/discourse/discourse.git
synced 2025-06-10 16:13:40 +08:00
FIX: prevent redirect when image scale btn is inside a link.
Currently in composer preview, if the image scale buttons are inside a `<a>` link then it redirects to the `href` location after the image scaling task.
This commit is contained in:
@ -799,10 +799,8 @@ export default Component.extend({
|
|||||||
|
|
||||||
if (matchingPlaceholder) {
|
if (matchingPlaceholder) {
|
||||||
const match = matchingPlaceholder[index];
|
const match = matchingPlaceholder[index];
|
||||||
if (!match) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (match) {
|
||||||
const replacement = match.replace(
|
const replacement = match.replace(
|
||||||
imageScaleRegex,
|
imageScaleRegex,
|
||||||
``
|
``
|
||||||
@ -815,6 +813,10 @@ export default Component.extend({
|
|||||||
{ regex: imageScaleRegex, index }
|
{ regex: imageScaleRegex, index }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ QUnit.test("Image resizing buttons", async assert => {
|
|||||||
|
|
||||||
let uploads = [
|
let uploads = [
|
||||||
// 0 Default markdown with dimensions- should work
|
// 0 Default markdown with dimensions- should work
|
||||||
"",
|
"<a href='https://example.com'></a>",
|
||||||
// 1 Image with scaling percentage, should work
|
// 1 Image with scaling percentage, should work
|
||||||
"",
|
"",
|
||||||
// 2 image with scaling percentage and a proceeding whitespace, should work
|
// 2 image with scaling percentage and a proceeding whitespace, should work
|
||||||
@ -784,7 +784,8 @@ QUnit.test("Image resizing buttons", async assert => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
uploads[0] = "";
|
uploads[0] =
|
||||||
|
"<a href='https://example.com'></a>";
|
||||||
await click(
|
await click(
|
||||||
find(".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']")
|
find(".button-wrapper[data-image-index='0'] .scale-btn[data-scale='50']")
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user