Update ImageUtilities.plugin.js

This commit is contained in:
Mirco Wittrien 2022-06-28 18:03:54 +02:00
parent c4689e78b0
commit 329e19853f
1 changed files with 97 additions and 93 deletions

View File

@ -2,7 +2,7 @@
* @name ImageUtilities
* @author DevilBro
* @authorId 278543574059057154
* @version 4.7.5
* @version 4.7.6
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "ImageUtilities",
"author": "DevilBro",
"version": "4.7.5",
"version": "4.7.6",
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
}
};
@ -258,7 +258,7 @@ module.exports = (_ => {
},
after: {
ImageModal: ["render", "componentDidMount", "componentWillUnmount"],
LazyImage: "componentDidMount",
LazyImage: ["componentDidMount", "componentDidUpdate"],
LazyImageZoomable: "render",
Spoiler: "render",
UserBanner: "default"
@ -379,8 +379,6 @@ module.exports = (_ => {
${BDFDB.dotCNS._imageutilitiesoperations + BDFDB.dotCN.anchor + BDFDB.dotCN.downloadlink} {
margin: 0 !important;
}
${BDFDB.dotCN.embedfull} {
}
`;
}
@ -1139,10 +1137,15 @@ module.exports = (_ => {
processLazyImage (e) {
if (e.node) {
if (e.instance.props.resized && e.instance.state.readyState != BDFDB.LibraryComponents.Image.ImageReadyStates.READY) {
if (e.instance.props.resized) {
let embed = BDFDB.DOMUtils.getParent(BDFDB.dotCN.embedfull, e.node);
if (embed) embed.style.setProperty("max-width", "unset", "important");
if (e.instance.state.readyState != BDFDB.LibraryComponents.Image.ImageReadyStates.READY) {
e.instance.state.readyState = BDFDB.LibraryComponents.Image.ImageReadyStates.READY;
BDFDB.ReactUtils.forceUpdate(e.instance);
}
}
if (e.methodname == "componentDidMount") {
let isVideo = (typeof e.instance.props.children == "function" && e.instance.props.children(Object.assign({}, e.instance.props, {size: e.instance.props})) || {type: {}}).type.displayName == "Video";
if (this.settings.viewerSettings.zoomMode && !isVideo && !BDFDB.DOMUtils.containsClass(e.node.parentElement, BDFDB.disCN._imageutilitiessibling) && BDFDB.ReactUtils.findOwner(BDFDB.ReactUtils.getInstance(e.node), {name: "ImageModal", up: true})) {
e.node.addEventListener("mousedown", event => {
@ -1238,6 +1241,7 @@ module.exports = (_ => {
});
}
}
}
else {
let reactInstance = BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`);
if (this.settings.rescaleSettings.imageViewer != "NONE" && BDFDB.ReactUtils.findOwner(reactInstance, {name: "ImageModal", up: true})) {