Add post images hook (#5828)

* Add post images hook

This hook would allow plugins to manipulate images inside posts  after images are manipulated by nodebb (for example, delay loading). Without this hook we can manipulate images by searching post data for them and manipulate that data, but any change on that level is either erased by nodebb once image loading starts (if delay is turned on) or it disables native image behaviour by changing image code so native behaviour is not triggered.
Hook at this place works for both delayed loading turned on and off.
Usage for this kind of hook was talked about here: https://community.nodebb.org/topic/10960/opening-uploaded-images-in-modal-windows

* trying to fix Travis error

* Update images.js

Hook moved out of wrapImagesInLinks function to places where images are actually loaded. One of the places is inside unloadImage function but in place where loading is happening because of failed if check (delayImageLoading not se in users configuration).
v1.18.x
Stjepan Osojnički 8 years ago committed by Barış Soner Uşaklı
parent eecc680761
commit 9b491e4c2e

@ -20,6 +20,7 @@ define('forum/topic/images', [
} else {
images.attr('data-state', 'loaded');
Images.wrapImagesInLinks(posts);
$(window).trigger('action:images.loaded');
}
};
@ -75,6 +76,7 @@ define('forum/topic/images', [
adjusting = false;
Images.wrapImagesInLinks(posts);
$(window).trigger('action:images.loaded');
posts.length = 0;
}
}

Loading…
Cancel
Save