quill-resize-module 1.2.3 → 2.0.0
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.
- package/README.md +19 -82
- package/demo/demo.jpg +0 -0
- package/demo/index.html +15 -19
- package/demo/{script.js → index.js} +7 -38
- package/dist/resize.css +1 -41
- package/dist/resize.js +2 -2
- package/package.json +28 -31
- package/src/DefaultOptions.js +7 -10
- package/src/QuillResize.js +36 -13
- package/src/Util.js +9 -0
- package/src/assets/resize.css +0 -41
- package/src/index.js +2 -36
- package/src/modules/Keyboard.js +49 -37
- package/src/modules/Resize.js +27 -11
- package/demo/demo.png +0 -0
- package/demo/umd.html +0 -110
- package/src/formats/image.js +0 -40
- package/src/formats/placeholder.js +0 -188
package/README.md
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
# Quill Resize Module
|
|
2
2
|
|
|
3
|
-
A module for Quill rich text editor to allow images/iframe/video and custom elements
|
|
3
|
+
A module for Quill rich text editor to allow images/iframe/video and custom elements to be resized.
|
|
4
4
|
|
|
5
5
|
This module is original forked from <https://github.com/whatcould/quill-image-resize-module>.
|
|
6
6
|
|
|
7
|
+
## Changed V2
|
|
8
|
+
1. Support Quill2
|
|
9
|
+
2. Removed formats/image formats/placeholder
|
|
10
|
+
3. Add `embedTags` option for custom embed element
|
|
11
|
+
|
|
7
12
|
## Features
|
|
8
|
-
- Image resize
|
|
9
|
-
- Embed
|
|
10
|
-
- Custom any elements resize
|
|
13
|
+
- Image resize
|
|
14
|
+
- Embed resize (Default to iframe/video tag)
|
|
15
|
+
- Custom any elements resize
|
|
11
16
|
|
|
12
|
-
- Limit minWidth/maxWidth/minHeight/maxHeight
|
|
13
|
-
- Limit Width/Height ratio
|
|
14
|
-
- Selected
|
|
15
|
-
- Direction key support
|
|
17
|
+
- Limit minWidth/maxWidth/minHeight/maxHeight
|
|
18
|
+
- Limit Width/Height ratio
|
|
19
|
+
- Selected embed element style
|
|
20
|
+
- Direction key support
|
|
16
21
|
|
|
17
22
|
## Demo
|
|
18
23
|
|
|
19
|
-
<https://
|
|
20
|
-

