@wangeditor-next/plugin-float-image 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core/src/editor/helper.d.ts +8 -0
- package/dist/core/src/render/helper.d.ts +2 -1
- package/dist/core/src/utils/dom.d.ts +11 -10
- package/dist/css/style.css +1 -29
- package/dist/index.js +2 -1006
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -1002
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-float-image/src/constants/icon-svg.d.ts +1 -1
- package/dist/plugin-float-image/src/index.d.ts +1 -1
- package/dist/plugin-float-image/src/module/custom-types.d.ts +3 -1
- package/dist/plugin-float-image/src/module/elem-to-html.d.ts +1 -1
- package/dist/plugin-float-image/src/module/index.d.ts +1 -1
- package/dist/plugin-float-image/src/module/local.d.ts +1 -1
- package/dist/plugin-float-image/src/module/menu/FloatBase.d.ts +4 -4
- package/dist/plugin-float-image/src/module/menu/FloatLeft.d.ts +1 -1
- package/dist/plugin-float-image/src/module/menu/FloatNone.d.ts +1 -1
- package/dist/plugin-float-image/src/module/menu/FloatRight.d.ts +1 -1
- package/dist/plugin-float-image/src/module/menu/index.d.ts +2 -2
- package/dist/plugin-float-image/src/module/parse-elem-html.d.ts +1 -1
- package/dist/plugin-float-image/src/module/plugin.d.ts +1 -1
- package/dist/plugin-float-image/src/utils/dom.d.ts +3 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -1,1006 +1,2 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
|
3
|
-
typeof define === 'function' && define.amd ? define(['@wangeditor-next/editor', 'snabbdom', 'dom7'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.WangEditorFloatImagePlugin = factory(global.editor, global.snabbdom, global.$));
|
5
|
-
})(this, (function (editor, snabbdom, $) { 'use strict';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* @description 多语言
|
9
|
-
* @author Yanghc
|
10
|
-
*/
|
11
|
-
editor.i18nAddResources('en', {
|
12
|
-
float: {
|
13
|
-
none: 'Default',
|
14
|
-
left: 'Float Left',
|
15
|
-
right: 'Float Right',
|
16
|
-
},
|
17
|
-
});
|
18
|
-
editor.i18nAddResources('zh-CN', {
|
19
|
-
float: {
|
20
|
-
none: '默认',
|
21
|
-
left: '左浮动',
|
22
|
-
right: '右浮动',
|
23
|
-
},
|
24
|
-
});
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @description elem to html
|
28
|
-
* @author Yanghc
|
29
|
-
*/
|
30
|
-
// 生成 html 的函数
|
31
|
-
function imageToHtml(elem, _childrenHtml) {
|
32
|
-
var _a = elem, src = _a.src, _b = _a.alt, alt = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d;
|
33
|
-
var _e = style.width, width = _e === void 0 ? '' : _e, _f = style.height, height = _f === void 0 ? '' : _f, _g = style.float, float = _g === void 0 ? '' : _g;
|
34
|
-
var styleStr = '';
|
35
|
-
if (width) {
|
36
|
-
styleStr += "width: ".concat(width, ";");
|
37
|
-
}
|
38
|
-
if (height) {
|
39
|
-
styleStr += "height: ".concat(height, ";");
|
40
|
-
}
|
41
|
-
if (float) {
|
42
|
-
styleStr += "float: ".concat(float, ";");
|
43
|
-
}
|
44
|
-
return "<img src=\"".concat(src, "\" alt=\"").concat(alt, "\" data-href=\"").concat(href, "\" style=\"").concat(styleStr, "\"/>");
|
45
|
-
}
|
46
|
-
// 配置
|
47
|
-
var conf = {
|
48
|
-
type: 'image', // 节点 type ,重要!!!
|
49
|
-
elemToHtml: imageToHtml,
|
50
|
-
};
|
51
|
-
|
52
|
-
/******************************************************************************
|
53
|
-
Copyright (c) Microsoft Corporation.
|
54
|
-
|
55
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
56
|
-
purpose with or without fee is hereby granted.
|
57
|
-
|
58
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
59
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
60
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
61
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
62
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
63
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
64
|
-
PERFORMANCE OF THIS SOFTWARE.
|
65
|
-
***************************************************************************** */
|
66
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
67
|
-
|
68
|
-
var extendStatics = function(d, b) {
|
69
|
-
extendStatics = Object.setPrototypeOf ||
|
70
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
71
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
72
|
-
return extendStatics(d, b);
|
73
|
-
};
|
74
|
-
|
75
|
-
function __extends(d, b) {
|
76
|
-
if (typeof b !== "function" && b !== null)
|
77
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
78
|
-
extendStatics(d, b);
|
79
|
-
function __() { this.constructor = d; }
|
80
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
81
|
-
}
|
82
|
-
|
83
|
-
var __assign = function() {
|
84
|
-
__assign = Object.assign || function __assign(t) {
|
85
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
86
|
-
s = arguments[i];
|
87
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
88
|
-
}
|
89
|
-
return t;
|
90
|
-
};
|
91
|
-
return __assign.apply(this, arguments);
|
92
|
-
};
|
93
|
-
|
94
|
-
function __read(o, n) {
|
95
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
96
|
-
if (!m) return o;
|
97
|
-
var i = m.call(o), r, ar = [], e;
|
98
|
-
try {
|
99
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
100
|
-
}
|
101
|
-
catch (error) { e = { error: error }; }
|
102
|
-
finally {
|
103
|
-
try {
|
104
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
105
|
-
}
|
106
|
-
finally { if (e) throw e.error; }
|
107
|
-
}
|
108
|
-
return ar;
|
109
|
-
}
|
110
|
-
|
111
|
-
function __spreadArray(to, from, pack) {
|
112
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
113
|
-
if (ar || !(i in from)) {
|
114
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
115
|
-
ar[i] = from[i];
|
116
|
-
}
|
117
|
-
}
|
118
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
119
|
-
}
|
120
|
-
|
121
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
122
|
-
var e = new Error(message);
|
123
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
124
|
-
};
|
125
|
-
|
126
|
-
/**
|
127
|
-
* @description icon svg
|
128
|
-
* @author Yanghc
|
129
|
-
*/
|
130
|
-
/**
|
131
|
-
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
|
132
|
-
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
|
133
|
-
* 找不到再从 iconfont.com 搜索
|
134
|
-
*/
|
135
|
-
// 默认不浮动
|
136
|
-
var DEFAULT_FLOAT_SVG = '<svg viewBox="0 0 1024 1024"><path d="M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z"></path><path d="M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z"></path><path d="M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z"></path></svg>';
|
137
|
-
// 左浮动
|
138
|
-
var LEFT_FLOAT_SVG = '<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z"></path><path d="M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z"></path><path d="M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z"></path></svg>';
|
139
|
-
// 右浮动
|
140
|
-
var RIGHT_FLOAT_SVG = '<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z"></path><path d="M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z"></path><path d="M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z"></path></svg>';
|
141
|
-
|
142
|
-
/**
|
143
|
-
* @description image float base class
|
144
|
-
* @author Yanghc
|
145
|
-
*/
|
146
|
-
var ImageFloatBaseClass = /** @class */ (function () {
|
147
|
-
function ImageFloatBaseClass() {
|
148
|
-
this.tag = 'button';
|
149
|
-
}
|
150
|
-
ImageFloatBaseClass.prototype.getValue = function (editor) {
|
151
|
-
// 无需获取 val
|
152
|
-
return '';
|
153
|
-
};
|
154
|
-
ImageFloatBaseClass.prototype.isActive = function (editor) {
|
155
|
-
// 无需 active
|
156
|
-
return false;
|
157
|
-
};
|
158
|
-
ImageFloatBaseClass.prototype.getSelectedNode = function (editor$1) {
|
159
|
-
return editor.DomEditor.getSelectedNodeByType(editor$1, 'image');
|
160
|
-
};
|
161
|
-
ImageFloatBaseClass.prototype.isDisabled = function (editor) {
|
162
|
-
if (editor.selection == null) {
|
163
|
-
return true;
|
164
|
-
}
|
165
|
-
var imageNode = this.getSelectedNode(editor);
|
166
|
-
return imageNode == null;
|
167
|
-
};
|
168
|
-
ImageFloatBaseClass.prototype.exec = function (editor$1, value) {
|
169
|
-
if (this.isDisabled(editor$1)) {
|
170
|
-
return;
|
171
|
-
}
|
172
|
-
var imageNode = this.getSelectedNode(editor$1);
|
173
|
-
if (imageNode == null) {
|
174
|
-
return;
|
175
|
-
}
|
176
|
-
// 隐藏 hoverbar
|
177
|
-
var hoverbar = editor.DomEditor.getHoverbar(editor$1);
|
178
|
-
if (hoverbar) {
|
179
|
-
hoverbar.hideAndClean();
|
180
|
-
}
|
181
|
-
var _a = imageNode.style, style = _a === void 0 ? {} : _a;
|
182
|
-
var props = {
|
183
|
-
style: __assign(__assign({}, style), { float: this.value }),
|
184
|
-
};
|
185
|
-
editor.SlateTransforms.setNodes(editor$1, props, {
|
186
|
-
match: function (n) { return editor.DomEditor.checkNodeType(n, 'image'); },
|
187
|
-
});
|
188
|
-
};
|
189
|
-
return ImageFloatBaseClass;
|
190
|
-
}());
|
191
|
-
|
192
|
-
/**
|
193
|
-
* @description float image none
|
194
|
-
* @author Yanghc
|
195
|
-
*/
|
196
|
-
var FloatNone = /** @class */ (function (_super) {
|
197
|
-
__extends(FloatNone, _super);
|
198
|
-
function FloatNone() {
|
199
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
200
|
-
_this.title = editor.t('float.none'); // 菜单标题
|
201
|
-
_this.value = 'none'; // css float 的值
|
202
|
-
_this.iconSvg = DEFAULT_FLOAT_SVG;
|
203
|
-
return _this;
|
204
|
-
}
|
205
|
-
return FloatNone;
|
206
|
-
}(ImageFloatBaseClass));
|
207
|
-
|
208
|
-
/**
|
209
|
-
* @description float image left
|
210
|
-
* @author Yanghc
|
211
|
-
*/
|
212
|
-
var FloatLeft = /** @class */ (function (_super) {
|
213
|
-
__extends(FloatLeft, _super);
|
214
|
-
function FloatLeft() {
|
215
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
216
|
-
_this.title = editor.t('float.left'); // 菜单标题
|
217
|
-
_this.value = 'left'; // css float 的值
|
218
|
-
_this.iconSvg = LEFT_FLOAT_SVG;
|
219
|
-
return _this;
|
220
|
-
}
|
221
|
-
return FloatLeft;
|
222
|
-
}(ImageFloatBaseClass));
|
223
|
-
|
224
|
-
/**
|
225
|
-
* @description float image right
|
226
|
-
* @author Yanghc
|
227
|
-
*/
|
228
|
-
var FloatRight = /** @class */ (function (_super) {
|
229
|
-
__extends(FloatRight, _super);
|
230
|
-
function FloatRight() {
|
231
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
232
|
-
_this.title = editor.t('float.right'); // 菜单标题
|
233
|
-
_this.value = 'right'; // css float 的值
|
234
|
-
_this.iconSvg = RIGHT_FLOAT_SVG;
|
235
|
-
return _this;
|
236
|
-
}
|
237
|
-
return FloatRight;
|
238
|
-
}(ImageFloatBaseClass));
|
239
|
-
|
240
|
-
/**
|
241
|
-
* @description menu index
|
242
|
-
* @author Yanghc
|
243
|
-
*/
|
244
|
-
var imageFloatNoneMenuConf = {
|
245
|
-
key: 'imageFloatNone',
|
246
|
-
factory: function () {
|
247
|
-
return new FloatNone();
|
248
|
-
},
|
249
|
-
};
|
250
|
-
var imageFloatLeftMenuConf = {
|
251
|
-
key: 'imageFloatLeft',
|
252
|
-
factory: function () {
|
253
|
-
return new FloatLeft();
|
254
|
-
},
|
255
|
-
};
|
256
|
-
var imageFloatRightMenuConf = {
|
257
|
-
key: 'imageFloatRight',
|
258
|
-
factory: function () {
|
259
|
-
return new FloatRight();
|
260
|
-
},
|
261
|
-
};
|
262
|
-
|
263
|
-
/**
|
264
|
-
* @description parse elem html
|
265
|
-
* @author Yanghc
|
266
|
-
*/
|
267
|
-
function parseHtml(elem, _children, _editor) {
|
268
|
-
var href = elem.getAttribute('data-href') || '';
|
269
|
-
href = decodeURIComponent(href); // 兼容 V4
|
270
|
-
return {
|
271
|
-
type: 'image',
|
272
|
-
src: elem.getAttribute('src') || '',
|
273
|
-
alt: elem.getAttribute('alt') || '',
|
274
|
-
href: href,
|
275
|
-
style: {
|
276
|
-
width: elem.getAttribute('width') || '',
|
277
|
-
height: elem.getAttribute('height') || '',
|
278
|
-
float: elem.getAttribute('float') || '',
|
279
|
-
},
|
280
|
-
children: [{ text: '' }], // void node 有一个空白 text
|
281
|
-
};
|
282
|
-
}
|
283
|
-
var parseHtmlConf = {
|
284
|
-
selector: 'img:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性
|
285
|
-
parseElemHtml: parseHtml,
|
286
|
-
};
|
287
|
-
|
288
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
289
|
-
|
290
|
-
function getDefaultExportFromCjs (x) {
|
291
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
292
|
-
}
|
293
|
-
|
294
|
-
/**
|
295
|
-
* lodash (Custom Build) <https://lodash.com/>
|
296
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
297
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
298
|
-
* Released under MIT license <https://lodash.com/license>
|
299
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
300
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
301
|
-
*/
|
302
|
-
|
303
|
-
var lodash_throttle;
|
304
|
-
var hasRequiredLodash_throttle;
|
305
|
-
|
306
|
-
function requireLodash_throttle () {
|
307
|
-
if (hasRequiredLodash_throttle) return lodash_throttle;
|
308
|
-
hasRequiredLodash_throttle = 1;
|
309
|
-
/** Used as the `TypeError` message for "Functions" methods. */
|
310
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
311
|
-
|
312
|
-
/** Used as references for various `Number` constants. */
|
313
|
-
var NAN = 0 / 0;
|
314
|
-
|
315
|
-
/** `Object#toString` result references. */
|
316
|
-
var symbolTag = '[object Symbol]';
|
317
|
-
|
318
|
-
/** Used to match leading and trailing whitespace. */
|
319
|
-
var reTrim = /^\s+|\s+$/g;
|
320
|
-
|
321
|
-
/** Used to detect bad signed hexadecimal string values. */
|
322
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
323
|
-
|
324
|
-
/** Used to detect binary string values. */
|
325
|
-
var reIsBinary = /^0b[01]+$/i;
|
326
|
-
|
327
|
-
/** Used to detect octal string values. */
|
328
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
329
|
-
|
330
|
-
/** Built-in method references without a dependency on `root`. */
|
331
|
-
var freeParseInt = parseInt;
|
332
|
-
|
333
|
-
/** Detect free variable `global` from Node.js. */
|
334
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
335
|
-
|
336
|
-
/** Detect free variable `self`. */
|
337
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
338
|
-
|
339
|
-
/** Used as a reference to the global object. */
|
340
|
-
var root = freeGlobal || freeSelf || Function('return this')();
|
341
|
-
|
342
|
-
/** Used for built-in method references. */
|
343
|
-
var objectProto = Object.prototype;
|
344
|
-
|
345
|
-
/**
|
346
|
-
* Used to resolve the
|
347
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
348
|
-
* of values.
|
349
|
-
*/
|
350
|
-
var objectToString = objectProto.toString;
|
351
|
-
|
352
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
353
|
-
var nativeMax = Math.max,
|
354
|
-
nativeMin = Math.min;
|
355
|
-
|
356
|
-
/**
|
357
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
358
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
359
|
-
*
|
360
|
-
* @static
|
361
|
-
* @memberOf _
|
362
|
-
* @since 2.4.0
|
363
|
-
* @category Date
|
364
|
-
* @returns {number} Returns the timestamp.
|
365
|
-
* @example
|
366
|
-
*
|
367
|
-
* _.defer(function(stamp) {
|
368
|
-
* console.log(_.now() - stamp);
|
369
|
-
* }, _.now());
|
370
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
371
|
-
*/
|
372
|
-
var now = function() {
|
373
|
-
return root.Date.now();
|
374
|
-
};
|
375
|
-
|
376
|
-
/**
|
377
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
378
|
-
* milliseconds have elapsed since the last time the debounced function was
|
379
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
380
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
381
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
382
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
383
|
-
* with the last arguments provided to the debounced function. Subsequent
|
384
|
-
* calls to the debounced function return the result of the last `func`
|
385
|
-
* invocation.
|
386
|
-
*
|
387
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
388
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
389
|
-
* is invoked more than once during the `wait` timeout.
|
390
|
-
*
|
391
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
392
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
393
|
-
*
|
394
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
395
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
396
|
-
*
|
397
|
-
* @static
|
398
|
-
* @memberOf _
|
399
|
-
* @since 0.1.0
|
400
|
-
* @category Function
|
401
|
-
* @param {Function} func The function to debounce.
|
402
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
403
|
-
* @param {Object} [options={}] The options object.
|
404
|
-
* @param {boolean} [options.leading=false]
|
405
|
-
* Specify invoking on the leading edge of the timeout.
|
406
|
-
* @param {number} [options.maxWait]
|
407
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
408
|
-
* @param {boolean} [options.trailing=true]
|
409
|
-
* Specify invoking on the trailing edge of the timeout.
|
410
|
-
* @returns {Function} Returns the new debounced function.
|
411
|
-
* @example
|
412
|
-
*
|
413
|
-
* // Avoid costly calculations while the window size is in flux.
|
414
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
415
|
-
*
|
416
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
417
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
418
|
-
* 'leading': true,
|
419
|
-
* 'trailing': false
|
420
|
-
* }));
|
421
|
-
*
|
422
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
423
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
424
|
-
* var source = new EventSource('/stream');
|
425
|
-
* jQuery(source).on('message', debounced);
|
426
|
-
*
|
427
|
-
* // Cancel the trailing debounced invocation.
|
428
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
429
|
-
*/
|
430
|
-
function debounce(func, wait, options) {
|
431
|
-
var lastArgs,
|
432
|
-
lastThis,
|
433
|
-
maxWait,
|
434
|
-
result,
|
435
|
-
timerId,
|
436
|
-
lastCallTime,
|
437
|
-
lastInvokeTime = 0,
|
438
|
-
leading = false,
|
439
|
-
maxing = false,
|
440
|
-
trailing = true;
|
441
|
-
|
442
|
-
if (typeof func != 'function') {
|
443
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
444
|
-
}
|
445
|
-
wait = toNumber(wait) || 0;
|
446
|
-
if (isObject(options)) {
|
447
|
-
leading = !!options.leading;
|
448
|
-
maxing = 'maxWait' in options;
|
449
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
450
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
451
|
-
}
|
452
|
-
|
453
|
-
function invokeFunc(time) {
|
454
|
-
var args = lastArgs,
|
455
|
-
thisArg = lastThis;
|
456
|
-
|
457
|
-
lastArgs = lastThis = undefined;
|
458
|
-
lastInvokeTime = time;
|
459
|
-
result = func.apply(thisArg, args);
|
460
|
-
return result;
|
461
|
-
}
|
462
|
-
|
463
|
-
function leadingEdge(time) {
|
464
|
-
// Reset any `maxWait` timer.
|
465
|
-
lastInvokeTime = time;
|
466
|
-
// Start the timer for the trailing edge.
|
467
|
-
timerId = setTimeout(timerExpired, wait);
|
468
|
-
// Invoke the leading edge.
|
469
|
-
return leading ? invokeFunc(time) : result;
|
470
|
-
}
|
471
|
-
|
472
|
-
function remainingWait(time) {
|
473
|
-
var timeSinceLastCall = time - lastCallTime,
|
474
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
475
|
-
result = wait - timeSinceLastCall;
|
476
|
-
|
477
|
-
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
478
|
-
}
|
479
|
-
|
480
|
-
function shouldInvoke(time) {
|
481
|
-
var timeSinceLastCall = time - lastCallTime,
|
482
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
483
|
-
|
484
|
-
// Either this is the first call, activity has stopped and we're at the
|
485
|
-
// trailing edge, the system time has gone backwards and we're treating
|
486
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
487
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
488
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
489
|
-
}
|
490
|
-
|
491
|
-
function timerExpired() {
|
492
|
-
var time = now();
|
493
|
-
if (shouldInvoke(time)) {
|
494
|
-
return trailingEdge(time);
|
495
|
-
}
|
496
|
-
// Restart the timer.
|
497
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
498
|
-
}
|
499
|
-
|
500
|
-
function trailingEdge(time) {
|
501
|
-
timerId = undefined;
|
502
|
-
|
503
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
504
|
-
// debounced at least once.
|
505
|
-
if (trailing && lastArgs) {
|
506
|
-
return invokeFunc(time);
|
507
|
-
}
|
508
|
-
lastArgs = lastThis = undefined;
|
509
|
-
return result;
|
510
|
-
}
|
511
|
-
|
512
|
-
function cancel() {
|
513
|
-
if (timerId !== undefined) {
|
514
|
-
clearTimeout(timerId);
|
515
|
-
}
|
516
|
-
lastInvokeTime = 0;
|
517
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
518
|
-
}
|
519
|
-
|
520
|
-
function flush() {
|
521
|
-
return timerId === undefined ? result : trailingEdge(now());
|
522
|
-
}
|
523
|
-
|
524
|
-
function debounced() {
|
525
|
-
var time = now(),
|
526
|
-
isInvoking = shouldInvoke(time);
|
527
|
-
|
528
|
-
lastArgs = arguments;
|
529
|
-
lastThis = this;
|
530
|
-
lastCallTime = time;
|
531
|
-
|
532
|
-
if (isInvoking) {
|
533
|
-
if (timerId === undefined) {
|
534
|
-
return leadingEdge(lastCallTime);
|
535
|
-
}
|
536
|
-
if (maxing) {
|
537
|
-
// Handle invocations in a tight loop.
|
538
|
-
timerId = setTimeout(timerExpired, wait);
|
539
|
-
return invokeFunc(lastCallTime);
|
540
|
-
}
|
541
|
-
}
|
542
|
-
if (timerId === undefined) {
|
543
|
-
timerId = setTimeout(timerExpired, wait);
|
544
|
-
}
|
545
|
-
return result;
|
546
|
-
}
|
547
|
-
debounced.cancel = cancel;
|
548
|
-
debounced.flush = flush;
|
549
|
-
return debounced;
|
550
|
-
}
|
551
|
-
|
552
|
-
/**
|
553
|
-
* Creates a throttled function that only invokes `func` at most once per
|
554
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
555
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
556
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
557
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
558
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
559
|
-
* throttled function. Subsequent calls to the throttled function return the
|
560
|
-
* result of the last `func` invocation.
|
561
|
-
*
|
562
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
563
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
564
|
-
* is invoked more than once during the `wait` timeout.
|
565
|
-
*
|
566
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
567
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
568
|
-
*
|
569
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
570
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
571
|
-
*
|
572
|
-
* @static
|
573
|
-
* @memberOf _
|
574
|
-
* @since 0.1.0
|
575
|
-
* @category Function
|
576
|
-
* @param {Function} func The function to throttle.
|
577
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
578
|
-
* @param {Object} [options={}] The options object.
|
579
|
-
* @param {boolean} [options.leading=true]
|
580
|
-
* Specify invoking on the leading edge of the timeout.
|
581
|
-
* @param {boolean} [options.trailing=true]
|
582
|
-
* Specify invoking on the trailing edge of the timeout.
|
583
|
-
* @returns {Function} Returns the new throttled function.
|
584
|
-
* @example
|
585
|
-
*
|
586
|
-
* // Avoid excessively updating the position while scrolling.
|
587
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
588
|
-
*
|
589
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
590
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
591
|
-
* jQuery(element).on('click', throttled);
|
592
|
-
*
|
593
|
-
* // Cancel the trailing throttled invocation.
|
594
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
595
|
-
*/
|
596
|
-
function throttle(func, wait, options) {
|
597
|
-
var leading = true,
|
598
|
-
trailing = true;
|
599
|
-
|
600
|
-
if (typeof func != 'function') {
|
601
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
602
|
-
}
|
603
|
-
if (isObject(options)) {
|
604
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
605
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
606
|
-
}
|
607
|
-
return debounce(func, wait, {
|
608
|
-
'leading': leading,
|
609
|
-
'maxWait': wait,
|
610
|
-
'trailing': trailing
|
611
|
-
});
|
612
|
-
}
|
613
|
-
|
614
|
-
/**
|
615
|
-
* Checks if `value` is the
|
616
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
617
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
618
|
-
*
|
619
|
-
* @static
|
620
|
-
* @memberOf _
|
621
|
-
* @since 0.1.0
|
622
|
-
* @category Lang
|
623
|
-
* @param {*} value The value to check.
|
624
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
625
|
-
* @example
|
626
|
-
*
|
627
|
-
* _.isObject({});
|
628
|
-
* // => true
|
629
|
-
*
|
630
|
-
* _.isObject([1, 2, 3]);
|
631
|
-
* // => true
|
632
|
-
*
|
633
|
-
* _.isObject(_.noop);
|
634
|
-
* // => true
|
635
|
-
*
|
636
|
-
* _.isObject(null);
|
637
|
-
* // => false
|
638
|
-
*/
|
639
|
-
function isObject(value) {
|
640
|
-
var type = typeof value;
|
641
|
-
return !!value && (type == 'object' || type == 'function');
|
642
|
-
}
|
643
|
-
|
644
|
-
/**
|
645
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
646
|
-
* and has a `typeof` result of "object".
|
647
|
-
*
|
648
|
-
* @static
|
649
|
-
* @memberOf _
|
650
|
-
* @since 4.0.0
|
651
|
-
* @category Lang
|
652
|
-
* @param {*} value The value to check.
|
653
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
654
|
-
* @example
|
655
|
-
*
|
656
|
-
* _.isObjectLike({});
|
657
|
-
* // => true
|
658
|
-
*
|
659
|
-
* _.isObjectLike([1, 2, 3]);
|
660
|
-
* // => true
|
661
|
-
*
|
662
|
-
* _.isObjectLike(_.noop);
|
663
|
-
* // => false
|
664
|
-
*
|
665
|
-
* _.isObjectLike(null);
|
666
|
-
* // => false
|
667
|
-
*/
|
668
|
-
function isObjectLike(value) {
|
669
|
-
return !!value && typeof value == 'object';
|
670
|
-
}
|
671
|
-
|
672
|
-
/**
|
673
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
674
|
-
*
|
675
|
-
* @static
|
676
|
-
* @memberOf _
|
677
|
-
* @since 4.0.0
|
678
|
-
* @category Lang
|
679
|
-
* @param {*} value The value to check.
|
680
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
681
|
-
* @example
|
682
|
-
*
|
683
|
-
* _.isSymbol(Symbol.iterator);
|
684
|
-
* // => true
|
685
|
-
*
|
686
|
-
* _.isSymbol('abc');
|
687
|
-
* // => false
|
688
|
-
*/
|
689
|
-
function isSymbol(value) {
|
690
|
-
return typeof value == 'symbol' ||
|
691
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
692
|
-
}
|
693
|
-
|
694
|
-
/**
|
695
|
-
* Converts `value` to a number.
|
696
|
-
*
|
697
|
-
* @static
|
698
|
-
* @memberOf _
|
699
|
-
* @since 4.0.0
|
700
|
-
* @category Lang
|
701
|
-
* @param {*} value The value to process.
|
702
|
-
* @returns {number} Returns the number.
|
703
|
-
* @example
|
704
|
-
*
|
705
|
-
* _.toNumber(3.2);
|
706
|
-
* // => 3.2
|
707
|
-
*
|
708
|
-
* _.toNumber(Number.MIN_VALUE);
|
709
|
-
* // => 5e-324
|
710
|
-
*
|
711
|
-
* _.toNumber(Infinity);
|
712
|
-
* // => Infinity
|
713
|
-
*
|
714
|
-
* _.toNumber('3.2');
|
715
|
-
* // => 3.2
|
716
|
-
*/
|
717
|
-
function toNumber(value) {
|
718
|
-
if (typeof value == 'number') {
|
719
|
-
return value;
|
720
|
-
}
|
721
|
-
if (isSymbol(value)) {
|
722
|
-
return NAN;
|
723
|
-
}
|
724
|
-
if (isObject(value)) {
|
725
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
726
|
-
value = isObject(other) ? (other + '') : other;
|
727
|
-
}
|
728
|
-
if (typeof value != 'string') {
|
729
|
-
return value === 0 ? value : +value;
|
730
|
-
}
|
731
|
-
value = value.replace(reTrim, '');
|
732
|
-
var isBinary = reIsBinary.test(value);
|
733
|
-
return (isBinary || reIsOctal.test(value))
|
734
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
735
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
736
|
-
}
|
737
|
-
|
738
|
-
lodash_throttle = throttle;
|
739
|
-
return lodash_throttle;
|
740
|
-
}
|
741
|
-
|
742
|
-
var lodash_throttleExports = requireLodash_throttle();
|
743
|
-
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
744
|
-
|
745
|
-
/**
|
746
|
-
* @description DOM 操作
|
747
|
-
* @author Yanghc
|
748
|
-
*/
|
749
|
-
if ($.css) {
|
750
|
-
$.fn.css = $.css;
|
751
|
-
}
|
752
|
-
if ($.append) {
|
753
|
-
$.fn.append = $.append;
|
754
|
-
}
|
755
|
-
if ($.prepend) {
|
756
|
-
$.fn.prepend = $.prepend;
|
757
|
-
}
|
758
|
-
if ($.addClass) {
|
759
|
-
$.fn.addClass = $.addClass;
|
760
|
-
}
|
761
|
-
if ($.removeClass) {
|
762
|
-
$.fn.removeClass = $.removeClass;
|
763
|
-
}
|
764
|
-
if ($.hasClass) {
|
765
|
-
$.fn.hasClass = $.hasClass;
|
766
|
-
}
|
767
|
-
if ($.on) {
|
768
|
-
$.fn.on = $.on;
|
769
|
-
}
|
770
|
-
if ($.off) {
|
771
|
-
$.fn.off = $.off;
|
772
|
-
}
|
773
|
-
if ($.focus) {
|
774
|
-
$.fn.focus = $.focus;
|
775
|
-
}
|
776
|
-
if ($.attr) {
|
777
|
-
$.fn.attr = $.attr;
|
778
|
-
}
|
779
|
-
if ($.removeAttr) {
|
780
|
-
$.fn.removeAttr = $.removeAttr;
|
781
|
-
}
|
782
|
-
if ($.hide) {
|
783
|
-
$.fn.hide = $.hide;
|
784
|
-
}
|
785
|
-
if ($.show) {
|
786
|
-
$.fn.show = $.show;
|
787
|
-
}
|
788
|
-
if ($.parents) {
|
789
|
-
$.fn.parents = $.parents;
|
790
|
-
}
|
791
|
-
if ($.dataset) {
|
792
|
-
$.fn.dataset = $.dataset;
|
793
|
-
}
|
794
|
-
if ($.val) {
|
795
|
-
$.fn.val = $.val;
|
796
|
-
}
|
797
|
-
if ($.text) {
|
798
|
-
$.fn.text = $.text;
|
799
|
-
}
|
800
|
-
if ($.html) {
|
801
|
-
$.fn.html = $.html;
|
802
|
-
}
|
803
|
-
if ($.children) {
|
804
|
-
$.fn.children = $.children;
|
805
|
-
}
|
806
|
-
if ($.remove) {
|
807
|
-
$.fn.remove = $.remove;
|
808
|
-
}
|
809
|
-
if ($.find) {
|
810
|
-
$.fn.find = $.find;
|
811
|
-
}
|
812
|
-
if ($.width) {
|
813
|
-
$.fn.width = $.width;
|
814
|
-
}
|
815
|
-
if ($.height) {
|
816
|
-
$.fn.height = $.height;
|
817
|
-
}
|
818
|
-
if ($.filter) {
|
819
|
-
$.fn.filter = $.filter;
|
820
|
-
}
|
821
|
-
if ($.empty) {
|
822
|
-
$.fn.empty = $.empty;
|
823
|
-
}
|
824
|
-
|
825
|
-
/**
|
826
|
-
* @description image render elem
|
827
|
-
* @author wangfupeng
|
828
|
-
*/
|
829
|
-
function genContainerId(editor$1, elemNode) {
|
830
|
-
var id = editor.DomEditor.findKey(editor$1, elemNode).id; // node 唯一 id
|
831
|
-
return "w-e-image-container-".concat(id);
|
832
|
-
}
|
833
|
-
/**
|
834
|
-
* 未选中时,渲染 image container
|
835
|
-
*/
|
836
|
-
function renderContainer(editor, elemNode, imageVnode, imageInfo) {
|
837
|
-
var width = imageInfo.width, height = imageInfo.height, float = imageInfo.float;
|
838
|
-
var style = {};
|
839
|
-
if (width) {
|
840
|
-
style.width = width;
|
841
|
-
}
|
842
|
-
if (height) {
|
843
|
-
style.height = height;
|
844
|
-
}
|
845
|
-
if (float) {
|
846
|
-
style.float = float;
|
847
|
-
}
|
848
|
-
var containerId = genContainerId(editor, elemNode);
|
849
|
-
return (snabbdom.jsx("div", { id: containerId, style: style, className: "w-e-image-container" }, imageVnode));
|
850
|
-
}
|
851
|
-
/**
|
852
|
-
* 选中状态下,渲染 image container(渲染拖拽容器,修改图片尺寸)
|
853
|
-
*/
|
854
|
-
function renderResizeContainer(editor$1, elemNode, imageVnode, imageInfo) {
|
855
|
-
var $body = $('body');
|
856
|
-
var containerId = genContainerId(editor$1, elemNode);
|
857
|
-
var width = imageInfo.width, height = imageInfo.height, float = imageInfo.float;
|
858
|
-
var originalX = 0;
|
859
|
-
var originalWith = 0;
|
860
|
-
var originalHeight = 0;
|
861
|
-
var revers = false; // 是否反转。如向右拖拽 right-top 需增加宽度(非反转),但向右拖拽 left-top 则需要减少宽度(反转)
|
862
|
-
var $container = null;
|
863
|
-
function getContainerElem() {
|
864
|
-
var $containerFromDom = $("#".concat(containerId));
|
865
|
-
if ($containerFromDom.length === 0) {
|
866
|
-
throw new Error('Cannot find image container elem');
|
867
|
-
}
|
868
|
-
return $containerFromDom;
|
869
|
-
}
|
870
|
-
// mouseover callback (节流)
|
871
|
-
var onMousemove = throttle(function (e) {
|
872
|
-
e.preventDefault();
|
873
|
-
var clientX = e.clientX;
|
874
|
-
var gap = revers ? originalX - clientX : clientX - originalX; // 考虑是否反转
|
875
|
-
var newWidth = originalWith + gap;
|
876
|
-
var newHeight = originalHeight * (newWidth / originalWith); // 根据 width ,按比例计算 height
|
877
|
-
// 实时修改 img 宽高 -【注意】这里只修改 DOM ,mouseup 时再统一不修改 node
|
878
|
-
if ($container == null) {
|
879
|
-
return;
|
880
|
-
}
|
881
|
-
if (newWidth <= 15 || newHeight <= 15) {
|
882
|
-
return;
|
883
|
-
} // 最小就是 15px
|
884
|
-
$container.css('width', "".concat(newWidth, "px"));
|
885
|
-
$container.css('height', "".concat(newHeight, "px"));
|
886
|
-
}, 100);
|
887
|
-
function onMouseup(_e) {
|
888
|
-
// 取消监听 mousemove
|
889
|
-
$body.off('mousemove', onMousemove);
|
890
|
-
if ($container == null) {
|
891
|
-
return;
|
892
|
-
}
|
893
|
-
var newWidth = $container.width().toFixed(2);
|
894
|
-
var newHeight = $container.height().toFixed(2);
|
895
|
-
// 修改 node
|
896
|
-
var props = {
|
897
|
-
style: __assign(__assign({}, elemNode.style), { width: "".concat(newWidth, "px"), height: "".concat(newHeight, "px") }),
|
898
|
-
};
|
899
|
-
editor.SlateTransforms.setNodes(editor$1, props, { at: editor.DomEditor.findPath(editor$1, elemNode) });
|
900
|
-
// 取消监听 mouseup
|
901
|
-
$body.off('mouseup', onMouseup);
|
902
|
-
}
|
903
|
-
/**
|
904
|
-
* 初始化。监听事件,记录原始数据
|
905
|
-
*/
|
906
|
-
function init(clientX) {
|
907
|
-
$container = getContainerElem();
|
908
|
-
// 记录当前 x 坐标值
|
909
|
-
originalX = clientX;
|
910
|
-
// 记录 img 原始宽高
|
911
|
-
var $img = $container.find('img');
|
912
|
-
if ($img.length === 0) {
|
913
|
-
throw new Error('Cannot find image elem');
|
914
|
-
}
|
915
|
-
originalWith = $img.width();
|
916
|
-
originalHeight = $img.height();
|
917
|
-
// 监听 mousemove
|
918
|
-
$body.on('mousemove', onMousemove);
|
919
|
-
// 监听 mouseup
|
920
|
-
$body.on('mouseup', onMouseup);
|
921
|
-
// 隐藏 hoverbar
|
922
|
-
var hoverbar = editor.DomEditor.getHoverbar(editor$1);
|
923
|
-
if (hoverbar) {
|
924
|
-
hoverbar.hideAndClean();
|
925
|
-
}
|
926
|
-
}
|
927
|
-
var style = {};
|
928
|
-
if (width) {
|
929
|
-
style.width = width;
|
930
|
-
}
|
931
|
-
if (height) {
|
932
|
-
style.height = height;
|
933
|
-
}
|
934
|
-
if (float) {
|
935
|
-
style.float = float;
|
936
|
-
}
|
937
|
-
// style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手
|
938
|
-
return (snabbdom.jsx("div", { id: containerId, style: style, className: "w-e-image-container w-e-selected-image-container", on: {
|
939
|
-
// 统一绑定拖拽触手的 mousedown 事件
|
940
|
-
mousedown: function (e) {
|
941
|
-
var $target = $(e.target);
|
942
|
-
if (!$target.hasClass('w-e-image-dragger')) {
|
943
|
-
// target 不是 .w-e-image-dragger 拖拽触手,则忽略
|
944
|
-
return;
|
945
|
-
}
|
946
|
-
e.preventDefault();
|
947
|
-
if ($target.hasClass('left-top') || $target.hasClass('left-bottom')) {
|
948
|
-
revers = true; // 反转。向右拖拽,减少宽度
|
949
|
-
}
|
950
|
-
init(e.clientX); // 初始化
|
951
|
-
},
|
952
|
-
} },
|
953
|
-
imageVnode,
|
954
|
-
snabbdom.jsx("div", { className: "w-e-image-dragger left-top" }),
|
955
|
-
snabbdom.jsx("div", { className: "w-e-image-dragger right-top" }),
|
956
|
-
snabbdom.jsx("div", { className: "w-e-image-dragger left-bottom" }),
|
957
|
-
snabbdom.jsx("div", { className: "w-e-image-dragger right-bottom" })));
|
958
|
-
}
|
959
|
-
function renderImage(elemNode, children, editor$1) {
|
960
|
-
var _a = elemNode, src = _a.src, _b = _a.alt, alt = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d;
|
961
|
-
var _f = style.width, width = _f === void 0 ? '' : _f, _g = style.height, height = _g === void 0 ? '' : _g, float = style.float;
|
962
|
-
var selected = editor.DomEditor.isNodeSelected(editor$1, elemNode); // 图片是否选中
|
963
|
-
var imageStyle = {};
|
964
|
-
if (width) {
|
965
|
-
imageStyle.width = '100%';
|
966
|
-
}
|
967
|
-
if (height) {
|
968
|
-
imageStyle.height = '100%';
|
969
|
-
}
|
970
|
-
if (float) {
|
971
|
-
imageStyle.float = float;
|
972
|
-
}
|
973
|
-
// 【注意】void node 中,renderElem 不用处理 children 。core 会统一处理。
|
974
|
-
var vnode = snabbdom.jsx("img", { style: imageStyle, src: src, alt: alt, "data-href": href });
|
975
|
-
var isDisabled = editor$1.isDisabled();
|
976
|
-
if (selected && !isDisabled) {
|
977
|
-
// 选中,未禁用 - 渲染 resize container
|
978
|
-
return renderResizeContainer(editor$1, elemNode, vnode, { width: width, height: height, float: float });
|
979
|
-
}
|
980
|
-
// 其他,渲染普通 image container
|
981
|
-
return renderContainer(editor$1, elemNode, vnode, { width: width, height: height, float: float });
|
982
|
-
}
|
983
|
-
var renderImageConf = {
|
984
|
-
type: 'image', // 和 elemNode.type 一致
|
985
|
-
renderElem: renderImage,
|
986
|
-
};
|
987
|
-
|
988
|
-
/**
|
989
|
-
* @description module entry
|
990
|
-
* @author Yanghc
|
991
|
-
*/
|
992
|
-
var module = {
|
993
|
-
renderElems: [renderImageConf],
|
994
|
-
elemsToHtml: [conf],
|
995
|
-
parseElemsHtml: [parseHtmlConf],
|
996
|
-
menus: [imageFloatLeftMenuConf, imageFloatRightMenuConf, imageFloatNoneMenuConf],
|
997
|
-
};
|
998
|
-
|
999
|
-
/**
|
1000
|
-
* @description src entry
|
1001
|
-
* @author Yanghc
|
1002
|
-
*/
|
1003
|
-
|
1004
|
-
return module;
|
1005
|
-
|
1006
|
-
}));
|
1
|
+
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("@wangeditor-next/editor"),require("dom7"),require("snabbdom")):"function"==typeof define&&define.amd?define(["@wangeditor-next/editor","dom7","snabbdom"],r):(t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorFloatImagePlugin=r(t.editor,t.$,t.snabbdom)}(this,(function(t,r,n){"use strict";t.i18nAddResources("en",{float:{none:"Default",left:"Float Left",right:"Float Right"}}),t.i18nAddResources("zh-CN",{float:{none:"默认",left:"左浮动",right:"右浮动"}});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,u,a={};function f(){if(u)return i;u=1;var t=function(t){return t&&t.Math===Math&&t};return i=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||t("object"==typeof i&&i)||function(){return this}()||Function("return this")()}var c,l,s,v,d,p,h,g,y={};function m(){return l?c:(l=1,c=function(t){try{return!!t()}catch(t){return!0}})}function b(){if(v)return s;v=1;var t=m();return s=!t((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function w(){if(p)return d;p=1;var t=m();return d=!t((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))}function x(){if(g)return h;g=1;var t=w(),r=Function.prototype.call;return h=t?r.bind(r):function(){return r.apply(r,arguments)},h}var O,S,j,E,q,T,C,P,A,I,N,R,M,F,D,_,k,z,$,L,W,Z,B,H,U,G,K,X,Y,V,J,Q,tt,rt,nt,et,ot,it,ut,at,ft,ct={};function lt(){return j?S:(j=1,S=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}})}function st(){if(q)return E;q=1;var t=w(),r=Function.prototype,n=r.call,e=t&&r.bind.bind(n,n);return E=t?e:function(t){return function(){return n.apply(t,arguments)}},E}function vt(){if(C)return T;C=1;var t=st(),r=t({}.toString),n=t("".slice);return T=function(t){return n(r(t),8,-1)}}function dt(){if(A)return P;A=1;var t=st(),r=m(),n=vt(),e=Object,o=t("".split);return P=r((function(){return!e("z").propertyIsEnumerable(0)}))?function(t){return"String"===n(t)?o(t,""):e(t)}:e}function pt(){return N?I:(N=1,I=function(t){return null==t})}function ht(){if(M)return R;M=1;var t=pt(),r=TypeError;return R=function(n){if(t(n))throw new r("Can't call method on "+n);return n}}function gt(){if(D)return F;D=1;var t=dt(),r=ht();return F=function(n){return t(r(n))}}function yt(){if(k)return _;k=1;var t="object"==typeof document&&document.all;return _=void 0===t&&void 0!==t?function(r){return"function"==typeof r||r===t}:function(t){return"function"==typeof t}}function mt(){if($)return z;$=1;var t=yt();return z=function(r){return"object"==typeof r?null!==r:t(r)}}function bt(){if(W)return L;W=1;var t=f(),r=yt();return L=function(n,e){return arguments.length<2?(o=t[n],r(o)?o:void 0):t[n]&&t[n][e];var o},L}function wt(){if(K)return G;K=1;var t,r,n=f(),e=function(){if(U)return H;U=1;var t=f().navigator,r=t&&t.userAgent;return H=r?String(r):""}(),o=n.process,i=n.Deno,u=o&&o.versions||i&&i.version,a=u&&u.v8;return a&&(r=(t=a.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!r&&e&&(!(t=e.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=e.match(/Chrome\/(\d+)/))&&(r=+t[1]),G=r}function xt(){if(Y)return X;Y=1;var t=wt(),r=m(),n=f().String;return X=!!Object.getOwnPropertySymbols&&!r((function(){var r=Symbol("symbol detection");return!n(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&t&&t<41}))}function Ot(){if(J)return V;J=1;var t=xt();return V=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function St(){if(tt)return Q;tt=1;var t=bt(),r=yt(),n=function(){if(B)return Z;B=1;var t=st();return Z=t({}.isPrototypeOf)}(),e=Ot(),o=Object;return Q=e?function(t){return"symbol"==typeof t}:function(e){var i=t("Symbol");return r(i)&&n(i.prototype,o(e))}}function jt(){if(nt)return rt;nt=1;var t=String;return rt=function(r){try{return t(r)}catch(t){return"Object"}}}function Et(){if(ot)return et;ot=1;var t=yt(),r=jt(),n=TypeError;return et=function(e){if(t(e))return e;throw new n(r(e)+" is not a function")}}function qt(){if(ut)return it;ut=1;var t=Et(),r=pt();return it=function(n,e){var o=n[e];return r(o)?void 0:t(o)}}function Tt(){if(ft)return at;ft=1;var t=x(),r=yt(),n=mt(),e=TypeError;return at=function(o,i){var u,a;if("string"===i&&r(u=o.toString)&&!n(a=t(u,o)))return a;if(r(u=o.valueOf)&&!n(a=t(u,o)))return a;if("string"!==i&&r(u=o.toString)&&!n(a=t(u,o)))return a;throw new e("Can't convert object to primitive value")}}var Ct,Pt,At,It,Nt,Rt,Mt,Ft,Dt,_t,kt,zt,$t,Lt,Wt,Zt,Bt,Ht,Ut,Gt,Kt,Xt,Yt,Vt,Jt={exports:{}};function Qt(){if(It)return At;It=1;var t=f(),r=Object.defineProperty;return At=function(n,e){try{r(t,n,{value:e,configurable:!0,writable:!0})}catch(r){t[n]=e}return e}}function tr(){if(Nt)return Jt.exports;Nt=1;var t=Pt?Ct:(Pt=1,Ct=!1),r=f(),n=Qt(),e="__core-js_shared__",o=Jt.exports=r[e]||n(e,{});return(o.versions||(o.versions=[])).push({version:"3.38.1",mode:t?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"}),Jt.exports}function rr(){if(Mt)return Rt;Mt=1;var t=tr();return Rt=function(r,n){return t[r]||(t[r]=n||{})}}function nr(){if(Dt)return Ft;Dt=1;var t=ht(),r=Object;return Ft=function(n){return r(t(n))}}function er(){if(kt)return _t;kt=1;var t=st(),r=nr(),n=t({}.hasOwnProperty);return _t=Object.hasOwn||function(t,e){return n(r(t),e)}}function or(){if($t)return zt;$t=1;var t=st(),r=0,n=Math.random(),e=t(1..toString);return zt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+e(++r+n,36)}}function ir(){if(Wt)return Lt;Wt=1;var t=f(),r=rr(),n=er(),e=or(),o=xt(),i=Ot(),u=t.Symbol,a=r("wks"),c=i?u.for||u:u&&u.withoutSetter||e;return Lt=function(t){return n(a,t)||(a[t]=o&&n(u,t)?u[t]:c("Symbol."+t)),a[t]}}function ur(){if(Bt)return Zt;Bt=1;var t=x(),r=mt(),n=St(),e=qt(),o=Tt(),i=ir(),u=TypeError,a=i("toPrimitive");return Zt=function(i,f){if(!r(i)||n(i))return i;var c,l=e(i,a);if(l){if(void 0===f&&(f="default"),c=t(l,i,f),!r(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===f&&(f="number"),o(i,f)}}function ar(){if(Ut)return Ht;Ut=1;var t=ur(),r=St();return Ht=function(n){var e=t(n,"string");return r(e)?e:e+""}}function fr(){if(Kt)return Gt;Kt=1;var t=f(),r=mt(),n=t.document,e=r(n)&&r(n.createElement);return Gt=function(t){return e?n.createElement(t):{}}}function cr(){if(Yt)return Xt;Yt=1;var t=b(),r=m(),n=fr();return Xt=!t&&!r((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function lr(){if(Vt)return y;Vt=1;var t=b(),r=x(),n=function(){if(O)return ct;O=1;var t={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,n=r&&!t.call({1:2},1);return ct.f=n?function(t){var n=r(this,t);return!!n&&n.enumerable}:t,ct}(),e=lt(),o=gt(),i=ar(),u=er(),a=cr(),f=Object.getOwnPropertyDescriptor;return y.f=t?f:function(t,c){if(t=o(t),c=i(c),a)try{return f(t,c)}catch(t){}if(u(t,c))return e(!r(n.f,t,c),t[c])},y}var sr,vr,dr,pr,hr,gr,yr,mr={};function br(){if(vr)return sr;vr=1;var t=b(),r=m();return sr=t&&r((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function wr(){if(pr)return dr;pr=1;var t=mt(),r=String,n=TypeError;return dr=function(e){if(t(e))return e;throw new n(r(e)+" is not an object")}}function xr(){if(hr)return mr;hr=1;var t=b(),r=cr(),n=br(),e=wr(),o=ar(),i=TypeError,u=Object.defineProperty,a=Object.getOwnPropertyDescriptor,f="enumerable",c="configurable",l="writable";return mr.f=t?n?function(t,r,n){if(e(t),r=o(r),e(n),"function"==typeof t&&"prototype"===r&&"value"in n&&l in n&&!n[l]){var i=a(t,r);i&&i[l]&&(t[r]=n.value,n={configurable:c in n?n[c]:i[c],enumerable:f in n?n[f]:i[f],writable:!1})}return u(t,r,n)}:u:function(t,n,a){if(e(t),n=o(n),e(a),r)try{return u(t,n,a)}catch(t){}if("get"in a||"set"in a)throw new i("Accessors not supported");return"value"in a&&(t[n]=a.value),t},mr}function Or(){if(yr)return gr;yr=1;var t=b(),r=xr(),n=lt();return gr=t?function(t,e,o){return r.f(t,e,n(1,o))}:function(t,r,n){return t[r]=n,t}}var Sr,jr,Er,qr,Tr,Cr,Pr,Ar,Ir,Nr,Rr,Mr,Fr,Dr,_r,kr={exports:{}};function zr(){if(jr)return Sr;jr=1;var t=b(),r=er(),n=Function.prototype,e=t&&Object.getOwnPropertyDescriptor,o=r(n,"name"),i=o&&"something"===function(){}.name,u=o&&(!t||t&&e(n,"name").configurable);return Sr={EXISTS:o,PROPER:i,CONFIGURABLE:u}}function $r(){if(qr)return Er;qr=1;var t=st(),r=yt(),n=tr(),e=t(Function.toString);return r(n.inspectSource)||(n.inspectSource=function(t){return e(t)}),Er=n.inspectSource}function Lr(){if(Ar)return Pr;Ar=1;var t=rr(),r=or(),n=t("keys");return Pr=function(t){return n[t]||(n[t]=r(t))}}function Wr(){return Nr?Ir:(Nr=1,Ir={})}function Zr(){if(Mr)return Rr;Mr=1;var t,r,n,e=function(){if(Cr)return Tr;Cr=1;var t=f(),r=yt(),n=t.WeakMap;return Tr=r(n)&&/native code/.test(String(n))}(),o=f(),i=mt(),u=Or(),a=er(),c=tr(),l=Lr(),s=Wr(),v="Object already initialized",d=o.TypeError,p=o.WeakMap;if(e||c.state){var h=c.state||(c.state=new p);h.get=h.get,h.has=h.has,h.set=h.set,t=function(t,r){if(h.has(t))throw new d(v);return r.facade=t,h.set(t,r),r},r=function(t){return h.get(t)||{}},n=function(t){return h.has(t)}}else{var g=l("state");s[g]=!0,t=function(t,r){if(a(t,g))throw new d(v);return r.facade=t,u(t,g,r),r},r=function(t){return a(t,g)?t[g]:{}},n=function(t){return a(t,g)}}return Rr={set:t,get:r,has:n,enforce:function(e){return n(e)?r(e):t(e,{})},getterFor:function(t){return function(n){var e;if(!i(n)||(e=r(n)).type!==t)throw new d("Incompatible receiver, "+t+" required");return e}}}}function Br(){if(Fr)return kr.exports;Fr=1;var t=st(),r=m(),n=yt(),e=er(),o=b(),i=zr().CONFIGURABLE,u=$r(),a=Zr(),f=a.enforce,c=a.get,l=String,s=Object.defineProperty,v=t("".slice),d=t("".replace),p=t([].join),h=o&&!r((function(){return 8!==s((function(){}),"length",{value:8}).length})),g=String(String).split("String"),y=kr.exports=function(t,r,n){"Symbol("===v(l(r),0,7)&&(r="["+d(l(r),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!e(t,"name")||i&&t.name!==r)&&(o?s(t,"name",{value:r,configurable:!0}):t.name=r),h&&n&&e(n,"arity")&&t.length!==n.arity&&s(t,"length",{value:n.arity});try{n&&e(n,"constructor")&&n.constructor?o&&s(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=f(t);return e(u,"source")||(u.source=p(g,"string"==typeof r?r:"")),t};return Function.prototype.toString=y((function(){return n(this)&&c(this).source||u(this)}),"toString"),kr.exports}function Hr(){if(_r)return Dr;_r=1;var t=yt(),r=xr(),n=Br(),e=Qt();return Dr=function(o,i,u,a){a||(a={});var f=a.enumerable,c=void 0!==a.name?a.name:i;if(t(u)&&n(u,c,a),a.global)f?o[i]=u:e(i,u);else{try{a.unsafe?o[i]&&(f=!0):delete o[i]}catch(t){}f?o[i]=u:r.f(o,i,{value:u,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return o}}var Ur,Gr,Kr,Xr,Yr,Vr,Jr,Qr,tn,rn,nn,en,on,un,an,fn,cn,ln={};function sn(){if(Xr)return Kr;Xr=1;var t=function(){if(Gr)return Ur;Gr=1;var t=Math.ceil,r=Math.floor;return Ur=Math.trunc||function(n){var e=+n;return(e>0?r:t)(e)}}();return Kr=function(r){var n=+r;return n!=n||0===n?0:t(n)}}function vn(){if(Vr)return Yr;Vr=1;var t=sn(),r=Math.max,n=Math.min;return Yr=function(e,o){var i=t(e);return i<0?r(i+o,0):n(i,o)}}function dn(){if(Qr)return Jr;Qr=1;var t=sn(),r=Math.min;return Jr=function(n){var e=t(n);return e>0?r(e,9007199254740991):0}}function pn(){if(rn)return tn;rn=1;var t=dn();return tn=function(r){return t(r.length)}}function hn(){if(un)return on;un=1;var t=st(),r=er(),n=gt(),e=function(){if(en)return nn;en=1;var t=gt(),r=vn(),n=pn(),e=function(e){return function(o,i,u){var a=t(o),f=n(a);if(0===f)return!e&&-1;var c,l=r(u,f);if(e&&i!=i){for(;f>l;)if((c=a[l++])!=c)return!0}else for(;f>l;l++)if((e||l in a)&&a[l]===i)return e||l||0;return!e&&-1}};return nn={includes:e(!0),indexOf:e(!1)}}().indexOf,o=Wr(),i=t([].push);return on=function(t,u){var a,f=n(t),c=0,l=[];for(a in f)!r(o,a)&&r(f,a)&&i(l,a);for(;u.length>c;)r(f,a=u[c++])&&(~e(l,a)||i(l,a));return l}}function gn(){return fn?an:(fn=1,an=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}var yn,mn,bn,wn,xn,On,Sn,jn,En,qn,Tn,Cn,Pn,An,In,Nn,Rn,Mn,Fn,Dn,_n,kn,zn,$n,Ln,Wn,Zn,Bn,Hn={};function Un(){if(bn)return mn;bn=1;var t=bt(),r=st(),n=function(){if(cn)return ln;cn=1;var t=hn(),r=gn().concat("length","prototype");return ln.f=Object.getOwnPropertyNames||function(n){return t(n,r)},ln}(),e=(yn||(yn=1,Hn.f=Object.getOwnPropertySymbols),Hn),o=wr(),i=r([].concat);return mn=t("Reflect","ownKeys")||function(t){var r=n.f(o(t)),u=e.f;return u?i(r,u(t)):r}}function Gn(){if(xn)return wn;xn=1;var t=er(),r=Un(),n=lr(),e=xr();return wn=function(o,i,u){for(var a=r(i),f=e.f,c=n.f,l=0;l<a.length;l++){var s=a[l];t(o,s)||u&&t(u,s)||f(o,s,c(i,s))}}}function Kn(){if(En)return jn;En=1;var t=f(),r=lr().f,n=Or(),e=Hr(),o=Qt(),i=Gn(),u=function(){if(Sn)return On;Sn=1;var t=m(),r=yt(),n=/#|\.prototype\./,e=function(n,e){var f=i[o(n)];return f===a||f!==u&&(r(e)?t(e):!!e)},o=e.normalize=function(t){return String(t).replace(n,".").toLowerCase()},i=e.data={},u=e.NATIVE="N",a=e.POLYFILL="P";return On=e}();return jn=function(a,f){var c,l,s,v,d,p=a.target,h=a.global,g=a.stat;if(c=h?t:g?t[p]||o(p,{}):t[p]&&t[p].prototype)for(l in f){if(v=f[l],s=a.dontCallGetSet?(d=r(c,l))&&d.value:c[l],!u(h?l:p+(g?".":"#")+l,a.forced)&&void 0!==s){if(typeof v==typeof s)continue;i(v,s)}(a.sham||s&&s.sham)&&n(v,"sham",!0),e(c,l,v,a)}}}function Xn(){if(Tn)return qn;Tn=1;var t=vt();return qn=Array.isArray||function(r){return"Array"===t(r)}}function Yn(){if(Pn)return Cn;Pn=1;var t=TypeError;return Cn=function(r){if(r>9007199254740991)throw t("Maximum allowed index exceeded");return r}}function Vn(){if(In)return An;In=1;var t=b(),r=xr(),n=lt();return An=function(e,o,i){t?r.f(e,o,n(0,i)):e[o]=i}}function Jn(){if(Rn)return Nn;Rn=1;var t={};return t[ir()("toStringTag")]="z",Nn="[object z]"===String(t)}function Qn(){if(Fn)return Mn;Fn=1;var t=Jn(),r=yt(),n=vt(),e=ir()("toStringTag"),o=Object,i="Arguments"===n(function(){return arguments}());return Mn=t?n:function(t){var u,a,f;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,r){try{return t[r]}catch(t){}}(u=o(t),e))?a:i?n(u):"Object"===(f=n(u))&&r(u.callee)?"Arguments":f}}function te(){if(_n)return Dn;_n=1;var t=st(),r=m(),n=yt(),e=Qn(),o=bt(),i=$r(),u=function(){},a=o("Reflect","construct"),f=/^\s*(?:class|function)\b/,c=t(f.exec),l=!f.test(u),s=function(t){if(!n(t))return!1;try{return a(u,[],t),!0}catch(t){return!1}},v=function(t){if(!n(t))return!1;switch(e(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return l||!!c(f,i(t))}catch(t){return!0}};return v.sham=!0,Dn=!a||r((function(){var t;return s(s.call)||!s(Object)||!s((function(){t=!0}))||t}))?v:s}function re(){if(zn)return kn;zn=1;var t=Xn(),r=te(),n=mt(),e=ir()("species"),o=Array;return kn=function(i){var u;return t(i)&&(u=i.constructor,(r(u)&&(u===o||t(u.prototype))||n(u)&&null===(u=u[e]))&&(u=void 0)),void 0===u?o:u}}function ne(){if(Ln)return $n;Ln=1;var t=re();return $n=function(r,n){return new(t(r))(0===n?0:n)}}function ee(){if(Zn)return Wn;Zn=1;var t=m(),r=ir(),n=wt(),e=r("species");return Wn=function(r){return n>=51||!t((function(){var t=[];return(t.constructor={})[e]=function(){return{foo:1}},1!==t[r](Boolean).foo}))}}!function(){if(Bn)return a;Bn=1;var t=Kn(),r=m(),n=Xn(),e=mt(),o=nr(),i=pn(),u=Yn(),f=Vn(),c=ne(),l=ee(),s=ir(),v=wt(),d=s("isConcatSpreadable"),p=v>=51||!r((function(){var t=[];return t[d]=!1,t.concat()[0]!==t})),h=function(t){if(!e(t))return!1;var r=t[d];return void 0!==r?!!r:n(t)};t({target:"Array",proto:!0,arity:1,forced:!p||!l("concat")},{concat:function(t){var r,n,e,a,l,s=o(this),v=c(s,0),d=0;for(r=-1,e=arguments.length;r<e;r++)if(h(l=-1===r?s:arguments[r]))for(a=i(l),u(d+a),n=0;n<a;n++,d++)n in l&&f(v,d,l[n]);else u(d+1),f(v,d++,l);return v.length=d,v}})}();var oe={type:"image",elemToHtml:function(t,r){var n=t,e=n.src,o=n.alt,i=void 0===o?"":o,u=n.href,a=void 0===u?"":u,f=n.style,c=void 0===f?{}:f,l=c.width,s=void 0===l?"":l,v=c.height,d=void 0===v?"":v,p=c.float,h=void 0===p?"":p,g="";return s&&(g+="width: ".concat(s,";")),d&&(g+="height: ".concat(d,";")),h&&(g+="float: ".concat(h,";")),'<img src="'.concat(e,'" alt="').concat(i,'" data-href="').concat(a,'" style="').concat(g,'"/>')}},ie=function(t,r){return ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},ie(t,r)};function ue(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}ie(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var ae=function(){return ae=Object.assign||function(t){for(var r,n=1,e=arguments.length;n<e;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},ae.apply(this,arguments)};function fe(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function ce(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var le,se,ve,de,pe,he,ge={};function ye(){if(se)return le;se=1;var t=Qn(),r=String;return le=function(n){if("Symbol"===t(n))throw new TypeError("Cannot convert a Symbol value to a string");return r(n)}}function me(){if(de)return ve;de=1;var t=wr();return ve=function(){var r=t(this),n="";return r.hasIndices&&(n+="d"),r.global&&(n+="g"),r.ignoreCase&&(n+="i"),r.multiline&&(n+="m"),r.dotAll&&(n+="s"),r.unicode&&(n+="u"),r.unicodeSets&&(n+="v"),r.sticky&&(n+="y"),n}}var be,we,xe,Oe,Se,je,Ee,qe,Te,Ce,Pe,Ae,Ie,Ne,Re={};function Me(){if(we)return be;we=1;var t=hn(),r=gn();return be=Object.keys||function(n){return t(n,r)}}function Fe(){if(Se)return Oe;Se=1;var t=bt();return Oe=t("document","documentElement")}function De(){if(Ee)return je;Ee=1;var t,r=wr(),n=function(){if(xe)return Re;xe=1;var t=b(),r=br(),n=xr(),e=wr(),o=gt(),i=Me();return Re.f=t&&!r?Object.defineProperties:function(t,r){e(t);for(var u,a=o(r),f=i(r),c=f.length,l=0;c>l;)n.f(t,u=f[l++],a[u]);return t},Re}(),e=gn(),o=Wr(),i=Fe(),u=fr(),a=Lr(),f="prototype",c="script",l=a("IE_PROTO"),s=function(){},v=function(t){return"<"+c+">"+t+"</"+c+">"},d=function(t){t.write(v("")),t.close();var r=t.parentWindow.Object;return t=null,r},p=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var r,n,o;p="undefined"!=typeof document?document.domain&&t?d(t):(n=u("iframe"),o="java"+c+":",n.style.display="none",i.appendChild(n),n.src=String(o),(r=n.contentWindow.document).open(),r.write(v("document.F=Object")),r.close(),r.F):d(t);for(var a=e.length;a--;)delete p[f][e[a]];return p()};return o[l]=!0,je=Object.create||function(t,e){var o;return null!==t?(s[f]=r(t),o=new s,s[f]=null,o[l]=t):o=p(),void 0===e?o:n.f(o,e)}}function _e(){if(Ie)return Ae;Ie=1;var t,r,n=x(),e=st(),o=ye(),i=me(),u=function(){if(he)return pe;he=1;var t=m(),r=f().RegExp,n=t((function(){var t=r("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),e=n||t((function(){return!r("a","y").sticky})),o=n||t((function(){var t=r("^r","gy");return t.lastIndex=2,null!==t.exec("str")}));return pe={BROKEN_CARET:o,MISSED_STICKY:e,UNSUPPORTED_Y:n}}(),a=rr(),c=De(),l=Zr().get,s=function(){if(Te)return qe;Te=1;var t=m(),r=f().RegExp;return qe=t((function(){var t=r(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}))}(),v=function(){if(Pe)return Ce;Pe=1;var t=m(),r=f().RegExp;return Ce=t((function(){var t=r("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))}(),d=a("native-string-replace",String.prototype.replace),p=RegExp.prototype.exec,h=p,g=e("".charAt),y=e("".indexOf),b=e("".replace),w=e("".slice),O=(r=/b*/g,n(p,t=/a/,"a"),n(p,r,"a"),0!==t.lastIndex||0!==r.lastIndex),S=u.BROKEN_CARET,j=void 0!==/()??/.exec("")[1];return(O||j||S||s||v)&&(h=function(t){var r,e,u,a,f,s,v,m=this,x=l(m),E=o(t),q=x.raw;if(q)return q.lastIndex=m.lastIndex,r=n(h,q,E),m.lastIndex=q.lastIndex,r;var T=x.groups,C=S&&m.sticky,P=n(i,m),A=m.source,I=0,N=E;if(C&&(P=b(P,"y",""),-1===y(P,"g")&&(P+="g"),N=w(E,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==g(E,m.lastIndex-1))&&(A="(?: "+A+")",N=" "+N,I++),e=new RegExp("^(?:"+A+")",P)),j&&(e=new RegExp("^"+A+"$(?!\\s)",P)),O&&(u=m.lastIndex),a=n(p,C?e:m,N),C?a?(a.input=w(a.input,I),a[0]=w(a[0],I),a.index=m.lastIndex,m.lastIndex+=a[0].length):m.lastIndex=0:O&&a&&(m.lastIndex=m.global?a.index+a[0].length:u),j&&a&&a.length>1&&n(d,a[0],e,(function(){for(f=1;f<arguments.length-2;f++)void 0===arguments[f]&&(a[f]=void 0)})),a&&T)for(a.groups=s=c(null),f=0;f<T.length;f++)s[(v=T[f])[0]]=a[v[1]];return a}),Ae=h}!function(){if(Ne)return ge;Ne=1;var t=Kn(),r=_e();t({target:"RegExp",proto:!0,forced:/./.exec!==r},{exec:r})}();var ke,ze,$e,Le,We,Ze,Be,He=function(){function r(){this.tag="button"}return r.prototype.getValue=function(t){return""},r.prototype.isActive=function(t){return!1},r.prototype.getSelectedNode=function(r){return t.DomEditor.getSelectedNodeByType(r,"image")},r.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedNode(t)},r.prototype.exec=function(r,n){if(!this.isDisabled(r)){var e=this.getSelectedNode(r);if(null!=e){var o=t.DomEditor.getHoverbar(r);o&&o.hideAndClean();var i=e.style,u={style:ae(ae({},void 0===i?{}:i),{float:this.value})};t.SlateTransforms.setNodes(r,u,{match:function(r){return t.DomEditor.checkNodeType(r,"image")}})}}},r}(),Ue=function(r){function n(){var n=r.apply(this,ce([],fe(arguments),!1))||this;return n.title=t.t("float.left"),n.value="left",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M89.46270815 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.42756742 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756742 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.4275674-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.4275674-12.42756741z"></path><path d="M512 552.8045037m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756742l0 68.35162073q0 12.42756741-12.4275674 12.42756741l-410.10972444 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162073q0-12.42756741 12.42756741-12.42756742Z"></path><path d="M512 366.39099259m12.42756741 0l410.10972444 0q12.42756741 0 12.4275674 12.42756741l0 68.35162075q0 12.42756741-12.4275674 12.4275674l-410.10972444 0q-12.42756741 0-12.42756741-12.4275674l0-68.35162075q0-12.42756741 12.42756741-12.42756741Z"></path></svg>',n}return ue(n,r),n}(He),Ge=function(r){function n(){var n=r.apply(this,ce([],fe(arguments),!1))||this;return n.title=t.t("float.none"),n.value="none",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M76.73805432 117.83964445m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.4275674l0 68.35162074q0 12.42756741-12.42756741 12.42756741l-845.0745837 0q-12.42756741 0-12.42756741-12.42756741l0-68.35162074q0-12.42756741 12.42756741-12.4275674Z"></path><path d="M76.73805432 801.35585185m12.42756741 0l845.0745837 0q12.42756741 0 12.42756741 12.42756741l0 68.35162074q0 12.42756741-12.42756741 12.42756742l-845.0745837 0q-12.42756741 0-12.42756741-12.42756742l0-68.35162074q0-12.42756741 12.42756741-12.42756741Z"></path><path d="M89.16562173 304.25315556h410.10972444c6.83516208 0 12.42756741 5.59240533 12.42756741 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.42756741 12.4275674h-410.10972444a12.42756741 12.42756741 0 0 1-12.42756741-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756741-12.42756741z"></path></svg>',n}return ue(n,r),n}(He),Ke=function(r){function n(){var n=r.apply(this,ce([],fe(arguments),!1))||this;return n.title=t.t("float.right"),n.value="right",n.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M77.03514075 117.83964445m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.4275674l0 68.35162074q0 12.42756741-12.4275674 12.42756741l-845.0745837 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162074q0-12.42756741 12.4275674-12.4275674Z"></path><path d="M77.03514075 801.35585185m12.4275674 0l845.0745837 0q12.42756741 0 12.4275674 12.42756741l0 68.35162074q0 12.42756741-12.4275674 12.42756742l-845.0745837 0q-12.42756741 0-12.4275674-12.42756742l0-68.35162074q0-12.42756741 12.4275674-12.42756741Z"></path><path d="M586.56540445 304.25315556h347.9718874c6.83516208 0 12.42756741 5.59240533 12.4275674 12.42756741v410.10972445a12.42756741 12.42756741 0 0 1-12.4275674 12.4275674h-347.9718874a12.42756741 12.42756741 0 0 1-12.42756742-12.4275674v-410.10972445c0-6.83516208 5.59240533-12.42756741 12.42756742-12.42756741z"></path><path d="M77.03514075 552.8045037m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756742l0 68.35162073q0 12.42756741-12.42756741 12.42756741l-410.10972444 0q-12.42756741 0-12.4275674-12.42756741l0-68.35162073q0-12.42756741 12.4275674-12.42756742Z"></path><path d="M77.03514075 366.39099259m12.4275674 0l410.10972444 0q12.42756741 0 12.42756741 12.42756741l0 68.35162075q0 12.42756741-12.42756741 12.4275674l-410.10972444 0q-12.42756741 0-12.4275674-12.4275674l0-68.35162075q0-12.42756741 12.4275674-12.42756741Z"></path></svg>',n}return ue(n,r),n}(He),Xe={key:"imageFloatNone",factory:function(){return new Ge}},Ye={key:"imageFloatLeft",factory:function(){return new Ue}},Ve={key:"imageFloatRight",factory:function(){return new Ke}},Je={};function Qe(){if(Le)return $e;Le=1;var t=function(){if(ze)return ke;ze=1;var t=vt(),r=st();return ke=function(n){if("Function"===t(n))return r(n)}}(),r=Et(),n=w(),e=t(t.bind);return $e=function(t,o){return r(t),void 0===o?t:n?e(t,o):function(){return t.apply(o,arguments)}},$e}function to(){if(Ze)return We;Ze=1;var t=Qe(),r=st(),n=dt(),e=nr(),o=pn(),i=ne(),u=r([].push),a=function(r){var a=1===r,f=2===r,c=3===r,l=4===r,s=6===r,v=7===r,d=5===r||s;return function(p,h,g,y){for(var m,b,w=e(p),x=n(w),O=o(x),S=t(h,g),j=0,E=y||i,q=a?E(p,O):f||v?E(p,0):void 0;O>j;j++)if((d||j in x)&&(b=S(m=x[j],j,w),r))if(a)q[j]=b;else if(b)switch(r){case 3:return!0;case 5:return m;case 6:return j;case 2:u(q,m)}else switch(r){case 4:return!1;case 7:u(q,m)}return s?-1:c||l?l:q}};return We={forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findIndex:a(6),filterReject:a(7)}}!function(){if(Be)return Je;Be=1;var t=Kn(),r=to().filter;t({target:"Array",proto:!0,forced:!ee()("filter")},{filter:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}})}();var ro,no,eo,oo={};function io(){if(no)return ro;no=1;var t=ir(),r=De(),n=xr().f,e=t("unscopables"),o=Array.prototype;return void 0===o[e]&&n(o,e,{configurable:!0,value:r(null)}),ro=function(t){o[e][t]=!0}}!function(){if(eo)return oo;eo=1;var t=Kn(),r=to().find,n=io(),e="find",o=!0;e in[]&&Array(1)[e]((function(){o=!1})),t({target:"Array",proto:!0,forced:o},{find:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}}),n(e)}();var uo,ao,fo,co={};!function(){if(fo)return co;fo=1;var t=Jn(),r=Hr(),n=function(){if(ao)return uo;ao=1;var t=Jn(),r=Qn();return uo=t?{}.toString:function(){return"[object "+r(this)+"]"}}();t||r(Object.prototype,"toString",n,{unsafe:!0})}();var lo,so,vo,po,ho,go,yo,mo={};function bo(){return so?lo:(so=1,lo="\t\n\v\f\r \u2028\u2029\ufeff")}!function(){if(yo)return mo;yo=1;var t=Kn(),r=function(){if(po)return vo;po=1;var t=st(),r=ht(),n=ye(),e=bo(),o=t("".replace),i=RegExp("^["+e+"]+"),u=RegExp("(^|[^"+e+"])["+e+"]+$"),a=function(t){return function(e){var a=n(r(e));return 1&t&&(a=o(a,i,"")),2&t&&(a=o(a,u,"$1")),a}};return vo={start:a(1),end:a(2),trim:a(3)}}().trim,n=function(){if(go)return ho;go=1;var t=zr().PROPER,r=m(),n=bo();return ho=function(e){return r((function(){return!!n[e]()||"
"!=="
"[e]()||t&&n[e].name!==e}))}}();t({target:"String",proto:!0,forced:n("trim")},{trim:function(){return r(this)}})}();var wo,xo,Oo={};function So(t,r){for(var n="",e=(t.attr("style")||"").split(";"),o=e.length,i=0;i<o;i+=1){var u=e[i];if(u){var a=u.split(":");a[0].trim()===r&&(n=a[1].trim())}}return n}xo||(xo=1,function(){if(wo)return Oo;wo=1;var t=Kn(),r=f();t({global:!0,forced:r.globalThis!==r},{globalThis:r})}()),r.css&&(r.fn.css=r.css),r.append&&(r.fn.append=r.append),r.prepend&&(r.fn.prepend=r.prepend),r.addClass&&(r.fn.addClass=r.addClass),r.removeClass&&(r.fn.removeClass=r.removeClass),r.hasClass&&(r.fn.hasClass=r.hasClass),r.on&&(r.fn.on=r.on),r.off&&(r.fn.off=r.off),r.focus&&(r.fn.focus=r.focus),r.attr&&(r.fn.attr=r.attr),r.removeAttr&&(r.fn.removeAttr=r.removeAttr),r.hide&&(r.fn.hide=r.hide),r.show&&(r.fn.show=r.show),r.parents&&(r.fn.parents=r.parents),r.dataset&&(r.fn.dataset=r.dataset),r.val&&(r.fn.val=r.val),r.text&&(r.fn.text=r.text),r.html&&(r.fn.html=r.html),r.children&&(r.fn.children=r.children),r.remove&&(r.fn.remove=r.remove),r.find&&(r.fn.find=r.find),r.width&&(r.fn.width=r.width),r.height&&(r.fn.height=r.height),r.filter&&(r.fn.filter=r.filter),r.empty&&(r.fn.empty=r.empty);var jo,Eo,qo,To,Co,Po,Ao,Io={selector:"img:not([data-w-e-type])",parseElemHtml:function(t,n,e){var o=r(t),i=o.attr("data-href")||"";return i=decodeURIComponent(i),{type:"image",src:o.attr("src")||"",alt:o.attr("alt")||"",href:i,style:{width:So(o,"width"),height:So(o,"height"),float:So(o,"float")||""},width:o.attr("width")||"",height:o.attr("height")||"",children:[{text:""}]}}},No={};function Ro(){if(Eo)return jo;Eo=1;var t=st();return jo=t(1..valueOf)}!function(){if(Co)return No;Co=1;var t=Kn(),r=st(),n=sn(),e=Ro(),o=function(){if(To)return qo;To=1;var t=sn(),r=ye(),n=ht(),e=RangeError;return qo=function(o){var i=r(n(this)),u="",a=t(o);if(a<0||a===1/0)throw new e("Wrong number of repetitions");for(;a>0;(a>>>=1)&&(i+=i))1&a&&(u+=i);return u}}(),i=m(),u=RangeError,a=String,f=Math.floor,c=r(o),l=r("".slice),s=r(1..toFixed),v=function(t,r,n){return 0===r?n:r%2==1?v(t,r-1,n*t):v(t*t,r/2,n)},d=function(t,r,n){for(var e=-1,o=n;++e<6;)o+=r*t[e],t[e]=o%1e7,o=f(o/1e7)},p=function(t,r){for(var n=6,e=0;--n>=0;)e+=t[n],t[n]=f(e/r),e=e%r*1e7},h=function(t){for(var r=6,n="";--r>=0;)if(""!==n||0===r||0!==t[r]){var e=a(t[r]);n=""===n?e:n+c("0",7-e.length)+e}return n};t({target:"Number",proto:!0,forced:i((function(){return"0.000"!==s(8e-5,3)||"1"!==s(.9,0)||"1.25"!==s(1.255,2)||"1000000000000000128"!==s(0xde0b6b3a7640080,0)}))||!i((function(){s({})}))},{toFixed:function(t){var r,o,i,f,s=e(this),g=n(t),y=[0,0,0,0,0,0],m="",b="0";if(g<0||g>20)throw new u("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return a(s);if(s<0&&(m="-",s=-s),s>1e-21)if(o=(r=function(t){for(var r=0,n=t;n>=4096;)r+=12,n/=4096;for(;n>=2;)r+=1,n/=2;return r}(s*v(2,69,1))-69)<0?s*v(2,-r,1):s/v(2,r,1),o*=4503599627370496,(r=52-r)>0){for(d(y,0,o),i=g;i>=7;)d(y,1e7,0),i-=7;for(d(y,v(10,i,1),0),i=r-1;i>=23;)p(y,1<<23),i-=23;p(y,1<<i),d(y,1,1),p(y,2),b=h(y)}else d(y,0,o),d(y,1<<-r,0),b=h(y)+c("0",g);return b=g>0?m+((f=b.length)<=g?"0."+c("0",g-f)+b:l(b,0,f-g)+"."+l(b,f-g)):m+b}})}();var Mo=function(){if(Ao)return Po;Ao=1;var t="Expected a function",r=NaN,n="[object Symbol]",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,a=/^0o[0-7]+$/i,f=parseInt,c="object"==typeof e&&e&&e.Object===Object&&e,l="object"==typeof self&&self&&self.Object===Object&&self,s=c||l||Function("return this")(),v=Object.prototype.toString,d=Math.max,p=Math.min,h=function(){return s.Date.now()};function g(r,n,e){var o,i,u,a,f,c,l=0,s=!1,v=!1,g=!0;if("function"!=typeof r)throw new TypeError(t);function b(t){var n=o,e=i;return o=i=void 0,l=t,a=r.apply(e,n)}function w(t){var r=t-c;return void 0===c||r>=n||r<0||v&&t-l>=u}function x(){var t=h();if(w(t))return O(t);f=setTimeout(x,function(t){var r=n-(t-c);return v?p(r,u-(t-l)):r}(t))}function O(t){return f=void 0,g&&o?b(t):(o=i=void 0,a)}function S(){var t=h(),r=w(t);if(o=arguments,i=this,c=t,r){if(void 0===f)return function(t){return l=t,f=setTimeout(x,n),s?b(t):a}(c);if(v)return f=setTimeout(x,n),b(c)}return void 0===f&&(f=setTimeout(x,n)),a}return n=m(n)||0,y(e)&&(s=!!e.leading,u=(v="maxWait"in e)?d(m(e.maxWait)||0,n):u,g="trailing"in e?!!e.trailing:g),S.cancel=function(){void 0!==f&&clearTimeout(f),l=0,o=c=i=f=void 0},S.flush=function(){return void 0===f?a:O(h())},S}function y(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&v.call(t)==n}(t))return r;if(y(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=y(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var c=u.test(t);return c||a.test(t)?f(t.slice(2),c?2:8):i.test(t)?r:+t}return Po=function(r,n,e){var o=!0,i=!0;if("function"!=typeof r)throw new TypeError(t);return y(e)&&(o="leading"in e?!!e.leading:o,i="trailing"in e?!!e.trailing:i),g(r,n,{leading:o,maxWait:n,trailing:i})}}(),Fo=o(Mo);function Do(r,n){var e=t.DomEditor.findKey(r,n).id;return"w-e-image-container-".concat(e)}function _o(e,o,i,u){var a=r("body"),f=Do(e,o),c=u.width,l=u.height,s=u.float,v=0,d=0,p=0,h=!1,g=null;var y=Fo((function(t){t.preventDefault();var r=t.clientX,n=d+(h?v-r:r-v),e=p*(n/d);null!=g&&(n<=15||e<=15||(g.css("width","".concat(n,"px")),g.css("height","".concat(e,"px"))))}),100);function m(r){if(a.off("mousemove",y),null!=g){var n=g.width().toFixed(2),i=g.height().toFixed(2),u={style:ae(ae({},o.style),{width:"".concat(n,"px"),height:"".concat(i,"px")})};t.SlateTransforms.setNodes(e,u,{at:t.DomEditor.findPath(e,o)}),a.off("mouseup",m)}}function b(n){g=function(){var t=r("#".concat(f));if(0===t.length)throw new Error("Cannot find image container elem");return t}(),v=n;var o=g.find("img");if(0===o.length)throw new Error("Cannot find image elem");d=o.width(),p=o.height(),a.on("mousemove",y),a.on("mouseup",m);var i=t.DomEditor.getHoverbar(e);i&&i.hideAndClean()}var w={};return c&&(w.width=c),l&&(w.height=l),s&&(w.float=s),n.jsx("div",{id:f,style:w,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(t){var n=r(t.target);n.hasClass("w-e-image-dragger")&&(t.preventDefault(),(n.hasClass("left-top")||n.hasClass("left-bottom"))&&(h=!0),b(t.clientX))}}},i,n.jsx("div",{className:"w-e-image-dragger left-top"}),n.jsx("div",{className:"w-e-image-dragger right-top"}),n.jsx("div",{className:"w-e-image-dragger left-bottom"}),n.jsx("div",{className:"w-e-image-dragger right-bottom"}))}return{renderElems:[{type:"image",renderElem:function(r,e,o){var i=r,u=i.src,a=i.alt,f=void 0===a?"":a,c=i.href,l=void 0===c?"":c,s=i.style,v=void 0===s?{}:s,d=v.width,p=void 0===d?"":d,h=v.height,g=void 0===h?"":h,y=v.float,m=t.DomEditor.isNodeSelected(o,r),b={};p&&(b.width="100%"),g&&(b.height="100%"),y&&(b.float=y);var w=n.jsx("img",{style:b,src:u,alt:f,"data-href":l}),x=o.isDisabled();return m&&!x?_o(o,r,w,{width:p,height:g,float:y}):function(t,r,e,o){var i=o.width,u=o.height,a=o.float,f={};i&&(f.width=i),u&&(f.height=u),a&&(f.float=a);var c=Do(t,r);return n.jsx("div",{id:c,style:f,className:"w-e-image-container"},e)}(o,r,w,{width:p,height:g,float:y})}}],elemsToHtml:[oe],parseElemsHtml:[Io],menus:[Ye,Ve,Xe]}}));
|
2
|
+
//# sourceMappingURL=index.js.map
|