Server IP : 162.0.232.140 / Your IP : 3.142.219.125 Web Server : LiteSpeed System : Linux premium139.web-hosting.com 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : micrcvoy ( 740) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/micrcvoy/microleess-uae.store/controlPanel/assets/plugins/summernote/src/js/module/ |
Upload File : |
define([ 'summernote/core/dom' ], function (dom) { /** * @class module.Handle * * Handle */ var Handle = function (handler) { var $document = $(document); /** * `mousedown` event handler on $handle * - controlSizing: resize image * * @param {MouseEvent} event */ var hHandleMousedown = function (event) { if (dom.isControlSizing(event.target)) { event.preventDefault(); event.stopPropagation(); var layoutInfo = dom.makeLayoutInfo(event.target), $handle = layoutInfo.handle(), $popover = layoutInfo.popover(), $editable = layoutInfo.editable(), $editor = layoutInfo.editor(); var target = $handle.find('.note-control-selection').data('target'), $target = $(target), posStart = $target.offset(), scrollTop = $document.scrollTop(); var isAirMode = $editor.data('options').airMode; $document.on('mousemove', function (event) { handler.invoke('editor.resizeTo', { x: event.clientX - posStart.left, y: event.clientY - (posStart.top - scrollTop) }, $target, !event.shiftKey); handler.invoke('handle.update', $handle, {image: target}, isAirMode); handler.invoke('popover.update', $popover, {image: target}, isAirMode); }).one('mouseup', function () { $document.off('mousemove'); handler.invoke('editor.afterCommand', $editable); }); if (!$target.data('ratio')) { // original ratio. $target.data('ratio', $target.height() / $target.width()); } } }; this.attach = function (layoutInfo) { layoutInfo.handle().on('mousedown', hHandleMousedown); }; /** * update handle * @param {jQuery} $handle * @param {Object} styleInfo * @param {Boolean} isAirMode */ this.update = function ($handle, styleInfo, isAirMode) { var $selection = $handle.find('.note-control-selection'); if (styleInfo.image) { var $image = $(styleInfo.image); var pos = isAirMode ? $image.offset() : $image.position(); // include margin var imageSize = { w: $image.outerWidth(true), h: $image.outerHeight(true) }; $selection.css({ display: 'block', left: pos.left, top: pos.top, width: imageSize.w, height: imageSize.h }).data('target', styleInfo.image); // save current image element. var sizingText = imageSize.w + 'x' + imageSize.h; $selection.find('.note-control-selection-info').text(sizingText); } else { $selection.hide(); } }; /** * hide * * @param {jQuery} $handle */ this.hide = function ($handle) { $handle.children().hide(); }; }; return Handle; });