web.bower_components.summernote.src.js.module.Handle.js Maven / Gradle / Ivy
define('summernote/module/Handle', function () {
/**
* Handle
*/
var Handle = function () {
/**
* 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();
}
};
this.hide = function ($handle) {
$handle.children().hide();
};
};
return Handle;
});