@lingxiteam/lcdp-ueditor-react 1.0.2 → 1.0.3-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/es/LcdpUeditor.d.ts.map +1 -1
  2. package/es/LcdpUeditor.js +2 -1
  3. package/es/tools/UeditorResourceLoader.d.ts +1 -1
  4. package/es/tools/UeditorResourceLoader.d.ts.map +1 -1
  5. package/es/tools/UeditorResourceLoader.js +18 -7
  6. package/es/tools/filterHtmlNode.d.ts.map +1 -1
  7. package/es/tools/filterHtmlNode.js +7 -2
  8. package/lib/LcdpUeditor.js +1 -3
  9. package/lib/tools/UeditorResourceLoader.d.ts +1 -1
  10. package/lib/tools/UeditorResourceLoader.js +15 -7
  11. package/lib/tools/filterHtmlNode.js +8 -4
  12. package/package.json +1 -1
  13. package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
  14. package/ueditor-resource/dialogs/attachment/attachment.css +2 -715
  15. package/ueditor-resource/dialogs/attachment/attachment.html +6 -6
  16. package/ueditor-resource/dialogs/attachment/attachment.js +2 -803
  17. package/ueditor-resource/dialogs/audio/audio.css +2 -878
  18. package/ueditor-resource/dialogs/audio/audio.js +2 -815
  19. package/ueditor-resource/dialogs/background/background.css +2 -192
  20. package/ueditor-resource/dialogs/background/background.html +3 -3
  21. package/ueditor-resource/dialogs/background/background.js +2 -370
  22. package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
  23. package/ueditor-resource/dialogs/contentimport/contentimport.js +2 -91
  24. package/ueditor-resource/dialogs/emotion/emotion.css +2 -128
  25. package/ueditor-resource/dialogs/emotion/emotion.html +3 -3
  26. package/ueditor-resource/dialogs/emotion/emotion.js +2 -186
  27. package/ueditor-resource/dialogs/formula/formula.html +4 -4
  28. package/ueditor-resource/dialogs/formula/formula.js +2 -147
  29. package/ueditor-resource/dialogs/help/help.css +2 -36
  30. package/ueditor-resource/dialogs/help/help.html +3 -3
  31. package/ueditor-resource/dialogs/help/help.js +2 -57
  32. package/ueditor-resource/dialogs/image/image.css +2 -767
  33. package/ueditor-resource/dialogs/image/image.js +2 -1060
  34. package/ueditor-resource/dialogs/insertframe/insertframe.html +2 -2
  35. package/ueditor-resource/dialogs/internal.js +2 -81
  36. package/ueditor-resource/dialogs/preview/preview.html +2 -2
  37. package/ueditor-resource/dialogs/scrawl/scrawl.css +2 -323
  38. package/ueditor-resource/dialogs/scrawl/scrawl.html +3 -3
  39. package/ueditor-resource/dialogs/scrawl/scrawl.js +2 -682
  40. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
  41. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +2 -174
  42. package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
  43. package/ueditor-resource/dialogs/spechars/spechars.js +2 -86
  44. package/ueditor-resource/dialogs/table/edittable.css +2 -84
  45. package/ueditor-resource/dialogs/table/edittable.html +3 -3
  46. package/ueditor-resource/dialogs/table/edittable.js +2 -241
  47. package/ueditor-resource/dialogs/table/edittd.html +1 -1
  48. package/ueditor-resource/dialogs/table/edittip.html +1 -1
  49. package/ueditor-resource/dialogs/template/config.js +2 -42
  50. package/ueditor-resource/dialogs/template/template.css +2 -98
  51. package/ueditor-resource/dialogs/template/template.html +4 -4
  52. package/ueditor-resource/dialogs/template/template.js +2 -53
  53. package/ueditor-resource/dialogs/video/video.css +2 -908
  54. package/ueditor-resource/dialogs/video/video.js +2 -867
  55. package/ueditor-resource/dialogs/wordimage/wordimage.html +5 -5
  56. package/ueditor-resource/dialogs/wordimage/wordimage.js +2 -93
  57. package/ueditor-resource/lang/en/en.js +2 -686
  58. package/ueditor-resource/lang/zh-cn/zh-cn.js +2 -748
  59. package/ueditor-resource/lang/zh-tw/zh-tw.js +2 -748
  60. package/ueditor-resource/plugins/demo/demo.js +1 -3
  61. package/ueditor-resource/themes/default/css/ueditor.css +2 -2148
  62. package/ueditor-resource/themes/default/dialog.css +2 -16
  63. package/ueditor-resource/themes/default/dialogbase.css +2 -131
  64. package/ueditor-resource/themes/iframe.css +2 -62
  65. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +4 -3655
  66. package/ueditor-resource/third-party/SyntaxHighlighter/shCoreDefault.css +3 -1
  67. package/ueditor-resource/third-party/clipboard/clipboard.js +2 -753
  68. package/ueditor-resource/third-party/codemirror/codemirror.css +2 -105
  69. package/ueditor-resource/third-party/codemirror/codemirror.js +3 -3581
  70. package/ueditor-resource/third-party/jquery-3.5.1.js +4 -2
  71. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4 -4314
  72. package/ueditor-resource/third-party/webuploader/webuploader.css +2 -87
  73. package/ueditor-resource/third-party/webuploader/webuploader.js +5 -4
  74. package/ueditor-resource/ueditor.all.js +20 -32644
  75. package/ueditor-resource/ueditor.config.js +2 -655
  76. package/ueditor-resource/ueditor.parse.js +2 -639
