summaryrefslogtreecommitdiff
path: root/addons/website/static/lib/summernote/src/js/module/Handle.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website/static/lib/summernote/src/js/module/Handle.js')
-rw-r--r--addons/website/static/lib/summernote/src/js/module/Handle.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/addons/website/static/lib/summernote/src/js/module/Handle.js b/addons/website/static/lib/summernote/src/js/module/Handle.js
new file mode 100644
index 00000000000..375428faa32
--- /dev/null
+++ b/addons/website/static/lib/summernote/src/js/module/Handle.js
@@ -0,0 +1,44 @@
+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;
+});