1 line
900 B
JavaScript
1 line
900 B
JavaScript
|
!function(i){"use strict";var e={minSize:32,step:4},n=function(i){return i.preventDefault()};i.extend(!0,i.trumbowyg,{plugins:{resizimg:{init:function(t){function o(){t.$ed.find("img:not(.resizable)").resizable(t.o.plugins.resizimg.resizable).on("mousedown",n)}function r(){t.$ed.find("img.resizable").resizable("destroy").off("mousedown",n),t.syncTextarea()}t.o.plugins.resizimg=i.extend(!0,{},e,t.o.plugins.resizimg||{},{resizable:{resizeWidth:!1,onDragStart:function(i,e){var n=t.o.plugins.resizimg,o=i.pageX-e.offset().left,r=i.pageY-e.offset().top;if(o<e.width()-n.minSize||r<e.height()-n.minSize)return!1},onDrag:function(i,e,n,o){var r=t.o.plugins.resizimg;return o<r.minSize&&(o=r.minSize),o-=o%r.step,e.height(o),!1},onDragEnd:function(){t.$c.trigger("tbwchange")}}}),t.$c.on("tbwinit",o),t.$c.on("tbwfocus",o),t.$c.on("tbwchange",o),t.$c.on("tbwblur",r),t.$c.on("tbwclose",r)}}}})}(jQuery);
|