@@ -1,753 +1,2 @@
1
- /*!
2
- * clipboard.js v1.5.15
3
- * https://zenorocha.github.io/clipboard.js
4
- *
5
- * Licensed MIT © Zeno Rocha
6
- */
7
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
8
- /**
9
- * A polyfill for Element.matches()
10
- */
11
- if (Element && !Element.prototype.matches) {
12
- var proto = Element.prototype;
13
-
14
- proto.matches = proto.matchesSelector ||
15
- proto.mozMatchesSelector ||
16
- proto.msMatchesSelector ||
17
- proto.oMatchesSelector ||
18
- proto.webkitMatchesSelector;
19
- }
20
-
21
- /**
22
- * Finds the closest parent that matches a selector.
23
- *
24
- * @param {Element} element
25
- * @param {String} selector
26
- * @return {Function}
27
- */
28
- function closest (element, selector) {
29
- while (element && element !== document) {
30
- if (element.matches(selector)) return element;
31
- element = element.parentNode;
32
- }
33
- }
34
-
35
- module.exports = closest;
36
-
37
- },{}],2:[function(require,module,exports){
38
- var closest = require('./closest');
39
-
40
- /**
41
- * Delegates event to a selector.
42
- *
43
- * @param {Element} element
44
- * @param {String} selector
45
- * @param {String} type
46
- * @param {Function} callback
47
- * @param {Boolean} useCapture
48
- * @return {Object}
49
- */
50
- function delegate(element, selector, type, callback, useCapture) {
51
- var listenerFn = listener.apply(this, arguments);
52
-
53
- element.addEventListener(type, listenerFn, useCapture);
54
-
55
- return {
56
- destroy: function() {
57
- element.removeEventListener(type, listenerFn, useCapture);
58
- }
59
- }
60
- }
61
-
62
- /**
63
- * Finds closest match and invokes callback.
64
- *
65
- * @param {Element} element
66
- * @param {String} selector
67
- * @param {String} type
68
- * @param {Function} callback
69
- * @return {Function}
70
- */
71
- function listener(element, selector, type, callback) {
72
- return function(e) {
73
- e.delegateTarget = closest(e.target, selector);
74
-
75
- if (e.delegateTarget) {
76
- callback.call(element, e);
77
- }
78
- }
79
- }
80
-
81
- module.exports = delegate;
82
-
83
- },{"./closest":1}],3:[function(require,module,exports){
84
- /**
85
- * Check if argument is a HTML element.
86
- *
87
- * @param {Object} value
88
- * @return {Boolean}
89
- */
90
- exports.node = function(value) {
91
- return value !== undefined
92
- && value instanceof HTMLElement
93
- && value.nodeType === 1;
94
- };
95
-
96
- /**
97
- * Check if argument is a list of HTML elements.
98
- *
99
- * @param {Object} value
100
- * @return {Boolean}
101
- */
102
- exports.nodeList = function(value) {
103
- var type = Object.prototype.toString.call(value);
104
-
105
- return value !== undefined
106
- && (type === '[object NodeList]' || type === '[object HTMLCollection]')
107
- && ('length' in value)
108
- && (value.length === 0 || exports.node(value[0]));
109
- };
110
-
111
- /**
112
- * Check if argument is a string.
113
- *
114
- * @param {Object} value
115
- * @return {Boolean}
116
- */
117
- exports.string = function(value) {
118
- return typeof value === 'string'
119
- || value instanceof String;
120
- };
121
-
122
- /**
123
- * Check if argument is a function.
124
- *
125
- * @param {Object} value
126
- * @return {Boolean}
127
- */
128
- exports.fn = function(value) {
129
- var type = Object.prototype.toString.call(value);
130
-
131
- return type === '[object Function]';
132
- };
133
-
134
- },{}],4:[function(require,module,exports){
135
- var is = require('./is');
136
- var delegate = require('delegate');
137
-
138
- /**
139
- * Validates all params and calls the right
140
- * listener function based on its target type.
141
- *
142
- * @param {String|HTMLElement|HTMLCollection|NodeList} target
143
- * @param {String} type
144
- * @param {Function} callback
145
- * @return {Object}
146
- */
147
- function listen(target, type, callback) {
148
- if (!target && !type && !callback) {
149
- throw new Error('Missing required arguments');
150
- }
151
-
152
- if (!is.string(type)) {
153
- throw new TypeError('Second argument must be a String');
154
- }
155
-
156
- if (!is.fn(callback)) {
157
- throw new TypeError('Third argument must be a Function');
158
- }
159
-
160
- if (is.node(target)) {
161
- return listenNode(target, type, callback);
162
- }
163
- else if (is.nodeList(target)) {
164
- return listenNodeList(target, type, callback);
165
- }
166
- else if (is.string(target)) {
167
- return listenSelector(target, type, callback);
168
- }
169
- else {
170
- throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
171
- }
172
- }
173
-
174
- /**
175
- * Adds an event listener to a HTML element
176
- * and returns a remove listener function.
177
- *
178
- * @param {HTMLElement} node
179
- * @param {String} type
180
- * @param {Function} callback
181
- * @return {Object}
182
- */
183
- function listenNode(node, type, callback) {
184
- node.addEventListener(type, callback);
185
-
186
- return {
187
- destroy: function() {
188
- node.removeEventListener(type, callback);
189
- }
190
- }
191
- }
192
-
193
- /**
194
- * Add an event listener to a list of HTML elements
195
- * and returns a remove listener function.
196
- *
197
- * @param {NodeList|HTMLCollection} nodeList
198
- * @param {String} type
199
- * @param {Function} callback
200
- * @return {Object}
201
- */
202
- function listenNodeList(nodeList, type, callback) {
203
- Array.prototype.forEach.call(nodeList, function(node) {
204
- node.addEventListener(type, callback);
205
- });
206
-
207
- return {
208
- destroy: function() {
209
- Array.prototype.forEach.call(nodeList, function(node) {
210
- node.removeEventListener(type, callback);
211
- });
212
- }
213
- }
214
- }
215
-
216
- /**
217
- * Add an event listener to a selector
218
- * and returns a remove listener function.
219
- *
220
- * @param {String} selector
221
- * @param {String} type
222
- * @param {Function} callback
223
- * @return {Object}
224
- */
225
- function listenSelector(selector, type, callback) {
226
- return delegate(document.body, selector, type, callback);
227
- }
228
-
229
- module.exports = listen;
230
-
231
- },{"./is":3,"delegate":2}],5:[function(require,module,exports){
232
- function select(element) {
233
- var selectedText;
234
-
235
- if (element.nodeName === 'SELECT') {
236
- element.focus();
237
-
238
- selectedText = element.value;
239
- }
240
- else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
241
- element.focus();
242
- element.setSelectionRange(0, element.value.length);
243
-
244
- selectedText = element.value;
245
- }
246
- else {
247
- if (element.hasAttribute('contenteditable')) {
248
- element.focus();
249
- }
250
-
251
- var selection = window.getSelection();
252
- var range = document.createRange();
253
-
254
- range.selectNodeContents(element);
255
- selection.removeAllRanges();
256
- selection.addRange(range);
257
-
258
- selectedText = selection.toString();
259
- }
260
-
261
- return selectedText;
262
- }
263
-
264
- module.exports = select;
265
-
266
- },{}],6:[function(require,module,exports){
267
- function E () {
268
- // Keep this empty so it's easier to inherit from
269
- // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
270
- }
271
-
272
- E.prototype = {
273
- on: function (name, callback, ctx) {
274
- var e = this.e || (this.e = {});
275
-
276
- (e[name] || (e[name] = [])).push({
277
- fn: callback,
278
- ctx: ctx
279
- });
280
-
281
- return this;
282
- },
283
-
284
- once: function (name, callback, ctx) {
285
- var self = this;
286
- function listener () {
287
- self.off(name, listener);
288
- callback.apply(ctx, arguments);
289
- };
290
-
291
- listener._ = callback
292
- return this.on(name, listener, ctx);
293
- },
294
-
295
- emit: function (name) {
296
- var data = [].slice.call(arguments, 1);
297
- var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
298
- var i = 0;
299
- var len = evtArr.length;
300
-
301
- for (i; i < len; i++) {
302
- evtArr[i].fn.apply(evtArr[i].ctx, data);
303
- }
304
-
305
- return this;
306
- },
307
-
308
- off: function (name, callback) {
309
- var e = this.e || (this.e = {});
310
- var evts = e[name];
311
- var liveEvents = [];
312
-
313
- if (evts && callback) {
314
- for (var i = 0, len = evts.length; i < len; i++) {
315
- if (evts[i].fn !== callback && evts[i].fn._ !== callback)
316
- liveEvents.push(evts[i]);
317
- }
318
- }
319
-
320
- // Remove event from queue to prevent memory leak
321
- // Suggested by https://github.com/lazd
322
- // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
323
-
324
- (liveEvents.length)
325
- ? e[name] = liveEvents
326
- : delete e[name];
327
-
328
- return this;
329
- }
330
- };
331
-
332
- module.exports = E;
333
-
334
- },{}],7:[function(require,module,exports){
335
- (function (global, factory) {
336
- if (typeof define === "function" && define.amd) {
337
- define(['module', 'select'], factory);
338
- } else if (typeof exports !== "undefined") {
339
- factory(module, require('select'));
340
- } else {
341
- var mod = {
342
- exports: {}
343
- };
344
- factory(mod, global.select);
345
- global.clipboardAction = mod.exports;
346
- }
347
- })(this, function (module, _select) {
348
- 'use strict';
349
-
350
- var _select2 = _interopRequireDefault(_select);
351
-
352
- function _interopRequireDefault(obj) {
353
- return obj && obj.__esModule ? obj : {
354
- default: obj
355
- };
356
- }
357
-
358
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
359
- return typeof obj;
360
- } : function (obj) {
361
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
362
- };
363
-
364
- function _classCallCheck(instance, Constructor) {
365
- if (!(instance instanceof Constructor)) {
366
- throw new TypeError("Cannot call a class as a function");
367
- }
368
- }
369
-
370
- var _createClass = function () {
371
- function defineProperties(target, props) {
372
- for (var i = 0; i < props.length; i++) {
373
- var descriptor = props[i];
374
- descriptor.enumerable = descriptor.enumerable || false;
375
- descriptor.configurable = true;
376
- if ("value" in descriptor) descriptor.writable = true;
377
- Object.defineProperty(target, descriptor.key, descriptor);
378
- }
379
- }
380
-
381
- return function (Constructor, protoProps, staticProps) {
382
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
383
- if (staticProps) defineProperties(Constructor, staticProps);
384
- return Constructor;
385
- };
386
- }();
387
-
388
- var ClipboardAction = function () {
389
- /**
390
- * @param {Object} options
391
- */
392
- function ClipboardAction(options) {
393
- _classCallCheck(this, ClipboardAction);
394
-
395
- this.resolveOptions(options);
396
- this.initSelection();
397
- }
398
-
399
- /**
400
- * Defines base properties passed from constructor.
401
- * @param {Object} options
402
- */
403
-
404
-
405
- _createClass(ClipboardAction, [{
406
- key: 'resolveOptions',
407
- value: function resolveOptions() {
408
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
409
-
410
- this.action = options.action;
411
- this.emitter = options.emitter;
412
- this.target = options.target;
413
- this.text = options.text;
414
- this.trigger = options.trigger;
415
-
416
- this.selectedText = '';
417
- }
418
- }, {
419
- key: 'initSelection',
420
- value: function initSelection() {
421
- if (this.text) {
422
- this.selectFake();
423
- } else if (this.target) {
424
- this.selectTarget();
425
- }
426
- }
427
- }, {
428
- key: 'selectFake',
429
- value: function selectFake() {
430
- var _this = this;
431
-
432
- var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
433
-
434
- this.removeFake();
435
-
436
- this.fakeHandlerCallback = function () {
437
- return _this.removeFake();
438
- };
439
- this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
440
-
441
- this.fakeElem = document.createElement('textarea');
442
- // Prevent zooming on iOS
443
- this.fakeElem.style.fontSize = '12pt';
444
- // Reset box model
445
- this.fakeElem.style.border = '0';
446
- this.fakeElem.style.padding = '0';
447
- this.fakeElem.style.margin = '0';
448
- // Move element out of screen horizontally
449
- this.fakeElem.style.position = 'absolute';
450
- this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
451
- // Move element to the same position vertically
452
- var yPosition = window.pageYOffset || document.documentElement.scrollTop;
453
- this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
454
- this.fakeElem.style.top = yPosition + 'px';
455
-
456
- this.fakeElem.setAttribute('readonly', '');
457
- this.fakeElem.value = this.text;
458
-
459
- document.body.appendChild(this.fakeElem);
460
-
461
- this.selectedText = (0, _select2.default)(this.fakeElem);
462
- this.copyText();
463
- }
464
- }, {
465
- key: 'removeFake',
466
- value: function removeFake() {
467
- if (this.fakeHandler) {
468
- document.body.removeEventListener('click', this.fakeHandlerCallback);
469
- this.fakeHandler = null;
470
- this.fakeHandlerCallback = null;
471
- }
472
-
473
- if (this.fakeElem) {
474
- document.body.removeChild(this.fakeElem);
475
- this.fakeElem = null;
476
- }
477
- }
478
- }, {
479
- key: 'selectTarget',
480
- value: function selectTarget() {
481
- this.selectedText = (0, _select2.default)(this.target);
482
- this.copyText();
483
- }
484
- }, {
485
- key: 'copyText',
486
- value: function copyText() {
487
- var succeeded = void 0;
488
-
489
- try {
490
- succeeded = document.execCommand(this.action);
491
- } catch (err) {
492
- succeeded = false;
493
- }
494
-
495
- this.handleResult(succeeded);
496
- }
497
- }, {
498
- key: 'handleResult',
499
- value: function handleResult(succeeded) {
500
- this.emitter.emit(succeeded ? 'success' : 'error', {
501
- action: this.action,
502
- text: this.selectedText,
503
- trigger: this.trigger,
504
- clearSelection: this.clearSelection.bind(this)
505
- });
506
- }
507
- }, {
508
- key: 'clearSelection',
509
- value: function clearSelection() {
510
- if (this.target) {
511
- this.target.blur();
512
- }
513
-
514
- window.getSelection().removeAllRanges();
515
- }
516
- }, {
517
- key: 'destroy',
518
- value: function destroy() {
519
- this.removeFake();
520
- }
521
- }, {
522
- key: 'action',
523
- set: function set() {
524
- var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
525
-
526
- this._action = action;
527
-
528
- if (this._action !== 'copy' && this._action !== 'cut') {
529
- throw new Error('Invalid "action" value, use either "copy" or "cut"');
530
- }
531
- },
532
- get: function get() {
533
- return this._action;
534
- }
535
- }, {
536
- key: 'target',
537
- set: function set(target) {
538
- if (target !== undefined) {
539
- if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
540
- if (this.action === 'copy' && target.hasAttribute('disabled')) {
541
- throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
542
- }
543
-
544
- if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
545
- throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
546
- }
547
-
548
- this._target = target;
549
- } else {
550
- throw new Error('Invalid "target" value, use a valid Element');
551
- }
552
- }
553
- },
554
- get: function get() {
555
- return this._target;
556
- }
557
- }]);
558
-
559
- return ClipboardAction;
560
- }();
561
-
562
- module.exports = ClipboardAction;
563
- });
564
-
565
- },{"select":5}],8:[function(require,module,exports){
566
- (function (global, factory) {
567
- if (typeof define === "function" && define.amd) {
568
- define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);
569
- } else if (typeof exports !== "undefined") {
570
- factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
571
- } else {
572
- var mod = {
573
- exports: {}
574
- };
575
- factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
576
- global.clipboard = mod.exports;
577
- }
578
- })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
579
- 'use strict';
580
-
581
- var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
582
-
583
- var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
584
-
585
- var _goodListener2 = _interopRequireDefault(_goodListener);
586
-
587
- function _interopRequireDefault(obj) {
588
- return obj && obj.__esModule ? obj : {
589
- default: obj
590
- };
591
- }
592
-
593
- function _classCallCheck(instance, Constructor) {
594
- if (!(instance instanceof Constructor)) {
595
- throw new TypeError("Cannot call a class as a function");
596
- }
597
- }
598
-
599
- var _createClass = function () {
600
- function defineProperties(target, props) {
601
- for (var i = 0; i < props.length; i++) {
602
- var descriptor = props[i];
603
- descriptor.enumerable = descriptor.enumerable || false;
604
- descriptor.configurable = true;
605
- if ("value" in descriptor) descriptor.writable = true;
606
- Object.defineProperty(target, descriptor.key, descriptor);
607
- }
608
- }
609
-
610
- return function (Constructor, protoProps, staticProps) {
611
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
612
- if (staticProps) defineProperties(Constructor, staticProps);
613
- return Constructor;
614
- };
615
- }();
616
-
617
- function _possibleConstructorReturn(self, call) {
618
- if (!self) {
619
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
620
- }
621
-
622
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
623
- }
624
-
625
- function _inherits(subClass, superClass) {
626
- if (typeof superClass !== "function" && superClass !== null) {
627
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
628
- }
629
-
630
- subClass.prototype = Object.create(superClass && superClass.prototype, {
631
- constructor: {
632
- value: subClass,
633
- enumerable: false,
634
- writable: true,
635
- configurable: true
636
- }
637
- });
638
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
639
- }
640
-
641
- var Clipboard = function (_Emitter) {
642
- _inherits(Clipboard, _Emitter);
643
-
644
- /**
645
- * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
646
- * @param {Object} options
647
- */
648
- function Clipboard(trigger, options) {
649
- _classCallCheck(this, Clipboard);
650
-
651
- var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
652
-
653
- _this.resolveOptions(options);
654
- _this.listenClick(trigger);
655
- return _this;
656
- }
657
-
658
- /**
659
- * Defines if attributes would be resolved using internal setter functions
660
- * or custom functions that were passed in the constructor.
661
- * @param {Object} options
662
- */
663
-
664
-
665
- _createClass(Clipboard, [{
666
- key: 'resolveOptions',
667
- value: function resolveOptions() {
668
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
669
-
670
- this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
671
- this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
672
- this.text = typeof options.text === 'function' ? options.text : this.defaultText;
673
- }
674
- }, {
675
- key: 'listenClick',
676
- value: function listenClick(trigger) {
677
- var _this2 = this;
678
-
679
- this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
680
- return _this2.onClick(e);
681
- });
682
- }
683
- }, {
684
- key: 'onClick',
685
- value: function onClick(e) {
686
- var trigger = e.delegateTarget || e.currentTarget;
687
-
688
- if (this.clipboardAction) {
689
- this.clipboardAction = null;
690
- }
691
-
692
- this.clipboardAction = new _clipboardAction2.default({
693
- action: this.action(trigger),
694
- target: this.target(trigger),
695
- text: this.text(trigger),
696
- trigger: trigger,
697
- emitter: this
698
- });
699
- }
700
- }, {
701
- key: 'defaultAction',
702
- value: function defaultAction(trigger) {
703
- return getAttributeValue('action', trigger);
704
- }
705
- }, {
706
- key: 'defaultTarget',
707
- value: function defaultTarget(trigger) {
708
- var selector = getAttributeValue('target', trigger);
709
-
710
- if (selector) {
711
- return document.querySelector(selector);
712
- }
713
- }
714
- }, {
715
- key: 'defaultText',
716
- value: function defaultText(trigger) {
717
- return getAttributeValue('text', trigger);
718
- }
719
- }, {
720
- key: 'destroy',
721
- value: function destroy() {
722
- this.listener.destroy();
723
-
724
- if (this.clipboardAction) {
725
- this.clipboardAction.destroy();
726
- this.clipboardAction = null;
727
- }
728
- }
729
- }]);
730
-
731
- return Clipboard;
732
- }(_tinyEmitter2.default);
733
-
734
- /**
735
- * Helper function to retrieve attribute value.
736
- * @param {String} suffix
737
- * @param {Element} element
738
- */
739
- function getAttributeValue(suffix, element) {
740
- var attribute = 'data-clipboard-' + suffix;
741
-
742
- if (!element.hasAttribute(attribute)) {
743
- return;
744
- }
745
-
746
- return element.getAttribute(attribute);
747
- }
748
-
749
- module.exports = Clipboard;
750
- });
751
-
752
- },{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)
753
- });
1
+ /*! UEditorPlus v2.0.0*/
2
+ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Clipboard=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a,b){for(;a&&a!==document;){if(a.matches(b))return a;a=a.parentNode}}if(Element&&!Element.prototype.matches){var e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}b.exports=d},{}],2:[function(a,b,c){function d(a,b,c,d,f){var g=e.apply(this,arguments);return a.addEventListener(c,g,f),{destroy:function(){a.removeEventListener(c,g,f)}}}function e(a,b,c,d){return function(c){c.delegateTarget=f(c.target,b),c.delegateTarget&&d.call(a,c)}}var f=a("./closest");b.exports=d},{"./closest":1}],3:[function(a,b,c){c.node=function(a){return void 0!==a&&a instanceof HTMLElement&&1===a.nodeType},c.nodeList=function(a){var b=Object.prototype.toString.call(a);return void 0!==a&&("[object NodeList]"===b||"[object HTMLCollection]"===b)&&"length"in a&&(0===a.length||c.node(a[0]))},c.string=function(a){return"string"==typeof a||a instanceof String},c.fn=function(a){var b=Object.prototype.toString.call(a);return"[object Function]"===b}},{}],4:[function(a,b,c){function d(a,b,c){if(!a&&!b&&!c)throw new Error("Missing required arguments");if(!h.string(b))throw new TypeError("Second argument must be a String");if(!h.fn(c))throw new TypeError("Third argument must be a Function");if(h.node(a))return e(a,b,c);if(h.nodeList(a))return f(a,b,c);if(h.string(a))return g(a,b,c);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function e(a,b,c){return a.addEventListener(b,c),{destroy:function(){a.removeEventListener(b,c)}}}function f(a,b,c){return Array.prototype.forEach.call(a,function(a){a.addEventListener(b,c)}),{destroy:function(){Array.prototype.forEach.call(a,function(a){a.removeEventListener(b,c)})}}}function g(a,b,c){return i(document.body,a,b,c)}var h=a("./is"),i=a("delegate");b.exports=d},{"./is":3,delegate:2}],5:[function(a,b,c){function d(a){var b;if("SELECT"===a.nodeName)a.focus(),b=a.value;else if("INPUT"===a.nodeName||"TEXTAREA"===a.nodeName)a.focus(),a.setSelectionRange(0,a.value.length),b=a.value;else{a.hasAttribute("contenteditable")&&a.focus();var c=window.getSelection(),d=document.createRange();d.selectNodeContents(a),c.removeAllRanges(),c.addRange(d),b=c.toString()}return b}b.exports=d},{}],6:[function(a,b,c){function d(){}d.prototype={on:function(a,b,c){var d=this.e||(this.e={});return(d[a]||(d[a]=[])).push({fn:b,ctx:c}),this},once:function(a,b,c){function d(){e.off(a,d),b.apply(c,arguments)}var e=this;return d._=b,this.on(a,d,c)},emit:function(a){var b=[].slice.call(arguments,1),c=((this.e||(this.e={}))[a]||[]).slice(),d=0,e=c.length;for(d;d<e;d++)c[d].fn.apply(c[d].ctx,b);return this},off:function(a,b){var c=this.e||(this.e={}),d=c[a],e=[];if(d&&b)for(var f=0,g=d.length;f<g;f++)d[f].fn!==b&&d[f].fn._!==b&&e.push(d[f]);return e.length?c[a]=e:delete c[a],this}},b.exports=d},{}],7:[function(b,c,d){!function(e,f){if("function"==typeof a&&a.amd)a(["module","select"],f);else if("undefined"!=typeof d)f(c,b("select"));else{var g={exports:{}};f(g,e.select),e.clipboardAction=g.exports}}(this,function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=c(b),f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=function(){function a(b){d(this,a),this.resolveOptions(b),this.initSelection()}return g(a,[{key:"resolveOptions",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=a.action,this.emitter=a.emitter,this.target=a.target,this.text=a.text,this.trigger=a.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var a=this,b="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return a.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[b?"right":"left"]="-9999px";var c=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.addEventListener("focus",window.scrollTo(0,c)),this.fakeElem.style.top=c+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,e["default"])(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,e["default"])(this.target),this.copyText()}},{key:"copyText",value:function(){var a=void 0;try{a=document.execCommand(this.action)}catch(b){a=!1}this.handleResult(a)}},{key:"handleResult",value:function(a){this.emitter.emit(a?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=a,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(a){if(void 0!==a){if(!a||"object"!==("undefined"==typeof a?"undefined":f(a))||1!==a.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&a.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(a.hasAttribute("readonly")||a.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=a}},get:function(){return this._target}}]),a}();a.exports=h})},{select:5}],8:[function(b,c,d){!function(e,f){if("function"==typeof a&&a.amd)a(["module","./clipboard-action","tiny-emitter","good-listener"],f);else if("undefined"!=typeof d)f(c,b("./clipboard-action"),b("tiny-emitter"),b("good-listener"));else{var g={exports:{}};f(g,e.clipboardAction,e.tinyEmitter,e.goodListener),e.clipboard=g.exports}}(this,function(a,b,c,d){"use strict";function e(a){return a&&a.__esModule?a:{"default":a}}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function g(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function h(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function i(a,b){var c="data-clipboard-"+a;if(b.hasAttribute(c))return b.getAttribute(c)}var j=e(b),k=e(c),l=e(d),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),n=function(a){function b(a,c){f(this,b);var d=g(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return d.resolveOptions(c),d.listenClick(a),d}return h(b,a),m(b,[{key:"resolveOptions",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof a.action?a.action:this.defaultAction,this.target="function"==typeof a.target?a.target:this.defaultTarget,this.text="function"==typeof a.text?a.text:this.defaultText}},{key:"listenClick",value:function(a){var b=this;this.listener=(0,l["default"])(a,"click",function(a){return b.onClick(a)})}},{key:"onClick",value:function(a){var b=a.delegateTarget||a.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new j["default"]({action:this.action(b),target:this.target(b),text:this.text(b),trigger:b,emitter:this})}},{key:"defaultAction",value:function(a){return i("action",a)}},{key:"defaultTarget",value:function(a){var b=i("target",a);if(b)return document.querySelector(b)}},{key:"defaultText",value:function(a){return i("text",a)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}]),b}(k["default"]);a.exports=n})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});