summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib/jquery-cropper
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-09-13 14:44:20 +0000
committerqsm-odoo <qsm@odoo.com>2019-09-13 14:55:26 +0000
commitaa9db571e30787da8e5d486de7d0a86828dd4e79 (patch)
tree00370b274523e07d2f6b8277d69e99d67812c181 /addons/web_editor/static/lib/jquery-cropper
parentda95ff210d93da512809d9f917f3e62264d01fe6 (diff)
[REF] web_editor: update the cropper library
Just after we first added the library in Odoo (in april 2018), the library was released in its last and deprecated version (4.0.0). At the same time, the author indeed split its 'cropper' library into 2 parts: 'cropperjs' which is the core of the original library without jquery and 'jquery-cropper' which is a jquery wrapper of the 'cropperjs' library. This commit updates our code to use the latest version of those two libraries. Note: the commit also removes the lazy loading of the library which is useless and maybe breaking since it comes with the editor assets which are themself lazy loaded. Note 2: we may want to remove the jquery wrapper in another update and simply use the standard JS library. Part of https://github.com/odoo/odoo/pull/36880 task-2059480 closes odoo/odoo#36880 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/lib/jquery-cropper')
-rw-r--r--addons/web_editor/static/lib/jquery-cropper/LICENSE21
-rw-r--r--addons/web_editor/static/lib/jquery-cropper/jquery-cropper.js75
2 files changed, 96 insertions, 0 deletions
diff --git a/addons/web_editor/static/lib/jquery-cropper/LICENSE b/addons/web_editor/static/lib/jquery-cropper/LICENSE
new file mode 100644
index 00000000000..4b2a9da8a66
--- /dev/null
+++ b/addons/web_editor/static/lib/jquery-cropper/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2018 Chen Fengyuan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/addons/web_editor/static/lib/jquery-cropper/jquery-cropper.js b/addons/web_editor/static/lib/jquery-cropper/jquery-cropper.js
new file mode 100644
index 00000000000..c1c71415d19
--- /dev/null
+++ b/addons/web_editor/static/lib/jquery-cropper/jquery-cropper.js
@@ -0,0 +1,75 @@
+/*!
+ * jQuery Cropper v1.0.0
+ * https://github.com/fengyuanchen/jquery-cropper
+ *
+ * Copyright (c) 2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-04-01T06:20:13.168Z
+ */
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery'), require('cropperjs')) :
+ typeof define === 'function' && define.amd ? define(['jquery', 'cropperjs'], factory) :
+ (factory(global.jQuery,global.Cropper));
+ }(this, (function ($,Cropper) { 'use strict';
+
+ $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
+ Cropper = Cropper && Cropper.hasOwnProperty('default') ? Cropper['default'] : Cropper;
+
+ if ($.fn) {
+ var AnotherCropper = $.fn.cropper;
+ var NAMESPACE = 'cropper';
+
+ $.fn.cropper = function jQueryCropper(option) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ var result = void 0;
+
+ this.each(function (i, element) {
+ var $element = $(element);
+ var isDestroy = option === 'destroy';
+ var cropper = $element.data(NAMESPACE);
+
+ if (!cropper) {
+ if (isDestroy) {
+ return;
+ }
+
+ var options = $.extend({}, $element.data(), $.isPlainObject(option) && option);
+
+ cropper = new Cropper(element, options);
+ $element.data(NAMESPACE, cropper);
+ }
+
+ if (typeof option === 'string') {
+ var fn = cropper[option];
+
+ if ($.isFunction(fn)) {
+ result = fn.apply(cropper, args);
+
+ if (result === cropper) {
+ result = undefined;
+ }
+
+ if (isDestroy) {
+ $element.removeData(NAMESPACE);
+ }
+ }
+ }
+ });
+
+ return result !== undefined ? result : this;
+ };
+
+ $.fn.cropper.Constructor = Cropper;
+ $.fn.cropper.setDefaults = Cropper.setDefaults;
+ $.fn.cropper.noConflict = function noConflict() {
+ $.fn.cropper = AnotherCropper;
+ return this;
+ };
+ }
+
+ })));