|
|
21
26
|
|
|
22
27
|
## Usage
|
|
23
28
|
|
|
@@ -39,60 +44,6 @@ const quill = new Quill(editor, {
|
|
|
39
44
|
});
|
|
40
45
|
```
|
|
41
46
|
|
|
42
|
-
**use placeholder for iframe/video**
|
|
43
|
-
|
|
44
|
-
```javascript
|
|
45
|
-
import Quill from 'quill';
|
|
46
|
-
import QuillResize, { PlaceholderRegister } from 'quill-resize-module';
|
|
47
|
-
|
|
48
|
-
Quill.register('modules/resize', QuillResize);
|
|
49
|
-
// default to iframe/video tag
|
|
50
|
-
// if you went to replace default video blot, see 'demo/script.js'
|
|
51
|
-
PlaceholderRegister();
|
|
52
|
-
|
|
53
|
-
const quill = new Quill(editor, {
|
|
54
|
-
// ...
|
|
55
|
-
modules: {
|
|
56
|
-
// ...
|
|
57
|
-
resize: {
|
|
58
|
-
// See optional "config" below
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**use placeholder for custom element**
|
|
65
|
-
|
|
66
|
-
```javascript
|
|
67
|
-
import Quill from 'quill';
|
|
68
|
-
import QuillResize, { PlaceholderRegister, EmbedPlaceholder } from 'quill-resize-module';
|
|
69
|
-
|
|
70
|
-
Quill.register('modules/resize', QuillResize);
|
|
71
|
-
|
|
72
|
-
class TagPlaceholder extends EmbedPlaceholder { }
|
|
73
|
-
// default to ['iframe', 'video']
|
|
74
|
-
TagPlaceholder.tagName = ['iframe', 'video', 'embed']
|
|
75
|
-
// Important!!! must be null or don't set it
|
|
76
|
-
// TagPlaceholder.className = null
|
|
77
|
-
|
|
78
|
-
// if you went to replace default video blot, see 'demo/script.js'
|
|
79
|
-
|
|
80
|
-
class ClassPlaceholder extends EmbedPlaceholder { }
|
|
81
|
-
ClassPlaceholder.className = '.ql-embed'
|
|
82
|
-
|
|
83
|
-
PlaceholderRegister([TagPlaceholder, ClassPlaceholder])
|
|
84
|
-
|
|
85
|
-
const quill = new Quill(editor, {
|
|
86
|
-
// ...
|
|
87
|
-
modules: {
|
|
88
|
-
// ...
|
|
89
|
-
resize: {
|
|
90
|
-
// See optional "config" below
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
```
|
|
95
|
-
|
|
96
47
|
### Script Tag
|
|
97
48
|
|
|
98
49
|
Copy resize.js into your web root or include from node_modules
|
|
@@ -112,21 +63,6 @@ var quill = new Quill(editor, {
|
|
|
112
63
|
}
|
|
113
64
|
});
|
|
114
65
|
```
|
|
115
|
-
**use placeholder for iframe/video**
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
// if you went to replace default video blot, see 'demo/script.js'
|
|
119
|
-
QuillResize.PlaceholderRegister()
|
|
120
|
-
var quill = new Quill(editor, {
|
|
121
|
-
// ...
|
|
122
|
-
modules: {
|
|
123
|
-
// ...
|
|
124
|
-
resize: {
|
|
125
|
-
// See optional "config" below
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
66
|
|
|
131
67
|
### Config
|
|
132
68
|
|
|
@@ -263,9 +199,10 @@ the module setup.
|
|
|
263
199
|
For example,
|
|
264
200
|
|
|
265
201
|
```javascript
|
|
266
|
-
import
|
|
202
|
+
import QuillResize from 'quill-resize-module';
|
|
203
|
+
Quill.register('modules/resize', QuillResize);
|
|
267
204
|
|
|
268
|
-
class MyModule extends
|
|
205
|
+
class MyModule extends QuillResize.Modules.Base {
|
|
269
206
|
// See src/modules/BaseModule.js for documentation on the various lifecycle callbacks
|
|
270
207
|
}
|
|
271
208
|
|
|
@@ -274,7 +211,7 @@ var quill = new Quill(editor, {
|
|
|
274
211
|
modules: {
|
|
275
212
|
// ...
|
|
276
213
|
resize: {
|
|
277
|
-
modules: [ MyModule, Resize ],
|
|
214
|
+
modules: [ MyModule, QuillResize.Modules.Resize ],
|
|
278
215
|
// ...
|
|
279
216
|
}
|
|
280
217
|
}
|
package/demo/demo.jpg
ADDED
|
Binary file
|
package/demo/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.editor-box {
|
|
14
|
-
height:
|
|
14
|
+
height: 600px;
|
|
15
15
|
padding-top: 42px;
|
|
16
16
|
margin: 0 auto;
|
|
17
17
|
}
|
|
@@ -28,10 +28,6 @@
|
|
|
28
28
|
cursor: default !important;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.ql-embed-placeholder[data-type="ql-embed"] {
|
|
32
|
-
background-color: #fff;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
31
|
.buttons {
|
|
36
32
|
margin: 1em 0 2em;
|
|
37
33
|
}
|
|
@@ -40,6 +36,16 @@
|
|
|
40
36
|
padding: 3px .5em;
|
|
41
37
|
}
|
|
42
38
|
|
|
39
|
+
/* for active resize element */
|
|
40
|
+
.ql-editor .active {
|
|
41
|
+
outline: 2px solid rgba(5, 145, 255, 0.4);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* for selected element */
|
|
45
|
+
.ql-editor .selected {
|
|
46
|
+
opacity: .5;
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
#result {
|
|
44
50
|
width: 100%;
|
|
45
51
|
}
|
|
@@ -50,21 +56,11 @@
|
|
|
50
56
|
<h1>Quill Resize Module Demo</h1>
|
|
51
57
|
<div class="editor-box">
|
|
52
58
|
<div id="editor">
|
|
53
|
-
<p>Click
|
|
54
|
-
<p><img src="
|
|
59
|
+
<p>Click target to resize.</p>
|
|
60
|
+
<p><img src="https://i.ytimg.com/vi/Fp5ghKduTK8/hq720.jpg" width="450"></p>
|
|
61
|
+
<p><br></p>
|
|
62
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/vYD1cSQ8jAY?si=DZYEYsGyDlciQRBP" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
|
55
63
|
<p><br></p>
|
|
56
|
-
<p>And you can custom any element to be resized.</p>
|
|
57
|
-
<div>
|
|
58
|
-
<iframe src="https://vjs.zencdn.net/" frameborder="0"></iframe>
|
|
59
|
-
<iframe src="https://22222/" frameborder="0"></iframe>
|
|
60
|
-
</div>
|
|
61
|
-
<div>
|
|
62
|
-
<video src="https://vjs.zencdn.net/v/oceans.mp4" controls preload="auto"
|
|
63
|
-
poster="https://vjs.zencdn.net/v/oceans.png"></video>
|
|
64
|
-
<embed src="test://embed"></embed>
|
|
65
|
-
<span class="ql-embed" data-type="ql-embed" data-src="test://ql-embed"
|
|
66
|
-
style="background-color: beige;">ddd</span>
|
|
67
|
-
</div>
|
|
68
64
|
<p>Try to press left/right key around the placeholder.</p>
|
|
69
65
|
</div>
|
|
70
66
|
</div>
|
|
@@ -1,47 +1,13 @@
|
|
|
1
1
|
import 'quill/dist/quill.snow.css'
|
|
2
2
|
import '../src/assets/resize.css'
|
|
3
3
|
|
|
4
|
-
import Resize
|
|
5
|
-
EmbedPlaceholder,
|
|
6
|
-
PlaceholderRegister,
|
|
7
|
-
convertPlaceholderHTML
|
|
8
|
-
} from '../src/index'
|
|
4
|
+
import Resize from '../src/index'
|
|
9
5
|
|
|
10
6
|
import _Quill from 'quill'
|
|
11
7
|
const Quill = window.Quill || _Quill
|
|
12
8
|
|
|
13
9
|
Quill.register('modules/resize', Resize)
|
|
14
10
|
|
|
15
|
-
class TagPlaceholder extends EmbedPlaceholder {}
|
|
16
|
-
// default to ['iframe', 'video']
|
|
17
|
-
TagPlaceholder.tagName = ['iframe', 'embed']
|
|
18
|
-
// important!!! must be null or don't set it
|
|
19
|
-
// TagPlaceholder.className = null
|
|
20
|
-
|
|
21
|
-
// replace default video blot
|
|
22
|
-
class VideoPlaceholder extends EmbedPlaceholder {
|
|
23
|
-
static create (value) {
|
|
24
|
-
let video = value
|
|
25
|
-
if (typeof value === 'string') {
|
|
26
|
-
video = {
|
|
27
|
-
'data-embed-source': encodeURIComponent(
|
|
28
|
-
`<video src="${value}" controls preload="auto"></video>`
|
|
29
|
-
),
|
|
30
|
-
'data-type': 'video',
|
|
31
|
-
'data-src': value
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return super.create(video)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
VideoPlaceholder.blotName = 'video'
|
|
38
|
-
VideoPlaceholder.tagName = 'video'
|
|
39
|
-
|
|
40
|
-
class ClassPlaceholder extends EmbedPlaceholder {}
|
|
41
|
-
ClassPlaceholder.className = 'ql-embed'
|
|
42
|
-
|
|
43
|
-
PlaceholderRegister([TagPlaceholder, VideoPlaceholder, ClassPlaceholder])
|
|
44
|
-
|
|
45
11
|
const demoEditor = new Quill('#editor', {
|
|
46
12
|
theme: 'snow',
|
|
47
13
|
modules: {
|
|
@@ -52,14 +18,17 @@ const demoEditor = new Quill('#editor', {
|
|
|
52
18
|
['link', 'image', 'video'],
|
|
53
19
|
['clean']
|
|
54
20
|
],
|
|
55
|
-
resize: {
|
|
21
|
+
resize: {
|
|
22
|
+
// set embed tags to capture resize
|
|
23
|
+
embedTags: ['VIDEO', 'IFRAME']
|
|
24
|
+
}
|
|
56
25
|
}
|
|
57
26
|
})
|
|
58
27
|
|
|
59
28
|
const $result = document.querySelector('#result')
|
|
29
|
+
$result.value = `Quill V${Quill.version}`
|
|
60
30
|
document.querySelector('.btn-html').addEventListener('click', function () {
|
|
61
|
-
|
|
62
|
-
$result.value = html
|
|
31
|
+
$result.value = demoEditor.root.innerHTML
|
|
63
32
|
})
|
|
64
33
|
document.querySelector('.btn-content').addEventListener('click', function () {
|
|
65
34
|
const result = demoEditor.getContents()
|
package/dist/resize.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Quill Resize Module
|
|
2
|
+
* Quill Resize Module v2.0.0
|
|
3
3
|
* https://github.com/mudoo/quill-resize-module
|
|
4
4
|
*/
|
|
5
5
|
.ql-resize-style-left {
|
|
@@ -18,43 +18,3 @@
|
|
|
18
18
|
width: 100% !important;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.ql-embed-placeholder {
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
text-align: center;
|
|
26
|
-
width: 400px;
|
|
27
|
-
height: 225px;
|
|
28
|
-
background-color: #f0f0f0;
|
|
29
|
-
border: 1px solid #ccc;
|
|
30
|
-
cursor: default !important;
|
|
31
|
-
margin-bottom: 1em;
|
|
32
|
-
padding: 2em;
|
|
33
|
-
/* user-select: none; */
|
|
34
|
-
}
|
|
35
|
-
.ql-embed-placeholder:hover {
|
|
36
|
-
background-color: #e8e8e8;
|
|
37
|
-
}
|
|
38
|
-
.ql-embed-placeholder::before {
|
|
39
|
-
content: "<" attr(data-type) ">";
|
|
40
|
-
font-size: 1.5em;
|
|
41
|
-
margin-bottom: .5em;
|
|
42
|
-
text-transform: uppercase;
|
|
43
|
-
}
|
|
44
|
-
.ql-embed-placeholder::after {
|
|
45
|
-
content: attr(data-src);
|
|
46
|
-
color: #666;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.ql-embed-placeholder.active {
|
|
50
|
-
border-color: #abc9e9;
|
|
51
|
-
background-color: #d2e5f9;
|
|
52
|
-
}
|
|
53
|
-
.ql-embed-placeholder.selected {
|
|
54
|
-
color: #fff;
|
|
55
|
-
border-color: #4185d2;
|
|
56
|
-
background-color: #5f9de2;
|
|
57
|
-
}
|
|
58
|
-
.ql-embed-placeholder.selected::after {
|
|
59
|
-
color: #fff;
|
|
60
|
-
}
|
package/dist/resize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Quill Resize Module
|
|
2
|
+
* Quill Resize Module v2.0.0
|
|
3
3
|
* https://github.com/mudoo/quill-resize-module
|
|
4
4
|
*/
|
|
5
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("Quill")):"function"==typeof define&&define.amd?define(["Quill"],e):"object"==typeof exports?exports.QuillResize=e(require("Quill")):t.QuillResize=e(t.Quill)}(window,(function(t){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(e,i){e.exports=t},function(t,e,i){"use strict";e.__esModule=!0;var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.resizer=e,this.quill=e.quill,this.overlay=e.overlay,this.activeEle=e.activeEle,this.blot=e.blot,this.options=e.options,this.requestUpdate=function(){e.onUpdate(!0)}}return t.prototype.onCreate=function(){},t.prototype.onDestroy=function(){},t.prototype.onUpdate=function(){},t}();e.default=o},function(t,e,i){"use strict";e.__esModule=!0,e.PlaceholderRegister=e.Image=e.Resize=e.convertPlaceholderHTML=e.ClassNamePlaceholder=e.TagPlaceholder=e.EmbedPlaceholder=void 0;var o=i(3);Object.defineProperty(e,"EmbedPlaceholder",{enumerable:!0,get:function(){return o.EmbedPlaceholder}}),Object.defineProperty(e,"TagPlaceholder",{enumerable:!0,get:function(){return o.TagPlaceholder}}),Object.defineProperty(e,"ClassNamePlaceholder",{enumerable:!0,get:function(){return o.ClassNamePlaceholder}}),Object.defineProperty(e,"convertPlaceholderHTML",{enumerable:!0,get:function(){return o.convertPlaceholderHTML}});var n=a(i(0));i(16);var r=a(i(4)),s=i(15),l=a(o);function a(t){return t&&t.__esModule?t:{default:t}}(window.Quill||n.default).register(s.Image,!0),e.default=r.default,e.Resize=r.default,e.Image=s.Image,e.PlaceholderRegister=l.default,Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null})},function(t,e,i){"use strict";e.__esModule=!0,e.convertPlaceholderHTML=e.ClassNamePlaceholder=e.TagPlaceholder=e.EmbedPlaceholder=void 0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[v];Array.isArray(t)||(t=[t]);t.push(m),t.forEach((function(t){h.register(t,!0),t.tagName=y.tagName,t.className=m.className}))};var n,r=i(0),s=(n=r)&&n.__esModule?n:{default:n};function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var h=window.Quill||s.default,c=h.import("blots/container"),d=h.import("blots/scroll"),f=["data-embed-source","data-type","data-src","data-size","style"],p=h.import("parchment"),y=function(t){function e(){return l(this,e),a(this,t.apply(this,arguments))}return u(e,t),e.create=function(e){var i=t.create.call(this);if("string"==typeof e)i.setAttribute(f[0],e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.setAttribute(o,e[o]);return i.setAttribute("contenteditable",!1),i.setAttribute("unselectable","on"),i},e.formats=function(t){return t.__handling&&t.__formats?t.__formats:f.slice(3).reduce((function(e,i){return t.hasAttribute(i)&&(e[i]=t.getAttribute(i)),e}),{})},e.value=function(t){var e=f.slice(0,3),i={};return e.forEach((function(e){var o="";if(t.hasAttribute(e))o=t.getAttribute(e);else switch(e){case f[0]:o=encodeURIComponent(t.outerHTML);break;case f[1]:o=t.tagName;break;case f[2]:o=t.getAttribute("src");break;case"style":o=t.style.cssText;break;default:o=t[e]||""}o&&(i[e]=o)})),i},e.prototype.format=function(e,i){"style"!==e?-1!==f.indexOf(e)?i?this.domNode.setAttribute(e,i):this.domNode.removeAttribute(e):t.prototype.format.call(this,e,i):this.domNode.style.cssText=i},e.prototype.handling=function(t){this.domNode.__formats=this.constructor.formats(this.domNode),this.domNode.__handling=t},e}(h.import("blots/block/embed"));y.blotName="embed-placeholder",y.tagName="span",y.scope=p.Scope.INLINE_BLOT,c.allowedChildren.push(y),d.allowedChildren.push(y);var v=function(t){function e(){return l(this,e),a(this,t.apply(this,arguments))}return u(e,t),e}(y);v.tagName=["video","iframe"];var m=function(t){function e(){return l(this,e),a(this,t.apply(this,arguments))}return u(e,t),e}(y);m.className="ql-embed-placeholder";var b=/<([\w-]+)((?:\s+[\w-:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*>([^<]*?)<\/\1>/g,g=/([\w-:.]+)(?:\s*=\s*(?:"((?:\\.|[^"])*)"|'((?:\\.|[^'])*)'))?/g;function w(t){var e={};return t.replace(g,(function(t,i,o,n){var r=(o||n||"").trim();e[i]=r})),e}var E=/<([\w-]+)((?:\s+[\w-:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*>/;function x(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.replace(E,(function(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=w(n);o(r,e);var s=Object.keys(r).reduce((function(t,e){var i=r[e];return null==i?t:t+=""===i?" "+e:" "+e+'="'+i+'"'}),"");return"<"+i+s+">"}))}e.EmbedPlaceholder=y,e.TagPlaceholder=v,e.ClassNamePlaceholder=m,e.convertPlaceholderHTML=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(!t)return"";var e=new RegExp('class\\s*=\\s*(?:"[^"]*\\b('+m.className+")\\b[^\"]*\"|'[^']*\\b("+m.className+")\\b[^']*')");return t.replace(b,(function(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(!i||i.toLowerCase()!==y.tagName||!e.test(o))return t;var n=w(o),r=decodeURIComponent(n[f[0]]);return x(r,{style:n.style,"data-size":n["data-size"]})}))}},function(t,e,i){"use strict";e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},n=h(i(5)),r=h(i(6)),s=h(i(7)),l=h(i(13)),a=h(i(14)),u=h(i(0));function h(t){return t&&t.__esModule?t:{default:t}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var d=(window.Quill||u.default).import("parchment"),f={DisplaySize:r.default,Toolbar:s.default,Resize:l.default,Keyboard:a.default},p=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(this,t),e.resizer=this,this.quill=e;var r=!1;i.modules&&(r=i.modules.slice()),this.options=o({},n.default,i),this.options.styles=o({},n.default.styles,i.styles),!1!==r&&(this.options.modules=r),document.execCommand("enableObjectResizing",!1,"false"),this.quill.root.addEventListener("mousedown",this.handleClick.bind(this),!1),this.quill.on("text-change",this.handleChange.bind(this)),this.quill.emitter.on("resize-edit",this.handleEdit.bind(this)),this.quill.root.parentNode.style.position=this.quill.root.parentNode.style.position||"relative",this.selectedBlots=[],this.options.selectedClass&&this.quill.on("selection-change",this.addBlotsSelectedClass.bind(this)),this.moduleClasses=this.options.modules,this.modules=[],this.options.keyboardSelect&&a.default.injectInit(this.quill)}return t.prototype.initializeModules=function(){var t=this;this.removeModules(),this.modules=this.moduleClasses.map((function(e){return new(f[e]||e)(t)})),this.modules.forEach((function(t){t.onCreate()})),this.onUpdate()},t.prototype.onUpdate=function(t){this.updateFromModule=t,this.repositionElements(),this.modules.forEach((function(t){t.onUpdate()}))},t.prototype.removeModules=function(){this.modules.forEach((function(t){t.onDestroy()})),this.modules=[]},t.prototype.handleEdit=function(){if(this.blot){var t=this.blot.offset(this.quill.scroll);this.hide(),this.quill.focus(),this.quill.setSelection(t,1)}},t.prototype.handleClick=function(t){var e=!1,i=void 0,o=t.target;o&&o.tagName&&(i=this.quill.constructor.find(o))&&(e=this.judgeShow(i,o)),e?t.preventDefault():this.activeEle&&this.hide()},t.prototype.judgeShow=function(t,e){var i=!1;if(!t)return i;!e&&t.domNode&&(e=t.domNode);var o=this.options.parchment[t.statics.blotName];if(!o)return i;if(this.activeEle===e)return!0;var n=o.limit||{};return(!n.minWidth||n.minWidth&&e.offsetWidth>=n.minWidth)&&(i=!0,this.activeEle&&this.hide(),this.activeEle=e,this.blot=t,this.show(e)),i},t.prototype.handleChange=function(t,e,i){this.updateFromModule?this.updateFromModule=!1:"user"===i&&this.overlay&&this.activeEle&&this.onUpdate()},t.prototype.show=function(){this.showOverlay(),this.initializeModules(),this.options.activeClass&&this.activeEle.classList.add(this.options.activeClass)},t.prototype.showOverlay=function(){var t=this;this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.setUserSelect("none"),this.overlay=document.createElement("div"),o(this.overlay.style,this.options.styles.overlay),this.overlay.addEventListener("dblclick",this.handleEdit.bind(this),!1),this.quill.root.parentNode.appendChild(this.overlay),this.hideProxy=function(e){t.activeEle&&t.hide()},this.quill.root.addEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy=this.updateOverlayPosition.bind(this),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy),this.repositionElements()},t.prototype.hideOverlay=function(){this.overlay&&(this.quill.root.parentNode.removeChild(this.overlay),this.overlay=void 0,document.removeEventListener("keydown",this.keyboardProxy,!0),this.quill.root.removeEventListener("input",this.hideProxy,!0),this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.setUserSelect(""))},t.prototype.repositionElements=function(){if(this.overlay&&this.activeEle){var t=this.quill.root.parentNode,e=this.activeEle.getBoundingClientRect(),i=t.getBoundingClientRect();o(this.overlay.style,{left:e.left-i.left-1+t.scrollLeft+"px",top:e.top-i.top+this.quill.root.scrollTop+"px",width:e.width+"px",height:e.height+"px",marginTop:-1*this.quill.root.scrollTop+"px"})}},t.prototype.updateOverlayPosition=function(){this.overlay.style.marginTop=-1*this.quill.root.scrollTop+"px"},t.prototype.addBlotsSelectedClass=function(t,e){var i=this;if(!t)return this.removeBlotsSelectedClass(),void(this.selectedBlots=[]);var o=this.quill.scroll.descendants(d.Leaf,t.index,t.length).filter((function(t){var e=!!i.options.parchment[t.statics.blotName];return e&&t.domNode.classList.add(i.options.selectedClass),e}));this.removeBlotsSelectedClass(o),this.selectedBlots=o},t.prototype.removeBlotsSelectedClass=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Array.isArray(e)||(e=[e]),this.selectedBlots.forEach((function(i){-1===e.indexOf(i)&&i.domNode.classList.remove(t.options.selectedClass)}))},t.prototype.hide=function(){this.hideOverlay(),this.removeModules(),this.activeEle&&this.options.activeClass&&this.activeEle.classList.remove(this.options.activeClass),this.activeEle=void 0,this.blot=void 0},t.prototype.setUserSelect=function(t){var e=this;["userSelect","mozUserSelect","webkitUserSelect","msUserSelect"].forEach((function(i){e.quill.root.style[i]=t,document.documentElement.style[i]=t}))},t}();e.default=p,window.Quill&&window.Quill.register("modules/resize",p)},function(t,e,i){"use strict";e.__esModule=!0,e.default={modules:["DisplaySize","Toolbar","Resize","Keyboard"],keyboardSelect:!0,selectedClass:"selected",activeClass:"active",parchment:{image:{attribute:["width"],limit:{minWidth:100}},"embed-placeholder":{attribute:["width","height"],limit:{minWidth:200,ratio:.5625}},video:{attribute:["width","height"],limit:{minWidth:200,ratio:.5625}}},styles:{overlay:{position:"absolute",boxSizing:"border-box",border:"1px dashed #444"},handle:{position:"absolute",height:"12px",width:"12px",backgroundColor:"white",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80"},display:{position:"absolute",padding:"4px 8px",textAlign:"center",backgroundColor:"white",color:"#333",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80",cursor:"default",lineHeight:"1"},toolbar:{position:"absolute",top:"-12px",right:"0",left:"0",height:"0",minWidth:"120px",textAlign:"center",color:"#333",boxSizing:"border-box",cursor:"default"},toolbarButton:{display:"inline-block",width:"24px",height:"24px",background:"white",border:"1px solid #999",verticalAlign:"middle"},toolbarButtonSvg:{}}}},function(t,e,i){"use strict";e.__esModule=!0;var o,n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},r=i(1);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=function(t){function e(){return s(this,e),l(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.onCreate=function(){this.display=document.createElement("div"),n(this.display.style,this.options.styles.display),this.overlay.appendChild(this.display)},e.prototype.onUpdate=function(){if(this.display&&this.activeEle){var t=this.getCurrentSize();if(this.display.innerHTML=t.join(" × "),t[0]>120&&t[1]>30)n(this.display.style,{right:"4px",bottom:"4px",left:"auto"});else if("right"===this.activeEle.style.float){var e=this.display.getBoundingClientRect();n(this.display.style,{right:"auto",bottom:"-"+(e.height+4)+"px",left:"-"+(e.width+4)+"px"})}else{var i=this.display.getBoundingClientRect();n(this.display.style,{right:"-"+(i.width+4)+"px",bottom:"-"+(i.height+4)+"px",left:"auto"})}}},e.prototype.getCurrentSize=function(){return[this.activeEle.offsetWidth,this.activeEle.offsetHeight]},e}(((o=r)&&o.__esModule?o:{default:o}).default);e.default=a},function(t,e,i){"use strict";e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},n=c(i(1)),r=c(i(8)),s=c(i(9)),l=c(i(10)),a=c(i(11)),u=c(i(12)),h=c(i(0));function c(t){return t&&t.__esModule?t:{default:t}}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var p=(window.Quill||h.default).import("parchment"),y=new(p.ClassAttributor?p.ClassAttributor:p.Attributor.Class)("imagestyle","ql-resize-style"),v=function(t){function e(){return d(this,e),f(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.onCreate=function(){this.toolbar=document.createElement("div"),o(this.toolbar.style,this.options.styles.toolbar),this.overlay.appendChild(this.toolbar),this._defineAlignments(),this._addToolbarButtons()},e.prototype._defineAlignments=function(){var t=this;this.alignments=[{icon:r.default,apply:function(){y.add(t.activeEle,"left")},isApplied:function(){return"left"===y.value(t.activeEle)}},{icon:s.default,apply:function(){y.add(t.activeEle,"center")},isApplied:function(){return"center"===y.value(t.activeEle)}},{icon:l.default,apply:function(){y.add(t.activeEle,"right")},isApplied:function(){return"right"===y.value(t.activeEle)}},{icon:a.default,apply:function(){y.add(t.activeEle,"full")},isApplied:function(){return"full"===y.value(t.activeEle)}}]},e.prototype._addToolbarButtons=function(){var t=this,e=[];this.alignments.forEach((function(i,n){var r=document.createElement("span");e.push(r),r.innerHTML=i.icon,r.addEventListener("click",(function(){e.forEach((function(t){return t.style.filter=""})),i.isApplied()?y.remove(t.activeEle):(t._selectButton(r),i.apply()),t.requestUpdate()})),o(r.style,t.options.styles.toolbarButton),n>0&&(r.style.borderLeftWidth="0"),o(r.children[0].style,t.options.styles.toolbarButtonSvg),i.isApplied()&&t._selectButton(r),t.toolbar.appendChild(r)}));var i=document.createElement("span");i.innerHTML=u.default,o(i.style,this.options.styles.toolbarButton),i.style.borderLeftWidth="0",i.addEventListener("click",(function(){t.quill.emitter.emit("resize-edit",t.activeEle,t.blot)})),this.toolbar.appendChild(i)},e.prototype._selectButton=function(t){t.style.filter="invert(20%)"},e}(n.default);e.default=v},function(t,e,i){"use strict";i.r(e),e.default='<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z"/>\n <path class="ql-fill" d="M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z"/>\n <path class="ql-fill" d="M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z"/>\n <path class="ql-fill" d="M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z"/>\n <rect class="ql-fill" x="2" y="6" width="8" height="6" rx="1" ry="1"/>\n</svg>'},function(t,e,i){"use strict";i.r(e),e.default='<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z"/>\n <path class="ql-fill" d="M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z"/>\n <rect class="ql-fill" x="3" y="6" width="12" height="6" rx="1" ry="1"/>\n</svg>'},function(t,e,i){"use strict";i.r(e),e.default='<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z"/>\n <path class="ql-fill" d="M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z"/>\n <path class="ql-fill" d="M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z"/>\n <path class="ql-fill" d="M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z"/>\n <rect class="ql-fill" x="8" y="6" width="8" height="6" rx="1" ry="1" transform="translate(24 18) rotate(-180)"/>\n</svg>'},function(t,e,i){"use strict";i.r(e),e.default='<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z"/>\n <path class="ql-fill" d="M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z"/>\n <rect class="ql-fill" x="2" y="6" width="14" height="6" rx="1" ry="1"/>\n</svg>'},function(t,e,i){"use strict";i.r(e),e.default='<svg viewBox="0 0 18 18">\n <path class="ql-fill" d="M 12.9 2 L 11.3 3.6 L 14.8 7 L 16.3 5.5 L 12.9 2 Z M 9.3 5.5 L 2 12.2 L 2 15.5 L 5.7 15.5 L 13 8.9 L 9.3 5.5 Z"></path>\n</svg>\n'},function(t,e,i){"use strict";e.__esModule=!0;var o,n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t},r=i(1);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=function(t){function e(){return s(this,e),l(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.onCreate=function(){this.boxes=[],this.addBox("nwse-resize"),this.addBox("nesw-resize"),this.addBox("nwse-resize"),this.addBox("nesw-resize"),this.positionBoxes()},e.prototype.onDestroy=function(){this.setCursor("")},e.prototype.positionBoxes=function(){var t=this,e=-parseFloat(this.options.styles.handle.width)/2+"px",i=-parseFloat(this.options.styles.handle.height)/2+"px";[{left:e,top:i},{right:e,top:i},{right:e,bottom:i},{left:e,bottom:i}].forEach((function(e,i){n(t.boxes[i].style,e)}))},e.prototype.addBox=function(t){var e=document.createElement("div");n(e.style,this.options.styles.handle),e.style.cursor=t,e.style.width=this.options.styles.handle.width+"px",e.style.height=this.options.styles.handle.height+"px",e.addEventListener("mousedown",this.handleMousedown.bind(this),!1),this.overlay.appendChild(e),this.boxes.push(e)},e.prototype.handleMousedown=function(t){var e=this;this.blot.handling&&this.blot.handling(!0),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(this.dragBox.style.cursor),this.handleDragProxy=function(t){return e.handleDrag(t)},this.handleMouseupProxy=function(t){return e.handleMouseup(t)},document.addEventListener("mousemove",this.handleDragProxy,!1),document.addEventListener("mouseup",this.handleMouseupProxy,!1)},e.prototype.handleMouseup=function(){this.setCursor(""),this.blot.handling&&this.blot.handling(!1),document.removeEventListener("mousemove",this.handleDragProxy),document.removeEventListener("mouseup",this.handleMouseupProxy)},e.prototype.handleDrag=function(t){var e=this;if(this.activeEle&&this.blot){var i=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,r=this.options.parchment[this.blot.statics.blotName],s={},l=1;(r.attribute||["width"]).forEach((function(t){s[t]=e.preDragSize[t]})),this.dragBox!==this.boxes[0]&&this.dragBox!==this.boxes[3]||(l=-1),s.width&&(s.width=Math.round(this.preDragSize.width+i*l)),s.height&&(s.height=Math.round(this.preDragSize.height+o*l)),n(this.activeEle.style,this.calcSize(s,r.limit)),this.requestUpdate()}},e.prototype.calcSize=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.width,o=t.height;if(e.ratio){var n=void 0;e.minWidth&&(i=Math.max(e.minWidth,i)),e.maxWidth&&(i=Math.min(e.maxWidth,i)),o=i*e.ratio,e.minHeight&&o<e.minHeight&&(n=!0,o=e.minHeight),e.maxHeight&&o>e.maxHeight&&(n=!0,o=e.maxHeight),n&&(i=o/e.ratio)}else t.width&&(e.minWidth&&(i=Math.max(e.minWidth,i)),e.maxWidth&&(i=Math.min(e.maxWidth,i))),t.height&&(e.minHeight&&(o=Math.max(e.minHeight,o)),e.maxHeight&&(o=Math.min(e.maxHeight,o)));return i&&(t.width=i+"px"),o&&(t.height=o+"px"),t},e.prototype.getNaturalSize=function(){var t=this.activeEle,e=[0,0];return t.getAttribute("data-size")?e=t.getAttribute("data-size").split(","):(e=[t.naturalWidth||t.offsetWidth,t.naturalHeight||t.offsetHeight],t.setAttribute("data-size",e[0]+","+e[1])),{width:parseInt(e[0]),height:parseInt(e[1])}},e.prototype.setCursor=function(t){[document.body,this.activeEle].forEach((function(e){e.style.cursor=t}))},e}(((o=r)&&o.__esModule?o:{default:o}).default);e.default=a},function(t,e,i){"use strict";e.__esModule=!0;var o,n=i(1);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var l=function(t){function e(){return r(this,e),s(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.injectInit=function(t){var e=t.keyboard.bindings;e[this.keys.LEFT].unshift(this.makeArrowHandler(this.keys.LEFT,!1)),e[this.keys.RIGHT].unshift(this.makeArrowHandler(this.keys.RIGHT,!1))},e.makeArrowHandler=function(t,i){var o,n=t===e.keys.LEFT?"prefix":"suffix";return(o={key:t,shiftKey:i,altKey:null})[n]=/^$/,o.handler=function(i){if(!this.quill.resizer)return!0;var o=i.index,n=this.quill.getLine(i.index)[0],r=this.quill.getIndex(n);if(t===e.keys.RIGHT&&r+n.length()-1===o)return!0;t===e.keys.RIGHT&&(o+=i.length+1);var s=this.quill.getLeaf(o)[0],l=s.offset(s.parent);return t===e.keys.LEFT&&(0===o||o===r)||(t===e.keys.LEFT&&0===l&&(o-=1,s=this.quill.getLeaf(o)[0]),!this.quill.resizer.judgeShow(s))},o},e.prototype.onCreate=function(t){var e=this;this.keyboardProxy=function(t){return e.keyboardHandle(t)},document.addEventListener("keydown",this.keyboardProxy,!0)},e.prototype.onDestroy=function(){document.removeEventListener("keydown",this.keyboardProxy,!0)},e.prototype.keyboardHandle=function(t){if(!t.defaultPrevented&&!(t.shiftKey||t.ctrlKey||t.altKey)&&this.activeEle&&!t.fromResize&&!t.ctrlKey){var i=t.keyCode,o=this.blot.offset(this.quill.scroll),n=void 0,r=!1;i===e.keys.BACKSPACE||i===e.keys.DELETE?(this.quill.constructor.find(this.activeEle).deleteAt(0),r=!0):i>=e.keys.LEFT&&i<=e.keys.DOWN&&(i===e.keys.RIGHT?o++:i===e.keys.UP?(o=this.getOtherLineIndex(-1),n=this.quill.getLeaf(o)[0]):i===e.keys.DOWN&&(o=this.getOtherLineIndex(1),n=this.quill.getLeaf(o)[0]),r=!0),r&&(t.stopPropagation(),t.preventDefault()),n&&this.resizer.judgeShow(n,n.domNode)||(this.quill.setSelection(o),this.resizer.hide())}},e.prototype.getOtherLineIndex=function(t){var e=this.blot.offset(this.quill.scroll),i=this.quill.getLine(e)[0],o=this.blot.offset(i)+1,n=t>0?i.next:i.prev;if(n){var r=n.length();"block"===n.statics.blotName&&r--,e=n.offset(this.quill.scroll)+Math.min(r,o)}return e},e.prototype.dispatchEvent=function(t){var e=new t.constructor(t);e.fromResize=!0,this.quill.root.dispatchEvent(e)},e}(((o=n)&&o.__esModule?o:{default:o}).default);e.default=l,l.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}},function(t,e,i){"use strict";e.__esModule=!0,e.ATTRIBUTES=e.Image=void 0;var o,n=i(0),r=(o=n)&&o.__esModule?o:{default:o};function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=window.Quill||r.default,u=["alt","height","width","style","data-size"],h=function(t){function e(){return s(this,e),l(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.formats=function(t){return t.__handling&&t.__formats?t.__formats:u.reduce((function(e,i){return t.hasAttribute(i)&&(e[i]=t.getAttribute(i)),e}),{})},e.prototype.format=function(e,i){u.indexOf(e)>-1?i?this.domNode.setAttribute(e,i):this.domNode.removeAttribute(e):t.prototype.format.call(this,e,i)},e.prototype.handling=function(t){this.domNode.__formats=this.constructor.formats(this.domNode),this.domNode.__handling=t},e}(a.import("formats/image"));e.Image=h,e.ATTRIBUTES=u},function(t,e){}])}));
|
|
5
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("Quill")):"function"==typeof define&&define.amd?define(["Quill"],e):"object"==typeof exports?exports.QuillResize=e(require("Quill")):t.QuillResize=e(t.Quill)}(self,(t=>(()=>{"use strict";var e=[,e=>{e.exports=t}],i={};function o(t){var n=i[t];if(void 0!==n)return n.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};o.r(n),o.d(n,{default:()=>ut});const r={modules:["DisplaySize","Toolbar","Resize","Keyboard"],keyboardSelect:!0,selectedClass:"selected",activeClass:"active",embedTags:["VIDEO","IFRAME"],parchment:{image:{attribute:["width"],limit:{minWidth:100}},video:{attribute:["width","height"],limit:{minWidth:200,ratio:.5625}}},styles:{overlay:{position:"absolute",boxSizing:"border-box",border:"1px dashed #444",pointerEvents:"none"},handle:{position:"absolute",height:"12px",width:"12px",backgroundColor:"white",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80",pointerEvents:"all"},display:{position:"absolute",padding:"4px 8px",textAlign:"center",backgroundColor:"white",color:"#333",border:"1px solid #777",boxSizing:"border-box",opacity:"0.80",cursor:"default",lineHeight:"1"},toolbar:{position:"absolute",top:"-12px",right:"0",left:"0",height:"0",minWidth:"120px",textAlign:"center",color:"#333",boxSizing:"border-box",cursor:"default",pointerEvents:"all"},toolbarButton:{display:"inline-block",width:"24px",height:"24px",background:"white",border:"1px solid #999",verticalAlign:"middle"},toolbarButtonSvg:{}}};function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function s(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,a(o.key),o)}}function a(t){var e=function(t,e){if("object"!=l(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=l(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==l(e)?e:e+""}var u=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.resizer=e,this.quill=e.quill,this.overlay=e.overlay,this.activeEle=e.activeEle,this.blot=e.blot,this.options=e.options,this.requestUpdate=function(){e.onUpdate(!0)}},(e=[{key:"onCreate",value:function(){}},{key:"onDestroy",value:function(){}},{key:"onUpdate",value:function(){}}])&&s(t.prototype,e),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function h(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,f(o.key),o)}}function f(t){var e=function(t,e){if("object"!=c(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=c(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==c(e)?e:e+""}function d(t,e,i){return e=y(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,i||[],y(t).constructor):e.apply(t,i))}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}var v=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),d(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}(e,t),i=e,(o=[{key:"onCreate",value:function(){this.display=document.createElement("div"),Object.assign(this.display.style,this.options.styles.display),this.overlay.appendChild(this.display)}},{key:"onUpdate",value:function(){if(this.display&&this.activeEle){var t=this.getCurrentSize();if(this.display.innerHTML=t.join(" × "),t[0]>120&&t[1]>30)Object.assign(this.display.style,{right:"4px",bottom:"4px",left:"auto"});else if("right"===this.activeEle.style.float){var e=this.display.getBoundingClientRect();Object.assign(this.display.style,{right:"auto",bottom:"-".concat(e.height+4,"px"),left:"-".concat(e.width+4,"px")})}else{var i=this.display.getBoundingClientRect();Object.assign(this.display.style,{right:"-".concat(i.width+4,"px"),bottom:"-".concat(i.height+4,"px"),left:"auto"})}}}},{key:"getCurrentSize",value:function(){return[this.activeEle.offsetWidth,this.activeEle.offsetHeight]}}])&&h(i.prototype,o),n&&h(i,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,o,n}(u);var m=o(1),g=o.n(m);function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function E(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,O(o.key),o)}}function O(t){var e=function(t,e){if("object"!=w(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=w(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==w(e)?e:e+""}function x(t,e,i){return e=S(e),function(t,e){if(e&&("object"==w(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,j()?Reflect.construct(e,i||[],S(t).constructor):e.apply(t,i))}function j(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(j=function(){return!!t})()}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}function P(t,e){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},P(t,e)}var k=(window.Quill||g()).import("parchment"),C=new(k.ClassAttributor?k.ClassAttributor:k.Attributor.Class)("imagestyle","ql-resize-style"),q=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),x(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&P(t,e)}(e,t),i=e,(o=[{key:"onCreate",value:function(){this.toolbar=document.createElement("div"),Object.assign(this.toolbar.style,this.options.styles.toolbar),this.overlay.appendChild(this.toolbar),this._defineAlignments(),this._addToolbarButtons()}},{key:"_defineAlignments",value:function(){var t=this;this.alignments=[{icon:'<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z"/>\n <path class="ql-fill" d="M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z"/>\n <path class="ql-fill" d="M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z"/>\n <path class="ql-fill" d="M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z"/>\n <rect class="ql-fill" x="2" y="6" width="8" height="6" rx="1" ry="1"/>\n</svg>',apply:function(){C.add(t.activeEle,"left")},isApplied:function(){return"left"===C.value(t.activeEle)}},{icon:'<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z"/>\n <path class="ql-fill" d="M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z"/>\n <rect class="ql-fill" x="3" y="6" width="12" height="6" rx="1" ry="1"/>\n</svg>',apply:function(){C.add(t.activeEle,"center")},isApplied:function(){return"center"===C.value(t.activeEle)}},{icon:'<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z"/>\n <path class="ql-fill" d="M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z"/>\n <path class="ql-fill" d="M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z"/>\n <path class="ql-fill" d="M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z"/>\n <rect class="ql-fill" x="8" y="6" width="8" height="6" rx="1" ry="1" transform="translate(24 18) rotate(-180)"/>\n</svg>',apply:function(){C.add(t.activeEle,"right")},isApplied:function(){return"right"===C.value(t.activeEle)}},{icon:'<svg viewbox="0 0 18 18">\n <path class="ql-fill" d="M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z"/>\n <path class="ql-fill" d="M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z"/>\n <rect class="ql-fill" x="2" y="6" width="14" height="6" rx="1" ry="1"/>\n</svg>',apply:function(){C.add(t.activeEle,"full")},isApplied:function(){return"full"===C.value(t.activeEle)}}]}},{key:"_addToolbarButtons",value:function(){var t=this,e=[];this.alignments.forEach((function(i,o){var n=document.createElement("span");e.push(n),n.innerHTML=i.icon,n.addEventListener("click",(function(){e.forEach((function(t){return t.style.filter=""})),i.isApplied()?C.remove(t.activeEle):(t._selectButton(n),i.apply()),t.requestUpdate()})),Object.assign(n.style,t.options.styles.toolbarButton),o>0&&(n.style.borderLeftWidth="0"),Object.assign(n.children[0].style,t.options.styles.toolbarButtonSvg),i.isApplied()&&t._selectButton(n),t.toolbar.appendChild(n)}));var i=document.createElement("span");i.innerHTML='<svg viewBox="0 0 18 18">\n <path class="ql-fill" d="M 12.9 2 L 11.3 3.6 L 14.8 7 L 16.3 5.5 L 12.9 2 Z M 9.3 5.5 L 2 12.2 L 2 15.5 L 5.7 15.5 L 13 8.9 L 9.3 5.5 Z"></path>\n</svg>\n',Object.assign(i.style,this.options.styles.toolbarButton),i.style.borderLeftWidth="0",i.addEventListener("click",(function(){t.quill.emitter.emit("resize-edit",t.activeEle,t.blot)})),this.toolbar.appendChild(i)}},{key:"_selectButton",value:function(t){t.style.filter="invert(20%)"}}])&&E(i.prototype,o),n&&E(i,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,o,n}(u);function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function T(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}function L(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?T(Object(i),!0).forEach((function(e){B(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):T(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function B(t,e,i){return(e=z(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function M(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,z(o.key),o)}}function z(t){var e=function(t,e){if("object"!=A(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=A(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==A(e)?e:e+""}function H(t,e,i){return e=D(e),function(t,e){if(e&&("object"==A(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,_()?Reflect.construct(e,i||[],D(t).constructor):e.apply(t,i))}function _(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_=function(){return!!t})()}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},D(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}var N=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),H(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R(t,e)}(e,t),i=e,o=[{key:"onCreate",value:function(){this.blotOptions=this.options.parchment[this.blot.statics.blotName],this.boxes=[],this.addBox("nwse-resize"),this.addBox("nesw-resize"),this.addBox("nwse-resize"),this.addBox("nesw-resize"),this.positionBoxes()}},{key:"onDestroy",value:function(){this.setCursor("")}},{key:"positionBoxes",value:function(){var t=this,e="".concat(-parseFloat(this.options.styles.handle.width)/2,"px"),i="".concat(-parseFloat(this.options.styles.handle.height)/2,"px");[{left:e,top:i},{right:e,top:i},{right:e,bottom:i},{left:e,bottom:i}].forEach((function(e,i){Object.assign(t.boxes[i].style,e)}))}},{key:"addBox",value:function(t){var e=document.createElement("div");Object.assign(e.style,this.options.styles.handle),e.style.cursor=t,e.style.width="".concat(this.options.styles.handle.width,"px"),e.style.height="".concat(this.options.styles.handle.height,"px"),e.addEventListener("mousedown",this.handleMousedown.bind(this),!1),this.overlay.appendChild(e),this.boxes.push(e)}},{key:"handleMousedown",value:function(t){var e=this;this.blot.handling&&this.blot.handling(!0),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(this.dragBox.style.cursor),this.handleDragProxy=function(t){return e.handleDrag(t)},this.handleMouseupProxy=function(t){return e.handleMouseup(t)},document.addEventListener("mousemove",this.handleDragProxy,!1),document.addEventListener("mouseup",this.handleMouseupProxy,!1)}},{key:"handleMouseup",value:function(t){var e=this.calcSize(t,this.blotOptions.limit);Object.assign(this.activeEle,e),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.blot.handling&&this.blot.handling(!1),document.removeEventListener("mousemove",this.handleDragProxy),document.removeEventListener("mouseup",this.handleMouseupProxy)}},{key:"handleDrag",value:function(t){if(this.activeEle&&this.blot){var e=L(L({},this.blotOptions.limit),{},{unit:!0});Object.assign(this.activeEle.style,this.calcSize(t,e)),this.requestUpdate()}}},{key:"calcSize",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=t.clientX-this.dragStartX,n=t.clientY-this.dragStartY,r={},l=1;(this.blotOptions.attribute||["width"]).forEach((function(t){r[t]=e.preDragSize[t]})),this.dragBox!==this.boxes[0]&&this.dragBox!==this.boxes[3]||(l=-1),r.width&&(r.width=Math.round(this.preDragSize.width+o*l)),r.height&&(r.height=Math.round(this.preDragSize.height+n*l));var s,a=r.width,u=r.height;i.ratio?(i.minWidth&&(a=Math.max(i.minWidth,a)),i.maxWidth&&(a=Math.min(i.maxWidth,a)),u=a*i.ratio,i.minHeight&&u<i.minHeight&&(s=!0,u=i.minHeight),i.maxHeight&&u>i.maxHeight&&(s=!0,u=i.maxHeight),s&&(a=u/i.ratio)):(r.width&&(i.minWidth&&(a=Math.max(i.minWidth,a)),i.maxWidth&&(a=Math.min(i.maxWidth,a))),r.height&&(i.minHeight&&(u=Math.max(i.minHeight,u)),i.maxHeight&&(u=Math.min(i.maxHeight,u)))),i.unit&&(a&&(a+="px"),u&&(u+="px"));var c={};return a&&(c.width=a),u&&(c.height=u),c}},{key:"getNaturalSize",value:function(){var t=this.activeEle,e=[0,0];return t.getAttribute("data-size")?e=t.getAttribute("data-size").split(","):(e=[t.naturalWidth||t.offsetWidth,t.naturalHeight||t.offsetHeight],t.setAttribute("data-size",e[0]+","+e[1])),{width:parseInt(e[0]),height:parseInt(e[1])}}},{key:"setCursor",value:function(t){[document.body,this.activeEle].forEach((function(e){e.style.cursor=t}))}}],o&&M(i.prototype,o),n&&M(i,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,o,n}(u);function W(t){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(t)}function U(t,e,i){return(e=K(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var o,n,r,l,s=[],a=!0,u=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;a=!1}else for(;!(a=(o=r.call(i)).done)&&(s.push(o.value),s.length!==e);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=i.return&&(l=i.return(),Object(l)!==l))return}finally{if(u)throw n}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return F(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?F(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,o=Array(e);i<e;i++)o[i]=t[i];return o}function Z(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,K(o.key),o)}}function K(t){var e=function(t,e){if("object"!=W(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=W(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==W(e)?e:e+""}function Q(t,e,i){return e=X(e),function(t,e){if(e&&("object"==W(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,G()?Reflect.construct(e,i||[],X(t).constructor):e.apply(t,i))}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(G=function(){return!!t})()}function X(t){return X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},X(t)}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}var V=window.Quill||g(),$=V.import("parchment"),J={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},tt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Q(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(e,t),i=e,n=[{key:"injectInit",value:function(t){var e=t.keyboard.bindings;e[this.keys.LEFT].unshift(this.makeArrowHandler(this.keys.LEFT,!1)),e[this.keys.RIGHT].unshift(this.makeArrowHandler(this.keys.RIGHT,!1))}},{key:"makeArrowHandler",value:function(t,i){var o=t===e.keys.LEFT?"prefix":"suffix";return U(U({key:t,shiftKey:i,altKey:null},o,/^$/),"handler",(function(i){if(!this.quill.resizer)return!0;var o=i.index,n=t===e.keys.LEFT,r=t===e.keys.RIGHT,l=I(this.quill.getLine(o+(n?-1:0)),1)[0];if(this.quill.resizer.judgeShow(l))return!1;var s=this.quill.getIndex(l);if(r&&s+l.length()-1===o)return!0;r&&(o+=i.length+1);var a=I(this.quill.getLeaf(o),1)[0],u=a.offset(a.parent),c=a.constructor.scope===$.Scope.BLOCK_BLOT;return!(!n||!(c&&o===u||0===o||o===s))||(n&&0===u&&(o-=1,a=this.quill.getLeaf(o)[0]),!this.quill.resizer.judgeShow(a))}))}}],(o=[{key:"onCreate",value:function(t){var e=this;this.keyboardProxy=function(t){return e.keyboardHandle(t)},document.addEventListener("keydown",this.keyboardProxy,!0)}},{key:"onDestroy",value:function(){document.removeEventListener("keydown",this.keyboardProxy,!0)}},{key:"keyboardHandle",value:function(t){if(!t.defaultPrevented&&!(t.shiftKey||t.ctrlKey||t.altKey)&&this.activeEle&&!t.fromResize&&!t.ctrlKey){var e,i=t.keyCode,o=this.blot.offset(this.quill.scroll),n=!1;i===J.BACKSPACE||i===J.DELETE?(this.blot.deleteAt(0),this.blot.parent.optimize(),n=!0):i>=J.LEFT&&i<=J.DOWN&&(i===J.RIGHT?o+=this.blot.length()||1:i===J.UP?(o=this.getOtherLineIndex(-1),e=this.quill.getLeaf(o)[0]):i===J.DOWN&&(o=this.getOtherLineIndex(1),e=this.quill.getLeaf(o)[0]),n=!0),n&&(t.stopPropagation(),t.preventDefault()),e&&this.resizer.judgeShow(e,e.domNode)||(this.quill.setSelection(o),this.resizer.hide())}}},{key:"getOtherLineIndex",value:function(t){var e=this.blot.offset(this.quill.scroll),i=I(this.quill.getLine(e),1)[0],o=this.blot.offset(i)+1,n=t>0?i.next:i.prev;if(n){var r=n.length();"block"===n.statics.blotName&&r--,e=n.offset(this.quill.scroll)+Math.min(r,o)}return e}},{key:"dispatchEvent",value:function(t){var e=new t.constructor(t);e.fromResize=!0,this.quill.root.dispatchEvent(e)}}])&&Z(i.prototype,o),n&&Z(i,n),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,o,n}(u);function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function it(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,ot(o.key),o)}}function ot(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,e||"default");if("object"!=et(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==et(e)?e:e+""}/^2\./.test(V.version)?tt.keys={BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",DELETE:"Delete"}:tt.keys=J;var nt,rt,lt,st=(window.Quill||g()).import("parchment"),at=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e.resizer=this,this.quill=e;var o=!1;i.modules&&(o=i.modules.slice()),this.options=Object.assign({},r,i),this.options.styles=Object.assign({},r.styles,i.styles),!1!==o&&(this.options.modules=o),document.execCommand("enableObjectResizing",!1,"false"),this.quill.root.addEventListener("mousedown",this.handleClick.bind(this),!1),this.quill.on("text-change",this.handleChange.bind(this)),this.quill.emitter.on("resize-edit",this.handleEdit.bind(this)),this.quill.container.style.position=this.quill.container.style.position||"relative",this.selectedBlots=[],this.options.selectedClass&&this.quill.on("selection-change",this.addBlotsSelectedClass.bind(this)),this.moduleClasses=this.options.modules,this.modules=[],this.options.keyboardSelect&&tt.injectInit(this.quill),this.options.embedTags&&this.initializeEmbed()},e=[{key:"initializeModules",value:function(){var t=this;this.removeModules(),this.modules=this.moduleClasses.map((function(e){return new(t.constructor.Modules[e]||e)(t)})),this.modules.forEach((function(e){e.onCreate(t)})),this.onUpdate()}},{key:"initializeEmbed",value:function(){if(this.options.embedTags.length){this.embedClassName="ql-".concat(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";return Array.from({length:t},(function(){return e[Math.floor(62*Math.random())]})).join("")}());var t=[""].concat(this.options.embedTags).join(", .".concat(this.embedClassName," ")).slice(2);t+="{pointer-events: none;}";var e=document.createElement("style");e.textContent=t,this.quill.container.appendChild(e),this.quill.root.classList.add(this.embedClassName)}}},{key:"onUpdate",value:function(t){this.updateFromModule=t,this.repositionElements(),this.modules.forEach((function(t){t.onUpdate()}))}},{key:"removeModules",value:function(){this.modules.forEach((function(t){t.onDestroy()})),this.modules=[]}},{key:"handleEdit",value:function(){if(this.blot){var t=this.blot.offset(this.quill.scroll);this.hide(),this.quill.focus(),this.quill.setSelection(t,1)}}},{key:"handleClick",value:function(t){var e,i=!1,o=t.target;if(o===this.quill.root&&this.options.embedTags){var n=this.quill.root;n.classList.remove(this.embedClassName),o=document.elementFromPoint(t.clientX,t.clientY),n.classList.add(this.embedClassName)}o&&o.tagName&&(e=this.quill.constructor.find(o))&&(i=this.judgeShow(e,o)),i?t.preventDefault():this.activeEle&&this.hide()}},{key:"judgeShow",value:function(t,e){var i=!1;if(!t)return i;!e&&t.domNode&&(e=t.domNode);var o=this.options.parchment[t.statics.blotName];if(!o)return i;if(this.activeEle===e)return!0;var n=o.limit||{};return(!n.minWidth||n.minWidth&&e.offsetWidth>=n.minWidth)&&(i=!0,this.activeEle&&this.hide(),this.activeEle=e,this.blot=t,this.show(e)),i}},{key:"handleChange",value:function(t,e,i){this.updateFromModule?this.updateFromModule=!1:"user"===i&&this.overlay&&this.activeEle&&this.onUpdate()}},{key:"show",value:function(){this.showOverlay(),this.initializeModules(),this.options.activeClass&&this.activeEle.classList.add(this.options.activeClass)}},{key:"showOverlay",value:function(){var t=this;this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.setUserSelect("none"),this.overlay=document.createElement("div"),Object.assign(this.overlay.style,this.options.styles.overlay),this.overlay.addEventListener("dblclick",this.handleEdit.bind(this),!1),this.quill.container.appendChild(this.overlay),this.hideProxy=function(e){t.activeEle&&t.hide()},this.quill.root.addEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy=this.updateOverlayPosition.bind(this),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy),this.repositionElements()}},{key:"hideOverlay",value:function(){this.overlay&&(this.quill.container.removeChild(this.overlay),this.overlay=void 0,this.quill.root.removeEventListener("input",this.hideProxy,!0),this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.setUserSelect(""))}},{key:"repositionElements",value:function(){if(this.overlay&&this.activeEle){var t=this.quill.container,e=this.activeEle.getBoundingClientRect(),i=t.getBoundingClientRect();Object.assign(this.overlay.style,{left:"".concat(e.left-i.left-1+t.scrollLeft,"px"),top:"".concat(e.top-i.top+this.quill.root.scrollTop,"px"),width:"".concat(e.width,"px"),height:"".concat(e.height,"px"),marginTop:-1*this.quill.root.scrollTop+"px"})}}},{key:"updateOverlayPosition",value:function(){this.overlay.style.marginTop=-1*this.quill.root.scrollTop+"px"}},{key:"addBlotsSelectedClass",value:function(t,e){var i=this;if(!t)return this.removeBlotsSelectedClass(),void(this.selectedBlots=[]);var o=this.quill.scroll.descendants(st.Leaf||st.LeafBlot,t.index,t.length).filter((function(t){var e=!!i.options.parchment[t.statics.blotName];return e&&t.domNode.classList.add(i.options.selectedClass),e}));this.removeBlotsSelectedClass(o),this.selectedBlots=o}},{key:"removeBlotsSelectedClass",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Array.isArray(e)||(e=[e]),this.selectedBlots.forEach((function(i){-1===e.indexOf(i)&&i.domNode.classList.remove(t.options.selectedClass)}))}},{key:"hide",value:function(){this.hideOverlay(),this.removeModules(),this.activeEle&&this.options.activeClass&&this.activeEle.classList.remove(this.options.activeClass),this.activeEle=void 0,this.blot=void 0}},{key:"setUserSelect",value:function(t){var e=this;["userSelect","mozUserSelect","webkitUserSelect","msUserSelect"].forEach((function(i){e.quill.root.style[i]=t,document.documentElement.style[i]=t}))}}],e&&it(t.prototype,e),i&&it(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();nt=at,lt={Base:u,DisplaySize:v,Toolbar:q,Resize:N,Keyboard:tt},(rt=ot(rt="Modules"))in nt?Object.defineProperty(nt,rt,{value:lt,enumerable:!0,configurable:!0,writable:!0}):nt[rt]=lt,window.Quill&&window.Quill.register("modules/resize",at);const ut=at;return n})()));
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quill-resize-module",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A module for Quill rich text editor to allow images/iframe/video and custom elements(covert to placeholder) to be resized.",
|
|
5
5
|
"main": "dist/resize.js",
|
|
6
6
|
"module": "src/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
8
|
+
"dev": "webpack serve",
|
|
9
|
+
"serve": "webpack serve",
|
|
10
|
+
"watch": "webpack --watch",
|
|
11
|
+
"build": "webpack --mode=production --node-env=production",
|
|
12
|
+
"build:dev": "webpack --mode=development",
|
|
13
|
+
"build:prod": "webpack --mode=production --node-env=production"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -43,30 +43,27 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/mudoo/quill-resize-module#readme",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"babel
|
|
47
|
-
"babel-
|
|
48
|
-
"babel-
|
|
46
|
+
"@babel/core": "^7.26.0",
|
|
47
|
+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
48
|
+
"@babel/preset-env": "^7.26.0",
|
|
49
|
+
"@webpack-cli/generators": "^3.0.7",
|
|
50
|
+
"babel-loader": "^9.2.1",
|
|
49
51
|
"babel-plugin-transform-object-assign": "^6.22.0",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"eslint": "^
|
|
53
|
-
"eslint-
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"eslint-plugin-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"webpack": "^
|
|
66
|
-
"webpack-cli": "^3.3.11",
|
|
67
|
-
"webpack-dev-server": "^3.10.3"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"extend": "^3.0.2"
|
|
52
|
+
"css-loader": "^7.1.2",
|
|
53
|
+
"eslint": "^8.57.1",
|
|
54
|
+
"eslint-config-standard": "^17.1.0",
|
|
55
|
+
"eslint-plugin-import": "^2.31.0",
|
|
56
|
+
"eslint-plugin-n": "^17.15.0",
|
|
57
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
58
|
+
"html-webpack-plugin": "^5.6.3",
|
|
59
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
60
|
+
"prettier": "^3.4.1",
|
|
61
|
+
"quill": "^1.0.0",
|
|
62
|
+
"sass": "^1.81.1",
|
|
63
|
+
"sass-loader": "^16.0.3",
|
|
64
|
+
"style-loader": "^4.0.0",
|
|
65
|
+
"webpack": "^5.96.1",
|
|
66
|
+
"webpack-cli": "^5.1.4",
|
|
67
|
+
"webpack-dev-server": "^5.1.0"
|
|
71
68
|
}
|
|
72
69
|
}
|
package/src/DefaultOptions.js
CHANGED
|
@@ -3,6 +3,7 @@ export default {
|
|
|
3
3
|
keyboardSelect: true,
|
|
4
4
|
selectedClass: 'selected',
|
|
5
5
|
activeClass: 'active',
|
|
6
|
+
embedTags: ['VIDEO', 'IFRAME'],
|
|
6
7
|
|
|
7
8
|
parchment: {
|
|
8
9
|
image: {
|
|
@@ -11,13 +12,6 @@ export default {
|
|
|
11
12
|
minWidth: 100
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
|
-
'embed-placeholder': {
|
|
15
|
-
attribute: ['width', 'height'],
|
|
16
|
-
limit: {
|
|
17
|
-
minWidth: 200,
|
|
18
|
-
ratio: 0.5625
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
15
|
video: {
|
|
22
16
|
attribute: ['width', 'height'],
|
|
23
17
|
limit: {
|
|
@@ -31,7 +25,8 @@ export default {
|
|
|
31
25
|
overlay: {
|
|
32
26
|
position: 'absolute',
|
|
33
27
|
boxSizing: 'border-box',
|
|
34
|
-
border: '1px dashed #444'
|
|
28
|
+
border: '1px dashed #444',
|
|
29
|
+
pointerEvents: 'none'
|
|
35
30
|
},
|
|
36
31
|
handle: {
|
|
37
32
|
position: 'absolute',
|
|
@@ -40,7 +35,8 @@ export default {
|
|
|
40
35
|
backgroundColor: 'white',
|
|
41
36
|
border: '1px solid #777',
|
|
42
37
|
boxSizing: 'border-box',
|
|
43
|
-
opacity: '0.80'
|
|
38
|
+
opacity: '0.80',
|
|
39
|
+
pointerEvents: 'all'
|
|
44
40
|
},
|
|
45
41
|
display: {
|
|
46
42
|
position: 'absolute',
|
|
@@ -64,7 +60,8 @@ export default {
|
|
|
64
60
|
textAlign: 'center',
|
|
65
61
|
color: '#333',
|
|
66
62
|
boxSizing: 'border-box',
|
|
67
|
-
cursor: 'default'
|
|
63
|
+
cursor: 'default',
|
|
64
|
+
pointerEvents: 'all'
|
|
68
65
|
},
|
|
69
66
|
toolbarButton: {
|
|
70
67
|
display: 'inline-block',
|