diff options
| author | Christophe Matthieu <chm@odoo.com> | 2014-12-10 15:59:48 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-01-05 10:17:10 +0100 |
| commit | 1596e45e8174cd736d4f7c78f85ec76a8e34888d (patch) | |
| tree | 4ff318ee78bccc6c0bb6253670e85977f8f5a643 /addons/website/static/lib/summernote/src/js/module/Handle.js | |
| parent | f9a7ed6b9406d657fda33ec55c4e237576b77a42 (diff) | |
[IMP] website: add summernote lib
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.js | 44 |
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; +}); |
