Version Description
Download this release
Release Info
Developer | azaozz |
Plugin | TinyMCE Advanced |
Version | 5.2 |
Comparing to | |
See all releases |
Code changes from version 5.1.0 to 5.2
- css/block-editor.css +0 -358
- css/tadv-styles.css +408 -79
- css/tma-block-editor.css +209 -0
- dist/classic-paragraph.css +1 -1
- dist/classic-paragraph.js +1 -1
- dist/richtext-buttons.css +1 -1
- dist/richtext-buttons.js +1 -1
- images/toolbar-left-rtl.png +0 -0
- images/toolbar-left.png +0 -0
- images/toolbar-right.png +0 -0
- js/tadv.js +24 -41
- mce/advlist/plugin.js +137 -137
- mce/anchor/plugin.js +102 -102
- mce/code/plugin.js +80 -80
- mce/contextmenu/plugin.js +144 -144
- mce/importcss/plugin.js +260 -230
- mce/importcss/plugin.min.js +1 -1
- mce/insertdatetime/plugin.js +152 -152
- mce/link/plugin.js +646 -646
- mce/nonbreaking/plugin.js +69 -69
- mce/print/plugin.js +28 -28
- mce/searchreplace/plugin.js +537 -535
- mce/searchreplace/plugin.min.js +1 -1
- mce/table/plugin.js +9789 -8911
- mce/table/plugin.min.js +0 -1
css/block-editor.css
DELETED
@@ -1,358 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
-
* For more information please see tinymce-advanced.php.
|
4 |
-
*
|
5 |
-
* Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
|
6 |
-
*/
|
7 |
-
|
8 |
-
/* Fixes for the Block Editor */
|
9 |
-
.block-library-classic__toolbar:empty {
|
10 |
-
height: 40px;
|
11 |
-
}
|
12 |
-
|
13 |
-
.block-library-classic__toolbar:empty::before {
|
14 |
-
padding: 0 14px;
|
15 |
-
vertical-align: text-bottom;
|
16 |
-
}
|
17 |
-
|
18 |
-
.editor-block-list__layout .editor-block-list__block[data-type="core/freeform"] .editor-block-list__block-edit::before {
|
19 |
-
outline: none;
|
20 |
-
}
|
21 |
-
|
22 |
-
.editor-block-list__block[data-type="core/freeform"] > .editor-block-list__insertion-point {
|
23 |
-
z-index: 11;
|
24 |
-
}
|
25 |
-
|
26 |
-
.editor-block-list__block[data-type="core/freeform"] .editor-block-list__insertion-point-inserter .editor-inserter__toggle {
|
27 |
-
width: 20px;
|
28 |
-
height: 20px;
|
29 |
-
padding: 0;
|
30 |
-
margin-top: 5px;
|
31 |
-
}
|
32 |
-
|
33 |
-
.block-library-classic__toolbar .mce-menubar {
|
34 |
-
min-height: 38px;
|
35 |
-
}
|
36 |
-
|
37 |
-
.block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-container-body .mce-toolbar {
|
38 |
-
padding: 0;
|
39 |
-
}
|
40 |
-
|
41 |
-
.block-library-classic__toolbar .mce-btn .mce-txt {
|
42 |
-
font-size: 14px;
|
43 |
-
}
|
44 |
-
|
45 |
-
@media (min-width: 600px) {
|
46 |
-
.block-library-classic__toolbar .mce-menubar > .mce-container-body {
|
47 |
-
padding-top: 6px;
|
48 |
-
padding-right: 36px;
|
49 |
-
white-space: normal;
|
50 |
-
width: auto !important;
|
51 |
-
}
|
52 |
-
|
53 |
-
.rtl .block-library-classic__toolbar .mce-menubar > .mce-container-body {
|
54 |
-
padding-right: 0;
|
55 |
-
padding-left: 36px;
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
.block-library-classic__toolbar .mce-menubar i.mce-caret {
|
60 |
-
margin-top: 0.4em;
|
61 |
-
}
|
62 |
-
|
63 |
-
/* Classic Block styling regressions fixes */
|
64 |
-
.wp-block-freeform.block-library-rich-text__tinymce {
|
65 |
-
padding: 6px; /* For wpview outlines and image resize handles. */
|
66 |
-
}
|
67 |
-
|
68 |
-
/* Remove blue highlighting of selected images in WebKit */
|
69 |
-
.wp-block-freeform.block-library-rich-text__tinymce img[data-mce-selected]::selection {
|
70 |
-
background-color: transparent;
|
71 |
-
}
|
72 |
-
/* Image resize handles */
|
73 |
-
.wp-block-freeform.block-library-rich-text__tinymce .mce-content-body div.mce-resizehandle {
|
74 |
-
border-color: #191e23;
|
75 |
-
width: 6px;
|
76 |
-
height: 6px;
|
77 |
-
}
|
78 |
-
|
79 |
-
.wp-block-freeform.block-library-rich-text__tinymce .mce-content-body img[data-mce-selected] {
|
80 |
-
outline: 1px solid #191e23;
|
81 |
-
}
|
82 |
-
|
83 |
-
.wp-block-freeform.block-library-rich-text__tinymce .mce-content-body img[data-mce-resize="false"] {
|
84 |
-
outline: 0;
|
85 |
-
}
|
86 |
-
|
87 |
-
/* Image captions */
|
88 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wp-caption {
|
89 |
-
margin: 0; /* browser reset */
|
90 |
-
max-width: 100%;
|
91 |
-
}
|
92 |
-
|
93 |
-
.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption dt.wp-caption-dt img {
|
94 |
-
display: inline-block;
|
95 |
-
margin-bottom: -1ex;
|
96 |
-
}
|
97 |
-
|
98 |
-
.wp-block-freeform.block-library-rich-text__tinymce div.mceTemp {
|
99 |
-
-ms-user-select: element;
|
100 |
-
}
|
101 |
-
|
102 |
-
.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption,
|
103 |
-
.wp-block-freeform.block-library-rich-text__tinymce dl.wp-caption * {
|
104 |
-
-webkit-user-drag: none;
|
105 |
-
}
|
106 |
-
|
107 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wp-caption-dd {
|
108 |
-
padding-top: 0.5em;
|
109 |
-
margin: 0; /* browser reset */
|
110 |
-
}
|
111 |
-
|
112 |
-
/* WP Views */
|
113 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview {
|
114 |
-
width: 99.99%; /* All IE need hasLayout, incl. 11 (ugh, not again!!) */
|
115 |
-
position: relative;
|
116 |
-
clear: both;
|
117 |
-
margin-bottom: 16px;
|
118 |
-
border: 1px solid transparent;
|
119 |
-
}
|
120 |
-
|
121 |
-
.wp-block-freeform.block-library-rich-text__tinymce .mce-shim {
|
122 |
-
position: absolute;
|
123 |
-
top: 0;
|
124 |
-
right: 0;
|
125 |
-
bottom: 0;
|
126 |
-
left: 0;
|
127 |
-
}
|
128 |
-
|
129 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected="2"] .mce-shim {
|
130 |
-
display: none;
|
131 |
-
}
|
132 |
-
|
133 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview .loading-placeholder {
|
134 |
-
border: 1px dashed $light-gray-400;
|
135 |
-
padding: 10px;
|
136 |
-
}
|
137 |
-
|
138 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .loading-placeholder {
|
139 |
-
border-color: transparent;
|
140 |
-
}
|
141 |
-
|
142 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview .wpview-content > iframe {
|
143 |
-
max-width: 100%;
|
144 |
-
background: transparent;
|
145 |
-
}
|
146 |
-
|
147 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview-error {
|
148 |
-
border: 1px solid $light-gray-400;
|
149 |
-
padding: 1em 0;
|
150 |
-
margin: 0;
|
151 |
-
word-wrap: break-word;
|
152 |
-
}
|
153 |
-
|
154 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview[data-mce-selected] .wpview-error {
|
155 |
-
border-color: transparent;
|
156 |
-
}
|
157 |
-
|
158 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview-error .dashicons,
|
159 |
-
.wp-block-freeform.block-library-rich-text__tinymce .loading-placeholder .dashicons {
|
160 |
-
display: block;
|
161 |
-
margin: 0 auto;
|
162 |
-
width: 32px;
|
163 |
-
height: 32px;
|
164 |
-
font-size: 32px;
|
165 |
-
}
|
166 |
-
|
167 |
-
.wp-block-freeform.block-library-rich-text__tinymce .wpview-error p {
|
168 |
-
margin: 0;
|
169 |
-
text-align: center;
|
170 |
-
}
|
171 |
-
|
172 |
-
/* Toolbars (some get appended to <body>) */
|
173 |
-
div.mce-toolbar-grp .mce-btn:hover button,
|
174 |
-
div.mce-toolbar-grp .mce-btn:hover i,
|
175 |
-
div.mce-toolbar-grp .mce-btn.mce-active button,
|
176 |
-
div.mce-toolbar-grp .mce-btn.mce-active:hover button,
|
177 |
-
div.mce-toolbar-grp .mce-btn.mce-active i,
|
178 |
-
div.mce-toolbar-grp .mce-btn.mce-active:hover i
|
179 |
-
div.mce-inline-toolbar-grp .mce-btn:hover button,
|
180 |
-
div.mce-inline-toolbar-grp .mce-btn:hover i,
|
181 |
-
div.mce-inline-toolbar-grp .mce-btn.mce-active button,
|
182 |
-
div.mce-inline-toolbar-grp .mce-btn.mce-active:hover button,
|
183 |
-
div.mce-inline-toolbar-grp .mce-btn.mce-active i,
|
184 |
-
div.mce-inline-toolbar-grp .mce-btn.mce-active:hover i {
|
185 |
-
color: #191e23;
|
186 |
-
}
|
187 |
-
|
188 |
-
div.mce-toolbar-grp .mce-btn i,
|
189 |
-
div.mce-inline-toolbar-grp .mce-btn i {
|
190 |
-
font-style: normal;
|
191 |
-
}
|
192 |
-
|
193 |
-
div.mce-widget.mce-tooltip .mce-tooltip-inner {
|
194 |
-
font-size: 13px;
|
195 |
-
opacity: 1;
|
196 |
-
}
|
197 |
-
|
198 |
-
.block-library-classic__toolbar .mce-menubar .mce-flow-layout-item {
|
199 |
-
margin: 2px 0;
|
200 |
-
}
|
201 |
-
|
202 |
-
/* Menu */
|
203 |
-
div.mce-menu .mce-menu-item:hover,
|
204 |
-
div.mce-menu .mce-menu-item.mce-selected,
|
205 |
-
div.mce-menu .mce-menu-item:focus,
|
206 |
-
div.mce-menu .mce-menu-item-normal.mce-active,
|
207 |
-
div.mce-menu .mce-menu-item-preview.mce-active {
|
208 |
-
background: #0073aa; /* See color scheme. */
|
209 |
-
color: #fff;
|
210 |
-
}
|
211 |
-
|
212 |
-
div.mce-menu-item:hover .mce-text,
|
213 |
-
div.mce-menu-item:focus .mce-text,
|
214 |
-
div.mce-menu-item:hover .mce-ico,
|
215 |
-
div.mce-menu-item:focus .mce-ico,
|
216 |
-
div.mce-menu-item:hover .mce-menu-shortcut,
|
217 |
-
div.mce-menu-item:focus .mce-menu-shortcut,
|
218 |
-
div.mce-menu-item.mce-active .mce-menu-shortcut,
|
219 |
-
div.mce-menu-item.mce-disabled:hover .mce-text,
|
220 |
-
div.mce-menu-item.mce-disabled:hover .mce-ico {
|
221 |
-
color: inherit;
|
222 |
-
}
|
223 |
-
|
224 |
-
div.mce-menu .mce-menu-item.mce-disabled {
|
225 |
-
cursor: default;
|
226 |
-
}
|
227 |
-
|
228 |
-
div.mce-menu .mce-menu-item.mce-disabled:hover {
|
229 |
-
background: #ccc;
|
230 |
-
}
|
231 |
-
|
232 |
-
/* Menubar */
|
233 |
-
div.mce-menubar {
|
234 |
-
border-color: #e5e5e5;
|
235 |
-
background: #fff;
|
236 |
-
border-width: 0px 0px 1px;
|
237 |
-
}
|
238 |
-
|
239 |
-
div.mce-menubar .mce-menubtn:hover,
|
240 |
-
div.mce-menubar .mce-menubtn.mce-active,
|
241 |
-
div.mce-menubar .mce-menubtn:focus {
|
242 |
-
border-color: transparent;
|
243 |
-
background: transparent;
|
244 |
-
}
|
245 |
-
|
246 |
-
div.mce-menubar .mce-menubtn:focus {
|
247 |
-
color: #124964;
|
248 |
-
box-shadow:
|
249 |
-
0 0 0 1px #5b9dd9,
|
250 |
-
0 0 2px 1px rgba(30, 140, 190, .8);
|
251 |
-
}
|
252 |
-
|
253 |
-
div.mce-menu .mce-menu-item-sep,
|
254 |
-
div.mce-menu-item-sep:hover {
|
255 |
-
border-bottom: 1px solid #ddd;
|
256 |
-
height: 0px;
|
257 |
-
margin: 5px 0;
|
258 |
-
}
|
259 |
-
|
260 |
-
div.mce-menubtn span {
|
261 |
-
margin-right: 0;
|
262 |
-
padding-left: 3px;
|
263 |
-
}
|
264 |
-
|
265 |
-
div.mce-menu-has-icons i.mce-ico:before {
|
266 |
-
margin-left: 0;
|
267 |
-
}
|
268 |
-
|
269 |
-
div.mce-menu-has-icons i.mce-ico {
|
270 |
-
line-height: 16px;
|
271 |
-
}
|
272 |
-
|
273 |
-
.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover,
|
274 |
-
.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active,
|
275 |
-
.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus {
|
276 |
-
border-color: transparent;
|
277 |
-
background: transparent;
|
278 |
-
}
|
279 |
-
|
280 |
-
.wp-block-freeform.block-library-rich-text__tinymce p {
|
281 |
-
margin: 1em 0;
|
282 |
-
}
|
283 |
-
|
284 |
-
.mce-content-body img[data-mce-selected],
|
285 |
-
.mce-content-body hr[data-mce-selected] {
|
286 |
-
outline: 1px solid black;
|
287 |
-
resize: none;
|
288 |
-
}
|
289 |
-
|
290 |
-
/* Increase editor width a bit... */
|
291 |
-
@media (min-width: 600px) {
|
292 |
-
.edit-post-layout.is-sidebar-opened .editor-post-title,
|
293 |
-
.edit-post-layout.is-sidebar-opened .editor-block-list__layout {
|
294 |
-
padding-left: 0;
|
295 |
-
padding-right: 0;
|
296 |
-
}
|
297 |
-
|
298 |
-
.edit-post-layout .editor-styles-wrapper .wp-block {
|
299 |
-
margin-left: auto;
|
300 |
-
margin-right: auto;
|
301 |
-
}
|
302 |
-
|
303 |
-
|
304 |
-
.edit-post-layout .wp-block-columns .editor-styles-wrapper .wp-block {
|
305 |
-
min-width: 0;
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
/* Fix regression in toolbar buttons :-( */
|
310 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i {
|
311 |
-
font-family: tinymce !important;
|
312 |
-
}
|
313 |
-
|
314 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-bold,
|
315 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-italic,
|
316 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-bullist,
|
317 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-numlist,
|
318 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-blockquote,
|
319 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignleft,
|
320 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-aligncenter,
|
321 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignright,
|
322 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-link,
|
323 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-unlink,
|
324 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_more,
|
325 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-strikethrough,
|
326 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-spellchecker,
|
327 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-fullscreen,
|
328 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_fullscreen,
|
329 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-dfw,
|
330 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_adv,
|
331 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-underline,
|
332 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-alignjustify,
|
333 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-forecolor,
|
334 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-backcolor,
|
335 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-pastetext,
|
336 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-pasteword,
|
337 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-removeformat,
|
338 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-charmap,
|
339 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-outdent,
|
340 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-indent,
|
341 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-undo,
|
342 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-redo,
|
343 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-help,
|
344 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_help,
|
345 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp-media-library,
|
346 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-ltr,
|
347 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_page,
|
348 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-hr,
|
349 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-wp_code,
|
350 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-dashicon,
|
351 |
-
.editor-styles-wrapper .wp-block[data-type="core/freeform"] .mce-toolbar-grp .mce-btn i.mce-i-remove {
|
352 |
-
font-family: dashicons !important;
|
353 |
-
}
|
354 |
-
|
355 |
-
/* Editor content */
|
356 |
-
.wp-block-freeform.block-library-rich-text__tinymce table {
|
357 |
-
width: 100%;
|
358 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/tadv-styles.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/**
|
2 |
-
|
3 |
* For more information please see tinymce-advanced.php.
|
4 |
*
|
5 |
* Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
|
@@ -56,11 +56,11 @@ body.settings_page_tinymce-advanced {
|
|
56 |
|
57 |
.wrap.tinymce-advanced {
|
58 |
max-width: 760px;
|
59 |
-
|
60 |
}
|
61 |
|
62 |
.rtl .wrap.tinymce-advanced {
|
63 |
-
|
64 |
}
|
65 |
|
66 |
#classic-editor,
|
@@ -73,14 +73,7 @@ body.settings_page_tinymce-advanced {
|
|
73 |
display: inline-block;
|
74 |
}
|
75 |
|
76 |
-
.toolbar-block-wrap img {
|
77 |
-
height: 36px;
|
78 |
-
width: auto;
|
79 |
-
}
|
80 |
-
|
81 |
/* Block editor buttons */
|
82 |
-
.toolbar-block-left,
|
83 |
-
.toolbar-block-right,
|
84 |
#toolbar_block {
|
85 |
display: inline-block;
|
86 |
vertical-align: text-top;
|
@@ -91,78 +84,191 @@ body.settings_page_tinymce-advanced {
|
|
91 |
}
|
92 |
|
93 |
.toolbar-wrap.highlighted ul,
|
94 |
-
.toolbar-block-wrap.highlighted
|
|
|
95 |
background-color: #e4f2fd;
|
96 |
}
|
97 |
|
98 |
.toolbar-block-wrap {
|
99 |
-
|
100 |
-
border-top: 1px solid #ddd;
|
101 |
-
border-bottom: 1px solid #ddd;
|
102 |
}
|
103 |
|
104 |
#toolbar_block {
|
105 |
border: 0;
|
106 |
}
|
107 |
|
108 |
-
.
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
111 |
|
112 |
-
.
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
background-color: #fff;
|
116 |
line-height: 1px;
|
117 |
min-height: 36px;
|
118 |
font-size: 0pt;
|
119 |
}
|
120 |
|
121 |
-
.components-toolbar > li {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
display: inline-block;
|
|
|
123 |
margin: 0;
|
|
|
|
|
124 |
width: 36px;
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
|
129 |
-
.components-icon-button {
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
outline: none;
|
134 |
-
position: relative;
|
135 |
-
width: 36px;
|
136 |
-
height: 36px;
|
137 |
-
font-size: 10px;
|
138 |
-
border: none;
|
139 |
-
background: none;
|
140 |
-
color: #555d66;
|
141 |
-
overflow: hidden;
|
142 |
-
border-radius: 4px;
|
143 |
-
-webkit-appearance: none;
|
144 |
}
|
145 |
|
146 |
-
.components-icon-button
|
147 |
-
|
148 |
-
|
149 |
-
padding: 5px;
|
150 |
-
border-radius: 4px;
|
151 |
-
height: 30px;
|
152 |
-
width: 30px;
|
153 |
-
outline: none;
|
154 |
-
overflow: hidden;
|
155 |
}
|
156 |
|
157 |
-
.components-icon-button
|
158 |
-
|
159 |
-
margin: 2px;
|
160 |
-
display: block;
|
161 |
}
|
162 |
|
163 |
-
.components-icon-button:hover
|
164 |
-
|
165 |
-
box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
|
166 |
}
|
167 |
|
168 |
.toolbar-side-wrap,
|
@@ -174,9 +280,9 @@ body.settings_page_tinymce-advanced {
|
|
174 |
|
175 |
.panel-title {
|
176 |
padding: 15px;
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
}
|
181 |
|
182 |
.panel-title span {
|
@@ -197,7 +303,7 @@ body.settings_page_tinymce-advanced {
|
|
197 |
}
|
198 |
|
199 |
.toolbar-block-title {
|
200 |
-
margin: 1.2em 0 0;
|
201 |
}
|
202 |
|
203 |
.block-toolbar-side {
|
@@ -225,7 +331,7 @@ body.settings_page_tinymce-advanced {
|
|
225 |
.panel-block-colors-settings {
|
226 |
margin-left: 280px;
|
227 |
width: auto;
|
228 |
-
|
229 |
}
|
230 |
|
231 |
.rtl .panel-block-colors-settings {
|
@@ -275,7 +381,7 @@ form#tadvadmin {
|
|
275 |
}
|
276 |
|
277 |
.tinymce-advanced label {
|
278 |
-
|
279 |
}
|
280 |
|
281 |
.tinymce-advanced input[type="checkbox"] {
|
@@ -319,6 +425,10 @@ form#tadvadmin {
|
|
319 |
height: 22px;
|
320 |
}
|
321 |
|
|
|
|
|
|
|
|
|
322 |
#tadv-confirm-uninstall {
|
323 |
display: none;
|
324 |
background: #FFFFE0;
|
@@ -335,10 +445,9 @@ form#tadvadmin {
|
|
335 |
min-width: 320px;
|
336 |
}
|
337 |
|
338 |
-
#tadv-export,
|
339 |
#tadv-import {
|
340 |
width: 100%;
|
341 |
-
height:
|
342 |
padding: 8px 12px;
|
343 |
}
|
344 |
|
@@ -370,12 +479,21 @@ ul.container,
|
|
370 |
}
|
371 |
|
372 |
.tadvitem i.mce-ico.mce-i-tadv_mark:before {
|
373 |
-
|
374 |
}
|
375 |
|
376 |
.tadvitem i.mce-ico.mce-i-tadv_mark {
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
}
|
380 |
|
381 |
.tadv-mce-menu.mce-menubar {
|
@@ -431,8 +549,8 @@ ul.container,
|
|
431 |
.unuseddiv .highlighted,
|
432 |
.tadvdropzone.highlighted {
|
433 |
background-color: #e4f2fd;
|
434 |
-
|
435 |
-
|
436 |
}
|
437 |
|
438 |
.tadvdropzone .descr {
|
@@ -513,8 +631,8 @@ ul.container,
|
|
513 |
width: 140px;
|
514 |
border: 1px solid #bbb;
|
515 |
background-color: #fff;
|
516 |
-
margin: 1px;
|
517 |
-
padding:
|
518 |
-webkit-border-radius: 2px;
|
519 |
border-radius: 2px;
|
520 |
white-space: nowrap;
|
@@ -527,7 +645,7 @@ ul.container,
|
|
527 |
.unused .tadvmodule .descr {
|
528 |
display: inline;
|
529 |
font-size: 12px;
|
530 |
-
line-height:
|
531 |
}
|
532 |
|
533 |
.unused .tadvmodule .the-button .descr {
|
@@ -579,14 +697,14 @@ div.tadv-error {
|
|
579 |
|
580 |
.tadv-mce-menu.tadv-block-editor.mce-menubar {
|
581 |
background-image: url(../images/toolbar-actions.png);
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
}
|
586 |
|
587 |
.rtl .tadv-mce-menu.tadv-block-editor.mce-menubar {
|
588 |
background-image: url(../images/toolbar-actions-rtl.png);
|
589 |
-
|
590 |
}
|
591 |
|
592 |
.tadv-block-editor .mce-menubtn {
|
@@ -604,18 +722,18 @@ div.tadv-error {
|
|
604 |
.tadv-popout-help {
|
605 |
padding: 1px 18px;
|
606 |
background-color: #fff;
|
607 |
-
margin: 8px;
|
608 |
border: 1px solid #e8e8e8;
|
609 |
}
|
610 |
|
611 |
-
.tadv-popout-help
|
612 |
-
|
613 |
-
|
614 |
}
|
615 |
|
616 |
.tadv-popout-help-close {
|
617 |
float: right;
|
618 |
-
margin:
|
619 |
}
|
620 |
|
621 |
.rtl .tadv-popout-help-close {
|
@@ -641,8 +759,219 @@ div.tadv-error {
|
|
641 |
margin-left: 80px;
|
642 |
}
|
643 |
|
644 |
-
|
645 |
.rtl .the-button {
|
646 |
direction: rtl;
|
647 |
text-align: right;
|
648 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
+
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
* For more information please see tinymce-advanced.php.
|
4 |
*
|
5 |
* Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
|
56 |
|
57 |
.wrap.tinymce-advanced {
|
58 |
max-width: 760px;
|
59 |
+
margin: 16px 24px 0 16px;
|
60 |
}
|
61 |
|
62 |
.rtl .wrap.tinymce-advanced {
|
63 |
+
margin: 16px 16px 0 24px;
|
64 |
}
|
65 |
|
66 |
#classic-editor,
|
73 |
display: inline-block;
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
76 |
/* Block editor buttons */
|
|
|
|
|
77 |
#toolbar_block {
|
78 |
display: inline-block;
|
79 |
vertical-align: text-top;
|
84 |
}
|
85 |
|
86 |
.toolbar-wrap.highlighted ul,
|
87 |
+
.toolbar-block-wrap.highlighted,
|
88 |
+
.tma-block-dropdown-toolbar-inner-wrap.highlighted {
|
89 |
background-color: #e4f2fd;
|
90 |
}
|
91 |
|
92 |
.toolbar-block-wrap {
|
93 |
+
margin: 0;
|
|
|
|
|
94 |
}
|
95 |
|
96 |
#toolbar_block {
|
97 |
border: 0;
|
98 |
}
|
99 |
|
100 |
+
.tma-down-addow-wrap {
|
101 |
+
padding: 16px 13px 0;
|
102 |
+
display: inline-block;
|
103 |
+
box-sizing: border-box;
|
104 |
+
vertical-align: text-top;
|
105 |
+
}
|
106 |
+
|
107 |
+
span.tma-down-addow::after {
|
108 |
+
content: "";
|
109 |
+
pointer-events: none;
|
110 |
+
display: block;
|
111 |
+
width: 0;
|
112 |
+
height: 0;
|
113 |
+
border-left: 3px solid transparent;
|
114 |
+
border-right: 3px solid transparent;
|
115 |
+
border-top: 5px solid #444;
|
116 |
+
}
|
117 |
+
|
118 |
+
.tma-block-dropdown-toolbar-wrap {
|
119 |
+
position: relative;
|
120 |
+
margin: 3px 0 0 36px;
|
121 |
+
height: auto;
|
122 |
+
width: 260px;
|
123 |
+
box-shadow: 0 3px 30px rgba(25, 30, 35, 0.16);
|
124 |
+
border: 1px solid #e2e4e7;
|
125 |
+
background: #fff;
|
126 |
+
}
|
127 |
+
|
128 |
+
.rtl .tma-block-dropdown-toolbar-wrap {
|
129 |
+
margin: 3px 72px 0 0;
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
/* Drop-down arrow */
|
134 |
+
.tma-block-dropdown-toolbar-arrow::before {
|
135 |
+
top: -8px;
|
136 |
+
border: 8px solid #e2e4e7;
|
137 |
+
}
|
138 |
+
|
139 |
+
.tma-block-dropdown-toolbar-arrow::after {
|
140 |
+
top: -6px;
|
141 |
+
border: 8px solid #fff;
|
142 |
+
}
|
143 |
+
|
144 |
+
.tma-block-dropdown-toolbar-arrow::before,
|
145 |
+
.tma-block-dropdown-toolbar-arrow::after {
|
146 |
+
content: "";
|
147 |
+
position: absolute;
|
148 |
+
height: 0;
|
149 |
+
width: 0;
|
150 |
+
line-height: 0;
|
151 |
+
|
152 |
+
border-bottom-style: solid;
|
153 |
+
border-left-color: transparent;
|
154 |
+
border-right-color: transparent;
|
155 |
+
border-top: none;
|
156 |
+
margin-left: -10px;
|
157 |
+
|
158 |
+
left: 235px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.rtl .tma-block-dropdown-toolbar-arrow::before,
|
162 |
+
.rtl .tma-block-dropdown-toolbar-arrow::after {
|
163 |
+
left: auto;
|
164 |
+
right: 226px;
|
165 |
+
}
|
166 |
+
|
167 |
+
.tma-block-dropdown-toolbar-inner-wrap {
|
168 |
+
height: 100%;
|
169 |
+
width: 100%;
|
170 |
+
padding: 9px;
|
171 |
+
}
|
172 |
+
|
173 |
+
ul.toolbar-block-dropdown {
|
174 |
+
padding: 0;
|
175 |
+
margin: 0;
|
176 |
+
height: 100%;
|
177 |
+
width: 100%;
|
178 |
+
min-height: 36px;
|
179 |
+
}
|
180 |
+
|
181 |
+
ul.toolbar-block-dropdown > li {
|
182 |
+
display: block;
|
183 |
+
margin: 0;
|
184 |
+
width: auto;
|
185 |
+
height: 40px;
|
186 |
+
cursor: move;
|
187 |
+
}
|
188 |
+
|
189 |
+
ul.toolbar-block-dropdown .tma-components-icon-button {
|
190 |
+
width: 100%;
|
191 |
+
}
|
192 |
+
|
193 |
+
ul.toolbar-block-dropdown span {
|
194 |
+
vertical-align: middle;
|
195 |
}
|
196 |
|
197 |
+
.block-button-name {
|
198 |
+
display: inline-block;
|
199 |
+
vertical-align: middle;
|
200 |
+
}
|
201 |
+
|
202 |
+
.tma-components-toolbar *,
|
203 |
+
.tma-block-dropdown-toolbar-wrap * {
|
204 |
+
box-sizing: border-box;
|
205 |
+
}
|
206 |
+
|
207 |
+
.tma-components-toolbar {
|
208 |
+
border: 1px solid #e2e4e7;
|
209 |
+
margin: 0;
|
210 |
background-color: #fff;
|
211 |
line-height: 1px;
|
212 |
min-height: 36px;
|
213 |
font-size: 0pt;
|
214 |
}
|
215 |
|
216 |
+
.tma-components-toolbar > li {
|
217 |
+
display: inline-block;
|
218 |
+
margin: 0;
|
219 |
+
width: 36px;
|
220 |
+
height: 36px;
|
221 |
+
cursor: move;
|
222 |
+
}
|
223 |
+
|
224 |
+
.tma-components-toolbar .block-button-name {
|
225 |
+
display: none;
|
226 |
+
}
|
227 |
+
|
228 |
+
.tma-components-icon-button {
|
229 |
display: inline-block;
|
230 |
+
vertical-align: middle;
|
231 |
margin: 0;
|
232 |
+
padding: 3px;
|
233 |
+
outline: none;
|
234 |
width: 36px;
|
235 |
+
height: 36px;
|
236 |
+
border: none;
|
237 |
+
background: none;
|
238 |
+
color: #555d66;
|
239 |
+
overflow: hidden;
|
240 |
+
border-radius: 4px;
|
241 |
+
-webkit-appearance: none;
|
242 |
+
}
|
243 |
+
|
244 |
+
.tma-components-icon-button .dashicons,
|
245 |
+
.tma-components-icon-button .mce-ico {
|
246 |
+
display: inline-block;
|
247 |
+
padding: 5px;
|
248 |
+
border-radius: 4px;
|
249 |
+
height: 30px;
|
250 |
+
width: 30px;
|
251 |
+
outline: none;
|
252 |
+
overflow: hidden;
|
253 |
}
|
254 |
|
255 |
+
.tma-components-icon-button .mce-ico:before {
|
256 |
+
font-size: 20px;
|
257 |
+
margin: 2px;
|
258 |
+
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
|
261 |
+
.tma-components-icon-button:hover > span {
|
262 |
+
color: #555d66;
|
263 |
+
box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
+
.toolbar-block-dropdown .tma-components-icon-button:hover > span {
|
267 |
+
box-shadow: none;
|
|
|
|
|
268 |
}
|
269 |
|
270 |
+
.toolbar-block-dropdown .tma-components-icon-button:hover {
|
271 |
+
box-shadow: inset 0 0 0 1px #e2e4e7, inset 0 0 0 2px #fff, 0 1px 1px rgba(25, 30, 35, 0.2);
|
|
|
272 |
}
|
273 |
|
274 |
.toolbar-side-wrap,
|
280 |
|
281 |
.panel-title {
|
282 |
padding: 15px;
|
283 |
+
font-weight: 600;
|
284 |
+
background-color: #f8f9f9;
|
285 |
+
margin-bottom: 5px;
|
286 |
}
|
287 |
|
288 |
.panel-title span {
|
303 |
}
|
304 |
|
305 |
.toolbar-block-title {
|
306 |
+
margin: 1.2em 0 0.6em;
|
307 |
}
|
308 |
|
309 |
.block-toolbar-side {
|
331 |
.panel-block-colors-settings {
|
332 |
margin-left: 280px;
|
333 |
width: auto;
|
334 |
+
clear: none;
|
335 |
}
|
336 |
|
337 |
.rtl .panel-block-colors-settings {
|
381 |
}
|
382 |
|
383 |
.tinymce-advanced label {
|
384 |
+
vertical-align: baseline;
|
385 |
}
|
386 |
|
387 |
.tinymce-advanced input[type="checkbox"] {
|
425 |
height: 22px;
|
426 |
}
|
427 |
|
428 |
+
.import-file {
|
429 |
+
margin: 2em 0;
|
430 |
+
}
|
431 |
+
|
432 |
#tadv-confirm-uninstall {
|
433 |
display: none;
|
434 |
background: #FFFFE0;
|
445 |
min-width: 320px;
|
446 |
}
|
447 |
|
|
|
448 |
#tadv-import {
|
449 |
width: 100%;
|
450 |
+
height: 200px;
|
451 |
padding: 8px 12px;
|
452 |
}
|
453 |
|
479 |
}
|
480 |
|
481 |
.tadvitem i.mce-ico.mce-i-tadv_mark:before {
|
482 |
+
content: "\e01a";
|
483 |
}
|
484 |
|
485 |
.tadvitem i.mce-ico.mce-i-tadv_mark {
|
486 |
+
text-shadow: none;
|
487 |
+
background: #ddd;
|
488 |
+
}
|
489 |
+
|
490 |
+
.tadvitem.mce-listbox i.mce-caret {
|
491 |
+
right: 6px;
|
492 |
+
}
|
493 |
+
|
494 |
+
.rtl .tadvitem.mce-listbox i.mce-caret {
|
495 |
+
right: auto;
|
496 |
+
left: 6px;
|
497 |
}
|
498 |
|
499 |
.tadv-mce-menu.mce-menubar {
|
549 |
.unuseddiv .highlighted,
|
550 |
.tadvdropzone.highlighted {
|
551 |
background-color: #e4f2fd;
|
552 |
+
color: #000;
|
553 |
+
border-color: #aaa;
|
554 |
}
|
555 |
|
556 |
.tadvdropzone .descr {
|
631 |
width: 140px;
|
632 |
border: 1px solid #bbb;
|
633 |
background-color: #fff;
|
634 |
+
margin: 2px 1px 1px;
|
635 |
+
padding: 3px 3px 0;
|
636 |
-webkit-border-radius: 2px;
|
637 |
border-radius: 2px;
|
638 |
white-space: nowrap;
|
645 |
.unused .tadvmodule .descr {
|
646 |
display: inline;
|
647 |
font-size: 12px;
|
648 |
+
line-height: 20px;
|
649 |
}
|
650 |
|
651 |
.unused .tadvmodule .the-button .descr {
|
697 |
|
698 |
.tadv-mce-menu.tadv-block-editor.mce-menubar {
|
699 |
background-image: url(../images/toolbar-actions.png);
|
700 |
+
background-position: right;
|
701 |
+
background-repeat: no-repeat;
|
702 |
+
background-size: 84px 37px;
|
703 |
}
|
704 |
|
705 |
.rtl .tadv-mce-menu.tadv-block-editor.mce-menubar {
|
706 |
background-image: url(../images/toolbar-actions-rtl.png);
|
707 |
+
background-position: left;
|
708 |
}
|
709 |
|
710 |
.tadv-block-editor .mce-menubtn {
|
722 |
.tadv-popout-help {
|
723 |
padding: 1px 18px;
|
724 |
background-color: #fff;
|
725 |
+
margin: 8px 0;
|
726 |
border: 1px solid #e8e8e8;
|
727 |
}
|
728 |
|
729 |
+
.tadv-popout-help ol {
|
730 |
+
padding: 0;
|
731 |
+
margin: 1em;
|
732 |
}
|
733 |
|
734 |
.tadv-popout-help-close {
|
735 |
float: right;
|
736 |
+
margin: 1px -16px;
|
737 |
}
|
738 |
|
739 |
.rtl .tadv-popout-help-close {
|
759 |
margin-left: 80px;
|
760 |
}
|
761 |
|
|
|
762 |
.rtl .the-button {
|
763 |
direction: rtl;
|
764 |
text-align: right;
|
765 |
}
|
766 |
+
|
767 |
+
.tadv-block-placeholder {
|
768 |
+
background: #fff;
|
769 |
+
vertical-align: middle;
|
770 |
+
}
|
771 |
+
|
772 |
+
|
773 |
+
/* Block toolbar */
|
774 |
+
.tma-block-toolbar-wrap.editor-block-toolbar {
|
775 |
+
white-space: nowrap;
|
776 |
+
overflow-wrap: break-word;
|
777 |
+
box-sizing: border-box;
|
778 |
+
font-size: 16px;
|
779 |
+
line-height: 1.8;
|
780 |
+
color: #191e23;
|
781 |
+
|
782 |
+
display: flex;
|
783 |
+
flex-grow: 1;
|
784 |
+
|
785 |
+
width: auto;
|
786 |
+
overflow: inherit;
|
787 |
+
border-right: none;
|
788 |
+
border-left: 1px solid #b5bcc2;
|
789 |
+
}
|
790 |
+
|
791 |
+
.tma-block-toolbar-wrap.editor-block-toolbar * {
|
792 |
+
box-sizing: inherit;
|
793 |
+
}
|
794 |
+
|
795 |
+
.tma-block-toolbar-wrap div.components-toolbar {
|
796 |
+
border-top: 1px solid #b5bcc2;
|
797 |
+
border-bottom: 1px solid #b5bcc2;
|
798 |
+
border-right: 1px solid #b5bcc2;
|
799 |
+
|
800 |
+
margin: 0;
|
801 |
+
background-color: #fff;
|
802 |
+
display: flex;
|
803 |
+
flex-shrink: 0;
|
804 |
+
}
|
805 |
+
|
806 |
+
.tma-block-toolbar-wrap div.components-toolbar > div {
|
807 |
+
display: flex;
|
808 |
+
}
|
809 |
+
|
810 |
+
.tma-block-toolbar-wrap .block-editor-block-switcher {
|
811 |
+
position: relative;
|
812 |
+
height: 36px;
|
813 |
+
}
|
814 |
+
|
815 |
+
.tma-block-toolbar-wrap .components-button {
|
816 |
+
display: inline-flex;
|
817 |
+
text-decoration: none;
|
818 |
+
font-size: 13px;
|
819 |
+
margin: 0;
|
820 |
+
border: 0;
|
821 |
+
cursor: default;
|
822 |
+
-webkit-appearance: none;
|
823 |
+
background: none;
|
824 |
+
outline: none;
|
825 |
+
}
|
826 |
+
|
827 |
+
.tma-block-toolbar-wrap .components-icon-button {
|
828 |
+
display: flex;
|
829 |
+
align-items: center;
|
830 |
+
padding: 8px;
|
831 |
+
margin: 0;
|
832 |
+
border: none;
|
833 |
+
background: none;
|
834 |
+
color: #555d66;
|
835 |
+
position: relative;
|
836 |
+
overflow: hidden;
|
837 |
+
border-radius: 4px;
|
838 |
+
}
|
839 |
+
|
840 |
+
.tma-block-toolbar-wrap .components-toolbar__control.components-button {
|
841 |
+
display: inline-flex;
|
842 |
+
align-items: flex-end;
|
843 |
+
margin: 0;
|
844 |
+
padding: 3px;
|
845 |
+
outline: none;
|
846 |
+
position: relative;
|
847 |
+
width: 36px;
|
848 |
+
height: 36px;
|
849 |
+
}
|
850 |
+
|
851 |
+
.tma-block-toolbar-wrap .components-dropdown-menu {
|
852 |
+
padding: 3px;
|
853 |
+
}
|
854 |
+
|
855 |
+
.tma-block-toolbar-wrap div.components-toolbar > div + div {
|
856 |
+
margin-left: -3px;
|
857 |
+
}
|
858 |
+
|
859 |
+
.rtl .tma-block-toolbar-wrap div.components-toolbar > div + div {
|
860 |
+
margin-left: 0;
|
861 |
+
margin-right: -3px;
|
862 |
+
}
|
863 |
+
|
864 |
+
.tma-block-toolbar-wrap .components-dropdown-menu .components-dropdown-menu__toggle {
|
865 |
+
width: auto;
|
866 |
+
margin: 0;
|
867 |
+
padding: 4px;
|
868 |
+
border: 1px solid transparent;
|
869 |
+
display: flex;
|
870 |
+
flex-direction: row;
|
871 |
+
|
872 |
+
/* Always hover... */
|
873 |
+
color: #555d66;
|
874 |
+
box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
|
875 |
+
}
|
876 |
+
|
877 |
+
.tma-block-toolbar-wrap .components-dropdown-menu .components-dropdown-menu__toggle .components-dropdown-menu__indicator::after {
|
878 |
+
content: "";
|
879 |
+
pointer-events: none;
|
880 |
+
display: block;
|
881 |
+
width: 0;
|
882 |
+
height: 0;
|
883 |
+
border-left: 3px solid transparent;
|
884 |
+
border-right: 3px solid transparent;
|
885 |
+
border-top: 5px solid currentColor;
|
886 |
+
margin: 7px;
|
887 |
+
}
|
888 |
+
|
889 |
+
.components-dropdown-menu .components-dropdown-menu__toggle:hover,
|
890 |
+
.components-dropdown-menu .components-dropdown-menu__toggle:focus,
|
891 |
+
.components-dropdown-menu .components-dropdown-menu__toggle:not(:disabled):not([aria-disabled="true"]):not(.is-default):hover {
|
892 |
+
color: #555d66;
|
893 |
+
box-shadow: inset 0 0 0 1px #555d66, inset 0 0 0 2px #fff;
|
894 |
+
}
|
895 |
+
|
896 |
+
.tma-block-toolbar-wrap .block-editor-block-icon {
|
897 |
+
display: flex;
|
898 |
+
align-items: center;
|
899 |
+
justify-content: center;
|
900 |
+
width: 24px;
|
901 |
+
height: 24px;
|
902 |
+
margin: 0;
|
903 |
+
border-radius: 4px;
|
904 |
+
}
|
905 |
+
|
906 |
+
.tma-block-toolbar-wrap .block-editor-block-icon.has-colors svg {
|
907 |
+
fill: currentColor;
|
908 |
+
}
|
909 |
+
|
910 |
+
.tma-block-toolbar-wrap .block-editor-block-icon svg {
|
911 |
+
width: 20px;
|
912 |
+
height: 20px;
|
913 |
+
max-width: 24px;
|
914 |
+
max-height: 24px;
|
915 |
+
}
|
916 |
+
|
917 |
+
.tma-block-toolbar-wrap .components-icon-button svg {
|
918 |
+
fill: currentColor;
|
919 |
+
outline: none;
|
920 |
+
}
|
921 |
+
|
922 |
+
.tma-block-toolbar-wrap .components-toolbar__control.components-button > svg,
|
923 |
+
.tma-block-toolbar-wrap .components-toolbar__control.components-button > .dashicons {
|
924 |
+
padding: 5px;
|
925 |
+
border-radius: 4px;
|
926 |
+
height: 30px;
|
927 |
+
width: 30px;
|
928 |
+
}
|
929 |
+
|
930 |
+
.tma-block-toolbar-wrap .components-toolbar__control .dashicon {
|
931 |
+
display: block;
|
932 |
+
}
|
933 |
+
|
934 |
+
.tma-block-toolbar-wrap .components-icon-button.block-editor-block-switcher__toggle .block-editor-block-icon::after {
|
935 |
+
content: "";
|
936 |
+
pointer-events: none;
|
937 |
+
display: block;
|
938 |
+
width: 0;
|
939 |
+
height: 0;
|
940 |
+
border-left: 3px solid transparent;
|
941 |
+
border-right: 3px solid transparent;
|
942 |
+
border-top: 5px solid currentColor;
|
943 |
+
margin-left: 4px;
|
944 |
+
margin-right: 2px;
|
945 |
+
}
|
946 |
+
|
947 |
+
.tma-block-toolbar-wrap .block-editor-block-settings-menu__toggle .dashicon {
|
948 |
+
transform: rotate(90deg);
|
949 |
+
}
|
950 |
+
|
951 |
+
.tma-block-toolbar-wrap .components-icon-button.block-editor-block-switcher__toggle,
|
952 |
+
.tma-block-toolbar-wrap .components-icon-button.block-editor-block-switcher__no-switcher-icon {
|
953 |
+
width: auto;
|
954 |
+
margin: 0;
|
955 |
+
display: block;
|
956 |
+
height: 36px;
|
957 |
+
padding: 3px;
|
958 |
+
}
|
959 |
+
|
960 |
+
.tma-block-toolbar-wrap .components-icon-button.block-editor-block-switcher__toggle .block-editor-block-icon,
|
961 |
+
.tma-block-toolbar-wrap .components-icon-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform {
|
962 |
+
width: 42px;
|
963 |
+
height: 30px;
|
964 |
+
position: relative;
|
965 |
+
margin: 0 auto;
|
966 |
+
padding: 3px;
|
967 |
+
display: flex;
|
968 |
+
align-items: center;
|
969 |
+
}
|
970 |
+
|
971 |
+
.advanced-options .dashicons {
|
972 |
+
color: #777;
|
973 |
+
}
|
974 |
+
|
975 |
+
.tadvmodule .the-button {
|
976 |
+
margin: 2px 0;
|
977 |
+
}
|
css/tma-block-editor.css
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* This file is part of the TinyMCE Advanced WordPress plugin and is released under the same license.
|
3 |
+
* For more information please see tinymce-advanced.php.
|
4 |
+
*
|
5 |
+
* Copyright (c) 2007-2019 Andrew Ozz. All rights reserved.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/* Fixes for the Block Editor */
|
9 |
+
.block-library-classic__toolbar:empty {
|
10 |
+
height: 40px;
|
11 |
+
}
|
12 |
+
|
13 |
+
/* Fix top border left over after deselecting */
|
14 |
+
div.block-library-classic__toolbar {
|
15 |
+
border-color: transparent;
|
16 |
+
/*transform: translateY(-15px);*/
|
17 |
+
}
|
18 |
+
|
19 |
+
.is-selected div.block-library-classic__toolbar {
|
20 |
+
border-left-width: 0;
|
21 |
+
}
|
22 |
+
|
23 |
+
.rtl .is-selected div.block-library-classic__toolbar {
|
24 |
+
border-left-width: 1px;
|
25 |
+
border-right-width: 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
/* Fix: no left-over top border when an inner block */
|
29 |
+
.is-selected .block-editor-block-list__block div.block-library-classic__toolbar {
|
30 |
+
border-color: transparent;
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Fix the inserter button at the top of the classic block */
|
34 |
+
.editor-block-list__block[data-type="core/freeform"] > .editor-block-list__insertion-point {
|
35 |
+
z-index: 11;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Fix position of the inserter button at the top of the block */
|
39 |
+
.editor-block-list__block[data-type="core/freeform"] .editor-block-list__insertion-point-inserter .editor-inserter__toggle {
|
40 |
+
margin-top: -2px;
|
41 |
+
}
|
42 |
+
|
43 |
+
/* Fix the stiky "contextual toolbar" from sticking on top of the toolbar when scrolling the block off the screen */
|
44 |
+
/* Assumes the toolbar has two rown of buttons... */
|
45 |
+
.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar {
|
46 |
+
margin-bottom: 108px;
|
47 |
+
}
|
48 |
+
|
49 |
+
/* Fix text size and color in drop-downs (overwriten by some themes) */
|
50 |
+
.block-library-classic__toolbar .mce-btn .mce-txt {
|
51 |
+
font-size: 13px;
|
52 |
+
color: #454545;
|
53 |
+
}
|
54 |
+
|
55 |
+
/* TinyMCE Menu */
|
56 |
+
div.mce-menubar,
|
57 |
+
div.mce-menubar * {
|
58 |
+
box-sizing: border-box;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* toolbar after menubar */
|
62 |
+
div.editor-block-list__layout .block-library-classic__toolbar .mce-menubar + .mce-toolbar-grp .mce-container-body .mce-toolbar {
|
63 |
+
padding: 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
@media (min-width: 600px) {
|
67 |
+
.block-library-classic__toolbar .mce-menubar > .mce-container-body {
|
68 |
+
padding-top: 5px;
|
69 |
+
padding-right: 36px;
|
70 |
+
white-space: normal;
|
71 |
+
width: auto !important;
|
72 |
+
}
|
73 |
+
|
74 |
+
.rtl .block-library-classic__toolbar .mce-menubar > .mce-container-body {
|
75 |
+
padding-right: 0;
|
76 |
+
padding-left: 36px;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
.block-library-classic__toolbar .mce-menubar {
|
81 |
+
min-height: 38px;
|
82 |
+
}
|
83 |
+
|
84 |
+
.block-library-classic__toolbar .mce-menubar i.mce-caret {
|
85 |
+
margin-top: 0.32em;
|
86 |
+
}
|
87 |
+
|
88 |
+
.block-library-classic__toolbar .mce-menubar .mce-flow-layout-item {
|
89 |
+
margin: 2px 0;
|
90 |
+
}
|
91 |
+
|
92 |
+
div.mce-menu-item.mce-menu-item-preview.mce-active:hover,
|
93 |
+
div.mce-menu .mce-menu-item:hover,
|
94 |
+
div.mce-menu .mce-menu-item.mce-selected,
|
95 |
+
div.mce-menu .mce-menu-item:focus,
|
96 |
+
div.mce-menu .mce-menu-item-normal.mce-active,
|
97 |
+
div.mce-menu .mce-menu-item-preview.mce-active {
|
98 |
+
background: #0073aa; /* See color scheme. */
|
99 |
+
color: #fff;
|
100 |
+
}
|
101 |
+
|
102 |
+
div.mce-menu-item.mce-menu-item-preview.mce-active .mce-text,
|
103 |
+
div.mce-menu-item.mce-menu-item-preview.mce-active .mce-ico,
|
104 |
+
div.mce-menu-item:hover .mce-text,
|
105 |
+
div.mce-menu-item:focus .mce-text,
|
106 |
+
div.mce-menu-item:hover .mce-ico,
|
107 |
+
div.mce-menu-item:focus .mce-ico,
|
108 |
+
div.mce-menu-item:hover .mce-menu-shortcut,
|
109 |
+
div.mce-menu-item:focus .mce-menu-shortcut,
|
110 |
+
div.mce-menu-item.mce-active .mce-menu-shortcut,
|
111 |
+
div.mce-menu-item.mce-disabled:hover .mce-text,
|
112 |
+
div.mce-menu-item.mce-disabled:hover .mce-ico {
|
113 |
+
color: inherit;
|
114 |
+
}
|
115 |
+
|
116 |
+
div.mce-menu .mce-menu-item.mce-disabled {
|
117 |
+
cursor: default;
|
118 |
+
}
|
119 |
+
|
120 |
+
div.mce-menu .mce-menu-item.mce-disabled:hover {
|
121 |
+
background: #ccc;
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/* Toolbars (some get appended to <body>) */
|
126 |
+
div.mce-toolbar-grp .mce-btn:hover button,
|
127 |
+
div.mce-toolbar-grp .mce-btn:hover i,
|
128 |
+
div.mce-toolbar-grp .mce-btn.mce-active button,
|
129 |
+
div.mce-toolbar-grp .mce-btn.mce-active:hover button,
|
130 |
+
div.mce-toolbar-grp .mce-btn.mce-active i,
|
131 |
+
div.mce-toolbar-grp .mce-btn.mce-active:hover i
|
132 |
+
div.mce-inline-toolbar-grp .mce-btn:hover button,
|
133 |
+
div.mce-inline-toolbar-grp .mce-btn:hover i,
|
134 |
+
div.mce-inline-toolbar-grp .mce-btn.mce-active button,
|
135 |
+
div.mce-inline-toolbar-grp .mce-btn.mce-active:hover button,
|
136 |
+
div.mce-inline-toolbar-grp .mce-btn.mce-active i,
|
137 |
+
div.mce-inline-toolbar-grp .mce-btn.mce-active:hover i {
|
138 |
+
color: #191e23;
|
139 |
+
}
|
140 |
+
|
141 |
+
div.mce-toolbar-grp .mce-btn i,
|
142 |
+
div.mce-inline-toolbar-grp .mce-btn i {
|
143 |
+
font-style: normal;
|
144 |
+
}
|
145 |
+
|
146 |
+
div.mce-widget.mce-tooltip .mce-tooltip-inner {
|
147 |
+
font-size: 13px;
|
148 |
+
opacity: 1;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
/* Menubar */
|
153 |
+
div.mce-menubar.mce-toolbar .mce-btn button {
|
154 |
+
padding: 3px 4px 2px;
|
155 |
+
}
|
156 |
+
|
157 |
+
div.mce-menubar {
|
158 |
+
border-color: #e5e5e5;
|
159 |
+
background: #fff;
|
160 |
+
border-width: 0px 0px 1px;
|
161 |
+
}
|
162 |
+
|
163 |
+
div.mce-menubar .mce-menubtn:focus {
|
164 |
+
color: #124964;
|
165 |
+
box-shadow:
|
166 |
+
0 0 0 1px #5b9dd9,
|
167 |
+
0 0 2px 1px rgba(30, 140, 190, .8);
|
168 |
+
}
|
169 |
+
|
170 |
+
div.mce-menu .mce-menu-item-sep,
|
171 |
+
div.mce-menu-item-sep:hover {
|
172 |
+
border-bottom: 1px solid #ddd;
|
173 |
+
height: 0px;
|
174 |
+
margin: 5px 0;
|
175 |
+
}
|
176 |
+
|
177 |
+
div.mce-menubtn span {
|
178 |
+
margin-right: 0;
|
179 |
+
padding-left: 3px;
|
180 |
+
}
|
181 |
+
|
182 |
+
div.mce-menu-has-icons i.mce-ico:before {
|
183 |
+
margin-left: 0;
|
184 |
+
}
|
185 |
+
|
186 |
+
div.mce-menu-has-icons i.mce-ico {
|
187 |
+
line-height: 16px;
|
188 |
+
}
|
189 |
+
|
190 |
+
.wp-core-ui .mce-menu-item .mce-text {
|
191 |
+
font-size: 13px;
|
192 |
+
}
|
193 |
+
|
194 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover,
|
195 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active,
|
196 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus {
|
197 |
+
border-color: transparent;
|
198 |
+
}
|
199 |
+
|
200 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn:hover span,
|
201 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn.mce-active span,
|
202 |
+
.block-library-classic__toolbar .mce-menubar .mce-menubtn:focus span {
|
203 |
+
color: #000;
|
204 |
+
}
|
205 |
+
|
206 |
+
/* Editor content */
|
207 |
+
.wp-block-freeform.block-library-rich-text__tinymce table {
|
208 |
+
width: 100%;
|
209 |
+
}
|
dist/classic-paragraph.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-tinymce{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.editor-block-list__block[data-type="tadv/classic-paragraph"] div.mce-toolbar-grp{background:#f8f9f9;border-bottom-color:#eceded}.editor-block-list__block[data-type="tadv/classic-paragraph"] div.mce-toolbar .mce-btn-group{padding:
|
1 |
+
.editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-tinymce{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;border-color:#fff}.editor-block-list__block[data-type="tadv/classic-paragraph"] div.mce-toolbar-grp{background:#f8f9f9;border-bottom-color:#eceded}.editor-block-list__block[data-type="tadv/classic-paragraph"] div.mce-toolbar .mce-btn-group{padding:2px;margin:0}.editor-block-list__block[data-type="tadv/classic-paragraph"] div.mce-toolbar-grp.mce-container>div{padding:0}.editor-block-list__block[data-type="tadv/classic-paragraph"]>.editor-block-list__insertion-point{z-index:11}div[data-type="tadv/classic-paragraph"] .block-editor-block-list__block-edit:before{transition:border-color .1s linear,box-shadow .1s linear;border:1px solid #e2e4e7;outline:1px solid transparent}div[data-type="tadv/classic-paragraph"].is-selected .block-editor-block-list__block-edit:before{border-color:#b5bcc2 #b5bcc2 #b5bcc2 transparent}div[data-type="tadv/classic-paragraph"] .editor-block-contextual-toolbar+div{margin-top:0;padding-top:0}div[data-type="tadv/classic-paragraph"].is-selected .block-library-rich-text__tinymce:after{content:"";display:table;clear:both}@media (min-width:600px){.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-switcher__no-switcher-icon{display:none}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar{float:right;margin-right:74px;transform:translateY(-13px);top:14px}.rtl .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar,.rtl .editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar{float:left;margin-right:0;margin-left:74px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{margin-bottom:105px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{border:none;box-shadow:none;margin-top:0}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar:before,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar:before{content:"";display:block;border-left:1px solid #e2e4e7;margin-top:4px;margin-bottom:4px}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar__control.components-button:hover,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar .components-toolbar__control.components-button:hover{background-color:transparent}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .block-editor-block-contextual-toolbar .components-toolbar{background:transparent;border:none}.block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar.mce-stack-layout-item,.editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .mce-container.mce-toolbar.mce-stack-layout-item{padding-right:86px}.rtl .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar.mce-stack-layout-item,.rtl .editor-block-list__layout .block-editor-block-list__block[data-type="core/freeform"] .mce-container.mce-toolbar.mce-stack-layout-item{padding-left:86px;padding-right:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{float:none;margin-right:0;transform:translateY(-52px);top:0;position:absolute}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar{margin-right:-15px;margin-left:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{box-shadow:-3px 0 0 0 #555d66;position:relative}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar{box-shadow:3px 0 0 0 #555d66}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .block-editor-block-toolbar:before{display:none}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar{background:#fff;border:1px solid #b5bcc2;border-left-width:0}.rtl .block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .block-editor-block-contextual-toolbar .components-toolbar{border:1px solid #b5bcc2;border-right-width:0}.block-editor-inner-blocks .block-editor-block-list__block[data-type="tadv/classic-paragraph"] .mce-container.mce-toolbar.mce-stack-layout-item{padding:0}.block-library-classic__toolbar .mce-menubar>div.mce-container-body{padding-right:80px}.rtl .block-library-classic__toolbar .mce-menubar>div.mce-container-body{padding-left:84px}.editor-inner-blocks .block-library-classic__toolbar .mce-menubar>div.mce-container-body{padding:0}.block-library-classic__toolbar .mce-rtl .mce-flow-layout .mce-flow-layout-item>div{direction:rtl;text-align:right}}
|
dist/classic-paragraph.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=122)}([function(t,n,e){var r=e(45)("wks"),o=e(29),i=e(3).Symbol,c="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=c&&i[t]||(c?i:o)("Symbol."+t))}).store=r},function(t,n){var e=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=e)},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n,e){var r=e(17),o=e(48);t.exports=e(11)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(15),o=e(54),i=e(35),c=Object.defineProperty;n.f=e(6)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return c(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){t.exports=!e(12)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(18);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(96),o=e(42);t.exports=function(t){return r(o(t))}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){t.exports=!e(30)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,e){var r=e(2),o=e(1),i=e(65),c=e(14),u=e(8),a=function(t,n,e){var s,f,l,p=t&a.F,v=t&a.G,h=t&a.S,y=t&a.P,d=t&a.B,g=t&a.W,b=v?o:o[n]||(o[n]={}),m=b.prototype,x=v?r:h?r[n]:(r[n]||{}).prototype;for(s in v&&(e=n),e)(f=!p&&x&&void 0!==x[s])&&u(b,s)||(l=f?x[s]:e[s],b[s]=v&&"function"!=typeof x[s]?e[s]:d&&f?i(l,r):g&&x[s]==l?function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(l):y&&"function"==typeof l?i(Function.call,l):l,y&&((b.virtual||(b.virtual={}))[s]=l,t&a.R&&m&&!m[s]&&c(m,s,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n,e){var r=e(5),o=e(24);t.exports=e(6)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(10);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n,e){var r=e(36)("wks"),o=e(22),i=e(2).Symbol,c="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=c&&i[t]||(c?i:o)("Symbol."+t))}).store=r},function(t,n,e){var r=e(7),o=e(75),i=e(76),c=Object.defineProperty;n.f=e(11)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return c(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(3),o=e(4),i=e(21),c=e(29)("src"),u=Function.toString,a=(""+u).split("toString");e(28).inspectSource=function(t){return u.call(t)},(t.exports=function(t,n,e,u){var s="function"==typeof e;s&&(i(e,"name")||o(e,"name",n)),t[n]!==e&&(s&&(i(e,c)||o(e,c,t[n]?""+t[n]:a.join(String(n)))),t===r?t[n]=e:u?t[n]?t[n]=e:o(t,n,e):(delete t[n],o(t,n,e)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[c]||u.call(this)})},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){t.exports=!0},function(t,n,e){var r=e(57),o=e(37);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,n){var e=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=e)},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){t.exports={}},function(t,n,e){var r=e(78),o=e(19);t.exports=function(t){return r(o(t))}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n,e){var r=e(45)("keys"),o=e(29);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n,e){var r=e(10);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,e){var r=e(1),o=e(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(25)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){"use strict";var r,o,i=e(111),c=RegExp.prototype.exec,u=String.prototype.replace,a=c,s=(r=/a/,o=/b*/g,c.call(r,"a"),c.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),f=void 0!==/()??/.exec("")[1];(s||f)&&(a=function(t){var n,e,r,o,a=this;return f&&(e=new RegExp("^"+a.source+"$(?!\\s)",i.call(a))),s&&(n=a.lastIndex),r=c.call(a,t),s&&r&&(a.lastIndex=a.global?r.index+r[0].length:n),f&&r&&r.length>1&&u.call(r[0],e,function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)}),r}),t.exports=a},function(t,n,e){var r=e(23),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(36)("keys"),o=e(22);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n,e){n.f=e(16)},function(t,n,e){var r=e(28),o=e(3),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(46)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports=!1},function(t,n,e){var r=e(18),o=e(3).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,e){var r=e(3),o=e(28),i=e(4),c=e(20),u=e(80),a=function(t,n,e){var s,f,l,p,v=t&a.F,h=t&a.G,y=t&a.S,d=t&a.P,g=t&a.B,b=h?r:y?r[n]||(r[n]={}):(r[n]||{}).prototype,m=h?o:o[n]||(o[n]={}),x=m.prototype||(m.prototype={});for(s in h&&(e=n),e)l=((f=!v&&b&&void 0!==b[s])?b:e)[s],p=g&&f?u(l,r):d&&"function"==typeof l?u(Function.call,l):l,b&&c(b,s,l,t&a.U),m[s]!=l&&i(m,s,p),d&&x[s]!=l&&(x[s]=l)};r.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,e){var r=e(84),o=e(52);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(17).f,o=e(21),i=e(0)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n,e){t.exports=!e(6)&&!e(12)(function(){return 7!=Object.defineProperty(e(55)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(10),o=e(2).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,e){var r=e(15),o=e(95),i=e(37),c=e(43)("IE_PROTO"),u=function(){},a=function(){var t,n=e(55)("iframe"),r=i.length;for(n.style.display="none",e(100).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;r--;)delete a.prototype[i[r]];return a()};t.exports=Object.create||function(t,n){var e;return null!==t?(u.prototype=r(t),e=new u,u.prototype=null,e[c]=t):e=a(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(8),o=e(9),i=e(97)(!1),c=e(43)("IE_PROTO");t.exports=function(t,n){var e,u=o(t),a=0,s=[];for(e in u)e!=c&&r(u,e)&&s.push(e);for(;n.length>a;)r(u,e=n[a++])&&(~i(s,e)||s.push(e));return s}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n,e){var r=e(5).f,o=e(8),i=e(16)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n,e){var r=e(2),o=e(1),i=e(25),c=e(44),u=e(5).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||u(n,t,{value:c.f(t)})}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(57),o=e(37).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,n,e){var r=e(38),o=e(24),i=e(9),c=e(35),u=e(8),a=e(54),s=Object.getOwnPropertyDescriptor;n.f=e(6)?s:function(t,n){if(t=i(t),n=c(n,!0),a)try{return s(t,n)}catch(t){}if(u(t,n))return o(!r.f.call(t,n),t[n])}},function(t,n,e){var r=e(19);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(93);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){t.exports=e(14)},function(t,n,e){var r=e(42);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(13),o=e(1),i=e(12);t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],c={};c[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",c)}},function(t,n,e){"use strict";var r=e(109)(!0);t.exports=function(t,n,e){return n+(e?r(t,n).length:1)}},function(t,n,e){"use strict";var r=e(110),o=RegExp.prototype.exec;t.exports=function(t,n){var e=t.exec;if("function"==typeof e){var i=e.call(t,n);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},function(t,n,e){"use strict";e(112);var r=e(20),o=e(4),i=e(30),c=e(19),u=e(0),a=e(39),s=u("species"),f=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),l=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var e="ab".split(t);return 2===e.length&&"a"===e[0]&&"b"===e[1]}();t.exports=function(t,n,e){var p=u(t),v=!i(function(){var n={};return n[p]=function(){return 7},7!=""[t](n)}),h=v?!i(function(){var n=!1,e=/a/;return e.exec=function(){return n=!0,null},"split"===t&&(e.constructor={},e.constructor[s]=function(){return e}),e[p](""),!n}):void 0;if(!v||!h||"replace"===t&&!f||"split"===t&&!l){var y=/./[p],d=e(c,p,""[t],function(t,n,e,r,o){return n.exec===a?v&&!o?{done:!0,value:y.call(n,e,r)}:{done:!0,value:t.call(e,n,r)}:{done:!1}}),g=d[0],b=d[1];r(String.prototype,t,g),o(RegExp.prototype,p,2==n?function(t,n){return b.call(t,this,n)}:function(t){return b.call(t,this)})}}},function(t,n,e){for(var r=e(73),o=e(51),i=e(20),c=e(3),u=e(4),a=e(31),s=e(0),f=s("iterator"),l=s("toStringTag"),p=a.Array,v={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=o(v),y=0;y<h.length;y++){var d,g=h[y],b=v[g],m=c[g],x=m&&m.prototype;if(x&&(x[f]||u(x,f,p),x[l]||u(x,l,g),a[g]=p,b))for(d in r)x[d]||i(x,d,r[d],!0)}},function(t,n,e){"use strict";var r=e(74),o=e(77),i=e(31),c=e(32);t.exports=e(79)(Array,"Array",function(t,n){this._t=c(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n,e){var r=e(0)("unscopables"),o=Array.prototype;null==o[r]&&e(4)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,n,e){t.exports=!e(11)&&!e(30)(function(){return 7!=Object.defineProperty(e(47)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(18);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){var r=e(33);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n,e){"use strict";var r=e(46),o=e(49),i=e(20),c=e(4),u=e(31),a=e(81),s=e(53),f=e(88),l=e(0)("iterator"),p=!([].keys&&"next"in[].keys()),v=function(){return this};t.exports=function(t,n,e,h,y,d,g){a(e,n,h);var b,m,x,w=function(t){if(!p&&t in j)return j[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},S=n+" Iterator",O="values"==y,_=!1,j=t.prototype,P=j[l]||j["@@iterator"]||y&&j[y],k=P||w(y),E=y?O?w("entries"):k:void 0,T="Array"==n&&j.entries||P;if(T&&(x=f(T.call(new t)))!==Object.prototype&&x.next&&(s(x,S,!0),r||"function"==typeof x[l]||c(x,l,v)),O&&P&&"values"!==P.name&&(_=!0,k=function(){return P.call(this)}),r&&!g||!p&&!_&&j[l]||c(j,l,k),u[n]=k,u[S]=v,y)if(b={values:O?k:w("values"),keys:d?k:w("keys"),entries:E},g)for(m in b)m in j||i(j,m,b[m]);else o(o.P+o.F*(p||_),n,b);return b}},function(t,n,e){var r=e(50);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){"use strict";var r=e(82),o=e(48),i=e(53),c={};e(4)(c,e(0)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(c,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){var r=e(7),o=e(83),i=e(52),c=e(34)("IE_PROTO"),u=function(){},a=function(){var t,n=e(47)("iframe"),r=i.length;for(n.style.display="none",e(87).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;r--;)delete a.prototype[i[r]];return a()};t.exports=Object.create||function(t,n){var e;return null!==t?(u.prototype=r(t),e=new u,u.prototype=null,e[c]=t):e=a(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(17),o=e(7),i=e(51);t.exports=e(11)?Object.defineProperties:function(t,n){o(t);for(var e,c=i(n),u=c.length,a=0;u>a;)r.f(t,e=c[a++],n[e]);return t}},function(t,n,e){var r=e(21),o=e(32),i=e(85)(!1),c=e(34)("IE_PROTO");t.exports=function(t,n){var e,u=o(t),a=0,s=[];for(e in u)e!=c&&r(u,e)&&s.push(e);for(;n.length>a;)r(u,e=n[a++])&&(~i(s,e)||s.push(e));return s}},function(t,n,e){var r=e(32),o=e(40),i=e(86);t.exports=function(t){return function(n,e,c){var u,a=r(n),s=o(a.length),f=i(c,s);if(t&&e!=e){for(;s>f;)if((u=a[f++])!=u)return!0}else for(;s>f;f++)if((t||f in a)&&a[f]===e)return t||f||0;return!t&&-1}}},function(t,n,e){var r=e(23),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(3).document;t.exports=r&&r.documentElement},function(t,n,e){var r=e(21),o=e(64),i=e(34)("IE_PROTO"),c=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,n,e){var r=e(17).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||e(11)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},function(t,n,e){t.exports=e(91)},function(t,n,e){e(92);var r=e(1).Object;t.exports=function(t,n,e){return r.defineProperty(t,n,e)}},function(t,n,e){var r=e(13);r(r.S+r.F*!e(6),"Object",{defineProperty:e(5).f})},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){t.exports={}},function(t,n,e){var r=e(5),o=e(15),i=e(26);t.exports=e(6)?Object.defineProperties:function(t,n){o(t);for(var e,c=i(n),u=c.length,a=0;u>a;)r.f(t,e=c[a++],n[e]);return t}},function(t,n,e){var r=e(58);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n,e){var r=e(9),o=e(98),i=e(99);t.exports=function(t){return function(n,e,c){var u,a=r(n),s=o(a.length),f=i(c,s);if(t&&e!=e){for(;s>f;)if((u=a[f++])!=u)return!0}else for(;s>f;f++)if((t||f in a)&&a[f]===e)return t||f||0;return!t&&-1}}},function(t,n,e){var r=e(41),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n,e){var r=e(41),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(2).document;t.exports=r&&r.documentElement},function(t,n,e){"use strict";var r=e(2),o=e(8),i=e(6),c=e(13),u=e(66),a=e(102).KEY,s=e(12),f=e(36),l=e(59),p=e(22),v=e(16),h=e(44),y=e(60),d=e(103),g=e(104),b=e(15),m=e(10),x=e(9),w=e(35),S=e(24),O=e(56),_=e(105),j=e(63),P=e(5),k=e(26),E=j.f,T=P.f,L=_.f,M=r.Symbol,C=r.JSON,A=C&&C.stringify,I=v("_hidden"),N=v("toPrimitive"),R={}.propertyIsEnumerable,F=f("symbol-registry"),D=f("symbols"),B=f("op-symbols"),G=Object.prototype,V="function"==typeof M,z=r.QObject,H=!z||!z.prototype||!z.prototype.findChild,U=i&&s(function(){return 7!=O(T({},"a",{get:function(){return T(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=E(G,n);r&&delete G[n],T(t,n,e),r&&t!==G&&T(G,n,r)}:T,W=function(t){var n=D[t]=O(M.prototype);return n._k=t,n},K=V&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},J=function(t,n,e){return t===G&&J(B,n,e),b(t),n=w(n,!0),b(e),o(D,n)?(e.enumerable?(o(t,I)&&t[I][n]&&(t[I][n]=!1),e=O(e,{enumerable:S(0,!1)})):(o(t,I)||T(t,I,S(1,{})),t[I][n]=!0),U(t,n,e)):T(t,n,e)},$=function(t,n){b(t);for(var e,r=d(n=x(n)),o=0,i=r.length;i>o;)J(t,e=r[o++],n[e]);return t},Y=function(t){var n=R.call(this,t=w(t,!0));return!(this===G&&o(D,t)&&!o(B,t))&&(!(n||!o(this,t)||!o(D,t)||o(this,I)&&this[I][t])||n)},Q=function(t,n){if(t=x(t),n=w(n,!0),t!==G||!o(D,n)||o(B,n)){var e=E(t,n);return!e||!o(D,n)||o(t,I)&&t[I][n]||(e.enumerable=!0),e}},q=function(t){for(var n,e=L(x(t)),r=[],i=0;e.length>i;)o(D,n=e[i++])||n==I||n==a||r.push(n);return r},X=function(t){for(var n,e=t===G,r=L(e?B:x(t)),i=[],c=0;r.length>c;)!o(D,n=r[c++])||e&&!o(G,n)||i.push(D[n]);return i};V||(u((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(e){this===G&&n.call(B,e),o(this,I)&&o(this[I],t)&&(this[I][t]=!1),U(this,t,S(1,e))};return i&&H&&U(G,t,{configurable:!0,set:n}),W(t)}).prototype,"toString",function(){return this._k}),j.f=Q,P.f=J,e(62).f=_.f=q,e(38).f=Y,e(61).f=X,i&&!e(25)&&u(G,"propertyIsEnumerable",Y,!0),h.f=function(t){return W(v(t))}),c(c.G+c.W+c.F*!V,{Symbol:M});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)v(Z[tt++]);for(var nt=k(v.store),et=0;nt.length>et;)y(nt[et++]);c(c.S+c.F*!V,"Symbol",{for:function(t){return o(F,t+="")?F[t]:F[t]=M(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var n in F)if(F[n]===t)return n},useSetter:function(){H=!0},useSimple:function(){H=!1}}),c(c.S+c.F*!V,"Object",{create:function(t,n){return void 0===n?O(t):$(O(t),n)},defineProperty:J,defineProperties:$,getOwnPropertyDescriptor:Q,getOwnPropertyNames:q,getOwnPropertySymbols:X}),C&&c(c.S+c.F*(!V||s(function(){var t=M();return"[null]"!=A([t])||"{}"!=A({a:t})||"{}"!=A(Object(t))})),"JSON",{stringify:function(t){for(var n,e,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(e=n=r[1],(m(n)||void 0!==t)&&!K(t))return g(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!K(n))return n}),r[1]=n,A.apply(C,r)}}),M.prototype[N]||e(14)(M.prototype,N,M.prototype.valueOf),l(M,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n,e){var r=e(22)("meta"),o=e(10),i=e(8),c=e(5).f,u=0,a=Object.isExtensible||function(){return!0},s=!e(12)(function(){return a(Object.preventExtensions({}))}),f=function(t){c(t,r,{value:{i:"O"+ ++u,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!a(t))return"F";if(!n)return"E";f(t)}return t[r].i},getWeak:function(t,n){if(!i(t,r)){if(!a(t))return!0;if(!n)return!1;f(t)}return t[r].w},onFreeze:function(t){return s&&l.NEED&&a(t)&&!i(t,r)&&f(t),t}}},function(t,n,e){var r=e(26),o=e(61),i=e(38);t.exports=function(t){var n=r(t),e=o.f;if(e)for(var c,u=e(t),a=i.f,s=0;u.length>s;)a.call(t,c=u[s++])&&n.push(c);return n}},function(t,n,e){var r=e(58);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(9),o=e(62).f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return c.slice()}}(t):o(r(t))}},function(t,n,e){"use strict";var r=e(107),o=e(7),i=e(108),c=e(69),u=e(40),a=e(70),s=e(39),f=Math.min,l=[].push,p=!!function(){try{return new RegExp("x","y")}catch(t){}}();e(71)("split",2,function(t,n,e,v){var h;return h="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var o=String(this);if(void 0===t&&0===n)return[];if(!r(t))return e.call(o,t,n);for(var i,c,u,a=[],f=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),p=0,v=void 0===n?4294967295:n>>>0,h=new RegExp(t.source,f+"g");(i=s.call(h,o))&&!((c=h.lastIndex)>p&&(a.push(o.slice(p,i.index)),i.length>1&&i.index<o.length&&l.apply(a,i.slice(1)),u=i[0].length,p=c,a.length>=v));)h.lastIndex===i.index&&h.lastIndex++;return p===o.length?!u&&h.test("")||a.push(""):a.push(o.slice(p)),a.length>v?a.slice(0,v):a}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function(e,r){var o=t(this),i=null==e?void 0:e[n];return void 0!==i?i.call(e,o,r):h.call(String(o),e,r)},function(t,n){var r=v(h,t,this,n,h!==e);if(r.done)return r.value;var s=o(t),l=String(this),y=i(s,RegExp),d=s.unicode,g=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(p?"y":"g"),b=new y(p?s:"^(?:"+s.source+")",g),m=void 0===n?4294967295:n>>>0;if(0===m)return[];if(0===l.length)return null===a(b,l)?[l]:[];for(var x=0,w=0,S=[];w<l.length;){b.lastIndex=p?w:0;var O,_=a(b,p?l:l.slice(w));if(null===_||(O=f(u(b.lastIndex+(p?0:w)),l.length))===x)w=c(l,w,d);else{if(S.push(l.slice(x,w)),S.length===m)return S;for(var j=1;j<=_.length-1;j++)if(S.push(_[j]),S.length===m)return S;w=x=O}}return S.push(l.slice(x)),S}]})},function(t,n,e){var r=e(18),o=e(33),i=e(0)("match");t.exports=function(t){var n;return r(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,e){var r=e(7),o=e(50),i=e(0)("species");t.exports=function(t,n){var e,c=r(t).constructor;return void 0===c||null==(e=r(c)[i])?n:o(e)}},function(t,n,e){var r=e(23),o=e(19);t.exports=function(t){return function(n,e){var i,c,u=String(o(n)),a=r(e),s=u.length;return a<0||a>=s?t?"":void 0:(i=u.charCodeAt(a))<55296||i>56319||a+1===s||(c=u.charCodeAt(a+1))<56320||c>57343?t?u.charAt(a):i:t?u.slice(a,a+2):c-56320+(i-55296<<10)+65536}}},function(t,n,e){var r=e(33),o=e(0)("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var n,e,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?e:i?r(n):"Object"==(c=r(n))&&"function"==typeof n.callee?"Arguments":c}},function(t,n,e){"use strict";var r=e(7);t.exports=function(){var t=r(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,e){"use strict";var r=e(39);e(49)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},,function(t,n,e){"use strict";var r=e(25),o=e(13),i=e(66),c=e(14),u=e(94),a=e(128),s=e(59),f=e(115),l=e(16)("iterator"),p=!([].keys&&"next"in[].keys()),v=function(){return this};t.exports=function(t,n,e,h,y,d,g){a(e,n,h);var b,m,x,w=function(t){if(!p&&t in j)return j[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},S=n+" Iterator",O="values"==y,_=!1,j=t.prototype,P=j[l]||j["@@iterator"]||y&&j[y],k=P||w(y),E=y?O?w("entries"):k:void 0,T="Array"==n&&j.entries||P;if(T&&(x=f(T.call(new t)))!==Object.prototype&&x.next&&(s(x,S,!0),r||"function"==typeof x[l]||c(x,l,v)),O&&P&&"values"!==P.name&&(_=!0,k=function(){return P.call(this)}),r&&!g||!p&&!_&&j[l]||c(j,l,k),u[n]=k,u[S]=v,y)if(b={values:O?k:w("values"),keys:d?k:w("keys"),entries:E},g)for(m in b)m in j||i(j,m,b[m]);else o(o.P+o.F*(p||_),n,b);return b}},function(t,n,e){var r=e(8),o=e(67),i=e(43)("IE_PROTO"),c=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,n,e){t.exports=e(141)},function(t,n){t.exports=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}},function(t,n,e){var r=e(90);function o(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),r(t,o.key,o)}}t.exports=function(t,n,e){return n&&o(t.prototype,n),e&&o(t,e),t}},function(t,n,e){var r=e(123),o=e(27);t.exports=function(t,n){return!n||"object"!==r(n)&&"function"!=typeof n?o(t):n}},function(t,n,e){var r=e(138),o=e(116);function i(n){return t.exports=i=o?r:function(t){return t.__proto__||r(t)},i(n)}t.exports=i},function(t,n,e){var r=e(144),o=e(147);t.exports=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=r(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&o(t,n)}},function(t,n,e){"use strict";e.r(n);e(72),e(89);var r=e(117),o=e.n(r),i=e(118),c=e.n(i),u=e(119),a=e.n(u),s=e(120),f=e.n(s),l=e(121),p=e.n(l),v=e(27),h=e.n(v);e(106);!function(t,n,e){if(t){var r=t.element,i=r.RawHTML,u=r.Component,s=r.createElement,l=t.i18n,v=l.__,y=l._x,d=t.components,g=d.Path,b=d.Rect,m=d.SVG,x=t.keycodes,w=x.BACKSPACE,S=x.DELETE,O=x.F10,_=t.hooks.addFilter,j=t.data,P=j.dispatch,k=j.select,E=t.editPost.PluginBlockSettingsMenuItem,T=t.plugins.registerPlugin,L=t.richText,M=L.join,C=(L.split,L.create),A=L.toHTMLString,I=(n.get,n.assign),N=t.blocks,R=N.registerBlockType,F=N.setDefaultBlockName,D=(N.setFreeformContentHandlerName,N.createBlock),B=N.getBlockContent,G=N.rawHandler;if(e.hybridMode){var V="core/freeform";e.classicParagraph&&(V="tadv/classic-paragraph"),_("blocks.registerBlockType","tadv-reregister-blocks",function(t,n){return"core/freeform"===n&&(t=W,setTimeout(function(){F(V)},0)),t})}var z,H=function(n){function e(t){var n;return o()(this,e),(n=a()(this,f()(e).call(this,t))).initialize=n.initialize.bind(h()(h()(n))),n.onSetup=n.onSetup.bind(h()(h()(n))),n.focus=n.focus.bind(h()(h()(n))),n}return p()(e,n),c()(e,[{key:"componentDidMount",value:function(){var t=window.wpEditorL10n.tinymce,n=t.baseURL,e=t.suffix;window.tinymce.EditorManager.overrideDefaults({base_url:n,suffix:e}),"complete"===document.readyState?this.initialize():window.addEventListener("DOMContentLoaded",this.initialize)}},{key:"componentWillUnmount",value:function(){window.addEventListener("DOMContentLoaded",this.initialize),t.oldEditor.remove("editor-".concat(this.props.clientId))}},{key:"componentDidUpdate",value:function(t){var n=this.props,e=n.clientId,r=n.isSelected,o=n.attributes.content,i=window.tinymce.get("editor-".concat(e));t.attributes.content!==o&&this.content!==o&&i.setContent(o||""),!r&&i.initialized&&i.fire("blur",{wpBlockDidUpdate:!0})}},{key:"initialize",value:function(){var n=this.props,e=n.clientId,r=n.setAttributes,o=window.wpEditorL10n.tinymce.settings;t.oldEditor.initialize("editor-".concat(e),{tinymce:I({},o,{inline:!0,content_css:!1,fixed_toolbar_container:"#toolbar-".concat(e),setup:this.onSetup})}),r({id:e})}},{key:"onSetup",value:function(t){var n,e=this,r=this.props,o=r.attributes.content,i=r.setAttributes;this.ref;this.editor=t,o&&t.on("loadContent",function(){return t.setContent(o)}),t.on("blur",function(r){if(!r.wpBlockDidUpdate){n=t.selection.getBookmark(2,!0),e.content=t.getContent();var o=e.props.isSelected;return i({content:e.content}),t.once("focus",function(){n&&t.selection.moveToBookmark(n)}),!o&&void 0}}),t.on("mousedown touchstart",function(){n=null}),t.on("keydown",function(n){n.keyCode!==w&&n.keyCode!==S||!function(t){var n=t.getBody();return!(n.childNodes.length>1)&&(0===n.childNodes.length||!(n.childNodes[0].childNodes.length>1)&&/^\n?$/.test(n.innerText||n.textContent))}(t)||(e.props.onReplace([]),n.preventDefault(),n.stopImmediatePropagation()),n.altKey&&n.keyCode===O&&n.stopPropagation()}),t.on("init",function(){var t=e.editor.getBody();document.activeElement===t&&(t.blur(),e.editor.focus())})}},{key:"focus",value:function(){this.editor&&this.editor.focus()}},{key:"onToolbarKeyDown",value:function(t){t.stopPropagation(),t.nativeEvent.stopImmediatePropagation()}},{key:"render",value:function(){var t=this,n=this.props,e=n.clientId,r=n.name;return[s("div",{key:"toolbar",id:"toolbar-".concat(e),ref:function(n){return t.ref=n},className:"block-library-classic__toolbar",onClick:this.focus,"data-placeholder":J(r),onKeyDown:this.onToolbarKeyDown}),s("div",{key:"editor",id:"editor-".concat(e),className:"wp-block-freeform block-library-rich-text__tinymce"})]}}]),e}(u),U={keywords:[v("text")],category:"common",icon:"welcome-widgets-menus",attributes:{content:{type:"string",source:"html"}},merge:function(t,n){return{content:t.content+n.content}},edit:H,save:function(t){var n=t.attributes;return s(i,null,n.content)}},W=I({},U,{title:J("core/freeform"),name:"core/freeform",description:v("Use the classic WordPress editor."),supports:{className:!1,customClassName:!1,reusable:!1},icon:s(m,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},s(g,{d:"M0,0h24v24H0V0z M0,0h24v24H0V0z",fill:"none"}),s(g,{d:"m20 7v10h-16v-10h16m0-2h-16c-1.1 0-1.99 0.9-1.99 2l-0.01 10c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2v-10c0-1.1-0.9-2-2-2z"}),s(b,{x:"11",y:"8",width:"2",height:"2"}),s(b,{x:"11",y:"11",width:"2",height:"2"}),s(b,{x:"8",y:"8",width:"2",height:"2"}),s(b,{x:"8",y:"11",width:"2",height:"2"}),s(b,{x:"5",y:"11",width:"2",height:"2"}),s(b,{x:"5",y:"8",width:"2",height:"2"}),s(b,{x:"8",y:"14",width:"8",height:"2"}),s(b,{x:"14",y:"11",width:"2",height:"2"}),s(b,{x:"14",y:"8",width:"2",height:"2"}),s(b,{x:"17",y:"11",width:"2",height:"2"}),s(b,{x:"17",y:"8",width:"2",height:"2"}))}),K=I({},U,{title:J("tadv/classic-paragraph"),name:"tadv/classic-paragraph",description:e.description,supports:{className:!1,customClassName:!1,reusable:!0},transforms:{from:(z=[],["core/freeform","core/code","core/cover","core/embed","core/gallery","core/heading","core/html","core/image","core/list","core/media-text","core/preformatted","core/nextpage","core/more","core/quote","core/pullquote","core/separator","core/subhead","core/table","core/verse","core/video","core/audio"].forEach(function(t){z.push({type:"block",blocks:[t],transform:function(n){var e=B(D(t,n));return e&&!/<\/div>\s*/.test(e)||(e+='<p><br data-mce-bogus="1"></p>'),D("tadv/classic-paragraph",{content:e})}})}),z.push({type:"raw",priority:21,isMatch:function(){return!0}},{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:function(t){var n=A({value:M(t.map(function(t){var n=t.content;return C({html:n})}),"\u2028"),multilineTag:"p"});return D("tadv/classic-paragraph",{content:n})}}),z),to:[{type:"block",blocks:["core/freeform"],transform:function(t){return D("core/freeform",t)}},{type:"block",blocks:["core/html"],transform:function(t){return D("core/html",t)}}]}});e.classicParagraph&&(R("tadv/classic-paragraph",K),T("tadv-add-submenu",{render:function(){return s(E,{allowedBlocks:["tadv/classic-paragraph"],icon:"screenoptions",label:v("Convert to Blocks"),onClick:function(){var t=k("core/editor").getSelectedBlock();t&&P("core/editor").replaceBlocks(t.clientId,G({HTML:t.attributes.content}))},small:null,role:"menuitem"})}}))}function J(t){return"core/freeform"===t?y("Classic","block title"):e.classicParagraphTitle}}(window.wp,window.lodash,window.tadvBlockRegister)},function(t,n,e){var r=e(124),o=e(133);function i(t){return(i="function"==typeof o&&"symbol"==typeof r?function(t){return typeof t}:function(t){return t&&"function"==typeof o&&t.constructor===o&&t!==o.prototype?"symbol":typeof t})(t)}function c(n){return"function"==typeof o&&"symbol"===i(r)?t.exports=c=function(t){return i(t)}:t.exports=c=function(t){return t&&"function"==typeof o&&t.constructor===o&&t!==o.prototype?"symbol":i(t)},c(n)}t.exports=c},function(t,n,e){t.exports=e(125)},function(t,n,e){e(126),e(129),t.exports=e(44).f("iterator")},function(t,n,e){"use strict";var r=e(127)(!0);e(114)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},function(t,n,e){var r=e(41),o=e(42);t.exports=function(t){return function(n,e){var i,c,u=String(o(n)),a=r(e),s=u.length;return a<0||a>=s?t?"":void 0:(i=u.charCodeAt(a))<55296||i>56319||a+1===s||(c=u.charCodeAt(a+1))<56320||c>57343?t?u.charAt(a):i:t?u.slice(a,a+2):c-56320+(i-55296<<10)+65536}}},function(t,n,e){"use strict";var r=e(56),o=e(24),i=e(59),c={};e(14)(c,e(16)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(c,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){e(130);for(var r=e(2),o=e(14),i=e(94),c=e(16)("toStringTag"),u="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),a=0;a<u.length;a++){var s=u[a],f=r[s],l=f&&f.prototype;l&&!l[c]&&o(l,c,s),i[s]=i.Array}},function(t,n,e){"use strict";var r=e(131),o=e(132),i=e(94),c=e(9);t.exports=e(114)(Array,"Array",function(t,n){this._t=c(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n){t.exports=function(){}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){t.exports=e(134)},function(t,n,e){e(101),e(135),e(136),e(137),t.exports=e(1).Symbol},function(t,n){},function(t,n,e){e(60)("asyncIterator")},function(t,n,e){e(60)("observable")},function(t,n,e){t.exports=e(139)},function(t,n,e){e(140),t.exports=e(1).Object.getPrototypeOf},function(t,n,e){var r=e(67),o=e(115);e(68)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,n,e){e(142),t.exports=e(1).Object.setPrototypeOf},function(t,n,e){var r=e(13);r(r.S,"Object",{setPrototypeOf:e(143).set})},function(t,n,e){var r=e(10),o=e(15),i=function(t,n){if(o(t),!r(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=e(65)(Function.call,e(63).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},function(t,n,e){t.exports=e(145)},function(t,n,e){e(146);var r=e(1).Object;t.exports=function(t,n){return r.create(t,n)}},function(t,n,e){var r=e(13);r(r.S,"Object",{create:e(56)})},function(t,n,e){var r=e(116);function o(n,e){return t.exports=o=r||function(t,n){return t.__proto__=n,t},o(n,e)}t.exports=o}]);
|
1 |
+
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=11)}([function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,o){var n=o(7);t.exports=function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){n(t,e,o[e])})}return t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function o(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}},function(t,e,o){var n=o(8),r=o(0);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?r(t):e}},function(t,e){function o(e){return t.exports=o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},o(e)}t.exports=o},function(t,e,o){var n=o(9);t.exports=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}}),e&&n(t,e)}},function(t,e){t.exports=function(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}},function(t,e){function o(t){return(o="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})(t)}function n(e){return"function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?t.exports=n=function(t){return o(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":o(t)},n(e)}t.exports=n},function(t,e){function o(e,n){return t.exports=o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(e,n)}t.exports=o},,function(t,e,o){"use strict";o.r(e);var n=o(1),r=o.n(n),i=o(2),c=o.n(i),a=o(3),l=o.n(a),u=o(4),s=o.n(u),p=o(5),f=o.n(p),d=o(0),b=o.n(d),m=o(6),y=o.n(m),v=window.wp,h=v.element,g=h.Component,k=h.createElement,w=v.keycodes,x=w.BACKSPACE,S=w.DELETE,_=w.F10,O=window.tadvBlockRegister;var P=function(t){function e(t){var o;return c()(this,e),(o=s()(this,f()(e).call(this,t))).initialize=o.initialize.bind(b()(o)),o.onSetup=o.onSetup.bind(b()(o)),o.focus=o.focus.bind(b()(o)),o}return y()(e,t),l()(e,[{key:"componentDidMount",value:function(){var t=window.wpEditorL10n.tinymce,e=t.baseURL,o=t.suffix;window.tinymce.EditorManager.overrideDefaults({base_url:e,suffix:o}),"complete"===document.readyState?this.initialize():window.addEventListener("DOMContentLoaded",this.initialize)}},{key:"componentWillUnmount",value:function(){window.addEventListener("DOMContentLoaded",this.initialize),v.oldEditor.remove("editor-".concat(this.props.clientId))}},{key:"componentDidUpdate",value:function(t){var e=this.props,o=e.clientId,n=e.isSelected,r=e.attributes.content,i=window.tinymce.get("editor-".concat(o));t.attributes.content!==r&&this.content!==r&&i.setContent(r||""),!n&&i.initialized&&i.fire("blur",{wpBlockDidUpdate:!0})}},{key:"initialize",value:function(){var t=this.props,e=t.clientId,o=t.setAttributes,n=window.wpEditorL10n.tinymce.settings;v.oldEditor.initialize("editor-".concat(e),{tinymce:r()({},n,{inline:!0,content_css:!1,fixed_toolbar_container:"#toolbar-".concat(e),setup:this.onSetup})}),o({id:e})}},{key:"onSetup",value:function(t){var e,o=this,n=this.props,r=n.attributes.content,i=n.setAttributes;this.ref;this.editor=t,r&&t.on("loadContent",function(){return t.setContent(r)}),t.on("blur",function(n){if(!n.wpBlockDidUpdate){e=t.selection.getBookmark(2,!0),o.content=t.getContent();var r=o.props.isSelected;return i({content:o.content}),t.once("focus",function(){e&&t.selection.moveToBookmark(e)}),!r&&void 0}}),t.on("mousedown touchstart",function(){e=null}),t.on("keydown",function(e){e.keyCode!==x&&e.keyCode!==S||!function(t){var e=t.getBody();return!(e.childNodes.length>1)&&(0===e.childNodes.length||!(e.childNodes[0].childNodes.length>1)&&/^\n?$/.test(e.innerText||e.textContent))}(t)||(o.props.onReplace([]),e.preventDefault(),e.stopImmediatePropagation()),e.altKey&&e.keyCode===_&&e.stopPropagation()}),t.on("init",function(){var t=o.editor.getBody();document.activeElement===t&&(t.blur(),o.editor.focus())})}},{key:"focus",value:function(){this.editor&&this.editor.focus()}},{key:"onToolbarKeyDown",value:function(t){t.stopPropagation(),t.nativeEvent.stopImmediatePropagation()}},{key:"render",value:function(){var t=this,e=this.props,o=e.clientId;e.name;return[k("div",{key:"toolbar",id:"toolbar-".concat(o),ref:function(e){return t.ref=e},className:"block-library-classic__toolbar tma-classic-paragraph__toolbar",onClick:this.focus,"data-placeholder":O.classicParagraphTitle,onKeyDown:this.onToolbarKeyDown}),k("div",{key:"editor",id:"editor-".concat(o),className:"wp-block-freeform block-library-rich-text__tinymce tma-classic-paragraph"})]}}]),e}(g),B=wp.element,E=B.RawHTML,j=B.createElement;var C,M=wp.richText,T=M.join,D=(M.split,M.create),L=M.toHTMLString,N=wp.blocks,z=N.createBlock,I=N.getBlockContent,R={from:(C=[],["core/freeform","core/code","core/cover","core/embed","core/gallery","core/heading","core/html","core/image","core/list","core/media-text","core/preformatted","core/nextpage","core/more","core/quote","core/pullquote","core/separator","core/subhead","core/table","core/verse","core/video","core/audio"].forEach(function(t){C.push({type:"block",blocks:[t],transform:function(e){var o=I(z(t,e));return o&&!/<\/div>\s*/.test(o)||(o+='<p><br data-mce-bogus="1"></p>'),z("tadv/classic-paragraph",{content:o})}})}),C.push({type:"raw",priority:21,isMatch:function(){return!0}},{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:function(t){var e=L({value:T(t.map(function(t){var e=t.content;return D({html:e})}),"\u2028"),multilineTag:"p"});return z("tadv/classic-paragraph",{content:e})}},{type:"block",isMultiBlock:!0,blocks:["tadv/classic-paragraph"],transform:function(t){var e=L({value:T(t.map(function(t){var e=t.content;return D({html:e})}),"\u2028")});return z("tadv/classic-paragraph",{content:e})}},{type:"block",isMultiBlock:!0,blocks:["core/freeform"],transform:function(t){var e=L({value:T(t.map(function(t){var e=t.content;return D({html:e})}),"\u2028")});return z("tadv/classic-paragraph",{content:e})}}),C),to:[{type:"block",blocks:["core/freeform"],transform:function(t){return z("core/freeform",t)}},{type:"block",blocks:["core/html"],transform:function(t){return z("core/html",t)}}]},K=wp.i18n.__,U=window.tadvBlockRegister,A={title:U.classicParagraphTitle,description:U.description,keywords:[K("text")],icon:"welcome-widgets-menus",category:"common",name:"tadv/classic-paragraph",attributes:{content:{type:"string",source:"html"}},supports:{className:!1,customClassName:!1,reusable:!0},merge:function(t,e){return{content:(t.content||"")+(e.content||"")}},transforms:R,edit:P,save:function(t){var e=t.attributes.content;return j(E,null,e)}};!function(t,e,o){if(t){var n=t.element.createElement,r=t.i18n.__,i=(t.hooks.addFilter,t.data),c=i.dispatch,a=i.select,l=t.editPost.PluginBlockSettingsMenuItem,u=t.plugins.registerPlugin,s=t.blocks,p=s.registerBlockType,f=s.setDefaultBlockName,d=s.rawHandler;o.classicParagraph?(p("tadv/classic-paragraph",A),u("tadv-add-submenu",{render:function(){return o.hybridMode&&f("tadv/classic-paragraph"),n(l,{allowedBlocks:["tadv/classic-paragraph"],icon:"screenoptions",label:r("Convert to Blocks"),onClick:function(){var t=a("core/editor").getSelectedBlock();t&&c("core/editor").replaceBlocks(t.clientId,d({HTML:t.attributes.content}))},small:null,role:"menuitem"})}})):o.hybridMode&&u("tadv-set-default-block",{render:function(){return f("core/freeform"),null}})}}(window.wp,window.lodash,window.tadvBlockRegister)}]);
|
dist/richtext-buttons.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.tadv-buttons-panel .components-toolbar__control.tadv-icon-button{width:38px;height:38px}.tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{height:32px;width:32px}.tadv-buttons-panel .components-toolbar{border:none;display:block}.tadv-buttons-panel div.components-toolbar>div{display:inline-block;margin:0}.
|
1 |
+
.tadv-buttons-panel .components-toolbar__control.tadv-icon-button{width:38px;height:38px}.tadv-buttons-panel .components-toolbar__control.tadv-icon-button>svg{height:32px;width:32px}.tadv-buttons-panel .components-toolbar{border:none;display:block}.tadv-buttons-panel div.components-toolbar>div{display:inline-block;margin:0}.dashicons-editor-textcolor{background-color:#fff9c0;background-clip:content-box}
|
dist/richtext-buttons.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=158)}([function(t,n,r){var e=r(45)("wks"),o=r(29),i=r(3).Symbol,c="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=c&&i[t]||(c?i:o)("Symbol."+t))}).store=e},function(t,n){var r=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=r)},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n,r){var e=r(17),o=r(48);t.exports=r(11)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(15),o=r(54),i=r(35),c=Object.defineProperty;n.f=r(6)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return c(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){t.exports=!r(12)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(18);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(96),o=r(42);t.exports=function(t){return e(o(t))}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){t.exports=!r(30)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(2),o=r(1),i=r(65),c=r(14),u=r(8),a=function(t,n,r){var l,s,f,p=t&a.F,v=t&a.G,d=t&a.S,h=t&a.P,y=t&a.B,g=t&a.W,m=v?o:o[n]||(o[n]={}),b=m.prototype,x=v?e:d?e[n]:(e[n]||{}).prototype;for(l in v&&(r=n),r)(s=!p&&x&&void 0!==x[l])&&u(m,l)||(f=s?x[l]:r[l],m[l]=v&&"function"!=typeof x[l]?r[l]:y&&s?i(f,e):g&&x[l]==f?function(t){var n=function(n,r,e){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,e)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(f):h&&"function"==typeof f?i(Function.call,f):f,h&&((m.virtual||(m.virtual={}))[l]=f,t&a.R&&b&&!b[l]&&c(b,l,f)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n,r){var e=r(5),o=r(24);t.exports=r(6)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(10);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n,r){var e=r(36)("wks"),o=r(22),i=r(2).Symbol,c="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=c&&i[t]||(c?i:o)("Symbol."+t))}).store=e},function(t,n,r){var e=r(7),o=r(75),i=r(76),c=Object.defineProperty;n.f=r(11)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return c(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(3),o=r(4),i=r(21),c=r(29)("src"),u=Function.toString,a=(""+u).split("toString");r(28).inspectSource=function(t){return u.call(t)},(t.exports=function(t,n,r,u){var l="function"==typeof r;l&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(l&&(i(r,c)||o(r,c,t[n]?""+t[n]:a.join(String(n)))),t===e?t[n]=r:u?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[c]||u.call(this)})},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){t.exports=!0},function(t,n,r){var e=r(57),o=r(37);t.exports=Object.keys||function(t){return e(t,o)}},,function(t,n){var r=t.exports={version:"2.6.1"};"number"==typeof __e&&(__e=r)},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){t.exports={}},function(t,n,r){var e=r(78),o=r(19);t.exports=function(t){return e(o(t))}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(45)("keys"),o=r(29);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n,r){var e=r(10);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(1),o=r(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(25)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){"use strict";var e,o,i=r(111),c=RegExp.prototype.exec,u=String.prototype.replace,a=c,l=(e=/a/,o=/b*/g,c.call(e,"a"),c.call(o,"a"),0!==e.lastIndex||0!==o.lastIndex),s=void 0!==/()??/.exec("")[1];(l||s)&&(a=function(t){var n,r,e,o,a=this;return s&&(r=new RegExp("^"+a.source+"$(?!\\s)",i.call(a))),l&&(n=a.lastIndex),e=c.call(a,t),l&&e&&(a.lastIndex=a.global?e.index+e[0].length:n),s&&e&&e.length>1&&u.call(e[0],r,function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(e[o]=void 0)}),e}),t.exports=a},function(t,n,r){var e=r(23),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(36)("keys"),o=r(22);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n,r){n.f=r(16)},function(t,n,r){var e=r(28),o=r(3),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(46)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports=!1},function(t,n,r){var e=r(18),o=r(3).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){var e=r(3),o=r(28),i=r(4),c=r(20),u=r(80),a=function(t,n,r){var l,s,f,p,v=t&a.F,d=t&a.G,h=t&a.S,y=t&a.P,g=t&a.B,m=d?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,b=d?o:o[n]||(o[n]={}),x=b.prototype||(b.prototype={});for(l in d&&(r=n),r)f=((s=!v&&m&&void 0!==m[l])?m:r)[l],p=g&&s?u(f,e):y&&"function"==typeof f?u(Function.call,f):f,m&&c(m,l,f,t&a.U),b[l]!=f&&i(b,l,p),y&&x[l]!=f&&(x[l]=f)};e.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(84),o=r(52);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(17).f,o=r(21),i=r(0)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){t.exports=!r(6)&&!r(12)(function(){return 7!=Object.defineProperty(r(55)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(10),o=r(2).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(15),o=r(95),i=r(37),c=r(43)("IE_PROTO"),u=function(){},a=function(){var t,n=r(55)("iframe"),e=i.length;for(n.style.display="none",r(100).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a.prototype[i[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(u.prototype=e(t),r=new u,u.prototype=null,r[c]=t):r=a(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(8),o=r(9),i=r(97)(!1),c=r(43)("IE_PROTO");t.exports=function(t,n){var r,u=o(t),a=0,l=[];for(r in u)r!=c&&e(u,r)&&l.push(r);for(;n.length>a;)e(u,r=n[a++])&&(~i(l,r)||l.push(r));return l}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(5).f,o=r(8),i=r(16)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(2),o=r(1),i=r(25),c=r(44),u=r(5).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||u(n,t,{value:c.f(t)})}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(57),o=r(37).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){var e=r(38),o=r(24),i=r(9),c=r(35),u=r(8),a=r(54),l=Object.getOwnPropertyDescriptor;n.f=r(6)?l:function(t,n){if(t=i(t),n=c(n,!0),a)try{return l(t,n)}catch(t){}if(u(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){var e=r(19);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(93);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){t.exports=r(14)},function(t,n,r){var e=r(42);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(13),o=r(1),i=r(12);t.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],c={};c[t]=n(r),e(e.S+e.F*i(function(){r(1)}),"Object",c)}},function(t,n,r){"use strict";var e=r(109)(!0);t.exports=function(t,n,r){return n+(r?e(t,n).length:1)}},function(t,n,r){"use strict";var e=r(110),o=RegExp.prototype.exec;t.exports=function(t,n){var r=t.exec;if("function"==typeof r){var i=r.call(t,n);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==e(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},function(t,n,r){"use strict";r(112);var e=r(20),o=r(4),i=r(30),c=r(19),u=r(0),a=r(39),l=u("species"),s=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),f=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();t.exports=function(t,n,r){var p=u(t),v=!i(function(){var n={};return n[p]=function(){return 7},7!=""[t](n)}),d=v?!i(function(){var n=!1,r=/a/;return r.exec=function(){return n=!0,null},"split"===t&&(r.constructor={},r.constructor[l]=function(){return r}),r[p](""),!n}):void 0;if(!v||!d||"replace"===t&&!s||"split"===t&&!f){var h=/./[p],y=r(c,p,""[t],function(t,n,r,e,o){return n.exec===a?v&&!o?{done:!0,value:h.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}}),g=y[0],m=y[1];e(String.prototype,t,g),o(RegExp.prototype,p,2==n?function(t,n){return m.call(t,this,n)}:function(t){return m.call(t,this)})}}},function(t,n,r){for(var e=r(73),o=r(51),i=r(20),c=r(3),u=r(4),a=r(31),l=r(0),s=l("iterator"),f=l("toStringTag"),p=a.Array,v={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(v),h=0;h<d.length;h++){var y,g=d[h],m=v[g],b=c[g],x=b&&b.prototype;if(x&&(x[s]||u(x,s,p),x[f]||u(x,f,g),a[g]=p,m))for(y in e)x[y]||i(x,y,e[y],!0)}},function(t,n,r){"use strict";var e=r(74),o=r(77),i=r(31),c=r(32);t.exports=r(79)(Array,"Array",function(t,n){this._t=c(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,e("keys"),e("values"),e("entries")},function(t,n,r){var e=r(0)("unscopables"),o=Array.prototype;null==o[e]&&r(4)(o,e,{}),t.exports=function(t){o[e][t]=!0}},function(t,n,r){t.exports=!r(11)&&!r(30)(function(){return 7!=Object.defineProperty(r(47)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(18);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){var e=r(33);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){"use strict";var e=r(46),o=r(49),i=r(20),c=r(4),u=r(31),a=r(81),l=r(53),s=r(88),f=r(0)("iterator"),p=!([].keys&&"next"in[].keys()),v=function(){return this};t.exports=function(t,n,r,d,h,y,g){a(r,n,d);var m,b,x,w=function(t){if(!p&&t in j)return j[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},S=n+" Iterator",O="values"==h,k=!1,j=t.prototype,C=j[f]||j["@@iterator"]||h&&j[h],P=C||w(h),T=h?O?w("entries"):P:void 0,E="Array"==n&&j.entries||C;if(E&&(x=s(E.call(new t)))!==Object.prototype&&x.next&&(l(x,S,!0),e||"function"==typeof x[f]||c(x,f,v)),O&&C&&"values"!==C.name&&(k=!0,P=function(){return C.call(this)}),e&&!g||!p&&!k&&j[f]||c(j,f,P),u[n]=P,u[S]=v,h)if(m={values:O?P:w("values"),keys:y?P:w("keys"),entries:T},g)for(b in m)b in j||i(j,b,m[b]);else o(o.P+o.F*(p||k),n,m);return m}},function(t,n,r){var e=r(50);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){"use strict";var e=r(82),o=r(48),i=r(53),c={};r(4)(c,r(0)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(c,{next:o(1,r)}),i(t,n+" Iterator")}},function(t,n,r){var e=r(7),o=r(83),i=r(52),c=r(34)("IE_PROTO"),u=function(){},a=function(){var t,n=r(47)("iframe"),e=i.length;for(n.style.display="none",r(87).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a.prototype[i[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(u.prototype=e(t),r=new u,u.prototype=null,r[c]=t):r=a(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(17),o=r(7),i=r(51);t.exports=r(11)?Object.defineProperties:function(t,n){o(t);for(var r,c=i(n),u=c.length,a=0;u>a;)e.f(t,r=c[a++],n[r]);return t}},function(t,n,r){var e=r(21),o=r(32),i=r(85)(!1),c=r(34)("IE_PROTO");t.exports=function(t,n){var r,u=o(t),a=0,l=[];for(r in u)r!=c&&e(u,r)&&l.push(r);for(;n.length>a;)e(u,r=n[a++])&&(~i(l,r)||l.push(r));return l}},function(t,n,r){var e=r(32),o=r(40),i=r(86);t.exports=function(t){return function(n,r,c){var u,a=e(n),l=o(a.length),s=i(c,l);if(t&&r!=r){for(;l>s;)if((u=a[s++])!=u)return!0}else for(;l>s;s++)if((t||s in a)&&a[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(23),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=e(t))<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(3).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(21),o=r(64),i=r(34)("IE_PROTO"),c=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?c:null}},function(t,n,r){var e=r(17).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||r(11)&&e(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},function(t,n,r){t.exports=r(91)},function(t,n,r){r(92);var e=r(1).Object;t.exports=function(t,n,r){return e.defineProperty(t,n,r)}},function(t,n,r){var e=r(13);e(e.S+e.F*!r(6),"Object",{defineProperty:r(5).f})},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},,function(t,n,r){var e=r(5),o=r(15),i=r(26);t.exports=r(6)?Object.defineProperties:function(t,n){o(t);for(var r,c=i(n),u=c.length,a=0;u>a;)e.f(t,r=c[a++],n[r]);return t}},function(t,n,r){var e=r(58);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(9),o=r(98),i=r(99);t.exports=function(t){return function(n,r,c){var u,a=e(n),l=o(a.length),s=i(c,l);if(t&&r!=r){for(;l>s;)if((u=a[s++])!=u)return!0}else for(;l>s;s++)if((t||s in a)&&a[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(41),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){var e=r(41),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=e(t))<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(2).document;t.exports=e&&e.documentElement},function(t,n,r){"use strict";var e=r(2),o=r(8),i=r(6),c=r(13),u=r(66),a=r(102).KEY,l=r(12),s=r(36),f=r(59),p=r(22),v=r(16),d=r(44),h=r(60),y=r(103),g=r(104),m=r(15),b=r(10),x=r(9),w=r(35),S=r(24),O=r(56),k=r(105),j=r(63),C=r(5),P=r(26),T=j.f,E=C.f,_=k.f,N=e.Symbol,A=e.JSON,F=A&&A.stringify,M=v("_hidden"),L=v("toPrimitive"),R={}.propertyIsEnumerable,I=s("symbol-registry"),B=s("symbols"),U=s("op-symbols"),D=Object.prototype,G="function"==typeof N,z=e.QObject,$=!z||!z.prototype||!z.prototype.findChild,W=i&&l(function(){return 7!=O(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=T(D,n);e&&delete D[n],E(t,n,r),e&&t!==D&&E(D,n,e)}:E,V=function(t){var n=B[t]=O(N.prototype);return n._k=t,n},H=G&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},J=function(t,n,r){return t===D&&J(U,n,r),m(t),n=w(n,!0),m(r),o(B,n)?(r.enumerable?(o(t,M)&&t[M][n]&&(t[M][n]=!1),r=O(r,{enumerable:S(0,!1)})):(o(t,M)||E(t,M,S(1,{})),t[M][n]=!0),W(t,n,r)):E(t,n,r)},K=function(t,n){m(t);for(var r,e=y(n=x(n)),o=0,i=e.length;i>o;)J(t,r=e[o++],n[r]);return t},Y=function(t){var n=R.call(this,t=w(t,!0));return!(this===D&&o(B,t)&&!o(U,t))&&(!(n||!o(this,t)||!o(B,t)||o(this,M)&&this[M][t])||n)},Q=function(t,n){if(t=x(t),n=w(n,!0),t!==D||!o(B,n)||o(U,n)){var r=T(t,n);return!r||!o(B,n)||o(t,M)&&t[M][n]||(r.enumerable=!0),r}},X=function(t){for(var n,r=_(x(t)),e=[],i=0;r.length>i;)o(B,n=r[i++])||n==M||n==a||e.push(n);return e},Z=function(t){for(var n,r=t===D,e=_(r?U:x(t)),i=[],c=0;e.length>c;)!o(B,n=e[c++])||r&&!o(D,n)||i.push(B[n]);return i};G||(u((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(r){this===D&&n.call(U,r),o(this,M)&&o(this[M],t)&&(this[M][t]=!1),W(this,t,S(1,r))};return i&&$&&W(D,t,{configurable:!0,set:n}),V(t)}).prototype,"toString",function(){return this._k}),j.f=Q,C.f=J,r(62).f=k.f=X,r(38).f=Y,r(61).f=Z,i&&!r(25)&&u(D,"propertyIsEnumerable",Y,!0),d.f=function(t){return V(v(t))}),c(c.G+c.W+c.F*!G,{Symbol:N});for(var q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;q.length>tt;)v(q[tt++]);for(var nt=P(v.store),rt=0;nt.length>rt;)h(nt[rt++]);c(c.S+c.F*!G,"Symbol",{for:function(t){return o(I,t+="")?I[t]:I[t]=N(t)},keyFor:function(t){if(!H(t))throw TypeError(t+" is not a symbol!");for(var n in I)if(I[n]===t)return n},useSetter:function(){$=!0},useSimple:function(){$=!1}}),c(c.S+c.F*!G,"Object",{create:function(t,n){return void 0===n?O(t):K(O(t),n)},defineProperty:J,defineProperties:K,getOwnPropertyDescriptor:Q,getOwnPropertyNames:X,getOwnPropertySymbols:Z}),A&&c(c.S+c.F*(!G||l(function(){var t=N();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){for(var n,r,e=[t],o=1;arguments.length>o;)e.push(arguments[o++]);if(r=n=e[1],(b(n)||void 0!==t)&&!H(t))return g(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!H(n))return n}),e[1]=n,F.apply(A,e)}}),N.prototype[L]||r(14)(N.prototype,L,N.prototype.valueOf),f(N,"Symbol"),f(Math,"Math",!0),f(e.JSON,"JSON",!0)},function(t,n,r){var e=r(22)("meta"),o=r(10),i=r(8),c=r(5).f,u=0,a=Object.isExtensible||function(){return!0},l=!r(12)(function(){return a(Object.preventExtensions({}))}),s=function(t){c(t,e,{value:{i:"O"+ ++u,w:{}}})},f=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,e)){if(!a(t))return"F";if(!n)return"E";s(t)}return t[e].i},getWeak:function(t,n){if(!i(t,e)){if(!a(t))return!0;if(!n)return!1;s(t)}return t[e].w},onFreeze:function(t){return l&&f.NEED&&a(t)&&!i(t,e)&&s(t),t}}},function(t,n,r){var e=r(26),o=r(61),i=r(38);t.exports=function(t){var n=e(t),r=o.f;if(r)for(var c,u=r(t),a=i.f,l=0;u.length>l;)a.call(t,c=u[l++])&&n.push(c);return n}},function(t,n,r){var e=r(58);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(9),o=r(62).f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return c.slice()}}(t):o(e(t))}},function(t,n,r){"use strict";var e=r(107),o=r(7),i=r(108),c=r(69),u=r(40),a=r(70),l=r(39),s=Math.min,f=[].push,p=!!function(){try{return new RegExp("x","y")}catch(t){}}();r(71)("split",2,function(t,n,r,v){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var o=String(this);if(void 0===t&&0===n)return[];if(!e(t))return r.call(o,t,n);for(var i,c,u,a=[],s=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),p=0,v=void 0===n?4294967295:n>>>0,d=new RegExp(t.source,s+"g");(i=l.call(d,o))&&!((c=d.lastIndex)>p&&(a.push(o.slice(p,i.index)),i.length>1&&i.index<o.length&&f.apply(a,i.slice(1)),u=i[0].length,p=c,a.length>=v));)d.lastIndex===i.index&&d.lastIndex++;return p===o.length?!u&&d.test("")||a.push(""):a.push(o.slice(p)),a.length>v?a.slice(0,v):a}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:r.call(this,t,n)}:r,[function(r,e){var o=t(this),i=null==r?void 0:r[n];return void 0!==i?i.call(r,o,e):d.call(String(o),r,e)},function(t,n){var e=v(d,t,this,n,d!==r);if(e.done)return e.value;var l=o(t),f=String(this),h=i(l,RegExp),y=l.unicode,g=(l.ignoreCase?"i":"")+(l.multiline?"m":"")+(l.unicode?"u":"")+(p?"y":"g"),m=new h(p?l:"^(?:"+l.source+")",g),b=void 0===n?4294967295:n>>>0;if(0===b)return[];if(0===f.length)return null===a(m,f)?[f]:[];for(var x=0,w=0,S=[];w<f.length;){m.lastIndex=p?w:0;var O,k=a(m,p?f:f.slice(w));if(null===k||(O=s(u(m.lastIndex+(p?0:w)),f.length))===x)w=c(f,w,y);else{if(S.push(f.slice(x,w)),S.length===b)return S;for(var j=1;j<=k.length-1;j++)if(S.push(k[j]),S.length===b)return S;w=x=O}}return S.push(f.slice(x)),S}]})},function(t,n,r){var e=r(18),o=r(33),i=r(0)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,r){var e=r(7),o=r(50),i=r(0)("species");t.exports=function(t,n){var r,c=e(t).constructor;return void 0===c||null==(r=e(c)[i])?n:o(r)}},function(t,n,r){var e=r(23),o=r(19);t.exports=function(t){return function(n,r){var i,c,u=String(o(n)),a=e(r),l=u.length;return a<0||a>=l?t?"":void 0:(i=u.charCodeAt(a))<55296||i>56319||a+1===l||(c=u.charCodeAt(a+1))<56320||c>57343?t?u.charAt(a):i:t?u.slice(a,a+2):c-56320+(i-55296<<10)+65536}}},function(t,n,r){var e=r(33),o=r(0)("toStringTag"),i="Arguments"==e(function(){return arguments}());t.exports=function(t){var n,r,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?r:i?e(n):"Object"==(c=e(n))&&"function"==typeof n.callee?"Arguments":c}},function(t,n,r){"use strict";var e=r(7);t.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,r){"use strict";var e=r(39);r(49)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},function(t,n,r){var e=r(148),o=r(151),i=r(153),c=r(156);t.exports=function(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},u=i(r);"function"==typeof o&&(u=u.concat(o(r).filter(function(t){return e(r,t).enumerable}))),u.forEach(function(n){c(t,n,r[n])})}return t}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,n,r){t.exports=r(149)},function(t,n,r){r(150);var e=r(1).Object;t.exports=function(t,n){return e.getOwnPropertyDescriptor(t,n)}},function(t,n,r){var e=r(9),o=r(63).f;r(68)("getOwnPropertyDescriptor",function(){return function(t,n){return o(e(t),n)}})},function(t,n,r){t.exports=r(152)},function(t,n,r){r(101),t.exports=r(1).Object.getOwnPropertySymbols},function(t,n,r){t.exports=r(154)},function(t,n,r){r(155),t.exports=r(1).Object.keys},function(t,n,r){var e=r(67),o=r(26);r(68)("keys",function(){return function(t){return o(e(t))}})},function(t,n,r){var e=r(90);t.exports=function(t,n,r){return n in t?e(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}},function(t,n,r){"use strict";var e=r(7),o=r(64),i=r(40),c=r(23),u=r(69),a=r(70),l=Math.max,s=Math.min,f=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,v=/\$([$&`']|\d\d?)/g;r(71)("replace",2,function(t,n,r,d){return[function(e,o){var i=t(this),c=null==e?void 0:e[n];return void 0!==c?c.call(e,i,o):r.call(String(i),e,o)},function(t,n){var o=d(r,t,this,n);if(o.done)return o.value;var f=e(t),p=String(this),v="function"==typeof n;v||(n=String(n));var y=f.global;if(y){var g=f.unicode;f.lastIndex=0}for(var m=[];;){var b=a(f,p);if(null===b)break;if(m.push(b),!y)break;""===String(b[0])&&(f.lastIndex=u(p,i(f.lastIndex),g))}for(var x,w="",S=0,O=0;O<m.length;O++){b=m[O];for(var k=String(b[0]),j=l(s(c(b.index),p.length),0),C=[],P=1;P<b.length;P++)C.push(void 0===(x=b[P])?x:String(x));var T=b.groups;if(v){var E=[k].concat(C,j,p);void 0!==T&&E.push(T);var _=String(n.apply(void 0,E))}else _=h(k,p,j,C,T,n);j>=S&&(w+=p.slice(S,j)+_,S=j+k.length)}return w+p.slice(S)}];function h(t,n,e,i,c,u){var a=e+t.length,l=i.length,s=v;return void 0!==c&&(c=o(c),s=p),r.call(u,s,function(r,o){var u;switch(o.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,e);case"'":return n.slice(a);case"<":u=c[o.slice(1,-1)];break;default:var s=+o;if(0===s)return o;if(s>l){var p=f(s/10);return 0===p?o:p<=l?void 0===i[p-1]?o.charAt(1):i[p-1]+o.charAt(1):o}u=i[s-1]}return void 0===u?"":u})}})},function(t,n,r){"use strict";r.r(n);var e=r(113),o=r.n(e),i=(r(89),r(72),r(106),r(157),window.tadvBlockButtons),c=window.wp,u=window.lodash.get,a=c.element.createElement,l=c.editor,s=l.InspectorControls,f=l.PanelColorSettings,p=c.richText,v=p.registerFormatType,d=p.applyFormat,h=p.removeFormat,y=p.getActiveFormat;function g(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}var m=window.tadvBlockButtons,b=window.wp,x=b.element,w=x.createElement,S=x.Fragment,O=b.richText.registerFormatType,k=b.editor,j=k.RichTextToolbarButton,C=k.RichTextShortcut,P=b.components,T=P.Path,E=P.SVG,_=w(E,{viewBox:"-85 -985 1024 1024",xmlns:"http://www.w3.org/2000/svg"},w(T,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 754v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"})),N=w(E,{viewBox:"-85 -975 1024 1024",xmlns:"http://www.w3.org/2000/svg"},w(T,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 50v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"}));function A(t,n){var r=t.type,e=t.tagName,o=t.title,i=t.character,c=t.icon;O(r,{title:o,tagName:e,className:null,edit:function(t){var e=t.isActive,u=t.value,a=t.onChange,l=function(){return a(toggleFormat(u,{type:r}))},s=null;return n||(s=w(j,{title:o,icon:c,onClick:l,isActive:e,shortcutType:"primary",shortcutCharacter:i})),w(S,null,w(C,{type:"primary",character:i,onUse:l}),s)}})}var F=window.wp,M=window.tadvBlockButtons,L=(window.lodash.get,F.element),R=L.createElement,I=L.Fragment,B=F.i18n.__,U=F.data.select,D=F.hooks.addFilter,G=F.components,z=G.PanelBody,$=G.Toolbar,W=G.ToolbarButton,V=F.editor,H=V.RichTextToolbarButton,J=V.RichTextShortcut,K=V.InspectorControls,Y=(V.PanelColorSettings,F.richText),Q=Y.registerFormatType,X=Y.unregisterFormatType,Z=Y.getActiveFormat,q=Y.toggleFormat,tt=Y.applyFormat,nt=Y.removeFormat;var rt={"tadv/mark":function(t){Q("tadv/mark",{title:M.strMark,tagName:"mark",className:null,edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){return o(q(e,{type:"tadv/mark"}))},c=null;return t||(c=R(H,{title:M.strMark,icon:"editor-textcolor",onClick:i,className:"tadv-icon-button-mark",isActive:r,shortcutType:"access",shortcutCharacter:"m"})),R(I,null,R(J,{type:"access",character:"m",onUse:i}),c)}})},"tadv/underline":function(t){Q("tadv/underline",{title:M.strUnderline,tagName:"span",className:"underline",attributes:{style:"style"},edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){o(r?nt(e,"tadv/underline"):tt(e,{type:"tadv/underline",attributes:{style:"text-decoration: underline"}}))},c=null;return t||(c=R(H,{title:M.strUnderline,icon:"editor-underline",onClick:i,className:null,isActive:r,shortcutType:"primary",shortcutCharacter:"u"})),R(I,null,R(J,{type:"primary",character:"u",onUse:i}),c)}})},"tadv/removeformat":function(t){Q("tadv/removeformat",{title:M.strRemoveFormatting||"Remove formatting",tagName:"u",className:"remove-format",edit:function(n){n.isActive;var r=n.value,e=n.onChange;return t?null:R(H,{icon:"editor-removeformatting",title:M.strRemoveFormatting,onClick:function(){return e(o()({},r,{formats:Array(r.formats.length)}))},isActive:null})}})},"tadv/sub":function(t){A({type:"tadv/sub",tagName:"sub",title:m.strSubscript,character:",",icon:N},t)},"tadv/sup":function(t){A({type:"tadv/sup",tagName:"sup",title:m.strSuperscript,character:".",icon:_},t)},"core/code":function(t){Q("core/code",{title:B("Code"),tagName:"code",className:null,edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){return o(q(e,{type:"core/code"}))},c=null;return t||(c=R(H,{icon:"editor-code",title:B("Code"),onClick:i,isActive:r,shortcutType:"access",shortcutCharacter:"x"})),R(I,null,R(J,{type:"access",character:"x",onUse:i}),c)}})},"core/strikethrough":function(t){Q("core/strikethrough",{name:"core/strikethrough",title:B("Strikethrough"),tagName:"del",className:null,edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){return o(q(e,{type:"core/strikethrough"}))},c=null;return t||(c=R(H,{name:"strikethrough",icon:"editor-strikethrough",title:B("Strikethrough"),onClick:i,isActive:r,shortcutType:"access",shortcutCharacter:"d"})),R(I,null,R(J,{type:"access",character:"d",onUse:i}),c)}})},"core/italic":function(t){Q("core/italic",{title:B("Italic"),tagName:"em",className:null,edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){return o(q(e,{type:"core/italic"}))},c=null;return t||(c=R(H,{name:"italic",icon:"editor-italic",title:B("Italic"),onClick:i,isActive:r,shortcutType:"primary",shortcutCharacter:"i"})),R(I,null,R(J,{type:"primary",character:"i",onUse:i}),c)}})},"core/bold":function(t){Q("core/bold",{title:B("Bold"),tagName:"strong",className:null,edit:function(n){var r=n.isActive,e=n.value,o=n.onChange,i=function(){return o(q(e,{type:"core/bold"}))},c=null;return t||(c=R(H,{name:"bold",icon:"editor-bold",title:B("Bold"),onClick:i,isActive:r,shortcutType:"primary",shortcutCharacter:"b"})),R(I,null,R(J,{type:"primary",character:"b",onUse:i}),c)}})}},et=!0;function ot(){if(et){et=!1;var t=U("core/rich-text").getFormatTypes(),n=(M.buttons||"").split(","),r=M.panelButtons.split(","),e=(M.unusedButtons||"").split(",").concat(n,r);t.forEach(function(t){e.indexOf(t.name)>-1&&rt.hasOwnProperty(t.name)&&X(t.name),-1===n.indexOf("core/link")&&X("core/link")}),n.forEach(function(t){rt.hasOwnProperty(t)&&rt[t].call(null)}),function(){if(M.panelButtons){var t=M.panelButtons.split(","),n=(M.buttons||"").split(",");t.forEach(function(t){-1===n.indexOf(t)&&rt.hasOwnProperty(t)&&rt[t].call(null,"panel")}),Q("tadv/tadv-format-panel",{title:M.strFormatting,tagName:"span",className:"tadv-format-panel",edit:function(n){n.isActive;var r=n.value,e=n.onChange,i=[],c={"tadv/removeformat":function(){return R(W,{key:"tadv/removeformat",icon:"editor-removeformatting",className:"tadv-icon-button",title:M.strRemoveFormatting,onClick:function(){return e(o()({},r,{formats:Array(r.formats.length)}))}})},"core/bold":function(){return R(W,{key:"core/bold",icon:"editor-bold",className:"tadv-icon-button",isActive:Z(r,"core/bold"),title:B("Bold"),onClick:function(){return e(q(r,{type:"core/bold"}))}})},"core/italic":function(){return R(W,{key:"core/italic",icon:"editor-italic",className:"tadv-icon-button",isActive:Z(r,"core/italic"),title:B("Italic"),onClick:function(){return e(q(r,{type:"core/italic"}))}})},"core/code":function(){return R(W,{key:"core/code",icon:"editor-code",className:"tadv-icon-button",isActive:Z(r,"core/code"),title:B("Code"),onClick:function(){return e(q(r,{type:"core/code"}))}})},"core/strikethrough":function(){return R(W,{key:"core/strikethrough",icon:"editor-strikethrough",className:"tadv-icon-button",isActive:Z(r,"core/strikethrough"),title:B("Strikethrough"),onClick:function(){return e(q(r,{type:"core/strikethrough"}))}})},"tadv/mark":function(){return R(W,{key:"tadv/mark",icon:"editor-textcolor",className:"tadv-icon-button tadv-icon-button-mark",isActive:Z(r,"tadv/mark"),title:M.strMark,onClick:function(){return e(q(r,{type:"tadv/mark"}))}})},"tadv/sup":function(){return R(W,{key:"tadv/sup",icon:_,className:"tadv-icon-button",isActive:Z(r,"tadv/sup"),title:M.strSuperscript,onClick:function(){return e(q(r,{type:"tadv/sup"}))}})},"tadv/sub":function(){return R(W,{key:"tadv/sub",icon:N,className:"tadv-icon-button",isActive:Z(r,"tadv/sub"),title:M.strSubscript,onClick:function(){return e(q(r,{type:"tadv/sub"}))}})},"tadv/underline":function(){return R(W,{key:"tadv/underline",icon:"editor-underline",className:"tadv-icon-button",isActive:Z(r,"tadv/underline"),title:M.strUnderline,onClick:function(){Z(r,"tadv/underline")?e(nt(r,"tadv/underline")):e(tt(r,{type:"tadv/underline",attributes:{style:"text-decoration: underline"}}))}})}};return t.forEach(function(t){c.hasOwnProperty(t)&&i.push(c[t].call(null))}),R(K,null,R(z,{title:M.strFormatting,className:"tadv-buttons-panel"},R($,null,i)))}})}}(),function(){if(i.colorPanel){var t=i.colorPanel.indexOf("tadv/color-panel")>-1,n=i.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&v("tadv/color-panel",{title:i.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit:function(t){var r,e,o=t.isActive,c=t.value,l=t.onChange;if(o){var p=y(c,"tadv/color-panel"),v=u(p,["attributes","style"])||"",m=y(c,"tadv/background-color-panel"),b=u(m,["attributes","style"])||"";r=g(v),e=g(b)}var x=[{value:r,onChange:function(t){l(t?d(c,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):h(c,"tadv/color-panel"))},label:i.strTextColorLabel}];return n&&x.push({value:e,onChange:function(t){l(t?d(c,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):h(c,"tadv/background-color-panel"))},label:i.strBackgroundColorLabel}),a(s,null,a(f,{title:i.strTextColor,initialOpen:!1,colorSettings:x}))}}),v("tadv/background-color-panel",{title:i.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit:function(r){var e,o=r.isActive,c=r.value,l=r.onChange;if(!n||t)return null;if(o){var p=y(c,"tadv/background-color-panel");e=g(u(p,["attributes","style"])||"")}var v=[{value:e,onChange:function(t){l(t?d(c,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):h(c,"tadv/background-color-panel"))},label:i.strBackgroundColorLabel}];return a(s,null,a(f,{title:i.strTextColor,initialOpen:!1,colorSettings:v}))}})}}()}}D("blocks.registerBlockType","tadv-register-formats",function(t){return ot(),t})}]);
|
1 |
+
!function(t){var e={};function r(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,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}({10:function(t,e,r){"use strict";r.r(e);var o=window.tadvBlockButtons,n=window.wp,a=window.lodash.get,i=n.element.createElement,c=n.editor,l=c.InspectorControls,u=c.PanelColorSettings,s=n.richText,d=s.registerFormatType,v=s.applyFormat,m=s.removeFormat,p=s.getActiveFormat;function f(t){return(t=t.replace(/.*?(background-)?color:\s*/,"")).replace(/[; ]+$/,"")}var h,g=window.tadvBlockButtons||{},b=window.wp,y=b.editor.RichTextToolbarButton,k=b.richText,T=k.registerFormatType,w=k.removeFormat,x=b.element.createElement,F=b.components.ToolbarButton;function C(t){var e=[];return h||(h=g.formats_to_remove?g.formats_to_remove.split(","):["core/bold","core/italic","core/code","core/underline","core/strikethrough","tadv/sup","tadv/sub","tadv/mark","tadv/color-panel","tadv/background-color-panel"]),t.forEach(function(t){t&&t.forEach(function(t){h.indexOf(t.type)>-1&&-1===e.indexOf(t.type)&&e.push(t.type)})}),e}function B(t){var e=t.formats;if(!e.length)return t;var r=0,o=e.length;t.end>t.start&&(r=t.start,o=t.end,e=e.slice(r,o));var n=C(e);return n.length?(n.forEach(function(e){t=w(t,e,r,o)}),t):t}var N=window.wp,A=(window.tadvBlockButtons,N.element),S=A.createElement,_=A.Fragment,R=N.i18n.__,E=N.components.ToolbarButton,O=N.editor,P=O.RichTextToolbarButton,M=O.RichTextShortcut,U=N.richText,j=U.registerFormatType,z=U.getActiveFormat,I=U.toggleFormat;U.applyFormat,U.removeFormat;function L(t,e){e(I(t,{type:"core/strikethrough"}))}var G=window.wp,V=G.element,$=V.createElement,q=V.Fragment,D=G.i18n.__,H=G.components.ToolbarButton,J=G.editor,K=J.RichTextToolbarButton,Q=J.RichTextShortcut,W=G.richText,X=W.registerFormatType,Y=W.getActiveFormat,Z=W.toggleFormat;function tt(t,e){e(Z(t,{type:"core/code"}))}var et=window.wp,rt=window.tadvBlockButtons||{},ot=et.element,nt=ot.createElement,at=ot.Fragment,it=(et.i18n.__,et.components.ToolbarButton),ct=et.editor,lt=ct.RichTextToolbarButton,ut=ct.RichTextShortcut,st=et.richText,dt=st.registerFormatType,vt=st.getActiveFormat,mt=st.toggleFormat;st.applyFormat,st.removeFormat;function pt(t,e){e(mt(t,{type:"tadv/mark"}))}var ft=window.wp,ht=window.tadvBlockButtons||{},gt=ft.element,bt=gt.createElement,yt=gt.Fragment,kt=(ft.i18n.__,ft.components.ToolbarButton),Tt=ft.editor,wt=Tt.RichTextToolbarButton,xt=Tt.RichTextShortcut,Ft=ft.richText,Ct=Ft.registerFormatType,Bt=Ft.getActiveFormat,Nt=Ft.applyFormat,At=Ft.removeFormat;function St(t,e,r){if(t)r(At(e,"core/underline"));else{r(Nt(e,{type:"core/underline",attributes:{style:"text-decoration: underline"}}))}}var _t=window.wp,Rt=_t.element,Et=Rt.createElement,Ot=(Rt.Fragment,_t.i18n.__),Pt=_t.components.ToolbarButton,Mt=_t.editor,Ut=(Mt.RichTextToolbarButton,Mt.RichTextShortcut,_t.richText),jt=(Ut.registerFormatType,Ut.getActiveFormat),zt=Ut.toggleFormat;function It(t,e){e(zt(t,{type:"core/bold"}))}var Lt=window.wp,Gt=Lt.element,Vt=Gt.createElement,$t=(Gt.Fragment,Lt.i18n.__),qt=Lt.components.ToolbarButton,Dt=Lt.editor,Ht=(Dt.RichTextToolbarButton,Dt.RichTextShortcut,Lt.richText),Jt=(Ht.registerFormatType,Ht.getActiveFormat),Kt=Ht.toggleFormat;function Qt(t,e){e(Kt(t,{type:"core/italic"}))}var Wt=window.wp,Xt=window.tadvBlockButtons,Yt=Wt.element,Zt=Yt.createElement,te=Yt.Fragment,ee=Wt.richText,re=ee.registerFormatType,oe=ee.getActiveFormat,ne=ee.toggleFormat,ae=Wt.components.ToolbarButton,ie=Wt.editor,ce=ie.RichTextToolbarButton,le=ie.RichTextShortcut,ue=Wt.components,se=ue.Path,de=ue.SVG,ve=Zt(de,{viewBox:"-85 -985 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Zt(se,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 754v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"})),me=Zt(de,{viewBox:"-85 -975 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Zt(se,{"aria-hidden":"true",role:"img",focusable:"false",transform:"scale(1, -1)",translate:"(0, -960)",d:"M768 50v-50h128v-64h-192v146l128 60v50h-128v64h192v-146zM676 704h-136l-188-188-188 188h-136l256-256-256-256h136l188 188 188-188h136l-256 256z"}));function pe(t,e,r){e(ne(t,{type:r}))}function fe(t,e){var r=t.type,o=t.tagName,n=t.title,a=t.character,i=t.icon;re(r,{title:n,tagName:o,className:null,edit:function(t){var o=t.isActive,c=t.value,l=t.onChange,u=null;return e||(u=Zt(ce,{title:n,icon:i,onClick:function(){return pe(c,l,r)},isActive:o,shortcutType:"primary",shortcutCharacter:a})),Zt(te,null,Zt(le,{type:"primary",character:a,onUse:function(){return pe(c,l,r)}}),u)}})}var he,ge=window.wp,be=ge.element.createElement,ye=ge.data.select,ke=ge.hooks.addFilter,Te=ge.components,we=Te.PanelBody,xe=Te.Toolbar,Fe=ge.editor.InspectorControls,Ce=ge.richText,Be=Ce.registerFormatType,Ne=Ce.unregisterFormatType,Ae=window.tadvBlockButtons||{},Se=Ae.buttons?Ae.buttons.split(","):[],_e=Ae.panelButtons?Ae.panelButtons.split(","):[],Re=Ae.unusedButtons?Ae.unusedButtons.split(","):[],Ee={"tadv/mark":function(t){dt("tadv/mark",{title:rt.strMark,tagName:"mark",className:null,edit:function(e){var r=e.isActive,o=e.value,n=e.onChange,a=null;return t||(a=nt(lt,{title:rt.strMark,icon:"editor-textcolor",onClick:function(){return pt(o,n)},className:"tadv-icon-button-mark",isActive:r,shortcutType:"access",shortcutCharacter:"m"})),nt(at,null,nt(ut,{type:"access",character:"m",onUse:function(){return pt(o,n)}}),a)}})},"tadv/removeformat":function(t){T("tadv/removeformat",{title:g.strRemoveFormatting||"Remove formatting",tagName:"u",className:"remove-format",edit:function(e){e.isActive;var r=e.value,o=e.onChange;return t?null:x(y,{icon:"editor-removeformatting",title:g.strRemoveFormatting,onClick:function(){return o(B(r))},isActive:null})}})},"tadv/sub":function(t){fe({type:"tadv/sub",tagName:"sub",title:Xt.strSubscript,character:",",icon:me},t)},"tadv/sup":function(t){fe({type:"tadv/sup",tagName:"sup",title:Xt.strSuperscript,character:".",icon:ve},t)},"core/code":function(t){X("core/code",{title:D("Code"),tagName:"code",className:null,edit:function(e){var r=e.isActive,o=e.value,n=e.onChange,a=null;return t||(a=$(K,{icon:"editor-code",title:D("Code"),onClick:function(){return tt(o,n)},isActive:r,shortcutType:"access",shortcutCharacter:"x"})),$(q,null,$(Q,{type:"access",character:"x",onUse:function(){return tt(o,n)}}),a)}})},"core/strikethrough":function(t){j("core/strikethrough",{name:"core/strikethrough",title:R("Strikethrough"),tagName:"del",className:null,edit:function(e){var r=e.isActive,o=e.value,n=e.onChange,a=null;return t||(a=S(P,{name:"strikethrough",icon:"editor-strikethrough",title:R("Strikethrough"),onClick:function(){return L(o,n)},isActive:r,shortcutType:"access",shortcutCharacter:"d"})),S(_,null,S(M,{type:"access",character:"d",onUse:function(){return L(o,n)}}),a)}})},"core/underline":function(t){Ct("core/underline",{title:ht.strUnderline,tagName:"span",className:"underline",attributes:{style:"style"},edit:function(e){var r=e.isActive,o=e.value,n=e.onChange,a=null;return t||(a=bt(wt,{title:ht.strUnderline,icon:"editor-underline",onClick:function(){return St(r,o,n)},className:null,isActive:r,shortcutType:"primary",shortcutCharacter:"u"})),bt(yt,null,bt(xt,{type:"primary",character:"u",onUse:function(){return St(r,o,n)}}),a)}})}},Oe={"core/bold":function(t,e,r){return Et(Pt,{key:"core/bold",icon:"editor-bold",className:"tadv-icon-button",isActive:jt(e,"core/bold"),title:Ot("Bold"),onClick:function(){return It(e,r)}})},"core/italic":function(t,e,r){return Vt(qt,{key:"core/italic",icon:"editor-italic",className:"tadv-icon-button",isActive:Jt(e,"core/italic"),title:$t("Italic"),onClick:function(){return Qt(e,r)}})},"core/code":function(t,e,r){return $(H,{key:"core/code",icon:"editor-code",className:"tadv-icon-button",isActive:Y(e,"core/code"),title:D("Code"),onClick:function(){return tt(e,r)}})},"core/strikethrough":function(t,e,r){return S(E,{key:"core/strikethrough",icon:"editor-strikethrough",className:"tadv-icon-button",isActive:z(e,"core/strikethrough"),title:R("Strikethrough"),onClick:function(){return L(e,r)}})},"core/underline":function(t,e,r){var o=!!Bt(e,"core/underline");return bt(kt,{key:"core/underline",icon:"editor-underline",className:"tadv-icon-button",isActive:o,title:ht.strUnderline,onClick:function(){return St(o,e,r)}})},"tadv/removeformat":function(t,e,r){return x(F,{key:"tadv/removeformat",icon:"editor-removeformatting",className:"tadv-icon-button",title:g.strRemoveFormatting,onClick:function(){return r(B(e))}})},"tadv/mark":function(t,e,r){return nt(it,{key:"tadv/mark",icon:"editor-textcolor",className:"tadv-icon-button tadv-icon-button-mark",isActive:vt(e,"tadv/mark"),title:rt.strMark,onClick:function(){return pt(e,r)}})},"tadv/sup":function(t,e,r){return Zt(ae,{key:"tadv/sup",icon:ve,className:"tadv-icon-button",isActive:oe(e,"tadv/sup"),title:Xt.strSuperscript,onClick:function(){return pe(e,r,"tadv/sup")}})},"tadv/sub":function(t,e,r){return Zt(ae,{key:"tadv/sub",icon:me,className:"tadv-icon-button",isActive:oe(e,"tadv/sub"),title:Xt.strSubscript,onClick:function(){return pe(e,r,"tadv/sub")}})}};function Pe(t){(function(t){var e=ye("core/rich-text").getFormatTypes(),r=!1;return e.forEach(function(e){e.name===t&&(r=!0)}),r})(t)&&Ne(t)}function Me(){Re.length&&Re.forEach(function(t){Pe(t)}),Se.forEach(function(t){Ee.hasOwnProperty(t)&&(Pe(t),Ee[t].call(null))}),_e.length&&(_e.forEach(function(t){-1===Se.indexOf(t)&&Ee.hasOwnProperty(t)&&(Pe(t),Ee[t].call(null,"panel"))}),Be("tadv/tadv-format-panel",{title:Ae.strFormatting,tagName:"span",className:"tadv-format-panel",edit:function(t){var e=t.isActive,r=t.value,o=t.onChange,n=[];return _e.forEach(function(t){Oe.hasOwnProperty(t)&&n.push(Oe[t].call(null,e,r,o))}),be(Fe,null,be(we,{title:Ae.strFormatting,className:"tadv-buttons-panel"},be(xe,null,n)))}})),function(){if(o.colorPanel){var t=o.colorPanel.indexOf("tadv/color-panel")>-1,e=o.colorPanel.indexOf("tadv/background-color-panel")>-1;t&&d("tadv/color-panel",{title:o.strTextColor,tagName:"span",className:"tadv-color",attributes:{style:"style"},edit:function(t){var r,n,c=t.isActive,s=t.value,d=t.onChange;if(c){var h=p(s,"tadv/color-panel"),g=a(h,["attributes","style"])||"",b=p(s,"tadv/background-color-panel"),y=a(b,["attributes","style"])||"";r=f(g),n=f(y)}var k=[{value:r,onChange:function(t){d(t?v(s,{type:"tadv/color-panel",attributes:{style:"color:"+t}}):m(s,"tadv/color-panel"))},label:o.strTextColorLabel}];return e&&k.push({value:n,onChange:function(t){d(t?v(s,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):m(s,"tadv/background-color-panel"))},label:o.strBackgroundColorLabel}),i(l,null,i(u,{title:o.strTextColor,initialOpen:!1,colorSettings:k}))}}),d("tadv/background-color-panel",{title:o.strBackgroundColor,tagName:"span",className:"tadv-background-color",attributes:{style:"style"},edit:function(r){var n,c=r.isActive,s=r.value,d=r.onChange;if(!e||t)return null;if(c){var h=p(s,"tadv/background-color-panel");n=f(a(h,["attributes","style"])||"")}var g=[{value:n,onChange:function(t){d(t?v(s,{type:"tadv/background-color-panel",attributes:{style:"background-color:"+t}}):m(s,"tadv/background-color-panel"))},label:o.strBackgroundColorLabel}];return i(l,null,i(u,{title:o.strTextColor,initialOpen:!1,colorSettings:g}))}})}}()}ke("blocks.registerBlockType","tadv-register-formats",function(t){return he||(Me(),he=!0),t})}});
|
images/toolbar-left-rtl.png
DELETED
Binary file
|
images/toolbar-left.png
DELETED
Binary file
|
images/toolbar-right.png
DELETED
Binary file
|
js/tadv.js
CHANGED
@@ -62,11 +62,8 @@ jQuery( document ).ready( function( $ ) {
|
|
62 |
items: '> li',
|
63 |
cursor: 'move',
|
64 |
stop: function( event, ui ) {
|
65 |
-
var toolbar_id;
|
66 |
-
|
67 |
-
if ( ui && ( toolbar_id = ui.item.parent().attr( 'id' ) ) ) {
|
68 |
-
ui.item.find( 'input.tadv-button' ).attr( 'name', toolbar_id + '[]' );
|
69 |
-
}
|
70 |
},
|
71 |
activate: function( event, ui ) {
|
72 |
$(this).parent().addClass( 'highlighted' );
|
@@ -85,18 +82,9 @@ jQuery( document ).ready( function( $ ) {
|
|
85 |
items: '> li',
|
86 |
cursor: 'move',
|
87 |
stop: function( event, ui ) {
|
88 |
-
var
|
89 |
-
var toolbar_id = parent.attr( 'id' );
|
90 |
-
|
91 |
-
if ( ui.item.is( '.core-link' ) && parent.is( '#toolbar_block_side' ) ) {
|
92 |
-
blockToolbar.sortable( 'cancel' );
|
93 |
-
return;
|
94 |
-
}
|
95 |
-
|
96 |
-
if ( toolbar_id ) {
|
97 |
-
ui.item.find( 'input[type="hidden"]' ).attr( 'name', toolbar_id + '[]' );
|
98 |
-
}
|
99 |
|
|
|
100 |
sortBlockToolbar();
|
101 |
},
|
102 |
activate: function( event, ui ) {
|
@@ -116,18 +104,9 @@ jQuery( document ).ready( function( $ ) {
|
|
116 |
items: '> li',
|
117 |
cursor: 'move',
|
118 |
stop: function( event, ui ) {
|
119 |
-
var
|
120 |
-
var toolbar_id = parent.attr( 'id' );
|
121 |
-
|
122 |
-
if ( ui.item.is( '.core-link' ) && parent.is( '#toolbar_block_side' ) ) {
|
123 |
-
block.sortable( 'cancel' );
|
124 |
-
}
|
125 |
|
126 |
-
|
127 |
-
ui.item.find( 'input[type="hidden"]' ).attr( 'name', toolbar_id + '[]' );
|
128 |
-
}
|
129 |
-
|
130 |
-
blockToolbar.css( 'min-width', '' );
|
131 |
sortBlockToolbar();
|
132 |
},
|
133 |
activate: function( event, ui ) {
|
@@ -136,11 +115,9 @@ jQuery( document ).ready( function( $ ) {
|
|
136 |
deactivate: function( event, ui ) {
|
137 |
$(this).parent().removeClass( 'highlighted' );
|
138 |
},
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
if ( width ) {
|
143 |
-
blockToolbar.css( 'min-width', 36 + width );
|
144 |
}
|
145 |
},
|
146 |
revert: 300,
|
@@ -150,18 +127,24 @@ jQuery( document ).ready( function( $ ) {
|
|
150 |
});
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
function sortBlockToolbar() {
|
154 |
-
var
|
155 |
-
var
|
156 |
|
157 |
-
|
158 |
-
var
|
|
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
}
|
163 |
|
164 |
-
|
165 |
}
|
166 |
|
167 |
// Make block editor tab sortable on load
|
@@ -206,7 +189,7 @@ jQuery( document ).ready( function( $ ) {
|
|
206 |
$( '.panel-block-background-color' ).addClass( 'disabled' );
|
207 |
}
|
208 |
} );
|
209 |
-
|
210 |
$( '.tadv-popout-help-toggle, .tadv-popout-help-close' ).on( 'click', function( event ) {
|
211 |
$( '.tadv-popout-help' ).toggleClass( 'hidden' );
|
212 |
} );
|
62 |
items: '> li',
|
63 |
cursor: 'move',
|
64 |
stop: function( event, ui ) {
|
65 |
+
var toolbar_id = ui.item.parent().attr( 'id' );
|
66 |
+
resetItemName( toolbar_id, ui.item );
|
|
|
|
|
|
|
67 |
},
|
68 |
activate: function( event, ui ) {
|
69 |
$(this).parent().addClass( 'highlighted' );
|
82 |
items: '> li',
|
83 |
cursor: 'move',
|
84 |
stop: function( event, ui ) {
|
85 |
+
var toolbar_id = ui.item.parent().attr( 'id' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
resetItemName( toolbar_id, ui.item );
|
88 |
sortBlockToolbar();
|
89 |
},
|
90 |
activate: function( event, ui ) {
|
104 |
items: '> li',
|
105 |
cursor: 'move',
|
106 |
stop: function( event, ui ) {
|
107 |
+
var toolbar_id = ui.item.parent().attr( 'id' );
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
resetItemName( toolbar_id, ui.item );
|
|
|
|
|
|
|
|
|
110 |
sortBlockToolbar();
|
111 |
},
|
112 |
activate: function( event, ui ) {
|
115 |
deactivate: function( event, ui ) {
|
116 |
$(this).parent().removeClass( 'highlighted' );
|
117 |
},
|
118 |
+
receive: function( event, ui ) {
|
119 |
+
if ( $( event.target ).is( '#toolbar_block_side' ) && ui.item.is( 'li.core-image' ) ) {
|
120 |
+
block.sortable( 'cancel' );
|
|
|
|
|
121 |
}
|
122 |
},
|
123 |
revert: 300,
|
127 |
});
|
128 |
}
|
129 |
|
130 |
+
function resetItemName( name, item ) {
|
131 |
+
if ( name ) {
|
132 |
+
item.find( 'input[type="hidden"]' ).attr( 'name', name + '[]' );
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
function sortBlockToolbar() {
|
137 |
+
var container = $( '#toolbar_block' );
|
138 |
+
var items = container.find( 'li' );
|
139 |
|
140 |
+
items.sort( function ( a, b ) {
|
141 |
+
var aa = $( a ).find( 'div' ).attr( 'title' );
|
142 |
+
var bb = $( b ).find( 'div' ).attr( 'title' );
|
143 |
|
144 |
+
return ( aa > bb ) ? 1 : -1;
|
145 |
+
});
|
|
|
146 |
|
147 |
+
container.append( items );
|
148 |
}
|
149 |
|
150 |
// Make block editor tab sortable on load
|
189 |
$( '.panel-block-background-color' ).addClass( 'disabled' );
|
190 |
}
|
191 |
} );
|
192 |
+
|
193 |
$( '.tadv-popout-help-toggle, .tadv-popout-help-close' ).on( 'click', function( event ) {
|
194 |
$( '.tadv-popout-help' ).toggleClass( 'hidden' );
|
195 |
} );
|
mce/advlist/plugin.js
CHANGED
@@ -1,160 +1,160 @@
|
|
1 |
(function () {
|
2 |
var advlist = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}
|
82 |
}
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
};
|
95 |
-
};
|
96 |
-
var updateSelection = function (editor) {
|
97 |
-
return function (e) {
|
98 |
-
var listStyleType = ListUtils.getSelectedStyleType(editor);
|
99 |
-
e.control.items().each(function (ctrl) {
|
100 |
-
ctrl.active(ctrl.settings.data === listStyleType);
|
101 |
-
});
|
102 |
-
};
|
103 |
-
};
|
104 |
-
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
105 |
-
editor.addButton(id, {
|
106 |
-
active: false,
|
107 |
-
type: 'splitbutton',
|
108 |
-
tooltip: tooltip,
|
109 |
-
menu: ListStyles.toMenuItems(styles),
|
110 |
-
onPostRender: listState(editor, nodeName),
|
111 |
-
onshow: updateSelection(editor),
|
112 |
-
onselect: function (e) {
|
113 |
-
Actions.applyListFormat(editor, nodeName, e.control.settings.data);
|
114 |
-
},
|
115 |
-
onclick: function () {
|
116 |
-
editor.execCommand(cmd);
|
117 |
-
}
|
118 |
});
|
119 |
};
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
onclick: function () {
|
127 |
-
editor.execCommand(cmd);
|
128 |
-
}
|
129 |
});
|
130 |
};
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
}
|
137 |
-
};
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
return global$1.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
148 |
-
};
|
149 |
-
if (hasPlugin(editor, 'lists')) {
|
150 |
-
Buttons.register(editor);
|
151 |
-
Commands.register(editor);
|
152 |
}
|
153 |
});
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
|
|
|
|
|
|
156 |
|
157 |
-
|
158 |
|
159 |
}());
|
160 |
})();
|
1 |
(function () {
|
2 |
var advlist = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
8 |
|
9 |
+
var applyListFormat = function (editor, listName, styleValue) {
|
10 |
+
var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';
|
11 |
+
editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });
|
12 |
+
};
|
13 |
+
var $_55i96w8fjjgwebbz = { applyListFormat: applyListFormat };
|
14 |
|
15 |
+
var register = function (editor) {
|
16 |
+
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
|
17 |
+
$_55i96w8fjjgwebbz.applyListFormat(editor, 'UL', value['list-style-type']);
|
18 |
+
});
|
19 |
+
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
|
20 |
+
$_55i96w8fjjgwebbz.applyListFormat(editor, 'OL', value['list-style-type']);
|
21 |
+
});
|
22 |
+
};
|
23 |
+
var $_46kte48ejjgwebby = { register: register };
|
24 |
|
25 |
+
var getNumberStyles = function (editor) {
|
26 |
+
var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');
|
27 |
+
return styles ? styles.split(/[ ,]/) : [];
|
28 |
+
};
|
29 |
+
var getBulletStyles = function (editor) {
|
30 |
+
var styles = editor.getParam('advlist_bullet_styles', 'default,circle,disc,square');
|
31 |
+
return styles ? styles.split(/[ ,]/) : [];
|
32 |
+
};
|
33 |
+
var $_7slyeq8hjjgwebc3 = {
|
34 |
+
getNumberStyles: getNumberStyles,
|
35 |
+
getBulletStyles: getBulletStyles
|
36 |
+
};
|
37 |
|
38 |
+
var isChildOfBody = function (editor, elm) {
|
39 |
+
return editor.$.contains(editor.getBody(), elm);
|
40 |
+
};
|
41 |
+
var isTableCellNode = function (node) {
|
42 |
+
return node && /^(TH|TD)$/.test(node.nodeName);
|
43 |
+
};
|
44 |
+
var isListNode = function (editor) {
|
45 |
+
return function (node) {
|
46 |
+
return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);
|
47 |
+
};
|
48 |
+
};
|
49 |
+
var getSelectedStyleType = function (editor) {
|
50 |
+
var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');
|
51 |
+
return editor.dom.getStyle(listElm, 'listStyleType') || '';
|
52 |
+
};
|
53 |
+
var $_brk9p8ijjgwebc5 = {
|
54 |
+
isTableCellNode: isTableCellNode,
|
55 |
+
isListNode: isListNode,
|
56 |
+
getSelectedStyleType: getSelectedStyleType
|
57 |
+
};
|
58 |
|
59 |
+
var styleValueToText = function (styleValue) {
|
60 |
+
return styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function (chr) {
|
61 |
+
return chr.toUpperCase();
|
62 |
+
});
|
63 |
+
};
|
64 |
+
var toMenuItems = function (styles) {
|
65 |
+
return global$1.map(styles, function (styleValue) {
|
66 |
+
var text = styleValueToText(styleValue);
|
67 |
+
var data = styleValue === 'default' ? '' : styleValue;
|
68 |
+
return {
|
69 |
+
text: text,
|
70 |
+
data: data
|
71 |
+
};
|
72 |
+
});
|
73 |
+
};
|
74 |
+
var $_7hivrd8jjjgwebc6 = { toMenuItems: toMenuItems };
|
75 |
|
76 |
+
var findIndex = function (list, predicate) {
|
77 |
+
for (var index = 0; index < list.length; index++) {
|
78 |
+
var element = list[index];
|
79 |
+
if (predicate(element)) {
|
80 |
+
return index;
|
|
|
81 |
}
|
82 |
+
}
|
83 |
+
return -1;
|
84 |
+
};
|
85 |
+
var listState = function (editor, listName) {
|
86 |
+
return function (e) {
|
87 |
+
var ctrl = e.control;
|
88 |
+
editor.on('NodeChange', function (e) {
|
89 |
+
var tableCellIndex = findIndex(e.parents, $_brk9p8ijjgwebc5.isTableCellNode);
|
90 |
+
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
91 |
+
var lists = global$1.grep(parents, $_brk9p8ijjgwebc5.isListNode(editor));
|
92 |
+
ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
});
|
94 |
};
|
95 |
+
};
|
96 |
+
var updateSelection = function (editor) {
|
97 |
+
return function (e) {
|
98 |
+
var listStyleType = $_brk9p8ijjgwebc5.getSelectedStyleType(editor);
|
99 |
+
e.control.items().each(function (ctrl) {
|
100 |
+
ctrl.active(ctrl.settings.data === listStyleType);
|
|
|
|
|
|
|
101 |
});
|
102 |
};
|
103 |
+
};
|
104 |
+
var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
105 |
+
editor.addButton(id, {
|
106 |
+
active: false,
|
107 |
+
type: 'splitbutton',
|
108 |
+
tooltip: tooltip,
|
109 |
+
menu: $_7hivrd8jjjgwebc6.toMenuItems(styles),
|
110 |
+
onPostRender: listState(editor, nodeName),
|
111 |
+
onshow: updateSelection(editor),
|
112 |
+
onselect: function (e) {
|
113 |
+
$_55i96w8fjjgwebbz.applyListFormat(editor, nodeName, e.control.settings.data);
|
114 |
+
},
|
115 |
+
onclick: function () {
|
116 |
+
editor.execCommand(cmd);
|
117 |
}
|
118 |
+
});
|
119 |
+
};
|
120 |
+
var addButton = function (editor, id, tooltip, cmd, nodeName, styles) {
|
121 |
+
editor.addButton(id, {
|
122 |
+
active: false,
|
123 |
+
type: 'button',
|
124 |
+
tooltip: tooltip,
|
125 |
+
onPostRender: listState(editor, nodeName),
|
126 |
+
onclick: function () {
|
127 |
+
editor.execCommand(cmd);
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
});
|
130 |
+
};
|
131 |
+
var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {
|
132 |
+
if (styles.length > 0) {
|
133 |
+
addSplitButton(editor, id, tooltip, cmd, nodeName, styles);
|
134 |
+
} else {
|
135 |
+
addButton(editor, id, tooltip, cmd, nodeName, styles);
|
136 |
+
}
|
137 |
+
};
|
138 |
+
var register$1 = function (editor) {
|
139 |
+
addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', $_7slyeq8hjjgwebc3.getNumberStyles(editor));
|
140 |
+
addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', $_7slyeq8hjjgwebc3.getBulletStyles(editor));
|
141 |
+
};
|
142 |
+
var $_fnebj78gjjgwebc0 = { register: register$1 };
|
143 |
+
|
144 |
+
global.add('advlist', function (editor) {
|
145 |
+
var hasPlugin = function (editor, plugin) {
|
146 |
+
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
|
147 |
+
return global$1.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
148 |
+
};
|
149 |
+
if (hasPlugin(editor, 'lists')) {
|
150 |
+
$_fnebj78gjjgwebc0.register(editor);
|
151 |
+
$_46kte48ejjgwebby.register(editor);
|
152 |
}
|
153 |
+
});
|
154 |
+
function Plugin () {
|
155 |
+
}
|
156 |
|
157 |
+
return Plugin;
|
158 |
|
159 |
}());
|
160 |
})();
|
mce/anchor/plugin.js
CHANGED
@@ -1,118 +1,118 @@
|
|
1 |
(function () {
|
2 |
var anchor = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
}
|
60 |
-
}
|
61 |
-
};
|
62 |
-
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
}
|
81 |
-
}
|
82 |
-
};
|
83 |
-
var setup = function (editor) {
|
84 |
-
editor.on('PreInit', function () {
|
85 |
-
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
86 |
-
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
87 |
-
});
|
88 |
-
};
|
89 |
-
var FilterContent = { setup: setup };
|
90 |
-
|
91 |
-
var register$1 = function (editor) {
|
92 |
-
editor.addButton('anchor', {
|
93 |
-
icon: 'anchor',
|
94 |
-
tooltip: 'Anchor',
|
95 |
-
cmd: 'mceAnchor',
|
96 |
-
stateSelector: 'a:not([href])'
|
97 |
-
});
|
98 |
-
editor.addMenuItem('anchor', {
|
99 |
-
icon: 'anchor',
|
100 |
-
text: 'Anchor',
|
101 |
-
context: 'insert',
|
102 |
-
cmd: 'mceAnchor'
|
103 |
-
});
|
104 |
};
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
111 |
});
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
|
116 |
|
117 |
}());
|
118 |
})();
|
1 |
(function () {
|
2 |
var anchor = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var isValidId = function (id) {
|
8 |
+
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
|
9 |
+
};
|
10 |
+
var getId = function (editor) {
|
11 |
+
var selectedNode = editor.selection.getNode();
|
12 |
+
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
13 |
+
return isAnchor ? selectedNode.id || selectedNode.name : '';
|
14 |
+
};
|
15 |
+
var insert = function (editor, id) {
|
16 |
+
var selectedNode = editor.selection.getNode();
|
17 |
+
var isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
18 |
+
if (isAnchor) {
|
19 |
+
selectedNode.removeAttribute('name');
|
20 |
+
selectedNode.id = id;
|
21 |
+
editor.undoManager.add();
|
22 |
+
} else {
|
23 |
+
editor.focus();
|
24 |
+
editor.selection.collapse(true);
|
25 |
+
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id }));
|
26 |
+
}
|
27 |
+
};
|
28 |
+
var $_30p5pl8ojjgwebcv = {
|
29 |
+
isValidId: isValidId,
|
30 |
+
getId: getId,
|
31 |
+
insert: insert
|
32 |
+
};
|
33 |
|
34 |
+
var insertAnchor = function (editor, newId) {
|
35 |
+
if (!$_30p5pl8ojjgwebcv.isValidId(newId)) {
|
36 |
+
editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
|
37 |
+
return true;
|
38 |
+
} else {
|
39 |
+
$_30p5pl8ojjgwebcv.insert(editor, newId);
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
};
|
43 |
+
var open = function (editor) {
|
44 |
+
var currentId = $_30p5pl8ojjgwebcv.getId(editor);
|
45 |
+
editor.windowManager.open({
|
46 |
+
title: 'Anchor',
|
47 |
+
body: {
|
48 |
+
type: 'textbox',
|
49 |
+
name: 'id',
|
50 |
+
size: 40,
|
51 |
+
label: 'Id',
|
52 |
+
value: currentId
|
53 |
+
},
|
54 |
+
onsubmit: function (e) {
|
55 |
+
var newId = e.data.id;
|
56 |
+
if (insertAnchor(editor, newId)) {
|
57 |
+
e.preventDefault();
|
|
|
58 |
}
|
59 |
+
}
|
60 |
+
});
|
61 |
+
};
|
62 |
+
var $_ctaozd8njjgwebct = { open: open };
|
63 |
|
64 |
+
var register = function (editor) {
|
65 |
+
editor.addCommand('mceAnchor', function () {
|
66 |
+
$_ctaozd8njjgwebct.open(editor);
|
67 |
+
});
|
68 |
+
};
|
69 |
+
var $_7z79du8mjjgwebcr = { register: register };
|
70 |
|
71 |
+
var isAnchorNode = function (node) {
|
72 |
+
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
|
73 |
+
};
|
74 |
+
var setContentEditable = function (state) {
|
75 |
+
return function (nodes) {
|
76 |
+
for (var i = 0; i < nodes.length; i++) {
|
77 |
+
if (isAnchorNode(nodes[i])) {
|
78 |
+
nodes[i].attr('contenteditable', state);
|
|
|
79 |
}
|
80 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
};
|
82 |
+
};
|
83 |
+
var setup = function (editor) {
|
84 |
+
editor.on('PreInit', function () {
|
85 |
+
editor.parser.addNodeFilter('a', setContentEditable('false'));
|
86 |
+
editor.serializer.addNodeFilter('a', setContentEditable(null));
|
87 |
+
});
|
88 |
+
};
|
89 |
+
var $_fm0e98pjjgwebcx = { setup: setup };
|
90 |
|
91 |
+
var register$1 = function (editor) {
|
92 |
+
editor.addButton('anchor', {
|
93 |
+
icon: 'anchor',
|
94 |
+
tooltip: 'Anchor',
|
95 |
+
cmd: 'mceAnchor',
|
96 |
+
stateSelector: 'a:not([href])'
|
97 |
});
|
98 |
+
editor.addMenuItem('anchor', {
|
99 |
+
icon: 'anchor',
|
100 |
+
text: 'Anchor',
|
101 |
+
context: 'insert',
|
102 |
+
cmd: 'mceAnchor'
|
103 |
+
});
|
104 |
+
};
|
105 |
+
var $_fq1n8m8qjjgwebcz = { register: register$1 };
|
106 |
+
|
107 |
+
global.add('anchor', function (editor) {
|
108 |
+
$_fm0e98pjjgwebcx.setup(editor);
|
109 |
+
$_7z79du8mjjgwebcr.register(editor);
|
110 |
+
$_fq1n8m8qjjgwebcz.register(editor);
|
111 |
+
});
|
112 |
+
function Plugin () {
|
113 |
+
}
|
114 |
|
115 |
+
return Plugin;
|
116 |
|
117 |
}());
|
118 |
})();
|
mce/code/plugin.js
CHANGED
@@ -1,94 +1,94 @@
|
|
1 |
(function () {
|
2 |
var code = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
var open = function (editor) {
|
37 |
-
var minWidth = Settings.getMinWidth(editor);
|
38 |
-
var minHeight = Settings.getMinHeight(editor);
|
39 |
-
var win = editor.windowManager.open({
|
40 |
-
title: 'Source code',
|
41 |
-
body: {
|
42 |
-
type: 'textbox',
|
43 |
-
name: 'code',
|
44 |
-
multiline: true,
|
45 |
-
minWidth: minWidth,
|
46 |
-
minHeight: minHeight,
|
47 |
-
spellcheck: false,
|
48 |
-
style: 'direction: ltr; text-align: left'
|
49 |
-
},
|
50 |
-
onSubmit: function (e) {
|
51 |
-
Content.setContent(editor, e.data.code);
|
52 |
-
}
|
53 |
-
});
|
54 |
-
win.find('#code').value(Content.getContent(editor));
|
55 |
-
};
|
56 |
-
var Dialog = { open: open };
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
}
|
72 |
-
});
|
73 |
-
editor.addMenuItem('code', {
|
74 |
-
icon: 'code',
|
75 |
-
text: 'Source code',
|
76 |
-
onclick: function () {
|
77 |
-
Dialog.open(editor);
|
78 |
-
}
|
79 |
-
});
|
80 |
-
};
|
81 |
-
var Buttons = { register: register$1 };
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
});
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
|
93 |
}());
|
94 |
})();
|
1 |
(function () {
|
2 |
var code = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
8 |
|
9 |
+
var getMinWidth = function (editor) {
|
10 |
+
return editor.getParam('code_dialog_width', 600);
|
11 |
+
};
|
12 |
+
var getMinHeight = function (editor) {
|
13 |
+
return editor.getParam('code_dialog_height', Math.min(global$1.DOM.getViewPort().h - 200, 500));
|
14 |
+
};
|
15 |
+
var $_bkj0vta2jjgwebiu = {
|
16 |
+
getMinWidth: getMinWidth,
|
17 |
+
getMinHeight: getMinHeight
|
18 |
+
};
|
19 |
|
20 |
+
var setContent = function (editor, html) {
|
21 |
+
editor.focus();
|
22 |
+
editor.undoManager.transact(function () {
|
23 |
+
editor.setContent(html);
|
24 |
+
});
|
25 |
+
editor.selection.setCursorLocation();
|
26 |
+
editor.nodeChanged();
|
27 |
+
};
|
28 |
+
var getContent = function (editor) {
|
29 |
+
return editor.getContent({ source_view: true });
|
30 |
+
};
|
31 |
+
var $_bnaf14a4jjgwebiw = {
|
32 |
+
setContent: setContent,
|
33 |
+
getContent: getContent
|
34 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
var open = function (editor) {
|
37 |
+
var minWidth = $_bkj0vta2jjgwebiu.getMinWidth(editor);
|
38 |
+
var minHeight = $_bkj0vta2jjgwebiu.getMinHeight(editor);
|
39 |
+
var win = editor.windowManager.open({
|
40 |
+
title: 'Source code',
|
41 |
+
body: {
|
42 |
+
type: 'textbox',
|
43 |
+
name: 'code',
|
44 |
+
multiline: true,
|
45 |
+
minWidth: minWidth,
|
46 |
+
minHeight: minHeight,
|
47 |
+
spellcheck: false,
|
48 |
+
style: 'direction: ltr; text-align: left'
|
49 |
+
},
|
50 |
+
onSubmit: function (e) {
|
51 |
+
$_bnaf14a4jjgwebiw.setContent(editor, e.data.code);
|
52 |
+
}
|
53 |
+
});
|
54 |
+
win.find('#code').value($_bnaf14a4jjgwebiw.getContent(editor));
|
55 |
+
};
|
56 |
+
var $_7n1iuxa1jjgwebit = { open: open };
|
57 |
|
58 |
+
var register = function (editor) {
|
59 |
+
editor.addCommand('mceCodeEditor', function () {
|
60 |
+
$_7n1iuxa1jjgwebit.open(editor);
|
61 |
+
});
|
62 |
+
};
|
63 |
+
var $_7j029sa0jjgwebis = { register: register };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
var register$1 = function (editor) {
|
66 |
+
editor.addButton('code', {
|
67 |
+
icon: 'code',
|
68 |
+
tooltip: 'Source code',
|
69 |
+
onclick: function () {
|
70 |
+
$_7n1iuxa1jjgwebit.open(editor);
|
71 |
+
}
|
72 |
+
});
|
73 |
+
editor.addMenuItem('code', {
|
74 |
+
icon: 'code',
|
75 |
+
text: 'Source code',
|
76 |
+
onclick: function () {
|
77 |
+
$_7n1iuxa1jjgwebit.open(editor);
|
78 |
+
}
|
79 |
});
|
80 |
+
};
|
81 |
+
var $_dv9koca5jjgwebix = { register: register$1 };
|
82 |
+
|
83 |
+
global.add('code', function (editor) {
|
84 |
+
$_7j029sa0jjgwebis.register(editor);
|
85 |
+
$_dv9koca5jjgwebix.register(editor);
|
86 |
+
return {};
|
87 |
+
});
|
88 |
+
function Plugin () {
|
89 |
+
}
|
90 |
|
91 |
+
return Plugin;
|
92 |
|
93 |
}());
|
94 |
})();
|
mce/contextmenu/plugin.js
CHANGED
@@ -1,168 +1,168 @@
|
|
1 |
(function () {
|
2 |
var contextmenu = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
};
|
10 |
-
var set = function (v) {
|
11 |
-
value = v;
|
12 |
-
};
|
13 |
-
var clone = function () {
|
14 |
-
return Cell(get());
|
15 |
-
};
|
16 |
-
return {
|
17 |
-
get: get,
|
18 |
-
set: set,
|
19 |
-
clone: clone
|
20 |
-
};
|
21 |
};
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
var get = function (visibleState) {
|
26 |
-
var isContextMenuVisible = function () {
|
27 |
-
return visibleState.get();
|
28 |
-
};
|
29 |
-
return { isContextMenuVisible: isContextMenuVisible };
|
30 |
};
|
31 |
-
var
|
32 |
-
|
33 |
-
var shouldNeverUseNative = function (editor) {
|
34 |
-
return editor.settings.contextmenu_never_use_native;
|
35 |
};
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
shouldNeverUseNative: shouldNeverUseNative,
|
41 |
-
getContextMenu: getContextMenu
|
42 |
};
|
|
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
|
|
48 |
};
|
|
|
|
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
var containerPos = global$1.DOM.getPos(element);
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
}
|
102 |
-
if (item) {
|
103 |
-
item.shortcut = '';
|
104 |
-
items.push(item);
|
105 |
-
}
|
106 |
-
});
|
107 |
-
for (var i = 0; i < items.length; i++) {
|
108 |
-
if (items[i].text === '|') {
|
109 |
-
if (i === 0 || i === items.length - 1) {
|
110 |
-
items.splice(i, 1);
|
111 |
-
}
|
112 |
-
}
|
113 |
}
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
classes: 'contextmenu'
|
118 |
-
});
|
119 |
-
menu.uiContainer = getUiContainer(editor);
|
120 |
-
menu.renderTo(getUiContainer(editor));
|
121 |
-
menu.on('hide', function (e) {
|
122 |
-
if (e.control === this) {
|
123 |
-
visibleState.set(false);
|
124 |
-
}
|
125 |
-
});
|
126 |
-
editor.on('remove', function () {
|
127 |
-
menu.remove();
|
128 |
-
menu = null;
|
129 |
-
});
|
130 |
-
return menu;
|
131 |
-
};
|
132 |
-
var show = function (editor, pos, visibleState, menu) {
|
133 |
-
if (menu.get() === null) {
|
134 |
-
menu.set(renderMenu(editor, visibleState));
|
135 |
-
} else {
|
136 |
-
menu.get().show();
|
137 |
}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
var isNativeOverrideKeyEvent = function (editor, e) {
|
144 |
-
return e.ctrlKey && !Settings.shouldNeverUseNative(editor);
|
145 |
-
};
|
146 |
-
var setup = function (editor, visibleState, menu) {
|
147 |
-
editor.on('contextmenu', function (e) {
|
148 |
-
if (isNativeOverrideKeyEvent(editor, e)) {
|
149 |
-
return;
|
150 |
}
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
});
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
-
|
166 |
|
167 |
}());
|
168 |
})();
|
1 |
(function () {
|
2 |
var contextmenu = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var Cell = function (initial) {
|
6 |
+
var value = initial;
|
7 |
+
var get = function () {
|
8 |
+
return value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
};
|
10 |
+
var set = function (v) {
|
11 |
+
value = v;
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
};
|
13 |
+
var clone = function () {
|
14 |
+
return Cell(get());
|
|
|
|
|
15 |
};
|
16 |
+
return {
|
17 |
+
get: get,
|
18 |
+
set: set,
|
19 |
+
clone: clone
|
|
|
|
|
20 |
};
|
21 |
+
};
|
22 |
|
23 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
24 |
|
25 |
+
var get = function (visibleState) {
|
26 |
+
var isContextMenuVisible = function () {
|
27 |
+
return visibleState.get();
|
28 |
};
|
29 |
+
return { isContextMenuVisible: isContextMenuVisible };
|
30 |
+
};
|
31 |
+
var $_5vudh2asjjgwebne = { get: get };
|
32 |
|
33 |
+
var shouldNeverUseNative = function (editor) {
|
34 |
+
return editor.settings.contextmenu_never_use_native;
|
35 |
+
};
|
36 |
+
var getContextMenu = function (editor) {
|
37 |
+
return editor.getParam('contextmenu', 'link openlink image inserttable | cell row column deletetable');
|
38 |
+
};
|
39 |
+
var $_4636zoaujjgwebng = {
|
40 |
+
shouldNeverUseNative: shouldNeverUseNative,
|
41 |
+
getContextMenu: getContextMenu
|
42 |
+
};
|
43 |
+
|
44 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
45 |
+
|
46 |
+
var getUiContainer = function (editor) {
|
47 |
+
return global$1.DOM.select(editor.settings.ui_container)[0];
|
48 |
+
};
|
49 |
+
|
50 |
+
var nu = function (x, y) {
|
51 |
+
return {
|
52 |
+
x: x,
|
53 |
+
y: y
|
54 |
+
};
|
55 |
+
};
|
56 |
+
var transpose = function (pos, dx, dy) {
|
57 |
+
return nu(pos.x + dx, pos.y + dy);
|
58 |
+
};
|
59 |
+
var fromPageXY = function (e) {
|
60 |
+
return nu(e.pageX, e.pageY);
|
61 |
+
};
|
62 |
+
var fromClientXY = function (e) {
|
63 |
+
return nu(e.clientX, e.clientY);
|
64 |
+
};
|
65 |
+
var transposeUiContainer = function (element, pos) {
|
66 |
+
if (element && global$1.DOM.getStyle(element, 'position', true) !== 'static') {
|
67 |
var containerPos = global$1.DOM.getPos(element);
|
68 |
+
var dx = containerPos.x - element.scrollLeft;
|
69 |
+
var dy = containerPos.y - element.scrollTop;
|
70 |
+
return transpose(pos, -dx, -dy);
|
71 |
+
} else {
|
72 |
+
return transpose(pos, 0, 0);
|
73 |
+
}
|
74 |
+
};
|
75 |
+
var transposeContentAreaContainer = function (element, pos) {
|
76 |
+
var containerPos = global$1.DOM.getPos(element);
|
77 |
+
return transpose(pos, containerPos.x, containerPos.y);
|
78 |
+
};
|
79 |
+
var getPos = function (editor, e) {
|
80 |
+
if (editor.inline) {
|
81 |
+
return transposeUiContainer(getUiContainer(editor), fromPageXY(e));
|
82 |
+
} else {
|
83 |
+
var iframePos = transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e));
|
84 |
+
return transposeUiContainer(getUiContainer(editor), iframePos);
|
85 |
+
}
|
86 |
+
};
|
87 |
+
var $_2f1lclavjjgwebni = { getPos: getPos };
|
88 |
|
89 |
+
var global$2 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
|
90 |
|
91 |
+
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
92 |
|
93 |
+
var renderMenu = function (editor, visibleState) {
|
94 |
+
var menu, contextmenu;
|
95 |
+
var items = [];
|
96 |
+
contextmenu = $_4636zoaujjgwebng.getContextMenu(editor);
|
97 |
+
global$3.each(contextmenu.split(/[ ,]/), function (name) {
|
98 |
+
var item = editor.menuItems[name];
|
99 |
+
if (name === '|') {
|
100 |
+
item = { text: name };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
+
if (item) {
|
103 |
+
item.shortcut = '';
|
104 |
+
items.push(item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
+
});
|
107 |
+
for (var i = 0; i < items.length; i++) {
|
108 |
+
if (items[i].text === '|') {
|
109 |
+
if (i === 0 || i === items.length - 1) {
|
110 |
+
items.splice(i, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
menu = global$2.create('menu', {
|
115 |
+
items: items,
|
116 |
+
context: 'contextmenu',
|
117 |
+
classes: 'contextmenu'
|
118 |
+
});
|
119 |
+
menu.uiContainer = getUiContainer(editor);
|
120 |
+
menu.renderTo(getUiContainer(editor));
|
121 |
+
menu.on('hide', function (e) {
|
122 |
+
if (e.control === this) {
|
123 |
+
visibleState.set(false);
|
124 |
+
}
|
125 |
+
});
|
126 |
+
editor.on('remove', function () {
|
127 |
+
menu.remove();
|
128 |
+
menu = null;
|
129 |
});
|
130 |
+
return menu;
|
131 |
+
};
|
132 |
+
var show = function (editor, pos, visibleState, menu) {
|
133 |
+
if (menu.get() === null) {
|
134 |
+
menu.set(renderMenu(editor, visibleState));
|
135 |
+
} else {
|
136 |
+
menu.get().show();
|
137 |
}
|
138 |
+
menu.get().moveTo(pos.x, pos.y);
|
139 |
+
visibleState.set(true);
|
140 |
+
};
|
141 |
+
var $_2wktdwayjjgwebnm = { show: show };
|
142 |
+
|
143 |
+
var isNativeOverrideKeyEvent = function (editor, e) {
|
144 |
+
return e.ctrlKey && !$_4636zoaujjgwebng.shouldNeverUseNative(editor);
|
145 |
+
};
|
146 |
+
var setup = function (editor, visibleState, menu) {
|
147 |
+
editor.on('contextmenu', function (e) {
|
148 |
+
if (isNativeOverrideKeyEvent(editor, e)) {
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
e.preventDefault();
|
152 |
+
$_2wktdwayjjgwebnm.show(editor, $_2f1lclavjjgwebni.getPos(editor, e), visibleState, menu);
|
153 |
+
});
|
154 |
+
};
|
155 |
+
var $_9lxnq5atjjgwebnf = { setup: setup };
|
156 |
+
|
157 |
+
global.add('contextmenu', function (editor) {
|
158 |
+
var menu = Cell(null), visibleState = Cell(false);
|
159 |
+
$_9lxnq5atjjgwebnf.setup(editor, visibleState, menu);
|
160 |
+
return $_5vudh2asjjgwebne.get(visibleState);
|
161 |
+
});
|
162 |
+
function Plugin () {
|
163 |
+
}
|
164 |
|
165 |
+
return Plugin;
|
166 |
|
167 |
}());
|
168 |
})();
|
mce/importcss/plugin.js
CHANGED
@@ -1,264 +1,294 @@
|
|
1 |
(function () {
|
2 |
var importcss = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
-
global$4.each(
|
99 |
-
|
100 |
});
|
101 |
-
if (!fileFilter) {
|
102 |
-
fileFilter = function (href, imported) {
|
103 |
-
return imported || contentCSSUrls[href];
|
104 |
-
};
|
105 |
-
}
|
106 |
try {
|
107 |
-
|
108 |
-
append(styleSheet);
|
109 |
-
});
|
110 |
} catch (e) {
|
111 |
}
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
}
|
120 |
-
var elementName = selector[1];
|
121 |
-
var classes = selector[2].substr(1).split('.').join(' ');
|
122 |
-
var inlineSelectorElements = global$4.makeMap('a,img');
|
123 |
-
if (selector[1]) {
|
124 |
-
format = { title: selectorText };
|
125 |
-
if (editor.schema.getTextBlockElements()[elementName]) {
|
126 |
-
format.block = elementName;
|
127 |
-
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
128 |
-
format.selector = elementName;
|
129 |
-
} else {
|
130 |
-
format.inline = elementName;
|
131 |
}
|
132 |
-
} else if (selector[2]) {
|
133 |
-
format = {
|
134 |
-
inline: 'span',
|
135 |
-
title: selectorText.substr(1),
|
136 |
-
classes: classes
|
137 |
-
};
|
138 |
-
}
|
139 |
-
if (Settings.shouldMergeClasses(editor) !== false) {
|
140 |
-
format.classes = classes;
|
141 |
-
} else {
|
142 |
-
format.attributes = { class: classes };
|
143 |
-
}
|
144 |
-
return format;
|
145 |
-
};
|
146 |
-
var getGroupsBySelector = function (groups, selector) {
|
147 |
-
return global$4.grep(groups, function (group) {
|
148 |
-
return !group.filter || group.filter(selector);
|
149 |
});
|
150 |
-
}
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
});
|
163 |
-
}
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
selectorConverter = Settings.getSelectorConverter(editor);
|
183 |
} else {
|
184 |
-
|
185 |
-
return defaultConvertSelectorToFormat(editor, selector);
|
186 |
-
};
|
187 |
}
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
-
return null;
|
209 |
-
};
|
210 |
-
if (!Settings.shouldAppend(editor)) {
|
211 |
-
ctrl.items().remove();
|
212 |
}
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
var menuItem = processSelector(selector, null);
|
226 |
if (menuItem) {
|
227 |
-
|
228 |
}
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
}
|
231 |
}
|
232 |
-
}
|
233 |
-
global$4.each(groups, function (group) {
|
234 |
-
if (group.item.menu.length > 0) {
|
235 |
-
ctrl.add(group.item);
|
236 |
-
}
|
237 |
-
});
|
238 |
-
e.control.renderNew();
|
239 |
});
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
};
|
250 |
-
return { convertSelectorToFormat: convertSelectorToFormat };
|
251 |
};
|
252 |
-
|
|
|
|
|
253 |
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
|
261 |
-
|
262 |
|
263 |
}());
|
264 |
})();
|
1 |
(function () {
|
2 |
var importcss = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
8 |
|
9 |
+
var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
|
10 |
|
11 |
+
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
12 |
|
13 |
+
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
14 |
|
15 |
+
var shouldMergeClasses = function (editor) {
|
16 |
+
return editor.getParam('importcss_merge_classes');
|
17 |
+
};
|
18 |
+
var shouldImportExclusive = function (editor) {
|
19 |
+
return editor.getParam('importcss_exclusive');
|
20 |
+
};
|
21 |
+
var getSelectorConverter = function (editor) {
|
22 |
+
return editor.getParam('importcss_selector_converter');
|
23 |
+
};
|
24 |
+
var getSelectorFilter = function (editor) {
|
25 |
+
return editor.getParam('importcss_selector_filter');
|
26 |
+
};
|
27 |
+
var getCssGroups = function (editor) {
|
28 |
+
return editor.getParam('importcss_groups');
|
29 |
+
};
|
30 |
+
var shouldAppend = function (editor) {
|
31 |
+
return editor.getParam('importcss_append');
|
32 |
+
};
|
33 |
+
var getFileFilter = function (editor) {
|
34 |
+
return editor.getParam('importcss_file_filter');
|
35 |
+
};
|
36 |
+
var $_31k679fcjjgwecfk = {
|
37 |
+
shouldMergeClasses: shouldMergeClasses,
|
38 |
+
shouldImportExclusive: shouldImportExclusive,
|
39 |
+
getSelectorConverter: getSelectorConverter,
|
40 |
+
getSelectorFilter: getSelectorFilter,
|
41 |
+
getCssGroups: getCssGroups,
|
42 |
+
shouldAppend: shouldAppend,
|
43 |
+
getFileFilter: getFileFilter
|
44 |
+
};
|
45 |
|
46 |
+
var removeCacheSuffix = function (url) {
|
47 |
+
var cacheSuffix = global$3.cacheSuffix;
|
48 |
+
if (typeof url === 'string') {
|
49 |
+
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
|
50 |
+
}
|
51 |
+
return url;
|
52 |
+
};
|
53 |
+
var isSkinContentCss = function (editor, href) {
|
54 |
+
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
|
55 |
+
if (skin) {
|
56 |
+
var skinUrl = settings.skin_url ? editor.documentBaseURI.toAbsolute(settings.skin_url) : global$2.baseURL + '/skins/' + skin;
|
57 |
+
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css';
|
58 |
+
}
|
59 |
+
return false;
|
60 |
+
};
|
61 |
+
var compileFilter = function (filter) {
|
62 |
+
if (typeof filter === 'string') {
|
63 |
+
return function (value) {
|
64 |
+
return value.indexOf(filter) !== -1;
|
65 |
+
};
|
66 |
+
} else if (filter instanceof RegExp) {
|
67 |
+
return function (value) {
|
68 |
+
return filter.test(value);
|
69 |
+
};
|
70 |
+
}
|
71 |
+
return filter;
|
72 |
+
};
|
73 |
+
var getSelectors = function (editor, doc, fileFilter) {
|
74 |
+
var selectors = [], contentCSSUrls = {};
|
75 |
+
function append(styleSheet, imported) {
|
76 |
+
var href = styleSheet.href, rules;
|
77 |
+
|
78 |
+
if ( editor.settings.classic_block_editor ) {
|
79 |
+
// Attempt to import the CSS rules from the style tag.
|
80 |
+
tinymce.$( 'style' ).each( function( i, node ) {
|
81 |
+
var css = node.textContent || '';
|
82 |
+
|
83 |
+
if ( /theme name: /i.test( css ) || css.indexOf( 'TinyMCE' ) > -1 ) {
|
84 |
+
try{
|
85 |
+
rules = node.sheet.cssRules;
|
86 |
+
} catch ( er ) {}
|
87 |
+
}
|
88 |
+
});
|
89 |
+
|
90 |
+
if ( rules ) {
|
91 |
+
tinymce.each( rules, function ( cssRule ) {
|
92 |
+
if ( cssRule.selectorText ) {
|
93 |
+
tinymce.each( cssRule.selectorText.split(','), function ( selector ) {
|
94 |
+
selector = selector.replace( /^\.editor-styles-wrapper/, '' );
|
95 |
+
|
96 |
+
if ( selector ) {
|
97 |
+
selectors.push( tinymce.trim( selector ) );
|
98 |
+
}
|
99 |
+
});
|
100 |
+
}
|
101 |
+
});
|
102 |
+
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
href = removeCacheSuffix(href);
|
108 |
+
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
|
109 |
+
return;
|
110 |
}
|
111 |
+
global$4.each(styleSheet.imports, function (styleSheet) {
|
112 |
+
append(styleSheet, true);
|
113 |
});
|
|
|
|
|
|
|
|
|
|
|
114 |
try {
|
115 |
+
rules = styleSheet.cssRules || styleSheet.rules;
|
|
|
|
|
116 |
} catch (e) {
|
117 |
}
|
118 |
+
global$4.each(rules, function (cssRule) {
|
119 |
+
if (cssRule.styleSheet) {
|
120 |
+
append(cssRule.styleSheet, true);
|
121 |
+
} else if (cssRule.selectorText) {
|
122 |
+
global$4.each(cssRule.selectorText.split(','), function (selector) {
|
123 |
+
selectors.push(global$4.trim(selector));
|
124 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
});
|
127 |
+
}
|
128 |
+
global$4.each(editor.contentCSS, function (url) {
|
129 |
+
contentCSSUrls[url] = true;
|
130 |
+
});
|
131 |
+
if (!fileFilter) {
|
132 |
+
fileFilter = function (href, imported) {
|
133 |
+
return imported || contentCSSUrls[href];
|
134 |
+
};
|
135 |
+
}
|
136 |
+
try {
|
137 |
+
global$4.each(doc.styleSheets, function (styleSheet) {
|
138 |
+
append(styleSheet);
|
139 |
});
|
140 |
+
} catch (e) {
|
141 |
+
}
|
142 |
+
return selectors;
|
143 |
+
};
|
144 |
+
var defaultConvertSelectorToFormat = function (editor, selectorText) {
|
145 |
+
var format;
|
146 |
+
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
147 |
+
if (!selector) {
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
var elementName = selector[1];
|
151 |
+
var classes = selector[2].substr(1).split('.').join(' ');
|
152 |
+
var inlineSelectorElements = global$4.makeMap('a,img');
|
153 |
+
if (selector[1]) {
|
154 |
+
format = { title: selectorText };
|
155 |
+
if (editor.schema.getTextBlockElements()[elementName]) {
|
156 |
+
format.block = elementName;
|
157 |
+
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
158 |
+
format.selector = elementName;
|
|
|
159 |
} else {
|
160 |
+
format.inline = elementName;
|
|
|
|
|
161 |
}
|
162 |
+
} else if (selector[2]) {
|
163 |
+
format = {
|
164 |
+
inline: 'span',
|
165 |
+
title: selectorText.substr(1),
|
166 |
+
classes: classes
|
167 |
+
};
|
168 |
+
}
|
169 |
+
if ($_31k679fcjjgwecfk.shouldMergeClasses(editor) !== false) {
|
170 |
+
format.classes = classes;
|
171 |
+
} else {
|
172 |
+
format.attributes = { class: classes };
|
173 |
+
}
|
174 |
+
return format;
|
175 |
+
};
|
176 |
+
var getGroupsBySelector = function (groups, selector) {
|
177 |
+
return global$4.grep(groups, function (group) {
|
178 |
+
return !group.filter || group.filter(selector);
|
179 |
+
});
|
180 |
+
};
|
181 |
+
var compileUserDefinedGroups = function (groups) {
|
182 |
+
return global$4.map(groups, function (group) {
|
183 |
+
return global$4.extend({}, group, {
|
184 |
+
original: group,
|
185 |
+
selectors: {},
|
186 |
+
filter: compileFilter(group.filter),
|
187 |
+
item: {
|
188 |
+
text: group.title,
|
189 |
+
menu: []
|
190 |
+
}
|
191 |
+
});
|
192 |
+
});
|
193 |
+
};
|
194 |
+
var isExclusiveMode = function (editor, group) {
|
195 |
+
return group === null || $_31k679fcjjgwecfk.shouldImportExclusive(editor) !== false;
|
196 |
+
};
|
197 |
+
var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
198 |
+
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
|
199 |
+
};
|
200 |
+
var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {
|
201 |
+
if (isExclusiveMode(editor, group)) {
|
202 |
+
globallyUniqueSelectors[selector] = true;
|
203 |
+
} else {
|
204 |
+
group.selectors[selector] = true;
|
205 |
+
}
|
206 |
+
};
|
207 |
+
var convertSelectorToFormat = function (editor, plugin, selector, group) {
|
208 |
+
var selectorConverter;
|
209 |
+
if (group && group.selector_converter) {
|
210 |
+
selectorConverter = group.selector_converter;
|
211 |
+
} else if ($_31k679fcjjgwecfk.getSelectorConverter(editor)) {
|
212 |
+
selectorConverter = $_31k679fcjjgwecfk.getSelectorConverter(editor);
|
213 |
+
} else {
|
214 |
+
selectorConverter = function () {
|
215 |
+
return defaultConvertSelectorToFormat(editor, selector);
|
216 |
+
};
|
217 |
+
}
|
218 |
+
return selectorConverter.call(plugin, selector, group);
|
219 |
+
};
|
220 |
+
var setup = function (editor) {
|
221 |
+
editor.on('renderFormatsMenu', function (e) {
|
222 |
+
var globallyUniqueSelectors = {};
|
223 |
+
var selectorFilter = compileFilter($_31k679fcjjgwecfk.getSelectorFilter(editor)), ctrl = e.control;
|
224 |
+
var groups = compileUserDefinedGroups($_31k679fcjjgwecfk.getCssGroups(editor));
|
225 |
+
var processSelector = function (selector, group) {
|
226 |
+
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
|
227 |
+
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
|
228 |
+
var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
|
229 |
+
if (format) {
|
230 |
+
var formatName = format.name || global$1.DOM.uniqueId();
|
231 |
+
editor.formatter.register(formatName, format);
|
232 |
+
return global$4.extend({}, ctrl.settings.itemDefaults, {
|
233 |
+
text: format.title,
|
234 |
+
format: formatName
|
235 |
+
});
|
236 |
}
|
|
|
|
|
|
|
|
|
237 |
}
|
238 |
+
return null;
|
239 |
+
};
|
240 |
+
if (!$_31k679fcjjgwecfk.shouldAppend(editor)) {
|
241 |
+
ctrl.items().remove();
|
242 |
+
}
|
243 |
+
global$4.each(getSelectors(editor, e.doc || editor.getDoc(), compileFilter($_31k679fcjjgwecfk.getFileFilter(editor))), function (selector) {
|
244 |
+
if (selector.indexOf('.mce-') === -1) {
|
245 |
+
if (!selectorFilter || selectorFilter(selector)) {
|
246 |
+
var selectorGroups = getGroupsBySelector(groups, selector);
|
247 |
+
if (selectorGroups.length > 0) {
|
248 |
+
global$4.each(selectorGroups, function (group) {
|
249 |
+
var menuItem = processSelector(selector, group);
|
|
|
250 |
if (menuItem) {
|
251 |
+
group.item.menu.push(menuItem);
|
252 |
}
|
253 |
+
});
|
254 |
+
} else {
|
255 |
+
var menuItem = processSelector(selector, null);
|
256 |
+
if (menuItem) {
|
257 |
+
ctrl.add(menuItem);
|
258 |
}
|
259 |
}
|
260 |
}
|
261 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
});
|
263 |
+
global$4.each(groups, function (group) {
|
264 |
+
if (group.item.menu.length > 0) {
|
265 |
+
ctrl.add(group.item);
|
266 |
+
}
|
267 |
+
});
|
268 |
+
e.control.renderNew();
|
269 |
+
});
|
270 |
+
};
|
271 |
+
var $_c4mxymf7jjgwecfd = {
|
272 |
+
defaultConvertSelectorToFormat: defaultConvertSelectorToFormat,
|
273 |
+
setup: setup
|
274 |
+
};
|
275 |
|
276 |
+
var get = function (editor) {
|
277 |
+
var convertSelectorToFormat = function (selectorText) {
|
278 |
+
return $_c4mxymf7jjgwecfd.defaultConvertSelectorToFormat(editor, selectorText);
|
|
|
|
|
279 |
};
|
280 |
+
return { convertSelectorToFormat: convertSelectorToFormat };
|
281 |
+
};
|
282 |
+
var $_9a1lwcf6jjgwecf8 = { get: get };
|
283 |
|
284 |
+
global.add('importcss', function (editor) {
|
285 |
+
$_c4mxymf7jjgwecfd.setup(editor);
|
286 |
+
return $_9a1lwcf6jjgwecf8.get(editor);
|
287 |
+
});
|
288 |
+
function Plugin () {
|
289 |
+
}
|
290 |
|
291 |
+
return Plugin;
|
292 |
|
293 |
}());
|
294 |
})();
|
mce/importcss/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var
|
1 |
+
!function(){(function(){"use strict";function a(){}var b=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),d=tinymce.util.Tools.resolve("tinymce.EditorManager"),e=tinymce.util.Tools.resolve("tinymce.Env"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(a){return a.getParam("importcss_merge_classes")},h=function(a){return a.getParam("importcss_exclusive")},i=function(a){return a.getParam("importcss_selector_converter")},j=function(a){return a.getParam("importcss_selector_filter")},k=function(a){return a.getParam("importcss_groups")},l=function(a){return a.getParam("importcss_append")},m=function(a){return a.getParam("importcss_file_filter")},n={shouldMergeClasses:g,shouldImportExclusive:h,getSelectorConverter:i,getSelectorFilter:j,getCssGroups:k,shouldAppend:l,getFileFilter:m},o=function(a){var b=e.cacheSuffix;return"string"==typeof a&&(a=a.replace("?"+b,"").replace("&"+b,"")),a},p=function(a,b){var c=a.settings,e=c.skin!==!1&&(c.skin||"lightgray");if(e){var f=c.skin_url?a.documentBaseURI.toAbsolute(c.skin_url):d.baseURL+"/skins/"+e;return b===f+"/content"+(a.inline?".inline":"")+".min.css"}return!1},q=function(a){return"string"==typeof a?function(b){return b.indexOf(a)!==-1}:a instanceof RegExp?function(b){return a.test(b)}:a},r=function(a,b,c){function d(b,g){var h,i=b.href;if(a.settings.classic_block_editor&&(tinymce.$("style").each(function(a,b){var c=b.textContent||"";if(/theme name: /i.test(c)||c.indexOf("TinyMCE")>-1)try{h=b.sheet.cssRules}catch(d){}}),h))return void tinymce.each(h,function(a){a.selectorText&&tinymce.each(a.selectorText.split(","),function(a){a=a.replace(/^\.editor-styles-wrapper/,""),a&&e.push(tinymce.trim(a))})});if(i=o(i),i&&c(i,g)&&!p(a,i)){f.each(b.imports,function(a){d(a,!0)});try{h=b.cssRules||b.rules}catch(j){}f.each(h,function(a){a.styleSheet?d(a.styleSheet,!0):a.selectorText&&f.each(a.selectorText.split(","),function(a){e.push(f.trim(a))})})}}var e=[],g={};f.each(a.contentCSS,function(a){g[a]=!0}),c||(c=function(a,b){return b||g[a]});try{f.each(b.styleSheets,function(a){d(a)})}catch(h){}return e},s=function(a,b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],g=d[2].substr(1).split(".").join(" "),h=f.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||h[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:g}),n.shouldMergeClasses(a)!==!1?c.classes=g:c.attributes={"class":g},c}},t=function(a,b){return f.grep(a,function(a){return!a.filter||a.filter(b)})},u=function(a){return f.map(a,function(a){return f.extend({},a,{original:a,selectors:{},filter:q(a.filter),item:{text:a.title,menu:[]}})})},v=function(a,b){return null===b||n.shouldImportExclusive(a)!==!1},w=function(a,b,c,d){return!(v(a,c)?b in d:b in c.selectors)},x=function(a,b,c,d){v(a,c)?d[b]=!0:c.selectors[b]=!0},y=function(a,b,c,d){var e;return e=d&&d.selector_converter?d.selector_converter:n.getSelectorConverter(a)?n.getSelectorConverter(a):function(){return s(a,c)},e.call(b,c,d)},z=function(a){a.on("renderFormatsMenu",function(b){var d={},e=q(n.getSelectorFilter(a)),g=b.control,h=u(n.getCssGroups(a)),i=function(b,e){if(w(a,b,e,d)){x(a,b,e,d);var h=y(a,a.plugins.importcss,b,e);if(h){var i=h.name||c.DOM.uniqueId();return a.formatter.register(i,h),f.extend({},g.settings.itemDefaults,{text:h.title,format:i})}}return null};n.shouldAppend(a)||g.items().remove(),f.each(r(a,b.doc||a.getDoc(),q(n.getFileFilter(a))),function(a){if(a.indexOf(".mce-")===-1&&(!e||e(a))){var b=t(h,a);if(b.length>0)f.each(b,function(b){var c=i(a,b);c&&b.item.menu.push(c)});else{var c=i(a,null);c&&g.add(c)}}}),f.each(h,function(a){a.item.menu.length>0&&g.add(a.item)}),b.control.renderNew()})},A={defaultConvertSelectorToFormat:s,setup:z},B=function(a){var b=function(b){return A.defaultConvertSelectorToFormat(a,b)};return{convertSelectorToFormat:b}},C={get:B};return b.add("importcss",function(a){return A.setup(a),C.get(a)}),a})()}();
|
mce/insertdatetime/plugin.js
CHANGED
@@ -1,173 +1,173 @@
|
|
1 |
(function () {
|
2 |
var insertdatetime = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
};
|
10 |
-
var set = function (v) {
|
11 |
-
value = v;
|
12 |
-
};
|
13 |
-
var clone = function () {
|
14 |
-
return Cell(get());
|
15 |
-
};
|
16 |
-
return {
|
17 |
-
get: get,
|
18 |
-
set: set,
|
19 |
-
clone: clone
|
20 |
-
};
|
21 |
-
};
|
22 |
-
|
23 |
-
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
24 |
-
|
25 |
-
var getDateFormat = function (editor) {
|
26 |
-
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
|
27 |
-
};
|
28 |
-
var getTimeFormat = function (editor) {
|
29 |
-
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
|
30 |
-
};
|
31 |
-
var getFormats = function (editor) {
|
32 |
-
return editor.getParam('insertdatetime_formats', [
|
33 |
-
'%H:%M:%S',
|
34 |
-
'%Y-%m-%d',
|
35 |
-
'%I:%M:%S %p',
|
36 |
-
'%D'
|
37 |
-
]);
|
38 |
};
|
39 |
-
var
|
40 |
-
|
41 |
-
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
|
42 |
};
|
43 |
-
var
|
44 |
-
return
|
45 |
};
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
getDefaultDateTime: getDefaultDateTime,
|
51 |
-
shouldInsertTimeElement: shouldInsertTimeElement
|
52 |
};
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
computerTime = getDateTime(editor, '%Y-%m-%d');
|
102 |
-
}
|
103 |
-
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
104 |
-
if (timeElm) {
|
105 |
-
updateElement(editor, timeElm, computerTime, userTime);
|
106 |
-
} else {
|
107 |
-
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
|
108 |
-
}
|
109 |
} else {
|
110 |
-
|
111 |
}
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
onclick: function () {
|
136 |
-
lastFormatState.set(fmt);
|
137 |
-
Actions.insertDateTime(editor, fmt);
|
138 |
-
}
|
139 |
-
};
|
140 |
-
});
|
141 |
-
};
|
142 |
-
var register$1 = function (editor, lastFormatState) {
|
143 |
-
var menuItems = createMenuItems(editor, lastFormatState);
|
144 |
-
editor.addButton('insertdatetime', {
|
145 |
-
type: 'splitbutton',
|
146 |
-
title: 'Insert date/time',
|
147 |
-
menu: menuItems,
|
148 |
onclick: function () {
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
-
}
|
153 |
-
editor.addMenuItem('insertdatetime', {
|
154 |
-
icon: 'date',
|
155 |
-
text: 'Date/time',
|
156 |
-
menu: menuItems,
|
157 |
-
context: 'insert'
|
158 |
-
});
|
159 |
-
};
|
160 |
-
var Buttons = { register: register$1 };
|
161 |
-
|
162 |
-
global.add('insertdatetime', function (editor) {
|
163 |
-
var lastFormatState = Cell(null);
|
164 |
-
Commands.register(editor);
|
165 |
-
Buttons.register(editor, lastFormatState);
|
166 |
});
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
-
|
171 |
|
172 |
}());
|
173 |
})();
|
1 |
(function () {
|
2 |
var insertdatetime = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var Cell = function (initial) {
|
6 |
+
var value = initial;
|
7 |
+
var get = function () {
|
8 |
+
return value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
};
|
10 |
+
var set = function (v) {
|
11 |
+
value = v;
|
|
|
12 |
};
|
13 |
+
var clone = function () {
|
14 |
+
return Cell(get());
|
15 |
};
|
16 |
+
return {
|
17 |
+
get: get,
|
18 |
+
set: set,
|
19 |
+
clone: clone
|
|
|
|
|
20 |
};
|
21 |
+
};
|
22 |
|
23 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
24 |
+
|
25 |
+
var getDateFormat = function (editor) {
|
26 |
+
return editor.getParam('insertdatetime_dateformat', editor.translate('%Y-%m-%d'));
|
27 |
+
};
|
28 |
+
var getTimeFormat = function (editor) {
|
29 |
+
return editor.getParam('insertdatetime_timeformat', editor.translate('%H:%M:%S'));
|
30 |
+
};
|
31 |
+
var getFormats = function (editor) {
|
32 |
+
return editor.getParam('insertdatetime_formats', [
|
33 |
+
'%H:%M:%S',
|
34 |
+
'%Y-%m-%d',
|
35 |
+
'%I:%M:%S %p',
|
36 |
+
'%D'
|
37 |
+
]);
|
38 |
+
};
|
39 |
+
var getDefaultDateTime = function (editor) {
|
40 |
+
var formats = getFormats(editor);
|
41 |
+
return formats.length > 0 ? formats[0] : getTimeFormat(editor);
|
42 |
+
};
|
43 |
+
var shouldInsertTimeElement = function (editor) {
|
44 |
+
return editor.getParam('insertdatetime_element', false);
|
45 |
+
};
|
46 |
+
var $_8d6uzsfhjjgwecg7 = {
|
47 |
+
getDateFormat: getDateFormat,
|
48 |
+
getTimeFormat: getTimeFormat,
|
49 |
+
getFormats: getFormats,
|
50 |
+
getDefaultDateTime: getDefaultDateTime,
|
51 |
+
shouldInsertTimeElement: shouldInsertTimeElement
|
52 |
+
};
|
53 |
+
|
54 |
+
var daysShort = 'Sun Mon Tue Wed Thu Fri Sat Sun'.split(' ');
|
55 |
+
var daysLong = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday'.split(' ');
|
56 |
+
var monthsShort = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
|
57 |
+
var monthsLong = 'January February March April May June July August September October November December'.split(' ');
|
58 |
+
var addZeros = function (value, len) {
|
59 |
+
value = '' + value;
|
60 |
+
if (value.length < len) {
|
61 |
+
for (var i = 0; i < len - value.length; i++) {
|
62 |
+
value = '0' + value;
|
63 |
}
|
64 |
+
}
|
65 |
+
return value;
|
66 |
+
};
|
67 |
+
var getDateTime = function (editor, fmt, date) {
|
68 |
+
date = date || new Date();
|
69 |
+
fmt = fmt.replace('%D', '%m/%d/%Y');
|
70 |
+
fmt = fmt.replace('%r', '%I:%M:%S %p');
|
71 |
+
fmt = fmt.replace('%Y', '' + date.getFullYear());
|
72 |
+
fmt = fmt.replace('%y', '' + date.getYear());
|
73 |
+
fmt = fmt.replace('%m', addZeros(date.getMonth() + 1, 2));
|
74 |
+
fmt = fmt.replace('%d', addZeros(date.getDate(), 2));
|
75 |
+
fmt = fmt.replace('%H', '' + addZeros(date.getHours(), 2));
|
76 |
+
fmt = fmt.replace('%M', '' + addZeros(date.getMinutes(), 2));
|
77 |
+
fmt = fmt.replace('%S', '' + addZeros(date.getSeconds(), 2));
|
78 |
+
fmt = fmt.replace('%I', '' + ((date.getHours() + 11) % 12 + 1));
|
79 |
+
fmt = fmt.replace('%p', '' + (date.getHours() < 12 ? 'AM' : 'PM'));
|
80 |
+
fmt = fmt.replace('%B', '' + editor.translate(monthsLong[date.getMonth()]));
|
81 |
+
fmt = fmt.replace('%b', '' + editor.translate(monthsShort[date.getMonth()]));
|
82 |
+
fmt = fmt.replace('%A', '' + editor.translate(daysLong[date.getDay()]));
|
83 |
+
fmt = fmt.replace('%a', '' + editor.translate(daysShort[date.getDay()]));
|
84 |
+
fmt = fmt.replace('%%', '%');
|
85 |
+
return fmt;
|
86 |
+
};
|
87 |
+
var updateElement = function (editor, timeElm, computerTime, userTime) {
|
88 |
+
var newTimeElm = editor.dom.create('time', { datetime: computerTime }, userTime);
|
89 |
+
timeElm.parentNode.insertBefore(newTimeElm, timeElm);
|
90 |
+
editor.dom.remove(timeElm);
|
91 |
+
editor.selection.select(newTimeElm, true);
|
92 |
+
editor.selection.collapse(false);
|
93 |
+
};
|
94 |
+
var insertDateTime = function (editor, format) {
|
95 |
+
if ($_8d6uzsfhjjgwecg7.shouldInsertTimeElement(editor)) {
|
96 |
+
var userTime = getDateTime(editor, format);
|
97 |
+
var computerTime = void 0;
|
98 |
+
if (/%[HMSIp]/.test(format)) {
|
99 |
+
computerTime = getDateTime(editor, '%Y-%m-%dT%H:%M');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
} else {
|
101 |
+
computerTime = getDateTime(editor, '%Y-%m-%d');
|
102 |
}
|
103 |
+
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
104 |
+
if (timeElm) {
|
105 |
+
updateElement(editor, timeElm, computerTime, userTime);
|
106 |
+
} else {
|
107 |
+
editor.insertContent('<time datetime="' + computerTime + '">' + userTime + '</time>');
|
108 |
+
}
|
109 |
+
} else {
|
110 |
+
editor.insertContent(getDateTime(editor, format));
|
111 |
+
}
|
112 |
+
};
|
113 |
+
var $_asqd00fijjgwecg9 = {
|
114 |
+
insertDateTime: insertDateTime,
|
115 |
+
getDateTime: getDateTime
|
116 |
+
};
|
117 |
|
118 |
+
var register = function (editor) {
|
119 |
+
editor.addCommand('mceInsertDate', function () {
|
120 |
+
$_asqd00fijjgwecg9.insertDateTime(editor, $_8d6uzsfhjjgwecg7.getDateFormat(editor));
|
121 |
+
});
|
122 |
+
editor.addCommand('mceInsertTime', function () {
|
123 |
+
$_asqd00fijjgwecg9.insertDateTime(editor, $_8d6uzsfhjjgwecg7.getTimeFormat(editor));
|
124 |
+
});
|
125 |
+
};
|
126 |
+
var $_3b8w2cfgjjgwecg5 = { register: register };
|
127 |
|
128 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
129 |
|
130 |
+
var createMenuItems = function (editor, lastFormatState) {
|
131 |
+
var formats = $_8d6uzsfhjjgwecg7.getFormats(editor);
|
132 |
+
return global$1.map(formats, function (fmt) {
|
133 |
+
return {
|
134 |
+
text: $_asqd00fijjgwecg9.getDateTime(editor, fmt),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
onclick: function () {
|
136 |
+
lastFormatState.set(fmt);
|
137 |
+
$_asqd00fijjgwecg9.insertDateTime(editor, fmt);
|
138 |
}
|
139 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
});
|
141 |
+
};
|
142 |
+
var register$1 = function (editor, lastFormatState) {
|
143 |
+
var menuItems = createMenuItems(editor, lastFormatState);
|
144 |
+
editor.addButton('insertdatetime', {
|
145 |
+
type: 'splitbutton',
|
146 |
+
title: 'Insert date/time',
|
147 |
+
menu: menuItems,
|
148 |
+
onclick: function () {
|
149 |
+
var lastFormat = lastFormatState.get();
|
150 |
+
$_asqd00fijjgwecg9.insertDateTime(editor, lastFormat ? lastFormat : $_8d6uzsfhjjgwecg7.getDefaultDateTime(editor));
|
151 |
+
}
|
152 |
+
});
|
153 |
+
editor.addMenuItem('insertdatetime', {
|
154 |
+
icon: 'date',
|
155 |
+
text: 'Date/time',
|
156 |
+
menu: menuItems,
|
157 |
+
context: 'insert'
|
158 |
+
});
|
159 |
+
};
|
160 |
+
var $_atzqltfjjjgwecgc = { register: register$1 };
|
161 |
+
|
162 |
+
global.add('insertdatetime', function (editor) {
|
163 |
+
var lastFormatState = Cell(null);
|
164 |
+
$_3b8w2cfgjjgwecg5.register(editor);
|
165 |
+
$_atzqltfjjjgwecgc.register(editor, lastFormatState);
|
166 |
+
});
|
167 |
+
function Plugin () {
|
168 |
+
}
|
169 |
|
170 |
+
return Plugin;
|
171 |
|
172 |
}());
|
173 |
})();
|
mce/link/plugin.js
CHANGED
@@ -1,713 +1,713 @@
|
|
1 |
(function () {
|
2 |
var link = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
}
|
96 |
-
}
|
97 |
-
|
|
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
};
|
116 |
-
newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
|
117 |
-
return newRel.length ? toString(newRel) : null;
|
118 |
-
};
|
119 |
-
var trimCaretContainers = function (text) {
|
120 |
-
return text.replace(/\uFEFF/g, '');
|
121 |
-
};
|
122 |
-
var getAnchorElement = function (editor, selectedElm) {
|
123 |
-
selectedElm = selectedElm || editor.selection.getNode();
|
124 |
-
if (isImageFigure(selectedElm)) {
|
125 |
-
return editor.dom.select('a[href]', selectedElm)[0];
|
126 |
-
} else {
|
127 |
-
return editor.dom.getParent(selectedElm, 'a[href]');
|
128 |
-
}
|
129 |
-
};
|
130 |
-
var getAnchorText = function (selection, anchorElm) {
|
131 |
-
var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
|
132 |
-
return trimCaretContainers(text);
|
133 |
-
};
|
134 |
-
var isLink = function (elm) {
|
135 |
-
return elm && elm.nodeName === 'A' && elm.href;
|
136 |
-
};
|
137 |
-
var hasLinks = function (elements) {
|
138 |
-
return global$4.grep(elements, isLink).length > 0;
|
139 |
-
};
|
140 |
-
var isOnlyTextSelected = function (html) {
|
141 |
-
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
|
142 |
-
return false;
|
143 |
-
}
|
144 |
-
return true;
|
145 |
-
};
|
146 |
-
var isImageFigure = function (node) {
|
147 |
-
return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
|
148 |
};
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
} else {
|
186 |
-
|
187 |
}
|
188 |
}
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
unlinkImageFigure(editor, node);
|
198 |
} else {
|
199 |
-
editor.execCommand('
|
200 |
}
|
201 |
-
}
|
202 |
-
};
|
203 |
};
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
if (
|
210 |
-
|
211 |
-
|
|
|
212 |
}
|
213 |
-
}
|
214 |
};
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
222 |
}
|
223 |
-
}
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
|
236 |
|
237 |
-
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
});
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
255 |
}
|
256 |
};
|
257 |
-
var
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
var menuItem = { text: item.text || item.title };
|
262 |
-
if (item.menu) {
|
263 |
-
menuItem.menu = appendItems(item.menu);
|
264 |
-
} else {
|
265 |
-
menuItem.value = item.value;
|
266 |
-
if (itemCallback) {
|
267 |
-
itemCallback(menuItem);
|
268 |
-
}
|
269 |
-
}
|
270 |
-
output.push(menuItem);
|
271 |
-
});
|
272 |
-
return output;
|
273 |
-
};
|
274 |
-
return appendItems(inputList, startItems || []);
|
275 |
};
|
276 |
-
var
|
277 |
-
var
|
278 |
-
|
279 |
-
editor.
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
};
|
285 |
-
var
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
}
|
296 |
-
win.find('#href').value(e.control.value());
|
297 |
};
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
selected: url.indexOf('#' + id) !== -1
|
307 |
-
});
|
308 |
-
}
|
309 |
-
});
|
310 |
-
if (anchorList.length) {
|
311 |
-
anchorList.unshift({
|
312 |
text: 'None',
|
313 |
value: ''
|
314 |
-
})
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
values: anchorList,
|
320 |
-
onselect: linkListChangeHandler
|
321 |
-
};
|
322 |
}
|
323 |
};
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
};
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
if (
|
337 |
-
|
338 |
-
inp.value(value);
|
339 |
-
data.text = value;
|
340 |
-
}
|
341 |
-
} else {
|
342 |
-
inp.value(value);
|
343 |
}
|
344 |
-
})
|
345 |
-
if (meta.attach) {
|
346 |
-
attachState = {
|
347 |
-
href: this.value(),
|
348 |
-
attach: meta.attach
|
349 |
-
};
|
350 |
-
}
|
351 |
-
if (!meta.text) {
|
352 |
-
updateText.call(this);
|
353 |
-
}
|
354 |
};
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
};
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
}
|
376 |
-
if (onlyText) {
|
377 |
-
textListCtrl = {
|
378 |
-
name: 'text',
|
379 |
-
type: 'textbox',
|
380 |
size: 40,
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
if (Settings.getTargetList(editor.settings) === undefined) {
|
406 |
-
Settings.setTargetList(editor, [
|
407 |
-
{
|
408 |
-
text: 'None',
|
409 |
-
value: ''
|
410 |
-
},
|
411 |
-
{
|
412 |
-
text: 'New window',
|
413 |
-
value: '_blank'
|
414 |
-
}
|
415 |
-
]);
|
416 |
}
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
if (Settings.hasRelList(editor.settings)) {
|
425 |
-
relListCtrl = {
|
426 |
-
name: 'rel',
|
427 |
-
type: 'listbox',
|
428 |
-
label: 'Rel',
|
429 |
-
values: buildListItems(Settings.getRelList(editor.settings), function (item) {
|
430 |
-
if (Settings.allowUnsafeLinkTarget(editor.settings) === false) {
|
431 |
-
item.value = Utils.toggleTargetRules(item.value, data.target === '_blank');
|
432 |
}
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
values: buildListItems(Settings.getLinkClassList(editor.settings), function (item) {
|
442 |
-
if (item.value) {
|
443 |
-
item.textStyle = function () {
|
444 |
-
return editor.formatter.getCssText({
|
445 |
-
inline: 'a',
|
446 |
-
classes: [item.value]
|
447 |
-
});
|
448 |
-
};
|
449 |
}
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
if (Settings.shouldShowLinkTitle(editor.settings)) {
|
454 |
-
linkTitleCtrl = {
|
455 |
-
name: 'title',
|
456 |
-
type: 'textbox',
|
457 |
-
label: 'Title',
|
458 |
-
value: data.title
|
459 |
-
};
|
460 |
-
}
|
461 |
-
win = editor.windowManager.open({
|
462 |
-
title: 'Insert link',
|
463 |
-
data: data,
|
464 |
-
body: [
|
465 |
-
{
|
466 |
-
name: 'href',
|
467 |
-
type: 'filepicker',
|
468 |
-
filetype: 'file',
|
469 |
-
size: 40,
|
470 |
-
autofocus: true,
|
471 |
-
label: 'Url',
|
472 |
-
onchange: urlChange,
|
473 |
-
onkeyup: updateText,
|
474 |
-
onpaste: updateText,
|
475 |
-
onbeforecall: onBeforeCall
|
476 |
-
},
|
477 |
-
textListCtrl,
|
478 |
-
linkTitleCtrl,
|
479 |
-
buildAnchorListControl(data.href),
|
480 |
-
linkListCtrl,
|
481 |
-
relListCtrl,
|
482 |
-
targetListCtrl,
|
483 |
-
classListCtrl
|
484 |
-
],
|
485 |
-
onSubmit: function (e) {
|
486 |
-
var assumeExternalTargets = Settings.assumeExternalTargets(editor.settings);
|
487 |
-
var insertLink = Utils.link(editor, attachState);
|
488 |
-
var removeLink = Utils.unlink(editor);
|
489 |
-
var resultData = global$4.extend({}, data, e.data);
|
490 |
-
var href = resultData.href;
|
491 |
-
if (!href) {
|
492 |
-
removeLink();
|
493 |
-
return;
|
494 |
-
}
|
495 |
-
if (!onlyText || resultData.text === initialText) {
|
496 |
-
delete resultData.text;
|
497 |
-
}
|
498 |
-
if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
|
499 |
-
delayedConfirm(editor, 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', function (state) {
|
500 |
-
if (state) {
|
501 |
-
resultData.href = 'mailto:' + href;
|
502 |
-
}
|
503 |
-
insertLink(resultData);
|
504 |
-
});
|
505 |
-
return;
|
506 |
-
}
|
507 |
-
if (assumeExternalTargets === true && !/^\w+:/i.test(href) || assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href)) {
|
508 |
-
delayedConfirm(editor, 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (state) {
|
509 |
-
if (state) {
|
510 |
-
resultData.href = 'http://' + href;
|
511 |
-
}
|
512 |
-
insertLink(resultData);
|
513 |
-
});
|
514 |
-
return;
|
515 |
-
}
|
516 |
-
insertLink(resultData);
|
517 |
}
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
|
|
|
|
524 |
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
}
|
550 |
-
} else {
|
551 |
-
OpenUrl.open(a.href);
|
552 |
}
|
|
|
|
|
553 |
}
|
554 |
-
}
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
};
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
};
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
}
|
576 |
-
return false;
|
577 |
-
};
|
578 |
-
};
|
579 |
-
var setupGotoLinks = function (editor) {
|
580 |
-
editor.on('click', function (e) {
|
581 |
-
var link = getLink(editor, e.target);
|
582 |
-
if (link && global$1.metaKeyPressed(e)) {
|
583 |
-
e.preventDefault();
|
584 |
-
gotoLink(editor, link);
|
585 |
-
}
|
586 |
-
});
|
587 |
-
editor.on('keydown', function (e) {
|
588 |
-
var link = getSelectedLink(editor);
|
589 |
-
if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
|
590 |
-
e.preventDefault();
|
591 |
-
gotoLink(editor, link);
|
592 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
});
|
594 |
};
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
var toggleViewLinkState = function (editor) {
|
604 |
-
return function () {
|
605 |
-
var self = this;
|
606 |
-
var toggleVisibility = function (e) {
|
607 |
-
if (Utils.hasLinks(e.parents)) {
|
608 |
-
self.show();
|
609 |
-
} else {
|
610 |
-
self.hide();
|
611 |
-
}
|
612 |
-
};
|
613 |
-
if (!Utils.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
|
614 |
self.hide();
|
615 |
}
|
616 |
-
editor.on('nodechange', toggleVisibility);
|
617 |
-
self.on('remove', function () {
|
618 |
-
editor.off('nodechange', toggleVisibility);
|
619 |
-
});
|
620 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
};
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
|
|
630 |
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
icon: 'newtab',
|
659 |
-
tooltip: 'Open link',
|
660 |
-
onclick: Actions.gotoSelectedLink(editor)
|
661 |
-
});
|
662 |
-
}
|
663 |
-
};
|
664 |
-
var setupMenuItems = function (editor) {
|
665 |
-
editor.addMenuItem('openlink', {
|
666 |
-
text: 'Open link',
|
667 |
icon: 'newtab',
|
668 |
-
|
669 |
-
|
670 |
-
prependToContext: true
|
671 |
-
});
|
672 |
-
editor.addMenuItem('link', {
|
673 |
-
icon: 'link',
|
674 |
-
text: 'Link',
|
675 |
-
shortcut: 'Meta+K',
|
676 |
-
onclick: Actions.openDialog(editor),
|
677 |
-
stateSelector: 'a[href]',
|
678 |
-
context: 'insert',
|
679 |
-
prependToContext: true
|
680 |
-
});
|
681 |
-
editor.addMenuItem('unlink', {
|
682 |
-
icon: 'unlink',
|
683 |
-
text: 'Remove link',
|
684 |
-
onclick: Utils.unlink(editor),
|
685 |
-
stateSelector: 'a[href]'
|
686 |
});
|
687 |
-
}
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
setupContextToolbars: setupContextToolbars
|
697 |
-
};
|
698 |
-
|
699 |
-
global.add('link', function (editor) {
|
700 |
-
Controls.setupButtons(editor);
|
701 |
-
Controls.setupMenuItems(editor);
|
702 |
-
Controls.setupContextToolbars(editor);
|
703 |
-
Actions.setupGotoLinks(editor);
|
704 |
-
Commands.register(editor);
|
705 |
-
Keyboard.setup(editor);
|
706 |
});
|
707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
-
|
711 |
|
712 |
}());
|
713 |
})();
|
1 |
(function () {
|
2 |
var link = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
8 |
|
9 |
+
var assumeExternalTargets = function (editorSettings) {
|
10 |
+
return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
|
11 |
+
};
|
12 |
+
var hasContextToolbar = function (editorSettings) {
|
13 |
+
return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
|
14 |
+
};
|
15 |
+
var getLinkList = function (editorSettings) {
|
16 |
+
return editorSettings.link_list;
|
17 |
+
};
|
18 |
+
var hasDefaultLinkTarget = function (editorSettings) {
|
19 |
+
return typeof editorSettings.default_link_target === 'string';
|
20 |
+
};
|
21 |
+
var getDefaultLinkTarget = function (editorSettings) {
|
22 |
+
return editorSettings.default_link_target;
|
23 |
+
};
|
24 |
+
var getTargetList = function (editorSettings) {
|
25 |
+
return editorSettings.target_list;
|
26 |
+
};
|
27 |
+
var setTargetList = function (editor, list) {
|
28 |
+
editor.settings.target_list = list;
|
29 |
+
};
|
30 |
+
var shouldShowTargetList = function (editorSettings) {
|
31 |
+
return getTargetList(editorSettings) !== false;
|
32 |
+
};
|
33 |
+
var getRelList = function (editorSettings) {
|
34 |
+
return editorSettings.rel_list;
|
35 |
+
};
|
36 |
+
var hasRelList = function (editorSettings) {
|
37 |
+
return getRelList(editorSettings) !== undefined;
|
38 |
+
};
|
39 |
+
var getLinkClassList = function (editorSettings) {
|
40 |
+
return editorSettings.link_class_list;
|
41 |
+
};
|
42 |
+
var hasLinkClassList = function (editorSettings) {
|
43 |
+
return getLinkClassList(editorSettings) !== undefined;
|
44 |
+
};
|
45 |
+
var shouldShowLinkTitle = function (editorSettings) {
|
46 |
+
return editorSettings.link_title !== false;
|
47 |
+
};
|
48 |
+
var allowUnsafeLinkTarget = function (editorSettings) {
|
49 |
+
return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
|
50 |
+
};
|
51 |
+
var $_1b4wbxfvjjgwechi = {
|
52 |
+
assumeExternalTargets: assumeExternalTargets,
|
53 |
+
hasContextToolbar: hasContextToolbar,
|
54 |
+
getLinkList: getLinkList,
|
55 |
+
hasDefaultLinkTarget: hasDefaultLinkTarget,
|
56 |
+
getDefaultLinkTarget: getDefaultLinkTarget,
|
57 |
+
getTargetList: getTargetList,
|
58 |
+
setTargetList: setTargetList,
|
59 |
+
shouldShowTargetList: shouldShowTargetList,
|
60 |
+
getRelList: getRelList,
|
61 |
+
hasRelList: hasRelList,
|
62 |
+
getLinkClassList: getLinkClassList,
|
63 |
+
hasLinkClassList: hasLinkClassList,
|
64 |
+
shouldShowLinkTitle: shouldShowLinkTitle,
|
65 |
+
allowUnsafeLinkTarget: allowUnsafeLinkTarget
|
66 |
+
};
|
67 |
|
68 |
+
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
69 |
|
70 |
+
var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
|
71 |
|
72 |
+
var appendClickRemove = function (link, evt) {
|
73 |
+
document.body.appendChild(link);
|
74 |
+
link.dispatchEvent(evt);
|
75 |
+
document.body.removeChild(link);
|
76 |
+
};
|
77 |
+
var open$$1 = function (url) {
|
78 |
+
if (!global$3.ie || global$3.ie > 10) {
|
79 |
+
var link = document.createElement('a');
|
80 |
+
link.target = '_blank';
|
81 |
+
link.href = url;
|
82 |
+
link.rel = 'noreferrer noopener';
|
83 |
+
var evt = document.createEvent('MouseEvents');
|
84 |
+
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
85 |
+
appendClickRemove(link, evt);
|
86 |
+
} else {
|
87 |
+
var win = window.open('', '_blank');
|
88 |
+
if (win) {
|
89 |
+
win.opener = null;
|
90 |
+
var doc = win.document;
|
91 |
+
doc.open();
|
92 |
+
doc.write('<meta http-equiv="refresh" content="0; url=' + global$2.DOM.encode(url) + '">');
|
93 |
+
doc.close();
|
|
|
94 |
}
|
95 |
+
}
|
96 |
+
};
|
97 |
+
var $_du0gebfwjjgwechl = { open: open$$1 };
|
98 |
|
99 |
+
var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
100 |
|
101 |
+
var toggleTargetRules = function (rel, isUnsafe) {
|
102 |
+
var rules = ['noopener'];
|
103 |
+
var newRel = rel ? rel.split(/\s+/) : [];
|
104 |
+
var toString = function (rel) {
|
105 |
+
return global$4.trim(rel.sort().join(' '));
|
106 |
+
};
|
107 |
+
var addTargetRules = function (rel) {
|
108 |
+
rel = removeTargetRules(rel);
|
109 |
+
return rel.length ? rel.concat(rules) : rules;
|
110 |
+
};
|
111 |
+
var removeTargetRules = function (rel) {
|
112 |
+
return rel.filter(function (val) {
|
113 |
+
return global$4.inArray(rules, val) === -1;
|
114 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
};
|
116 |
+
newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
|
117 |
+
return newRel.length ? toString(newRel) : null;
|
118 |
+
};
|
119 |
+
var trimCaretContainers = function (text) {
|
120 |
+
return text.replace(/\uFEFF/g, '');
|
121 |
+
};
|
122 |
+
var getAnchorElement = function (editor, selectedElm) {
|
123 |
+
selectedElm = selectedElm || editor.selection.getNode();
|
124 |
+
if (isImageFigure(selectedElm)) {
|
125 |
+
return editor.dom.select('a[href]', selectedElm)[0];
|
126 |
+
} else {
|
127 |
+
return editor.dom.getParent(selectedElm, 'a[href]');
|
128 |
+
}
|
129 |
+
};
|
130 |
+
var getAnchorText = function (selection, anchorElm) {
|
131 |
+
var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
|
132 |
+
return trimCaretContainers(text);
|
133 |
+
};
|
134 |
+
var isLink = function (elm) {
|
135 |
+
return elm && elm.nodeName === 'A' && elm.href;
|
136 |
+
};
|
137 |
+
var hasLinks = function (elements) {
|
138 |
+
return global$4.grep(elements, isLink).length > 0;
|
139 |
+
};
|
140 |
+
var isOnlyTextSelected = function (html) {
|
141 |
+
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
return true;
|
145 |
+
};
|
146 |
+
var isImageFigure = function (node) {
|
147 |
+
return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
|
148 |
+
};
|
149 |
+
var link = function (editor, attachState) {
|
150 |
+
return function (data) {
|
151 |
+
editor.undoManager.transact(function () {
|
152 |
+
var selectedElm = editor.selection.getNode();
|
153 |
+
var anchorElm = getAnchorElement(editor, selectedElm);
|
154 |
+
var linkAttrs = {
|
155 |
+
href: data.href,
|
156 |
+
target: data.target ? data.target : null,
|
157 |
+
rel: data.rel ? data.rel : null,
|
158 |
+
class: data.class ? data.class : null,
|
159 |
+
title: data.title ? data.title : null
|
160 |
+
};
|
161 |
+
if (!$_1b4wbxfvjjgwechi.hasRelList(editor.settings) && $_1b4wbxfvjjgwechi.allowUnsafeLinkTarget(editor.settings) === false) {
|
162 |
+
linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target === '_blank');
|
163 |
+
}
|
164 |
+
if (data.href === attachState.href) {
|
165 |
+
attachState.attach();
|
166 |
+
attachState = {};
|
167 |
+
}
|
168 |
+
if (anchorElm) {
|
169 |
+
editor.focus();
|
170 |
+
if (data.hasOwnProperty('text')) {
|
171 |
+
if ('innerText' in anchorElm) {
|
172 |
+
anchorElm.innerText = data.text;
|
173 |
} else {
|
174 |
+
anchorElm.textContent = data.text;
|
175 |
}
|
176 |
}
|
177 |
+
editor.dom.setAttribs(anchorElm, linkAttrs);
|
178 |
+
editor.selection.select(anchorElm);
|
179 |
+
editor.undoManager.add();
|
180 |
+
} else {
|
181 |
+
if (isImageFigure(selectedElm)) {
|
182 |
+
linkImageFigure(editor, selectedElm, linkAttrs);
|
183 |
+
} else if (data.hasOwnProperty('text')) {
|
184 |
+
editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
|
|
|
185 |
} else {
|
186 |
+
editor.execCommand('mceInsertLink', false, linkAttrs);
|
187 |
}
|
188 |
+
}
|
189 |
+
});
|
190 |
};
|
191 |
+
};
|
192 |
+
var unlink = function (editor) {
|
193 |
+
return function () {
|
194 |
+
editor.undoManager.transact(function () {
|
195 |
+
var node = editor.selection.getNode();
|
196 |
+
if (isImageFigure(node)) {
|
197 |
+
unlinkImageFigure(editor, node);
|
198 |
+
} else {
|
199 |
+
editor.execCommand('unlink');
|
200 |
}
|
201 |
+
});
|
202 |
};
|
203 |
+
};
|
204 |
+
var unlinkImageFigure = function (editor, fig) {
|
205 |
+
var a, img;
|
206 |
+
img = editor.dom.select('img', fig)[0];
|
207 |
+
if (img) {
|
208 |
+
a = editor.dom.getParents(img, 'a[href]', fig)[0];
|
209 |
+
if (a) {
|
210 |
+
a.parentNode.insertBefore(img, a);
|
211 |
+
editor.dom.remove(a);
|
212 |
}
|
213 |
+
}
|
214 |
+
};
|
215 |
+
var linkImageFigure = function (editor, fig, attrs) {
|
216 |
+
var a, img;
|
217 |
+
img = editor.dom.select('img', fig)[0];
|
218 |
+
if (img) {
|
219 |
+
a = editor.dom.create('a', attrs);
|
220 |
+
img.parentNode.insertBefore(a, img);
|
221 |
+
a.appendChild(img);
|
222 |
+
}
|
223 |
+
};
|
224 |
+
var $_5298ug0jjgweci0 = {
|
225 |
+
link: link,
|
226 |
+
unlink: unlink,
|
227 |
+
isLink: isLink,
|
228 |
+
hasLinks: hasLinks,
|
229 |
+
isOnlyTextSelected: isOnlyTextSelected,
|
230 |
+
getAnchorElement: getAnchorElement,
|
231 |
+
getAnchorText: getAnchorText,
|
232 |
+
toggleTargetRules: toggleTargetRules
|
233 |
+
};
|
234 |
|
235 |
+
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
236 |
|
237 |
+
var global$6 = tinymce.util.Tools.resolve('tinymce.util.XHR');
|
238 |
|
239 |
+
var attachState = {};
|
240 |
+
var createLinkList = function (editor, callback) {
|
241 |
+
var linkList = $_1b4wbxfvjjgwechi.getLinkList(editor.settings);
|
242 |
+
if (typeof linkList === 'string') {
|
243 |
+
global$6.send({
|
244 |
+
url: linkList,
|
245 |
+
success: function (text) {
|
246 |
+
callback(editor, JSON.parse(text));
|
247 |
+
}
|
248 |
+
});
|
249 |
+
} else if (typeof linkList === 'function') {
|
250 |
+
linkList(function (list) {
|
251 |
+
callback(editor, list);
|
252 |
+
});
|
253 |
+
} else {
|
254 |
+
callback(editor, linkList);
|
255 |
+
}
|
256 |
+
};
|
257 |
+
var buildListItems = function (inputList, itemCallback, startItems) {
|
258 |
+
var appendItems = function (values, output) {
|
259 |
+
output = output || [];
|
260 |
+
global$4.each(values, function (item) {
|
261 |
+
var menuItem = { text: item.text || item.title };
|
262 |
+
if (item.menu) {
|
263 |
+
menuItem.menu = appendItems(item.menu);
|
264 |
+
} else {
|
265 |
+
menuItem.value = item.value;
|
266 |
+
if (itemCallback) {
|
267 |
+
itemCallback(menuItem);
|
268 |
}
|
269 |
+
}
|
270 |
+
output.push(menuItem);
|
271 |
+
});
|
272 |
+
return output;
|
273 |
+
};
|
274 |
+
return appendItems(inputList, startItems || []);
|
275 |
+
};
|
276 |
+
var delayedConfirm = function (editor, message, callback) {
|
277 |
+
var rng = editor.selection.getRng();
|
278 |
+
global$5.setEditorTimeout(editor, function () {
|
279 |
+
editor.windowManager.confirm(message, function (state) {
|
280 |
+
editor.selection.setRng(rng);
|
281 |
+
callback(state);
|
282 |
+
});
|
283 |
+
});
|
284 |
+
};
|
285 |
+
var showDialog = function (editor, linkList) {
|
286 |
+
var data = {};
|
287 |
+
var selection = editor.selection;
|
288 |
+
var dom = editor.dom;
|
289 |
+
var anchorElm, initialText;
|
290 |
+
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
291 |
+
var linkListChangeHandler = function (e) {
|
292 |
+
var textCtrl = win.find('#text');
|
293 |
+
if (!textCtrl.value() || e.lastControl && textCtrl.value() === e.lastControl.text()) {
|
294 |
+
textCtrl.value(e.control.text());
|
295 |
+
}
|
296 |
+
win.find('#href').value(e.control.value());
|
297 |
+
};
|
298 |
+
var buildAnchorListControl = function (url) {
|
299 |
+
var anchorList = [];
|
300 |
+
global$4.each(editor.dom.select('a:not([href])'), function (anchor) {
|
301 |
+
var id = anchor.name || anchor.id;
|
302 |
+
if (id) {
|
303 |
+
anchorList.push({
|
304 |
+
text: id,
|
305 |
+
value: '#' + id,
|
306 |
+
selected: url.indexOf('#' + id) !== -1
|
307 |
+
});
|
308 |
+
}
|
309 |
+
});
|
310 |
+
if (anchorList.length) {
|
311 |
+
anchorList.unshift({
|
312 |
+
text: 'None',
|
313 |
+
value: ''
|
314 |
});
|
315 |
+
return {
|
316 |
+
name: 'anchor',
|
317 |
+
type: 'listbox',
|
318 |
+
label: 'Anchors',
|
319 |
+
values: anchorList,
|
320 |
+
onselect: linkListChangeHandler
|
321 |
+
};
|
322 |
}
|
323 |
};
|
324 |
+
var updateText = function () {
|
325 |
+
if (!initialText && onlyText && !data.text) {
|
326 |
+
this.parent().parent().find('#text')[0].value(this.value());
|
327 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
};
|
329 |
+
var urlChange = function (e) {
|
330 |
+
var meta = e.meta || {};
|
331 |
+
if (linkListCtrl) {
|
332 |
+
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
333 |
+
}
|
334 |
+
global$4.each(e.meta, function (value, key) {
|
335 |
+
var inp = win.find('#' + key);
|
336 |
+
if (key === 'text') {
|
337 |
+
if (initialText.length === 0) {
|
338 |
+
inp.value(value);
|
339 |
+
data.text = value;
|
340 |
+
}
|
341 |
+
} else {
|
342 |
+
inp.value(value);
|
343 |
+
}
|
344 |
});
|
345 |
+
if (meta.attach) {
|
346 |
+
attachState = {
|
347 |
+
href: this.value(),
|
348 |
+
attach: meta.attach
|
349 |
+
};
|
350 |
+
}
|
351 |
+
if (!meta.text) {
|
352 |
+
updateText.call(this);
|
353 |
+
}
|
354 |
};
|
355 |
+
var onBeforeCall = function (e) {
|
356 |
+
e.meta = win.toJSON();
|
357 |
+
};
|
358 |
+
onlyText = $_5298ug0jjgweci0.isOnlyTextSelected(selection.getContent());
|
359 |
+
anchorElm = $_5298ug0jjgweci0.getAnchorElement(editor);
|
360 |
+
data.text = initialText = $_5298ug0jjgweci0.getAnchorText(editor.selection, anchorElm);
|
361 |
+
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
362 |
+
if (anchorElm) {
|
363 |
+
data.target = dom.getAttrib(anchorElm, 'target');
|
364 |
+
} else if ($_1b4wbxfvjjgwechi.hasDefaultLinkTarget(editor.settings)) {
|
365 |
+
data.target = $_1b4wbxfvjjgwechi.getDefaultLinkTarget(editor.settings);
|
366 |
+
}
|
367 |
+
if (value = dom.getAttrib(anchorElm, 'rel')) {
|
368 |
+
data.rel = value;
|
369 |
+
}
|
370 |
+
if (value = dom.getAttrib(anchorElm, 'class')) {
|
371 |
+
data.class = value;
|
372 |
+
}
|
373 |
+
if (value = dom.getAttrib(anchorElm, 'title')) {
|
374 |
+
data.title = value;
|
375 |
+
}
|
376 |
+
if (onlyText) {
|
377 |
+
textListCtrl = {
|
378 |
+
name: 'text',
|
379 |
+
type: 'textbox',
|
380 |
+
size: 40,
|
381 |
+
label: 'Text to display',
|
382 |
+
onchange: function () {
|
383 |
+
data.text = this.value();
|
384 |
}
|
|
|
385 |
};
|
386 |
+
}
|
387 |
+
if (linkList) {
|
388 |
+
linkListCtrl = {
|
389 |
+
type: 'listbox',
|
390 |
+
label: 'Link list',
|
391 |
+
values: buildListItems(linkList, function (item) {
|
392 |
+
item.value = editor.convertURL(item.value || item.url, 'href');
|
393 |
+
}, [{
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
text: 'None',
|
395 |
value: ''
|
396 |
+
}]),
|
397 |
+
onselect: linkListChangeHandler,
|
398 |
+
value: editor.convertURL(data.href, 'href'),
|
399 |
+
onPostRender: function () {
|
400 |
+
linkListCtrl = this;
|
|
|
|
|
|
|
401 |
}
|
402 |
};
|
403 |
+
}
|
404 |
+
if ($_1b4wbxfvjjgwechi.shouldShowTargetList(editor.settings)) {
|
405 |
+
if ($_1b4wbxfvjjgwechi.getTargetList(editor.settings) === undefined) {
|
406 |
+
$_1b4wbxfvjjgwechi.setTargetList(editor, [
|
407 |
+
{
|
408 |
+
text: 'None',
|
409 |
+
value: ''
|
410 |
+
},
|
411 |
+
{
|
412 |
+
text: 'New window',
|
413 |
+
value: '_blank'
|
414 |
+
}
|
415 |
+
]);
|
416 |
+
}
|
417 |
+
targetListCtrl = {
|
418 |
+
name: 'target',
|
419 |
+
type: 'listbox',
|
420 |
+
label: 'Target',
|
421 |
+
values: buildListItems($_1b4wbxfvjjgwechi.getTargetList(editor.settings))
|
422 |
};
|
423 |
+
}
|
424 |
+
if ($_1b4wbxfvjjgwechi.hasRelList(editor.settings)) {
|
425 |
+
relListCtrl = {
|
426 |
+
name: 'rel',
|
427 |
+
type: 'listbox',
|
428 |
+
label: 'Rel',
|
429 |
+
values: buildListItems($_1b4wbxfvjjgwechi.getRelList(editor.settings), function (item) {
|
430 |
+
if ($_1b4wbxfvjjgwechi.allowUnsafeLinkTarget(editor.settings) === false) {
|
431 |
+
item.value = $_5298ug0jjgweci0.toggleTargetRules(item.value, data.target === '_blank');
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
433 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
};
|
435 |
+
}
|
436 |
+
if ($_1b4wbxfvjjgwechi.hasLinkClassList(editor.settings)) {
|
437 |
+
classListCtrl = {
|
438 |
+
name: 'class',
|
439 |
+
type: 'listbox',
|
440 |
+
label: 'Class',
|
441 |
+
values: buildListItems($_1b4wbxfvjjgwechi.getLinkClassList(editor.settings), function (item) {
|
442 |
+
if (item.value) {
|
443 |
+
item.textStyle = function () {
|
444 |
+
return editor.formatter.getCssText({
|
445 |
+
inline: 'a',
|
446 |
+
classes: [item.value]
|
447 |
+
});
|
448 |
+
};
|
449 |
+
}
|
450 |
+
})
|
451 |
};
|
452 |
+
}
|
453 |
+
if ($_1b4wbxfvjjgwechi.shouldShowLinkTitle(editor.settings)) {
|
454 |
+
linkTitleCtrl = {
|
455 |
+
name: 'title',
|
456 |
+
type: 'textbox',
|
457 |
+
label: 'Title',
|
458 |
+
value: data.title
|
459 |
+
};
|
460 |
+
}
|
461 |
+
win = editor.windowManager.open({
|
462 |
+
title: 'Insert link',
|
463 |
+
data: data,
|
464 |
+
body: [
|
465 |
+
{
|
466 |
+
name: 'href',
|
467 |
+
type: 'filepicker',
|
468 |
+
filetype: 'file',
|
|
|
|
|
|
|
|
|
|
|
469 |
size: 40,
|
470 |
+
autofocus: true,
|
471 |
+
label: 'Url',
|
472 |
+
onchange: urlChange,
|
473 |
+
onkeyup: updateText,
|
474 |
+
onpaste: updateText,
|
475 |
+
onbeforecall: onBeforeCall
|
476 |
+
},
|
477 |
+
textListCtrl,
|
478 |
+
linkTitleCtrl,
|
479 |
+
buildAnchorListControl(data.href),
|
480 |
+
linkListCtrl,
|
481 |
+
relListCtrl,
|
482 |
+
targetListCtrl,
|
483 |
+
classListCtrl
|
484 |
+
],
|
485 |
+
onSubmit: function (e) {
|
486 |
+
var assumeExternalTargets = $_1b4wbxfvjjgwechi.assumeExternalTargets(editor.settings);
|
487 |
+
var insertLink = $_5298ug0jjgweci0.link(editor, attachState);
|
488 |
+
var removeLink = $_5298ug0jjgweci0.unlink(editor);
|
489 |
+
var resultData = global$4.extend({}, data, e.data);
|
490 |
+
var href = resultData.href;
|
491 |
+
if (!href) {
|
492 |
+
removeLink();
|
493 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
}
|
495 |
+
if (!onlyText || resultData.text === initialText) {
|
496 |
+
delete resultData.text;
|
497 |
+
}
|
498 |
+
if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
|
499 |
+
delayedConfirm(editor, 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', function (state) {
|
500 |
+
if (state) {
|
501 |
+
resultData.href = 'mailto:' + href;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
}
|
503 |
+
insertLink(resultData);
|
504 |
+
});
|
505 |
+
return;
|
506 |
+
}
|
507 |
+
if (assumeExternalTargets === true && !/^\w+:/i.test(href) || assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href)) {
|
508 |
+
delayedConfirm(editor, 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (state) {
|
509 |
+
if (state) {
|
510 |
+
resultData.href = 'http://' + href;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
}
|
512 |
+
insertLink(resultData);
|
513 |
+
});
|
514 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
}
|
516 |
+
insertLink(resultData);
|
517 |
+
}
|
518 |
+
});
|
519 |
+
};
|
520 |
+
var open$1 = function (editor) {
|
521 |
+
createLinkList(editor, showDialog);
|
522 |
+
};
|
523 |
+
var $_dxaplrg2jjgweci6 = { open: open$1 };
|
524 |
|
525 |
+
var getLink = function (editor, elm) {
|
526 |
+
return editor.dom.getParent(elm, 'a[href]');
|
527 |
+
};
|
528 |
+
var getSelectedLink = function (editor) {
|
529 |
+
return getLink(editor, editor.selection.getStart());
|
530 |
+
};
|
531 |
+
var getHref = function (elm) {
|
532 |
+
var href = elm.getAttribute('data-mce-href');
|
533 |
+
return href ? href : elm.getAttribute('href');
|
534 |
+
};
|
535 |
+
var isContextMenuVisible = function (editor) {
|
536 |
+
var contextmenu = editor.plugins.contextmenu;
|
537 |
+
return contextmenu ? contextmenu.isContextMenuVisible() : false;
|
538 |
+
};
|
539 |
+
var hasOnlyAltModifier = function (e) {
|
540 |
+
return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
|
541 |
+
};
|
542 |
+
var gotoLink = function (editor, a) {
|
543 |
+
if (a) {
|
544 |
+
var href = getHref(a);
|
545 |
+
if (/^#/.test(href)) {
|
546 |
+
var targetEl = editor.$(href);
|
547 |
+
if (targetEl.length) {
|
548 |
+
editor.selection.scrollIntoView(targetEl[0], true);
|
|
|
|
|
|
|
549 |
}
|
550 |
+
} else {
|
551 |
+
$_du0gebfwjjgwechl.open(a.href);
|
552 |
}
|
553 |
+
}
|
554 |
+
};
|
555 |
+
var openDialog = function (editor) {
|
556 |
+
return function () {
|
557 |
+
$_dxaplrg2jjgweci6.open(editor);
|
558 |
+
};
|
559 |
+
};
|
560 |
+
var gotoSelectedLink = function (editor) {
|
561 |
+
return function () {
|
562 |
+
gotoLink(editor, getSelectedLink(editor));
|
563 |
+
};
|
564 |
+
};
|
565 |
+
var leftClickedOnAHref = function (editor) {
|
566 |
+
return function (elm) {
|
567 |
+
var sel, rng, node;
|
568 |
+
if ($_1b4wbxfvjjgwechi.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && $_5298ug0jjgweci0.isLink(elm)) {
|
569 |
+
sel = editor.selection;
|
570 |
+
rng = sel.getRng();
|
571 |
+
node = rng.startContainer;
|
572 |
+
if (node.nodeType === 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
|
573 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
}
|
575 |
+
}
|
576 |
+
return false;
|
577 |
+
};
|
578 |
+
};
|
579 |
+
var setupGotoLinks = function (editor) {
|
580 |
+
editor.on('click', function (e) {
|
581 |
+
var link = getLink(editor, e.target);
|
582 |
+
if (link && global$1.metaKeyPressed(e)) {
|
583 |
+
e.preventDefault();
|
584 |
+
gotoLink(editor, link);
|
585 |
+
}
|
586 |
+
});
|
587 |
+
editor.on('keydown', function (e) {
|
588 |
+
var link = getSelectedLink(editor);
|
589 |
+
if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
|
590 |
+
e.preventDefault();
|
591 |
+
gotoLink(editor, link);
|
592 |
+
}
|
593 |
+
});
|
594 |
+
};
|
595 |
+
var toggleActiveState = function (editor) {
|
596 |
+
return function () {
|
597 |
+
var self = this;
|
598 |
+
editor.on('nodechange', function (e) {
|
599 |
+
self.active(!editor.readonly && !!$_5298ug0jjgweci0.getAnchorElement(editor, e.element));
|
600 |
});
|
601 |
};
|
602 |
+
};
|
603 |
+
var toggleViewLinkState = function (editor) {
|
604 |
+
return function () {
|
605 |
+
var self = this;
|
606 |
+
var toggleVisibility = function (e) {
|
607 |
+
if ($_5298ug0jjgweci0.hasLinks(e.parents)) {
|
608 |
+
self.show();
|
609 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
self.hide();
|
611 |
}
|
|
|
|
|
|
|
|
|
612 |
};
|
613 |
+
if (!$_5298ug0jjgweci0.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
|
614 |
+
self.hide();
|
615 |
+
}
|
616 |
+
editor.on('nodechange', toggleVisibility);
|
617 |
+
self.on('remove', function () {
|
618 |
+
editor.off('nodechange', toggleVisibility);
|
619 |
+
});
|
620 |
};
|
621 |
+
};
|
622 |
+
var $_8hceq8ftjjgweche = {
|
623 |
+
openDialog: openDialog,
|
624 |
+
gotoSelectedLink: gotoSelectedLink,
|
625 |
+
leftClickedOnAHref: leftClickedOnAHref,
|
626 |
+
setupGotoLinks: setupGotoLinks,
|
627 |
+
toggleActiveState: toggleActiveState,
|
628 |
+
toggleViewLinkState: toggleViewLinkState
|
629 |
+
};
|
630 |
|
631 |
+
var register = function (editor) {
|
632 |
+
editor.addCommand('mceLink', $_8hceq8ftjjgweche.openDialog(editor));
|
633 |
+
};
|
634 |
+
var $_bauc80fsjjgwechc = { register: register };
|
635 |
|
636 |
+
var setup = function (editor) {
|
637 |
+
editor.addShortcut('Meta+K', '', $_8hceq8ftjjgweche.openDialog(editor));
|
638 |
+
};
|
639 |
+
var $_49u4p1g5jjgwecie = { setup: setup };
|
640 |
|
641 |
+
var setupButtons = function (editor) {
|
642 |
+
editor.addButton('link', {
|
643 |
+
active: false,
|
644 |
+
icon: 'link',
|
645 |
+
tooltip: 'Insert/edit link',
|
646 |
+
onclick: $_8hceq8ftjjgweche.openDialog(editor),
|
647 |
+
onpostrender: $_8hceq8ftjjgweche.toggleActiveState(editor)
|
648 |
+
});
|
649 |
+
editor.addButton('unlink', {
|
650 |
+
active: false,
|
651 |
+
icon: 'unlink',
|
652 |
+
tooltip: 'Remove link',
|
653 |
+
onclick: $_5298ug0jjgweci0.unlink(editor),
|
654 |
+
onpostrender: $_8hceq8ftjjgweche.toggleActiveState(editor)
|
655 |
+
});
|
656 |
+
if (editor.addContextToolbar) {
|
657 |
+
editor.addButton('openlink', {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
icon: 'newtab',
|
659 |
+
tooltip: 'Open link',
|
660 |
+
onclick: $_8hceq8ftjjgweche.gotoSelectedLink(editor)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
});
|
662 |
+
}
|
663 |
+
};
|
664 |
+
var setupMenuItems = function (editor) {
|
665 |
+
editor.addMenuItem('openlink', {
|
666 |
+
text: 'Open link',
|
667 |
+
icon: 'newtab',
|
668 |
+
onclick: $_8hceq8ftjjgweche.gotoSelectedLink(editor),
|
669 |
+
onPostRender: $_8hceq8ftjjgweche.toggleViewLinkState(editor),
|
670 |
+
prependToContext: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
});
|
672 |
+
editor.addMenuItem('link', {
|
673 |
+
icon: 'link',
|
674 |
+
text: 'Link',
|
675 |
+
shortcut: 'Meta+K',
|
676 |
+
onclick: $_8hceq8ftjjgweche.openDialog(editor),
|
677 |
+
stateSelector: 'a[href]',
|
678 |
+
context: 'insert',
|
679 |
+
prependToContext: true
|
680 |
+
});
|
681 |
+
editor.addMenuItem('unlink', {
|
682 |
+
icon: 'unlink',
|
683 |
+
text: 'Remove link',
|
684 |
+
onclick: $_5298ug0jjgweci0.unlink(editor),
|
685 |
+
stateSelector: 'a[href]'
|
686 |
+
});
|
687 |
+
};
|
688 |
+
var setupContextToolbars = function (editor) {
|
689 |
+
if (editor.addContextToolbar) {
|
690 |
+
editor.addContextToolbar($_8hceq8ftjjgweche.leftClickedOnAHref(editor), 'openlink | link unlink');
|
691 |
}
|
692 |
+
};
|
693 |
+
var $_bn93cg6jjgwecif = {
|
694 |
+
setupButtons: setupButtons,
|
695 |
+
setupMenuItems: setupMenuItems,
|
696 |
+
setupContextToolbars: setupContextToolbars
|
697 |
+
};
|
698 |
+
|
699 |
+
global.add('link', function (editor) {
|
700 |
+
$_bn93cg6jjgwecif.setupButtons(editor);
|
701 |
+
$_bn93cg6jjgwecif.setupMenuItems(editor);
|
702 |
+
$_bn93cg6jjgwecif.setupContextToolbars(editor);
|
703 |
+
$_8hceq8ftjjgweche.setupGotoLinks(editor);
|
704 |
+
$_bauc80fsjjgwechc.register(editor);
|
705 |
+
$_49u4p1g5jjgwecie.setup(editor);
|
706 |
+
});
|
707 |
+
function Plugin () {
|
708 |
+
}
|
709 |
|
710 |
+
return Plugin;
|
711 |
|
712 |
}());
|
713 |
})();
|
mce/nonbreaking/plugin.js
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
(function () {
|
2 |
var nonbreaking = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
}
|
51 |
-
e.preventDefault();
|
52 |
-
e.stopImmediatePropagation();
|
53 |
-
Actions.insertNbsp(editor, spaces);
|
54 |
}
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
var register$1 = function (editor) {
|
61 |
-
editor.addButton('nonbreaking', {
|
62 |
-
title: 'Nonbreaking space',
|
63 |
-
cmd: 'mceNonBreaking'
|
64 |
});
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
cmd: 'mceNonBreaking',
|
69 |
-
context: 'insert'
|
70 |
-
});
|
71 |
-
};
|
72 |
-
var Buttons = { register: register$1 };
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
});
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
|
84 |
}());
|
85 |
})();
|
1 |
(function () {
|
2 |
var nonbreaking = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var stringRepeat = function (string, repeats) {
|
8 |
+
var str = '';
|
9 |
+
for (var index = 0; index < repeats; index++) {
|
10 |
+
str += string;
|
11 |
+
}
|
12 |
+
return str;
|
13 |
+
};
|
14 |
+
var isVisualCharsEnabled = function (editor) {
|
15 |
+
return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;
|
16 |
+
};
|
17 |
+
var insertNbsp = function (editor, times) {
|
18 |
+
var nbsp = isVisualCharsEnabled(editor) ? '<span class="mce-nbsp"> </span>' : ' ';
|
19 |
+
editor.insertContent(stringRepeat(nbsp, times));
|
20 |
+
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
|
21 |
+
};
|
22 |
+
var $_eqfkn3htjjgwecrh = { insertNbsp: insertNbsp };
|
23 |
|
24 |
+
var register = function (editor) {
|
25 |
+
editor.addCommand('mceNonBreaking', function () {
|
26 |
+
$_eqfkn3htjjgwecrh.insertNbsp(editor, 1);
|
27 |
+
});
|
28 |
+
};
|
29 |
+
var $_duyz3ehsjjgwecrg = { register: register };
|
30 |
|
31 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
32 |
|
33 |
+
var getKeyboardSpaces = function (editor) {
|
34 |
+
var spaces = editor.getParam('nonbreaking_force_tab', 0);
|
35 |
+
if (typeof spaces === 'boolean') {
|
36 |
+
return spaces === true ? 3 : 0;
|
37 |
+
} else {
|
38 |
+
return spaces;
|
39 |
+
}
|
40 |
+
};
|
41 |
+
var $_7krohxhwjjgwecrk = { getKeyboardSpaces: getKeyboardSpaces };
|
42 |
|
43 |
+
var setup = function (editor) {
|
44 |
+
var spaces = $_7krohxhwjjgwecrk.getKeyboardSpaces(editor);
|
45 |
+
if (spaces > 0) {
|
46 |
+
editor.on('keydown', function (e) {
|
47 |
+
if (e.keyCode === global$1.TAB && !e.isDefaultPrevented()) {
|
48 |
+
if (e.shiftKey) {
|
49 |
+
return;
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
+
e.preventDefault();
|
52 |
+
e.stopImmediatePropagation();
|
53 |
+
$_eqfkn3htjjgwecrh.insertNbsp(editor, spaces);
|
54 |
+
}
|
|
|
|
|
|
|
|
|
|
|
55 |
});
|
56 |
+
}
|
57 |
+
};
|
58 |
+
var $_cy5vbshujjgwecri = { setup: setup };
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
var register$1 = function (editor) {
|
61 |
+
editor.addButton('nonbreaking', {
|
62 |
+
title: 'Nonbreaking space',
|
63 |
+
cmd: 'mceNonBreaking'
|
64 |
});
|
65 |
+
editor.addMenuItem('nonbreaking', {
|
66 |
+
icon: 'nonbreaking',
|
67 |
+
text: 'Nonbreaking space',
|
68 |
+
cmd: 'mceNonBreaking',
|
69 |
+
context: 'insert'
|
70 |
+
});
|
71 |
+
};
|
72 |
+
var $_6surrthxjjgwecrl = { register: register$1 };
|
73 |
+
|
74 |
+
global.add('nonbreaking', function (editor) {
|
75 |
+
$_duyz3ehsjjgwecrg.register(editor);
|
76 |
+
$_6surrthxjjgwecrl.register(editor);
|
77 |
+
$_cy5vbshujjgwecri.setup(editor);
|
78 |
+
});
|
79 |
+
function Plugin () {
|
80 |
+
}
|
81 |
|
82 |
+
return Plugin;
|
83 |
|
84 |
}());
|
85 |
})();
|
mce/print/plugin.js
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
(function () {
|
2 |
var print = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
var register$1 = function (editor) {
|
15 |
-
editor.addButton('print', {
|
16 |
-
title: 'Print',
|
17 |
-
cmd: 'mcePrint'
|
18 |
-
});
|
19 |
-
editor.addMenuItem('print', {
|
20 |
-
text: 'Print',
|
21 |
-
cmd: 'mcePrint',
|
22 |
-
icon: 'print'
|
23 |
-
});
|
24 |
-
};
|
25 |
-
var Buttons = { register: register$1 };
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
});
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
|
37 |
}());
|
38 |
})();
|
1 |
(function () {
|
2 |
var print = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var register = function (editor) {
|
8 |
+
editor.addCommand('mcePrint', function () {
|
9 |
+
editor.getWin().print();
|
10 |
+
});
|
11 |
+
};
|
12 |
+
var $_brqngvjljjgwecz3 = { register: register };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
var register$1 = function (editor) {
|
15 |
+
editor.addButton('print', {
|
16 |
+
title: 'Print',
|
17 |
+
cmd: 'mcePrint'
|
18 |
});
|
19 |
+
editor.addMenuItem('print', {
|
20 |
+
text: 'Print',
|
21 |
+
cmd: 'mcePrint',
|
22 |
+
icon: 'print'
|
23 |
+
});
|
24 |
+
};
|
25 |
+
var $_3xztukjmjjgwecz4 = { register: register$1 };
|
26 |
+
|
27 |
+
global.add('print', function (editor) {
|
28 |
+
$_brqngvjljjgwecz3.register(editor);
|
29 |
+
$_3xztukjmjjgwecz4.register(editor);
|
30 |
+
editor.addShortcut('Meta+P', '', 'mcePrint');
|
31 |
+
});
|
32 |
+
function Plugin () {
|
33 |
+
}
|
34 |
|
35 |
+
return Plugin;
|
36 |
|
37 |
}());
|
38 |
})();
|
mce/searchreplace/plugin.js
CHANGED
@@ -1,601 +1,603 @@
|
|
1 |
(function () {
|
2 |
var searchreplace = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
};
|
13 |
-
var clone = function () {
|
14 |
-
return Cell(get());
|
15 |
-
};
|
16 |
-
return {
|
17 |
-
get: get,
|
18 |
-
set: set,
|
19 |
-
clone: clone
|
20 |
-
};
|
21 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
}
|
44 |
-
var index = m.index;
|
45 |
-
if (captureGroup > 0) {
|
46 |
-
var cg = m[captureGroup];
|
47 |
-
if (!cg) {
|
48 |
-
throw new Error('Invalid capture group');
|
49 |
-
}
|
50 |
-
index += m[0].indexOf(cg);
|
51 |
-
m[0] = cg;
|
52 |
-
}
|
53 |
-
return [
|
54 |
-
index,
|
55 |
-
index + m[0].length,
|
56 |
-
[m[0]]
|
57 |
-
];
|
58 |
}
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
63 |
}
|
64 |
-
|
65 |
-
|
66 |
-
}
|
67 |
-
txt = '';
|
68 |
-
if (isContentEditableFalse(node)) {
|
69 |
-
return '\n';
|
70 |
-
}
|
71 |
-
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
|
72 |
-
txt += '\n';
|
73 |
-
}
|
74 |
-
if (node = node.firstChild) {
|
75 |
-
do {
|
76 |
-
txt += getText(node);
|
77 |
-
} while (node = node.nextSibling);
|
78 |
-
}
|
79 |
-
return txt;
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
} else if (
|
121 |
-
|
122 |
-
curNode = curNode.firstChild;
|
123 |
-
continue;
|
124 |
-
}
|
125 |
-
} else if (curNode.nextSibling) {
|
126 |
-
curNode = curNode.nextSibling;
|
127 |
-
continue;
|
128 |
}
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
break;
|
133 |
-
} else if (curNode.parentNode !== node) {
|
134 |
-
curNode = curNode.parentNode;
|
135 |
-
} else {
|
136 |
-
break out;
|
137 |
-
}
|
138 |
}
|
|
|
139 |
}
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
}
|
156 |
-
return function (range) {
|
157 |
-
var before;
|
158 |
-
var after;
|
159 |
-
var parentNode;
|
160 |
-
var startNode = range.startNode;
|
161 |
-
var endNode = range.endNode;
|
162 |
-
var matchIndex = range.matchIndex;
|
163 |
-
if (startNode === endNode) {
|
164 |
-
var node_1 = startNode;
|
165 |
-
parentNode = node_1.parentNode;
|
166 |
-
if (range.startNodeIndex > 0) {
|
167 |
-
before = doc.createTextNode(node_1.data.substring(0, range.startNodeIndex));
|
168 |
-
parentNode.insertBefore(before, node_1);
|
169 |
}
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
-
node_1.parentNode.removeChild(node_1);
|
177 |
-
return el;
|
178 |
}
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
-
|
188 |
-
parentNode = startNode.parentNode;
|
189 |
-
parentNode.insertBefore(before, startNode);
|
190 |
-
parentNode.insertBefore(elA, startNode);
|
191 |
-
parentNode.removeChild(startNode);
|
192 |
-
parentNode = endNode.parentNode;
|
193 |
-
parentNode.insertBefore(elB, endNode);
|
194 |
-
parentNode.insertBefore(after, endNode);
|
195 |
-
parentNode.removeChild(endNode);
|
196 |
-
return elB;
|
197 |
};
|
|
|
|
|
198 |
}
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
}
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
matches.push(getMatchIndexes(m, captureGroup));
|
210 |
}
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
|
|
216 |
}
|
217 |
-
|
|
|
|
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
}
|
254 |
}
|
255 |
}
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
}
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
}
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
}
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
removeNode(editor.dom, nodes[i]);
|
|
|
|
|
|
|
324 |
}
|
325 |
-
while (nodes[++i]) {
|
326 |
-
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
327 |
-
if (matchIndex === currentMatchIndex) {
|
328 |
-
removeNode(editor.dom, nodes[i]);
|
329 |
-
} else {
|
330 |
-
i--;
|
331 |
-
break;
|
332 |
-
}
|
333 |
-
}
|
334 |
-
if (forward) {
|
335 |
-
nextIndex--;
|
336 |
-
}
|
337 |
-
} else if (currentMatchIndex > currentIndexState.get()) {
|
338 |
-
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
339 |
}
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
endContainer = nodes[i].firstChild;
|
362 |
}
|
363 |
-
|
364 |
}
|
|
|
365 |
}
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
return rng;
|
374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
};
|
376 |
-
var
|
377 |
-
return
|
378 |
};
|
379 |
-
var
|
380 |
-
return
|
381 |
};
|
382 |
-
|
383 |
done: done,
|
384 |
find: find,
|
385 |
next: next,
|
386 |
prev: prev,
|
387 |
-
replace: replace
|
388 |
-
hasNext: hasNext,
|
389 |
-
hasPrev: hasPrev
|
390 |
};
|
|
|
|
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
editor.windowManager.alert('Could not find the specified string.', function () {
|
428 |
-
win.find('#find')[0].focus();
|
429 |
-
});
|
430 |
-
}
|
431 |
-
var win = editor.windowManager.open({
|
432 |
-
layout: 'flex',
|
433 |
-
pack: 'center',
|
434 |
-
align: 'center',
|
435 |
-
onClose: function () {
|
436 |
-
editor.focus();
|
437 |
-
Actions.done(editor, currentIndexState);
|
438 |
-
editor.undoManager.add();
|
439 |
-
},
|
440 |
-
onSubmit: function (e) {
|
441 |
-
var count, caseState, text, wholeWord;
|
442 |
-
e.preventDefault();
|
443 |
-
caseState = win.find('#case').checked();
|
444 |
-
wholeWord = win.find('#words').checked();
|
445 |
-
text = win.find('#find').value();
|
446 |
-
if (!text.length) {
|
447 |
-
Actions.done(editor, currentIndexState, false);
|
448 |
-
win.statusbar.items().slice(1).disabled(true);
|
449 |
-
return;
|
450 |
-
}
|
451 |
-
if (last.text === text && last.caseState === caseState && last.wholeWord === wholeWord) {
|
452 |
-
if (!Actions.hasNext(editor, currentIndexState)) {
|
453 |
-
notFoundAlert();
|
454 |
-
return;
|
455 |
-
}
|
456 |
-
Actions.next(editor, currentIndexState);
|
457 |
-
updateButtonStates();
|
458 |
-
return;
|
459 |
-
}
|
460 |
-
count = Actions.find(editor, currentIndexState, text, caseState, wholeWord);
|
461 |
-
if (!count) {
|
462 |
notFoundAlert();
|
|
|
463 |
}
|
464 |
-
|
465 |
updateButtonStates();
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
},
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
win.submit();
|
478 |
-
}
|
479 |
-
},
|
480 |
-
{
|
481 |
-
text: 'Replace',
|
482 |
-
disabled: true,
|
483 |
-
onclick: function () {
|
484 |
-
if (!Actions.replace(editor, currentIndexState, win.find('#replace').value())) {
|
485 |
-
win.statusbar.items().slice(1).disabled(true);
|
486 |
-
currentIndexState.set(-1);
|
487 |
-
last = {};
|
488 |
-
}
|
489 |
-
}
|
490 |
-
},
|
491 |
-
{
|
492 |
-
text: 'Replace all',
|
493 |
-
disabled: true,
|
494 |
-
onclick: function () {
|
495 |
-
Actions.replace(editor, currentIndexState, win.find('#replace').value(), true, true);
|
496 |
win.statusbar.items().slice(1).disabled(true);
|
|
|
497 |
last = {};
|
498 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
},
|
500 |
{
|
501 |
-
type: '
|
502 |
-
|
|
|
|
|
503 |
},
|
504 |
{
|
505 |
-
|
506 |
-
name: '
|
507 |
-
|
508 |
-
|
509 |
-
Actions.prev(editor, currentIndexState);
|
510 |
-
updateButtonStates();
|
511 |
-
}
|
512 |
},
|
513 |
{
|
514 |
-
|
515 |
-
name: '
|
516 |
-
|
517 |
-
|
518 |
-
Actions.next(editor, currentIndexState);
|
519 |
-
updateButtonStates();
|
520 |
-
}
|
521 |
}
|
522 |
-
]
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
labelGap: 30,
|
528 |
-
spacing: 10,
|
529 |
-
items: [
|
530 |
-
{
|
531 |
-
type: 'textbox',
|
532 |
-
name: 'find',
|
533 |
-
size: 40,
|
534 |
-
label: 'Find',
|
535 |
-
value: selectedText
|
536 |
-
},
|
537 |
-
{
|
538 |
-
type: 'textbox',
|
539 |
-
name: 'replace',
|
540 |
-
size: 40,
|
541 |
-
label: 'Replace with'
|
542 |
-
},
|
543 |
-
{
|
544 |
-
type: 'checkbox',
|
545 |
-
name: 'case',
|
546 |
-
text: 'Match case',
|
547 |
-
label: ' '
|
548 |
-
},
|
549 |
-
{
|
550 |
-
type: 'checkbox',
|
551 |
-
name: 'words',
|
552 |
-
text: 'Whole words',
|
553 |
-
label: ' '
|
554 |
-
}
|
555 |
-
]
|
556 |
-
}
|
557 |
-
});
|
558 |
-
};
|
559 |
-
var Dialog = { open: open };
|
560 |
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
};
|
572 |
};
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
editor.addButton('searchreplace', {
|
582 |
-
tooltip: 'Find and replace',
|
583 |
-
onclick: showDialog(editor, currentIndexState)
|
584 |
-
});
|
585 |
-
editor.shortcuts.add('Meta+F', '', showDialog(editor, currentIndexState));
|
586 |
-
};
|
587 |
-
var Buttons = { register: register$1 };
|
588 |
-
|
589 |
-
global.add('searchreplace', function (editor) {
|
590 |
-
var currentIndexState = Cell(-1);
|
591 |
-
Commands.register(editor, currentIndexState);
|
592 |
-
Buttons.register(editor, currentIndexState);
|
593 |
-
return Api.get(editor, currentIndexState);
|
594 |
});
|
595 |
-
|
596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
-
|
599 |
|
600 |
}());
|
601 |
})();
|
1 |
(function () {
|
2 |
var searchreplace = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var Cell = function (initial) {
|
6 |
+
var value = initial;
|
7 |
+
var get = function () {
|
8 |
+
return value;
|
9 |
+
};
|
10 |
+
var set = function (v) {
|
11 |
+
value = v;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
};
|
13 |
+
var clone = function () {
|
14 |
+
return Cell(get());
|
15 |
+
};
|
16 |
+
return {
|
17 |
+
get: get,
|
18 |
+
set: set,
|
19 |
+
clone: clone
|
20 |
+
};
|
21 |
+
};
|
22 |
|
23 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
24 |
|
25 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
26 |
|
27 |
+
function isContentEditableFalse(node) {
|
28 |
+
return node && node.nodeType === 1 && node.contentEditable === 'false';
|
29 |
+
}
|
30 |
+
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
|
31 |
+
var m;
|
32 |
+
var matches = [];
|
33 |
+
var text, count = 0, doc;
|
34 |
+
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
|
35 |
+
doc = node.ownerDocument;
|
36 |
+
blockElementsMap = schema.getBlockElements();
|
37 |
+
hiddenTextElementsMap = schema.getWhiteSpaceElements();
|
38 |
+
shortEndedElementsMap = schema.getShortEndedElements();
|
39 |
+
function getMatchIndexes(m, captureGroup) {
|
40 |
+
captureGroup = captureGroup || 0;
|
41 |
+
if (!m[0]) {
|
42 |
+
throw new Error('findAndReplaceDOMText cannot handle zero-length matches');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
var index = m.index;
|
45 |
+
if (captureGroup > 0) {
|
46 |
+
var cg = m[captureGroup];
|
47 |
+
if (!cg) {
|
48 |
+
throw new Error('Invalid capture group');
|
49 |
}
|
50 |
+
index += m[0].indexOf(cg);
|
51 |
+
m[0] = cg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
+
return [
|
54 |
+
index,
|
55 |
+
index + m[0].length,
|
56 |
+
[m[0]]
|
57 |
+
];
|
58 |
+
}
|
59 |
+
function getText(node) {
|
60 |
+
var txt;
|
61 |
+
if (node.nodeType === 3) {
|
62 |
+
return node.data;
|
63 |
+
}
|
64 |
+
if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
|
65 |
+
return '';
|
66 |
+
}
|
67 |
+
txt = '';
|
68 |
+
if (isContentEditableFalse(node)) {
|
69 |
+
return '\n';
|
70 |
+
}
|
71 |
+
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
|
72 |
+
txt += '\n';
|
73 |
+
}
|
74 |
+
if (node = node.firstChild) {
|
75 |
+
do {
|
76 |
+
txt += getText(node);
|
77 |
+
} while (node = node.nextSibling);
|
78 |
+
}
|
79 |
+
return txt;
|
80 |
+
}
|
81 |
+
function stepThroughMatches(node, matches, replaceFn) {
|
82 |
+
var startNode, endNode, startNodeIndex, endNodeIndex, innerNodes = [], atIndex = 0, curNode = node, matchLocation = matches.shift(), matchIndex = 0;
|
83 |
+
out:
|
84 |
+
while (true) {
|
85 |
+
if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName] || isContentEditableFalse(curNode)) {
|
86 |
+
atIndex++;
|
87 |
+
}
|
88 |
+
if (curNode.nodeType === 3) {
|
89 |
+
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
|
90 |
+
endNode = curNode;
|
91 |
+
endNodeIndex = matchLocation[1] - atIndex;
|
92 |
+
} else if (startNode) {
|
93 |
+
innerNodes.push(curNode);
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
+
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
|
96 |
+
startNode = curNode;
|
97 |
+
startNodeIndex = matchLocation[0] - atIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
+
atIndex += curNode.length;
|
100 |
}
|
101 |
+
if (startNode && endNode) {
|
102 |
+
curNode = replaceFn({
|
103 |
+
startNode: startNode,
|
104 |
+
startNodeIndex: startNodeIndex,
|
105 |
+
endNode: endNode,
|
106 |
+
endNodeIndex: endNodeIndex,
|
107 |
+
innerNodes: innerNodes,
|
108 |
+
match: matchLocation[2],
|
109 |
+
matchIndex: matchIndex
|
110 |
+
});
|
111 |
+
atIndex -= endNode.length - endNodeIndex;
|
112 |
+
startNode = null;
|
113 |
+
endNode = null;
|
114 |
+
innerNodes = [];
|
115 |
+
matchLocation = matches.shift();
|
116 |
+
matchIndex++;
|
117 |
+
if (!matchLocation) {
|
118 |
+
break;
|
119 |
}
|
120 |
+
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
|
121 |
+
if (!isContentEditableFalse(curNode)) {
|
122 |
+
curNode = curNode.firstChild;
|
123 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
+
} else if (curNode.nextSibling) {
|
126 |
+
curNode = curNode.nextSibling;
|
127 |
+
continue;
|
128 |
+
}
|
129 |
+
while (true) {
|
130 |
+
if (curNode.nextSibling) {
|
131 |
+
curNode = curNode.nextSibling;
|
132 |
+
break;
|
133 |
+
} else if (curNode.parentNode !== node) {
|
134 |
+
curNode = curNode.parentNode;
|
135 |
+
} else {
|
136 |
+
break out;
|
137 |
}
|
|
|
|
|
138 |
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
function genReplacer(nodeName) {
|
142 |
+
var makeReplacementNode;
|
143 |
+
if (typeof nodeName !== 'function') {
|
144 |
+
var stencilNode_1 = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
|
145 |
+
makeReplacementNode = function (fill, matchIndex) {
|
146 |
+
var clone = stencilNode_1.cloneNode(false);
|
147 |
+
clone.setAttribute('data-mce-index', matchIndex);
|
148 |
+
if (fill) {
|
149 |
+
clone.appendChild(doc.createTextNode(fill));
|
150 |
}
|
151 |
+
return clone;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
};
|
153 |
+
} else {
|
154 |
+
makeReplacementNode = nodeName;
|
155 |
}
|
156 |
+
return function (range) {
|
157 |
+
var before;
|
158 |
+
var after;
|
159 |
+
var parentNode;
|
160 |
+
var startNode = range.startNode;
|
161 |
+
var endNode = range.endNode;
|
162 |
+
var matchIndex = range.matchIndex;
|
163 |
+
if (startNode === endNode) {
|
164 |
+
var node_1 = startNode;
|
165 |
+
parentNode = node_1.parentNode;
|
166 |
+
if (range.startNodeIndex > 0) {
|
167 |
+
before = doc.createTextNode(node_1.data.substring(0, range.startNodeIndex));
|
168 |
+
parentNode.insertBefore(before, node_1);
|
169 |
+
}
|
170 |
+
var el = makeReplacementNode(range.match[0], matchIndex);
|
171 |
+
parentNode.insertBefore(el, node_1);
|
172 |
+
if (range.endNodeIndex < node_1.length) {
|
173 |
+
after = doc.createTextNode(node_1.data.substring(range.endNodeIndex));
|
174 |
+
parentNode.insertBefore(after, node_1);
|
175 |
+
}
|
176 |
+
node_1.parentNode.removeChild(node_1);
|
177 |
+
return el;
|
178 |
}
|
179 |
+
before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
|
180 |
+
after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
|
181 |
+
var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
|
182 |
+
var innerEls = [];
|
183 |
+
for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
|
184 |
+
var innerNode = range.innerNodes[i];
|
185 |
+
var innerEl = makeReplacementNode(innerNode.data, matchIndex);
|
186 |
+
innerNode.parentNode.replaceChild(innerEl, innerNode);
|
187 |
+
innerEls.push(innerEl);
|
188 |
+
}
|
189 |
+
var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
|
190 |
+
parentNode = startNode.parentNode;
|
191 |
+
parentNode.insertBefore(before, startNode);
|
192 |
+
parentNode.insertBefore(elA, startNode);
|
193 |
+
parentNode.removeChild(startNode);
|
194 |
+
parentNode = endNode.parentNode;
|
195 |
+
parentNode.insertBefore(elB, endNode);
|
196 |
+
parentNode.insertBefore(after, endNode);
|
197 |
+
parentNode.removeChild(endNode);
|
198 |
+
return elB;
|
199 |
+
};
|
200 |
+
}
|
201 |
+
text = getText(node);
|
202 |
+
if (!text) {
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
if (regex.global) {
|
206 |
+
while (m = regex.exec(text)) {
|
207 |
matches.push(getMatchIndexes(m, captureGroup));
|
208 |
}
|
209 |
+
} else {
|
210 |
+
m = text.match(regex);
|
211 |
+
matches.push(getMatchIndexes(m, captureGroup));
|
212 |
+
}
|
213 |
+
if (matches.length) {
|
214 |
+
count = matches.length;
|
215 |
+
stepThroughMatches(node, matches, genReplacer(replacementNode));
|
216 |
}
|
217 |
+
return count;
|
218 |
+
}
|
219 |
+
var $_frdtaok1jjgwed02 = { findAndReplaceDOMText: findAndReplaceDOMText };
|
220 |
|
221 |
+
var getElmIndex = function (elm) {
|
222 |
+
var value = elm.getAttribute('data-mce-index');
|
223 |
+
if (typeof value === 'number') {
|
224 |
+
return '' + value;
|
225 |
+
}
|
226 |
+
return value;
|
227 |
+
};
|
228 |
+
var markAllMatches = function (editor, currentIndexState, regex) {
|
229 |
+
var node, marker;
|
230 |
+
marker = editor.dom.create('span', { 'data-mce-bogus': 1 });
|
231 |
+
marker.className = 'mce-match-marker';
|
232 |
+
node = editor.getBody();
|
233 |
+
done(editor, currentIndexState, false);
|
234 |
+
return $_frdtaok1jjgwed02.findAndReplaceDOMText(regex, node, marker, false, editor.schema);
|
235 |
+
};
|
236 |
+
var unwrap = function (node) {
|
237 |
+
var parentNode = node.parentNode;
|
238 |
+
if (node.firstChild) {
|
239 |
+
parentNode.insertBefore(node.firstChild, node);
|
240 |
+
}
|
241 |
+
node.parentNode.removeChild(node);
|
242 |
+
};
|
243 |
+
var findSpansByIndex = function (editor, index) {
|
244 |
+
var nodes;
|
245 |
+
var spans = [];
|
246 |
+
nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
247 |
+
if (nodes.length) {
|
248 |
+
for (var i = 0; i < nodes.length; i++) {
|
249 |
+
var nodeIndex = getElmIndex(nodes[i]);
|
250 |
+
if (nodeIndex === null || !nodeIndex.length) {
|
251 |
+
continue;
|
252 |
+
}
|
253 |
+
if (nodeIndex === index.toString()) {
|
254 |
+
spans.push(nodes[i]);
|
|
|
255 |
}
|
256 |
}
|
257 |
+
}
|
258 |
+
return spans;
|
259 |
+
};
|
260 |
+
var moveSelection = function (editor, currentIndexState, forward) {
|
261 |
+
var testIndex = currentIndexState.get();
|
262 |
+
var dom = editor.dom;
|
263 |
+
forward = forward !== false;
|
264 |
+
if (forward) {
|
265 |
+
testIndex++;
|
266 |
+
} else {
|
267 |
+
testIndex--;
|
268 |
+
}
|
269 |
+
dom.removeClass(findSpansByIndex(editor, currentIndexState.get()), 'mce-match-marker-selected');
|
270 |
+
var spans = findSpansByIndex(editor, testIndex);
|
271 |
+
if (spans.length) {
|
272 |
+
dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
|
273 |
+
editor.selection.scrollIntoView(spans[0]);
|
274 |
+
return testIndex;
|
275 |
+
}
|
276 |
+
return -1;
|
277 |
+
};
|
278 |
+
var removeNode = function (dom, node) {
|
279 |
+
var parent = node.parentNode;
|
280 |
+
dom.remove(node);
|
281 |
+
if (dom.isEmpty(parent)) {
|
282 |
+
dom.remove(parent);
|
283 |
+
}
|
284 |
+
};
|
285 |
+
var find = function (editor, currentIndexState, text, matchCase, wholeWord) {
|
286 |
+
text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
287 |
+
text = text.replace(/\s/g, '\\s');
|
288 |
+
text = wholeWord ? '\\b' + text + '\\b' : text;
|
289 |
+
var count = markAllMatches(editor, currentIndexState, new RegExp(text, matchCase ? 'g' : 'gi'));
|
290 |
+
if (count) {
|
291 |
+
currentIndexState.set(-1);
|
292 |
+
currentIndexState.set(moveSelection(editor, currentIndexState, true));
|
293 |
+
}
|
294 |
+
return count;
|
295 |
+
};
|
296 |
+
var next = function (editor, currentIndexState) {
|
297 |
+
var index = moveSelection(editor, currentIndexState, true);
|
298 |
+
if (index !== -1) {
|
299 |
+
currentIndexState.set(index);
|
300 |
+
}
|
301 |
+
};
|
302 |
+
var prev = function (editor, currentIndexState) {
|
303 |
+
var index = moveSelection(editor, currentIndexState, false);
|
304 |
+
if (index !== -1) {
|
305 |
+
currentIndexState.set(index);
|
306 |
+
}
|
307 |
+
};
|
308 |
+
var isMatchSpan = function (node) {
|
309 |
+
var matchIndex = getElmIndex(node);
|
310 |
+
return matchIndex !== null && matchIndex.length > 0;
|
311 |
+
};
|
312 |
+
var replace = function (editor, currentIndexState, text, forward, all) {
|
313 |
+
var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndexState.get(), hasMore;
|
314 |
+
forward = forward !== false;
|
315 |
+
node = editor.getBody();
|
316 |
+
nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
|
317 |
+
for (i = 0; i < nodes.length; i++) {
|
318 |
+
var nodeIndex = getElmIndex(nodes[i]);
|
319 |
+
matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
|
320 |
+
if (all || matchIndex === currentIndexState.get()) {
|
321 |
+
if (text.length) {
|
322 |
+
nodes[i].firstChild.nodeValue = text;
|
323 |
+
unwrap(nodes[i]);
|
324 |
+
} else {
|
325 |
+
removeNode(editor.dom, nodes[i]);
|
326 |
+
}
|
327 |
+
while (nodes[++i]) {
|
328 |
+
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
329 |
+
if (matchIndex === currentMatchIndex) {
|
330 |
removeNode(editor.dom, nodes[i]);
|
331 |
+
} else {
|
332 |
+
i--;
|
333 |
+
break;
|
334 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
}
|
336 |
+
if (forward) {
|
337 |
+
nextIndex--;
|
338 |
+
}
|
339 |
+
} else if (currentMatchIndex > currentIndexState.get()) {
|
340 |
+
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
341 |
}
|
342 |
+
}
|
343 |
+
currentIndexState.set(nextIndex);
|
344 |
+
if (forward) {
|
345 |
+
hasMore = hasNext(editor, currentIndexState);
|
346 |
+
next(editor, currentIndexState);
|
347 |
+
} else {
|
348 |
+
hasMore = hasPrev(editor, currentIndexState);
|
349 |
+
prev(editor, currentIndexState);
|
350 |
+
}
|
351 |
+
return !all && hasMore;
|
352 |
+
};
|
353 |
+
var done = function (editor, currentIndexState, keepEditorSelection) {
|
354 |
+
var i, nodes, startContainer, endContainer;
|
355 |
+
nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
356 |
+
for (i = 0; i < nodes.length; i++) {
|
357 |
+
var nodeIndex = getElmIndex(nodes[i]);
|
358 |
+
if (nodeIndex !== null && nodeIndex.length) {
|
359 |
+
if (nodeIndex === currentIndexState.get().toString()) {
|
360 |
+
if (!startContainer) {
|
361 |
+
startContainer = nodes[i].firstChild;
|
|
|
362 |
}
|
363 |
+
endContainer = nodes[i].firstChild;
|
364 |
}
|
365 |
+
unwrap(nodes[i]);
|
366 |
}
|
367 |
+
}
|
368 |
+
if (startContainer && endContainer) {
|
369 |
+
var rng = editor.dom.createRng();
|
370 |
+
rng.setStart(startContainer, 0);
|
371 |
+
rng.setEnd(endContainer, endContainer.data.length);
|
372 |
+
if (keepEditorSelection !== false) {
|
373 |
+
editor.selection.setRng(rng);
|
|
|
374 |
}
|
375 |
+
return rng;
|
376 |
+
}
|
377 |
+
};
|
378 |
+
var hasNext = function (editor, currentIndexState) {
|
379 |
+
return findSpansByIndex(editor, currentIndexState.get() + 1).length > 0;
|
380 |
+
};
|
381 |
+
var hasPrev = function (editor, currentIndexState) {
|
382 |
+
return findSpansByIndex(editor, currentIndexState.get() - 1).length > 0;
|
383 |
+
};
|
384 |
+
var $_8aeifjjzjjgweczv = {
|
385 |
+
done: done,
|
386 |
+
find: find,
|
387 |
+
next: next,
|
388 |
+
prev: prev,
|
389 |
+
replace: replace,
|
390 |
+
hasNext: hasNext,
|
391 |
+
hasPrev: hasPrev
|
392 |
+
};
|
393 |
+
|
394 |
+
var get = function (editor, currentIndexState) {
|
395 |
+
var done = function (keepEditorSelection) {
|
396 |
+
return $_8aeifjjzjjgweczv.done(editor, currentIndexState, keepEditorSelection);
|
397 |
+
};
|
398 |
+
var find = function (text, matchCase, wholeWord) {
|
399 |
+
return $_8aeifjjzjjgweczv.find(editor, currentIndexState, text, matchCase, wholeWord);
|
400 |
+
};
|
401 |
+
var next = function () {
|
402 |
+
return $_8aeifjjzjjgweczv.next(editor, currentIndexState);
|
403 |
};
|
404 |
+
var prev = function () {
|
405 |
+
return $_8aeifjjzjjgweczv.prev(editor, currentIndexState);
|
406 |
};
|
407 |
+
var replace = function (text, forward, all) {
|
408 |
+
return $_8aeifjjzjjgweczv.replace(editor, currentIndexState, text, forward, all);
|
409 |
};
|
410 |
+
return {
|
411 |
done: done,
|
412 |
find: find,
|
413 |
next: next,
|
414 |
prev: prev,
|
415 |
+
replace: replace
|
|
|
|
|
416 |
};
|
417 |
+
};
|
418 |
+
var $_6py2wyjyjjgweczt = { get: get };
|
419 |
|
420 |
+
var open = function (editor, currentIndexState) {
|
421 |
+
var last = {}, selectedText;
|
422 |
+
editor.undoManager.add();
|
423 |
+
selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
|
424 |
+
function updateButtonStates() {
|
425 |
+
win.statusbar.find('#next').disabled($_8aeifjjzjjgweczv.hasNext(editor, currentIndexState) === false);
|
426 |
+
win.statusbar.find('#prev').disabled($_8aeifjjzjjgweczv.hasPrev(editor, currentIndexState) === false);
|
427 |
+
}
|
428 |
+
function notFoundAlert() {
|
429 |
+
editor.windowManager.alert('Could not find the specified string.', function () {
|
430 |
+
win.find('#find')[0].focus();
|
431 |
+
});
|
432 |
+
}
|
433 |
+
var win = editor.windowManager.open({
|
434 |
+
layout: 'flex',
|
435 |
+
pack: 'center',
|
436 |
+
align: 'center',
|
437 |
+
onClose: function () {
|
438 |
+
editor.focus();
|
439 |
+
$_8aeifjjzjjgweczv.done(editor, currentIndexState);
|
440 |
+
editor.undoManager.add();
|
441 |
+
},
|
442 |
+
onSubmit: function (e) {
|
443 |
+
var count, caseState, text, wholeWord;
|
444 |
+
e.preventDefault();
|
445 |
+
caseState = win.find('#case').checked();
|
446 |
+
wholeWord = win.find('#words').checked();
|
447 |
+
text = win.find('#find').value();
|
448 |
+
if (!text.length) {
|
449 |
+
$_8aeifjjzjjgweczv.done(editor, currentIndexState, false);
|
450 |
+
win.statusbar.items().slice(1).disabled(true);
|
451 |
+
return;
|
452 |
+
}
|
453 |
+
if (last.text === text && last.caseState === caseState && last.wholeWord === wholeWord) {
|
454 |
+
if (!$_8aeifjjzjjgweczv.hasNext(editor, currentIndexState)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
notFoundAlert();
|
456 |
+
return;
|
457 |
}
|
458 |
+
$_8aeifjjzjjgweczv.next(editor, currentIndexState);
|
459 |
updateButtonStates();
|
460 |
+
return;
|
461 |
+
}
|
462 |
+
count = $_8aeifjjzjjgweczv.find(editor, currentIndexState, text, caseState, wholeWord);
|
463 |
+
if (!count) {
|
464 |
+
notFoundAlert();
|
465 |
+
}
|
466 |
+
win.statusbar.items().slice(1).disabled(count === 0);
|
467 |
+
updateButtonStates();
|
468 |
+
last = {
|
469 |
+
text: text,
|
470 |
+
caseState: caseState,
|
471 |
+
wholeWord: wholeWord
|
472 |
+
};
|
473 |
+
},
|
474 |
+
buttons: [
|
475 |
+
{
|
476 |
+
text: 'Find',
|
477 |
+
subtype: 'primary',
|
478 |
+
onclick: function () {
|
479 |
+
win.submit();
|
480 |
+
}
|
481 |
},
|
482 |
+
{
|
483 |
+
text: 'Replace',
|
484 |
+
disabled: true,
|
485 |
+
onclick: function () {
|
486 |
+
if (!$_8aeifjjzjjgweczv.replace(editor, currentIndexState, win.find('#replace').value())) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
win.statusbar.items().slice(1).disabled(true);
|
488 |
+
currentIndexState.set(-1);
|
489 |
last = {};
|
490 |
}
|
491 |
+
}
|
492 |
+
},
|
493 |
+
{
|
494 |
+
text: 'Replace all',
|
495 |
+
disabled: true,
|
496 |
+
onclick: function () {
|
497 |
+
$_8aeifjjzjjgweczv.replace(editor, currentIndexState, win.find('#replace').value(), true, true);
|
498 |
+
win.statusbar.items().slice(1).disabled(true);
|
499 |
+
last = {};
|
500 |
+
}
|
501 |
+
},
|
502 |
+
{
|
503 |
+
type: 'spacer',
|
504 |
+
flex: 1
|
505 |
+
},
|
506 |
+
{
|
507 |
+
text: 'Prev',
|
508 |
+
name: 'prev',
|
509 |
+
disabled: true,
|
510 |
+
onclick: function () {
|
511 |
+
$_8aeifjjzjjgweczv.prev(editor, currentIndexState);
|
512 |
+
updateButtonStates();
|
513 |
+
}
|
514 |
+
},
|
515 |
+
{
|
516 |
+
text: 'Next',
|
517 |
+
name: 'next',
|
518 |
+
disabled: true,
|
519 |
+
onclick: function () {
|
520 |
+
$_8aeifjjzjjgweczv.next(editor, currentIndexState);
|
521 |
+
updateButtonStates();
|
522 |
+
}
|
523 |
+
}
|
524 |
+
],
|
525 |
+
title: 'Find and replace',
|
526 |
+
items: {
|
527 |
+
type: 'form',
|
528 |
+
padding: 20,
|
529 |
+
labelGap: 30,
|
530 |
+
spacing: 10,
|
531 |
+
items: [
|
532 |
+
{
|
533 |
+
type: 'textbox',
|
534 |
+
name: 'find',
|
535 |
+
size: 40,
|
536 |
+
label: 'Find',
|
537 |
+
value: selectedText
|
538 |
},
|
539 |
{
|
540 |
+
type: 'textbox',
|
541 |
+
name: 'replace',
|
542 |
+
size: 40,
|
543 |
+
label: 'Replace with'
|
544 |
},
|
545 |
{
|
546 |
+
type: 'checkbox',
|
547 |
+
name: 'case',
|
548 |
+
text: 'Match case',
|
549 |
+
label: ' '
|
|
|
|
|
|
|
550 |
},
|
551 |
{
|
552 |
+
type: 'checkbox',
|
553 |
+
name: 'words',
|
554 |
+
text: 'Whole words',
|
555 |
+
label: ' '
|
|
|
|
|
|
|
556 |
}
|
557 |
+
]
|
558 |
+
}
|
559 |
+
});
|
560 |
+
};
|
561 |
+
var $_5c1p1tk3jjgwed08 = { open: open };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
|
563 |
+
var register = function (editor, currentIndexState) {
|
564 |
+
editor.addCommand('SearchReplace', function () {
|
565 |
+
$_5c1p1tk3jjgwed08.open(editor, currentIndexState);
|
566 |
+
});
|
567 |
+
};
|
568 |
+
var $_cdqp73k2jjgwed06 = { register: register };
|
569 |
|
570 |
+
var showDialog = function (editor, currentIndexState) {
|
571 |
+
return function () {
|
572 |
+
$_5c1p1tk3jjgwed08.open(editor, currentIndexState);
|
|
|
573 |
};
|
574 |
+
};
|
575 |
+
var register$1 = function (editor, currentIndexState) {
|
576 |
+
editor.addMenuItem('searchreplace', {
|
577 |
+
text: 'Find and replace',
|
578 |
+
shortcut: 'Meta+F',
|
579 |
+
onclick: showDialog(editor, currentIndexState),
|
580 |
+
separator: 'before',
|
581 |
+
context: 'edit'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
});
|
583 |
+
editor.addButton('searchreplace', {
|
584 |
+
tooltip: 'Find and replace',
|
585 |
+
onclick: showDialog(editor, currentIndexState)
|
586 |
+
});
|
587 |
+
editor.shortcuts.add('Meta+F', '', showDialog(editor, currentIndexState));
|
588 |
+
};
|
589 |
+
var $_5a8qhik4jjgwed0f = { register: register$1 };
|
590 |
+
|
591 |
+
global.add('searchreplace', function (editor) {
|
592 |
+
var currentIndexState = Cell(-1);
|
593 |
+
$_cdqp73k2jjgwed06.register(editor, currentIndexState);
|
594 |
+
$_5a8qhik4jjgwed0f.register(editor, currentIndexState);
|
595 |
+
return $_6py2wyjyjjgweczt.get(editor, currentIndexState);
|
596 |
+
});
|
597 |
+
function Plugin () {
|
598 |
+
}
|
599 |
|
600 |
+
return Plugin;
|
601 |
|
602 |
}());
|
603 |
})();
|
mce/searchreplace/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.util.Tools");function h(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var u={findAndReplaceDOMText:function(t,n,r,a,i){var o,d,
|
1 |
+
!function(){"use strict";var r=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return r(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.util.Tools");function h(e){return e&&1===e.nodeType&&"false"===e.contentEditable}var u={findAndReplaceDOMText:function(t,n,r,a,i){var o,d,v,f,p,g,c=[],l=0;function s(e,t){if(t=t||0,!e[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");var n=e.index;if(0<t){var r=e[t];if(!r)throw new Error("Invalid capture group");n+=e[0].indexOf(r),e[0]=r}return[n,n+e[0].length,[e[0]]]}if(v=n.ownerDocument,f=i.getBlockElements(),p=i.getWhiteSpaceElements(),g=i.getShortEndedElements(),d=function e(t){var n;if(3===t.nodeType)return t.data;if(p[t.nodeName]&&!f[t.nodeName])return"";if(n="",h(t))return"\n";if((f[t.nodeName]||g[t.nodeName])&&(n+="\n"),t=t.firstChild)for(;n+=e(t),t=t.nextSibling;);return n}(n)){if(t.global)for(;o=t.exec(d);)c.push(s(o,a));else o=d.match(t),c.push(s(o,a));return c.length&&(l=c.length,function(e,t,n){var r,a,i,o,d=[],c=0,l=e,s=t.shift(),u=0;e:for(;;){if((f[l.nodeName]||g[l.nodeName]||h(l))&&c++,3===l.nodeType&&(!a&&l.length+c>=s[1]?(a=l,o=s[1]-c):r&&d.push(l),!r&&l.length+c>s[0]&&(r=l,i=s[0]-c),c+=l.length),r&&a){if(l=n({startNode:r,startNodeIndex:i,endNode:a,endNodeIndex:o,innerNodes:d,match:s[2],matchIndex:u}),c-=a.length-o,a=r=null,d=[],u++,!(s=t.shift()))break}else if(p[l.nodeName]&&!f[l.nodeName]||!l.firstChild){if(l.nextSibling){l=l.nextSibling;continue}}else if(!h(l)){l=l.firstChild;continue}for(;;){if(l.nextSibling){l=l.nextSibling;break}if(l.parentNode===e)break e;l=l.parentNode}}}(n,c,function(e){var m;if("function"!=typeof e){var r=e.nodeType?e:v.createElement(e);m=function(e,t){var n=r.cloneNode(!1);return n.setAttribute("data-mce-index",t),e&&n.appendChild(v.createTextNode(e)),n}}else m=e;return function(e){var t,n,r,a=e.startNode,i=e.endNode,o=e.matchIndex;if(a===i){var d=a;r=d.parentNode,0<e.startNodeIndex&&(t=v.createTextNode(d.data.substring(0,e.startNodeIndex)),r.insertBefore(t,d));var c=m(e.match[0],o);return r.insertBefore(c,d),e.endNodeIndex<d.length&&(n=v.createTextNode(d.data.substring(e.endNodeIndex)),r.insertBefore(n,d)),d.parentNode.removeChild(d),c}t=v.createTextNode(a.data.substring(0,e.startNodeIndex)),n=v.createTextNode(i.data.substring(e.endNodeIndex));for(var l=m(a.data.substring(e.startNodeIndex),o),s=[],u=0,f=e.innerNodes.length;u<f;++u){var p=e.innerNodes[u],g=m(p.data,o);p.parentNode.replaceChild(g,p),s.push(g)}var h=m(i.data.substring(0,e.endNodeIndex),o);return(r=a.parentNode).insertBefore(t,a),r.insertBefore(l,a),r.removeChild(a),(r=i.parentNode).insertBefore(h,i),r.insertBefore(n,i),r.removeChild(i),h}}(r))),l}}},g=function(e){var t=e.getAttribute("data-mce-index");return"number"==typeof t?""+t:t},m=function(e){var t=e.parentNode;e.firstChild&&t.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)},o=function(e,t){var n,r=[];if((n=p.toArray(e.getBody().getElementsByTagName("span"))).length)for(var a=0;a<n.length;a++){var i=g(n[a]);null!==i&&i.length&&i===t.toString()&&r.push(n[a])}return r},f=function(e,t,n){var r=t.get(),a=e.dom;(n=!1!==n)?r++:r--,a.removeClass(o(e,t.get()),"mce-match-marker-selected");var i=o(e,r);return i.length?(a.addClass(o(e,r),"mce-match-marker-selected"),e.selection.scrollIntoView(i[0]),r):-1},v=function(e,t){var n=t.parentNode;e.remove(t),e.isEmpty(n)&&e.remove(n)},x=function(e,t){var n=f(e,t,!0);-1!==n&&t.set(n)},b=function(e,t){var n=f(e,t,!1);-1!==n&&t.set(n)},N=function(e){var t=g(e);return null!==t&&0<t.length},y=function(e,t,n){var r,a,i,o;for(a=p.toArray(e.getBody().getElementsByTagName("span")),r=0;r<a.length;r++){var d=g(a[r]);null!==d&&d.length&&(d===t.get().toString()&&(i||(i=a[r].firstChild),o=a[r].firstChild),m(a[r]))}if(i&&o){var c=e.dom.createRng();return c.setStart(i,0),c.setEnd(o,o.data.length),!1!==n&&e.selection.setRng(c),c}},k=function(e,t){return 0<o(e,t.get()+1).length},C=function(e,t){return 0<o(e,t.get()-1).length},T={done:y,find:function(e,t,n,r,a){n=(n=n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")).replace(/\s/g,"\\s"),n=a?"\\b"+n+"\\b":n;var i,o,d,c,l,s=(i=e,o=t,d=new RegExp(n,r?"g":"gi"),(l=i.dom.create("span",{"data-mce-bogus":1})).className="mce-match-marker",c=i.getBody(),y(i,o,!1),u.findAndReplaceDOMText(d,c,l,!1,i.schema));return s&&(t.set(-1),t.set(f(e,t,!0))),s},next:x,prev:b,replace:function(e,t,n,r,a){var i,o,d,c,l,s,u=t.get();for(r=!1!==r,d=e.getBody(),o=p.grep(p.toArray(d.getElementsByTagName("span")),N),i=0;i<o.length;i++){var f=g(o[i]);if(c=l=parseInt(f,10),a||c===t.get()){for(n.length?(o[i].firstChild.nodeValue=n,m(o[i])):v(e.dom,o[i]);o[++i];){if((c=parseInt(g(o[i]),10))!==l){i--;break}v(e.dom,o[i])}r&&u--}else l>t.get()&&o[i].setAttribute("data-mce-index",l-1)}return t.set(u),r?(s=k(e,t),x(e,t)):(s=C(e,t),b(e,t)),!a&&s},hasNext:k,hasPrev:C},n=function(r,a){return{done:function(e){return T.done(r,a,e)},find:function(e,t,n){return T.find(r,a,e,t,n)},next:function(){return T.next(r,a)},prev:function(){return T.prev(r,a)},replace:function(e,t,n){return T.replace(r,a,e,t,n)}}},a=function(i,o){var e,d={};function c(){s.statusbar.find("#next").disabled(!1===T.hasNext(i,o)),s.statusbar.find("#prev").disabled(!1===T.hasPrev(i,o))}function l(){i.windowManager.alert("Could not find the specified string.",function(){s.find("#find")[0].focus()})}i.undoManager.add(),e=p.trim(i.selection.getContent({format:"text"}));var s=i.windowManager.open({layout:"flex",pack:"center",align:"center",onClose:function(){i.focus(),T.done(i,o),i.undoManager.add()},onSubmit:function(e){var t,n,r,a;return e.preventDefault(),n=s.find("#case").checked(),a=s.find("#words").checked(),(r=s.find("#find").value()).length?d.text===r&&d.caseState===n&&d.wholeWord===a?T.hasNext(i,o)?(T.next(i,o),void c()):void l():((t=T.find(i,o,r,n,a))||l(),s.statusbar.items().slice(1).disabled(0===t),c(),void(d={text:r,caseState:n,wholeWord:a})):(T.done(i,o,!1),void s.statusbar.items().slice(1).disabled(!0))},buttons:[{text:"Find",subtype:"primary",onclick:function(){s.submit()}},{text:"Replace",disabled:!0,onclick:function(){T.replace(i,o,s.find("#replace").value())||(s.statusbar.items().slice(1).disabled(!0),o.set(-1),d={})}},{text:"Replace all",disabled:!0,onclick:function(){T.replace(i,o,s.find("#replace").value(),!0,!0),s.statusbar.items().slice(1).disabled(!0),d={}}},{type:"spacer",flex:1},{text:"Prev",name:"prev",disabled:!0,onclick:function(){T.prev(i,o),c()}},{text:"Next",name:"next",disabled:!0,onclick:function(){T.next(i,o),c()}}],title:"Find and replace",items:{type:"form",padding:20,labelGap:30,spacing:10,items:[{type:"textbox",name:"find",size:40,label:"Find",value:e},{type:"textbox",name:"replace",size:40,label:"Replace with"},{type:"checkbox",name:"case",text:"Match case",label:" "},{type:"checkbox",name:"words",text:"Whole words",label:" "}]}})},i=function(e,t){e.addCommand("SearchReplace",function(){a(e,t)})},d=function(e,t){return function(){a(e,t)}},c=function(e,t){e.addMenuItem("searchreplace",{text:"Find and replace",shortcut:"Meta+F",onclick:d(e,t),separator:"before",context:"edit"}),e.addButton("searchreplace",{tooltip:"Find and replace",onclick:d(e,t)}),e.shortcuts.add("Meta+F","",d(e,t))};e.add("searchreplace",function(e){var t=r(-1);return i(e,t),c(e,t),n(e,t)})}();
|
mce/table/plugin.js
CHANGED
@@ -1,9266 +1,10144 @@
|
|
1 |
(function () {
|
2 |
var table = (function () {
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
for (var _i = 0; _i < arguments.length; _i++) {
|
10 |
-
|
11 |
-
}
|
12 |
-
};
|
13 |
-
var compose = function (fa, fb) {
|
14 |
-
return function () {
|
15 |
-
var args = [];
|
16 |
-
for (var _i = 0; _i < arguments.length; _i++) {
|
17 |
-
args[_i] = arguments[_i];
|
18 |
-
}
|
19 |
-
return fa(fb.apply(null, args));
|
20 |
-
};
|
21 |
-
};
|
22 |
-
var constant = function (value) {
|
23 |
-
return function () {
|
24 |
-
return value;
|
25 |
-
};
|
26 |
-
};
|
27 |
-
var identity = function (x) {
|
28 |
-
return x;
|
29 |
-
};
|
30 |
-
function curry(fn) {
|
31 |
-
var initialArgs = [];
|
32 |
-
for (var _i = 1; _i < arguments.length; _i++) {
|
33 |
-
initialArgs[_i - 1] = arguments[_i];
|
34 |
}
|
35 |
-
return
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
-
var
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
};
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
};
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
};
|
76 |
-
var id = function (n) {
|
77 |
-
return n;
|
78 |
-
};
|
79 |
-
var noop$$1 = function () {
|
80 |
-
};
|
81 |
-
var nul = function () {
|
82 |
-
return null;
|
83 |
-
};
|
84 |
-
var undef = function () {
|
85 |
-
return undefined;
|
86 |
-
};
|
87 |
-
var me = {
|
88 |
-
fold: function (n, s) {
|
89 |
-
return n();
|
90 |
-
},
|
91 |
-
is: never$1,
|
92 |
-
isSome: never$1,
|
93 |
-
isNone: always$1,
|
94 |
-
getOr: id,
|
95 |
-
getOrThunk: call$$1,
|
96 |
-
getOrDie: function (msg) {
|
97 |
-
throw new Error(msg || 'error: getOrDie called on none.');
|
98 |
-
},
|
99 |
-
getOrNull: nul,
|
100 |
-
getOrUndefined: undef,
|
101 |
-
or: id,
|
102 |
-
orThunk: call$$1,
|
103 |
-
map: none,
|
104 |
-
ap: none,
|
105 |
-
each: noop$$1,
|
106 |
-
bind: none,
|
107 |
-
flatten: none,
|
108 |
-
exists: never$1,
|
109 |
-
forall: always$1,
|
110 |
-
filter: none,
|
111 |
-
equals: eq,
|
112 |
-
equals_: eq,
|
113 |
-
toArray: function () {
|
114 |
-
return [];
|
115 |
-
},
|
116 |
-
toString: constant('none()')
|
117 |
-
};
|
118 |
-
if (Object.freeze)
|
119 |
-
Object.freeze(me);
|
120 |
-
return me;
|
121 |
-
}();
|
122 |
-
var some = function (a) {
|
123 |
-
var constant_a = function () {
|
124 |
-
return a;
|
125 |
-
};
|
126 |
-
var self = function () {
|
127 |
-
return me;
|
128 |
-
};
|
129 |
-
var map = function (f) {
|
130 |
-
return some(f(a));
|
131 |
-
};
|
132 |
-
var bind = function (f) {
|
133 |
-
return f(a);
|
134 |
-
};
|
135 |
-
var me = {
|
136 |
-
fold: function (n, s) {
|
137 |
-
return s(a);
|
138 |
-
},
|
139 |
-
is: function (v) {
|
140 |
-
return a === v;
|
141 |
-
},
|
142 |
-
isSome: always$1,
|
143 |
-
isNone: never$1,
|
144 |
-
getOr: constant_a,
|
145 |
-
getOrThunk: constant_a,
|
146 |
-
getOrDie: constant_a,
|
147 |
-
getOrNull: constant_a,
|
148 |
-
getOrUndefined: constant_a,
|
149 |
-
or: self,
|
150 |
-
orThunk: self,
|
151 |
-
map: map,
|
152 |
-
ap: function (optfab) {
|
153 |
-
return optfab.fold(none, function (fab) {
|
154 |
-
return some(fab(a));
|
155 |
-
});
|
156 |
-
},
|
157 |
-
each: function (f) {
|
158 |
-
f(a);
|
159 |
-
},
|
160 |
-
bind: bind,
|
161 |
-
flatten: constant_a,
|
162 |
-
exists: bind,
|
163 |
-
forall: bind,
|
164 |
-
filter: function (f) {
|
165 |
-
return f(a) ? me : NONE;
|
166 |
-
},
|
167 |
-
equals: function (o) {
|
168 |
-
return o.is(a);
|
169 |
-
},
|
170 |
-
equals_: function (o, elementEq) {
|
171 |
-
return o.fold(never$1, function (b) {
|
172 |
-
return elementEq(a, b);
|
173 |
-
});
|
174 |
-
},
|
175 |
-
toArray: function () {
|
176 |
-
return [a];
|
177 |
-
},
|
178 |
-
toString: function () {
|
179 |
-
return 'some(' + a + ')';
|
180 |
-
}
|
181 |
-
};
|
182 |
-
return me;
|
183 |
};
|
184 |
-
var
|
185 |
-
return
|
186 |
};
|
187 |
-
var
|
188 |
-
|
189 |
-
none: none,
|
190 |
-
from: from
|
191 |
};
|
192 |
-
|
193 |
-
var typeOf = function (x) {
|
194 |
-
if (x === null)
|
195 |
-
return 'null';
|
196 |
-
var t = typeof x;
|
197 |
-
if (t === 'object' && Array.prototype.isPrototypeOf(x))
|
198 |
-
return 'array';
|
199 |
-
if (t === 'object' && String.prototype.isPrototypeOf(x))
|
200 |
-
return 'string';
|
201 |
-
return t;
|
202 |
};
|
203 |
-
var
|
204 |
-
return
|
205 |
-
return typeOf(value) === type;
|
206 |
-
};
|
207 |
};
|
208 |
-
var
|
209 |
-
|
210 |
-
var isBoolean = isType('boolean');
|
211 |
-
var isFunction = isType('function');
|
212 |
-
var isNumber = isType('number');
|
213 |
-
|
214 |
-
var rawIndexOf = function () {
|
215 |
-
var pIndexOf = Array.prototype.indexOf;
|
216 |
-
var fastIndex = function (xs, x) {
|
217 |
-
return pIndexOf.call(xs, x);
|
218 |
-
};
|
219 |
-
var slowIndex = function (xs, x) {
|
220 |
-
return slowIndexOf(xs, x);
|
221 |
-
};
|
222 |
-
return pIndexOf === undefined ? slowIndex : fastIndex;
|
223 |
-
}();
|
224 |
-
var contains = function (xs, x) {
|
225 |
-
return rawIndexOf(xs, x) > -1;
|
226 |
-
};
|
227 |
-
var exists = function (xs, pred) {
|
228 |
-
return findIndex(xs, pred).isSome();
|
229 |
-
};
|
230 |
-
var map = function (xs, f) {
|
231 |
-
var len = xs.length;
|
232 |
-
var r = new Array(len);
|
233 |
-
for (var i = 0; i < len; i++) {
|
234 |
-
var x = xs[i];
|
235 |
-
r[i] = f(x, i, xs);
|
236 |
-
}
|
237 |
-
return r;
|
238 |
};
|
239 |
-
var
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
};
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
250 |
};
|
251 |
-
var
|
252 |
-
|
253 |
-
for (var i = 0, len = xs.length; i < len; i++) {
|
254 |
-
var x = xs[i];
|
255 |
-
if (pred(x, i, xs)) {
|
256 |
-
r.push(x);
|
257 |
-
}
|
258 |
-
}
|
259 |
-
return r;
|
260 |
};
|
261 |
-
var
|
262 |
-
|
263 |
-
acc = f(acc, x);
|
264 |
-
});
|
265 |
-
return acc;
|
266 |
};
|
267 |
-
var
|
268 |
-
|
269 |
-
acc = f(acc, x);
|
270 |
-
});
|
271 |
-
return acc;
|
272 |
};
|
273 |
-
var
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
}
|
280 |
-
return Option.none();
|
281 |
};
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
}
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
push.apply(r, xs[i]);
|
306 |
}
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
for (var i = 0, len = xs.length; i < len; ++i) {
|
315 |
-
var x = xs[i];
|
316 |
-
if (pred(x, i, xs) !== true) {
|
317 |
-
return false;
|
318 |
-
}
|
319 |
}
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
}
|
331 |
-
|
332 |
-
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
});
|
351 |
-
|
352 |
-
|
353 |
var r = {};
|
354 |
-
each
|
355 |
-
|
356 |
-
|
|
|
|
|
357 |
});
|
358 |
return r;
|
359 |
};
|
360 |
-
|
361 |
-
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
for (var _i = 0; _i < arguments.length; _i++) {
|
364 |
-
|
365 |
}
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
if (fields.length !== values.length) {
|
372 |
-
throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
|
373 |
-
}
|
374 |
-
var struct = {};
|
375 |
-
each(fields, function (name, i) {
|
376 |
-
struct[name] = constant(values[i]);
|
377 |
-
});
|
378 |
-
return struct;
|
379 |
-
};
|
380 |
-
};
|
381 |
-
|
382 |
-
var sort$1 = function (arr) {
|
383 |
-
return arr.slice(0).sort();
|
384 |
-
};
|
385 |
-
var reqMessage = function (required, keys) {
|
386 |
-
throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
|
387 |
-
};
|
388 |
-
var unsuppMessage = function (unsupported) {
|
389 |
-
throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
|
390 |
-
};
|
391 |
-
var validateStrArr = function (label, array) {
|
392 |
-
if (!isArray(array))
|
393 |
-
throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
|
394 |
-
each(array, function (a) {
|
395 |
-
if (!isString(a))
|
396 |
-
throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
|
397 |
-
});
|
398 |
-
};
|
399 |
-
var invalidTypeMessage = function (incorrect, type) {
|
400 |
-
throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
|
401 |
-
};
|
402 |
-
var checkDupes = function (everything) {
|
403 |
-
var sorted = sort$1(everything);
|
404 |
-
var dupe = find(sorted, function (s, i) {
|
405 |
-
return i < sorted.length - 1 && s === sorted[i + 1];
|
406 |
-
});
|
407 |
-
dupe.each(function (d) {
|
408 |
-
throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
|
409 |
-
});
|
410 |
};
|
|
|
411 |
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
};
|
440 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
|
442 |
-
var dimensions = Immutable('width', 'height');
|
443 |
-
var grid = Immutable('rows', 'columns');
|
444 |
-
var address = Immutable('row', 'column');
|
445 |
-
var coords = Immutable('x', 'y');
|
446 |
-
var detail = Immutable('element', 'rowspan', 'colspan');
|
447 |
-
var detailnew = Immutable('element', 'rowspan', 'colspan', 'isNew');
|
448 |
-
var extended = Immutable('element', 'rowspan', 'colspan', 'row', 'column');
|
449 |
-
var rowdata = Immutable('element', 'cells', 'section');
|
450 |
-
var elementnew = Immutable('element', 'isNew');
|
451 |
-
var rowdatanew = Immutable('element', 'cells', 'section', 'isNew');
|
452 |
-
var rowcells = Immutable('cells', 'section');
|
453 |
-
var rowdetails = Immutable('details', 'section');
|
454 |
-
var bounds = Immutable('startRow', 'startCol', 'finishRow', 'finishCol');
|
455 |
-
var Structs = {
|
456 |
-
dimensions: dimensions,
|
457 |
-
grid: grid,
|
458 |
-
address: address,
|
459 |
-
coords: coords,
|
460 |
-
extended: extended,
|
461 |
-
detail: detail,
|
462 |
-
detailnew: detailnew,
|
463 |
-
rowdata: rowdata,
|
464 |
-
elementnew: elementnew,
|
465 |
-
rowdatanew: rowdatanew,
|
466 |
-
rowcells: rowcells,
|
467 |
-
rowdetails: rowdetails,
|
468 |
-
bounds: bounds
|
469 |
-
};
|
470 |
-
|
471 |
-
var fromHtml = function (html, scope) {
|
472 |
-
var doc = scope || document;
|
473 |
-
var div = doc.createElement('div');
|
474 |
-
div.innerHTML = html;
|
475 |
-
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
476 |
-
console.error('HTML does not have a single root node', html);
|
477 |
-
throw 'HTML must have a single root node';
|
478 |
-
}
|
479 |
-
return fromDom(div.childNodes[0]);
|
480 |
-
};
|
481 |
-
var fromTag = function (tag, scope) {
|
482 |
-
var doc = scope || document;
|
483 |
-
var node = doc.createElement(tag);
|
484 |
-
return fromDom(node);
|
485 |
-
};
|
486 |
-
var fromText = function (text, scope) {
|
487 |
-
var doc = scope || document;
|
488 |
-
var node = doc.createTextNode(text);
|
489 |
-
return fromDom(node);
|
490 |
-
};
|
491 |
-
var fromDom = function (node) {
|
492 |
-
if (node === null || node === undefined)
|
493 |
-
throw new Error('Node cannot be null or undefined');
|
494 |
-
return { dom: constant(node) };
|
495 |
-
};
|
496 |
-
var fromPoint = function (docElm, x, y) {
|
497 |
-
var doc = docElm.dom();
|
498 |
-
return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
|
499 |
-
};
|
500 |
-
var Element$$1 = {
|
501 |
-
fromHtml: fromHtml,
|
502 |
-
fromTag: fromTag,
|
503 |
-
fromText: fromText,
|
504 |
-
fromDom: fromDom,
|
505 |
-
fromPoint: fromPoint
|
506 |
-
};
|
507 |
-
|
508 |
-
var ATTRIBUTE = Node.ATTRIBUTE_NODE;
|
509 |
-
var CDATA_SECTION = Node.CDATA_SECTION_NODE;
|
510 |
-
var COMMENT = Node.COMMENT_NODE;
|
511 |
-
var DOCUMENT = Node.DOCUMENT_NODE;
|
512 |
-
var DOCUMENT_TYPE = Node.DOCUMENT_TYPE_NODE;
|
513 |
-
var DOCUMENT_FRAGMENT = Node.DOCUMENT_FRAGMENT_NODE;
|
514 |
-
var ELEMENT = Node.ELEMENT_NODE;
|
515 |
-
var TEXT = Node.TEXT_NODE;
|
516 |
-
var PROCESSING_INSTRUCTION = Node.PROCESSING_INSTRUCTION_NODE;
|
517 |
-
var ENTITY_REFERENCE = Node.ENTITY_REFERENCE_NODE;
|
518 |
-
var ENTITY = Node.ENTITY_NODE;
|
519 |
-
var NOTATION = Node.NOTATION_NODE;
|
520 |
-
|
521 |
-
var ELEMENT$1 = ELEMENT;
|
522 |
-
var DOCUMENT$1 = DOCUMENT;
|
523 |
-
var is = function (element, selector) {
|
524 |
-
var elem = element.dom();
|
525 |
-
if (elem.nodeType !== ELEMENT$1)
|
526 |
-
return false;
|
527 |
-
else if (elem.matches !== undefined)
|
528 |
-
return elem.matches(selector);
|
529 |
-
else if (elem.msMatchesSelector !== undefined)
|
530 |
-
return elem.msMatchesSelector(selector);
|
531 |
-
else if (elem.webkitMatchesSelector !== undefined)
|
532 |
-
return elem.webkitMatchesSelector(selector);
|
533 |
-
else if (elem.mozMatchesSelector !== undefined)
|
534 |
-
return elem.mozMatchesSelector(selector);
|
535 |
-
else
|
536 |
-
throw new Error('Browser lacks native selectors');
|
537 |
-
};
|
538 |
-
var bypassSelector = function (dom) {
|
539 |
-
return dom.nodeType !== ELEMENT$1 && dom.nodeType !== DOCUMENT$1 || dom.childElementCount === 0;
|
540 |
-
};
|
541 |
-
var all = function (selector, scope) {
|
542 |
-
var base = scope === undefined ? document : scope.dom();
|
543 |
-
return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), Element$$1.fromDom);
|
544 |
-
};
|
545 |
-
var one = function (selector, scope) {
|
546 |
-
var base = scope === undefined ? document : scope.dom();
|
547 |
-
return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map(Element$$1.fromDom);
|
548 |
-
};
|
549 |
|
550 |
-
var Global = typeof window !== 'undefined' ? window : Function('return this;')();
|
551 |
|
552 |
-
var path = function (parts, scope) {
|
553 |
-
var o = scope !== undefined && scope !== null ? scope : Global;
|
554 |
-
for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
|
555 |
-
o = o[parts[i]];
|
556 |
-
return o;
|
557 |
-
};
|
558 |
-
var resolve = function (p, scope) {
|
559 |
-
var parts = p.split('.');
|
560 |
-
return path(parts, scope);
|
561 |
-
};
|
562 |
|
563 |
-
var unsafe = function (name, scope) {
|
564 |
-
return resolve(name, scope);
|
565 |
-
};
|
566 |
-
var getOrDie = function (name, scope) {
|
567 |
-
var actual = unsafe(name, scope);
|
568 |
-
if (actual === undefined || actual === null)
|
569 |
-
throw name + ' not available on this browser';
|
570 |
-
return actual;
|
571 |
-
};
|
572 |
-
var Global$1 = { getOrDie: getOrDie };
|
573 |
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
};
|
578 |
-
var compareDocumentPosition = function (a, b, match) {
|
579 |
-
return (a.compareDocumentPosition(b) & match) !== 0;
|
580 |
-
};
|
581 |
-
var documentPositionPreceding = function (a, b) {
|
582 |
-
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
|
583 |
-
};
|
584 |
-
var documentPositionContainedBy = function (a, b) {
|
585 |
-
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
|
586 |
-
};
|
587 |
-
var Node$1 = {
|
588 |
-
documentPositionPreceding: documentPositionPreceding,
|
589 |
-
documentPositionContainedBy: documentPositionContainedBy
|
590 |
-
};
|
591 |
|
592 |
-
var cached = function (f) {
|
593 |
-
var called = false;
|
594 |
-
var r;
|
595 |
-
return function () {
|
596 |
-
var args = [];
|
597 |
-
for (var _i = 0; _i < arguments.length; _i++) {
|
598 |
-
args[_i] = arguments[_i];
|
599 |
-
}
|
600 |
-
if (!called) {
|
601 |
-
called = true;
|
602 |
-
r = f.apply(null, args);
|
603 |
-
}
|
604 |
-
return r;
|
605 |
-
};
|
606 |
-
};
|
607 |
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
return undefined;
|
615 |
-
};
|
616 |
-
var find$2 = function (regexes, agent) {
|
617 |
-
var r = firstMatch(regexes, agent);
|
618 |
-
if (!r)
|
619 |
-
return {
|
620 |
-
major: 0,
|
621 |
-
minor: 0
|
622 |
-
};
|
623 |
-
var group = function (i) {
|
624 |
-
return Number(agent.replace(r, '$' + i));
|
625 |
-
};
|
626 |
-
return nu(group(1), group(2));
|
627 |
-
};
|
628 |
-
var detect = function (versionRegexes, agent) {
|
629 |
-
var cleanedAgent = String(agent).toLowerCase();
|
630 |
-
if (versionRegexes.length === 0)
|
631 |
-
return unknown();
|
632 |
-
return find$2(versionRegexes, cleanedAgent);
|
633 |
-
};
|
634 |
-
var unknown = function () {
|
635 |
-
return nu(0, 0);
|
636 |
-
};
|
637 |
-
var nu = function (major, minor) {
|
638 |
-
return {
|
639 |
-
major: major,
|
640 |
-
minor: minor
|
641 |
-
};
|
642 |
-
};
|
643 |
-
var Version = {
|
644 |
-
nu: nu,
|
645 |
-
detect: detect,
|
646 |
-
unknown: unknown
|
647 |
-
};
|
648 |
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
var firefox = 'Firefox';
|
654 |
-
var safari = 'Safari';
|
655 |
-
var isBrowser = function (name, current) {
|
656 |
-
return function () {
|
657 |
-
return current === name;
|
658 |
-
};
|
659 |
};
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
};
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
var
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
var
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
|
|
|
|
|
|
|
|
|
|
837 |
}
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
{
|
848 |
-
name: 'Firefox',
|
849 |
-
versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
|
850 |
-
search: checkContains('firefox')
|
851 |
-
},
|
852 |
-
{
|
853 |
-
name: 'Safari',
|
854 |
-
versionRegexes: [
|
855 |
-
normalVersionRegex,
|
856 |
-
/.*?cpu os ([0-9]+)_([0-9]+).*/
|
857 |
-
],
|
858 |
-
search: function (uastring) {
|
859 |
-
return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');
|
860 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
}
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
}
|
905 |
-
];
|
906 |
-
var PlatformInfo = {
|
907 |
-
browsers: constant(browsers),
|
908 |
-
oses: constant(oses)
|
909 |
-
};
|
910 |
-
|
911 |
-
var detect$2 = function (userAgent) {
|
912 |
-
var browsers = PlatformInfo.browsers();
|
913 |
-
var oses = PlatformInfo.oses();
|
914 |
-
var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
|
915 |
-
var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
|
916 |
-
var deviceType = DeviceType(os, browser, userAgent);
|
917 |
-
return {
|
918 |
-
browser: browser,
|
919 |
-
os: os,
|
920 |
-
deviceType: deviceType
|
921 |
-
};
|
922 |
-
};
|
923 |
-
var PlatformDetection = { detect: detect$2 };
|
924 |
-
|
925 |
-
var detect$3 = cached(function () {
|
926 |
-
var userAgent = navigator.userAgent;
|
927 |
-
return PlatformDetection.detect(userAgent);
|
928 |
});
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
var
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
return Element$$1.fromDom(defaultView);
|
952 |
-
};
|
953 |
-
var parent = function (element) {
|
954 |
-
var dom = element.dom();
|
955 |
-
return Option.from(dom.parentNode).map(Element$$1.fromDom);
|
956 |
-
};
|
957 |
-
var parents = function (element, isRoot) {
|
958 |
-
var stop = isFunction(isRoot) ? isRoot : constant(false);
|
959 |
-
var dom = element.dom();
|
960 |
-
var ret = [];
|
961 |
-
while (dom.parentNode !== null && dom.parentNode !== undefined) {
|
962 |
-
var rawParent = dom.parentNode;
|
963 |
-
var parent = Element$$1.fromDom(rawParent);
|
964 |
-
ret.push(parent);
|
965 |
-
if (stop(parent) === true)
|
966 |
-
break;
|
967 |
-
else
|
968 |
-
dom = rawParent;
|
969 |
}
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
return
|
975 |
-
};
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
var dom = element.dom();
|
982 |
-
return map(dom.childNodes, Element$$1.fromDom);
|
983 |
-
};
|
984 |
-
var child = function (element, index) {
|
985 |
-
var children = element.dom().childNodes;
|
986 |
-
return Option.from(children[index]).map(Element$$1.fromDom);
|
987 |
-
};
|
988 |
-
var firstChild = function (element) {
|
989 |
-
return child(element, 0);
|
990 |
-
};
|
991 |
-
var spot = Immutable('element', 'offset');
|
992 |
-
|
993 |
-
var firstLayer = function (scope, selector) {
|
994 |
-
return filterFirstLayer(scope, selector, constant(true));
|
995 |
-
};
|
996 |
-
var filterFirstLayer = function (scope, selector, predicate) {
|
997 |
-
return bind(children(scope), function (x) {
|
998 |
-
return is(x, selector) ? predicate(x) ? [x] : [] : filterFirstLayer(x, selector, predicate);
|
999 |
});
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
return
|
1009 |
-
};
|
1010 |
-
var
|
1011 |
-
|
1012 |
-
|
1013 |
-
var
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1031 |
}
|
1032 |
};
|
1033 |
-
var
|
1034 |
-
|
1035 |
-
};
|
1036 |
-
var
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
};
|
1050 |
-
|
1051 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1052 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1053 |
var clone = function (element) {
|
1054 |
-
return
|
1055 |
-
acc[attr.name] = attr.value;
|
1056 |
-
return acc;
|
1057 |
-
}, {});
|
1058 |
};
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
|
|
|
|
1063 |
};
|
1064 |
-
var
|
1065 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1066 |
});
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1079 |
};
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1087 |
});
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
var
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
|
|
1099 |
});
|
1100 |
};
|
1101 |
-
var
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1119 |
}
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
if (res.isSome())
|
1139 |
-
return res;
|
1140 |
-
}
|
1141 |
-
return Option.none();
|
1142 |
-
};
|
1143 |
-
return descend(scope.dom());
|
1144 |
-
};
|
1145 |
-
|
1146 |
-
var ancestor$1 = function (scope, selector, isRoot) {
|
1147 |
-
return ancestor(scope, function (e) {
|
1148 |
-
return is(e, selector);
|
1149 |
-
}, isRoot);
|
1150 |
-
};
|
1151 |
-
var child$2 = function (scope, selector) {
|
1152 |
-
return child$1(scope, function (e) {
|
1153 |
-
return is(e, selector);
|
1154 |
});
|
1155 |
-
};
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
var
|
1170 |
-
|
1171 |
-
|
1172 |
-
return
|
1173 |
-
|
1174 |
-
var cell = function (element, isRoot) {
|
1175 |
-
return lookup([
|
1176 |
-
'td',
|
1177 |
-
'th'
|
1178 |
-
], element, isRoot);
|
1179 |
-
};
|
1180 |
-
var cells = function (ancestor) {
|
1181 |
-
return LayerSelector.firstLayer(ancestor, 'th,td');
|
1182 |
-
};
|
1183 |
-
var notCell = function (element, isRoot) {
|
1184 |
-
return lookup([
|
1185 |
-
'caption',
|
1186 |
-
'tr',
|
1187 |
-
'tbody',
|
1188 |
-
'tfoot',
|
1189 |
-
'thead'
|
1190 |
-
], element, isRoot);
|
1191 |
-
};
|
1192 |
-
var neighbours = function (selector, element) {
|
1193 |
-
return parent(element).map(function (parent$$1) {
|
1194 |
-
return children$2(parent$$1, selector);
|
1195 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1196 |
};
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
var
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
var
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1231 |
};
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1246 |
});
|
1247 |
-
return Structs.rowdata(element, cells, parentSection);
|
1248 |
});
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1256 |
});
|
1257 |
-
return Structs.rowdata(row, cells, example.section());
|
1258 |
});
|
1259 |
-
};
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
var filtered = filterItems(warehouse, function (detail) {
|
1274 |
-
return comparator(item, detail.element());
|
1275 |
});
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
|
|
1281 |
});
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
}
|
1305 |
-
}
|
1306 |
-
currentRow.push(current);
|
1307 |
});
|
1308 |
-
cells.push(Structs.rowdata(details.element(), currentRow, details.section()));
|
1309 |
});
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1339 |
}
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
if (
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
var dom = element.dom();
|
1349 |
-
internalSet(dom, property, value$$1);
|
1350 |
-
};
|
1351 |
-
var setAll$1 = function (element, css) {
|
1352 |
-
var dom = element.dom();
|
1353 |
-
each$1(css, function (v, k) {
|
1354 |
-
internalSet(dom, k, v);
|
1355 |
-
});
|
1356 |
-
};
|
1357 |
-
var get$2 = function (element, property) {
|
1358 |
-
var dom = element.dom();
|
1359 |
-
var styles = window.getComputedStyle(dom);
|
1360 |
-
var r = styles.getPropertyValue(property);
|
1361 |
-
var v = r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
|
1362 |
-
return v === null ? undefined : v;
|
1363 |
-
};
|
1364 |
-
var getUnsafeProperty = function (dom, property) {
|
1365 |
-
return isSupported(dom) ? dom.style.getPropertyValue(property) : '';
|
1366 |
-
};
|
1367 |
-
var getRaw = function (element, property) {
|
1368 |
-
var dom = element.dom();
|
1369 |
-
var raw = getUnsafeProperty(dom, property);
|
1370 |
-
return Option.from(raw).filter(function (r) {
|
1371 |
-
return r.length > 0;
|
1372 |
-
});
|
1373 |
-
};
|
1374 |
-
var remove$1 = function (element, property) {
|
1375 |
-
var dom = element.dom();
|
1376 |
-
internalRemove(dom, property);
|
1377 |
-
if (has$1(element, 'style') && trim(get$1(element, 'style')) === '') {
|
1378 |
-
remove(element, 'style');
|
1379 |
}
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1386 |
}
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1401 |
});
|
1402 |
-
}
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
each(elements, function (x) {
|
1435 |
-
append(parent, x);
|
1436 |
-
});
|
1437 |
-
};
|
1438 |
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
});
|
1444 |
-
};
|
1445 |
-
var remove$2 = function (element) {
|
1446 |
var dom = element.dom();
|
1447 |
-
if (dom
|
1448 |
-
dom.
|
1449 |
-
};
|
1450 |
-
var
|
1451 |
-
var
|
1452 |
-
if (
|
1453 |
-
|
1454 |
-
|
1455 |
-
};
|
1456 |
-
|
1457 |
-
var stats = Immutable('minRow', 'minCol', 'maxRow', 'maxCol');
|
1458 |
-
var findSelectedStats = function (house, isSelected) {
|
1459 |
-
var totalColumns = house.grid().columns();
|
1460 |
-
var totalRows = house.grid().rows();
|
1461 |
-
var minRow = totalRows;
|
1462 |
-
var minCol = totalColumns;
|
1463 |
-
var maxRow = 0;
|
1464 |
-
var maxCol = 0;
|
1465 |
-
each$1(house.access(), function (detail) {
|
1466 |
-
if (isSelected(detail)) {
|
1467 |
-
var startRow = detail.row();
|
1468 |
-
var endRow = startRow + detail.rowspan() - 1;
|
1469 |
-
var startCol = detail.column();
|
1470 |
-
var endCol = startCol + detail.colspan() - 1;
|
1471 |
-
if (startRow < minRow)
|
1472 |
-
minRow = startRow;
|
1473 |
-
else if (endRow > maxRow)
|
1474 |
-
maxRow = endRow;
|
1475 |
-
if (startCol < minCol)
|
1476 |
-
minCol = startCol;
|
1477 |
-
else if (endCol > maxCol)
|
1478 |
-
maxCol = endCol;
|
1479 |
-
}
|
1480 |
-
});
|
1481 |
-
return stats(minRow, minCol, maxRow, maxCol);
|
1482 |
-
};
|
1483 |
-
var makeCell = function (list, seenSelected, rowIndex) {
|
1484 |
-
var row = list[rowIndex].element();
|
1485 |
-
var td = Element$$1.fromTag('td');
|
1486 |
-
append(td, Element$$1.fromTag('br'));
|
1487 |
-
var f = seenSelected ? append : prepend;
|
1488 |
-
f(row, td);
|
1489 |
-
};
|
1490 |
-
var fillInGaps = function (list, house, stats, isSelected) {
|
1491 |
-
var totalColumns = house.grid().columns();
|
1492 |
-
var totalRows = house.grid().rows();
|
1493 |
-
for (var i = 0; i < totalRows; i++) {
|
1494 |
-
var seenSelected = false;
|
1495 |
-
for (var j = 0; j < totalColumns; j++) {
|
1496 |
-
if (!(i < stats.minRow() || i > stats.maxRow() || j < stats.minCol() || j > stats.maxCol())) {
|
1497 |
-
var needCell = Warehouse.getAt(house, i, j).filter(isSelected).isNone();
|
1498 |
-
if (needCell)
|
1499 |
-
makeCell(list, seenSelected, i);
|
1500 |
-
else
|
1501 |
-
seenSelected = true;
|
1502 |
-
}
|
1503 |
-
}
|
1504 |
}
|
|
|
1505 |
};
|
1506 |
-
var
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1515 |
});
|
|
|
|
|
1516 |
}
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1532 |
});
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1537 |
};
|
1538 |
-
|
1539 |
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1545 |
};
|
1546 |
-
var
|
1547 |
-
|
1548 |
};
|
1549 |
-
var
|
1550 |
-
|
1551 |
-
var attributes = clone(original);
|
1552 |
-
setAll(nu, attributes);
|
1553 |
-
return nu;
|
1554 |
};
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
return nu;
|
1560 |
};
|
|
|
1561 |
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1574 |
};
|
1575 |
-
var
|
1576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1577 |
};
|
1578 |
-
var
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
};
|
1585 |
return {
|
1586 |
-
|
1587 |
-
|
1588 |
-
set: set
|
1589 |
-
};
|
1590 |
-
}
|
1591 |
-
|
1592 |
-
var api = NodeValue(isText, 'text');
|
1593 |
-
var get$3 = function (element) {
|
1594 |
-
return api.get(element);
|
1595 |
-
};
|
1596 |
-
var getOption = function (element) {
|
1597 |
-
return api.getOption(element);
|
1598 |
-
};
|
1599 |
-
var set$2 = function (element, value$$1) {
|
1600 |
-
api.set(element, value$$1);
|
1601 |
-
};
|
1602 |
-
|
1603 |
-
var getEnd = function (element) {
|
1604 |
-
return name(element) === 'img' ? 1 : getOption(element).fold(function () {
|
1605 |
-
return children(element).length;
|
1606 |
-
}, function (v) {
|
1607 |
-
return v.length;
|
1608 |
-
});
|
1609 |
-
};
|
1610 |
-
var NBSP = '\xA0';
|
1611 |
-
var isTextNodeWithCursorPosition = function (el) {
|
1612 |
-
return getOption(el).filter(function (text) {
|
1613 |
-
return text.trim().length !== 0 || text.indexOf(NBSP) > -1;
|
1614 |
-
}).isSome();
|
1615 |
-
};
|
1616 |
-
var elementsWithCursorPosition = [
|
1617 |
-
'img',
|
1618 |
-
'br'
|
1619 |
-
];
|
1620 |
-
var isCursorPosition = function (elem) {
|
1621 |
-
var hasCursorPosition = isTextNodeWithCursorPosition(elem);
|
1622 |
-
return hasCursorPosition || contains(elementsWithCursorPosition, name(elem));
|
1623 |
-
};
|
1624 |
-
|
1625 |
-
var first$3 = function (element) {
|
1626 |
-
return descendant(element, isCursorPosition);
|
1627 |
-
};
|
1628 |
-
var last$2 = function (element) {
|
1629 |
-
return descendantRtl(element, isCursorPosition);
|
1630 |
-
};
|
1631 |
-
var descendantRtl = function (scope, predicate) {
|
1632 |
-
var descend = function (element) {
|
1633 |
-
var children$$1 = children(element);
|
1634 |
-
for (var i = children$$1.length - 1; i >= 0; i--) {
|
1635 |
-
var child$$1 = children$$1[i];
|
1636 |
-
if (predicate(child$$1))
|
1637 |
-
return Option.some(child$$1);
|
1638 |
-
var res = descend(child$$1);
|
1639 |
-
if (res.isSome())
|
1640 |
-
return res;
|
1641 |
-
}
|
1642 |
-
return Option.none();
|
1643 |
};
|
1644 |
-
return descend(scope);
|
1645 |
-
};
|
1646 |
-
|
1647 |
-
var cell$1 = function () {
|
1648 |
-
var td = Element$$1.fromTag('td');
|
1649 |
-
append(td, Element$$1.fromTag('br'));
|
1650 |
-
return td;
|
1651 |
-
};
|
1652 |
-
var replace = function (cell, tag, attrs) {
|
1653 |
-
var replica = copy$1(cell, tag);
|
1654 |
-
each$1(attrs, function (v, k) {
|
1655 |
-
if (v === null)
|
1656 |
-
remove(replica, k);
|
1657 |
-
else
|
1658 |
-
set(replica, k, v);
|
1659 |
-
});
|
1660 |
-
return replica;
|
1661 |
};
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
var
|
|
|
|
|
|
|
1666 |
return function () {
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
var first = first$3(oldCell);
|
1672 |
-
return first.map(function (firstText) {
|
1673 |
-
var formatSelector = formats.join(',');
|
1674 |
-
var parents$$1 = ancestors$1(firstText, formatSelector, function (element) {
|
1675 |
-
return eq(element, oldCell);
|
1676 |
});
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
append(last$$1, clonedFormat);
|
1681 |
-
return clonedFormat;
|
1682 |
-
}, newCell);
|
1683 |
-
}).getOr(newCell);
|
1684 |
-
};
|
1685 |
-
var cellOperations = function (mutate$$1, doc, formatsToClone) {
|
1686 |
-
var newCell = function (prev) {
|
1687 |
-
var doc = owner(prev.element());
|
1688 |
-
var td = Element$$1.fromTag(name(prev.element()), doc.dom());
|
1689 |
-
var formats = formatsToClone.getOr([
|
1690 |
-
'strong',
|
1691 |
-
'em',
|
1692 |
-
'b',
|
1693 |
-
'i',
|
1694 |
-
'span',
|
1695 |
-
'font',
|
1696 |
-
'h1',
|
1697 |
-
'h2',
|
1698 |
-
'h3',
|
1699 |
-
'h4',
|
1700 |
-
'h5',
|
1701 |
-
'h6',
|
1702 |
-
'p',
|
1703 |
-
'div'
|
1704 |
-
]);
|
1705 |
-
var lastNode = formats.length > 0 ? cloneFormats(prev.element(), td, formats) : td;
|
1706 |
-
append(lastNode, Element$$1.fromTag('br'));
|
1707 |
-
copy(prev.element(), td);
|
1708 |
-
remove$1(td, 'height');
|
1709 |
-
if (prev.colspan() !== 1)
|
1710 |
-
remove$1(prev.element(), 'width');
|
1711 |
-
mutate$$1(prev.element(), td);
|
1712 |
-
return td;
|
1713 |
-
};
|
1714 |
-
return {
|
1715 |
-
row: newRow(doc),
|
1716 |
-
cell: newCell,
|
1717 |
-
replace: replace,
|
1718 |
-
gap: cell$1
|
1719 |
-
};
|
1720 |
-
};
|
1721 |
-
var paste = function (doc) {
|
1722 |
-
return {
|
1723 |
-
row: newRow(doc),
|
1724 |
-
cell: cell$1,
|
1725 |
-
replace: pasteReplace,
|
1726 |
-
gap: cell$1
|
1727 |
};
|
1728 |
};
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
};
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1753 |
'ol',
|
1754 |
-
'ul'
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1764 |
'h1',
|
1765 |
'h2',
|
1766 |
'h3',
|
1767 |
'h4',
|
1768 |
'h5',
|
1769 |
-
'h6'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1770 |
'blockquote',
|
1771 |
-
'
|
1772 |
-
'
|
1773 |
-
];
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1783 |
return true;
|
1784 |
-
|
1785 |
-
|
1786 |
-
var isEmptyTag = function (element) {
|
1787 |
-
if (!isElement(element))
|
1788 |
-
return false;
|
1789 |
-
return contains([
|
1790 |
-
'br',
|
1791 |
-
'img',
|
1792 |
-
'hr',
|
1793 |
-
'input'
|
1794 |
-
], name(element));
|
1795 |
-
};
|
1796 |
-
var comparePosition = function (element, other) {
|
1797 |
-
return element.dom().compareDocumentPosition(other.dom());
|
1798 |
-
};
|
1799 |
-
var copyAttributesTo = function (source, destination) {
|
1800 |
-
var as = clone(source);
|
1801 |
-
setAll(destination, as);
|
1802 |
-
};
|
1803 |
-
return {
|
1804 |
-
up: constant({
|
1805 |
-
selector: ancestor$1,
|
1806 |
-
closest: closest$1,
|
1807 |
-
predicate: ancestor,
|
1808 |
-
all: parents
|
1809 |
-
}),
|
1810 |
-
down: constant({
|
1811 |
-
selector: descendants$1,
|
1812 |
-
predicate: descendants
|
1813 |
-
}),
|
1814 |
-
styles: constant({
|
1815 |
-
get: get$2,
|
1816 |
-
getRaw: getRaw,
|
1817 |
-
set: set$1,
|
1818 |
-
remove: remove$1
|
1819 |
-
}),
|
1820 |
-
attrs: constant({
|
1821 |
-
get: get$1,
|
1822 |
-
set: set,
|
1823 |
-
remove: remove,
|
1824 |
-
copyTo: copyAttributesTo
|
1825 |
-
}),
|
1826 |
-
insert: constant({
|
1827 |
-
before: before,
|
1828 |
-
after: after,
|
1829 |
-
afterAll: after$1,
|
1830 |
-
append: append,
|
1831 |
-
appendAll: append$1,
|
1832 |
-
prepend: prepend,
|
1833 |
-
wrap: wrap
|
1834 |
-
}),
|
1835 |
-
remove: constant({
|
1836 |
-
unwrap: unwrap,
|
1837 |
-
remove: remove$2
|
1838 |
-
}),
|
1839 |
-
create: constant({
|
1840 |
-
nu: Element$$1.fromTag,
|
1841 |
-
clone: clone$$1,
|
1842 |
-
text: Element$$1.fromText
|
1843 |
-
}),
|
1844 |
-
query: constant({
|
1845 |
-
comparePosition: comparePosition,
|
1846 |
-
prevSibling: prevSibling,
|
1847 |
-
nextSibling: nextSibling
|
1848 |
-
}),
|
1849 |
-
property: constant({
|
1850 |
-
children: children,
|
1851 |
-
name: name,
|
1852 |
-
parent: parent,
|
1853 |
-
isText: isText,
|
1854 |
-
isComment: isComment,
|
1855 |
-
isElement: isElement,
|
1856 |
-
getText: get$3,
|
1857 |
-
setText: set$2,
|
1858 |
-
isBoundary: isBoundary,
|
1859 |
-
isEmptyTag: isEmptyTag
|
1860 |
-
}),
|
1861 |
-
eq: eq,
|
1862 |
-
is: is$1
|
1863 |
-
};
|
1864 |
-
}
|
1865 |
-
|
1866 |
-
var leftRight = Immutable('left', 'right');
|
1867 |
-
var bisect = function (universe, parent, child) {
|
1868 |
-
var children = universe.property().children(parent);
|
1869 |
-
var index = findIndex(children, curry(universe.eq, child));
|
1870 |
-
return index.map(function (ind) {
|
1871 |
-
return {
|
1872 |
-
before: constant(children.slice(0, ind)),
|
1873 |
-
after: constant(children.slice(ind + 1))
|
1874 |
-
};
|
1875 |
-
});
|
1876 |
-
};
|
1877 |
-
var breakToRight = function (universe, parent, child) {
|
1878 |
-
return bisect(universe, parent, child).map(function (parts) {
|
1879 |
-
var second = universe.create().clone(parent);
|
1880 |
-
universe.insert().appendAll(second, parts.after());
|
1881 |
-
universe.insert().after(parent, second);
|
1882 |
-
return leftRight(parent, second);
|
1883 |
-
});
|
1884 |
-
};
|
1885 |
-
var breakToLeft = function (universe, parent, child) {
|
1886 |
-
return bisect(universe, parent, child).map(function (parts) {
|
1887 |
-
var prior = universe.create().clone(parent);
|
1888 |
-
universe.insert().appendAll(prior, parts.before().concat([child]));
|
1889 |
-
universe.insert().appendAll(parent, parts.after());
|
1890 |
-
universe.insert().before(parent, prior);
|
1891 |
-
return leftRight(prior, parent);
|
1892 |
-
});
|
1893 |
-
};
|
1894 |
-
var breakPath = function (universe, item, isTop, breaker) {
|
1895 |
-
var result = Immutable('first', 'second', 'splits');
|
1896 |
-
var next = function (child, group, splits) {
|
1897 |
-
var fallback = result(child, Option.none(), splits);
|
1898 |
-
if (isTop(child))
|
1899 |
-
return result(child, group, splits);
|
1900 |
-
else {
|
1901 |
-
return universe.property().parent(child).bind(function (parent) {
|
1902 |
-
return breaker(universe, parent, child).map(function (breakage) {
|
1903 |
-
var extra = [{
|
1904 |
-
first: breakage.left,
|
1905 |
-
second: breakage.right
|
1906 |
-
}];
|
1907 |
-
var nextChild = isTop(parent) ? parent : breakage.left();
|
1908 |
-
return next(nextChild, Option.some(breakage.right()), splits.concat(extra));
|
1909 |
-
}).getOr(fallback);
|
1910 |
-
});
|
1911 |
}
|
1912 |
-
};
|
1913 |
-
return next(item, Option.none(), []);
|
1914 |
};
|
1915 |
-
var
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
var all$3 = function (universe, look, elements, f) {
|
1922 |
-
var head$$1 = elements[0];
|
1923 |
-
var tail = elements.slice(1);
|
1924 |
-
return f(universe, look, head$$1, tail);
|
1925 |
-
};
|
1926 |
-
var oneAll = function (universe, look, elements) {
|
1927 |
-
return elements.length > 0 ? all$3(universe, look, elements, unsafeOne) : Option.none();
|
1928 |
-
};
|
1929 |
-
var unsafeOne = function (universe, look, head$$1, tail) {
|
1930 |
-
var start = look(universe, head$$1);
|
1931 |
-
return foldr(tail, function (b, a) {
|
1932 |
-
var current = look(universe, a);
|
1933 |
-
return commonElement(universe, b, current);
|
1934 |
-
}, start);
|
1935 |
-
};
|
1936 |
-
var commonElement = function (universe, start, end) {
|
1937 |
-
return start.bind(function (s) {
|
1938 |
-
return end.filter(curry(universe.eq, s));
|
1939 |
-
});
|
1940 |
-
};
|
1941 |
-
var Shared = { oneAll: oneAll };
|
1942 |
-
|
1943 |
-
var eq$1 = function (universe, item) {
|
1944 |
-
return curry(universe.eq, item);
|
1945 |
-
};
|
1946 |
-
var unsafeSubset = function (universe, common, ps1, ps2) {
|
1947 |
-
var children = universe.property().children(common);
|
1948 |
-
if (universe.eq(common, ps1[0]))
|
1949 |
-
return Option.some([ps1[0]]);
|
1950 |
-
if (universe.eq(common, ps2[0]))
|
1951 |
-
return Option.some([ps2[0]]);
|
1952 |
-
var finder = function (ps) {
|
1953 |
-
var topDown = reverse(ps);
|
1954 |
-
var index = findIndex(topDown, eq$1(universe, common)).getOr(-1);
|
1955 |
-
var item = index < topDown.length - 1 ? topDown[index + 1] : topDown[index];
|
1956 |
-
return findIndex(children, eq$1(universe, item));
|
1957 |
-
};
|
1958 |
-
var startIndex = finder(ps1);
|
1959 |
-
var endIndex = finder(ps2);
|
1960 |
-
return startIndex.bind(function (sIndex) {
|
1961 |
-
return endIndex.map(function (eIndex) {
|
1962 |
-
var first = Math.min(sIndex, eIndex);
|
1963 |
-
var last$$1 = Math.max(sIndex, eIndex);
|
1964 |
-
return children.slice(first, last$$1 + 1);
|
1965 |
});
|
1966 |
-
});
|
1967 |
-
};
|
1968 |
-
var
|
1969 |
-
var
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
var
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
|
|
2000 |
};
|
|
|
2001 |
|
2002 |
-
|
2003 |
-
return Shared.oneAll(universe, look, elements);
|
2004 |
-
};
|
2005 |
-
var subset$1 = function (universe, start, finish) {
|
2006 |
-
return Subset.subset(universe, start, finish);
|
2007 |
-
};
|
2008 |
-
var ancestors$3 = function (universe, start, finish, _isRoot) {
|
2009 |
-
return Subset.ancestors(universe, start, finish, _isRoot);
|
2010 |
-
};
|
2011 |
-
var breakToLeft$1 = function (universe, parent, child) {
|
2012 |
-
return Breaker.breakToLeft(universe, parent, child);
|
2013 |
-
};
|
2014 |
-
var breakToRight$1 = function (universe, parent, child) {
|
2015 |
-
return Breaker.breakToRight(universe, parent, child);
|
2016 |
-
};
|
2017 |
-
var breakPath$1 = function (universe, child, isTop, breaker) {
|
2018 |
-
return Breaker.breakPath(universe, child, isTop, breaker);
|
2019 |
-
};
|
2020 |
-
var Parent = {
|
2021 |
-
sharedOne: sharedOne,
|
2022 |
-
subset: subset$1,
|
2023 |
-
ancestors: ancestors$3,
|
2024 |
-
breakToLeft: breakToLeft$1,
|
2025 |
-
breakToRight: breakToRight$1,
|
2026 |
-
breakPath: breakPath$1
|
2027 |
-
};
|
2028 |
|
2029 |
-
|
2030 |
-
var
|
2031 |
-
|
2032 |
-
|
2033 |
-
}, elements);
|
2034 |
-
};
|
2035 |
-
var subset$2 = function (start, finish) {
|
2036 |
-
return Parent.subset(universe, start, finish);
|
2037 |
-
};
|
2038 |
-
var ancestors$4 = function (start, finish, _isRoot) {
|
2039 |
-
return Parent.ancestors(universe, start, finish, _isRoot);
|
2040 |
-
};
|
2041 |
-
var breakToLeft$2 = function (parent, child) {
|
2042 |
-
return Parent.breakToLeft(universe, parent, child);
|
2043 |
-
};
|
2044 |
-
var breakToRight$2 = function (parent, child) {
|
2045 |
-
return Parent.breakToRight(universe, parent, child);
|
2046 |
};
|
2047 |
-
var
|
2048 |
-
|
2049 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2050 |
});
|
2051 |
-
};
|
2052 |
-
var
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
breakToLeft: breakToLeft$2,
|
2057 |
-
breakToRight: breakToRight$2,
|
2058 |
-
breakPath: breakPath$2
|
2059 |
-
};
|
2060 |
-
|
2061 |
-
var inSelection = function (bounds, detail) {
|
2062 |
-
var leftEdge = detail.column();
|
2063 |
-
var rightEdge = detail.column() + detail.colspan() - 1;
|
2064 |
-
var topEdge = detail.row();
|
2065 |
-
var bottomEdge = detail.row() + detail.rowspan() - 1;
|
2066 |
-
return leftEdge <= bounds.finishCol() && rightEdge >= bounds.startCol() && (topEdge <= bounds.finishRow() && bottomEdge >= bounds.startRow());
|
2067 |
-
};
|
2068 |
-
var isWithin = function (bounds, detail) {
|
2069 |
-
return detail.column() >= bounds.startCol() && detail.column() + detail.colspan() - 1 <= bounds.finishCol() && detail.row() >= bounds.startRow() && detail.row() + detail.rowspan() - 1 <= bounds.finishRow();
|
2070 |
-
};
|
2071 |
-
var isRectangular = function (warehouse, bounds) {
|
2072 |
-
var isRect = true;
|
2073 |
-
var detailIsWithin = curry(isWithin, bounds);
|
2074 |
-
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
2075 |
-
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
2076 |
-
isRect = isRect && Warehouse.getAt(warehouse, i, j).exists(detailIsWithin);
|
2077 |
}
|
2078 |
}
|
2079 |
-
return isRect ? Option.some(bounds) : Option.none();
|
2080 |
-
};
|
2081 |
-
var CellBounds = {
|
2082 |
-
inSelection: inSelection,
|
2083 |
-
isWithin: isWithin,
|
2084 |
-
isRectangular: isRectangular
|
2085 |
};
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2096 |
});
|
|
|
2097 |
});
|
|
|
2098 |
};
|
2099 |
-
var
|
2100 |
-
|
2101 |
-
return CellBounds.isRectangular(warehouse, bounds);
|
2102 |
-
});
|
2103 |
};
|
2104 |
-
var
|
2105 |
-
|
2106 |
-
|
|
|
|
|
|
|
2107 |
};
|
2108 |
-
|
2109 |
-
var
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2117 |
});
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2124 |
});
|
2125 |
});
|
2126 |
-
}
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
};
|
2131 |
-
return Warehouse.findItem(warehouse, innerCell, isContainedBy).bind(function (detail) {
|
2132 |
-
return detail.element();
|
2133 |
});
|
2134 |
-
};
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
};
|
2140 |
-
|
2141 |
-
var moveBy$1 = function (cell, deltaRow, deltaColumn) {
|
2142 |
-
return TableLookup.table(cell).bind(function (table) {
|
2143 |
-
var warehouse = getWarehouse(table);
|
2144 |
-
return CellFinder.moveBy(warehouse, cell, deltaRow, deltaColumn);
|
2145 |
});
|
2146 |
-
};
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
var
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
nestedIntercepts: nestedIntercepts,
|
2169 |
-
getBox: getBox$1
|
2170 |
-
};
|
2171 |
-
|
2172 |
-
var lookupTable = function (container, isRoot) {
|
2173 |
-
return ancestor$1(container, 'table');
|
2174 |
-
};
|
2175 |
-
var identified = MixedBag([
|
2176 |
-
'boxes',
|
2177 |
-
'start',
|
2178 |
-
'finish'
|
2179 |
-
], []);
|
2180 |
-
var identify = function (start, finish, isRoot) {
|
2181 |
-
var getIsRoot = function (rootTable) {
|
2182 |
-
return function (element) {
|
2183 |
-
return isRoot(element) || eq(element, rootTable);
|
2184 |
-
};
|
2185 |
};
|
2186 |
-
|
2187 |
-
return
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
}));
|
2217 |
-
} else {
|
2218 |
-
return DomParent.ancestors(start, finish).shared().bind(function (lca) {
|
2219 |
-
return closest$1(lca, 'table', isRoot).bind(function (lcaTable) {
|
2220 |
-
var finishAncestorCells = ancestors$1(finish, 'td,th', getIsRoot(lcaTable));
|
2221 |
-
var finishCell = finishAncestorCells.length > 0 ? finishAncestorCells[finishAncestorCells.length - 1] : finish;
|
2222 |
-
var startAncestorCells = ancestors$1(start, 'td,th', getIsRoot(lcaTable));
|
2223 |
-
var startCell = startAncestorCells.length > 0 ? startAncestorCells[startAncestorCells.length - 1] : start;
|
2224 |
-
return Option.some(identified({
|
2225 |
-
boxes: TablePositions.nestedIntercepts(lcaTable, start, startTable, finish, finishTable),
|
2226 |
-
start: startCell,
|
2227 |
-
finish: finishCell
|
2228 |
-
}));
|
2229 |
-
});
|
2230 |
-
});
|
2231 |
-
}
|
2232 |
});
|
2233 |
});
|
2234 |
-
}
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2239 |
};
|
2240 |
-
var
|
2241 |
-
|
2242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2243 |
});
|
2244 |
-
};
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2258 |
});
|
2259 |
});
|
|
|
|
|
|
|
2260 |
};
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2273 |
});
|
2274 |
});
|
2275 |
};
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2280 |
});
|
2281 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2282 |
};
|
2283 |
-
var
|
2284 |
-
|
2285 |
-
retrieve: retrieve,
|
2286 |
-
shiftSelection: shiftSelection,
|
2287 |
-
getEdges: getEdges
|
2288 |
};
|
2289 |
-
|
2290 |
-
|
2291 |
-
return CellSelection.retrieve(container, selector);
|
2292 |
};
|
2293 |
-
var
|
2294 |
-
return
|
2295 |
-
var isRoot = function (ancestor) {
|
2296 |
-
return eq(container, ancestor);
|
2297 |
-
};
|
2298 |
-
var firstAncestor = ancestor$1(edges.first(), 'thead,tfoot,tbody,table', isRoot);
|
2299 |
-
var lastAncestor = ancestor$1(edges.last(), 'thead,tfoot,tbody,table', isRoot);
|
2300 |
-
return firstAncestor.bind(function (fA) {
|
2301 |
-
return lastAncestor.bind(function (lA) {
|
2302 |
-
return eq(fA, lA) ? TablePositions.getBox(edges.table(), edges.first(), edges.last()) : Option.none();
|
2303 |
-
});
|
2304 |
-
});
|
2305 |
-
});
|
2306 |
};
|
2307 |
-
var
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
var
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2335 |
}
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
var
|
2344 |
-
var
|
2345 |
-
if (
|
2346 |
-
|
2347 |
-
} else if (
|
2348 |
-
|
2349 |
-
} else if (!isArray(value)) {
|
2350 |
-
throw new Error('case arguments must be an array');
|
2351 |
}
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
|
2377 |
}
|
2378 |
-
|
2379 |
-
|
2380 |
-
},
|
2381 |
-
match: match,
|
2382 |
-
log: function (label) {
|
2383 |
-
console.log(label, {
|
2384 |
-
constructors: constructors,
|
2385 |
-
constructor: key,
|
2386 |
-
params: args
|
2387 |
});
|
2388 |
}
|
2389 |
-
}
|
2390 |
-
}
|
2391 |
});
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
var
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
var
|
2412 |
-
|
2413 |
-
|
2414 |
-
var
|
2415 |
-
var
|
2416 |
-
|
2417 |
-
|
2418 |
-
var candidates = selection(cell, selections);
|
2419 |
-
return candidates.length > 0 && forall(candidates, hasSpan) ? Option.some(candidates) : Option.none();
|
2420 |
-
};
|
2421 |
-
var mergable = function (table, selections) {
|
2422 |
-
return SelectionTypes.cata(selections.get(), Option.none, function (cells, _env) {
|
2423 |
-
if (cells.length === 0) {
|
2424 |
-
return Option.none();
|
2425 |
}
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2433 |
};
|
2434 |
-
var
|
2435 |
-
|
2436 |
-
|
2437 |
-
selection: selection
|
2438 |
};
|
2439 |
-
|
2440 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2441 |
return {
|
2442 |
-
element:
|
2443 |
-
|
2444 |
-
|
2445 |
-
selection: constant([cell])
|
2446 |
};
|
2447 |
-
};
|
2448 |
-
|
|
|
|
|
|
|
|
|
2449 |
return {
|
2450 |
-
element:
|
2451 |
-
|
2452 |
-
|
2453 |
-
selection: constant(CellOperations.selection(cell, selections))
|
2454 |
};
|
2455 |
-
};
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
var paste$1 = Immutable('element', 'clipboard', 'generators');
|
2460 |
-
var pasteRows = function (selections, table, cell, clipboard, generators) {
|
2461 |
return {
|
2462 |
-
element:
|
2463 |
-
|
2464 |
-
unmergable: Option.none,
|
2465 |
-
selection: constant(CellOperations.selection(cell, selections)),
|
2466 |
-
clipboard: constant(clipboard),
|
2467 |
-
generators: constant(generators)
|
2468 |
};
|
2469 |
-
};
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
var
|
2479 |
-
|
2480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2481 |
});
|
2482 |
-
};
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
return
|
2490 |
-
return
|
2491 |
-
}).
|
2492 |
-
}
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2499 |
});
|
2500 |
-
|
2501 |
-
|
2502 |
-
SelectionTypes.cata(selections.get(), noop, multiCellContext, noop);
|
2503 |
-
}
|
2504 |
-
});
|
2505 |
-
editor.on('BeforeSetContent', function (e) {
|
2506 |
-
if (e.selection === true && e.paste === true) {
|
2507 |
-
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
2508 |
-
cellOpt.each(function (domCell) {
|
2509 |
-
var cell = Element$$1.fromDom(domCell);
|
2510 |
-
var table = TableLookup.table(cell);
|
2511 |
-
table.bind(function (table) {
|
2512 |
-
var elements = filter(fromHtml$1(e.content), function (content) {
|
2513 |
-
return name(content) !== 'meta';
|
2514 |
-
});
|
2515 |
-
if (elements.length === 1 && name(elements[0]) === 'table') {
|
2516 |
-
e.preventDefault();
|
2517 |
-
var doc = Element$$1.fromDom(editor.getDoc());
|
2518 |
-
var generators = TableFill.paste(doc);
|
2519 |
-
var targets = TableTargets.paste(cell, elements[0], generators);
|
2520 |
-
actions.pasteCells(table, targets).each(function (rng) {
|
2521 |
-
editor.selection.setRng(rng);
|
2522 |
-
editor.focus();
|
2523 |
-
cellSelection.clear(table);
|
2524 |
-
});
|
2525 |
-
}
|
2526 |
-
});
|
2527 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2528 |
}
|
2529 |
-
|
2530 |
-
|
2531 |
-
var Clipboard = { registerEvents: registerEvents };
|
2532 |
-
|
2533 |
-
function Dimension (name, getOffset) {
|
2534 |
-
var set = function (element, h) {
|
2535 |
-
if (!isNumber(h) && !h.match(/^[0-9]+$/))
|
2536 |
-
throw name + '.set accepts only positive integer values. Value was ' + h;
|
2537 |
-
var dom = element.dom();
|
2538 |
-
if (isSupported(dom))
|
2539 |
-
dom.style[name] = h + 'px';
|
2540 |
-
};
|
2541 |
-
var get = function (element) {
|
2542 |
-
var r = getOffset(element);
|
2543 |
-
if (r <= 0 || r === null) {
|
2544 |
-
var css = get$2(element, name);
|
2545 |
-
return parseFloat(css) || 0;
|
2546 |
}
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
};
|
2557 |
-
var max = function (element, value, properties) {
|
2558 |
-
var cumulativeInclusions = aggregate(element, properties);
|
2559 |
-
var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;
|
2560 |
-
return absoluteMax;
|
2561 |
-
};
|
2562 |
-
return {
|
2563 |
-
set: set,
|
2564 |
-
get: get,
|
2565 |
-
getOuter: getOuter,
|
2566 |
-
aggregate: aggregate,
|
2567 |
-
max: max
|
2568 |
-
};
|
2569 |
}
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
|
|
|
|
|
|
|
|
|
|
2574 |
});
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
return api$1.getOuter(element);
|
2580 |
-
};
|
2581 |
-
|
2582 |
-
var api$2 = Dimension('width', function (element) {
|
2583 |
-
return element.dom().offsetWidth;
|
2584 |
});
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
var
|
2625 |
-
var
|
2626 |
-
var
|
2627 |
-
var
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
var
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
};
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
return Option.from(get$1(element, 'width'));
|
2671 |
-
}, function (width) {
|
2672 |
-
return Option.some(width);
|
2673 |
-
});
|
2674 |
-
};
|
2675 |
-
var normalizePercentageWidth = function (cellWidth, tableSize) {
|
2676 |
-
return cellWidth / tableSize.pixelWidth() * 100;
|
2677 |
-
};
|
2678 |
-
var choosePercentageSize = function (element, width, tableSize) {
|
2679 |
-
if (percentageBasedSizeRegex.test(width)) {
|
2680 |
-
var percentMatch = percentageBasedSizeRegex.exec(width);
|
2681 |
-
return parseFloat(percentMatch[1]);
|
2682 |
-
} else {
|
2683 |
-
var intWidth = get$5(element);
|
2684 |
-
return normalizePercentageWidth(intWidth, tableSize);
|
2685 |
}
|
2686 |
};
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
return cellWidth / 100 * tableSize.pixelWidth();
|
2698 |
-
};
|
2699 |
-
var choosePixelSize = function (element, width, tableSize) {
|
2700 |
-
if (pixelBasedSizeRegex.test(width)) {
|
2701 |
-
var pixelMatch = pixelBasedSizeRegex.exec(width);
|
2702 |
-
return parseInt(pixelMatch[1], 10);
|
2703 |
-
} else if (percentageBasedSizeRegex.test(width)) {
|
2704 |
-
var percentMatch = percentageBasedSizeRegex.exec(width);
|
2705 |
-
var floatWidth = parseFloat(percentMatch[1]);
|
2706 |
-
return normalizePixelWidth(floatWidth, tableSize);
|
2707 |
-
} else {
|
2708 |
-
return get$5(element);
|
2709 |
-
}
|
2710 |
-
};
|
2711 |
-
var getPixelWidth = function (cell, tableSize) {
|
2712 |
-
var width = getRawWidth(cell);
|
2713 |
-
return width.fold(function () {
|
2714 |
-
return get$5(cell);
|
2715 |
-
}, function (width) {
|
2716 |
-
return choosePixelSize(cell, width, tableSize);
|
2717 |
-
});
|
2718 |
-
};
|
2719 |
-
var getHeight$1 = function (cell) {
|
2720 |
-
return get$6(cell, 'rowspan', getTotalHeight);
|
2721 |
-
};
|
2722 |
-
var getGenericWidth = function (cell) {
|
2723 |
-
var width = getRawWidth(cell);
|
2724 |
-
return width.bind(function (width) {
|
2725 |
-
if (genericSizeRegex.test(width)) {
|
2726 |
-
var match = genericSizeRegex.exec(width);
|
2727 |
-
return Option.some({
|
2728 |
-
width: constant(match[1]),
|
2729 |
-
unit: constant(match[3])
|
2730 |
-
});
|
2731 |
-
} else {
|
2732 |
-
return Option.none();
|
2733 |
-
}
|
2734 |
-
});
|
2735 |
-
};
|
2736 |
-
var setGenericWidth = function (cell, amount, unit) {
|
2737 |
-
set$1(cell, 'width', amount + unit);
|
2738 |
-
};
|
2739 |
-
var Sizes = {
|
2740 |
-
percentageBasedSizeRegex: constant(percentageBasedSizeRegex),
|
2741 |
-
pixelBasedSizeRegex: constant(pixelBasedSizeRegex),
|
2742 |
-
setPixelWidth: setPixelWidth,
|
2743 |
-
setPercentageWidth: setPercentageWidth,
|
2744 |
-
setHeight: setHeight,
|
2745 |
-
getPixelWidth: getPixelWidth,
|
2746 |
-
getPercentageWidth: getPercentageWidth,
|
2747 |
-
getGenericWidth: getGenericWidth,
|
2748 |
-
setGenericWidth: setGenericWidth,
|
2749 |
-
getHeight: getHeight$1,
|
2750 |
-
getRawWidth: getRawWidth
|
2751 |
-
};
|
2752 |
-
|
2753 |
-
var halve = function (main, other) {
|
2754 |
-
var width = Sizes.getGenericWidth(main);
|
2755 |
-
width.each(function (width) {
|
2756 |
-
var newWidth = width.width() / 2;
|
2757 |
-
Sizes.setGenericWidth(main, newWidth, width.unit());
|
2758 |
-
Sizes.setGenericWidth(other, newWidth, width.unit());
|
2759 |
-
});
|
2760 |
-
};
|
2761 |
-
var CellMutations = { halve: halve };
|
2762 |
-
|
2763 |
-
var attached = function (element, scope) {
|
2764 |
-
var doc = scope || Element$$1.fromDom(document.documentElement);
|
2765 |
-
return ancestor(element, curry(eq, doc)).isSome();
|
2766 |
-
};
|
2767 |
-
var windowOf = function (element) {
|
2768 |
-
var dom = element.dom();
|
2769 |
-
if (dom === dom.window && element instanceof Window)
|
2770 |
-
return element;
|
2771 |
-
return isDocument(element) ? dom.defaultView || dom.parentWindow : null;
|
2772 |
-
};
|
2773 |
-
|
2774 |
-
var r = function (left, top) {
|
2775 |
-
var translate = function (x, y) {
|
2776 |
-
return r(left + x, top + y);
|
2777 |
-
};
|
2778 |
-
return {
|
2779 |
-
left: constant(left),
|
2780 |
-
top: constant(top),
|
2781 |
-
translate: translate
|
2782 |
-
};
|
2783 |
-
};
|
2784 |
-
var Position = r;
|
2785 |
-
|
2786 |
-
var boxPosition = function (dom) {
|
2787 |
-
var box = dom.getBoundingClientRect();
|
2788 |
-
return Position(box.left, box.top);
|
2789 |
-
};
|
2790 |
-
var firstDefinedOrZero = function (a, b) {
|
2791 |
-
return a !== undefined ? a : b !== undefined ? b : 0;
|
2792 |
-
};
|
2793 |
-
var absolute = function (element) {
|
2794 |
-
var doc = element.dom().ownerDocument;
|
2795 |
-
var body = doc.body;
|
2796 |
-
var win = windowOf(Element$$1.fromDom(doc));
|
2797 |
-
var html = doc.documentElement;
|
2798 |
-
var scrollTop = firstDefinedOrZero(win.pageYOffset, html.scrollTop);
|
2799 |
-
var scrollLeft = firstDefinedOrZero(win.pageXOffset, html.scrollLeft);
|
2800 |
-
var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
|
2801 |
-
var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
|
2802 |
-
return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
|
2803 |
-
};
|
2804 |
-
var viewport = function (element) {
|
2805 |
-
var dom = element.dom();
|
2806 |
-
var doc = dom.ownerDocument;
|
2807 |
-
var body = doc.body;
|
2808 |
-
var html = Element$$1.fromDom(doc.documentElement);
|
2809 |
-
if (body === dom)
|
2810 |
-
return Position(body.offsetLeft, body.offsetTop);
|
2811 |
-
if (!attached(element, html))
|
2812 |
-
return Position(0, 0);
|
2813 |
-
return boxPosition(dom);
|
2814 |
-
};
|
2815 |
-
|
2816 |
-
var rowInfo = Immutable('row', 'y');
|
2817 |
-
var colInfo = Immutable('col', 'x');
|
2818 |
-
var rtlEdge = function (cell) {
|
2819 |
-
var pos = absolute(cell);
|
2820 |
-
return pos.left() + getOuter$1(cell);
|
2821 |
-
};
|
2822 |
-
var ltrEdge = function (cell) {
|
2823 |
-
return absolute(cell).left();
|
2824 |
-
};
|
2825 |
-
var getLeftEdge = function (index, cell) {
|
2826 |
-
return colInfo(index, ltrEdge(cell));
|
2827 |
-
};
|
2828 |
-
var getRightEdge = function (index, cell) {
|
2829 |
-
return colInfo(index, rtlEdge(cell));
|
2830 |
-
};
|
2831 |
-
var getTop = function (cell) {
|
2832 |
-
return absolute(cell).top();
|
2833 |
-
};
|
2834 |
-
var getTopEdge = function (index, cell) {
|
2835 |
-
return rowInfo(index, getTop(cell));
|
2836 |
-
};
|
2837 |
-
var getBottomEdge = function (index, cell) {
|
2838 |
-
return rowInfo(index, getTop(cell) + getOuter(cell));
|
2839 |
-
};
|
2840 |
-
var findPositions = function (getInnerEdge, getOuterEdge, array) {
|
2841 |
-
if (array.length === 0)
|
2842 |
-
return [];
|
2843 |
-
var lines = map(array.slice(1), function (cellOption, index) {
|
2844 |
-
return cellOption.map(function (cell) {
|
2845 |
-
return getInnerEdge(index, cell);
|
2846 |
-
});
|
2847 |
-
});
|
2848 |
-
var lastLine = array[array.length - 1].map(function (cell) {
|
2849 |
-
return getOuterEdge(array.length - 1, cell);
|
2850 |
-
});
|
2851 |
-
return lines.concat([lastLine]);
|
2852 |
-
};
|
2853 |
-
var negate = function (step, _table) {
|
2854 |
-
return -step;
|
2855 |
-
};
|
2856 |
-
var height = {
|
2857 |
-
delta: identity,
|
2858 |
-
positions: curry(findPositions, getTopEdge, getBottomEdge),
|
2859 |
-
edge: getTop
|
2860 |
-
};
|
2861 |
-
var ltr = {
|
2862 |
-
delta: identity,
|
2863 |
-
edge: ltrEdge,
|
2864 |
-
positions: curry(findPositions, getLeftEdge, getRightEdge)
|
2865 |
-
};
|
2866 |
-
var rtl = {
|
2867 |
-
delta: negate,
|
2868 |
-
edge: rtlEdge,
|
2869 |
-
positions: curry(findPositions, getRightEdge, getLeftEdge)
|
2870 |
-
};
|
2871 |
-
var BarPositions = {
|
2872 |
-
height: height,
|
2873 |
-
rtl: rtl,
|
2874 |
-
ltr: ltr
|
2875 |
-
};
|
2876 |
-
|
2877 |
-
var ResizeDirection = {
|
2878 |
-
ltr: BarPositions.ltr,
|
2879 |
-
rtl: BarPositions.rtl
|
2880 |
-
};
|
2881 |
-
|
2882 |
-
function TableDirection (directionAt) {
|
2883 |
-
var auto = function (table) {
|
2884 |
-
return directionAt(table).isRtl() ? ResizeDirection.rtl : ResizeDirection.ltr;
|
2885 |
-
};
|
2886 |
-
var delta = function (amount, table) {
|
2887 |
-
return auto(table).delta(amount, table);
|
2888 |
-
};
|
2889 |
-
var positions = function (cols, table) {
|
2890 |
-
return auto(table).positions(cols, table);
|
2891 |
-
};
|
2892 |
-
var edge = function (cell) {
|
2893 |
-
return auto(cell).edge(cell);
|
2894 |
-
};
|
2895 |
-
return {
|
2896 |
-
delta: delta,
|
2897 |
-
edge: edge,
|
2898 |
-
positions: positions
|
2899 |
-
};
|
2900 |
-
}
|
2901 |
-
|
2902 |
-
var getGridSize = function (table) {
|
2903 |
-
var input = DetailsList.fromTable(table);
|
2904 |
-
var warehouse = Warehouse.generate(input);
|
2905 |
-
return warehouse.grid();
|
2906 |
-
};
|
2907 |
-
var TableGridSize = { getGridSize: getGridSize };
|
2908 |
-
|
2909 |
-
var Cell = function (initial) {
|
2910 |
-
var value = initial;
|
2911 |
-
var get = function () {
|
2912 |
-
return value;
|
2913 |
-
};
|
2914 |
-
var set = function (v) {
|
2915 |
-
value = v;
|
2916 |
-
};
|
2917 |
-
var clone = function () {
|
2918 |
-
return Cell(get());
|
2919 |
-
};
|
2920 |
-
return {
|
2921 |
-
get: get,
|
2922 |
-
set: set,
|
2923 |
-
clone: clone
|
2924 |
-
};
|
2925 |
-
};
|
2926 |
-
|
2927 |
-
var base = function (handleUnsupported, required) {
|
2928 |
-
return baseWith(handleUnsupported, required, {
|
2929 |
-
validate: isFunction,
|
2930 |
-
label: 'function'
|
2931 |
-
});
|
2932 |
-
};
|
2933 |
-
var baseWith = function (handleUnsupported, required, pred) {
|
2934 |
-
if (required.length === 0)
|
2935 |
-
throw new Error('You must specify at least one required field.');
|
2936 |
-
validateStrArr('required', required);
|
2937 |
-
checkDupes(required);
|
2938 |
-
return function (obj) {
|
2939 |
-
var keys$$1 = keys(obj);
|
2940 |
-
var allReqd = forall(required, function (req) {
|
2941 |
-
return contains(keys$$1, req);
|
2942 |
-
});
|
2943 |
-
if (!allReqd)
|
2944 |
-
reqMessage(required, keys$$1);
|
2945 |
-
handleUnsupported(required, keys$$1);
|
2946 |
-
var invalidKeys = filter(required, function (key) {
|
2947 |
-
return !pred.validate(obj[key], key);
|
2948 |
-
});
|
2949 |
-
if (invalidKeys.length > 0)
|
2950 |
-
invalidTypeMessage(invalidKeys, pred.label);
|
2951 |
-
return obj;
|
2952 |
-
};
|
2953 |
-
};
|
2954 |
-
var handleExact = function (required, keys$$1) {
|
2955 |
-
var unsupported = filter(keys$$1, function (key) {
|
2956 |
-
return !contains(required, key);
|
2957 |
-
});
|
2958 |
-
if (unsupported.length > 0)
|
2959 |
-
unsuppMessage(unsupported);
|
2960 |
-
};
|
2961 |
-
var exactly = function (required) {
|
2962 |
-
return base(handleExact, required);
|
2963 |
-
};
|
2964 |
-
|
2965 |
-
var elementToData = function (element) {
|
2966 |
-
var colspan = has$1(element, 'colspan') ? parseInt(get$1(element, 'colspan'), 10) : 1;
|
2967 |
-
var rowspan = has$1(element, 'rowspan') ? parseInt(get$1(element, 'rowspan'), 10) : 1;
|
2968 |
-
return {
|
2969 |
-
element: constant(element),
|
2970 |
-
colspan: constant(colspan),
|
2971 |
-
rowspan: constant(rowspan)
|
2972 |
-
};
|
2973 |
-
};
|
2974 |
-
var modification = function (generators, _toData) {
|
2975 |
-
contract(generators);
|
2976 |
-
var position = Cell(Option.none());
|
2977 |
-
var toData = _toData !== undefined ? _toData : elementToData;
|
2978 |
-
var nu = function (data) {
|
2979 |
-
return generators.cell(data);
|
2980 |
-
};
|
2981 |
-
var nuFrom = function (element) {
|
2982 |
-
var data = toData(element);
|
2983 |
-
return nu(data);
|
2984 |
-
};
|
2985 |
-
var add = function (element) {
|
2986 |
-
var replacement = nuFrom(element);
|
2987 |
-
if (position.get().isNone())
|
2988 |
-
position.set(Option.some(replacement));
|
2989 |
-
recent = Option.some({
|
2990 |
-
item: element,
|
2991 |
-
replacement: replacement
|
2992 |
-
});
|
2993 |
-
return replacement;
|
2994 |
-
};
|
2995 |
-
var recent = Option.none();
|
2996 |
-
var getOrInit = function (element, comparator) {
|
2997 |
-
return recent.fold(function () {
|
2998 |
-
return add(element);
|
2999 |
-
}, function (p) {
|
3000 |
-
return comparator(element, p.item) ? p.replacement : add(element);
|
3001 |
-
});
|
3002 |
-
};
|
3003 |
-
return {
|
3004 |
-
getOrInit: getOrInit,
|
3005 |
-
cursor: position.get
|
3006 |
-
};
|
3007 |
-
};
|
3008 |
-
var transform = function (scope, tag) {
|
3009 |
-
return function (generators) {
|
3010 |
-
var position = Cell(Option.none());
|
3011 |
-
contract(generators);
|
3012 |
-
var list = [];
|
3013 |
-
var find$$1 = function (element, comparator) {
|
3014 |
-
return find(list, function (x) {
|
3015 |
-
return comparator(x.item, element);
|
3016 |
-
});
|
3017 |
-
};
|
3018 |
-
var makeNew = function (element) {
|
3019 |
-
var cell = generators.replace(element, tag, { scope: scope });
|
3020 |
-
list.push({
|
3021 |
-
item: element,
|
3022 |
-
sub: cell
|
3023 |
-
});
|
3024 |
-
if (position.get().isNone())
|
3025 |
-
position.set(Option.some(cell));
|
3026 |
-
return cell;
|
3027 |
-
};
|
3028 |
-
var replaceOrInit = function (element, comparator) {
|
3029 |
-
return find$$1(element, comparator).fold(function () {
|
3030 |
-
return makeNew(element);
|
3031 |
-
}, function (p) {
|
3032 |
-
return comparator(element, p.item) ? p.sub : makeNew(element);
|
3033 |
-
});
|
3034 |
-
};
|
3035 |
-
return {
|
3036 |
-
replaceOrInit: replaceOrInit,
|
3037 |
-
cursor: position.get
|
3038 |
-
};
|
3039 |
-
};
|
3040 |
-
};
|
3041 |
-
var merging = function (generators) {
|
3042 |
-
contract(generators);
|
3043 |
-
var position = Cell(Option.none());
|
3044 |
-
var combine = function (cell) {
|
3045 |
-
if (position.get().isNone())
|
3046 |
-
position.set(Option.some(cell));
|
3047 |
-
return function () {
|
3048 |
-
var raw = generators.cell({
|
3049 |
-
element: constant(cell),
|
3050 |
-
colspan: constant(1),
|
3051 |
-
rowspan: constant(1)
|
3052 |
-
});
|
3053 |
-
remove$1(raw, 'width');
|
3054 |
-
remove$1(cell, 'width');
|
3055 |
-
return raw;
|
3056 |
-
};
|
3057 |
-
};
|
3058 |
-
return {
|
3059 |
-
combine: combine,
|
3060 |
-
cursor: position.get
|
3061 |
-
};
|
3062 |
-
};
|
3063 |
-
var contract = exactly([
|
3064 |
-
'cell',
|
3065 |
-
'row',
|
3066 |
-
'replace',
|
3067 |
-
'gap'
|
3068 |
-
]);
|
3069 |
-
var Generators = {
|
3070 |
-
modification: modification,
|
3071 |
-
transform: transform,
|
3072 |
-
merging: merging
|
3073 |
-
};
|
3074 |
-
|
3075 |
-
var blockList = [
|
3076 |
-
'body',
|
3077 |
-
'p',
|
3078 |
-
'div',
|
3079 |
-
'article',
|
3080 |
-
'aside',
|
3081 |
-
'figcaption',
|
3082 |
-
'figure',
|
3083 |
-
'footer',
|
3084 |
-
'header',
|
3085 |
-
'nav',
|
3086 |
-
'section',
|
3087 |
-
'ol',
|
3088 |
-
'ul',
|
3089 |
-
'table',
|
3090 |
-
'thead',
|
3091 |
-
'tfoot',
|
3092 |
-
'tbody',
|
3093 |
-
'caption',
|
3094 |
-
'tr',
|
3095 |
-
'td',
|
3096 |
-
'th',
|
3097 |
-
'h1',
|
3098 |
-
'h2',
|
3099 |
-
'h3',
|
3100 |
-
'h4',
|
3101 |
-
'h5',
|
3102 |
-
'h6',
|
3103 |
-
'blockquote',
|
3104 |
-
'pre',
|
3105 |
-
'address'
|
3106 |
-
];
|
3107 |
-
var isList = function (universe, item) {
|
3108 |
-
var tagName = universe.property().name(item);
|
3109 |
-
return contains([
|
3110 |
-
'ol',
|
3111 |
-
'ul'
|
3112 |
-
], tagName);
|
3113 |
-
};
|
3114 |
-
var isBlock = function (universe, item) {
|
3115 |
-
var tagName = universe.property().name(item);
|
3116 |
-
return contains(blockList, tagName);
|
3117 |
-
};
|
3118 |
-
var isFormatting = function (universe, item) {
|
3119 |
-
var tagName = universe.property().name(item);
|
3120 |
-
return contains([
|
3121 |
-
'address',
|
3122 |
-
'pre',
|
3123 |
-
'p',
|
3124 |
-
'h1',
|
3125 |
-
'h2',
|
3126 |
-
'h3',
|
3127 |
-
'h4',
|
3128 |
-
'h5',
|
3129 |
-
'h6'
|
3130 |
-
], tagName);
|
3131 |
-
};
|
3132 |
-
var isHeading = function (universe, item) {
|
3133 |
-
var tagName = universe.property().name(item);
|
3134 |
-
return contains([
|
3135 |
-
'h1',
|
3136 |
-
'h2',
|
3137 |
-
'h3',
|
3138 |
-
'h4',
|
3139 |
-
'h5',
|
3140 |
-
'h6'
|
3141 |
-
], tagName);
|
3142 |
-
};
|
3143 |
-
var isContainer = function (universe, item) {
|
3144 |
-
return contains([
|
3145 |
-
'div',
|
3146 |
-
'li',
|
3147 |
-
'td',
|
3148 |
-
'th',
|
3149 |
-
'blockquote',
|
3150 |
-
'body',
|
3151 |
-
'caption'
|
3152 |
-
], universe.property().name(item));
|
3153 |
-
};
|
3154 |
-
var isEmptyTag = function (universe, item) {
|
3155 |
-
return contains([
|
3156 |
-
'br',
|
3157 |
-
'img',
|
3158 |
-
'hr',
|
3159 |
-
'input'
|
3160 |
-
], universe.property().name(item));
|
3161 |
-
};
|
3162 |
-
var isFrame = function (universe, item) {
|
3163 |
-
return universe.property().name(item) === 'iframe';
|
3164 |
-
};
|
3165 |
-
var isInline = function (universe, item) {
|
3166 |
-
return !(isBlock(universe, item) || isEmptyTag(universe, item)) && universe.property().name(item) !== 'li';
|
3167 |
-
};
|
3168 |
-
var Structure = {
|
3169 |
-
isBlock: isBlock,
|
3170 |
-
isList: isList,
|
3171 |
-
isFormatting: isFormatting,
|
3172 |
-
isHeading: isHeading,
|
3173 |
-
isContainer: isContainer,
|
3174 |
-
isEmptyTag: isEmptyTag,
|
3175 |
-
isFrame: isFrame,
|
3176 |
-
isInline: isInline
|
3177 |
-
};
|
3178 |
-
|
3179 |
-
var universe$1 = DomUniverse();
|
3180 |
-
var isBlock$1 = function (element) {
|
3181 |
-
return Structure.isBlock(universe$1, element);
|
3182 |
-
};
|
3183 |
-
var isList$1 = function (element) {
|
3184 |
-
return Structure.isList(universe$1, element);
|
3185 |
-
};
|
3186 |
-
var isFormatting$1 = function (element) {
|
3187 |
-
return Structure.isFormatting(universe$1, element);
|
3188 |
-
};
|
3189 |
-
var isHeading$1 = function (element) {
|
3190 |
-
return Structure.isHeading(universe$1, element);
|
3191 |
-
};
|
3192 |
-
var isContainer$1 = function (element) {
|
3193 |
-
return Structure.isContainer(universe$1, element);
|
3194 |
-
};
|
3195 |
-
var isEmptyTag$1 = function (element) {
|
3196 |
-
return Structure.isEmptyTag(universe$1, element);
|
3197 |
-
};
|
3198 |
-
var isFrame$1 = function (element) {
|
3199 |
-
return Structure.isFrame(universe$1, element);
|
3200 |
-
};
|
3201 |
-
var isInline$1 = function (element) {
|
3202 |
-
return Structure.isInline(universe$1, element);
|
3203 |
-
};
|
3204 |
-
var DomStructure = {
|
3205 |
-
isBlock: isBlock$1,
|
3206 |
-
isList: isList$1,
|
3207 |
-
isFormatting: isFormatting$1,
|
3208 |
-
isHeading: isHeading$1,
|
3209 |
-
isContainer: isContainer$1,
|
3210 |
-
isEmptyTag: isEmptyTag$1,
|
3211 |
-
isFrame: isFrame$1,
|
3212 |
-
isInline: isInline$1
|
3213 |
-
};
|
3214 |
-
|
3215 |
-
var merge = function (cells) {
|
3216 |
-
var isBr = function (el) {
|
3217 |
-
return name(el) === 'br';
|
3218 |
-
};
|
3219 |
-
var advancedBr = function (children$$1) {
|
3220 |
-
return forall(children$$1, function (c) {
|
3221 |
-
return isBr(c) || isText(c) && get$3(c).trim().length === 0;
|
3222 |
-
});
|
3223 |
-
};
|
3224 |
-
var isListItem = function (el) {
|
3225 |
-
return name(el) === 'li' || ancestor(el, DomStructure.isList).isSome();
|
3226 |
-
};
|
3227 |
-
var siblingIsBlock = function (el) {
|
3228 |
-
return nextSibling(el).map(function (rightSibling) {
|
3229 |
-
if (DomStructure.isBlock(rightSibling))
|
3230 |
-
return true;
|
3231 |
-
if (DomStructure.isEmptyTag(rightSibling)) {
|
3232 |
-
return name(rightSibling) === 'img' ? false : true;
|
3233 |
-
}
|
3234 |
-
}).getOr(false);
|
3235 |
-
};
|
3236 |
-
var markCell = function (cell) {
|
3237 |
-
return last$2(cell).bind(function (rightEdge) {
|
3238 |
-
var rightSiblingIsBlock = siblingIsBlock(rightEdge);
|
3239 |
-
return parent(rightEdge).map(function (parent$$1) {
|
3240 |
-
return rightSiblingIsBlock === true || isListItem(parent$$1) || isBr(rightEdge) || DomStructure.isBlock(parent$$1) && !eq(cell, parent$$1) ? [] : [Element$$1.fromTag('br')];
|
3241 |
-
});
|
3242 |
-
}).getOr([]);
|
3243 |
-
};
|
3244 |
-
var markContent = function () {
|
3245 |
-
var content = bind(cells, function (cell) {
|
3246 |
-
var children$$1 = children(cell);
|
3247 |
-
return advancedBr(children$$1) ? [] : children$$1.concat(markCell(cell));
|
3248 |
-
});
|
3249 |
-
return content.length === 0 ? [Element$$1.fromTag('br')] : content;
|
3250 |
-
};
|
3251 |
-
var contents = markContent();
|
3252 |
-
empty(cells[0]);
|
3253 |
-
append$1(cells[0], contents);
|
3254 |
-
};
|
3255 |
-
var TableContent = { merge: merge };
|
3256 |
-
|
3257 |
-
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
3258 |
-
var shallow$1 = function (old, nu) {
|
3259 |
-
return nu;
|
3260 |
-
};
|
3261 |
-
var baseMerge = function (merger) {
|
3262 |
-
return function () {
|
3263 |
-
var objects = new Array(arguments.length);
|
3264 |
-
for (var i = 0; i < objects.length; i++)
|
3265 |
-
objects[i] = arguments[i];
|
3266 |
-
if (objects.length === 0)
|
3267 |
-
throw new Error('Can\'t merge zero objects');
|
3268 |
-
var ret = {};
|
3269 |
-
for (var j = 0; j < objects.length; j++) {
|
3270 |
-
var curObject = objects[j];
|
3271 |
-
for (var key in curObject)
|
3272 |
-
if (hasOwnProperty$1.call(curObject, key)) {
|
3273 |
-
ret[key] = merger(ret[key], curObject[key]);
|
3274 |
-
}
|
3275 |
-
}
|
3276 |
-
return ret;
|
3277 |
-
};
|
3278 |
-
};
|
3279 |
-
var merge$1 = baseMerge(shallow$1);
|
3280 |
-
|
3281 |
-
var cat = function (arr) {
|
3282 |
-
var r = [];
|
3283 |
-
var push = function (x) {
|
3284 |
-
r.push(x);
|
3285 |
-
};
|
3286 |
-
for (var i = 0; i < arr.length; i++) {
|
3287 |
-
arr[i].each(push);
|
3288 |
-
}
|
3289 |
-
return r;
|
3290 |
-
};
|
3291 |
-
var findMap = function (arr, f) {
|
3292 |
-
for (var i = 0; i < arr.length; i++) {
|
3293 |
-
var r = f(arr[i], i);
|
3294 |
-
if (r.isSome()) {
|
3295 |
-
return r;
|
3296 |
-
}
|
3297 |
-
}
|
3298 |
-
return Option.none();
|
3299 |
-
};
|
3300 |
-
|
3301 |
-
var addCell = function (gridRow, index, cell) {
|
3302 |
-
var cells = gridRow.cells();
|
3303 |
-
var before = cells.slice(0, index);
|
3304 |
-
var after = cells.slice(index);
|
3305 |
-
var newCells = before.concat([cell]).concat(after);
|
3306 |
-
return setCells(gridRow, newCells);
|
3307 |
-
};
|
3308 |
-
var mutateCell = function (gridRow, index, cell) {
|
3309 |
-
var cells = gridRow.cells();
|
3310 |
-
cells[index] = cell;
|
3311 |
-
};
|
3312 |
-
var setCells = function (gridRow, cells) {
|
3313 |
-
return Structs.rowcells(cells, gridRow.section());
|
3314 |
-
};
|
3315 |
-
var mapCells = function (gridRow, f) {
|
3316 |
-
var cells = gridRow.cells();
|
3317 |
-
var r = map(cells, f);
|
3318 |
-
return Structs.rowcells(r, gridRow.section());
|
3319 |
-
};
|
3320 |
-
var getCell = function (gridRow, index) {
|
3321 |
-
return gridRow.cells()[index];
|
3322 |
-
};
|
3323 |
-
var getCellElement = function (gridRow, index) {
|
3324 |
-
return getCell(gridRow, index).element();
|
3325 |
-
};
|
3326 |
-
var cellLength = function (gridRow) {
|
3327 |
-
return gridRow.cells().length;
|
3328 |
-
};
|
3329 |
-
var GridRow = {
|
3330 |
-
addCell: addCell,
|
3331 |
-
setCells: setCells,
|
3332 |
-
mutateCell: mutateCell,
|
3333 |
-
getCell: getCell,
|
3334 |
-
getCellElement: getCellElement,
|
3335 |
-
mapCells: mapCells,
|
3336 |
-
cellLength: cellLength
|
3337 |
-
};
|
3338 |
-
|
3339 |
-
var getColumn = function (grid, index) {
|
3340 |
-
return map(grid, function (row) {
|
3341 |
-
return GridRow.getCell(row, index);
|
3342 |
-
});
|
3343 |
-
};
|
3344 |
-
var getRow = function (grid, index) {
|
3345 |
-
return grid[index];
|
3346 |
-
};
|
3347 |
-
var findDiff = function (xs, comp) {
|
3348 |
-
if (xs.length === 0)
|
3349 |
-
return 0;
|
3350 |
-
var first = xs[0];
|
3351 |
-
var index = findIndex(xs, function (x) {
|
3352 |
-
return !comp(first.element(), x.element());
|
3353 |
-
});
|
3354 |
-
return index.fold(function () {
|
3355 |
-
return xs.length;
|
3356 |
-
}, function (ind) {
|
3357 |
-
return ind;
|
3358 |
-
});
|
3359 |
-
};
|
3360 |
-
var subgrid = function (grid, row, column, comparator) {
|
3361 |
-
var restOfRow = getRow(grid, row).cells().slice(column);
|
3362 |
-
var endColIndex = findDiff(restOfRow, comparator);
|
3363 |
-
var restOfColumn = getColumn(grid, column).slice(row);
|
3364 |
-
var endRowIndex = findDiff(restOfColumn, comparator);
|
3365 |
-
return {
|
3366 |
-
colspan: constant(endColIndex),
|
3367 |
-
rowspan: constant(endRowIndex)
|
3368 |
-
};
|
3369 |
-
};
|
3370 |
-
var TableGrid = { subgrid: subgrid };
|
3371 |
-
|
3372 |
-
var toDetails = function (grid, comparator) {
|
3373 |
-
var seen = map(grid, function (row, ri) {
|
3374 |
-
return map(row.cells(), function (col, ci) {
|
3375 |
-
return false;
|
3376 |
-
});
|
3377 |
-
});
|
3378 |
-
var updateSeen = function (ri, ci, rowspan, colspan) {
|
3379 |
-
for (var r = ri; r < ri + rowspan; r++) {
|
3380 |
-
for (var c = ci; c < ci + colspan; c++) {
|
3381 |
-
seen[r][c] = true;
|
3382 |
-
}
|
3383 |
-
}
|
3384 |
-
};
|
3385 |
-
return map(grid, function (row, ri) {
|
3386 |
-
var details = bind(row.cells(), function (cell, ci) {
|
3387 |
-
if (seen[ri][ci] === false) {
|
3388 |
-
var result = TableGrid.subgrid(grid, ri, ci, comparator);
|
3389 |
-
updateSeen(ri, ci, result.rowspan(), result.colspan());
|
3390 |
-
return [Structs.detailnew(cell.element(), result.rowspan(), result.colspan(), cell.isNew())];
|
3391 |
-
} else {
|
3392 |
-
return [];
|
3393 |
-
}
|
3394 |
-
});
|
3395 |
-
return Structs.rowdetails(details, row.section());
|
3396 |
-
});
|
3397 |
-
};
|
3398 |
-
var toGrid = function (warehouse, generators, isNew) {
|
3399 |
-
var grid = [];
|
3400 |
-
for (var i = 0; i < warehouse.grid().rows(); i++) {
|
3401 |
-
var rowCells = [];
|
3402 |
-
for (var j = 0; j < warehouse.grid().columns(); j++) {
|
3403 |
-
var element = Warehouse.getAt(warehouse, i, j).map(function (item) {
|
3404 |
-
return Structs.elementnew(item.element(), isNew);
|
3405 |
-
}).getOrThunk(function () {
|
3406 |
-
return Structs.elementnew(generators.gap(), true);
|
3407 |
-
});
|
3408 |
-
rowCells.push(element);
|
3409 |
-
}
|
3410 |
-
var row = Structs.rowcells(rowCells, warehouse.all()[i].section());
|
3411 |
-
grid.push(row);
|
3412 |
-
}
|
3413 |
-
return grid;
|
3414 |
-
};
|
3415 |
-
var Transitions = {
|
3416 |
-
toDetails: toDetails,
|
3417 |
-
toGrid: toGrid
|
3418 |
-
};
|
3419 |
-
|
3420 |
-
var setIfNot = function (element, property, value, ignore) {
|
3421 |
-
if (value === ignore)
|
3422 |
-
remove(element, property);
|
3423 |
-
else
|
3424 |
-
set(element, property, value);
|
3425 |
-
};
|
3426 |
-
var render = function (table, grid) {
|
3427 |
-
var newRows = [];
|
3428 |
-
var newCells = [];
|
3429 |
-
var renderSection = function (gridSection, sectionName) {
|
3430 |
-
var section = child$2(table, sectionName).getOrThunk(function () {
|
3431 |
-
var tb = Element$$1.fromTag(sectionName, owner(table).dom());
|
3432 |
-
append(table, tb);
|
3433 |
-
return tb;
|
3434 |
-
});
|
3435 |
-
empty(section);
|
3436 |
-
var rows = map(gridSection, function (row) {
|
3437 |
-
if (row.isNew()) {
|
3438 |
-
newRows.push(row.element());
|
3439 |
-
}
|
3440 |
-
var tr = row.element();
|
3441 |
-
empty(tr);
|
3442 |
-
each(row.cells(), function (cell) {
|
3443 |
-
if (cell.isNew()) {
|
3444 |
-
newCells.push(cell.element());
|
3445 |
-
}
|
3446 |
-
setIfNot(cell.element(), 'colspan', cell.colspan(), 1);
|
3447 |
-
setIfNot(cell.element(), 'rowspan', cell.rowspan(), 1);
|
3448 |
-
append(tr, cell.element());
|
3449 |
-
});
|
3450 |
-
return tr;
|
3451 |
-
});
|
3452 |
-
append$1(section, rows);
|
3453 |
-
};
|
3454 |
-
var removeSection = function (sectionName) {
|
3455 |
-
child$2(table, sectionName).each(remove$2);
|
3456 |
-
};
|
3457 |
-
var renderOrRemoveSection = function (gridSection, sectionName) {
|
3458 |
-
if (gridSection.length > 0) {
|
3459 |
-
renderSection(gridSection, sectionName);
|
3460 |
-
} else {
|
3461 |
-
removeSection(sectionName);
|
3462 |
-
}
|
3463 |
-
};
|
3464 |
-
var headSection = [];
|
3465 |
-
var bodySection = [];
|
3466 |
-
var footSection = [];
|
3467 |
-
each(grid, function (row) {
|
3468 |
-
switch (row.section()) {
|
3469 |
-
case 'thead':
|
3470 |
-
headSection.push(row);
|
3471 |
-
break;
|
3472 |
-
case 'tbody':
|
3473 |
-
bodySection.push(row);
|
3474 |
-
break;
|
3475 |
-
case 'tfoot':
|
3476 |
-
footSection.push(row);
|
3477 |
-
break;
|
3478 |
-
}
|
3479 |
-
});
|
3480 |
-
renderOrRemoveSection(headSection, 'thead');
|
3481 |
-
renderOrRemoveSection(bodySection, 'tbody');
|
3482 |
-
renderOrRemoveSection(footSection, 'tfoot');
|
3483 |
-
return {
|
3484 |
-
newRows: constant(newRows),
|
3485 |
-
newCells: constant(newCells)
|
3486 |
-
};
|
3487 |
-
};
|
3488 |
-
var copy$2 = function (grid) {
|
3489 |
-
var rows = map(grid, function (row) {
|
3490 |
-
var tr = shallow(row.element());
|
3491 |
-
each(row.cells(), function (cell) {
|
3492 |
-
var clonedCell = deep(cell.element());
|
3493 |
-
setIfNot(clonedCell, 'colspan', cell.colspan(), 1);
|
3494 |
-
setIfNot(clonedCell, 'rowspan', cell.rowspan(), 1);
|
3495 |
-
append(tr, clonedCell);
|
3496 |
-
});
|
3497 |
-
return tr;
|
3498 |
-
});
|
3499 |
-
return rows;
|
3500 |
-
};
|
3501 |
-
var Redraw = {
|
3502 |
-
render: render,
|
3503 |
-
copy: copy$2
|
3504 |
-
};
|
3505 |
-
|
3506 |
-
var repeat = function (repititions, f) {
|
3507 |
-
var r = [];
|
3508 |
-
for (var i = 0; i < repititions; i++) {
|
3509 |
-
r.push(f(i));
|
3510 |
-
}
|
3511 |
-
return r;
|
3512 |
-
};
|
3513 |
-
var range$1 = function (start, end) {
|
3514 |
-
var r = [];
|
3515 |
-
for (var i = start; i < end; i++) {
|
3516 |
-
r.push(i);
|
3517 |
-
}
|
3518 |
-
return r;
|
3519 |
-
};
|
3520 |
-
var unique = function (xs, comparator) {
|
3521 |
-
var result = [];
|
3522 |
-
each(xs, function (x, i) {
|
3523 |
-
if (i < xs.length - 1 && !comparator(x, xs[i + 1])) {
|
3524 |
-
result.push(x);
|
3525 |
-
} else if (i === xs.length - 1) {
|
3526 |
-
result.push(x);
|
3527 |
-
}
|
3528 |
-
});
|
3529 |
-
return result;
|
3530 |
-
};
|
3531 |
-
var deduce = function (xs, index) {
|
3532 |
-
if (index < 0 || index >= xs.length - 1)
|
3533 |
-
return Option.none();
|
3534 |
-
var current = xs[index].fold(function () {
|
3535 |
-
var rest = reverse(xs.slice(0, index));
|
3536 |
-
return findMap(rest, function (a, i) {
|
3537 |
-
return a.map(function (aa) {
|
3538 |
-
return {
|
3539 |
-
value: aa,
|
3540 |
-
delta: i + 1
|
3541 |
-
};
|
3542 |
-
});
|
3543 |
-
});
|
3544 |
-
}, function (c) {
|
3545 |
-
return Option.some({
|
3546 |
-
value: c,
|
3547 |
-
delta: 0
|
3548 |
-
});
|
3549 |
-
});
|
3550 |
-
var next = xs[index + 1].fold(function () {
|
3551 |
-
var rest = xs.slice(index + 1);
|
3552 |
-
return findMap(rest, function (a, i) {
|
3553 |
-
return a.map(function (aa) {
|
3554 |
-
return {
|
3555 |
-
value: aa,
|
3556 |
-
delta: i + 1
|
3557 |
-
};
|
3558 |
-
});
|
3559 |
-
});
|
3560 |
-
}, function (n) {
|
3561 |
-
return Option.some({
|
3562 |
-
value: n,
|
3563 |
-
delta: 1
|
3564 |
-
});
|
3565 |
-
});
|
3566 |
-
return current.bind(function (c) {
|
3567 |
-
return next.map(function (n) {
|
3568 |
-
var extras = n.delta + c.delta;
|
3569 |
-
return Math.abs(n.value - c.value) / extras;
|
3570 |
-
});
|
3571 |
-
});
|
3572 |
-
};
|
3573 |
-
var Util = {
|
3574 |
-
repeat: repeat,
|
3575 |
-
range: range$1,
|
3576 |
-
unique: unique,
|
3577 |
-
deduce: deduce
|
3578 |
-
};
|
3579 |
-
|
3580 |
-
var columns = function (warehouse) {
|
3581 |
-
var grid = warehouse.grid();
|
3582 |
-
var cols = Util.range(0, grid.columns());
|
3583 |
-
var rows = Util.range(0, grid.rows());
|
3584 |
-
return map(cols, function (col) {
|
3585 |
-
var getBlock = function () {
|
3586 |
-
return bind(rows, function (r) {
|
3587 |
-
return Warehouse.getAt(warehouse, r, col).filter(function (detail) {
|
3588 |
-
return detail.column() === col;
|
3589 |
-
}).fold(constant([]), function (detail) {
|
3590 |
-
return [detail];
|
3591 |
-
});
|
3592 |
-
});
|
3593 |
-
};
|
3594 |
-
var isSingle = function (detail) {
|
3595 |
-
return detail.colspan() === 1;
|
3596 |
-
};
|
3597 |
-
var getFallback = function () {
|
3598 |
-
return Warehouse.getAt(warehouse, 0, col);
|
3599 |
-
};
|
3600 |
-
return decide(getBlock, isSingle, getFallback);
|
3601 |
-
});
|
3602 |
-
};
|
3603 |
-
var decide = function (getBlock, isSingle, getFallback) {
|
3604 |
-
var inBlock = getBlock();
|
3605 |
-
var singleInBlock = find(inBlock, isSingle);
|
3606 |
-
var detailOption = singleInBlock.orThunk(function () {
|
3607 |
-
return Option.from(inBlock[0]).orThunk(getFallback);
|
3608 |
-
});
|
3609 |
-
return detailOption.map(function (detail) {
|
3610 |
-
return detail.element();
|
3611 |
-
});
|
3612 |
-
};
|
3613 |
-
var rows$1 = function (warehouse) {
|
3614 |
-
var grid = warehouse.grid();
|
3615 |
-
var rows = Util.range(0, grid.rows());
|
3616 |
-
var cols = Util.range(0, grid.columns());
|
3617 |
-
return map(rows, function (row) {
|
3618 |
-
var getBlock = function () {
|
3619 |
-
return bind(cols, function (c) {
|
3620 |
-
return Warehouse.getAt(warehouse, row, c).filter(function (detail) {
|
3621 |
-
return detail.row() === row;
|
3622 |
-
}).fold(constant([]), function (detail) {
|
3623 |
-
return [detail];
|
3624 |
-
});
|
3625 |
-
});
|
3626 |
-
};
|
3627 |
-
var isSingle = function (detail) {
|
3628 |
-
return detail.rowspan() === 1;
|
3629 |
-
};
|
3630 |
-
var getFallback = function () {
|
3631 |
-
return Warehouse.getAt(warehouse, row, 0);
|
3632 |
-
};
|
3633 |
-
return decide(getBlock, isSingle, getFallback);
|
3634 |
-
});
|
3635 |
-
};
|
3636 |
-
var Blocks = {
|
3637 |
-
columns: columns,
|
3638 |
-
rows: rows$1
|
3639 |
-
};
|
3640 |
-
|
3641 |
-
var col = function (column, x, y, w, h) {
|
3642 |
-
var blocker = Element$$1.fromTag('div');
|
3643 |
-
setAll$1(blocker, {
|
3644 |
-
position: 'absolute',
|
3645 |
-
left: x - w / 2 + 'px',
|
3646 |
-
top: y + 'px',
|
3647 |
-
height: h + 'px',
|
3648 |
-
width: w + 'px'
|
3649 |
-
});
|
3650 |
-
setAll(blocker, {
|
3651 |
-
'data-column': column,
|
3652 |
-
'role': 'presentation'
|
3653 |
-
});
|
3654 |
-
return blocker;
|
3655 |
-
};
|
3656 |
-
var row$1 = function (row, x, y, w, h) {
|
3657 |
-
var blocker = Element$$1.fromTag('div');
|
3658 |
-
setAll$1(blocker, {
|
3659 |
-
position: 'absolute',
|
3660 |
-
left: x + 'px',
|
3661 |
-
top: y - h / 2 + 'px',
|
3662 |
-
height: h + 'px',
|
3663 |
-
width: w + 'px'
|
3664 |
-
});
|
3665 |
-
setAll(blocker, {
|
3666 |
-
'data-row': row,
|
3667 |
-
'role': 'presentation'
|
3668 |
-
});
|
3669 |
-
return blocker;
|
3670 |
-
};
|
3671 |
-
var Bar = {
|
3672 |
-
col: col,
|
3673 |
-
row: row$1
|
3674 |
-
};
|
3675 |
-
|
3676 |
-
var css = function (namespace) {
|
3677 |
-
var dashNamespace = namespace.replace(/\./g, '-');
|
3678 |
-
var resolve = function (str) {
|
3679 |
-
return dashNamespace + '-' + str;
|
3680 |
-
};
|
3681 |
-
return { resolve: resolve };
|
3682 |
-
};
|
3683 |
-
|
3684 |
-
var styles = css('ephox-snooker');
|
3685 |
-
var Styles = { resolve: styles.resolve };
|
3686 |
-
|
3687 |
-
var read = function (element, attr) {
|
3688 |
-
var value = get$1(element, attr);
|
3689 |
-
return value === undefined || value === '' ? [] : value.split(' ');
|
3690 |
-
};
|
3691 |
-
var add = function (element, attr, id) {
|
3692 |
-
var old = read(element, attr);
|
3693 |
-
var nu = old.concat([id]);
|
3694 |
-
set(element, attr, nu.join(' '));
|
3695 |
-
return true;
|
3696 |
-
};
|
3697 |
-
var remove$3 = function (element, attr, id) {
|
3698 |
-
var nu = filter(read(element, attr), function (v) {
|
3699 |
-
return v !== id;
|
3700 |
-
});
|
3701 |
-
if (nu.length > 0)
|
3702 |
-
set(element, attr, nu.join(' '));
|
3703 |
-
else
|
3704 |
-
remove(element, attr);
|
3705 |
-
return false;
|
3706 |
-
};
|
3707 |
-
|
3708 |
-
var supports = function (element) {
|
3709 |
-
return element.dom().classList !== undefined;
|
3710 |
-
};
|
3711 |
-
var get$7 = function (element) {
|
3712 |
-
return read(element, 'class');
|
3713 |
-
};
|
3714 |
-
var add$1 = function (element, clazz) {
|
3715 |
-
return add(element, 'class', clazz);
|
3716 |
-
};
|
3717 |
-
var remove$4 = function (element, clazz) {
|
3718 |
-
return remove$3(element, 'class', clazz);
|
3719 |
-
};
|
3720 |
-
|
3721 |
-
var add$2 = function (element, clazz) {
|
3722 |
-
if (supports(element))
|
3723 |
-
element.dom().classList.add(clazz);
|
3724 |
-
else
|
3725 |
-
add$1(element, clazz);
|
3726 |
-
};
|
3727 |
-
var cleanClass = function (element) {
|
3728 |
-
var classList = supports(element) ? element.dom().classList : get$7(element);
|
3729 |
-
if (classList.length === 0) {
|
3730 |
-
remove(element, 'class');
|
3731 |
-
}
|
3732 |
-
};
|
3733 |
-
var remove$5 = function (element, clazz) {
|
3734 |
-
if (supports(element)) {
|
3735 |
-
var classList = element.dom().classList;
|
3736 |
-
classList.remove(clazz);
|
3737 |
-
} else
|
3738 |
-
remove$4(element, clazz);
|
3739 |
-
cleanClass(element);
|
3740 |
-
};
|
3741 |
-
var has$2 = function (element, clazz) {
|
3742 |
-
return supports(element) && element.dom().classList.contains(clazz);
|
3743 |
-
};
|
3744 |
-
|
3745 |
-
var resizeBar = Styles.resolve('resizer-bar');
|
3746 |
-
var resizeRowBar = Styles.resolve('resizer-rows');
|
3747 |
-
var resizeColBar = Styles.resolve('resizer-cols');
|
3748 |
-
var BAR_THICKNESS = 7;
|
3749 |
-
var clear = function (wire) {
|
3750 |
-
var previous = descendants$1(wire.parent(), '.' + resizeBar);
|
3751 |
-
each(previous, remove$2);
|
3752 |
-
};
|
3753 |
-
var drawBar = function (wire, positions, create) {
|
3754 |
-
var origin = wire.origin();
|
3755 |
-
each(positions, function (cpOption, i) {
|
3756 |
-
cpOption.each(function (cp) {
|
3757 |
-
var bar = create(origin, cp);
|
3758 |
-
add$2(bar, resizeBar);
|
3759 |
-
append(wire.parent(), bar);
|
3760 |
-
});
|
3761 |
-
});
|
3762 |
-
};
|
3763 |
-
var refreshCol = function (wire, colPositions, position, tableHeight) {
|
3764 |
-
drawBar(wire, colPositions, function (origin, cp) {
|
3765 |
-
var colBar = Bar.col(cp.col(), cp.x() - origin.left(), position.top() - origin.top(), BAR_THICKNESS, tableHeight);
|
3766 |
-
add$2(colBar, resizeColBar);
|
3767 |
-
return colBar;
|
3768 |
-
});
|
3769 |
-
};
|
3770 |
-
var refreshRow = function (wire, rowPositions, position, tableWidth) {
|
3771 |
-
drawBar(wire, rowPositions, function (origin, cp) {
|
3772 |
-
var rowBar = Bar.row(cp.row(), position.left() - origin.left(), cp.y() - origin.top(), tableWidth, BAR_THICKNESS);
|
3773 |
-
add$2(rowBar, resizeRowBar);
|
3774 |
-
return rowBar;
|
3775 |
-
});
|
3776 |
-
};
|
3777 |
-
var refreshGrid = function (wire, table, rows, cols, hdirection, vdirection) {
|
3778 |
-
var position = absolute(table);
|
3779 |
-
var rowPositions = rows.length > 0 ? hdirection.positions(rows, table) : [];
|
3780 |
-
refreshRow(wire, rowPositions, position, getOuter$1(table));
|
3781 |
-
var colPositions = cols.length > 0 ? vdirection.positions(cols, table) : [];
|
3782 |
-
refreshCol(wire, colPositions, position, getOuter(table));
|
3783 |
-
};
|
3784 |
-
var refresh = function (wire, table, hdirection, vdirection) {
|
3785 |
-
clear(wire);
|
3786 |
-
var list = DetailsList.fromTable(table);
|
3787 |
-
var warehouse = Warehouse.generate(list);
|
3788 |
-
var rows = Blocks.rows(warehouse);
|
3789 |
-
var cols = Blocks.columns(warehouse);
|
3790 |
-
refreshGrid(wire, table, rows, cols, hdirection, vdirection);
|
3791 |
-
};
|
3792 |
-
var each$2 = function (wire, f) {
|
3793 |
-
var bars = descendants$1(wire.parent(), '.' + resizeBar);
|
3794 |
-
each(bars, f);
|
3795 |
-
};
|
3796 |
-
var hide = function (wire) {
|
3797 |
-
each$2(wire, function (bar) {
|
3798 |
-
set$1(bar, 'display', 'none');
|
3799 |
-
});
|
3800 |
-
};
|
3801 |
-
var show = function (wire) {
|
3802 |
-
each$2(wire, function (bar) {
|
3803 |
-
set$1(bar, 'display', 'block');
|
3804 |
-
});
|
3805 |
-
};
|
3806 |
-
var isRowBar = function (element) {
|
3807 |
-
return has$2(element, resizeRowBar);
|
3808 |
-
};
|
3809 |
-
var isColBar = function (element) {
|
3810 |
-
return has$2(element, resizeColBar);
|
3811 |
-
};
|
3812 |
-
var Bars = {
|
3813 |
-
refresh: refresh,
|
3814 |
-
hide: hide,
|
3815 |
-
show: show,
|
3816 |
-
destroy: clear,
|
3817 |
-
isRowBar: isRowBar,
|
3818 |
-
isColBar: isColBar
|
3819 |
-
};
|
3820 |
-
|
3821 |
-
var fromWarehouse = function (warehouse, generators) {
|
3822 |
-
return Transitions.toGrid(warehouse, generators, false);
|
3823 |
-
};
|
3824 |
-
var deriveRows = function (rendered, generators) {
|
3825 |
-
var findRow = function (details) {
|
3826 |
-
var rowOfCells = findMap(details, function (detail) {
|
3827 |
-
return parent(detail.element()).map(function (row) {
|
3828 |
-
var isNew = parent(row).isNone();
|
3829 |
-
return Structs.elementnew(row, isNew);
|
3830 |
-
});
|
3831 |
-
});
|
3832 |
-
return rowOfCells.getOrThunk(function () {
|
3833 |
-
return Structs.elementnew(generators.row(), true);
|
3834 |
-
});
|
3835 |
-
};
|
3836 |
-
return map(rendered, function (details) {
|
3837 |
-
var row = findRow(details.details());
|
3838 |
-
return Structs.rowdatanew(row.element(), details.details(), details.section(), row.isNew());
|
3839 |
-
});
|
3840 |
-
};
|
3841 |
-
var toDetailList = function (grid, generators) {
|
3842 |
-
var rendered = Transitions.toDetails(grid, eq);
|
3843 |
-
return deriveRows(rendered, generators);
|
3844 |
-
};
|
3845 |
-
var findInWarehouse = function (warehouse, element) {
|
3846 |
-
var all = flatten(map(warehouse.all(), function (r) {
|
3847 |
-
return r.cells();
|
3848 |
-
}));
|
3849 |
-
return find(all, function (e) {
|
3850 |
-
return eq(element, e.element());
|
3851 |
-
});
|
3852 |
-
};
|
3853 |
-
var run = function (operation, extract, adjustment, postAction, genWrappers) {
|
3854 |
-
return function (wire, table, target, generators, direction) {
|
3855 |
-
var input = DetailsList.fromTable(table);
|
3856 |
-
var warehouse = Warehouse.generate(input);
|
3857 |
-
var output = extract(warehouse, target).map(function (info) {
|
3858 |
-
var model = fromWarehouse(warehouse, generators);
|
3859 |
-
var result = operation(model, info, eq, genWrappers(generators));
|
3860 |
-
var grid = toDetailList(result.grid(), generators);
|
3861 |
-
return {
|
3862 |
-
grid: constant(grid),
|
3863 |
-
cursor: result.cursor
|
3864 |
-
};
|
3865 |
-
});
|
3866 |
-
return output.fold(function () {
|
3867 |
-
return Option.none();
|
3868 |
-
}, function (out) {
|
3869 |
-
var newElements = Redraw.render(table, out.grid());
|
3870 |
-
adjustment(table, out.grid(), direction);
|
3871 |
-
postAction(table);
|
3872 |
-
Bars.refresh(wire, table, BarPositions.height, direction);
|
3873 |
-
return Option.some({
|
3874 |
-
cursor: out.cursor,
|
3875 |
-
newRows: newElements.newRows,
|
3876 |
-
newCells: newElements.newCells
|
3877 |
-
});
|
3878 |
-
});
|
3879 |
-
};
|
3880 |
-
};
|
3881 |
-
var onCell = function (warehouse, target) {
|
3882 |
-
return TableLookup.cell(target.element()).bind(function (cell) {
|
3883 |
-
return findInWarehouse(warehouse, cell);
|
3884 |
-
});
|
3885 |
-
};
|
3886 |
-
var onPaste = function (warehouse, target) {
|
3887 |
-
return TableLookup.cell(target.element()).bind(function (cell) {
|
3888 |
-
return findInWarehouse(warehouse, cell).map(function (details) {
|
3889 |
-
return merge$1(details, {
|
3890 |
-
generators: target.generators,
|
3891 |
-
clipboard: target.clipboard
|
3892 |
-
});
|
3893 |
-
});
|
3894 |
-
});
|
3895 |
-
};
|
3896 |
-
var onPasteRows = function (warehouse, target) {
|
3897 |
-
var details = map(target.selection(), function (cell) {
|
3898 |
-
return TableLookup.cell(cell).bind(function (lc) {
|
3899 |
-
return findInWarehouse(warehouse, lc);
|
3900 |
-
});
|
3901 |
-
});
|
3902 |
-
var cells = cat(details);
|
3903 |
-
return cells.length > 0 ? Option.some(merge$1({ cells: cells }, {
|
3904 |
-
generators: target.generators,
|
3905 |
-
clipboard: target.clipboard
|
3906 |
-
})) : Option.none();
|
3907 |
-
};
|
3908 |
-
var onMergable = function (warehouse, target) {
|
3909 |
-
return target.mergable();
|
3910 |
-
};
|
3911 |
-
var onUnmergable = function (warehouse, target) {
|
3912 |
-
return target.unmergable();
|
3913 |
-
};
|
3914 |
-
var onCells = function (warehouse, target) {
|
3915 |
-
var details = map(target.selection(), function (cell) {
|
3916 |
-
return TableLookup.cell(cell).bind(function (lc) {
|
3917 |
-
return findInWarehouse(warehouse, lc);
|
3918 |
-
});
|
3919 |
-
});
|
3920 |
-
var cells = cat(details);
|
3921 |
-
return cells.length > 0 ? Option.some(cells) : Option.none();
|
3922 |
-
};
|
3923 |
-
var RunOperation = {
|
3924 |
-
run: run,
|
3925 |
-
toDetailList: toDetailList,
|
3926 |
-
onCell: onCell,
|
3927 |
-
onCells: onCells,
|
3928 |
-
onPaste: onPaste,
|
3929 |
-
onPasteRows: onPasteRows,
|
3930 |
-
onMergable: onMergable,
|
3931 |
-
onUnmergable: onUnmergable
|
3932 |
-
};
|
3933 |
-
|
3934 |
-
var value$1 = function (o) {
|
3935 |
-
var is = function (v) {
|
3936 |
-
return o === v;
|
3937 |
-
};
|
3938 |
-
var or = function (opt) {
|
3939 |
-
return value$1(o);
|
3940 |
-
};
|
3941 |
-
var orThunk = function (f) {
|
3942 |
-
return value$1(o);
|
3943 |
-
};
|
3944 |
-
var map = function (f) {
|
3945 |
-
return value$1(f(o));
|
3946 |
-
};
|
3947 |
-
var mapError = function (f) {
|
3948 |
-
return value$1(o);
|
3949 |
-
};
|
3950 |
-
var each = function (f) {
|
3951 |
-
f(o);
|
3952 |
-
};
|
3953 |
-
var bind = function (f) {
|
3954 |
-
return f(o);
|
3955 |
-
};
|
3956 |
-
var fold = function (_, onValue) {
|
3957 |
-
return onValue(o);
|
3958 |
-
};
|
3959 |
-
var exists = function (f) {
|
3960 |
-
return f(o);
|
3961 |
-
};
|
3962 |
-
var forall = function (f) {
|
3963 |
-
return f(o);
|
3964 |
-
};
|
3965 |
-
var toOption = function () {
|
3966 |
-
return Option.some(o);
|
3967 |
-
};
|
3968 |
-
return {
|
3969 |
-
is: is,
|
3970 |
-
isValue: always,
|
3971 |
-
isError: never,
|
3972 |
-
getOr: constant(o),
|
3973 |
-
getOrThunk: constant(o),
|
3974 |
-
getOrDie: constant(o),
|
3975 |
-
or: or,
|
3976 |
-
orThunk: orThunk,
|
3977 |
-
fold: fold,
|
3978 |
-
map: map,
|
3979 |
-
mapError: mapError,
|
3980 |
-
each: each,
|
3981 |
-
bind: bind,
|
3982 |
-
exists: exists,
|
3983 |
-
forall: forall,
|
3984 |
-
toOption: toOption
|
3985 |
-
};
|
3986 |
-
};
|
3987 |
-
var error = function (message) {
|
3988 |
-
var getOrThunk = function (f) {
|
3989 |
-
return f();
|
3990 |
-
};
|
3991 |
-
var getOrDie = function () {
|
3992 |
-
return die(String(message))();
|
3993 |
-
};
|
3994 |
-
var or = function (opt) {
|
3995 |
-
return opt;
|
3996 |
-
};
|
3997 |
-
var orThunk = function (f) {
|
3998 |
-
return f();
|
3999 |
-
};
|
4000 |
-
var map = function (f) {
|
4001 |
-
return error(message);
|
4002 |
-
};
|
4003 |
-
var mapError = function (f) {
|
4004 |
-
return error(f(message));
|
4005 |
-
};
|
4006 |
-
var bind = function (f) {
|
4007 |
-
return error(message);
|
4008 |
-
};
|
4009 |
-
var fold = function (onError, _) {
|
4010 |
-
return onError(message);
|
4011 |
-
};
|
4012 |
-
return {
|
4013 |
-
is: never,
|
4014 |
-
isValue: never,
|
4015 |
-
isError: always,
|
4016 |
-
getOr: identity,
|
4017 |
-
getOrThunk: getOrThunk,
|
4018 |
-
getOrDie: getOrDie,
|
4019 |
-
or: or,
|
4020 |
-
orThunk: orThunk,
|
4021 |
-
fold: fold,
|
4022 |
-
map: map,
|
4023 |
-
mapError: mapError,
|
4024 |
-
each: noop,
|
4025 |
-
bind: bind,
|
4026 |
-
exists: never,
|
4027 |
-
forall: always,
|
4028 |
-
toOption: Option.none
|
4029 |
-
};
|
4030 |
-
};
|
4031 |
-
var Result = {
|
4032 |
-
value: value$1,
|
4033 |
-
error: error
|
4034 |
-
};
|
4035 |
-
|
4036 |
-
var measure = function (startAddress, gridA, gridB) {
|
4037 |
-
if (startAddress.row() >= gridA.length || startAddress.column() > GridRow.cellLength(gridA[0]))
|
4038 |
-
return Result.error('invalid start address out of table bounds, row: ' + startAddress.row() + ', column: ' + startAddress.column());
|
4039 |
-
var rowRemainder = gridA.slice(startAddress.row());
|
4040 |
-
var colRemainder = rowRemainder[0].cells().slice(startAddress.column());
|
4041 |
-
var colRequired = GridRow.cellLength(gridB[0]);
|
4042 |
-
var rowRequired = gridB.length;
|
4043 |
-
return Result.value({
|
4044 |
-
rowDelta: constant(rowRemainder.length - rowRequired),
|
4045 |
-
colDelta: constant(colRemainder.length - colRequired)
|
4046 |
-
});
|
4047 |
-
};
|
4048 |
-
var measureWidth = function (gridA, gridB) {
|
4049 |
-
var colLengthA = GridRow.cellLength(gridA[0]);
|
4050 |
-
var colLengthB = GridRow.cellLength(gridB[0]);
|
4051 |
-
return {
|
4052 |
-
rowDelta: constant(0),
|
4053 |
-
colDelta: constant(colLengthA - colLengthB)
|
4054 |
-
};
|
4055 |
-
};
|
4056 |
-
var fill = function (cells, generator) {
|
4057 |
-
return map(cells, function () {
|
4058 |
-
return Structs.elementnew(generator.cell(), true);
|
4059 |
-
});
|
4060 |
-
};
|
4061 |
-
var rowFill = function (grid, amount, generator) {
|
4062 |
-
return grid.concat(Util.repeat(amount, function (_row) {
|
4063 |
-
return GridRow.setCells(grid[grid.length - 1], fill(grid[grid.length - 1].cells(), generator));
|
4064 |
-
}));
|
4065 |
-
};
|
4066 |
-
var colFill = function (grid, amount, generator) {
|
4067 |
-
return map(grid, function (row) {
|
4068 |
-
return GridRow.setCells(row, row.cells().concat(fill(Util.range(0, amount), generator)));
|
4069 |
-
});
|
4070 |
-
};
|
4071 |
-
var tailor = function (gridA, delta, generator) {
|
4072 |
-
var fillCols = delta.colDelta() < 0 ? colFill : identity;
|
4073 |
-
var fillRows = delta.rowDelta() < 0 ? rowFill : identity;
|
4074 |
-
var modifiedCols = fillCols(gridA, Math.abs(delta.colDelta()), generator);
|
4075 |
-
var tailoredGrid = fillRows(modifiedCols, Math.abs(delta.rowDelta()), generator);
|
4076 |
-
return tailoredGrid;
|
4077 |
-
};
|
4078 |
-
var Fitment = {
|
4079 |
-
measure: measure,
|
4080 |
-
measureWidth: measureWidth,
|
4081 |
-
tailor: tailor
|
4082 |
-
};
|
4083 |
-
|
4084 |
-
var merge$2 = function (grid, bounds, comparator, substitution) {
|
4085 |
-
if (grid.length === 0)
|
4086 |
-
return grid;
|
4087 |
-
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
4088 |
-
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
4089 |
-
GridRow.mutateCell(grid[i], j, Structs.elementnew(substitution(), false));
|
4090 |
-
}
|
4091 |
-
}
|
4092 |
-
return grid;
|
4093 |
-
};
|
4094 |
-
var unmerge = function (grid, target, comparator, substitution) {
|
4095 |
-
var first = true;
|
4096 |
-
for (var i = 0; i < grid.length; i++) {
|
4097 |
-
for (var j = 0; j < GridRow.cellLength(grid[0]); j++) {
|
4098 |
-
var current = GridRow.getCellElement(grid[i], j);
|
4099 |
-
var isToReplace = comparator(current, target);
|
4100 |
-
if (isToReplace === true && first === false) {
|
4101 |
-
GridRow.mutateCell(grid[i], j, Structs.elementnew(substitution(), true));
|
4102 |
-
} else if (isToReplace === true) {
|
4103 |
-
first = false;
|
4104 |
-
}
|
4105 |
-
}
|
4106 |
-
}
|
4107 |
-
return grid;
|
4108 |
-
};
|
4109 |
-
var uniqueCells = function (row, comparator) {
|
4110 |
-
return foldl(row, function (rest, cell) {
|
4111 |
-
return exists(rest, function (currentCell) {
|
4112 |
-
return comparator(currentCell.element(), cell.element());
|
4113 |
-
}) ? rest : rest.concat([cell]);
|
4114 |
-
}, []);
|
4115 |
-
};
|
4116 |
-
var splitRows = function (grid, index, comparator, substitution) {
|
4117 |
-
if (index > 0 && index < grid.length) {
|
4118 |
-
var rowPrevCells = grid[index - 1].cells();
|
4119 |
-
var cells = uniqueCells(rowPrevCells, comparator);
|
4120 |
-
each(cells, function (cell) {
|
4121 |
-
var replacement = Option.none();
|
4122 |
-
for (var i = index; i < grid.length; i++) {
|
4123 |
-
for (var j = 0; j < GridRow.cellLength(grid[0]); j++) {
|
4124 |
-
var current = grid[i].cells()[j];
|
4125 |
-
var isToReplace = comparator(current.element(), cell.element());
|
4126 |
-
if (isToReplace) {
|
4127 |
-
if (replacement.isNone()) {
|
4128 |
-
replacement = Option.some(substitution());
|
4129 |
-
}
|
4130 |
-
replacement.each(function (sub) {
|
4131 |
-
GridRow.mutateCell(grid[i], j, Structs.elementnew(sub, true));
|
4132 |
-
});
|
4133 |
-
}
|
4134 |
-
}
|
4135 |
-
}
|
4136 |
-
});
|
4137 |
-
}
|
4138 |
-
return grid;
|
4139 |
-
};
|
4140 |
-
var MergingOperations = {
|
4141 |
-
merge: merge$2,
|
4142 |
-
unmerge: unmerge,
|
4143 |
-
splitRows: splitRows
|
4144 |
-
};
|
4145 |
-
|
4146 |
-
var isSpanning = function (grid, row, col, comparator) {
|
4147 |
-
var candidate = GridRow.getCell(grid[row], col);
|
4148 |
-
var matching = curry(comparator, candidate.element());
|
4149 |
-
var currentRow = grid[row];
|
4150 |
-
return grid.length > 1 && GridRow.cellLength(currentRow) > 1 && (col > 0 && matching(GridRow.getCellElement(currentRow, col - 1)) || col < currentRow.length - 1 && matching(GridRow.getCellElement(currentRow, col + 1)) || row > 0 && matching(GridRow.getCellElement(grid[row - 1], col)) || row < grid.length - 1 && matching(GridRow.getCellElement(grid[row + 1], col)));
|
4151 |
-
};
|
4152 |
-
var mergeTables = function (startAddress, gridA, gridB, generator, comparator) {
|
4153 |
-
var startRow = startAddress.row();
|
4154 |
-
var startCol = startAddress.column();
|
4155 |
-
var mergeHeight = gridB.length;
|
4156 |
-
var mergeWidth = GridRow.cellLength(gridB[0]);
|
4157 |
-
var endRow = startRow + mergeHeight;
|
4158 |
-
var endCol = startCol + mergeWidth;
|
4159 |
-
for (var r = startRow; r < endRow; r++) {
|
4160 |
-
for (var c = startCol; c < endCol; c++) {
|
4161 |
-
if (isSpanning(gridA, r, c, comparator)) {
|
4162 |
-
MergingOperations.unmerge(gridA, GridRow.getCellElement(gridA[r], c), comparator, generator.cell);
|
4163 |
-
}
|
4164 |
-
var newCell = GridRow.getCellElement(gridB[r - startRow], c - startCol);
|
4165 |
-
var replacement = generator.replace(newCell);
|
4166 |
-
GridRow.mutateCell(gridA[r], c, Structs.elementnew(replacement, true));
|
4167 |
-
}
|
4168 |
-
}
|
4169 |
-
return gridA;
|
4170 |
-
};
|
4171 |
-
var merge$3 = function (startAddress, gridA, gridB, generator, comparator) {
|
4172 |
-
var result = Fitment.measure(startAddress, gridA, gridB);
|
4173 |
-
return result.map(function (delta) {
|
4174 |
-
var fittedGrid = Fitment.tailor(gridA, delta, generator);
|
4175 |
-
return mergeTables(startAddress, fittedGrid, gridB, generator, comparator);
|
4176 |
-
});
|
4177 |
-
};
|
4178 |
-
var insert = function (index, gridA, gridB, generator, comparator) {
|
4179 |
-
MergingOperations.splitRows(gridA, index, comparator, generator.cell);
|
4180 |
-
var delta = Fitment.measureWidth(gridB, gridA);
|
4181 |
-
var fittedNewGrid = Fitment.tailor(gridB, delta, generator);
|
4182 |
-
var secondDelta = Fitment.measureWidth(gridA, fittedNewGrid);
|
4183 |
-
var fittedOldGrid = Fitment.tailor(gridA, secondDelta, generator);
|
4184 |
-
return fittedOldGrid.slice(0, index).concat(fittedNewGrid).concat(fittedOldGrid.slice(index, fittedOldGrid.length));
|
4185 |
-
};
|
4186 |
-
var TableMerge = {
|
4187 |
-
merge: merge$3,
|
4188 |
-
insert: insert
|
4189 |
-
};
|
4190 |
-
|
4191 |
-
var insertRowAt = function (grid, index, example, comparator, substitution) {
|
4192 |
-
var before = grid.slice(0, index);
|
4193 |
-
var after = grid.slice(index);
|
4194 |
-
var between = GridRow.mapCells(grid[example], function (ex, c) {
|
4195 |
-
var withinSpan = index > 0 && index < grid.length && comparator(GridRow.getCellElement(grid[index - 1], c), GridRow.getCellElement(grid[index], c));
|
4196 |
-
var ret = withinSpan ? GridRow.getCell(grid[index], c) : Structs.elementnew(substitution(ex.element(), comparator), true);
|
4197 |
-
return ret;
|
4198 |
-
});
|
4199 |
-
return before.concat([between]).concat(after);
|
4200 |
-
};
|
4201 |
-
var insertColumnAt = function (grid, index, example, comparator, substitution) {
|
4202 |
-
return map(grid, function (row) {
|
4203 |
-
var withinSpan = index > 0 && index < GridRow.cellLength(row) && comparator(GridRow.getCellElement(row, index - 1), GridRow.getCellElement(row, index));
|
4204 |
-
var sub = withinSpan ? GridRow.getCell(row, index) : Structs.elementnew(substitution(GridRow.getCellElement(row, example), comparator), true);
|
4205 |
-
return GridRow.addCell(row, index, sub);
|
4206 |
-
});
|
4207 |
-
};
|
4208 |
-
var splitCellIntoColumns = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
4209 |
-
var index = exampleCol + 1;
|
4210 |
-
return map(grid, function (row, i) {
|
4211 |
-
var isTargetCell = i === exampleRow;
|
4212 |
-
var sub = isTargetCell ? Structs.elementnew(substitution(GridRow.getCellElement(row, exampleCol), comparator), true) : GridRow.getCell(row, exampleCol);
|
4213 |
-
return GridRow.addCell(row, index, sub);
|
4214 |
-
});
|
4215 |
-
};
|
4216 |
-
var splitCellIntoRows = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
4217 |
-
var index = exampleRow + 1;
|
4218 |
-
var before = grid.slice(0, index);
|
4219 |
-
var after = grid.slice(index);
|
4220 |
-
var between = GridRow.mapCells(grid[exampleRow], function (ex, i) {
|
4221 |
-
var isTargetCell = i === exampleCol;
|
4222 |
-
return isTargetCell ? Structs.elementnew(substitution(ex.element(), comparator), true) : ex;
|
4223 |
-
});
|
4224 |
-
return before.concat([between]).concat(after);
|
4225 |
-
};
|
4226 |
-
var deleteColumnsAt = function (grid, start, finish) {
|
4227 |
-
var rows = map(grid, function (row) {
|
4228 |
-
var cells = row.cells().slice(0, start).concat(row.cells().slice(finish + 1));
|
4229 |
-
return Structs.rowcells(cells, row.section());
|
4230 |
-
});
|
4231 |
-
return filter(rows, function (row) {
|
4232 |
-
return row.cells().length > 0;
|
4233 |
-
});
|
4234 |
-
};
|
4235 |
-
var deleteRowsAt = function (grid, start, finish) {
|
4236 |
-
return grid.slice(0, start).concat(grid.slice(finish + 1));
|
4237 |
-
};
|
4238 |
-
var ModificationOperations = {
|
4239 |
-
insertRowAt: insertRowAt,
|
4240 |
-
insertColumnAt: insertColumnAt,
|
4241 |
-
splitCellIntoColumns: splitCellIntoColumns,
|
4242 |
-
splitCellIntoRows: splitCellIntoRows,
|
4243 |
-
deleteRowsAt: deleteRowsAt,
|
4244 |
-
deleteColumnsAt: deleteColumnsAt
|
4245 |
-
};
|
4246 |
-
|
4247 |
-
var replaceIn = function (grid, targets, comparator, substitution) {
|
4248 |
-
var isTarget = function (cell) {
|
4249 |
-
return exists(targets, function (target) {
|
4250 |
-
return comparator(cell.element(), target.element());
|
4251 |
-
});
|
4252 |
-
};
|
4253 |
-
return map(grid, function (row) {
|
4254 |
-
return GridRow.mapCells(row, function (cell) {
|
4255 |
-
return isTarget(cell) ? Structs.elementnew(substitution(cell.element(), comparator), true) : cell;
|
4256 |
-
});
|
4257 |
-
});
|
4258 |
-
};
|
4259 |
-
var notStartRow = function (grid, rowIndex, colIndex, comparator) {
|
4260 |
-
return GridRow.getCellElement(grid[rowIndex], colIndex) !== undefined && (rowIndex > 0 && comparator(GridRow.getCellElement(grid[rowIndex - 1], colIndex), GridRow.getCellElement(grid[rowIndex], colIndex)));
|
4261 |
-
};
|
4262 |
-
var notStartColumn = function (row, index, comparator) {
|
4263 |
-
return index > 0 && comparator(GridRow.getCellElement(row, index - 1), GridRow.getCellElement(row, index));
|
4264 |
-
};
|
4265 |
-
var replaceColumn = function (grid, index, comparator, substitution) {
|
4266 |
-
var targets = bind(grid, function (row, i) {
|
4267 |
-
var alreadyAdded = notStartRow(grid, i, index, comparator) || notStartColumn(row, index, comparator);
|
4268 |
-
return alreadyAdded ? [] : [GridRow.getCell(row, index)];
|
4269 |
-
});
|
4270 |
-
return replaceIn(grid, targets, comparator, substitution);
|
4271 |
-
};
|
4272 |
-
var replaceRow = function (grid, index, comparator, substitution) {
|
4273 |
-
var targetRow = grid[index];
|
4274 |
-
var targets = bind(targetRow.cells(), function (item, i) {
|
4275 |
-
var alreadyAdded = notStartRow(grid, index, i, comparator) || notStartColumn(targetRow, i, comparator);
|
4276 |
-
return alreadyAdded ? [] : [item];
|
4277 |
-
});
|
4278 |
-
return replaceIn(grid, targets, comparator, substitution);
|
4279 |
-
};
|
4280 |
-
var TransformOperations = {
|
4281 |
-
replaceColumn: replaceColumn,
|
4282 |
-
replaceRow: replaceRow
|
4283 |
-
};
|
4284 |
-
|
4285 |
-
var none$1 = function () {
|
4286 |
-
return folder(function (n, o, l, m, r) {
|
4287 |
-
return n();
|
4288 |
-
});
|
4289 |
-
};
|
4290 |
-
var only = function (index) {
|
4291 |
-
return folder(function (n, o, l, m, r) {
|
4292 |
-
return o(index);
|
4293 |
-
});
|
4294 |
-
};
|
4295 |
-
var left = function (index, next) {
|
4296 |
-
return folder(function (n, o, l, m, r) {
|
4297 |
-
return l(index, next);
|
4298 |
-
});
|
4299 |
-
};
|
4300 |
-
var middle = function (prev, index, next) {
|
4301 |
-
return folder(function (n, o, l, m, r) {
|
4302 |
-
return m(prev, index, next);
|
4303 |
-
});
|
4304 |
-
};
|
4305 |
-
var right = function (prev, index) {
|
4306 |
-
return folder(function (n, o, l, m, r) {
|
4307 |
-
return r(prev, index);
|
4308 |
-
});
|
4309 |
-
};
|
4310 |
-
var folder = function (fold) {
|
4311 |
-
return { fold: fold };
|
4312 |
-
};
|
4313 |
-
var ColumnContext = {
|
4314 |
-
none: none$1,
|
4315 |
-
only: only,
|
4316 |
-
left: left,
|
4317 |
-
middle: middle,
|
4318 |
-
right: right
|
4319 |
-
};
|
4320 |
-
|
4321 |
-
var neighbours$1 = function (input, index) {
|
4322 |
-
if (input.length === 0)
|
4323 |
-
return ColumnContext.none();
|
4324 |
-
if (input.length === 1)
|
4325 |
-
return ColumnContext.only(0);
|
4326 |
-
if (index === 0)
|
4327 |
-
return ColumnContext.left(0, 1);
|
4328 |
-
if (index === input.length - 1)
|
4329 |
-
return ColumnContext.right(index - 1, index);
|
4330 |
-
if (index > 0 && index < input.length - 1)
|
4331 |
-
return ColumnContext.middle(index - 1, index, index + 1);
|
4332 |
-
return ColumnContext.none();
|
4333 |
-
};
|
4334 |
-
var determine = function (input, column, step, tableSize) {
|
4335 |
-
var result = input.slice(0);
|
4336 |
-
var context = neighbours$1(input, column);
|
4337 |
-
var zero = function (array) {
|
4338 |
-
return map(array, constant(0));
|
4339 |
-
};
|
4340 |
-
var onNone = constant(zero(result));
|
4341 |
-
var onOnly = function (index) {
|
4342 |
-
return tableSize.singleColumnWidth(result[index], step);
|
4343 |
-
};
|
4344 |
-
var onChange = function (index, next) {
|
4345 |
-
if (step >= 0) {
|
4346 |
-
var newNext = Math.max(tableSize.minCellWidth(), result[next] - step);
|
4347 |
-
return zero(result.slice(0, index)).concat([
|
4348 |
-
step,
|
4349 |
-
newNext - result[next]
|
4350 |
-
]).concat(zero(result.slice(next + 1)));
|
4351 |
-
} else {
|
4352 |
-
var newThis = Math.max(tableSize.minCellWidth(), result[index] + step);
|
4353 |
-
var diffx = result[index] - newThis;
|
4354 |
-
return zero(result.slice(0, index)).concat([
|
4355 |
-
newThis - result[index],
|
4356 |
-
diffx
|
4357 |
-
]).concat(zero(result.slice(next + 1)));
|
4358 |
-
}
|
4359 |
-
};
|
4360 |
-
var onLeft = onChange;
|
4361 |
-
var onMiddle = function (prev, index, next) {
|
4362 |
-
return onChange(index, next);
|
4363 |
-
};
|
4364 |
-
var onRight = function (prev, index) {
|
4365 |
-
if (step >= 0) {
|
4366 |
-
return zero(result.slice(0, index)).concat([step]);
|
4367 |
-
} else {
|
4368 |
-
var size = Math.max(tableSize.minCellWidth(), result[index] + step);
|
4369 |
-
return zero(result.slice(0, index)).concat([size - result[index]]);
|
4370 |
-
}
|
4371 |
-
};
|
4372 |
-
return context.fold(onNone, onOnly, onLeft, onMiddle, onRight);
|
4373 |
-
};
|
4374 |
-
var Deltas = { determine: determine };
|
4375 |
-
|
4376 |
-
var getSpan$1 = function (cell, type) {
|
4377 |
-
return has$1(cell, type) && parseInt(get$1(cell, type), 10) > 1;
|
4378 |
-
};
|
4379 |
-
var hasColspan = function (cell) {
|
4380 |
-
return getSpan$1(cell, 'colspan');
|
4381 |
-
};
|
4382 |
-
var hasRowspan = function (cell) {
|
4383 |
-
return getSpan$1(cell, 'rowspan');
|
4384 |
-
};
|
4385 |
-
var getInt = function (element, property) {
|
4386 |
-
return parseInt(get$2(element, property), 10);
|
4387 |
-
};
|
4388 |
-
var CellUtils = {
|
4389 |
-
hasColspan: hasColspan,
|
4390 |
-
hasRowspan: hasRowspan,
|
4391 |
-
minWidth: constant(10),
|
4392 |
-
minHeight: constant(10),
|
4393 |
-
getInt: getInt
|
4394 |
-
};
|
4395 |
-
|
4396 |
-
var getRaw$1 = function (cell, property, getter) {
|
4397 |
-
return getRaw(cell, property).fold(function () {
|
4398 |
-
return getter(cell) + 'px';
|
4399 |
-
}, function (raw) {
|
4400 |
-
return raw;
|
4401 |
-
});
|
4402 |
-
};
|
4403 |
-
var getRawW = function (cell) {
|
4404 |
-
return getRaw$1(cell, 'width', Sizes.getPixelWidth);
|
4405 |
-
};
|
4406 |
-
var getRawH = function (cell) {
|
4407 |
-
return getRaw$1(cell, 'height', Sizes.getHeight);
|
4408 |
-
};
|
4409 |
-
var getWidthFrom = function (warehouse, direction, getWidth, fallback, tableSize) {
|
4410 |
-
var columns = Blocks.columns(warehouse);
|
4411 |
-
var backups = map(columns, function (cellOption) {
|
4412 |
-
return cellOption.map(direction.edge);
|
4413 |
-
});
|
4414 |
-
return map(columns, function (cellOption, c) {
|
4415 |
-
var columnCell = cellOption.filter(not(CellUtils.hasColspan));
|
4416 |
-
return columnCell.fold(function () {
|
4417 |
-
var deduced = Util.deduce(backups, c);
|
4418 |
-
return fallback(deduced);
|
4419 |
-
}, function (cell) {
|
4420 |
-
return getWidth(cell, tableSize);
|
4421 |
-
});
|
4422 |
-
});
|
4423 |
-
};
|
4424 |
-
var getDeduced = function (deduced) {
|
4425 |
-
return deduced.map(function (d) {
|
4426 |
-
return d + 'px';
|
4427 |
-
}).getOr('');
|
4428 |
-
};
|
4429 |
-
var getRawWidths = function (warehouse, direction) {
|
4430 |
-
return getWidthFrom(warehouse, direction, getRawW, getDeduced);
|
4431 |
-
};
|
4432 |
-
var getPercentageWidths = function (warehouse, direction, tableSize) {
|
4433 |
-
return getWidthFrom(warehouse, direction, Sizes.getPercentageWidth, function (deduced) {
|
4434 |
-
return deduced.fold(function () {
|
4435 |
-
return tableSize.minCellWidth();
|
4436 |
-
}, function (cellWidth) {
|
4437 |
-
return cellWidth / tableSize.pixelWidth() * 100;
|
4438 |
-
});
|
4439 |
-
}, tableSize);
|
4440 |
-
};
|
4441 |
-
var getPixelWidths = function (warehouse, direction, tableSize) {
|
4442 |
-
return getWidthFrom(warehouse, direction, Sizes.getPixelWidth, function (deduced) {
|
4443 |
-
return deduced.getOrThunk(tableSize.minCellWidth);
|
4444 |
-
}, tableSize);
|
4445 |
-
};
|
4446 |
-
var getHeightFrom = function (warehouse, direction, getHeight, fallback) {
|
4447 |
-
var rows = Blocks.rows(warehouse);
|
4448 |
-
var backups = map(rows, function (cellOption) {
|
4449 |
-
return cellOption.map(direction.edge);
|
4450 |
-
});
|
4451 |
-
return map(rows, function (cellOption, c) {
|
4452 |
-
var rowCell = cellOption.filter(not(CellUtils.hasRowspan));
|
4453 |
-
return rowCell.fold(function () {
|
4454 |
-
var deduced = Util.deduce(backups, c);
|
4455 |
-
return fallback(deduced);
|
4456 |
-
}, function (cell) {
|
4457 |
-
return getHeight(cell);
|
4458 |
-
});
|
4459 |
-
});
|
4460 |
-
};
|
4461 |
-
var getPixelHeights = function (warehouse, direction) {
|
4462 |
-
return getHeightFrom(warehouse, direction, Sizes.getHeight, function (deduced) {
|
4463 |
-
return deduced.getOrThunk(CellUtils.minHeight);
|
4464 |
-
});
|
4465 |
-
};
|
4466 |
-
var getRawHeights = function (warehouse, direction) {
|
4467 |
-
return getHeightFrom(warehouse, direction, getRawH, getDeduced);
|
4468 |
-
};
|
4469 |
-
var ColumnSizes = {
|
4470 |
-
getRawWidths: getRawWidths,
|
4471 |
-
getPixelWidths: getPixelWidths,
|
4472 |
-
getPercentageWidths: getPercentageWidths,
|
4473 |
-
getPixelHeights: getPixelHeights,
|
4474 |
-
getRawHeights: getRawHeights
|
4475 |
-
};
|
4476 |
-
|
4477 |
-
var total = function (start, end, measures) {
|
4478 |
-
var r = 0;
|
4479 |
-
for (var i = start; i < end; i++) {
|
4480 |
-
r += measures[i] !== undefined ? measures[i] : 0;
|
4481 |
-
}
|
4482 |
-
return r;
|
4483 |
-
};
|
4484 |
-
var recalculateWidth = function (warehouse, widths) {
|
4485 |
-
var all = Warehouse.justCells(warehouse);
|
4486 |
-
return map(all, function (cell) {
|
4487 |
-
var width = total(cell.column(), cell.column() + cell.colspan(), widths);
|
4488 |
-
return {
|
4489 |
-
element: cell.element,
|
4490 |
-
width: constant(width),
|
4491 |
-
colspan: cell.colspan
|
4492 |
-
};
|
4493 |
-
});
|
4494 |
-
};
|
4495 |
-
var recalculateHeight = function (warehouse, heights) {
|
4496 |
-
var all = Warehouse.justCells(warehouse);
|
4497 |
-
return map(all, function (cell) {
|
4498 |
-
var height = total(cell.row(), cell.row() + cell.rowspan(), heights);
|
4499 |
-
return {
|
4500 |
-
element: cell.element,
|
4501 |
-
height: constant(height),
|
4502 |
-
rowspan: cell.rowspan
|
4503 |
-
};
|
4504 |
-
});
|
4505 |
-
};
|
4506 |
-
var matchRowHeight = function (warehouse, heights) {
|
4507 |
-
return map(warehouse.all(), function (row, i) {
|
4508 |
-
return {
|
4509 |
-
element: row.element,
|
4510 |
-
height: constant(heights[i])
|
4511 |
-
};
|
4512 |
-
});
|
4513 |
-
};
|
4514 |
-
var Recalculations = {
|
4515 |
-
recalculateWidth: recalculateWidth,
|
4516 |
-
recalculateHeight: recalculateHeight,
|
4517 |
-
matchRowHeight: matchRowHeight
|
4518 |
-
};
|
4519 |
-
|
4520 |
-
var percentageSize = function (width, element) {
|
4521 |
-
var floatWidth = parseFloat(width);
|
4522 |
-
var pixelWidth = get$5(element);
|
4523 |
-
var getCellDelta = function (delta) {
|
4524 |
-
return delta / pixelWidth * 100;
|
4525 |
-
};
|
4526 |
-
var singleColumnWidth = function (width, _delta) {
|
4527 |
-
return [100 - width];
|
4528 |
-
};
|
4529 |
-
var minCellWidth = function () {
|
4530 |
-
return CellUtils.minWidth() / pixelWidth * 100;
|
4531 |
-
};
|
4532 |
-
var setTableWidth = function (table, _newWidths, delta) {
|
4533 |
-
var total = floatWidth + delta;
|
4534 |
-
Sizes.setPercentageWidth(table, total);
|
4535 |
-
};
|
4536 |
-
return {
|
4537 |
-
width: constant(floatWidth),
|
4538 |
-
pixelWidth: constant(pixelWidth),
|
4539 |
-
getWidths: ColumnSizes.getPercentageWidths,
|
4540 |
-
getCellDelta: getCellDelta,
|
4541 |
-
singleColumnWidth: singleColumnWidth,
|
4542 |
-
minCellWidth: minCellWidth,
|
4543 |
-
setElementWidth: Sizes.setPercentageWidth,
|
4544 |
-
setTableWidth: setTableWidth
|
4545 |
-
};
|
4546 |
-
};
|
4547 |
-
var pixelSize = function (width) {
|
4548 |
-
var intWidth = parseInt(width, 10);
|
4549 |
-
var getCellDelta = identity;
|
4550 |
-
var singleColumnWidth = function (width, delta) {
|
4551 |
-
var newNext = Math.max(CellUtils.minWidth(), width + delta);
|
4552 |
-
return [newNext - width];
|
4553 |
-
};
|
4554 |
-
var setTableWidth = function (table, newWidths, _delta) {
|
4555 |
-
var total = foldr(newWidths, function (b, a) {
|
4556 |
-
return b + a;
|
4557 |
-
}, 0);
|
4558 |
-
Sizes.setPixelWidth(table, total);
|
4559 |
-
};
|
4560 |
-
return {
|
4561 |
-
width: constant(intWidth),
|
4562 |
-
pixelWidth: constant(intWidth),
|
4563 |
-
getWidths: ColumnSizes.getPixelWidths,
|
4564 |
-
getCellDelta: getCellDelta,
|
4565 |
-
singleColumnWidth: singleColumnWidth,
|
4566 |
-
minCellWidth: CellUtils.minWidth,
|
4567 |
-
setElementWidth: Sizes.setPixelWidth,
|
4568 |
-
setTableWidth: setTableWidth
|
4569 |
-
};
|
4570 |
-
};
|
4571 |
-
var chooseSize = function (element, width) {
|
4572 |
-
if (Sizes.percentageBasedSizeRegex().test(width)) {
|
4573 |
-
var percentMatch = Sizes.percentageBasedSizeRegex().exec(width);
|
4574 |
-
return percentageSize(percentMatch[1], element);
|
4575 |
-
} else if (Sizes.pixelBasedSizeRegex().test(width)) {
|
4576 |
-
var pixelMatch = Sizes.pixelBasedSizeRegex().exec(width);
|
4577 |
-
return pixelSize(pixelMatch[1]);
|
4578 |
-
} else {
|
4579 |
-
var fallbackWidth = get$5(element);
|
4580 |
-
return pixelSize(fallbackWidth);
|
4581 |
-
}
|
4582 |
-
};
|
4583 |
-
var getTableSize = function (element) {
|
4584 |
-
var width = Sizes.getRawWidth(element);
|
4585 |
-
return width.fold(function () {
|
4586 |
-
var fallbackWidth = get$5(element);
|
4587 |
-
return pixelSize(fallbackWidth);
|
4588 |
-
}, function (width) {
|
4589 |
-
return chooseSize(element, width);
|
4590 |
-
});
|
4591 |
-
};
|
4592 |
-
var TableSize = { getTableSize: getTableSize };
|
4593 |
-
|
4594 |
-
var getWarehouse$1 = function (list) {
|
4595 |
-
return Warehouse.generate(list);
|
4596 |
-
};
|
4597 |
-
var sumUp = function (newSize) {
|
4598 |
-
return foldr(newSize, function (b, a) {
|
4599 |
-
return b + a;
|
4600 |
-
}, 0);
|
4601 |
-
};
|
4602 |
-
var getTableWarehouse = function (table) {
|
4603 |
-
var list = DetailsList.fromTable(table);
|
4604 |
-
return getWarehouse$1(list);
|
4605 |
-
};
|
4606 |
-
var adjustWidth = function (table, delta, index, direction) {
|
4607 |
-
var tableSize = TableSize.getTableSize(table);
|
4608 |
-
var step = tableSize.getCellDelta(delta);
|
4609 |
-
var warehouse = getTableWarehouse(table);
|
4610 |
-
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
4611 |
-
var deltas = Deltas.determine(widths, index, step, tableSize);
|
4612 |
-
var newWidths = map(deltas, function (dx, i) {
|
4613 |
-
return dx + widths[i];
|
4614 |
-
});
|
4615 |
-
var newSizes = Recalculations.recalculateWidth(warehouse, newWidths);
|
4616 |
-
each(newSizes, function (cell) {
|
4617 |
-
tableSize.setElementWidth(cell.element(), cell.width());
|
4618 |
-
});
|
4619 |
-
if (index === warehouse.grid().columns() - 1) {
|
4620 |
-
tableSize.setTableWidth(table, newWidths, step);
|
4621 |
-
}
|
4622 |
-
};
|
4623 |
-
var adjustHeight = function (table, delta, index, direction) {
|
4624 |
-
var warehouse = getTableWarehouse(table);
|
4625 |
-
var heights = ColumnSizes.getPixelHeights(warehouse, direction);
|
4626 |
-
var newHeights = map(heights, function (dy, i) {
|
4627 |
-
return index === i ? Math.max(delta + dy, CellUtils.minHeight()) : dy;
|
4628 |
-
});
|
4629 |
-
var newCellSizes = Recalculations.recalculateHeight(warehouse, newHeights);
|
4630 |
-
var newRowSizes = Recalculations.matchRowHeight(warehouse, newHeights);
|
4631 |
-
each(newRowSizes, function (row) {
|
4632 |
-
Sizes.setHeight(row.element(), row.height());
|
4633 |
-
});
|
4634 |
-
each(newCellSizes, function (cell) {
|
4635 |
-
Sizes.setHeight(cell.element(), cell.height());
|
4636 |
-
});
|
4637 |
-
var total = sumUp(newHeights);
|
4638 |
-
Sizes.setHeight(table, total);
|
4639 |
-
};
|
4640 |
-
var adjustWidthTo = function (table, list, direction) {
|
4641 |
-
var tableSize = TableSize.getTableSize(table);
|
4642 |
-
var warehouse = getWarehouse$1(list);
|
4643 |
-
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
4644 |
-
var newSizes = Recalculations.recalculateWidth(warehouse, widths);
|
4645 |
-
each(newSizes, function (cell) {
|
4646 |
-
tableSize.setElementWidth(cell.element(), cell.width());
|
4647 |
-
});
|
4648 |
-
var total = foldr(widths, function (b, a) {
|
4649 |
-
return a + b;
|
4650 |
-
}, 0);
|
4651 |
-
if (newSizes.length > 0) {
|
4652 |
-
tableSize.setElementWidth(table, total);
|
4653 |
-
}
|
4654 |
-
};
|
4655 |
-
var Adjustments = {
|
4656 |
-
adjustWidth: adjustWidth,
|
4657 |
-
adjustHeight: adjustHeight,
|
4658 |
-
adjustWidthTo: adjustWidthTo
|
4659 |
-
};
|
4660 |
-
|
4661 |
-
var prune = function (table) {
|
4662 |
-
var cells = TableLookup.cells(table);
|
4663 |
-
if (cells.length === 0)
|
4664 |
-
remove$2(table);
|
4665 |
-
};
|
4666 |
-
var outcome = Immutable('grid', 'cursor');
|
4667 |
-
var elementFromGrid = function (grid, row, column) {
|
4668 |
-
return findIn(grid, row, column).orThunk(function () {
|
4669 |
-
return findIn(grid, 0, 0);
|
4670 |
-
});
|
4671 |
-
};
|
4672 |
-
var findIn = function (grid, row, column) {
|
4673 |
-
return Option.from(grid[row]).bind(function (r) {
|
4674 |
-
return Option.from(r.cells()[column]).bind(function (c) {
|
4675 |
-
return Option.from(c.element());
|
4676 |
-
});
|
4677 |
-
});
|
4678 |
-
};
|
4679 |
-
var bundle = function (grid, row, column) {
|
4680 |
-
return outcome(grid, findIn(grid, row, column));
|
4681 |
-
};
|
4682 |
-
var uniqueRows = function (details) {
|
4683 |
-
return foldl(details, function (rest, detail) {
|
4684 |
-
return exists(rest, function (currentDetail) {
|
4685 |
-
return currentDetail.row() === detail.row();
|
4686 |
-
}) ? rest : rest.concat([detail]);
|
4687 |
-
}, []).sort(function (detailA, detailB) {
|
4688 |
-
return detailA.row() - detailB.row();
|
4689 |
-
});
|
4690 |
-
};
|
4691 |
-
var uniqueColumns = function (details) {
|
4692 |
-
return foldl(details, function (rest, detail) {
|
4693 |
-
return exists(rest, function (currentDetail) {
|
4694 |
-
return currentDetail.column() === detail.column();
|
4695 |
-
}) ? rest : rest.concat([detail]);
|
4696 |
-
}, []).sort(function (detailA, detailB) {
|
4697 |
-
return detailA.column() - detailB.column();
|
4698 |
-
});
|
4699 |
-
};
|
4700 |
-
var insertRowBefore = function (grid, detail, comparator, genWrappers) {
|
4701 |
-
var example = detail.row();
|
4702 |
-
var targetIndex = detail.row();
|
4703 |
-
var newGrid = ModificationOperations.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4704 |
-
return bundle(newGrid, targetIndex, detail.column());
|
4705 |
-
};
|
4706 |
-
var insertRowsBefore = function (grid, details, comparator, genWrappers) {
|
4707 |
-
var example = details[0].row();
|
4708 |
-
var targetIndex = details[0].row();
|
4709 |
-
var rows = uniqueRows(details);
|
4710 |
-
var newGrid = foldl(rows, function (newGrid, _row) {
|
4711 |
-
return ModificationOperations.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4712 |
-
}, grid);
|
4713 |
-
return bundle(newGrid, targetIndex, details[0].column());
|
4714 |
-
};
|
4715 |
-
var insertRowAfter = function (grid, detail, comparator, genWrappers) {
|
4716 |
-
var example = detail.row();
|
4717 |
-
var targetIndex = detail.row() + detail.rowspan();
|
4718 |
-
var newGrid = ModificationOperations.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4719 |
-
return bundle(newGrid, targetIndex, detail.column());
|
4720 |
-
};
|
4721 |
-
var insertRowsAfter = function (grid, details, comparator, genWrappers) {
|
4722 |
-
var rows = uniqueRows(details);
|
4723 |
-
var example = rows[rows.length - 1].row();
|
4724 |
-
var targetIndex = rows[rows.length - 1].row() + rows[rows.length - 1].rowspan();
|
4725 |
-
var newGrid = foldl(rows, function (newGrid, _row) {
|
4726 |
-
return ModificationOperations.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4727 |
-
}, grid);
|
4728 |
-
return bundle(newGrid, targetIndex, details[0].column());
|
4729 |
-
};
|
4730 |
-
var insertColumnBefore = function (grid, detail, comparator, genWrappers) {
|
4731 |
-
var example = detail.column();
|
4732 |
-
var targetIndex = detail.column();
|
4733 |
-
var newGrid = ModificationOperations.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4734 |
-
return bundle(newGrid, detail.row(), targetIndex);
|
4735 |
-
};
|
4736 |
-
var insertColumnsBefore = function (grid, details, comparator, genWrappers) {
|
4737 |
-
var columns = uniqueColumns(details);
|
4738 |
-
var example = columns[0].column();
|
4739 |
-
var targetIndex = columns[0].column();
|
4740 |
-
var newGrid = foldl(columns, function (newGrid, _row) {
|
4741 |
-
return ModificationOperations.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4742 |
-
}, grid);
|
4743 |
-
return bundle(newGrid, details[0].row(), targetIndex);
|
4744 |
-
};
|
4745 |
-
var insertColumnAfter = function (grid, detail, comparator, genWrappers) {
|
4746 |
-
var example = detail.column();
|
4747 |
-
var targetIndex = detail.column() + detail.colspan();
|
4748 |
-
var newGrid = ModificationOperations.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4749 |
-
return bundle(newGrid, detail.row(), targetIndex);
|
4750 |
-
};
|
4751 |
-
var insertColumnsAfter = function (grid, details, comparator, genWrappers) {
|
4752 |
-
var example = details[details.length - 1].column();
|
4753 |
-
var targetIndex = details[details.length - 1].column() + details[details.length - 1].colspan();
|
4754 |
-
var columns = uniqueColumns(details);
|
4755 |
-
var newGrid = foldl(columns, function (newGrid, _row) {
|
4756 |
-
return ModificationOperations.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
4757 |
-
}, grid);
|
4758 |
-
return bundle(newGrid, details[0].row(), targetIndex);
|
4759 |
-
};
|
4760 |
-
var makeRowHeader = function (grid, detail, comparator, genWrappers) {
|
4761 |
-
var newGrid = TransformOperations.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
4762 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4763 |
-
};
|
4764 |
-
var makeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
4765 |
-
var newGrid = TransformOperations.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
4766 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4767 |
-
};
|
4768 |
-
var unmakeRowHeader = function (grid, detail, comparator, genWrappers) {
|
4769 |
-
var newGrid = TransformOperations.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
4770 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4771 |
-
};
|
4772 |
-
var unmakeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
4773 |
-
var newGrid = TransformOperations.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
4774 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4775 |
-
};
|
4776 |
-
var splitCellIntoColumns$1 = function (grid, detail, comparator, genWrappers) {
|
4777 |
-
var newGrid = ModificationOperations.splitCellIntoColumns(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
4778 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4779 |
-
};
|
4780 |
-
var splitCellIntoRows$1 = function (grid, detail, comparator, genWrappers) {
|
4781 |
-
var newGrid = ModificationOperations.splitCellIntoRows(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
4782 |
-
return bundle(newGrid, detail.row(), detail.column());
|
4783 |
-
};
|
4784 |
-
var eraseColumns = function (grid, details, comparator, _genWrappers) {
|
4785 |
-
var columns = uniqueColumns(details);
|
4786 |
-
var newGrid = ModificationOperations.deleteColumnsAt(grid, columns[0].column(), columns[columns.length - 1].column());
|
4787 |
-
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
4788 |
-
return outcome(newGrid, cursor);
|
4789 |
-
};
|
4790 |
-
var eraseRows = function (grid, details, comparator, _genWrappers) {
|
4791 |
-
var rows = uniqueRows(details);
|
4792 |
-
var newGrid = ModificationOperations.deleteRowsAt(grid, rows[0].row(), rows[rows.length - 1].row());
|
4793 |
-
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
4794 |
-
return outcome(newGrid, cursor);
|
4795 |
-
};
|
4796 |
-
var mergeCells = function (grid, mergable, comparator, _genWrappers) {
|
4797 |
-
var cells = mergable.cells();
|
4798 |
-
TableContent.merge(cells);
|
4799 |
-
var newGrid = MergingOperations.merge(grid, mergable.bounds(), comparator, constant(cells[0]));
|
4800 |
-
return outcome(newGrid, Option.from(cells[0]));
|
4801 |
-
};
|
4802 |
-
var unmergeCells = function (grid, unmergable, comparator, genWrappers) {
|
4803 |
-
var newGrid = foldr(unmergable, function (b, cell) {
|
4804 |
-
return MergingOperations.unmerge(b, cell, comparator, genWrappers.combine(cell));
|
4805 |
-
}, grid);
|
4806 |
-
return outcome(newGrid, Option.from(unmergable[0]));
|
4807 |
-
};
|
4808 |
-
var pasteCells = function (grid, pasteDetails, comparator, genWrappers) {
|
4809 |
-
var gridify = function (table, generators) {
|
4810 |
-
var list = DetailsList.fromTable(table);
|
4811 |
-
var wh = Warehouse.generate(list);
|
4812 |
-
return Transitions.toGrid(wh, generators, true);
|
4813 |
-
};
|
4814 |
-
var gridB = gridify(pasteDetails.clipboard(), pasteDetails.generators());
|
4815 |
-
var startAddress = Structs.address(pasteDetails.row(), pasteDetails.column());
|
4816 |
-
var mergedGrid = TableMerge.merge(startAddress, grid, gridB, pasteDetails.generators(), comparator);
|
4817 |
-
return mergedGrid.fold(function () {
|
4818 |
-
return outcome(grid, Option.some(pasteDetails.element()));
|
4819 |
-
}, function (nuGrid) {
|
4820 |
-
var cursor = elementFromGrid(nuGrid, pasteDetails.row(), pasteDetails.column());
|
4821 |
-
return outcome(nuGrid, cursor);
|
4822 |
-
});
|
4823 |
-
};
|
4824 |
-
var gridifyRows = function (rows, generators, example) {
|
4825 |
-
var pasteDetails = DetailsList.fromPastedRows(rows, example);
|
4826 |
-
var wh = Warehouse.generate(pasteDetails);
|
4827 |
-
return Transitions.toGrid(wh, generators, true);
|
4828 |
-
};
|
4829 |
-
var pasteRowsBefore = function (grid, pasteDetails, comparator, genWrappers) {
|
4830 |
-
var example = grid[pasteDetails.cells[0].row()];
|
4831 |
-
var index = pasteDetails.cells[0].row();
|
4832 |
-
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
4833 |
-
var mergedGrid = TableMerge.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
4834 |
-
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
4835 |
-
return outcome(mergedGrid, cursor);
|
4836 |
-
};
|
4837 |
-
var pasteRowsAfter = function (grid, pasteDetails, comparator, genWrappers) {
|
4838 |
-
var example = grid[pasteDetails.cells[0].row()];
|
4839 |
-
var index = pasteDetails.cells[pasteDetails.cells.length - 1].row() + pasteDetails.cells[pasteDetails.cells.length - 1].rowspan();
|
4840 |
-
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
4841 |
-
var mergedGrid = TableMerge.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
4842 |
-
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
4843 |
-
return outcome(mergedGrid, cursor);
|
4844 |
-
};
|
4845 |
-
var resize = Adjustments.adjustWidthTo;
|
4846 |
-
var TableOperations = {
|
4847 |
-
insertRowBefore: RunOperation.run(insertRowBefore, RunOperation.onCell, noop, noop, Generators.modification),
|
4848 |
-
insertRowsBefore: RunOperation.run(insertRowsBefore, RunOperation.onCells, noop, noop, Generators.modification),
|
4849 |
-
insertRowAfter: RunOperation.run(insertRowAfter, RunOperation.onCell, noop, noop, Generators.modification),
|
4850 |
-
insertRowsAfter: RunOperation.run(insertRowsAfter, RunOperation.onCells, noop, noop, Generators.modification),
|
4851 |
-
insertColumnBefore: RunOperation.run(insertColumnBefore, RunOperation.onCell, resize, noop, Generators.modification),
|
4852 |
-
insertColumnsBefore: RunOperation.run(insertColumnsBefore, RunOperation.onCells, resize, noop, Generators.modification),
|
4853 |
-
insertColumnAfter: RunOperation.run(insertColumnAfter, RunOperation.onCell, resize, noop, Generators.modification),
|
4854 |
-
insertColumnsAfter: RunOperation.run(insertColumnsAfter, RunOperation.onCells, resize, noop, Generators.modification),
|
4855 |
-
splitCellIntoColumns: RunOperation.run(splitCellIntoColumns$1, RunOperation.onCell, noop, noop, Generators.modification),
|
4856 |
-
splitCellIntoRows: RunOperation.run(splitCellIntoRows$1, RunOperation.onCell, noop, noop, Generators.modification),
|
4857 |
-
eraseColumns: RunOperation.run(eraseColumns, RunOperation.onCells, resize, prune, Generators.modification),
|
4858 |
-
eraseRows: RunOperation.run(eraseRows, RunOperation.onCells, noop, prune, Generators.modification),
|
4859 |
-
makeColumnHeader: RunOperation.run(makeColumnHeader, RunOperation.onCell, noop, noop, Generators.transform('row', 'th')),
|
4860 |
-
unmakeColumnHeader: RunOperation.run(unmakeColumnHeader, RunOperation.onCell, noop, noop, Generators.transform(null, 'td')),
|
4861 |
-
makeRowHeader: RunOperation.run(makeRowHeader, RunOperation.onCell, noop, noop, Generators.transform('col', 'th')),
|
4862 |
-
unmakeRowHeader: RunOperation.run(unmakeRowHeader, RunOperation.onCell, noop, noop, Generators.transform(null, 'td')),
|
4863 |
-
mergeCells: RunOperation.run(mergeCells, RunOperation.onMergable, noop, noop, Generators.merging),
|
4864 |
-
unmergeCells: RunOperation.run(unmergeCells, RunOperation.onUnmergable, noop, noop, Generators.merging),
|
4865 |
-
pasteCells: RunOperation.run(pasteCells, RunOperation.onPaste, resize, noop, Generators.modification),
|
4866 |
-
pasteRowsBefore: RunOperation.run(pasteRowsBefore, RunOperation.onPasteRows, noop, noop, Generators.modification),
|
4867 |
-
pasteRowsAfter: RunOperation.run(pasteRowsAfter, RunOperation.onPasteRows, noop, noop, Generators.modification)
|
4868 |
-
};
|
4869 |
-
|
4870 |
-
var getBody$1 = function (editor) {
|
4871 |
-
return Element$$1.fromDom(editor.getBody());
|
4872 |
-
};
|
4873 |
-
var getPixelWidth$1 = function (elm) {
|
4874 |
-
return elm.getBoundingClientRect().width;
|
4875 |
-
};
|
4876 |
-
var getPixelHeight = function (elm) {
|
4877 |
-
return elm.getBoundingClientRect().height;
|
4878 |
-
};
|
4879 |
-
var getIsRoot = function (editor) {
|
4880 |
-
return function (element) {
|
4881 |
-
return eq(element, getBody$1(editor));
|
4882 |
-
};
|
4883 |
-
};
|
4884 |
-
var removePxSuffix = function (size) {
|
4885 |
-
return size ? size.replace(/px$/, '') : '';
|
4886 |
-
};
|
4887 |
-
var addSizeSuffix = function (size) {
|
4888 |
-
if (/^[0-9]+$/.test(size)) {
|
4889 |
-
size += 'px';
|
4890 |
-
}
|
4891 |
-
return size;
|
4892 |
-
};
|
4893 |
-
var removeDataStyle = function (table) {
|
4894 |
-
var dataStyleCells = descendants$1(table, 'td[data-mce-style],th[data-mce-style]');
|
4895 |
-
remove(table, 'data-mce-style');
|
4896 |
-
each(dataStyleCells, function (cell) {
|
4897 |
-
remove(cell, 'data-mce-style');
|
4898 |
-
});
|
4899 |
-
};
|
4900 |
-
|
4901 |
-
var getDirection = function (element) {
|
4902 |
-
return get$2(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
|
4903 |
-
};
|
4904 |
-
|
4905 |
-
var ltr$1 = { isRtl: constant(false) };
|
4906 |
-
var rtl$1 = { isRtl: constant(true) };
|
4907 |
-
var directionAt = function (element) {
|
4908 |
-
var dir = getDirection(element);
|
4909 |
-
return dir === 'rtl' ? rtl$1 : ltr$1;
|
4910 |
-
};
|
4911 |
-
var Direction = { directionAt: directionAt };
|
4912 |
-
|
4913 |
-
var defaultTableToolbar = [
|
4914 |
-
'tableprops',
|
4915 |
-
'tabledelete',
|
4916 |
-
'|',
|
4917 |
-
'tableinsertrowbefore',
|
4918 |
-
'tableinsertrowafter',
|
4919 |
-
'tabledeleterow',
|
4920 |
-
'|',
|
4921 |
-
'tableinsertcolbefore',
|
4922 |
-
'tableinsertcolafter',
|
4923 |
-
'tabledeletecol'
|
4924 |
-
];
|
4925 |
-
var defaultStyles = {
|
4926 |
-
'border-collapse': 'collapse',
|
4927 |
-
'width': '100%'
|
4928 |
-
};
|
4929 |
-
var defaultAttributes = { border: '1' };
|
4930 |
-
var getDefaultAttributes = function (editor) {
|
4931 |
-
return editor.getParam('table_default_attributes', defaultAttributes, 'object');
|
4932 |
-
};
|
4933 |
-
var getDefaultStyles = function (editor) {
|
4934 |
-
return editor.getParam('table_default_styles', defaultStyles, 'object');
|
4935 |
-
};
|
4936 |
-
var hasTableResizeBars = function (editor) {
|
4937 |
-
return editor.getParam('table_resize_bars', true, 'boolean');
|
4938 |
-
};
|
4939 |
-
var hasTabNavigation = function (editor) {
|
4940 |
-
return editor.getParam('table_tab_navigation', true, 'boolean');
|
4941 |
-
};
|
4942 |
-
var hasAdvancedCellTab = function (editor) {
|
4943 |
-
return editor.getParam('table_cell_advtab', true, 'boolean');
|
4944 |
-
};
|
4945 |
-
var hasAdvancedRowTab = function (editor) {
|
4946 |
-
return editor.getParam('table_row_advtab', true, 'boolean');
|
4947 |
-
};
|
4948 |
-
var hasAdvancedTableTab = function (editor) {
|
4949 |
-
return editor.getParam('table_advtab', true, 'boolean');
|
4950 |
-
};
|
4951 |
-
var hasAppearanceOptions = function (editor) {
|
4952 |
-
return editor.getParam('table_appearance_options', true, 'boolean');
|
4953 |
-
};
|
4954 |
-
var hasTableGrid = function (editor) {
|
4955 |
-
return editor.getParam('table_grid', true, 'boolean');
|
4956 |
-
};
|
4957 |
-
var shouldStyleWithCss = function (editor) {
|
4958 |
-
return editor.getParam('table_style_by_css', false, 'boolean');
|
4959 |
-
};
|
4960 |
-
var getCellClassList = function (editor) {
|
4961 |
-
return editor.getParam('table_cell_class_list', [], 'array');
|
4962 |
-
};
|
4963 |
-
var getRowClassList = function (editor) {
|
4964 |
-
return editor.getParam('table_row_class_list', [], 'array');
|
4965 |
-
};
|
4966 |
-
var getTableClassList = function (editor) {
|
4967 |
-
return editor.getParam('table_class_list', [], 'array');
|
4968 |
-
};
|
4969 |
-
var getColorPickerCallback = function (editor) {
|
4970 |
-
return editor.getParam('color_picker_callback');
|
4971 |
-
};
|
4972 |
-
var isPixelsForced = function (editor) {
|
4973 |
-
return editor.getParam('table_responsive_width') === false;
|
4974 |
-
};
|
4975 |
-
var getCloneElements = function (editor) {
|
4976 |
-
var cloneElements = editor.getParam('table_clone_elements');
|
4977 |
-
if (isString(cloneElements)) {
|
4978 |
-
return Option.some(cloneElements.split(/[ ,]/));
|
4979 |
-
} else if (Array.isArray(cloneElements)) {
|
4980 |
-
return Option.some(cloneElements);
|
4981 |
-
} else {
|
4982 |
-
return Option.none();
|
4983 |
-
}
|
4984 |
-
};
|
4985 |
-
var hasObjectResizing = function (editor) {
|
4986 |
-
var objectResizing = editor.getParam('object_resizing', true);
|
4987 |
-
return objectResizing === 'table' || objectResizing;
|
4988 |
-
};
|
4989 |
-
var getToolbar = function (editor) {
|
4990 |
-
var toolbar = editor.getParam('table_toolbar', defaultTableToolbar);
|
4991 |
-
if (toolbar === '' || toolbar === false) {
|
4992 |
-
return [];
|
4993 |
-
} else if (isString(toolbar)) {
|
4994 |
-
return toolbar.split(/[ ,]/);
|
4995 |
-
} else if (isArray(toolbar)) {
|
4996 |
-
return toolbar;
|
4997 |
-
} else {
|
4998 |
-
return [];
|
4999 |
-
}
|
5000 |
-
};
|
5001 |
-
|
5002 |
-
var fireNewRow = function (editor, row) {
|
5003 |
-
return editor.fire('newrow', { node: row });
|
5004 |
-
};
|
5005 |
-
var fireNewCell = function (editor, cell) {
|
5006 |
-
return editor.fire('newcell', { node: cell });
|
5007 |
-
};
|
5008 |
-
var fireObjectResizeStart = function (editor, target, width, height) {
|
5009 |
-
editor.fire('ObjectResizeStart', {
|
5010 |
-
target: target,
|
5011 |
-
width: width,
|
5012 |
-
height: height
|
5013 |
-
});
|
5014 |
-
};
|
5015 |
-
var fireObjectResized = function (editor, target, width, height) {
|
5016 |
-
editor.fire('ObjectResized', {
|
5017 |
-
target: target,
|
5018 |
-
width: width,
|
5019 |
-
height: height
|
5020 |
-
});
|
5021 |
-
};
|
5022 |
-
|
5023 |
-
var TableActions = function (editor, lazyWire) {
|
5024 |
-
var isTableBody = function (editor) {
|
5025 |
-
return name(getBody$1(editor)) === 'table';
|
5026 |
-
};
|
5027 |
-
var lastRowGuard = function (table) {
|
5028 |
-
var size = TableGridSize.getGridSize(table);
|
5029 |
-
return isTableBody(editor) === false || size.rows() > 1;
|
5030 |
-
};
|
5031 |
-
var lastColumnGuard = function (table) {
|
5032 |
-
var size = TableGridSize.getGridSize(table);
|
5033 |
-
return isTableBody(editor) === false || size.columns() > 1;
|
5034 |
-
};
|
5035 |
-
var cloneFormats = getCloneElements(editor);
|
5036 |
-
var execute = function (operation, guard, mutate, lazyWire) {
|
5037 |
-
return function (table, target) {
|
5038 |
-
removeDataStyle(table);
|
5039 |
-
var wire = lazyWire();
|
5040 |
-
var doc = Element$$1.fromDom(editor.getDoc());
|
5041 |
-
var direction = TableDirection(Direction.directionAt);
|
5042 |
-
var generators = TableFill.cellOperations(mutate, doc, cloneFormats);
|
5043 |
-
return guard(table) ? operation(wire, table, target, generators, direction).bind(function (result) {
|
5044 |
-
each(result.newRows(), function (row) {
|
5045 |
-
fireNewRow(editor, row.dom());
|
5046 |
-
});
|
5047 |
-
each(result.newCells(), function (cell) {
|
5048 |
-
fireNewCell(editor, cell.dom());
|
5049 |
-
});
|
5050 |
-
return result.cursor().map(function (cell) {
|
5051 |
-
var rng = editor.dom.createRng();
|
5052 |
-
rng.setStart(cell.dom(), 0);
|
5053 |
-
rng.setEnd(cell.dom(), 0);
|
5054 |
-
return rng;
|
5055 |
-
});
|
5056 |
-
}) : Option.none();
|
5057 |
-
};
|
5058 |
-
};
|
5059 |
-
var deleteRow = execute(TableOperations.eraseRows, lastRowGuard, noop, lazyWire);
|
5060 |
-
var deleteColumn = execute(TableOperations.eraseColumns, lastColumnGuard, noop, lazyWire);
|
5061 |
-
var insertRowsBefore = execute(TableOperations.insertRowsBefore, always, noop, lazyWire);
|
5062 |
-
var insertRowsAfter = execute(TableOperations.insertRowsAfter, always, noop, lazyWire);
|
5063 |
-
var insertColumnsBefore = execute(TableOperations.insertColumnsBefore, always, CellMutations.halve, lazyWire);
|
5064 |
-
var insertColumnsAfter = execute(TableOperations.insertColumnsAfter, always, CellMutations.halve, lazyWire);
|
5065 |
-
var mergeCells = execute(TableOperations.mergeCells, always, noop, lazyWire);
|
5066 |
-
var unmergeCells = execute(TableOperations.unmergeCells, always, noop, lazyWire);
|
5067 |
-
var pasteRowsBefore = execute(TableOperations.pasteRowsBefore, always, noop, lazyWire);
|
5068 |
-
var pasteRowsAfter = execute(TableOperations.pasteRowsAfter, always, noop, lazyWire);
|
5069 |
-
var pasteCells = execute(TableOperations.pasteCells, always, noop, lazyWire);
|
5070 |
-
return {
|
5071 |
-
deleteRow: deleteRow,
|
5072 |
-
deleteColumn: deleteColumn,
|
5073 |
-
insertRowsBefore: insertRowsBefore,
|
5074 |
-
insertRowsAfter: insertRowsAfter,
|
5075 |
-
insertColumnsBefore: insertColumnsBefore,
|
5076 |
-
insertColumnsAfter: insertColumnsAfter,
|
5077 |
-
mergeCells: mergeCells,
|
5078 |
-
unmergeCells: unmergeCells,
|
5079 |
-
pasteRowsBefore: pasteRowsBefore,
|
5080 |
-
pasteRowsAfter: pasteRowsAfter,
|
5081 |
-
pasteCells: pasteCells
|
5082 |
-
};
|
5083 |
-
};
|
5084 |
-
|
5085 |
-
var copyRows = function (table, target, generators) {
|
5086 |
-
var list = DetailsList.fromTable(table);
|
5087 |
-
var house = Warehouse.generate(list);
|
5088 |
-
var details = RunOperation.onCells(house, target);
|
5089 |
-
return details.map(function (selectedCells) {
|
5090 |
-
var grid = Transitions.toGrid(house, generators, false);
|
5091 |
-
var slicedGrid = grid.slice(selectedCells[0].row(), selectedCells[selectedCells.length - 1].row() + selectedCells[selectedCells.length - 1].rowspan());
|
5092 |
-
var slicedDetails = RunOperation.toDetailList(slicedGrid, generators);
|
5093 |
-
return Redraw.copy(slicedDetails);
|
5094 |
-
});
|
5095 |
-
};
|
5096 |
-
var CopyRows = { copyRows: copyRows };
|
5097 |
-
|
5098 |
-
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
5099 |
-
|
5100 |
-
var getTDTHOverallStyle = function (dom, elm, name) {
|
5101 |
-
var cells = dom.select('td,th', elm);
|
5102 |
-
var firstChildStyle;
|
5103 |
-
var checkChildren = function (firstChildStyle, elms) {
|
5104 |
-
for (var i = 0; i < elms.length; i++) {
|
5105 |
-
var currentStyle = dom.getStyle(elms[i], name);
|
5106 |
-
if (typeof firstChildStyle === 'undefined') {
|
5107 |
-
firstChildStyle = currentStyle;
|
5108 |
-
}
|
5109 |
-
if (firstChildStyle !== currentStyle) {
|
5110 |
-
return '';
|
5111 |
-
}
|
5112 |
-
}
|
5113 |
-
return firstChildStyle;
|
5114 |
-
};
|
5115 |
-
firstChildStyle = checkChildren(firstChildStyle, cells);
|
5116 |
-
return firstChildStyle;
|
5117 |
-
};
|
5118 |
-
var applyAlign = function (editor, elm, name) {
|
5119 |
-
if (name) {
|
5120 |
-
editor.formatter.apply('align' + name, {}, elm);
|
5121 |
-
}
|
5122 |
-
};
|
5123 |
-
var applyVAlign = function (editor, elm, name) {
|
5124 |
-
if (name) {
|
5125 |
-
editor.formatter.apply('valign' + name, {}, elm);
|
5126 |
-
}
|
5127 |
-
};
|
5128 |
-
var unApplyAlign = function (editor, elm) {
|
5129 |
-
global$1.each('left center right'.split(' '), function (name) {
|
5130 |
-
editor.formatter.remove('align' + name, {}, elm);
|
5131 |
-
});
|
5132 |
-
};
|
5133 |
-
var unApplyVAlign = function (editor, elm) {
|
5134 |
-
global$1.each('top middle bottom'.split(' '), function (name) {
|
5135 |
-
editor.formatter.remove('valign' + name, {}, elm);
|
5136 |
-
});
|
5137 |
-
};
|
5138 |
-
var Styles$1 = {
|
5139 |
-
applyAlign: applyAlign,
|
5140 |
-
applyVAlign: applyVAlign,
|
5141 |
-
unApplyAlign: unApplyAlign,
|
5142 |
-
unApplyVAlign: unApplyVAlign,
|
5143 |
-
getTDTHOverallStyle: getTDTHOverallStyle
|
5144 |
-
};
|
5145 |
-
|
5146 |
-
var buildListItems = function (inputList, itemCallback, startItems) {
|
5147 |
-
var appendItems = function (values, output) {
|
5148 |
-
output = output || [];
|
5149 |
-
global$1.each(values, function (item) {
|
5150 |
-
var menuItem = { text: item.text || item.title };
|
5151 |
-
if (item.menu) {
|
5152 |
-
menuItem.menu = appendItems(item.menu);
|
5153 |
-
} else {
|
5154 |
-
menuItem.value = item.value;
|
5155 |
-
if (itemCallback) {
|
5156 |
-
itemCallback(menuItem);
|
5157 |
-
}
|
5158 |
-
}
|
5159 |
-
output.push(menuItem);
|
5160 |
-
});
|
5161 |
-
return output;
|
5162 |
-
};
|
5163 |
-
return appendItems(inputList, startItems || []);
|
5164 |
-
};
|
5165 |
-
function styleFieldHasFocus(e) {
|
5166 |
-
return e.control.rootControl.find('#style')[0].getEl().isEqualNode(document.activeElement);
|
5167 |
-
}
|
5168 |
-
var syncAdvancedStyleFields = function (editor, evt) {
|
5169 |
-
if (styleFieldHasFocus(evt)) {
|
5170 |
-
updateAdvancedFields(editor, evt);
|
5171 |
-
} else {
|
5172 |
-
updateStyleField(editor, evt);
|
5173 |
-
}
|
5174 |
-
};
|
5175 |
-
var updateStyleField = function (editor, evt) {
|
5176 |
-
var dom = editor.dom;
|
5177 |
-
var rootControl = evt.control.rootControl;
|
5178 |
-
var data = rootControl.toJSON();
|
5179 |
-
var css = dom.parseStyle(data.style);
|
5180 |
-
css['border-style'] = data.borderStyle;
|
5181 |
-
css['border-color'] = data.borderColor;
|
5182 |
-
css['background-color'] = data.backgroundColor;
|
5183 |
-
css.width = data.width ? addSizeSuffix(data.width) : '';
|
5184 |
-
css.height = data.height ? addSizeSuffix(data.height) : '';
|
5185 |
-
rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
5186 |
-
};
|
5187 |
-
var updateAdvancedFields = function (editor, evt) {
|
5188 |
-
var dom = editor.dom;
|
5189 |
-
var rootControl = evt.control.rootControl;
|
5190 |
-
var data = rootControl.toJSON();
|
5191 |
-
var css = dom.parseStyle(data.style);
|
5192 |
-
rootControl.find('#borderStyle').value(css['border-style'] || '');
|
5193 |
-
rootControl.find('#borderColor').value(css['border-color'] || '');
|
5194 |
-
rootControl.find('#backgroundColor').value(css['background-color'] || '');
|
5195 |
-
rootControl.find('#width').value(css.width || '');
|
5196 |
-
rootControl.find('#height').value(css.height || '');
|
5197 |
-
};
|
5198 |
-
var extractAdvancedStyles = function (dom, elm) {
|
5199 |
-
var css = dom.parseStyle(dom.getAttrib(elm, 'style'));
|
5200 |
-
var data = {};
|
5201 |
-
if (css['border-style']) {
|
5202 |
-
data.borderStyle = css['border-style'];
|
5203 |
-
}
|
5204 |
-
if (css['border-color']) {
|
5205 |
-
data.borderColor = css['border-color'];
|
5206 |
-
}
|
5207 |
-
if (css['background-color']) {
|
5208 |
-
data.backgroundColor = css['background-color'];
|
5209 |
-
}
|
5210 |
-
data.style = dom.serializeStyle(css);
|
5211 |
-
return data;
|
5212 |
-
};
|
5213 |
-
var createStyleForm = function (editor) {
|
5214 |
-
var createColorPickAction = function () {
|
5215 |
-
var colorPickerCallback = getColorPickerCallback(editor);
|
5216 |
-
if (colorPickerCallback) {
|
5217 |
-
return function (evt) {
|
5218 |
-
return colorPickerCallback.call(editor, function (value) {
|
5219 |
-
evt.control.value(value).fire('change');
|
5220 |
-
}, evt.control.value());
|
5221 |
-
};
|
5222 |
-
}
|
5223 |
-
};
|
5224 |
-
return {
|
5225 |
-
title: 'Advanced',
|
5226 |
-
type: 'form',
|
5227 |
-
defaults: { onchange: curry(updateStyleField, editor) },
|
5228 |
-
items: [
|
5229 |
-
{
|
5230 |
-
label: 'Style',
|
5231 |
-
name: 'style',
|
5232 |
-
type: 'textbox',
|
5233 |
-
onchange: curry(updateAdvancedFields, editor)
|
5234 |
-
},
|
5235 |
-
{
|
5236 |
-
type: 'form',
|
5237 |
-
padding: 0,
|
5238 |
-
formItemDefaults: {
|
5239 |
-
layout: 'grid',
|
5240 |
-
alignH: [
|
5241 |
-
'start',
|
5242 |
-
'right'
|
5243 |
-
]
|
5244 |
-
},
|
5245 |
-
defaults: { size: 7 },
|
5246 |
-
items: [
|
5247 |
-
{
|
5248 |
-
label: 'Border style',
|
5249 |
-
type: 'listbox',
|
5250 |
-
name: 'borderStyle',
|
5251 |
-
width: 90,
|
5252 |
-
onselect: curry(updateStyleField, editor),
|
5253 |
-
values: [
|
5254 |
-
{
|
5255 |
-
text: 'Select...',
|
5256 |
-
value: ''
|
5257 |
-
},
|
5258 |
-
{
|
5259 |
-
text: 'Solid',
|
5260 |
-
value: 'solid'
|
5261 |
-
},
|
5262 |
-
{
|
5263 |
-
text: 'Dotted',
|
5264 |
-
value: 'dotted'
|
5265 |
-
},
|
5266 |
-
{
|
5267 |
-
text: 'Dashed',
|
5268 |
-
value: 'dashed'
|
5269 |
-
},
|
5270 |
-
{
|
5271 |
-
text: 'Double',
|
5272 |
-
value: 'double'
|
5273 |
-
},
|
5274 |
-
{
|
5275 |
-
text: 'Groove',
|
5276 |
-
value: 'groove'
|
5277 |
-
},
|
5278 |
-
{
|
5279 |
-
text: 'Ridge',
|
5280 |
-
value: 'ridge'
|
5281 |
-
},
|
5282 |
-
{
|
5283 |
-
text: 'Inset',
|
5284 |
-
value: 'inset'
|
5285 |
-
},
|
5286 |
-
{
|
5287 |
-
text: 'Outset',
|
5288 |
-
value: 'outset'
|
5289 |
-
},
|
5290 |
-
{
|
5291 |
-
text: 'None',
|
5292 |
-
value: 'none'
|
5293 |
-
},
|
5294 |
-
{
|
5295 |
-
text: 'Hidden',
|
5296 |
-
value: 'hidden'
|
5297 |
-
}
|
5298 |
-
]
|
5299 |
-
},
|
5300 |
-
{
|
5301 |
-
label: 'Border color',
|
5302 |
-
type: 'colorbox',
|
5303 |
-
name: 'borderColor',
|
5304 |
-
onaction: createColorPickAction()
|
5305 |
-
},
|
5306 |
-
{
|
5307 |
-
label: 'Background color',
|
5308 |
-
type: 'colorbox',
|
5309 |
-
name: 'backgroundColor',
|
5310 |
-
onaction: createColorPickAction()
|
5311 |
-
}
|
5312 |
-
]
|
5313 |
-
}
|
5314 |
-
]
|
5315 |
-
};
|
5316 |
-
};
|
5317 |
-
var Helpers = {
|
5318 |
-
createStyleForm: createStyleForm,
|
5319 |
-
buildListItems: buildListItems,
|
5320 |
-
updateStyleField: updateStyleField,
|
5321 |
-
extractAdvancedStyles: extractAdvancedStyles,
|
5322 |
-
updateAdvancedFields: updateAdvancedFields,
|
5323 |
-
syncAdvancedStyleFields: syncAdvancedStyleFields
|
5324 |
-
};
|
5325 |
-
|
5326 |
-
var updateStyles = function (elm, cssText) {
|
5327 |
-
delete elm.dataset.mceStyle;
|
5328 |
-
elm.style.cssText += ';' + cssText;
|
5329 |
-
};
|
5330 |
-
var extractDataFromElement = function (editor, elm) {
|
5331 |
-
var dom = editor.dom;
|
5332 |
-
var data = {
|
5333 |
-
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
|
5334 |
-
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
5335 |
-
scope: dom.getAttrib(elm, 'scope'),
|
5336 |
-
class: dom.getAttrib(elm, 'class'),
|
5337 |
-
type: elm.nodeName.toLowerCase(),
|
5338 |
-
style: '',
|
5339 |
-
align: '',
|
5340 |
-
valign: ''
|
5341 |
-
};
|
5342 |
-
global$1.each('left center right'.split(' '), function (name) {
|
5343 |
-
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
5344 |
-
data.align = name;
|
5345 |
-
}
|
5346 |
-
});
|
5347 |
-
global$1.each('top middle bottom'.split(' '), function (name) {
|
5348 |
-
if (editor.formatter.matchNode(elm, 'valign' + name)) {
|
5349 |
-
data.valign = name;
|
5350 |
-
}
|
5351 |
-
});
|
5352 |
-
if (hasAdvancedCellTab(editor)) {
|
5353 |
-
global$1.extend(data, Helpers.extractAdvancedStyles(dom, elm));
|
5354 |
-
}
|
5355 |
-
return data;
|
5356 |
-
};
|
5357 |
-
var onSubmitCellForm = function (editor, cells, evt) {
|
5358 |
-
var dom = editor.dom;
|
5359 |
-
var data;
|
5360 |
-
function setAttrib(elm, name, value) {
|
5361 |
-
if (cells.length === 1 || value) {
|
5362 |
-
dom.setAttrib(elm, name, value);
|
5363 |
-
}
|
5364 |
-
}
|
5365 |
-
function setStyle(elm, name, value) {
|
5366 |
-
if (cells.length === 1 || value) {
|
5367 |
-
dom.setStyle(elm, name, value);
|
5368 |
-
}
|
5369 |
-
}
|
5370 |
-
if (hasAdvancedCellTab(editor)) {
|
5371 |
-
Helpers.syncAdvancedStyleFields(editor, evt);
|
5372 |
-
}
|
5373 |
-
data = evt.control.rootControl.toJSON();
|
5374 |
-
editor.undoManager.transact(function () {
|
5375 |
-
global$1.each(cells, function (cellElm) {
|
5376 |
-
setAttrib(cellElm, 'scope', data.scope);
|
5377 |
-
if (cells.length === 1) {
|
5378 |
-
setAttrib(cellElm, 'style', data.style);
|
5379 |
-
} else {
|
5380 |
-
updateStyles(cellElm, data.style);
|
5381 |
-
}
|
5382 |
-
setAttrib(cellElm, 'class', data.class);
|
5383 |
-
setStyle(cellElm, 'width', addSizeSuffix(data.width));
|
5384 |
-
setStyle(cellElm, 'height', addSizeSuffix(data.height));
|
5385 |
-
if (data.type && cellElm.nodeName.toLowerCase() !== data.type) {
|
5386 |
-
cellElm = dom.rename(cellElm, data.type);
|
5387 |
-
}
|
5388 |
-
if (cells.length === 1) {
|
5389 |
-
Styles$1.unApplyAlign(editor, cellElm);
|
5390 |
-
Styles$1.unApplyVAlign(editor, cellElm);
|
5391 |
-
}
|
5392 |
-
if (data.align) {
|
5393 |
-
Styles$1.applyAlign(editor, cellElm, data.align);
|
5394 |
-
}
|
5395 |
-
if (data.valign) {
|
5396 |
-
Styles$1.applyVAlign(editor, cellElm, data.valign);
|
5397 |
-
}
|
5398 |
-
});
|
5399 |
-
editor.focus();
|
5400 |
-
});
|
5401 |
-
};
|
5402 |
-
var open = function (editor) {
|
5403 |
-
var cellElm, data, classListCtrl, cells = [];
|
5404 |
-
cells = editor.dom.select('td[data-mce-selected],th[data-mce-selected]');
|
5405 |
-
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
5406 |
-
if (!cells.length && cellElm) {
|
5407 |
-
cells.push(cellElm);
|
5408 |
-
}
|
5409 |
-
cellElm = cellElm || cells[0];
|
5410 |
-
if (!cellElm) {
|
5411 |
-
return;
|
5412 |
-
}
|
5413 |
-
if (cells.length > 1) {
|
5414 |
-
data = {
|
5415 |
-
width: '',
|
5416 |
-
height: '',
|
5417 |
-
scope: '',
|
5418 |
-
class: '',
|
5419 |
-
align: '',
|
5420 |
-
valign: '',
|
5421 |
-
style: '',
|
5422 |
-
type: cellElm.nodeName.toLowerCase()
|
5423 |
-
};
|
5424 |
-
} else {
|
5425 |
-
data = extractDataFromElement(editor, cellElm);
|
5426 |
-
}
|
5427 |
-
if (getCellClassList(editor).length > 0) {
|
5428 |
-
classListCtrl = {
|
5429 |
-
name: 'class',
|
5430 |
-
type: 'listbox',
|
5431 |
-
label: 'Class',
|
5432 |
-
values: Helpers.buildListItems(getCellClassList(editor), function (item) {
|
5433 |
-
if (item.value) {
|
5434 |
-
item.textStyle = function () {
|
5435 |
-
return editor.formatter.getCssText({
|
5436 |
-
block: 'td',
|
5437 |
-
classes: [item.value]
|
5438 |
-
});
|
5439 |
-
};
|
5440 |
-
}
|
5441 |
-
})
|
5442 |
-
};
|
5443 |
-
}
|
5444 |
-
var generalCellForm = {
|
5445 |
-
type: 'form',
|
5446 |
-
layout: 'flex',
|
5447 |
-
direction: 'column',
|
5448 |
-
labelGapCalc: 'children',
|
5449 |
-
padding: 0,
|
5450 |
-
items: [
|
5451 |
-
{
|
5452 |
-
type: 'form',
|
5453 |
-
layout: 'grid',
|
5454 |
-
columns: 2,
|
5455 |
-
labelGapCalc: false,
|
5456 |
-
padding: 0,
|
5457 |
-
defaults: {
|
5458 |
-
type: 'textbox',
|
5459 |
-
maxWidth: 50
|
5460 |
-
},
|
5461 |
-
items: [
|
5462 |
-
{
|
5463 |
-
label: 'Width',
|
5464 |
-
name: 'width',
|
5465 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
5466 |
-
},
|
5467 |
-
{
|
5468 |
-
label: 'Height',
|
5469 |
-
name: 'height',
|
5470 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
5471 |
-
},
|
5472 |
-
{
|
5473 |
-
label: 'Cell type',
|
5474 |
-
name: 'type',
|
5475 |
-
type: 'listbox',
|
5476 |
-
text: 'None',
|
5477 |
-
minWidth: 90,
|
5478 |
-
maxWidth: null,
|
5479 |
-
values: [
|
5480 |
-
{
|
5481 |
-
text: 'Cell',
|
5482 |
-
value: 'td'
|
5483 |
-
},
|
5484 |
-
{
|
5485 |
-
text: 'Header cell',
|
5486 |
-
value: 'th'
|
5487 |
-
}
|
5488 |
-
]
|
5489 |
-
},
|
5490 |
-
{
|
5491 |
-
label: 'Scope',
|
5492 |
-
name: 'scope',
|
5493 |
-
type: 'listbox',
|
5494 |
-
text: 'None',
|
5495 |
-
minWidth: 90,
|
5496 |
-
maxWidth: null,
|
5497 |
-
values: [
|
5498 |
-
{
|
5499 |
-
text: 'None',
|
5500 |
-
value: ''
|
5501 |
-
},
|
5502 |
-
{
|
5503 |
-
text: 'Row',
|
5504 |
-
value: 'row'
|
5505 |
-
},
|
5506 |
-
{
|
5507 |
-
text: 'Column',
|
5508 |
-
value: 'col'
|
5509 |
-
},
|
5510 |
-
{
|
5511 |
-
text: 'Row group',
|
5512 |
-
value: 'rowgroup'
|
5513 |
-
},
|
5514 |
-
{
|
5515 |
-
text: 'Column group',
|
5516 |
-
value: 'colgroup'
|
5517 |
-
}
|
5518 |
-
]
|
5519 |
-
},
|
5520 |
-
{
|
5521 |
-
label: 'H Align',
|
5522 |
-
name: 'align',
|
5523 |
-
type: 'listbox',
|
5524 |
-
text: 'None',
|
5525 |
-
minWidth: 90,
|
5526 |
-
maxWidth: null,
|
5527 |
-
values: [
|
5528 |
-
{
|
5529 |
-
text: 'None',
|
5530 |
-
value: ''
|
5531 |
-
},
|
5532 |
-
{
|
5533 |
-
text: 'Left',
|
5534 |
-
value: 'left'
|
5535 |
-
},
|
5536 |
-
{
|
5537 |
-
text: 'Center',
|
5538 |
-
value: 'center'
|
5539 |
-
},
|
5540 |
-
{
|
5541 |
-
text: 'Right',
|
5542 |
-
value: 'right'
|
5543 |
-
}
|
5544 |
-
]
|
5545 |
-
},
|
5546 |
-
{
|
5547 |
-
label: 'V Align',
|
5548 |
-
name: 'valign',
|
5549 |
-
type: 'listbox',
|
5550 |
-
text: 'None',
|
5551 |
-
minWidth: 90,
|
5552 |
-
maxWidth: null,
|
5553 |
-
values: [
|
5554 |
-
{
|
5555 |
-
text: 'None',
|
5556 |
-
value: ''
|
5557 |
-
},
|
5558 |
-
{
|
5559 |
-
text: 'Top',
|
5560 |
-
value: 'top'
|
5561 |
-
},
|
5562 |
-
{
|
5563 |
-
text: 'Middle',
|
5564 |
-
value: 'middle'
|
5565 |
-
},
|
5566 |
-
{
|
5567 |
-
text: 'Bottom',
|
5568 |
-
value: 'bottom'
|
5569 |
-
}
|
5570 |
-
]
|
5571 |
-
}
|
5572 |
-
]
|
5573 |
-
},
|
5574 |
-
classListCtrl
|
5575 |
-
]
|
5576 |
-
};
|
5577 |
-
if (hasAdvancedCellTab(editor)) {
|
5578 |
-
editor.windowManager.open({
|
5579 |
-
title: 'Cell properties',
|
5580 |
-
bodyType: 'tabpanel',
|
5581 |
-
data: data,
|
5582 |
-
body: [
|
5583 |
-
{
|
5584 |
-
title: 'General',
|
5585 |
-
type: 'form',
|
5586 |
-
items: generalCellForm
|
5587 |
-
},
|
5588 |
-
Helpers.createStyleForm(editor)
|
5589 |
-
],
|
5590 |
-
onsubmit: curry(onSubmitCellForm, editor, cells)
|
5591 |
-
});
|
5592 |
-
} else {
|
5593 |
-
editor.windowManager.open({
|
5594 |
-
title: 'Cell properties',
|
5595 |
-
data: data,
|
5596 |
-
body: generalCellForm,
|
5597 |
-
onsubmit: curry(onSubmitCellForm, editor, cells)
|
5598 |
-
});
|
5599 |
-
}
|
5600 |
-
};
|
5601 |
-
var CellDialog = { open: open };
|
5602 |
-
|
5603 |
-
var extractDataFromElement$1 = function (editor, elm) {
|
5604 |
-
var dom = editor.dom;
|
5605 |
-
var data = {
|
5606 |
-
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
5607 |
-
scope: dom.getAttrib(elm, 'scope'),
|
5608 |
-
class: dom.getAttrib(elm, 'class'),
|
5609 |
-
align: '',
|
5610 |
-
style: '',
|
5611 |
-
type: elm.parentNode.nodeName.toLowerCase()
|
5612 |
-
};
|
5613 |
-
global$1.each('left center right'.split(' '), function (name) {
|
5614 |
-
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
5615 |
-
data.align = name;
|
5616 |
-
}
|
5617 |
-
});
|
5618 |
-
if (hasAdvancedRowTab(editor)) {
|
5619 |
-
global$1.extend(data, Helpers.extractAdvancedStyles(dom, elm));
|
5620 |
-
}
|
5621 |
-
return data;
|
5622 |
-
};
|
5623 |
-
var switchRowType = function (dom, rowElm, toType) {
|
5624 |
-
var tableElm = dom.getParent(rowElm, 'table');
|
5625 |
-
var oldParentElm = rowElm.parentNode;
|
5626 |
-
var parentElm = dom.select(toType, tableElm)[0];
|
5627 |
-
if (!parentElm) {
|
5628 |
-
parentElm = dom.create(toType);
|
5629 |
-
if (tableElm.firstChild) {
|
5630 |
-
if (tableElm.firstChild.nodeName === 'CAPTION') {
|
5631 |
-
dom.insertAfter(parentElm, tableElm.firstChild);
|
5632 |
-
} else {
|
5633 |
-
tableElm.insertBefore(parentElm, tableElm.firstChild);
|
5634 |
-
}
|
5635 |
-
} else {
|
5636 |
-
tableElm.appendChild(parentElm);
|
5637 |
-
}
|
5638 |
-
}
|
5639 |
-
parentElm.appendChild(rowElm);
|
5640 |
-
if (!oldParentElm.hasChildNodes()) {
|
5641 |
-
dom.remove(oldParentElm);
|
5642 |
-
}
|
5643 |
-
};
|
5644 |
-
function onSubmitRowForm(editor, rows, oldData, evt) {
|
5645 |
-
var dom = editor.dom;
|
5646 |
-
function setAttrib(elm, name, value) {
|
5647 |
-
if (rows.length === 1 || value) {
|
5648 |
-
dom.setAttrib(elm, name, value);
|
5649 |
-
}
|
5650 |
-
}
|
5651 |
-
function setStyle(elm, name, value) {
|
5652 |
-
if (rows.length === 1 || value) {
|
5653 |
-
dom.setStyle(elm, name, value);
|
5654 |
-
}
|
5655 |
-
}
|
5656 |
-
if (hasAdvancedRowTab(editor)) {
|
5657 |
-
Helpers.syncAdvancedStyleFields(editor, evt);
|
5658 |
-
}
|
5659 |
-
var data = evt.control.rootControl.toJSON();
|
5660 |
-
editor.undoManager.transact(function () {
|
5661 |
-
global$1.each(rows, function (rowElm) {
|
5662 |
-
setAttrib(rowElm, 'scope', data.scope);
|
5663 |
-
setAttrib(rowElm, 'style', data.style);
|
5664 |
-
setAttrib(rowElm, 'class', data.class);
|
5665 |
-
setStyle(rowElm, 'height', addSizeSuffix(data.height));
|
5666 |
-
if (data.type !== rowElm.parentNode.nodeName.toLowerCase()) {
|
5667 |
-
switchRowType(editor.dom, rowElm, data.type);
|
5668 |
-
}
|
5669 |
-
if (data.align !== oldData.align) {
|
5670 |
-
Styles$1.unApplyAlign(editor, rowElm);
|
5671 |
-
Styles$1.applyAlign(editor, rowElm, data.align);
|
5672 |
-
}
|
5673 |
-
});
|
5674 |
-
editor.focus();
|
5675 |
-
});
|
5676 |
-
}
|
5677 |
-
var open$1 = function (editor) {
|
5678 |
-
var dom = editor.dom;
|
5679 |
-
var tableElm, cellElm, rowElm, classListCtrl, data;
|
5680 |
-
var rows = [];
|
5681 |
-
var generalRowForm;
|
5682 |
-
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
5683 |
-
cellElm = dom.getParent(editor.selection.getStart(), 'td,th');
|
5684 |
-
global$1.each(tableElm.rows, function (row) {
|
5685 |
-
global$1.each(row.cells, function (cell) {
|
5686 |
-
if (dom.getAttrib(cell, 'data-mce-selected') || cell === cellElm) {
|
5687 |
-
rows.push(row);
|
5688 |
-
return false;
|
5689 |
-
}
|
5690 |
-
});
|
5691 |
-
});
|
5692 |
-
rowElm = rows[0];
|
5693 |
-
if (!rowElm) {
|
5694 |
-
return;
|
5695 |
-
}
|
5696 |
-
if (rows.length > 1) {
|
5697 |
-
data = {
|
5698 |
-
height: '',
|
5699 |
-
scope: '',
|
5700 |
-
style: '',
|
5701 |
-
class: '',
|
5702 |
-
align: '',
|
5703 |
-
type: rowElm.parentNode.nodeName.toLowerCase()
|
5704 |
-
};
|
5705 |
-
} else {
|
5706 |
-
data = extractDataFromElement$1(editor, rowElm);
|
5707 |
-
}
|
5708 |
-
if (getRowClassList(editor).length > 0) {
|
5709 |
-
classListCtrl = {
|
5710 |
-
name: 'class',
|
5711 |
-
type: 'listbox',
|
5712 |
-
label: 'Class',
|
5713 |
-
values: Helpers.buildListItems(getRowClassList(editor), function (item) {
|
5714 |
-
if (item.value) {
|
5715 |
-
item.textStyle = function () {
|
5716 |
-
return editor.formatter.getCssText({
|
5717 |
-
block: 'tr',
|
5718 |
-
classes: [item.value]
|
5719 |
-
});
|
5720 |
-
};
|
5721 |
-
}
|
5722 |
-
})
|
5723 |
-
};
|
5724 |
-
}
|
5725 |
-
generalRowForm = {
|
5726 |
-
type: 'form',
|
5727 |
-
columns: 2,
|
5728 |
-
padding: 0,
|
5729 |
-
defaults: { type: 'textbox' },
|
5730 |
-
items: [
|
5731 |
-
{
|
5732 |
-
type: 'listbox',
|
5733 |
-
name: 'type',
|
5734 |
-
label: 'Row type',
|
5735 |
-
text: 'Header',
|
5736 |
-
maxWidth: null,
|
5737 |
-
values: [
|
5738 |
-
{
|
5739 |
-
text: 'Header',
|
5740 |
-
value: 'thead'
|
5741 |
-
},
|
5742 |
-
{
|
5743 |
-
text: 'Body',
|
5744 |
-
value: 'tbody'
|
5745 |
-
},
|
5746 |
-
{
|
5747 |
-
text: 'Footer',
|
5748 |
-
value: 'tfoot'
|
5749 |
-
}
|
5750 |
-
]
|
5751 |
-
},
|
5752 |
-
{
|
5753 |
-
type: 'listbox',
|
5754 |
-
name: 'align',
|
5755 |
-
label: 'Alignment',
|
5756 |
-
text: 'None',
|
5757 |
-
maxWidth: null,
|
5758 |
-
values: [
|
5759 |
-
{
|
5760 |
-
text: 'None',
|
5761 |
-
value: ''
|
5762 |
-
},
|
5763 |
-
{
|
5764 |
-
text: 'Left',
|
5765 |
-
value: 'left'
|
5766 |
-
},
|
5767 |
-
{
|
5768 |
-
text: 'Center',
|
5769 |
-
value: 'center'
|
5770 |
-
},
|
5771 |
-
{
|
5772 |
-
text: 'Right',
|
5773 |
-
value: 'right'
|
5774 |
-
}
|
5775 |
-
]
|
5776 |
-
},
|
5777 |
-
{
|
5778 |
-
label: 'Height',
|
5779 |
-
name: 'height'
|
5780 |
-
},
|
5781 |
-
classListCtrl
|
5782 |
-
]
|
5783 |
-
};
|
5784 |
-
if (hasAdvancedRowTab(editor)) {
|
5785 |
-
editor.windowManager.open({
|
5786 |
-
title: 'Row properties',
|
5787 |
-
data: data,
|
5788 |
-
bodyType: 'tabpanel',
|
5789 |
-
body: [
|
5790 |
-
{
|
5791 |
-
title: 'General',
|
5792 |
-
type: 'form',
|
5793 |
-
items: generalRowForm
|
5794 |
-
},
|
5795 |
-
Helpers.createStyleForm(editor)
|
5796 |
-
],
|
5797 |
-
onsubmit: curry(onSubmitRowForm, editor, rows, data)
|
5798 |
-
});
|
5799 |
-
} else {
|
5800 |
-
editor.windowManager.open({
|
5801 |
-
title: 'Row properties',
|
5802 |
-
data: data,
|
5803 |
-
body: generalRowForm,
|
5804 |
-
onsubmit: curry(onSubmitRowForm, editor, rows, data)
|
5805 |
-
});
|
5806 |
-
}
|
5807 |
-
};
|
5808 |
-
var RowDialog = { open: open$1 };
|
5809 |
-
|
5810 |
-
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
|
5811 |
-
|
5812 |
-
var DefaultRenderOptions = {
|
5813 |
-
styles: {
|
5814 |
-
'border-collapse': 'collapse',
|
5815 |
-
width: '100%'
|
5816 |
-
},
|
5817 |
-
attributes: { border: '1' },
|
5818 |
-
percentages: true
|
5819 |
-
};
|
5820 |
-
var makeTable = function () {
|
5821 |
-
return Element$$1.fromTag('table');
|
5822 |
-
};
|
5823 |
-
var tableBody = function () {
|
5824 |
-
return Element$$1.fromTag('tbody');
|
5825 |
-
};
|
5826 |
-
var tableRow = function () {
|
5827 |
-
return Element$$1.fromTag('tr');
|
5828 |
-
};
|
5829 |
-
var tableHeaderCell = function () {
|
5830 |
-
return Element$$1.fromTag('th');
|
5831 |
-
};
|
5832 |
-
var tableCell = function () {
|
5833 |
-
return Element$$1.fromTag('td');
|
5834 |
-
};
|
5835 |
-
var render$1 = function (rows, columns, rowHeaders, columnHeaders, renderOpts) {
|
5836 |
-
if (renderOpts === void 0) {
|
5837 |
-
renderOpts = DefaultRenderOptions;
|
5838 |
-
}
|
5839 |
-
var table = makeTable();
|
5840 |
-
setAll$1(table, renderOpts.styles);
|
5841 |
-
setAll(table, renderOpts.attributes);
|
5842 |
-
var tbody = tableBody();
|
5843 |
-
append(table, tbody);
|
5844 |
-
var trs = [];
|
5845 |
-
for (var i = 0; i < rows; i++) {
|
5846 |
-
var tr = tableRow();
|
5847 |
-
for (var j = 0; j < columns; j++) {
|
5848 |
-
var td = i < rowHeaders || j < columnHeaders ? tableHeaderCell() : tableCell();
|
5849 |
-
if (j < columnHeaders) {
|
5850 |
-
set(td, 'scope', 'row');
|
5851 |
-
}
|
5852 |
-
if (i < rowHeaders) {
|
5853 |
-
set(td, 'scope', 'col');
|
5854 |
-
}
|
5855 |
-
append(td, Element$$1.fromTag('br'));
|
5856 |
-
if (renderOpts.percentages) {
|
5857 |
-
set$1(td, 'width', 100 / columns + '%');
|
5858 |
-
}
|
5859 |
-
append(tr, td);
|
5860 |
-
}
|
5861 |
-
trs.push(tr);
|
5862 |
-
}
|
5863 |
-
append$1(tbody, trs);
|
5864 |
-
return table;
|
5865 |
-
};
|
5866 |
-
|
5867 |
-
var get$8 = function (element) {
|
5868 |
-
return element.dom().innerHTML;
|
5869 |
-
};
|
5870 |
-
var getOuter$2 = function (element) {
|
5871 |
-
var container = Element$$1.fromTag('div');
|
5872 |
-
var clone = Element$$1.fromDom(element.dom().cloneNode(true));
|
5873 |
-
append(container, clone);
|
5874 |
-
return get$8(container);
|
5875 |
-
};
|
5876 |
-
|
5877 |
-
var placeCaretInCell = function (editor, cell) {
|
5878 |
-
editor.selection.select(cell.dom(), true);
|
5879 |
-
editor.selection.collapse(true);
|
5880 |
-
};
|
5881 |
-
var selectFirstCellInTable = function (editor, tableElm) {
|
5882 |
-
descendant$1(tableElm, 'td,th').each(curry(placeCaretInCell, editor));
|
5883 |
-
};
|
5884 |
-
var fireEvents = function (editor, table) {
|
5885 |
-
each(descendants$1(table, 'tr'), function (row) {
|
5886 |
-
fireNewRow(editor, row.dom());
|
5887 |
-
each(descendants$1(row, 'th,td'), function (cell) {
|
5888 |
-
fireNewCell(editor, cell.dom());
|
5889 |
-
});
|
5890 |
-
});
|
5891 |
-
};
|
5892 |
-
var isPercentage = function (width) {
|
5893 |
-
return isString(width) && width.indexOf('%') !== -1;
|
5894 |
-
};
|
5895 |
-
var insert$1 = function (editor, columns, rows) {
|
5896 |
-
var defaultStyles = getDefaultStyles(editor);
|
5897 |
-
var options = {
|
5898 |
-
styles: defaultStyles,
|
5899 |
-
attributes: getDefaultAttributes(editor),
|
5900 |
-
percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
|
5901 |
-
};
|
5902 |
-
var table = render$1(rows, columns, 0, 0, options);
|
5903 |
-
set(table, 'data-mce-id', '__mce');
|
5904 |
-
var html = getOuter$2(table);
|
5905 |
-
editor.insertContent(html);
|
5906 |
-
return descendant$1(getBody$1(editor), 'table[data-mce-id="__mce"]').map(function (table) {
|
5907 |
-
if (isPixelsForced(editor)) {
|
5908 |
-
set$1(table, 'width', get$2(table, 'width'));
|
5909 |
-
}
|
5910 |
-
remove(table, 'data-mce-id');
|
5911 |
-
fireEvents(editor, table);
|
5912 |
-
selectFirstCellInTable(editor, table);
|
5913 |
-
return table.dom();
|
5914 |
-
}).getOr(null);
|
5915 |
-
};
|
5916 |
-
var InsertTable = { insert: insert$1 };
|
5917 |
-
|
5918 |
-
function styleTDTH(dom, elm, name, value) {
|
5919 |
-
if (elm.tagName === 'TD' || elm.tagName === 'TH') {
|
5920 |
-
dom.setStyle(elm, name, value);
|
5921 |
-
} else {
|
5922 |
-
if (elm.children) {
|
5923 |
-
for (var i = 0; i < elm.children.length; i++) {
|
5924 |
-
styleTDTH(dom, elm.children[i], name, value);
|
5925 |
-
}
|
5926 |
-
}
|
5927 |
-
}
|
5928 |
-
}
|
5929 |
-
var extractDataFromElement$2 = function (editor, tableElm) {
|
5930 |
-
var dom = editor.dom;
|
5931 |
-
var data = {
|
5932 |
-
width: dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width'),
|
5933 |
-
height: dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height'),
|
5934 |
-
cellspacing: dom.getStyle(tableElm, 'border-spacing') || dom.getAttrib(tableElm, 'cellspacing'),
|
5935 |
-
cellpadding: dom.getAttrib(tableElm, 'data-mce-cell-padding') || dom.getAttrib(tableElm, 'cellpadding') || Styles$1.getTDTHOverallStyle(editor.dom, tableElm, 'padding'),
|
5936 |
-
border: dom.getAttrib(tableElm, 'data-mce-border') || dom.getAttrib(tableElm, 'border') || Styles$1.getTDTHOverallStyle(editor.dom, tableElm, 'border'),
|
5937 |
-
borderColor: dom.getAttrib(tableElm, 'data-mce-border-color'),
|
5938 |
-
caption: !!dom.select('caption', tableElm)[0],
|
5939 |
-
class: dom.getAttrib(tableElm, 'class')
|
5940 |
-
};
|
5941 |
-
global$1.each('left center right'.split(' '), function (name) {
|
5942 |
-
if (editor.formatter.matchNode(tableElm, 'align' + name)) {
|
5943 |
-
data.align = name;
|
5944 |
-
}
|
5945 |
-
});
|
5946 |
-
if (hasAdvancedTableTab(editor)) {
|
5947 |
-
global$1.extend(data, Helpers.extractAdvancedStyles(dom, tableElm));
|
5948 |
-
}
|
5949 |
-
return data;
|
5950 |
-
};
|
5951 |
-
var applyDataToElement = function (editor, tableElm, data) {
|
5952 |
-
var dom = editor.dom;
|
5953 |
-
var attrs = {};
|
5954 |
-
var styles = {};
|
5955 |
-
attrs.class = data.class;
|
5956 |
-
styles.height = addSizeSuffix(data.height);
|
5957 |
-
if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {
|
5958 |
-
attrs.width = removePxSuffix(data.width);
|
5959 |
-
} else {
|
5960 |
-
styles.width = addSizeSuffix(data.width);
|
5961 |
-
}
|
5962 |
-
if (shouldStyleWithCss(editor)) {
|
5963 |
-
styles['border-width'] = addSizeSuffix(data.border);
|
5964 |
-
styles['border-spacing'] = addSizeSuffix(data.cellspacing);
|
5965 |
-
global$1.extend(attrs, {
|
5966 |
-
'data-mce-border-color': data.borderColor,
|
5967 |
-
'data-mce-cell-padding': data.cellpadding,
|
5968 |
-
'data-mce-border': data.border
|
5969 |
-
});
|
5970 |
-
} else {
|
5971 |
-
global$1.extend(attrs, {
|
5972 |
-
border: data.border,
|
5973 |
-
cellpadding: data.cellpadding,
|
5974 |
-
cellspacing: data.cellspacing
|
5975 |
-
});
|
5976 |
-
}
|
5977 |
-
if (shouldStyleWithCss(editor)) {
|
5978 |
-
if (tableElm.children) {
|
5979 |
-
for (var i = 0; i < tableElm.children.length; i++) {
|
5980 |
-
styleTDTH(dom, tableElm.children[i], {
|
5981 |
-
'border-width': addSizeSuffix(data.border),
|
5982 |
-
'border-color': data.borderColor,
|
5983 |
-
'padding': addSizeSuffix(data.cellpadding)
|
5984 |
-
});
|
5985 |
-
}
|
5986 |
-
}
|
5987 |
-
}
|
5988 |
-
if (data.style) {
|
5989 |
-
global$1.extend(styles, dom.parseStyle(data.style));
|
5990 |
-
} else {
|
5991 |
-
styles = global$1.extend({}, dom.parseStyle(dom.getAttrib(tableElm, 'style')), styles);
|
5992 |
-
}
|
5993 |
-
attrs.style = dom.serializeStyle(styles);
|
5994 |
-
dom.setAttribs(tableElm, attrs);
|
5995 |
-
};
|
5996 |
-
var onSubmitTableForm = function (editor, tableElm, evt) {
|
5997 |
-
var dom = editor.dom;
|
5998 |
-
var captionElm;
|
5999 |
-
var data;
|
6000 |
-
if (hasAdvancedTableTab(editor)) {
|
6001 |
-
Helpers.syncAdvancedStyleFields(editor, evt);
|
6002 |
-
}
|
6003 |
-
data = evt.control.rootControl.toJSON();
|
6004 |
-
if (data.class === false) {
|
6005 |
-
delete data.class;
|
6006 |
-
}
|
6007 |
-
editor.undoManager.transact(function () {
|
6008 |
-
if (!tableElm) {
|
6009 |
-
tableElm = InsertTable.insert(editor, data.cols || 1, data.rows || 1);
|
6010 |
-
}
|
6011 |
-
applyDataToElement(editor, tableElm, data);
|
6012 |
-
captionElm = dom.select('caption', tableElm)[0];
|
6013 |
-
if (captionElm && !data.caption) {
|
6014 |
-
dom.remove(captionElm);
|
6015 |
-
}
|
6016 |
-
if (!captionElm && data.caption) {
|
6017 |
-
captionElm = dom.create('caption');
|
6018 |
-
captionElm.innerHTML = !global$2.ie ? '<br data-mce-bogus="1"/>' : '\xA0';
|
6019 |
-
tableElm.insertBefore(captionElm, tableElm.firstChild);
|
6020 |
-
}
|
6021 |
-
Styles$1.unApplyAlign(editor, tableElm);
|
6022 |
-
if (data.align) {
|
6023 |
-
Styles$1.applyAlign(editor, tableElm, data.align);
|
6024 |
-
}
|
6025 |
-
editor.focus();
|
6026 |
-
editor.addVisual();
|
6027 |
-
});
|
6028 |
-
};
|
6029 |
-
var open$2 = function (editor, isProps) {
|
6030 |
-
var dom = editor.dom;
|
6031 |
-
var tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm;
|
6032 |
-
if (isProps === true) {
|
6033 |
-
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
6034 |
-
if (tableElm) {
|
6035 |
-
data = extractDataFromElement$2(editor, tableElm);
|
6036 |
-
}
|
6037 |
-
} else {
|
6038 |
-
colsCtrl = {
|
6039 |
-
label: 'Cols',
|
6040 |
-
name: 'cols'
|
6041 |
-
};
|
6042 |
-
rowsCtrl = {
|
6043 |
-
label: 'Rows',
|
6044 |
-
name: 'rows'
|
6045 |
-
};
|
6046 |
-
}
|
6047 |
-
if (getTableClassList(editor).length > 0) {
|
6048 |
-
if (data.class) {
|
6049 |
-
data.class = data.class.replace(/\s*mce\-item\-table\s*/g, '');
|
6050 |
-
}
|
6051 |
-
classListCtrl = {
|
6052 |
-
name: 'class',
|
6053 |
-
type: 'listbox',
|
6054 |
-
label: 'Class',
|
6055 |
-
values: Helpers.buildListItems(getTableClassList(editor), function (item) {
|
6056 |
-
if (item.value) {
|
6057 |
-
item.textStyle = function () {
|
6058 |
-
return editor.formatter.getCssText({
|
6059 |
-
block: 'table',
|
6060 |
-
classes: [item.value]
|
6061 |
-
});
|
6062 |
-
};
|
6063 |
-
}
|
6064 |
-
})
|
6065 |
-
};
|
6066 |
-
}
|
6067 |
-
generalTableForm = {
|
6068 |
-
type: 'form',
|
6069 |
-
layout: 'flex',
|
6070 |
-
direction: 'column',
|
6071 |
-
labelGapCalc: 'children',
|
6072 |
-
padding: 0,
|
6073 |
-
items: [
|
6074 |
-
{
|
6075 |
-
type: 'form',
|
6076 |
-
labelGapCalc: false,
|
6077 |
-
padding: 0,
|
6078 |
-
layout: 'grid',
|
6079 |
-
columns: 2,
|
6080 |
-
defaults: {
|
6081 |
-
type: 'textbox',
|
6082 |
-
maxWidth: 50
|
6083 |
-
},
|
6084 |
-
items: hasAppearanceOptions(editor) ? [
|
6085 |
-
colsCtrl,
|
6086 |
-
rowsCtrl,
|
6087 |
-
{
|
6088 |
-
label: 'Width',
|
6089 |
-
name: 'width',
|
6090 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
6091 |
-
},
|
6092 |
-
{
|
6093 |
-
label: 'Height',
|
6094 |
-
name: 'height',
|
6095 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
6096 |
-
},
|
6097 |
-
{
|
6098 |
-
label: 'Cell spacing',
|
6099 |
-
name: 'cellspacing'
|
6100 |
-
},
|
6101 |
-
{
|
6102 |
-
label: 'Cell padding',
|
6103 |
-
name: 'cellpadding'
|
6104 |
-
},
|
6105 |
-
{
|
6106 |
-
label: 'Border',
|
6107 |
-
name: 'border'
|
6108 |
-
},
|
6109 |
-
{
|
6110 |
-
label: 'Caption',
|
6111 |
-
name: 'caption',
|
6112 |
-
type: 'checkbox'
|
6113 |
-
}
|
6114 |
-
] : [
|
6115 |
-
colsCtrl,
|
6116 |
-
rowsCtrl,
|
6117 |
-
{
|
6118 |
-
label: 'Width',
|
6119 |
-
name: 'width',
|
6120 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
6121 |
-
},
|
6122 |
-
{
|
6123 |
-
label: 'Height',
|
6124 |
-
name: 'height',
|
6125 |
-
onchange: curry(Helpers.updateStyleField, editor)
|
6126 |
-
}
|
6127 |
-
]
|
6128 |
-
},
|
6129 |
-
{
|
6130 |
-
label: 'Alignment',
|
6131 |
-
name: 'align',
|
6132 |
-
type: 'listbox',
|
6133 |
-
text: 'None',
|
6134 |
-
values: [
|
6135 |
-
{
|
6136 |
-
text: 'None',
|
6137 |
-
value: ''
|
6138 |
-
},
|
6139 |
-
{
|
6140 |
-
text: 'Left',
|
6141 |
-
value: 'left'
|
6142 |
-
},
|
6143 |
-
{
|
6144 |
-
text: 'Center',
|
6145 |
-
value: 'center'
|
6146 |
-
},
|
6147 |
-
{
|
6148 |
-
text: 'Right',
|
6149 |
-
value: 'right'
|
6150 |
-
}
|
6151 |
-
]
|
6152 |
-
},
|
6153 |
-
classListCtrl
|
6154 |
-
]
|
6155 |
-
};
|
6156 |
-
if (hasAdvancedTableTab(editor)) {
|
6157 |
-
editor.windowManager.open({
|
6158 |
-
title: 'Table properties',
|
6159 |
-
data: data,
|
6160 |
-
bodyType: 'tabpanel',
|
6161 |
-
body: [
|
6162 |
-
{
|
6163 |
-
title: 'General',
|
6164 |
-
type: 'form',
|
6165 |
-
items: generalTableForm
|
6166 |
-
},
|
6167 |
-
Helpers.createStyleForm(editor)
|
6168 |
-
],
|
6169 |
-
onsubmit: curry(onSubmitTableForm, editor, tableElm)
|
6170 |
-
});
|
6171 |
-
} else {
|
6172 |
-
editor.windowManager.open({
|
6173 |
-
title: 'Table properties',
|
6174 |
-
data: data,
|
6175 |
-
body: generalTableForm,
|
6176 |
-
onsubmit: curry(onSubmitTableForm, editor, tableElm)
|
6177 |
-
});
|
6178 |
-
}
|
6179 |
-
};
|
6180 |
-
var TableDialog = { open: open$2 };
|
6181 |
-
|
6182 |
-
var each$3 = global$1.each;
|
6183 |
-
var registerCommands = function (editor, actions, cellSelection, selections, clipboardRows) {
|
6184 |
-
var isRoot = getIsRoot(editor);
|
6185 |
-
var eraseTable = function () {
|
6186 |
-
var cell = Element$$1.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
6187 |
-
var table = TableLookup.table(cell, isRoot);
|
6188 |
-
table.filter(not(isRoot)).each(function (table) {
|
6189 |
-
var cursor = Element$$1.fromText('');
|
6190 |
-
after(table, cursor);
|
6191 |
-
remove$2(table);
|
6192 |
-
var rng = editor.dom.createRng();
|
6193 |
-
rng.setStart(cursor.dom(), 0);
|
6194 |
-
rng.setEnd(cursor.dom(), 0);
|
6195 |
-
editor.selection.setRng(rng);
|
6196 |
-
});
|
6197 |
-
};
|
6198 |
-
var getSelectionStartCell = function () {
|
6199 |
-
return Element$$1.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
6200 |
-
};
|
6201 |
-
var getTableFromCell = function (cell) {
|
6202 |
-
return TableLookup.table(cell, isRoot);
|
6203 |
-
};
|
6204 |
-
var getSize = function (table) {
|
6205 |
-
return {
|
6206 |
-
width: getPixelWidth$1(table.dom()),
|
6207 |
-
height: getPixelWidth$1(table.dom())
|
6208 |
-
};
|
6209 |
-
};
|
6210 |
-
var resizeChange = function (editor, oldSize, table) {
|
6211 |
-
var newSize = getSize(table);
|
6212 |
-
if (oldSize.width !== newSize.width || oldSize.height !== newSize.height) {
|
6213 |
-
fireObjectResizeStart(editor, table.dom(), oldSize.width, oldSize.height);
|
6214 |
-
fireObjectResized(editor, table.dom(), newSize.width, newSize.height);
|
6215 |
-
}
|
6216 |
-
};
|
6217 |
-
var actOnSelection = function (execute) {
|
6218 |
-
var cell = getSelectionStartCell();
|
6219 |
-
var table = getTableFromCell(cell);
|
6220 |
-
table.each(function (table) {
|
6221 |
-
var targets = TableTargets.forMenu(selections, table, cell);
|
6222 |
-
var beforeSize = getSize(table);
|
6223 |
-
execute(table, targets).each(function (rng) {
|
6224 |
-
resizeChange(editor, beforeSize, table);
|
6225 |
-
editor.selection.setRng(rng);
|
6226 |
-
editor.focus();
|
6227 |
-
cellSelection.clear(table);
|
6228 |
-
removeDataStyle(table);
|
6229 |
-
});
|
6230 |
-
});
|
6231 |
-
};
|
6232 |
-
var copyRowSelection = function (execute) {
|
6233 |
-
var cell = getSelectionStartCell();
|
6234 |
-
var table = getTableFromCell(cell);
|
6235 |
-
return table.bind(function (table) {
|
6236 |
-
var doc = Element$$1.fromDom(editor.getDoc());
|
6237 |
-
var targets = TableTargets.forMenu(selections, table, cell);
|
6238 |
-
var generators = TableFill.cellOperations(noop, doc, Option.none());
|
6239 |
-
return CopyRows.copyRows(table, targets, generators);
|
6240 |
-
});
|
6241 |
-
};
|
6242 |
-
var pasteOnSelection = function (execute) {
|
6243 |
-
clipboardRows.get().each(function (rows) {
|
6244 |
-
var clonedRows = map(rows, function (row) {
|
6245 |
-
return deep(row);
|
6246 |
-
});
|
6247 |
-
var cell = getSelectionStartCell();
|
6248 |
-
var table = getTableFromCell(cell);
|
6249 |
-
table.bind(function (table) {
|
6250 |
-
var doc = Element$$1.fromDom(editor.getDoc());
|
6251 |
-
var generators = TableFill.paste(doc);
|
6252 |
-
var targets = TableTargets.pasteRows(selections, table, cell, clonedRows, generators);
|
6253 |
-
execute(table, targets).each(function (rng) {
|
6254 |
-
editor.selection.setRng(rng);
|
6255 |
-
editor.focus();
|
6256 |
-
cellSelection.clear(table);
|
6257 |
-
});
|
6258 |
-
});
|
6259 |
-
});
|
6260 |
-
};
|
6261 |
-
each$3({
|
6262 |
-
mceTableSplitCells: function () {
|
6263 |
-
actOnSelection(actions.unmergeCells);
|
6264 |
-
},
|
6265 |
-
mceTableMergeCells: function () {
|
6266 |
-
actOnSelection(actions.mergeCells);
|
6267 |
-
},
|
6268 |
-
mceTableInsertRowBefore: function () {
|
6269 |
-
actOnSelection(actions.insertRowsBefore);
|
6270 |
},
|
6271 |
-
|
6272 |
-
|
6273 |
-
|
6274 |
-
|
6275 |
-
|
6276 |
-
|
6277 |
-
|
6278 |
-
|
6279 |
-
|
6280 |
-
|
6281 |
-
|
6282 |
-
|
6283 |
-
|
6284 |
-
|
6285 |
-
|
6286 |
-
|
6287 |
-
|
6288 |
-
|
6289 |
-
|
6290 |
-
|
6291 |
-
|
6292 |
-
|
6293 |
-
|
6294 |
-
|
6295 |
-
|
6296 |
-
|
6297 |
-
|
6298 |
-
|
6299 |
-
|
6300 |
-
|
6301 |
-
|
6302 |
-
|
6303 |
-
|
6304 |
-
|
6305 |
-
|
6306 |
-
|
6307 |
-
|
6308 |
-
|
6309 |
-
|
6310 |
-
|
6311 |
-
|
6312 |
-
|
6313 |
-
|
6314 |
-
|
6315 |
-
|
6316 |
-
|
6317 |
-
|
6318 |
-
|
6319 |
-
|
6320 |
-
|
6321 |
-
|
6322 |
-
|
6323 |
-
|
6324 |
-
|
6325 |
-
|
6326 |
-
|
6327 |
-
|
6328 |
-
|
6329 |
-
|
6330 |
-
|
6331 |
-
|
6332 |
-
|
6333 |
-
|
6334 |
-
|
6335 |
-
|
6336 |
-
|
6337 |
-
|
6338 |
-
|
6339 |
-
|
6340 |
-
|
6341 |
-
|
6342 |
-
|
6343 |
-
|
6344 |
-
|
6345 |
-
|
6346 |
-
|
6347 |
-
|
6348 |
-
|
6349 |
-
if (handler === undefined) {
|
6350 |
-
throw 'Event bind error: undefined handler';
|
6351 |
}
|
6352 |
-
|
6353 |
-
|
6354 |
-
|
6355 |
-
|
6356 |
-
|
6357 |
-
|
6358 |
-
|
6359 |
-
|
6360 |
-
|
6361 |
-
|
6362 |
-
|
6363 |
-
|
6364 |
-
|
6365 |
-
|
6366 |
-
|
6367 |
-
|
6368 |
-
|
6369 |
-
|
6370 |
-
|
6371 |
-
|
6372 |
-
|
6373 |
-
|
6374 |
-
|
6375 |
-
|
6376 |
-
|
6377 |
-
|
6378 |
-
|
6379 |
-
|
6380 |
-
|
6381 |
-
|
6382 |
-
|
6383 |
-
|
6384 |
-
trigger: trigger
|
6385 |
-
};
|
6386 |
-
};
|
6387 |
-
var Events = { create: create };
|
6388 |
-
|
6389 |
-
var mode = exactly([
|
6390 |
-
'compare',
|
6391 |
-
'extract',
|
6392 |
-
'mutate',
|
6393 |
-
'sink'
|
6394 |
-
]);
|
6395 |
-
var sink = exactly([
|
6396 |
-
'element',
|
6397 |
-
'start',
|
6398 |
-
'stop',
|
6399 |
-
'destroy'
|
6400 |
-
]);
|
6401 |
-
var api$3 = exactly([
|
6402 |
-
'forceDrop',
|
6403 |
-
'drop',
|
6404 |
-
'move',
|
6405 |
-
'delayDrop'
|
6406 |
-
]);
|
6407 |
-
var DragApis = {
|
6408 |
-
mode: mode,
|
6409 |
-
sink: sink,
|
6410 |
-
api: api$3
|
6411 |
-
};
|
6412 |
-
|
6413 |
-
var styles$1 = css('ephox-dragster');
|
6414 |
-
var Styles$2 = { resolve: styles$1.resolve };
|
6415 |
-
|
6416 |
-
function Blocker (options) {
|
6417 |
-
var settings = merge$1({ 'layerClass': Styles$2.resolve('blocker') }, options);
|
6418 |
-
var div = Element$$1.fromTag('div');
|
6419 |
-
set(div, 'role', 'presentation');
|
6420 |
-
setAll$1(div, {
|
6421 |
-
position: 'fixed',
|
6422 |
-
left: '0px',
|
6423 |
-
top: '0px',
|
6424 |
-
width: '100%',
|
6425 |
-
height: '100%'
|
6426 |
-
});
|
6427 |
-
add$2(div, Styles$2.resolve('blocker'));
|
6428 |
-
add$2(div, settings.layerClass);
|
6429 |
-
var element = function () {
|
6430 |
-
return div;
|
6431 |
-
};
|
6432 |
-
var destroy = function () {
|
6433 |
-
remove$2(div);
|
6434 |
-
};
|
6435 |
-
return {
|
6436 |
-
element: element,
|
6437 |
-
destroy: destroy
|
6438 |
-
};
|
6439 |
-
}
|
6440 |
-
|
6441 |
-
var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
|
6442 |
-
return {
|
6443 |
-
'target': constant(target),
|
6444 |
-
'x': constant(x),
|
6445 |
-
'y': constant(y),
|
6446 |
-
'stop': stop,
|
6447 |
-
'prevent': prevent,
|
6448 |
-
'kill': kill,
|
6449 |
-
'raw': constant(raw)
|
6450 |
-
};
|
6451 |
-
};
|
6452 |
-
var handle = function (filter, handler) {
|
6453 |
-
return function (rawEvent) {
|
6454 |
-
if (!filter(rawEvent))
|
6455 |
-
return;
|
6456 |
-
var target = Element$$1.fromDom(rawEvent.target);
|
6457 |
-
var stop = function () {
|
6458 |
-
rawEvent.stopPropagation();
|
6459 |
-
};
|
6460 |
-
var prevent = function () {
|
6461 |
-
rawEvent.preventDefault();
|
6462 |
-
};
|
6463 |
-
var kill = compose(prevent, stop);
|
6464 |
-
var evt = mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
|
6465 |
-
handler(evt);
|
6466 |
-
};
|
6467 |
-
};
|
6468 |
-
var binder = function (element, event, filter, handler, useCapture) {
|
6469 |
-
var wrapped = handle(filter, handler);
|
6470 |
-
element.dom().addEventListener(event, wrapped, useCapture);
|
6471 |
-
return { unbind: curry(unbind, element, event, wrapped, useCapture) };
|
6472 |
-
};
|
6473 |
-
var bind$1 = function (element, event, filter, handler) {
|
6474 |
-
return binder(element, event, filter, handler, false);
|
6475 |
-
};
|
6476 |
-
var unbind = function (element, event, handler, useCapture) {
|
6477 |
-
element.dom().removeEventListener(event, handler, useCapture);
|
6478 |
-
};
|
6479 |
-
|
6480 |
-
var filter$1 = constant(true);
|
6481 |
-
var bind$2 = function (element, event, handler) {
|
6482 |
-
return bind$1(element, event, filter$1, handler);
|
6483 |
-
};
|
6484 |
-
|
6485 |
-
var compare = function (old, nu) {
|
6486 |
-
return Position(nu.left() - old.left(), nu.top() - old.top());
|
6487 |
-
};
|
6488 |
-
var extract$1 = function (event) {
|
6489 |
-
return Option.some(Position(event.x(), event.y()));
|
6490 |
-
};
|
6491 |
-
var mutate$1 = function (mutation, info) {
|
6492 |
-
mutation.mutate(info.left(), info.top());
|
6493 |
-
};
|
6494 |
-
var sink$1 = function (dragApi, settings) {
|
6495 |
-
var blocker = Blocker(settings);
|
6496 |
-
var mdown = bind$2(blocker.element(), 'mousedown', dragApi.forceDrop);
|
6497 |
-
var mup = bind$2(blocker.element(), 'mouseup', dragApi.drop);
|
6498 |
-
var mmove = bind$2(blocker.element(), 'mousemove', dragApi.move);
|
6499 |
-
var mout = bind$2(blocker.element(), 'mouseout', dragApi.delayDrop);
|
6500 |
-
var destroy = function () {
|
6501 |
-
blocker.destroy();
|
6502 |
-
mup.unbind();
|
6503 |
-
mmove.unbind();
|
6504 |
-
mout.unbind();
|
6505 |
-
mdown.unbind();
|
6506 |
-
};
|
6507 |
-
var start = function (parent) {
|
6508 |
-
append(parent, blocker.element());
|
6509 |
-
};
|
6510 |
-
var stop = function () {
|
6511 |
-
remove$2(blocker.element());
|
6512 |
-
};
|
6513 |
-
return DragApis.sink({
|
6514 |
-
element: blocker.element,
|
6515 |
-
start: start,
|
6516 |
-
stop: stop,
|
6517 |
-
destroy: destroy
|
6518 |
-
});
|
6519 |
-
};
|
6520 |
-
var MouseDrag = DragApis.mode({
|
6521 |
-
compare: compare,
|
6522 |
-
extract: extract$1,
|
6523 |
-
sink: sink$1,
|
6524 |
-
mutate: mutate$1
|
6525 |
});
|
6526 |
-
|
6527 |
-
|
6528 |
-
|
6529 |
-
|
6530 |
-
|
6531 |
-
|
6532 |
-
|
6533 |
-
var result = previous.map(function (old) {
|
6534 |
-
return mode.compare(old, nu);
|
6535 |
-
});
|
6536 |
-
previous = Option.some(nu);
|
6537 |
-
return result;
|
6538 |
-
};
|
6539 |
-
var onEvent = function (event, mode) {
|
6540 |
-
var dataOption = mode.extract(event);
|
6541 |
-
dataOption.each(function (data) {
|
6542 |
-
var offset = update(mode, data);
|
6543 |
-
offset.each(function (d) {
|
6544 |
-
events.trigger.move(d);
|
6545 |
-
});
|
6546 |
-
});
|
6547 |
-
};
|
6548 |
-
var events = Events.create({ move: Event(['info']) });
|
6549 |
-
return {
|
6550 |
-
onEvent: onEvent,
|
6551 |
-
reset: reset,
|
6552 |
-
events: events.registry
|
6553 |
-
};
|
6554 |
-
}
|
6555 |
-
|
6556 |
-
function NoDrag (anchor) {
|
6557 |
-
var onEvent = function (event, mode) {
|
6558 |
-
};
|
6559 |
-
return {
|
6560 |
-
onEvent: onEvent,
|
6561 |
-
reset: noop
|
6562 |
-
};
|
6563 |
-
}
|
6564 |
-
|
6565 |
-
function Movement () {
|
6566 |
-
var noDragState = NoDrag();
|
6567 |
-
var inDragState = InDrag();
|
6568 |
-
var dragState = noDragState;
|
6569 |
-
var on = function () {
|
6570 |
-
dragState.reset();
|
6571 |
-
dragState = inDragState;
|
6572 |
-
};
|
6573 |
-
var off = function () {
|
6574 |
-
dragState.reset();
|
6575 |
-
dragState = noDragState;
|
6576 |
-
};
|
6577 |
-
var onEvent = function (event, mode) {
|
6578 |
-
dragState.onEvent(event, mode);
|
6579 |
-
};
|
6580 |
-
var isOn = function () {
|
6581 |
-
return dragState === inDragState;
|
6582 |
-
};
|
6583 |
-
return {
|
6584 |
-
on: on,
|
6585 |
-
off: off,
|
6586 |
-
isOn: isOn,
|
6587 |
-
onEvent: onEvent,
|
6588 |
-
events: inDragState.events
|
6589 |
-
};
|
6590 |
-
}
|
6591 |
-
|
6592 |
-
var last$3 = function (fn, rate) {
|
6593 |
-
var timer = null;
|
6594 |
-
var cancel = function () {
|
6595 |
-
if (timer !== null) {
|
6596 |
-
clearTimeout(timer);
|
6597 |
-
timer = null;
|
6598 |
-
}
|
6599 |
-
};
|
6600 |
-
var throttle = function () {
|
6601 |
-
var args = [];
|
6602 |
-
for (var _i = 0; _i < arguments.length; _i++) {
|
6603 |
-
args[_i] = arguments[_i];
|
6604 |
-
}
|
6605 |
-
if (timer !== null)
|
6606 |
-
clearTimeout(timer);
|
6607 |
-
timer = setTimeout(function () {
|
6608 |
-
fn.apply(null, args);
|
6609 |
-
timer = null;
|
6610 |
-
}, rate);
|
6611 |
-
};
|
6612 |
-
return {
|
6613 |
-
cancel: cancel,
|
6614 |
-
throttle: throttle
|
6615 |
-
};
|
6616 |
-
};
|
6617 |
-
|
6618 |
-
var setup = function (mutation, mode, settings) {
|
6619 |
-
var active = false;
|
6620 |
-
var events = Events.create({
|
6621 |
-
start: Event([]),
|
6622 |
-
stop: Event([])
|
6623 |
-
});
|
6624 |
-
var movement = Movement();
|
6625 |
-
var drop = function () {
|
6626 |
-
sink.stop();
|
6627 |
-
if (movement.isOn()) {
|
6628 |
-
movement.off();
|
6629 |
-
events.trigger.stop();
|
6630 |
-
}
|
6631 |
-
};
|
6632 |
-
var throttledDrop = last$3(drop, 200);
|
6633 |
-
var go = function (parent) {
|
6634 |
-
sink.start(parent);
|
6635 |
-
movement.on();
|
6636 |
-
events.trigger.start();
|
6637 |
-
};
|
6638 |
-
var mousemove = function (event, ui) {
|
6639 |
-
throttledDrop.cancel();
|
6640 |
-
movement.onEvent(event, mode);
|
6641 |
-
};
|
6642 |
-
movement.events.move.bind(function (event) {
|
6643 |
-
mode.mutate(mutation, event.info());
|
6644 |
-
});
|
6645 |
-
var on = function () {
|
6646 |
-
active = true;
|
6647 |
-
};
|
6648 |
-
var off = function () {
|
6649 |
-
active = false;
|
6650 |
-
};
|
6651 |
-
var runIfActive = function (f) {
|
6652 |
-
return function () {
|
6653 |
-
var args = Array.prototype.slice.call(arguments, 0);
|
6654 |
-
if (active) {
|
6655 |
-
return f.apply(null, args);
|
6656 |
-
}
|
6657 |
-
};
|
6658 |
-
};
|
6659 |
-
var sink = mode.sink(DragApis.api({
|
6660 |
-
forceDrop: drop,
|
6661 |
-
drop: runIfActive(drop),
|
6662 |
-
move: runIfActive(mousemove),
|
6663 |
-
delayDrop: runIfActive(throttledDrop.throttle)
|
6664 |
-
}), settings);
|
6665 |
-
var destroy = function () {
|
6666 |
-
sink.destroy();
|
6667 |
-
};
|
6668 |
-
return {
|
6669 |
-
element: sink.element,
|
6670 |
-
go: go,
|
6671 |
-
on: on,
|
6672 |
-
off: off,
|
6673 |
-
destroy: destroy,
|
6674 |
-
events: events.registry
|
6675 |
-
};
|
6676 |
-
};
|
6677 |
-
var Dragging = { setup: setup };
|
6678 |
-
|
6679 |
-
var transform$1 = function (mutation, options) {
|
6680 |
-
var settings = options !== undefined ? options : {};
|
6681 |
-
var mode = settings.mode !== undefined ? settings.mode : MouseDrag;
|
6682 |
-
return Dragging.setup(mutation, mode, options);
|
6683 |
-
};
|
6684 |
-
var Dragger = { transform: transform$1 };
|
6685 |
-
|
6686 |
-
function Mutation () {
|
6687 |
-
var events = Events.create({
|
6688 |
-
'drag': Event([
|
6689 |
-
'xDelta',
|
6690 |
-
'yDelta'
|
6691 |
-
])
|
6692 |
-
});
|
6693 |
-
var mutate = function (x, y) {
|
6694 |
-
events.trigger.drag(x, y);
|
6695 |
-
};
|
6696 |
-
return {
|
6697 |
-
mutate: mutate,
|
6698 |
-
events: events.registry
|
6699 |
-
};
|
6700 |
}
|
6701 |
-
|
6702 |
-
|
6703 |
-
|
6704 |
-
|
6705 |
-
|
6706 |
-
|
6707 |
-
|
6708 |
-
|
6709 |
-
}
|
6710 |
-
var target = Option.none();
|
6711 |
-
var delegate = Mutation();
|
6712 |
-
delegate.events.drag.bind(function (event) {
|
6713 |
-
target.each(function (t) {
|
6714 |
-
events.trigger.drag(event.xDelta(), event.yDelta(), t);
|
6715 |
-
});
|
6716 |
-
});
|
6717 |
-
var assign = function (t) {
|
6718 |
-
target = Option.some(t);
|
6719 |
-
};
|
6720 |
-
var get = function () {
|
6721 |
-
return target;
|
6722 |
-
};
|
6723 |
-
return {
|
6724 |
-
assign: assign,
|
6725 |
-
get: get,
|
6726 |
-
mutate: delegate.mutate,
|
6727 |
-
events: events.registry
|
6728 |
-
};
|
6729 |
}
|
6730 |
-
|
6731 |
-
|
6732 |
-
|
6733 |
-
|
6734 |
-
|
6735 |
-
var resizeBarDragging = Styles.resolve('resizer-bar-dragging');
|
6736 |
-
function BarManager (wire, direction, hdirection) {
|
6737 |
-
var mutation = BarMutation();
|
6738 |
-
var resizing = Dragger.transform(mutation, {});
|
6739 |
-
var hoverTable = Option.none();
|
6740 |
-
var getResizer = function (element, type$$1) {
|
6741 |
-
return Option.from(get$1(element, type$$1));
|
6742 |
-
};
|
6743 |
-
mutation.events.drag.bind(function (event) {
|
6744 |
-
getResizer(event.target(), 'data-row').each(function (_dataRow) {
|
6745 |
-
var currentRow = CellUtils.getInt(event.target(), 'top');
|
6746 |
-
set$1(event.target(), 'top', currentRow + event.yDelta() + 'px');
|
6747 |
-
});
|
6748 |
-
getResizer(event.target(), 'data-column').each(function (_dataCol) {
|
6749 |
-
var currentCol = CellUtils.getInt(event.target(), 'left');
|
6750 |
-
set$1(event.target(), 'left', currentCol + event.xDelta() + 'px');
|
6751 |
-
});
|
6752 |
-
});
|
6753 |
-
var getDelta = function (target, direction) {
|
6754 |
-
var newX = CellUtils.getInt(target, direction);
|
6755 |
-
var oldX = parseInt(get$1(target, 'data-initial-' + direction), 10);
|
6756 |
-
return newX - oldX;
|
6757 |
-
};
|
6758 |
-
resizing.events.stop.bind(function () {
|
6759 |
-
mutation.get().each(function (target) {
|
6760 |
-
hoverTable.each(function (table) {
|
6761 |
-
getResizer(target, 'data-row').each(function (row) {
|
6762 |
-
var delta = getDelta(target, 'top');
|
6763 |
-
remove(target, 'data-initial-top');
|
6764 |
-
events.trigger.adjustHeight(table, delta, parseInt(row, 10));
|
6765 |
-
});
|
6766 |
-
getResizer(target, 'data-column').each(function (column) {
|
6767 |
-
var delta = getDelta(target, 'left');
|
6768 |
-
remove(target, 'data-initial-left');
|
6769 |
-
events.trigger.adjustWidth(table, delta, parseInt(column, 10));
|
6770 |
-
});
|
6771 |
-
Bars.refresh(wire, table, hdirection, direction);
|
6772 |
-
});
|
6773 |
-
});
|
6774 |
-
});
|
6775 |
-
var handler = function (target, direction) {
|
6776 |
-
events.trigger.startAdjust();
|
6777 |
-
mutation.assign(target);
|
6778 |
-
set(target, 'data-initial-' + direction, parseInt(get$2(target, direction), 10));
|
6779 |
-
add$2(target, resizeBarDragging);
|
6780 |
-
set$1(target, 'opacity', '0.2');
|
6781 |
-
resizing.go(wire.parent());
|
6782 |
-
};
|
6783 |
-
var mousedown = bind$2(wire.parent(), 'mousedown', function (event) {
|
6784 |
-
if (Bars.isRowBar(event.target()))
|
6785 |
-
handler(event.target(), 'top');
|
6786 |
-
if (Bars.isColBar(event.target()))
|
6787 |
-
handler(event.target(), 'left');
|
6788 |
-
});
|
6789 |
-
var isRoot = function (e) {
|
6790 |
-
return eq(e, wire.view());
|
6791 |
-
};
|
6792 |
-
var mouseover = bind$2(wire.view(), 'mouseover', function (event) {
|
6793 |
-
if (name(event.target()) === 'table' || closest$2(event.target(), 'table', isRoot)) {
|
6794 |
-
hoverTable = name(event.target()) === 'table' ? Option.some(event.target()) : ancestor$1(event.target(), 'table', isRoot);
|
6795 |
-
hoverTable.each(function (ht) {
|
6796 |
-
Bars.refresh(wire, ht, hdirection, direction);
|
6797 |
-
});
|
6798 |
-
} else if (inBody(event.target())) {
|
6799 |
-
Bars.destroy(wire);
|
6800 |
-
}
|
6801 |
-
});
|
6802 |
-
var destroy = function () {
|
6803 |
-
mousedown.unbind();
|
6804 |
-
mouseover.unbind();
|
6805 |
-
resizing.destroy();
|
6806 |
-
Bars.destroy(wire);
|
6807 |
-
};
|
6808 |
-
var refresh = function (tbl) {
|
6809 |
-
Bars.refresh(wire, tbl, hdirection, direction);
|
6810 |
-
};
|
6811 |
-
var events = Events.create({
|
6812 |
-
adjustHeight: Event([
|
6813 |
-
'table',
|
6814 |
-
'delta',
|
6815 |
-
'row'
|
6816 |
-
]),
|
6817 |
-
adjustWidth: Event([
|
6818 |
-
'table',
|
6819 |
-
'delta',
|
6820 |
-
'column'
|
6821 |
-
]),
|
6822 |
-
startAdjust: Event([])
|
6823 |
-
});
|
6824 |
-
return {
|
6825 |
-
destroy: destroy,
|
6826 |
-
refresh: refresh,
|
6827 |
-
on: resizing.on,
|
6828 |
-
off: resizing.off,
|
6829 |
-
hideBars: curry(Bars.hide, wire),
|
6830 |
-
showBars: curry(Bars.show, wire),
|
6831 |
-
events: events.registry
|
6832 |
-
};
|
6833 |
}
|
6834 |
-
|
6835 |
-
|
6836 |
-
var hdirection = BarPositions.height;
|
6837 |
-
var manager = BarManager(wire, vdirection, hdirection);
|
6838 |
-
var events = Events.create({
|
6839 |
-
beforeResize: Event(['table']),
|
6840 |
-
afterResize: Event(['table']),
|
6841 |
-
startDrag: Event([])
|
6842 |
-
});
|
6843 |
-
manager.events.adjustHeight.bind(function (event) {
|
6844 |
-
events.trigger.beforeResize(event.table());
|
6845 |
-
var delta = hdirection.delta(event.delta(), event.table());
|
6846 |
-
Adjustments.adjustHeight(event.table(), delta, event.row(), hdirection);
|
6847 |
-
events.trigger.afterResize(event.table());
|
6848 |
-
});
|
6849 |
-
manager.events.startAdjust.bind(function (event) {
|
6850 |
-
events.trigger.startDrag();
|
6851 |
-
});
|
6852 |
-
manager.events.adjustWidth.bind(function (event) {
|
6853 |
-
events.trigger.beforeResize(event.table());
|
6854 |
-
var delta = vdirection.delta(event.delta(), event.table());
|
6855 |
-
Adjustments.adjustWidth(event.table(), delta, event.column(), vdirection);
|
6856 |
-
events.trigger.afterResize(event.table());
|
6857 |
-
});
|
6858 |
-
return {
|
6859 |
-
on: manager.on,
|
6860 |
-
off: manager.off,
|
6861 |
-
hideBars: manager.hideBars,
|
6862 |
-
showBars: manager.showBars,
|
6863 |
-
destroy: manager.destroy,
|
6864 |
-
events: events.registry
|
6865 |
-
};
|
6866 |
}
|
6867 |
-
|
6868 |
-
|
6869 |
-
|
6870 |
-
|
6871 |
-
|
6872 |
-
|
6873 |
-
|
6874 |
-
|
6875 |
-
margin: '0',
|
6876 |
-
border: '0'
|
6877 |
-
});
|
6878 |
-
append(body(), container);
|
6879 |
-
return container;
|
6880 |
-
};
|
6881 |
-
var get$9 = function (editor, container) {
|
6882 |
-
return editor.inline ? ResizeWire.body(getBody$1(editor), createContainer()) : ResizeWire.only(Element$$1.fromDom(editor.getDoc()));
|
6883 |
-
};
|
6884 |
-
var remove$6 = function (editor, wire) {
|
6885 |
-
if (editor.inline) {
|
6886 |
-
remove$2(wire.parent());
|
6887 |
-
}
|
6888 |
-
};
|
6889 |
-
var TableWire = {
|
6890 |
-
get: get$9,
|
6891 |
-
remove: remove$6
|
6892 |
-
};
|
6893 |
-
|
6894 |
-
var ResizeHandler = function (editor) {
|
6895 |
-
var selectionRng = Option.none();
|
6896 |
-
var resize = Option.none();
|
6897 |
-
var wire = Option.none();
|
6898 |
-
var percentageBasedSizeRegex = /(\d+(\.\d+)?)%/;
|
6899 |
-
var startW, startRawW;
|
6900 |
-
var isTable = function (elm) {
|
6901 |
-
return elm.nodeName === 'TABLE';
|
6902 |
-
};
|
6903 |
-
var getRawWidth = function (elm) {
|
6904 |
-
return editor.dom.getStyle(elm, 'width') || editor.dom.getAttrib(elm, 'width');
|
6905 |
-
};
|
6906 |
-
var lazyResize = function () {
|
6907 |
-
return resize;
|
6908 |
-
};
|
6909 |
-
var lazyWire = function () {
|
6910 |
-
return wire.getOr(ResizeWire.only(Element$$1.fromDom(editor.getBody())));
|
6911 |
-
};
|
6912 |
-
var destroy = function () {
|
6913 |
-
resize.each(function (sz) {
|
6914 |
-
sz.destroy();
|
6915 |
-
});
|
6916 |
-
wire.each(function (w) {
|
6917 |
-
TableWire.remove(editor, w);
|
6918 |
-
});
|
6919 |
-
};
|
6920 |
-
editor.on('init', function () {
|
6921 |
-
var direction = TableDirection(Direction.directionAt);
|
6922 |
-
var rawWire = TableWire.get(editor);
|
6923 |
-
wire = Option.some(rawWire);
|
6924 |
-
if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {
|
6925 |
-
var sz = TableResize(rawWire, direction);
|
6926 |
-
sz.on();
|
6927 |
-
sz.events.startDrag.bind(function (event) {
|
6928 |
-
selectionRng = Option.some(editor.selection.getRng());
|
6929 |
-
});
|
6930 |
-
sz.events.beforeResize.bind(function (event) {
|
6931 |
-
var rawTable = event.table().dom();
|
6932 |
-
fireObjectResizeStart(editor, rawTable, getPixelWidth$1(rawTable), getPixelHeight(rawTable));
|
6933 |
-
});
|
6934 |
-
sz.events.afterResize.bind(function (event) {
|
6935 |
-
var table = event.table();
|
6936 |
-
var rawTable = table.dom();
|
6937 |
-
removeDataStyle(table);
|
6938 |
-
selectionRng.each(function (rng) {
|
6939 |
-
editor.selection.setRng(rng);
|
6940 |
-
editor.focus();
|
6941 |
-
});
|
6942 |
-
fireObjectResized(editor, rawTable, getPixelWidth$1(rawTable), getPixelHeight(rawTable));
|
6943 |
-
editor.undoManager.add();
|
6944 |
-
});
|
6945 |
-
resize = Option.some(sz);
|
6946 |
}
|
6947 |
-
|
6948 |
-
|
6949 |
-
|
6950 |
-
if (
|
6951 |
-
|
6952 |
-
startRawW = getRawWidth(targetElm);
|
6953 |
}
|
6954 |
-
|
6955 |
-
|
6956 |
-
|
6957 |
-
if (isTable(targetElm)) {
|
6958 |
-
var table = targetElm;
|
6959 |
-
if (percentageBasedSizeRegex.test(startRawW)) {
|
6960 |
-
var percentW = parseFloat(percentageBasedSizeRegex.exec(startRawW)[1]);
|
6961 |
-
var targetPercentW = e.width * percentW / startW;
|
6962 |
-
editor.dom.setStyle(table, 'width', targetPercentW + '%');
|
6963 |
-
} else {
|
6964 |
-
var newCellSizes_1 = [];
|
6965 |
-
global$1.each(table.rows, function (row) {
|
6966 |
-
global$1.each(row.cells, function (cell) {
|
6967 |
-
var width = editor.dom.getStyle(cell, 'width', true);
|
6968 |
-
newCellSizes_1.push({
|
6969 |
-
cell: cell,
|
6970 |
-
width: width
|
6971 |
-
});
|
6972 |
-
});
|
6973 |
-
});
|
6974 |
-
global$1.each(newCellSizes_1, function (newCellSize) {
|
6975 |
-
editor.dom.setStyle(newCellSize.cell, 'width', newCellSize.width);
|
6976 |
-
editor.dom.setAttrib(newCellSize.cell, 'width', null);
|
6977 |
-
});
|
6978 |
-
}
|
6979 |
}
|
6980 |
-
|
6981 |
-
|
6982 |
-
|
6983 |
-
|
6984 |
-
|
6985 |
-
};
|
6986 |
-
};
|
6987 |
-
|
6988 |
-
var none$2 = function (current) {
|
6989 |
-
return folder$1(function (n, f, m, l) {
|
6990 |
-
return n(current);
|
6991 |
-
});
|
6992 |
-
};
|
6993 |
-
var first$5 = function (current) {
|
6994 |
-
return folder$1(function (n, f, m, l) {
|
6995 |
-
return f(current);
|
6996 |
-
});
|
6997 |
-
};
|
6998 |
-
var middle$1 = function (current, target) {
|
6999 |
-
return folder$1(function (n, f, m, l) {
|
7000 |
-
return m(current, target);
|
7001 |
-
});
|
7002 |
-
};
|
7003 |
-
var last$4 = function (current) {
|
7004 |
-
return folder$1(function (n, f, m, l) {
|
7005 |
-
return l(current);
|
7006 |
-
});
|
7007 |
-
};
|
7008 |
-
var folder$1 = function (fold) {
|
7009 |
-
return { fold: fold };
|
7010 |
-
};
|
7011 |
-
var CellLocation = {
|
7012 |
-
none: none$2,
|
7013 |
-
first: first$5,
|
7014 |
-
middle: middle$1,
|
7015 |
-
last: last$4
|
7016 |
-
};
|
7017 |
-
|
7018 |
-
var detect$4 = function (current, isRoot) {
|
7019 |
-
return TableLookup.table(current, isRoot).bind(function (table) {
|
7020 |
-
var all = TableLookup.cells(table);
|
7021 |
-
var index = findIndex(all, function (x) {
|
7022 |
-
return eq(current, x);
|
7023 |
-
});
|
7024 |
-
return index.map(function (ind) {
|
7025 |
-
return {
|
7026 |
-
index: constant(ind),
|
7027 |
-
all: constant(all)
|
7028 |
-
};
|
7029 |
-
});
|
7030 |
-
});
|
7031 |
-
};
|
7032 |
-
var next = function (current, isRoot) {
|
7033 |
-
var detection = detect$4(current, isRoot);
|
7034 |
-
return detection.fold(function () {
|
7035 |
-
return CellLocation.none(current);
|
7036 |
-
}, function (info) {
|
7037 |
-
return info.index() + 1 < info.all().length ? CellLocation.middle(current, info.all()[info.index() + 1]) : CellLocation.last(current);
|
7038 |
-
});
|
7039 |
-
};
|
7040 |
-
var prev = function (current, isRoot) {
|
7041 |
-
var detection = detect$4(current, isRoot);
|
7042 |
-
return detection.fold(function () {
|
7043 |
-
return CellLocation.none();
|
7044 |
-
}, function (info) {
|
7045 |
-
return info.index() - 1 >= 0 ? CellLocation.middle(current, info.all()[info.index() - 1]) : CellLocation.first(current);
|
7046 |
-
});
|
7047 |
-
};
|
7048 |
-
var CellNavigation = {
|
7049 |
-
next: next,
|
7050 |
-
prev: prev
|
7051 |
-
};
|
7052 |
-
|
7053 |
-
var adt = Adt.generate([
|
7054 |
-
{ 'before': ['element'] },
|
7055 |
-
{
|
7056 |
-
'on': [
|
7057 |
-
'element',
|
7058 |
-
'offset'
|
7059 |
-
]
|
7060 |
-
},
|
7061 |
-
{ after: ['element'] }
|
7062 |
-
]);
|
7063 |
-
var cata$1 = function (subject, onBefore, onOn, onAfter) {
|
7064 |
-
return subject.fold(onBefore, onOn, onAfter);
|
7065 |
-
};
|
7066 |
-
var getStart = function (situ) {
|
7067 |
-
return situ.fold(identity, identity, identity);
|
7068 |
-
};
|
7069 |
-
var before$2 = adt.before;
|
7070 |
-
var on = adt.on;
|
7071 |
-
var after$2 = adt.after;
|
7072 |
-
var Situ = {
|
7073 |
-
before: before$2,
|
7074 |
-
on: on,
|
7075 |
-
after: after$2,
|
7076 |
-
cata: cata$1,
|
7077 |
-
getStart: getStart
|
7078 |
-
};
|
7079 |
-
|
7080 |
-
var type$2 = Adt.generate([
|
7081 |
-
{ domRange: ['rng'] },
|
7082 |
-
{
|
7083 |
-
relative: [
|
7084 |
-
'startSitu',
|
7085 |
-
'finishSitu'
|
7086 |
-
]
|
7087 |
-
},
|
7088 |
-
{
|
7089 |
-
exact: [
|
7090 |
-
'start',
|
7091 |
-
'soffset',
|
7092 |
-
'finish',
|
7093 |
-
'foffset'
|
7094 |
-
]
|
7095 |
-
}
|
7096 |
-
]);
|
7097 |
-
var range$2 = Immutable('start', 'soffset', 'finish', 'foffset');
|
7098 |
-
var getStart$1 = function (selection) {
|
7099 |
-
return selection.match({
|
7100 |
-
domRange: function (rng) {
|
7101 |
-
return Element$$1.fromDom(rng.startContainer);
|
7102 |
-
},
|
7103 |
-
relative: function (startSitu, finishSitu) {
|
7104 |
-
return Situ.getStart(startSitu);
|
7105 |
-
},
|
7106 |
-
exact: function (start, soffset, finish, foffset) {
|
7107 |
-
return start;
|
7108 |
}
|
7109 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7110 |
};
|
7111 |
-
|
7112 |
-
|
7113 |
-
|
7114 |
-
|
7115 |
-
|
7116 |
-
|
7117 |
-
|
7118 |
-
|
7119 |
-
|
7120 |
-
|
7121 |
-
|
7122 |
-
|
7123 |
-
|
7124 |
-
|
7125 |
-
};
|
7126 |
-
var after$3 = function (start, soffset, finish, foffset) {
|
7127 |
-
var r = makeRange(start, soffset, finish, foffset);
|
7128 |
-
var same = eq(start, finish) && soffset === foffset;
|
7129 |
-
return r.collapsed && !same;
|
7130 |
-
};
|
7131 |
-
|
7132 |
-
var selectNodeContents = function (win, element) {
|
7133 |
-
var rng = win.document.createRange();
|
7134 |
-
selectNodeContentsUsing(rng, element);
|
7135 |
-
return rng;
|
7136 |
-
};
|
7137 |
-
var selectNodeContentsUsing = function (rng, element) {
|
7138 |
-
rng.selectNodeContents(element.dom());
|
7139 |
-
};
|
7140 |
-
var setStart = function (rng, situ) {
|
7141 |
-
situ.fold(function (e) {
|
7142 |
-
rng.setStartBefore(e.dom());
|
7143 |
-
}, function (e, o) {
|
7144 |
-
rng.setStart(e.dom(), o);
|
7145 |
-
}, function (e) {
|
7146 |
-
rng.setStartAfter(e.dom());
|
7147 |
});
|
7148 |
-
}
|
7149 |
-
|
7150 |
-
|
7151 |
-
|
7152 |
-
|
7153 |
-
|
7154 |
-
}, function (e) {
|
7155 |
-
rng.setEndAfter(e.dom());
|
7156 |
});
|
7157 |
-
}
|
7158 |
-
|
7159 |
-
|
7160 |
-
|
7161 |
-
|
7162 |
-
|
7163 |
-
|
7164 |
-
|
7165 |
-
|
7166 |
-
|
7167 |
-
|
7168 |
-
|
7169 |
-
|
7170 |
-
|
7171 |
-
|
7172 |
-
|
7173 |
-
|
7174 |
-
right: constant(rect.right),
|
7175 |
-
bottom: constant(rect.bottom),
|
7176 |
-
width: constant(rect.width),
|
7177 |
-
height: constant(rect.height)
|
7178 |
-
};
|
7179 |
-
};
|
7180 |
-
var getFirstRect = function (rng) {
|
7181 |
-
var rects = rng.getClientRects();
|
7182 |
-
var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect();
|
7183 |
-
return rect.width > 0 || rect.height > 0 ? Option.some(rect).map(toRect) : Option.none();
|
7184 |
-
};
|
7185 |
-
|
7186 |
-
var adt$1 = Adt.generate([
|
7187 |
-
{
|
7188 |
-
ltr: [
|
7189 |
-
'start',
|
7190 |
-
'soffset',
|
7191 |
-
'finish',
|
7192 |
-
'foffset'
|
7193 |
-
]
|
7194 |
-
},
|
7195 |
-
{
|
7196 |
-
rtl: [
|
7197 |
-
'start',
|
7198 |
-
'soffset',
|
7199 |
-
'finish',
|
7200 |
-
'foffset'
|
7201 |
-
]
|
7202 |
}
|
7203 |
-
|
7204 |
-
|
7205 |
-
|
7206 |
-
}
|
7207 |
-
|
7208 |
-
|
7209 |
-
|
7210 |
-
|
7211 |
-
|
7212 |
-
|
7213 |
-
|
7214 |
-
|
7215 |
-
|
7216 |
-
|
7217 |
-
|
7218 |
-
|
7219 |
-
|
7220 |
-
rtl: cached(function () {
|
7221 |
-
return Option.some(relativeToNative(win, finishSitu, startSitu));
|
7222 |
-
})
|
7223 |
-
};
|
7224 |
-
},
|
7225 |
-
exact: function (start, soffset, finish, foffset) {
|
7226 |
-
return {
|
7227 |
-
ltr: cached(function () {
|
7228 |
-
return exactToNative(win, start, soffset, finish, foffset);
|
7229 |
-
}),
|
7230 |
-
rtl: cached(function () {
|
7231 |
-
return Option.some(exactToNative(win, finish, foffset, start, soffset));
|
7232 |
-
})
|
7233 |
-
};
|
7234 |
}
|
7235 |
-
});
|
7236 |
-
};
|
7237 |
-
var doDiagnose = function (win, ranges) {
|
7238 |
-
var rng = ranges.ltr();
|
7239 |
-
if (rng.collapsed) {
|
7240 |
-
var reversed = ranges.rtl().filter(function (rev) {
|
7241 |
-
return rev.collapsed === false;
|
7242 |
-
});
|
7243 |
-
return reversed.map(function (rev) {
|
7244 |
-
return adt$1.rtl(Element$$1.fromDom(rev.endContainer), rev.endOffset, Element$$1.fromDom(rev.startContainer), rev.startOffset);
|
7245 |
-
}).getOrThunk(function () {
|
7246 |
-
return fromRange(win, adt$1.ltr, rng);
|
7247 |
-
});
|
7248 |
} else {
|
7249 |
-
|
7250 |
}
|
7251 |
-
}
|
7252 |
-
|
7253 |
-
|
7254 |
-
|
7255 |
-
}
|
7256 |
-
|
7257 |
-
|
7258 |
-
|
7259 |
-
|
7260 |
-
|
7261 |
-
|
7262 |
-
|
7263 |
-
|
7264 |
-
|
7265 |
-
|
7266 |
-
|
7267 |
-
|
7268 |
-
|
7269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7270 |
}
|
7271 |
});
|
7272 |
-
|
7273 |
-
|
7274 |
-
|
7275 |
-
|
7276 |
-
var
|
7277 |
-
|
7278 |
-
|
7279 |
-
|
7280 |
-
|
7281 |
-
|
7282 |
-
|
7283 |
-
|
7284 |
-
|
7285 |
-
|
7286 |
-
|
7287 |
-
return i - 1;
|
7288 |
-
} else {
|
7289 |
-
xDelta = curDeltaX;
|
7290 |
-
}
|
7291 |
}
|
7292 |
-
}
|
7293 |
-
|
7294 |
-
|
7295 |
-
|
7296 |
-
return
|
7297 |
-
}
|
7298 |
-
|
7299 |
-
|
7300 |
-
|
7301 |
-
|
7302 |
-
|
7303 |
-
|
7304 |
-
|
|
|
7305 |
};
|
7306 |
-
|
7307 |
-
|
7308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7309 |
};
|
7310 |
-
|
7311 |
-
|
7312 |
-
|
7313 |
-
|
7314 |
-
|
7315 |
-
|
7316 |
-
|
7317 |
-
|
7318 |
-
|
7319 |
-
|
7320 |
-
|
7321 |
-
|
7322 |
-
|
7323 |
-
|
7324 |
-
|
7325 |
-
|
7326 |
-
|
7327 |
-
|
7328 |
-
|
7329 |
-
|
7330 |
-
|
7331 |
-
|
7332 |
-
|
7333 |
-
|
7334 |
-
|
7335 |
-
|
7336 |
-
|
7337 |
-
};
|
7338 |
-
var locate$1 = function (doc, node, x, y) {
|
7339 |
-
var r = doc.dom().createRange();
|
7340 |
-
r.selectNode(node.dom());
|
7341 |
-
var rect = r.getBoundingClientRect();
|
7342 |
-
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
7343 |
-
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
7344 |
-
return locateNode(doc, node, boundedX, boundedY);
|
7345 |
-
};
|
7346 |
-
|
7347 |
-
var COLLAPSE_TO_LEFT = true;
|
7348 |
-
var COLLAPSE_TO_RIGHT = false;
|
7349 |
-
var getCollapseDirection = function (rect, x) {
|
7350 |
-
return x - rect.left < rect.right - x ? COLLAPSE_TO_LEFT : COLLAPSE_TO_RIGHT;
|
7351 |
-
};
|
7352 |
-
var createCollapsedNode = function (doc, target, collapseDirection) {
|
7353 |
-
var r = doc.dom().createRange();
|
7354 |
-
r.selectNode(target.dom());
|
7355 |
-
r.collapse(collapseDirection);
|
7356 |
-
return r;
|
7357 |
-
};
|
7358 |
-
var locateInElement = function (doc, node, x) {
|
7359 |
-
var cursorRange = doc.dom().createRange();
|
7360 |
-
cursorRange.selectNode(node.dom());
|
7361 |
-
var rect = cursorRange.getBoundingClientRect();
|
7362 |
-
var collapseDirection = getCollapseDirection(rect, x);
|
7363 |
-
var f = collapseDirection === COLLAPSE_TO_LEFT ? first$3 : last$2;
|
7364 |
-
return f(node).map(function (target) {
|
7365 |
-
return createCollapsedNode(doc, target, collapseDirection);
|
7366 |
-
});
|
7367 |
-
};
|
7368 |
-
var locateInEmpty = function (doc, node, x) {
|
7369 |
-
var rect = node.dom().getBoundingClientRect();
|
7370 |
-
var collapseDirection = getCollapseDirection(rect, x);
|
7371 |
-
return Option.some(createCollapsedNode(doc, node, collapseDirection));
|
7372 |
-
};
|
7373 |
-
var search = function (doc, node, x) {
|
7374 |
-
var f = children(node).length === 0 ? locateInEmpty : locateInElement;
|
7375 |
-
return f(doc, node, x);
|
7376 |
-
};
|
7377 |
-
|
7378 |
-
var caretPositionFromPoint = function (doc, x, y) {
|
7379 |
-
return Option.from(doc.dom().caretPositionFromPoint(x, y)).bind(function (pos) {
|
7380 |
-
if (pos.offsetNode === null)
|
7381 |
-
return Option.none();
|
7382 |
-
var r = doc.dom().createRange();
|
7383 |
-
r.setStart(pos.offsetNode, pos.offset);
|
7384 |
-
r.collapse();
|
7385 |
-
return Option.some(r);
|
7386 |
-
});
|
7387 |
-
};
|
7388 |
-
var caretRangeFromPoint = function (doc, x, y) {
|
7389 |
-
return Option.from(doc.dom().caretRangeFromPoint(x, y));
|
7390 |
-
};
|
7391 |
-
var searchTextNodes = function (doc, node, x, y) {
|
7392 |
-
var r = doc.dom().createRange();
|
7393 |
-
r.selectNode(node.dom());
|
7394 |
-
var rect = r.getBoundingClientRect();
|
7395 |
-
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
7396 |
-
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
7397 |
-
return locate$1(doc, node, boundedX, boundedY);
|
7398 |
-
};
|
7399 |
-
var searchFromPoint = function (doc, x, y) {
|
7400 |
-
return Element$$1.fromPoint(doc, x, y).bind(function (elem) {
|
7401 |
-
var fallback = function () {
|
7402 |
-
return search(doc, elem, x);
|
7403 |
-
};
|
7404 |
-
return children(elem).length === 0 ? fallback() : searchTextNodes(doc, elem, x, y).orThunk(fallback);
|
7405 |
-
});
|
7406 |
-
};
|
7407 |
-
var availableSearch = document.caretPositionFromPoint ? caretPositionFromPoint : document.caretRangeFromPoint ? caretRangeFromPoint : searchFromPoint;
|
7408 |
-
var fromPoint$1 = function (win, x, y) {
|
7409 |
-
var doc = Element$$1.fromDom(win.document);
|
7410 |
-
return availableSearch(doc, x, y).map(function (rng) {
|
7411 |
-
return range$2(Element$$1.fromDom(rng.startContainer), rng.startOffset, Element$$1.fromDom(rng.endContainer), rng.endOffset);
|
7412 |
-
});
|
7413 |
-
};
|
7414 |
-
|
7415 |
-
var beforeSpecial = function (element, offset) {
|
7416 |
-
var name$$1 = name(element);
|
7417 |
-
if ('input' === name$$1)
|
7418 |
-
return Situ.after(element);
|
7419 |
-
else if (!contains([
|
7420 |
-
'br',
|
7421 |
-
'img'
|
7422 |
-
], name$$1))
|
7423 |
-
return Situ.on(element, offset);
|
7424 |
-
else
|
7425 |
-
return offset === 0 ? Situ.before(element) : Situ.after(element);
|
7426 |
-
};
|
7427 |
-
var preprocessRelative = function (startSitu, finishSitu) {
|
7428 |
-
var start = startSitu.fold(Situ.before, beforeSpecial, Situ.after);
|
7429 |
-
var finish = finishSitu.fold(Situ.before, beforeSpecial, Situ.after);
|
7430 |
-
return relative$1(start, finish);
|
7431 |
-
};
|
7432 |
-
var preprocessExact = function (start, soffset, finish, foffset) {
|
7433 |
-
var startSitu = beforeSpecial(start, soffset);
|
7434 |
-
var finishSitu = beforeSpecial(finish, foffset);
|
7435 |
-
return relative$1(startSitu, finishSitu);
|
7436 |
-
};
|
7437 |
-
var preprocess = function (selection) {
|
7438 |
-
return selection.match({
|
7439 |
-
domRange: function (rng) {
|
7440 |
-
var start = Element$$1.fromDom(rng.startContainer);
|
7441 |
-
var finish = Element$$1.fromDom(rng.endContainer);
|
7442 |
-
return preprocessExact(start, rng.startOffset, finish, rng.endOffset);
|
7443 |
-
},
|
7444 |
-
relative: preprocessRelative,
|
7445 |
-
exact: preprocessExact
|
7446 |
-
});
|
7447 |
-
};
|
7448 |
-
|
7449 |
-
var doSetNativeRange = function (win, rng) {
|
7450 |
-
Option.from(win.getSelection()).each(function (selection) {
|
7451 |
-
selection.removeAllRanges();
|
7452 |
-
selection.addRange(rng);
|
7453 |
-
});
|
7454 |
-
};
|
7455 |
-
var doSetRange = function (win, start, soffset, finish, foffset) {
|
7456 |
-
var rng = exactToNative(win, start, soffset, finish, foffset);
|
7457 |
-
doSetNativeRange(win, rng);
|
7458 |
-
};
|
7459 |
-
var setLegacyRtlRange = function (win, selection, start, soffset, finish, foffset) {
|
7460 |
-
selection.collapse(start.dom(), soffset);
|
7461 |
-
selection.extend(finish.dom(), foffset);
|
7462 |
-
};
|
7463 |
-
var setRangeFromRelative = function (win, relative) {
|
7464 |
-
return diagnose(win, relative).match({
|
7465 |
-
ltr: function (start, soffset, finish, foffset) {
|
7466 |
-
doSetRange(win, start, soffset, finish, foffset);
|
7467 |
},
|
7468 |
-
|
7469 |
-
|
7470 |
-
|
7471 |
-
|
7472 |
-
|
7473 |
-
|
7474 |
-
|
7475 |
-
|
7476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7477 |
}
|
7478 |
-
|
7479 |
-
|
7480 |
-
|
7481 |
-
|
7482 |
-
|
7483 |
-
|
7484 |
-
|
7485 |
-
|
7486 |
-
setRangeFromRelative(win, relative);
|
7487 |
-
};
|
7488 |
-
var setRelative = function (win, startSitu, finishSitu) {
|
7489 |
-
var relative = preprocessRelative(startSitu, finishSitu);
|
7490 |
-
setRangeFromRelative(win, relative);
|
7491 |
};
|
7492 |
-
|
7493 |
-
|
7494 |
-
|
7495 |
-
|
7496 |
-
|
7497 |
-
|
7498 |
-
|
7499 |
-
|
7500 |
-
|
|
|
|
|
|
|
|
|
|
|
7501 |
});
|
7502 |
-
}
|
7503 |
-
|
7504 |
-
|
7505 |
-
|
7506 |
-
|
7507 |
-
|
7508 |
-
} else {
|
7509 |
-
return Option.none();
|
7510 |
-
}
|
7511 |
-
};
|
7512 |
-
var doGetExact = function (selection) {
|
7513 |
-
var anchorNode = Element$$1.fromDom(selection.anchorNode);
|
7514 |
-
var focusNode = Element$$1.fromDom(selection.focusNode);
|
7515 |
-
return after$3(anchorNode, selection.anchorOffset, focusNode, selection.focusOffset) ? Option.some(range$2(Element$$1.fromDom(selection.anchorNode), selection.anchorOffset, Element$$1.fromDom(selection.focusNode), selection.focusOffset)) : readRange(selection);
|
7516 |
-
};
|
7517 |
-
var setToElement = function (win, element) {
|
7518 |
-
var rng = selectNodeContents(win, element);
|
7519 |
-
doSetNativeRange(win, rng);
|
7520 |
-
};
|
7521 |
-
var getExact = function (win) {
|
7522 |
-
return Option.from(win.getSelection()).filter(function (sel) {
|
7523 |
-
return sel.rangeCount > 0;
|
7524 |
-
}).bind(doGetExact);
|
7525 |
-
};
|
7526 |
-
var get$a = function (win) {
|
7527 |
-
return getExact(win).map(function (range) {
|
7528 |
-
return exact(range.start(), range.soffset(), range.finish(), range.foffset());
|
7529 |
});
|
7530 |
-
}
|
7531 |
-
|
7532 |
-
|
7533 |
-
return getFirstRect(rng);
|
7534 |
-
};
|
7535 |
-
var getAtPoint = function (win, x, y) {
|
7536 |
-
return fromPoint$1(win, x, y);
|
7537 |
-
};
|
7538 |
-
var clear$1 = function (win) {
|
7539 |
-
var selection = win.getSelection();
|
7540 |
-
selection.removeAllRanges();
|
7541 |
-
};
|
7542 |
|
7543 |
-
|
7544 |
|
7545 |
-
|
7546 |
-
|
7547 |
-
|
7548 |
-
|
7549 |
-
|
7550 |
-
}
|
7551 |
-
|
7552 |
-
|
7553 |
-
|
7554 |
-
|
7555 |
-
|
7556 |
-
|
7557 |
-
|
7558 |
-
|
7559 |
-
|
7560 |
-
|
7561 |
-
|
7562 |
-
|
7563 |
-
|
7564 |
-
|
7565 |
-
|
7566 |
-
|
7567 |
-
|
7568 |
-
|
7569 |
-
|
7570 |
-
|
7571 |
-
|
7572 |
-
|
7573 |
-
|
7574 |
-
|
7575 |
-
|
7576 |
-
|
7577 |
-
|
7578 |
-
var
|
7579 |
-
|
7580 |
-
|
7581 |
-
|
7582 |
-
|
7583 |
-
|
7584 |
-
if (event.keyCode === global$3.TAB) {
|
7585 |
-
var body_1 = getBody$1(editor);
|
7586 |
-
var isRoot_1 = function (element) {
|
7587 |
-
var name$$1 = name(element);
|
7588 |
-
return eq(element, body_1) || contains(rootElements, name$$1);
|
7589 |
-
};
|
7590 |
-
var rng = editor.selection.getRng();
|
7591 |
-
if (rng.collapsed) {
|
7592 |
-
var start = Element$$1.fromDom(rng.startContainer);
|
7593 |
-
TableLookup.cell(start, isRoot_1).each(function (cell) {
|
7594 |
-
event.preventDefault();
|
7595 |
-
var navigation = event.shiftKey ? backward : forward;
|
7596 |
-
var rng = navigation(editor, isRoot_1, cell, actions, lazyWire);
|
7597 |
-
rng.each(function (range$$1) {
|
7598 |
-
editor.selection.setRng(range$$1);
|
7599 |
-
});
|
7600 |
-
});
|
7601 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7602 |
}
|
7603 |
-
|
7604 |
-
|
7605 |
-
|
7606 |
-
|
7607 |
-
|
7608 |
-
|
7609 |
-
|
7610 |
-
|
7611 |
-
|
7612 |
-
|
7613 |
-
|
7614 |
-
var
|
7615 |
-
var
|
7616 |
-
var
|
7617 |
-
|
7618 |
-
|
7619 |
-
|
7620 |
-
|
7621 |
-
|
7622 |
-
|
7623 |
-
|
7624 |
-
|
7625 |
-
|
7626 |
-
|
7627 |
-
|
7628 |
-
|
7629 |
-
|
7630 |
-
|
7631 |
-
|
7632 |
-
|
7633 |
-
|
7634 |
-
|
7635 |
-
|
7636 |
-
|
7637 |
-
|
7638 |
-
|
7639 |
-
|
7640 |
-
|
7641 |
-
|
7642 |
-
|
7643 |
-
|
7644 |
-
|
7645 |
-
|
7646 |
-
|
7647 |
-
|
7648 |
-
|
7649 |
-
|
7650 |
-
|
7651 |
-
|
7652 |
-
|
7653 |
-
var
|
7654 |
-
|
7655 |
-
|
7656 |
-
|
7657 |
-
|
7658 |
-
|
7659 |
-
|
7660 |
-
var
|
7661 |
-
|
7662 |
-
|
7663 |
-
|
7664 |
-
|
7665 |
-
|
7666 |
-
|
7667 |
-
|
7668 |
-
|
7669 |
-
|
7670 |
-
|
7671 |
-
|
7672 |
-
|
7673 |
-
|
7674 |
-
|
7675 |
-
|
7676 |
-
|
7677 |
-
|
7678 |
-
|
7679 |
-
|
7680 |
-
|
7681 |
-
|
7682 |
-
|
7683 |
-
|
7684 |
-
|
7685 |
-
|
7686 |
-
|
7687 |
-
|
7688 |
-
|
7689 |
-
|
7690 |
-
|
7691 |
-
|
7692 |
-
|
7693 |
-
|
7694 |
-
|
7695 |
-
|
7696 |
-
|
7697 |
-
|
7698 |
-
|
7699 |
-
|
7700 |
-
|
7701 |
-
|
7702 |
-
|
7703 |
-
|
7704 |
-
|
7705 |
-
|
7706 |
-
|
7707 |
-
|
7708 |
-
|
7709 |
-
|
7710 |
-
|
7711 |
-
|
7712 |
-
|
7713 |
-
|
7714 |
-
|
7715 |
-
|
7716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7717 |
};
|
7718 |
-
|
7719 |
-
|
7720 |
-
|
7721 |
-
getRangedRect: getRangedRect,
|
7722 |
-
getSelection: getSelection,
|
7723 |
-
fromSitus: fromSitus,
|
7724 |
-
situsFromPoint: situsFromPoint,
|
7725 |
-
clearSelection: clearSelection,
|
7726 |
-
setSelection: setSelection,
|
7727 |
-
setRelativeSelection: setRelativeSelection,
|
7728 |
-
selectContents: selectContents,
|
7729 |
-
getInnerHeight: getInnerHeight,
|
7730 |
-
getScrollY: getScrollY,
|
7731 |
-
scrollBy: scrollBy
|
7732 |
};
|
7733 |
}
|
7734 |
-
|
7735 |
-
|
7736 |
-
|
7737 |
-
return closest$1(start, 'td,th', isRoot).bind(function (s) {
|
7738 |
-
return closest$1(finish, 'td,th', isRoot).bind(function (f) {
|
7739 |
-
return detect$5(container, isRoot, s, f, selectRange);
|
7740 |
-
});
|
7741 |
-
});
|
7742 |
-
} else {
|
7743 |
-
return Option.none();
|
7744 |
}
|
7745 |
-
|
7746 |
-
|
7747 |
-
|
7748 |
-
|
7749 |
-
|
7750 |
-
if (
|
7751 |
-
|
7752 |
-
|
7753 |
-
|
7754 |
-
|
|
|
|
|
7755 |
}
|
7756 |
-
})
|
7757 |
-
} else {
|
7758 |
-
return Option.none();
|
7759 |
-
}
|
7760 |
-
};
|
7761 |
-
var update = function (rows, columns, container, selected, annotations) {
|
7762 |
-
var updateSelection = function (newSels) {
|
7763 |
-
annotations.clear(container);
|
7764 |
-
annotations.selectRange(container, newSels.boxes(), newSels.start(), newSels.finish());
|
7765 |
-
return newSels.boxes();
|
7766 |
};
|
7767 |
-
|
7768 |
-
|
7769 |
-
|
7770 |
-
|
7771 |
-
|
7772 |
-
|
7773 |
-
|
7774 |
-
|
7775 |
-
|
7776 |
-
|
7777 |
-
|
7778 |
-
|
7779 |
-
|
7780 |
-
|
7781 |
-
|
7782 |
-
|
7783 |
-
|
7784 |
-
|
7785 |
-
|
7786 |
-
|
7787 |
-
|
7788 |
-
|
7789 |
-
|
7790 |
-
|
7791 |
-
|
7792 |
-
|
7793 |
-
|
7794 |
-
|
7795 |
-
|
7796 |
-
|
7797 |
-
|
7798 |
-
|
7799 |
-
|
7800 |
-
|
7801 |
-
|
7802 |
-
|
7803 |
-
|
7804 |
-
|
7805 |
-
|
7806 |
-
|
7807 |
-
|
7808 |
-
|
7809 |
-
|
7810 |
-
|
7811 |
-
|
7812 |
-
|
7813 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7814 |
};
|
7815 |
-
|
7816 |
-
|
7817 |
-
|
7818 |
-
|
7819 |
-
|
7820 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7821 |
});
|
7822 |
-
}
|
7823 |
-
|
7824 |
-
|
7825 |
-
|
7826 |
-
|
7827 |
-
|
7828 |
-
};
|
7829 |
-
var toString$1 = function (caret) {
|
7830 |
-
return '(' + caret.left() + ', ' + caret.top() + ') -> (' + caret.right() + ', ' + caret.bottom() + ')';
|
7831 |
-
};
|
7832 |
-
var Carets = {
|
7833 |
-
nu: nu$3,
|
7834 |
-
moveUp: moveUp,
|
7835 |
-
moveDown: moveDown,
|
7836 |
-
moveBottomTo: moveBottomTo,
|
7837 |
-
moveTopTo: moveTopTo,
|
7838 |
-
getTop: getTop$1,
|
7839 |
-
getBottom: getBottom,
|
7840 |
-
translate: translate,
|
7841 |
-
toString: toString$1
|
7842 |
-
};
|
7843 |
-
|
7844 |
-
var getPartialBox = function (bridge, element, offset) {
|
7845 |
-
if (offset >= 0 && offset < getEnd(element))
|
7846 |
-
return bridge.getRangedRect(element, offset, element, offset + 1);
|
7847 |
-
else if (offset > 0)
|
7848 |
-
return bridge.getRangedRect(element, offset - 1, element, offset);
|
7849 |
-
return Option.none();
|
7850 |
-
};
|
7851 |
-
var toCaret = function (rect) {
|
7852 |
-
return Carets.nu({
|
7853 |
-
left: rect.left,
|
7854 |
-
top: rect.top,
|
7855 |
-
right: rect.right,
|
7856 |
-
bottom: rect.bottom
|
7857 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7858 |
};
|
7859 |
-
var
|
7860 |
-
|
7861 |
-
|
7862 |
-
|
7863 |
-
|
7864 |
-
|
7865 |
-
else if (isText(element))
|
7866 |
-
return getPartialBox(bridge, element, offset).map(toCaret);
|
7867 |
-
else
|
7868 |
-
return Option.none();
|
7869 |
-
};
|
7870 |
-
var getEntireBox = function (bridge, element) {
|
7871 |
-
if (isElement(element))
|
7872 |
-
return getElemBox(bridge, element).map(toCaret);
|
7873 |
-
else if (isText(element))
|
7874 |
-
return bridge.getRangedRect(element, 0, element, getEnd(element)).map(toCaret);
|
7875 |
-
else
|
7876 |
-
return Option.none();
|
7877 |
-
};
|
7878 |
-
var Rectangles = {
|
7879 |
-
getBoxAt: getBoxAt,
|
7880 |
-
getEntireBox: getEntireBox
|
7881 |
};
|
7882 |
-
|
7883 |
-
|
7884 |
-
|
7885 |
-
|
7886 |
-
|
7887 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7888 |
});
|
7889 |
};
|
7890 |
-
var
|
7891 |
-
var
|
7892 |
-
|
7893 |
-
|
|
|
|
|
|
|
|
|
7894 |
});
|
7895 |
};
|
7896 |
-
var
|
7897 |
-
|
7898 |
-
|
7899 |
-
|
7900 |
-
|
7901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7902 |
});
|
7903 |
};
|
7904 |
-
|
7905 |
-
{
|
7906 |
-
|
7907 |
-
next: sidestep,
|
7908 |
-
fallback: Option.none()
|
7909 |
},
|
7910 |
-
{
|
7911 |
-
|
7912 |
-
next: advance,
|
7913 |
-
fallback: Option.some(backtrack)
|
7914 |
},
|
7915 |
-
{
|
7916 |
-
|
7917 |
-
|
7918 |
-
|
7919 |
-
|
7920 |
-
|
7921 |
-
|
7922 |
-
|
7923 |
-
|
7924 |
-
|
7925 |
-
|
7926 |
-
|
7927 |
-
|
7928 |
-
|
7929 |
-
|
7930 |
-
|
7931 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7932 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7933 |
};
|
7934 |
-
var
|
7935 |
-
|
7936 |
-
|
7937 |
-
advance: advance,
|
7938 |
-
go: go$1
|
7939 |
-
};
|
7940 |
-
|
7941 |
-
var left$1 = function () {
|
7942 |
-
var sibling = function (universe, item) {
|
7943 |
-
return universe.query().prevSibling(item);
|
7944 |
-
};
|
7945 |
-
var first = function (children) {
|
7946 |
-
return children.length > 0 ? Option.some(children[children.length - 1]) : Option.none();
|
7947 |
-
};
|
7948 |
-
return {
|
7949 |
-
sibling: sibling,
|
7950 |
-
first: first
|
7951 |
-
};
|
7952 |
-
};
|
7953 |
-
var right$1 = function () {
|
7954 |
-
var sibling = function (universe, item) {
|
7955 |
-
return universe.query().nextSibling(item);
|
7956 |
-
};
|
7957 |
-
var first = function (children) {
|
7958 |
-
return children.length > 0 ? Option.some(children[0]) : Option.none();
|
7959 |
-
};
|
7960 |
-
return {
|
7961 |
-
sibling: sibling,
|
7962 |
-
first: first
|
7963 |
-
};
|
7964 |
-
};
|
7965 |
-
var Walkers = {
|
7966 |
-
left: left$1,
|
7967 |
-
right: right$1
|
7968 |
-
};
|
7969 |
-
|
7970 |
-
var hone = function (universe, item, predicate, mode, direction, isRoot) {
|
7971 |
-
var next = Walker.go(universe, item, mode, direction);
|
7972 |
-
return next.bind(function (n) {
|
7973 |
-
if (isRoot(n.item()))
|
7974 |
-
return Option.none();
|
7975 |
-
else
|
7976 |
-
return predicate(n.item()) ? Option.some(n.item()) : hone(universe, n.item(), predicate, n.mode(), direction, isRoot);
|
7977 |
});
|
7978 |
};
|
7979 |
-
var
|
7980 |
-
|
7981 |
-
|
7982 |
-
|
7983 |
-
|
7984 |
};
|
7985 |
-
|
7986 |
-
|
7987 |
-
|
|
|
7988 |
};
|
|
|
7989 |
|
7990 |
-
|
7991 |
-
|
7992 |
-
};
|
7993 |
-
var before$3 = function (universe, item, isRoot) {
|
7994 |
-
return seekLeft(universe, item, curry(isLeaf, universe), isRoot);
|
7995 |
-
};
|
7996 |
-
var after$4 = function (universe, item, isRoot) {
|
7997 |
-
return seekRight(universe, item, curry(isLeaf, universe), isRoot);
|
7998 |
-
};
|
7999 |
-
var seekLeft = function (universe, item, predicate, isRoot) {
|
8000 |
-
return Seeker.left(universe, item, predicate, isRoot);
|
8001 |
-
};
|
8002 |
-
var seekRight = function (universe, item, predicate, isRoot) {
|
8003 |
-
return Seeker.right(universe, item, predicate, isRoot);
|
8004 |
-
};
|
8005 |
-
var walkers = function () {
|
8006 |
return {
|
8007 |
-
|
8008 |
-
|
8009 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8010 |
};
|
8011 |
-
var
|
8012 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8013 |
};
|
8014 |
-
var
|
8015 |
-
|
8016 |
-
|
8017 |
-
|
8018 |
-
|
8019 |
-
walkers: walkers,
|
8020 |
-
walk: walk,
|
8021 |
-
backtrack: Walker.backtrack,
|
8022 |
-
sidestep: Walker.sidestep,
|
8023 |
-
advance: Walker.advance
|
8024 |
};
|
|
|
8025 |
|
8026 |
-
|
8027 |
-
var
|
8028 |
-
return Gather.gather(universe$2, element, prune, transform);
|
8029 |
-
};
|
8030 |
-
var before$4 = function (element, isRoot) {
|
8031 |
-
return Gather.before(universe$2, element, isRoot);
|
8032 |
-
};
|
8033 |
-
var after$5 = function (element, isRoot) {
|
8034 |
-
return Gather.after(universe$2, element, isRoot);
|
8035 |
-
};
|
8036 |
-
var seekLeft$1 = function (element, predicate, isRoot) {
|
8037 |
-
return Gather.seekLeft(universe$2, element, predicate, isRoot);
|
8038 |
};
|
8039 |
-
|
8040 |
-
|
8041 |
-
|
8042 |
-
var walkers$1 = function () {
|
8043 |
-
return Gather.walkers();
|
8044 |
-
};
|
8045 |
-
var walk$1 = function (item, mode, direction, _rules) {
|
8046 |
-
return Gather.walk(universe$2, item, mode, direction, _rules);
|
8047 |
-
};
|
8048 |
-
var DomGather = {
|
8049 |
-
gather: gather,
|
8050 |
-
before: before$4,
|
8051 |
-
after: after$5,
|
8052 |
-
seekLeft: seekLeft$1,
|
8053 |
-
seekRight: seekRight$1,
|
8054 |
-
walkers: walkers$1,
|
8055 |
-
walk: walk$1
|
8056 |
};
|
|
|
8057 |
|
8058 |
-
|
8059 |
-
var
|
8060 |
-
var
|
8061 |
-
|
8062 |
-
|
8063 |
-
|
8064 |
-
|
8065 |
-
return caret.left() < box.left() || Math.abs(box.right() - caret.left()) < 1 || caret.left() > box.right();
|
8066 |
-
};
|
8067 |
-
var inOutsideBlock = function (bridge, element, caret) {
|
8068 |
-
return closest(element, DomStructure.isBlock).fold(constant(false), function (cell) {
|
8069 |
-
return Rectangles.getEntireBox(bridge, cell).exists(function (box) {
|
8070 |
-
return isOutside(caret, box);
|
8071 |
-
});
|
8072 |
-
});
|
8073 |
-
};
|
8074 |
-
var adjustDown = function (bridge, element, guessBox, original, caret) {
|
8075 |
-
var lowerCaret = Carets.moveDown(caret, JUMP_SIZE);
|
8076 |
-
if (Math.abs(guessBox.bottom() - original.bottom()) < 1)
|
8077 |
-
return adt$2.retry(lowerCaret);
|
8078 |
-
else if (guessBox.top() > caret.bottom())
|
8079 |
-
return adt$2.retry(lowerCaret);
|
8080 |
-
else if (guessBox.top() === caret.bottom())
|
8081 |
-
return adt$2.retry(Carets.moveDown(caret, 1));
|
8082 |
-
else
|
8083 |
-
return inOutsideBlock(bridge, element, caret) ? adt$2.retry(Carets.translate(lowerCaret, JUMP_SIZE, 0)) : adt$2.none();
|
8084 |
-
};
|
8085 |
-
var adjustUp = function (bridge, element, guessBox, original, caret) {
|
8086 |
-
var higherCaret = Carets.moveUp(caret, JUMP_SIZE);
|
8087 |
-
if (Math.abs(guessBox.top() - original.top()) < 1)
|
8088 |
-
return adt$2.retry(higherCaret);
|
8089 |
-
else if (guessBox.bottom() < caret.top())
|
8090 |
-
return adt$2.retry(higherCaret);
|
8091 |
-
else if (guessBox.bottom() === caret.top())
|
8092 |
-
return adt$2.retry(Carets.moveUp(caret, 1));
|
8093 |
-
else
|
8094 |
-
return inOutsideBlock(bridge, element, caret) ? adt$2.retry(Carets.translate(higherCaret, JUMP_SIZE, 0)) : adt$2.none();
|
8095 |
-
};
|
8096 |
-
var upMovement = {
|
8097 |
-
point: Carets.getTop,
|
8098 |
-
adjuster: adjustUp,
|
8099 |
-
move: Carets.moveUp,
|
8100 |
-
gather: DomGather.before
|
8101 |
-
};
|
8102 |
-
var downMovement = {
|
8103 |
-
point: Carets.getBottom,
|
8104 |
-
adjuster: adjustDown,
|
8105 |
-
move: Carets.moveDown,
|
8106 |
-
gather: DomGather.after
|
8107 |
-
};
|
8108 |
-
var isAtTable = function (bridge, x, y) {
|
8109 |
-
return bridge.elementFromPoint(x, y).filter(function (elm) {
|
8110 |
-
return name(elm) === 'table';
|
8111 |
-
}).isSome();
|
8112 |
-
};
|
8113 |
-
var adjustForTable = function (bridge, movement, original, caret, numRetries) {
|
8114 |
-
return adjustTil(bridge, movement, original, movement.move(caret, JUMP_SIZE), numRetries);
|
8115 |
-
};
|
8116 |
-
var adjustTil = function (bridge, movement, original, caret, numRetries) {
|
8117 |
-
if (numRetries === 0)
|
8118 |
-
return Option.some(caret);
|
8119 |
-
if (isAtTable(bridge, caret.left(), movement.point(caret)))
|
8120 |
-
return adjustForTable(bridge, movement, original, caret, numRetries - 1);
|
8121 |
-
return bridge.situsFromPoint(caret.left(), movement.point(caret)).bind(function (guess) {
|
8122 |
-
return guess.start().fold(Option.none, function (element, offset) {
|
8123 |
-
return Rectangles.getEntireBox(bridge, element, offset).bind(function (guessBox) {
|
8124 |
-
return movement.adjuster(bridge, element, guessBox, original, caret).fold(Option.none, function (newCaret) {
|
8125 |
-
return adjustTil(bridge, movement, original, newCaret, numRetries - 1);
|
8126 |
-
});
|
8127 |
-
}).orThunk(function () {
|
8128 |
-
return Option.some(caret);
|
8129 |
-
});
|
8130 |
-
}, Option.none);
|
8131 |
-
});
|
8132 |
-
};
|
8133 |
-
var ieTryDown = function (bridge, caret) {
|
8134 |
-
return bridge.situsFromPoint(caret.left(), caret.bottom() + JUMP_SIZE);
|
8135 |
};
|
8136 |
-
var
|
8137 |
-
|
|
|
8138 |
};
|
8139 |
-
var
|
8140 |
-
|
8141 |
-
return Option.some(movement.point(adjusted) - bridge.getInnerHeight());
|
8142 |
-
else if (movement.point(adjusted) < 0)
|
8143 |
-
return Option.some(-movement.point(adjusted));
|
8144 |
-
else
|
8145 |
-
return Option.none();
|
8146 |
};
|
8147 |
-
var
|
8148 |
-
|
8149 |
-
var adjusted = adjustTil(bridge, movement, caret, moved, NUM_RETRIES).getOr(moved);
|
8150 |
-
return checkScroll(movement, adjusted, bridge).fold(function () {
|
8151 |
-
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted));
|
8152 |
-
}, function (delta) {
|
8153 |
-
bridge.scrollBy(0, delta);
|
8154 |
-
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted) - delta);
|
8155 |
-
});
|
8156 |
};
|
8157 |
-
|
8158 |
-
|
8159 |
-
|
8160 |
-
|
8161 |
-
|
8162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8163 |
};
|
8164 |
-
|
8165 |
-
|
8166 |
-
|
8167 |
-
|
8168 |
-
|
8169 |
-
|
8170 |
-
|
8171 |
-
|
8172 |
-
|
8173 |
-
|
8174 |
-
|
8175 |
-
};
|
8176 |
-
|
8177 |
-
|
8178 |
-
|
8179 |
-
|
8180 |
-
|
8181 |
-
|
8182 |
-
|
8183 |
-
|
8184 |
-
|
8185 |
-
|
8186 |
-
|
8187 |
-
|
8188 |
-
|
8189 |
-
|
8190 |
-
|
8191 |
-
|
8192 |
-
|
|
|
|
|
8193 |
};
|
8194 |
-
var
|
8195 |
-
|
|
|
|
|
|
|
8196 |
};
|
8197 |
-
var
|
8198 |
-
|
|
|
8199 |
};
|
8200 |
-
|
8201 |
-
|
8202 |
-
|
8203 |
-
|
|
|
8204 |
};
|
8205 |
-
|
8206 |
-
|
8207 |
-
var delta = Immutable('element', 'deltaOffset');
|
8208 |
-
var range$3 = Immutable('element', 'start', 'finish');
|
8209 |
-
var points = Immutable('begin', 'end');
|
8210 |
-
var text = Immutable('element', 'text');
|
8211 |
-
var Spot = {
|
8212 |
-
point: point,
|
8213 |
-
delta: delta,
|
8214 |
-
range: range$3,
|
8215 |
-
points: points,
|
8216 |
-
text: text
|
8217 |
-
};
|
8218 |
-
|
8219 |
-
var inAncestor = Immutable('ancestor', 'descendants', 'element', 'index');
|
8220 |
-
var inParent = Immutable('parent', 'children', 'element', 'index');
|
8221 |
-
var indexInParent = function (element) {
|
8222 |
-
return parent(element).bind(function (parent$$1) {
|
8223 |
-
var children$$1 = children(parent$$1);
|
8224 |
-
return indexOf$1(children$$1, element).map(function (index) {
|
8225 |
-
return inParent(parent$$1, children$$1, element, index);
|
8226 |
-
});
|
8227 |
-
});
|
8228 |
};
|
8229 |
-
var
|
8230 |
-
return
|
|
|
|
|
|
|
|
|
|
|
8231 |
};
|
8232 |
-
|
8233 |
-
|
8234 |
-
|
|
|
|
|
|
|
|
|
|
|
8235 |
};
|
8236 |
-
|
8237 |
-
|
8238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8239 |
});
|
8240 |
-
};
|
8241 |
-
var
|
8242 |
-
|
8243 |
-
|
8244 |
-
|
8245 |
-
|
8246 |
-
|
8247 |
-
|
8248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8249 |
});
|
8250 |
-
};
|
8251 |
-
var
|
8252 |
-
|
8253 |
-
|
8254 |
-
|
8255 |
-
|
8256 |
-
|
8257 |
-
|
|
|
|
|
|
|
|
|
|
|
8258 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
8259 |
});
|
8260 |
});
|
8261 |
-
};
|
8262 |
-
var
|
8263 |
-
|
8264 |
-
|
8265 |
-
|
8266 |
-
|
8267 |
-
|
8268 |
-
|
8269 |
-
|
8270 |
-
|
8271 |
-
|
8272 |
-
|
8273 |
-
|
8274 |
-
|
8275 |
-
|
8276 |
-
|
8277 |
-
|
8278 |
-
|
8279 |
-
|
8280 |
-
|
8281 |
-
|
8282 |
-
|
8283 |
-
|
8284 |
-
process: process
|
8285 |
-
};
|
8286 |
-
|
8287 |
-
var MAX_RETRIES = 20;
|
8288 |
-
var platform$1 = PlatformDetection$1.detect();
|
8289 |
-
var findSpot = function (bridge, isRoot, direction) {
|
8290 |
-
return bridge.getSelection().bind(function (sel) {
|
8291 |
-
return BrTags.tryBr(isRoot, sel.finish(), sel.foffset(), direction).fold(function () {
|
8292 |
-
return Option.some(Spot.point(sel.finish(), sel.foffset()));
|
8293 |
-
}, function (brNeighbour) {
|
8294 |
-
var range = bridge.fromSitus(brNeighbour);
|
8295 |
-
var analysis = BeforeAfter.verify(bridge, sel.finish(), sel.foffset(), range.finish(), range.foffset(), direction.failure, isRoot);
|
8296 |
-
return BrTags.process(analysis);
|
8297 |
-
});
|
8298 |
-
});
|
8299 |
-
};
|
8300 |
-
var scan = function (bridge, isRoot, element, offset, direction, numRetries) {
|
8301 |
-
if (numRetries === 0)
|
8302 |
-
return Option.none();
|
8303 |
-
return tryCursor(bridge, isRoot, element, offset, direction).bind(function (situs) {
|
8304 |
-
var range = bridge.fromSitus(situs);
|
8305 |
-
var analysis = BeforeAfter.verify(bridge, element, offset, range.finish(), range.foffset(), direction.failure, isRoot);
|
8306 |
-
return BeforeAfter.cata(analysis, function () {
|
8307 |
-
return Option.none();
|
8308 |
-
}, function () {
|
8309 |
-
return Option.some(situs);
|
8310 |
-
}, function (cell) {
|
8311 |
-
if (eq(element, cell) && offset === 0)
|
8312 |
-
return tryAgain(bridge, element, offset, Carets.moveUp, direction);
|
8313 |
-
else
|
8314 |
-
return scan(bridge, isRoot, cell, 0, direction, numRetries - 1);
|
8315 |
-
}, function (cell) {
|
8316 |
-
if (eq(element, cell) && offset === getEnd(cell))
|
8317 |
-
return tryAgain(bridge, element, offset, Carets.moveDown, direction);
|
8318 |
-
else
|
8319 |
-
return scan(bridge, isRoot, cell, getEnd(cell), direction, numRetries - 1);
|
8320 |
});
|
8321 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8322 |
};
|
8323 |
-
var
|
8324 |
-
return
|
8325 |
-
return tryAt(bridge, direction, move(box, Retries.getJumpSize()));
|
8326 |
-
});
|
8327 |
};
|
8328 |
-
var
|
8329 |
-
|
8330 |
-
return direction.otherRetry(bridge, box);
|
8331 |
-
else if (platform$1.browser.isIE())
|
8332 |
-
return direction.ieRetry(bridge, box);
|
8333 |
-
else
|
8334 |
-
return Option.none();
|
8335 |
};
|
8336 |
-
var
|
8337 |
-
return
|
8338 |
-
return tryAt(bridge, direction, box);
|
8339 |
-
});
|
8340 |
};
|
8341 |
-
var
|
8342 |
-
|
8343 |
-
|
8344 |
});
|
8345 |
-
|
8346 |
-
|
8347 |
-
|
8348 |
-
var ancestor$3 = function (scope, predicate, isRoot) {
|
8349 |
-
return ancestor(scope, predicate, isRoot).isSome();
|
8350 |
-
};
|
8351 |
-
|
8352 |
-
var detection = PlatformDetection$1.detect();
|
8353 |
-
var inSameTable = function (elem, table) {
|
8354 |
-
return ancestor$3(elem, function (e) {
|
8355 |
-
return parent(e).exists(function (p) {
|
8356 |
-
return eq(p, table);
|
8357 |
-
});
|
8358 |
});
|
8359 |
};
|
8360 |
-
|
8361 |
-
|
8362 |
-
|
8363 |
-
|
8364 |
-
|
8365 |
-
|
8366 |
-
|
8367 |
-
|
8368 |
-
|
8369 |
-
finish: constant(finish),
|
8370 |
-
range: constant(range)
|
8371 |
-
};
|
8372 |
-
});
|
8373 |
-
});
|
8374 |
});
|
8375 |
-
|
8376 |
-
|
8377 |
-
|
8378 |
-
|
8379 |
-
|
8380 |
-
|
8381 |
-
|
8382 |
-
|
8383 |
-
|
8384 |
-
|
|
|
8385 |
});
|
|
|
|
|
8386 |
});
|
|
|
8387 |
}
|
8388 |
-
};
|
8389 |
-
|
8390 |
-
|
8391 |
-
|
8392 |
-
|
8393 |
-
|
8394 |
-
|
8395 |
-
|
8396 |
-
|
8397 |
-
|
8398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8399 |
});
|
8400 |
-
}
|
8401 |
-
|
8402 |
-
|
8403 |
-
|
8404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8405 |
};
|
8406 |
-
|
8407 |
-
|
8408 |
-
|
8409 |
-
|
8410 |
-
|
8411 |
-
|
8412 |
-
|
8413 |
-
|
8414 |
-
|
8415 |
-
|
8416 |
-
|
8417 |
-
|
8418 |
-
|
8419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8420 |
});
|
8421 |
-
|
8422 |
-
|
8423 |
-
|
8424 |
-
|
|
|
8425 |
});
|
8426 |
-
};
|
8427 |
-
|
8428 |
-
|
8429 |
-
|
8430 |
-
|
8431 |
-
|
8432 |
-
}
|
8433 |
-
|
8434 |
-
|
8435 |
-
|
8436 |
-
|
8437 |
-
|
8438 |
-
|
8439 |
-
|
8440 |
-
|
8441 |
-
|
8442 |
-
|
8443 |
-
|
8444 |
-
|
8445 |
-
|
8446 |
-
|
8447 |
-
|
8448 |
-
|
8449 |
-
|
8450 |
-
|
8451 |
-
|
8452 |
-
|
8453 |
-
|
8454 |
-
|
8455 |
-
|
8456 |
-
|
8457 |
-
|
8458 |
-
|
8459 |
-
|
8460 |
-
|
8461 |
-
|
8462 |
-
|
8463 |
-
|
8464 |
-
|
8465 |
-
|
8466 |
-
|
8467 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8468 |
}
|
8469 |
-
|
8470 |
-
|
8471 |
-
|
8472 |
-
|
8473 |
-
|
8474 |
-
|
8475 |
-
|
8476 |
-
|
8477 |
-
|
8478 |
},
|
8479 |
-
|
8480 |
-
|
8481 |
-
|
8482 |
-
|
8483 |
-
|
8484 |
-
ieRetry: Retries.ieTryUp,
|
8485 |
-
failure: BeforeAfter.adt.failedUp
|
8486 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8487 |
};
|
8488 |
-
|
8489 |
-
|
8490 |
-
|
8491 |
-
|
8492 |
-
|
8493 |
-
|
8494 |
-
|
8495 |
-
|
8496 |
-
|
8497 |
-
|
8498 |
-
|
8499 |
-
var
|
8500 |
-
|
8501 |
-
|
8502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8503 |
return Option.none();
|
8504 |
-
|
8505 |
-
|
8506 |
-
|
8507 |
-
|
8508 |
-
|
8509 |
-
|
8510 |
-
|
8511 |
-
|
8512 |
-
|
8513 |
-
|
8514 |
-
|
8515 |
-
|
8516 |
-
|
8517 |
-
|
8518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8519 |
}
|
8520 |
-
}
|
8521 |
-
|
8522 |
-
|
8523 |
-
|
8524 |
-
|
8525 |
-
|
8526 |
-
|
8527 |
-
|
8528 |
-
|
8529 |
-
|
8530 |
-
|
8531 |
-
|
8532 |
-
|
8533 |
-
|
8534 |
-
|
8535 |
-
|
8536 |
-
|
8537 |
-
|
8538 |
-
|
8539 |
-
|
8540 |
-
|
8541 |
-
|
8542 |
-
|
8543 |
-
|
8544 |
-
|
8545 |
-
|
8546 |
-
|
8547 |
-
|
8548 |
-
|
8549 |
-
|
8550 |
-
|
8551 |
-
|
8552 |
-
|
8553 |
-
|
8554 |
-
|
8555 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8556 |
});
|
8557 |
-
return
|
8558 |
-
};
|
8559 |
-
|
8560 |
-
|
8561 |
-
|
8562 |
-
|
8563 |
-
|
8564 |
-
|
8565 |
-
|
8566 |
-
|
8567 |
-
|
8568 |
-
|
8569 |
-
|
8570 |
-
|
8571 |
-
|
8572 |
-
|
8573 |
-
|
8574 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8575 |
};
|
8576 |
-
var
|
8577 |
-
|
8578 |
-
keyboard: keyboard
|
8579 |
};
|
8580 |
-
|
8581 |
-
|
8582 |
-
each(classes, function (x) {
|
8583 |
-
remove$5(element, x);
|
8584 |
-
});
|
8585 |
};
|
8586 |
-
|
8587 |
-
|
8588 |
-
return function (element) {
|
8589 |
-
add$2(element, clazz);
|
8590 |
-
};
|
8591 |
};
|
8592 |
-
var
|
8593 |
-
|
8594 |
-
remove$7(element, classes);
|
8595 |
-
};
|
8596 |
};
|
8597 |
-
|
8598 |
-
|
8599 |
-
var addSelectionClass = addClass(ephemera.selected());
|
8600 |
-
var removeSelectionClasses = removeClasses([
|
8601 |
-
ephemera.selected(),
|
8602 |
-
ephemera.lastSelected(),
|
8603 |
-
ephemera.firstSelected()
|
8604 |
-
]);
|
8605 |
-
var clear = function (container) {
|
8606 |
-
var sels = descendants$1(container, ephemera.selectedSelector());
|
8607 |
-
each(sels, removeSelectionClasses);
|
8608 |
-
};
|
8609 |
-
var selectRange = function (container, cells, start, finish) {
|
8610 |
-
clear(container);
|
8611 |
-
each(cells, addSelectionClass);
|
8612 |
-
add$2(start, ephemera.firstSelected());
|
8613 |
-
add$2(finish, ephemera.lastSelected());
|
8614 |
-
};
|
8615 |
-
return {
|
8616 |
-
clear: clear,
|
8617 |
-
selectRange: selectRange,
|
8618 |
-
selectedSelector: ephemera.selectedSelector,
|
8619 |
-
firstSelectedSelector: ephemera.firstSelectedSelector,
|
8620 |
-
lastSelectedSelector: ephemera.lastSelectedSelector
|
8621 |
-
};
|
8622 |
};
|
8623 |
-
var
|
8624 |
-
var
|
8625 |
-
|
8626 |
-
remove(element, ephemera.firstSelected());
|
8627 |
-
remove(element, ephemera.lastSelected());
|
8628 |
-
};
|
8629 |
-
var addSelectionAttribute = function (element) {
|
8630 |
-
set(element, ephemera.selected(), '1');
|
8631 |
-
};
|
8632 |
-
var clear = function (container) {
|
8633 |
-
var sels = descendants$1(container, ephemera.selectedSelector());
|
8634 |
-
each(sels, removeSelectionAttributes);
|
8635 |
-
};
|
8636 |
-
var selectRange = function (container, cells, start, finish) {
|
8637 |
-
clear(container);
|
8638 |
-
each(cells, addSelectionAttribute);
|
8639 |
-
set(start, ephemera.firstSelected(), '1');
|
8640 |
-
set(finish, ephemera.lastSelected(), '1');
|
8641 |
-
};
|
8642 |
-
return {
|
8643 |
-
clear: clear,
|
8644 |
-
selectRange: selectRange,
|
8645 |
-
selectedSelector: ephemera.selectedSelector,
|
8646 |
-
firstSelectedSelector: ephemera.firstSelectedSelector,
|
8647 |
-
lastSelectedSelector: ephemera.lastSelectedSelector
|
8648 |
-
};
|
8649 |
};
|
8650 |
-
var
|
8651 |
-
|
8652 |
-
|
8653 |
-
|
8654 |
-
|
8655 |
-
|
8656 |
-
|
8657 |
-
|
8658 |
-
|
8659 |
-
|
8660 |
-
|
8661 |
-
|
8662 |
-
|
8663 |
-
|
8664 |
-
|
8665 |
-
|
8666 |
-
|
8667 |
-
var annotations = SelectionAnnotation.byAttr(Ephemera);
|
8668 |
-
editor.on('init', function (e) {
|
8669 |
-
var win = editor.getWin();
|
8670 |
-
var body = getBody$1(editor);
|
8671 |
-
var isRoot = getIsRoot(editor);
|
8672 |
-
var syncSelection = function () {
|
8673 |
-
var sel = editor.selection;
|
8674 |
-
var start = Element$$1.fromDom(sel.getStart());
|
8675 |
-
var end = Element$$1.fromDom(sel.getEnd());
|
8676 |
-
var shared = DomParent.sharedOne(TableLookup.table, [
|
8677 |
-
start,
|
8678 |
-
end
|
8679 |
-
]);
|
8680 |
-
shared.fold(function () {
|
8681 |
-
annotations.clear(body);
|
8682 |
-
}, noop);
|
8683 |
-
};
|
8684 |
-
var mouseHandlers = InputHandlers.mouse(win, body, isRoot, annotations);
|
8685 |
-
var keyHandlers = InputHandlers.keyboard(win, body, isRoot, annotations);
|
8686 |
-
var hasShiftKey = function (event) {
|
8687 |
-
return event.raw().shiftKey === true;
|
8688 |
-
};
|
8689 |
-
var handleResponse = function (event, response) {
|
8690 |
-
if (!hasShiftKey(event)) {
|
8691 |
-
return;
|
8692 |
-
}
|
8693 |
-
if (response.kill()) {
|
8694 |
-
event.kill();
|
8695 |
-
}
|
8696 |
-
response.selection().each(function (ns) {
|
8697 |
-
var relative = relative$1(ns.start(), ns.finish());
|
8698 |
-
var rng = asLtrRange(win, relative);
|
8699 |
-
editor.selection.setRng(rng);
|
8700 |
-
});
|
8701 |
-
};
|
8702 |
-
var keyup = function (event) {
|
8703 |
-
var wrappedEvent = wrapEvent(event);
|
8704 |
-
if (wrappedEvent.raw().shiftKey && SelectionKeys.isNavigation(wrappedEvent.raw().which)) {
|
8705 |
-
var rng = editor.selection.getRng();
|
8706 |
-
var start = Element$$1.fromDom(rng.startContainer);
|
8707 |
-
var end = Element$$1.fromDom(rng.endContainer);
|
8708 |
-
keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) {
|
8709 |
-
handleResponse(wrappedEvent, response);
|
8710 |
-
});
|
8711 |
-
}
|
8712 |
-
};
|
8713 |
-
var keydown = function (event) {
|
8714 |
-
var wrappedEvent = wrapEvent(event);
|
8715 |
-
lazyResize().each(function (resize) {
|
8716 |
-
resize.hideBars();
|
8717 |
-
});
|
8718 |
-
var rng = editor.selection.getRng();
|
8719 |
-
var startContainer = Element$$1.fromDom(editor.selection.getStart());
|
8720 |
-
var start = Element$$1.fromDom(rng.startContainer);
|
8721 |
-
var end = Element$$1.fromDom(rng.endContainer);
|
8722 |
-
var direction = Direction.directionAt(startContainer).isRtl() ? SelectionKeys.rtl : SelectionKeys.ltr;
|
8723 |
-
keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) {
|
8724 |
-
handleResponse(wrappedEvent, response);
|
8725 |
-
});
|
8726 |
-
lazyResize().each(function (resize) {
|
8727 |
-
resize.showBars();
|
8728 |
-
});
|
8729 |
-
};
|
8730 |
-
var isMouseEvent = function (event) {
|
8731 |
-
return event.hasOwnProperty('x') && event.hasOwnProperty('y');
|
8732 |
-
};
|
8733 |
-
var wrapEvent = function (event) {
|
8734 |
-
var target = Element$$1.fromDom(event.target);
|
8735 |
-
var stop = function () {
|
8736 |
-
event.stopPropagation();
|
8737 |
-
};
|
8738 |
-
var prevent = function () {
|
8739 |
-
event.preventDefault();
|
8740 |
-
};
|
8741 |
-
var kill = compose(prevent, stop);
|
8742 |
-
return {
|
8743 |
-
target: constant(target),
|
8744 |
-
x: constant(isMouseEvent(event) ? event.x : null),
|
8745 |
-
y: constant(isMouseEvent(event) ? event.y : null),
|
8746 |
-
stop: stop,
|
8747 |
-
prevent: prevent,
|
8748 |
-
kill: kill,
|
8749 |
-
raw: constant(event)
|
8750 |
-
};
|
8751 |
-
};
|
8752 |
-
var isLeftMouse = function (raw) {
|
8753 |
-
return raw.button === 0;
|
8754 |
-
};
|
8755 |
-
var isLeftButtonPressed = function (raw) {
|
8756 |
-
if (raw.buttons === undefined) {
|
8757 |
-
return true;
|
8758 |
-
}
|
8759 |
-
return (raw.buttons & 1) !== 0;
|
8760 |
-
};
|
8761 |
-
var mouseDown = function (e) {
|
8762 |
-
if (isLeftMouse(e) && hasInternalTarget(e)) {
|
8763 |
-
mouseHandlers.mousedown(wrapEvent(e));
|
8764 |
-
}
|
8765 |
-
};
|
8766 |
-
var mouseOver = function (e) {
|
8767 |
-
if (isLeftButtonPressed(e) && hasInternalTarget(e)) {
|
8768 |
-
mouseHandlers.mouseover(wrapEvent(e));
|
8769 |
-
}
|
8770 |
-
};
|
8771 |
-
var mouseUp = function (e) {
|
8772 |
-
if (isLeftMouse(e) && hasInternalTarget(e)) {
|
8773 |
-
mouseHandlers.mouseup(wrapEvent(e));
|
8774 |
-
}
|
8775 |
-
};
|
8776 |
-
editor.on('mousedown', mouseDown);
|
8777 |
-
editor.on('mouseover', mouseOver);
|
8778 |
-
editor.on('mouseup', mouseUp);
|
8779 |
-
editor.on('keyup', keyup);
|
8780 |
-
editor.on('keydown', keydown);
|
8781 |
-
editor.on('nodechange', syncSelection);
|
8782 |
-
handlers = Option.some(handlerStruct({
|
8783 |
-
mousedown: mouseDown,
|
8784 |
-
mouseover: mouseOver,
|
8785 |
-
mouseup: mouseUp,
|
8786 |
-
keyup: keyup,
|
8787 |
-
keydown: keydown
|
8788 |
-
}));
|
8789 |
-
});
|
8790 |
-
var destroy = function () {
|
8791 |
-
handlers.each(function (handlers) {
|
8792 |
-
});
|
8793 |
-
};
|
8794 |
-
return {
|
8795 |
-
clear: annotations.clear,
|
8796 |
-
destroy: destroy
|
8797 |
-
};
|
8798 |
-
}
|
8799 |
-
|
8800 |
-
var Selections = function (editor) {
|
8801 |
-
var get = function () {
|
8802 |
-
var body = getBody$1(editor);
|
8803 |
-
return TableSelection.retrieve(body, Ephemera.selectedSelector()).fold(function () {
|
8804 |
-
if (editor.selection.getStart() === undefined) {
|
8805 |
-
return SelectionTypes.none();
|
8806 |
-
} else {
|
8807 |
-
return SelectionTypes.single(editor.selection);
|
8808 |
-
}
|
8809 |
-
}, function (cells) {
|
8810 |
-
return SelectionTypes.multiple(cells);
|
8811 |
-
});
|
8812 |
-
};
|
8813 |
-
return { get: get };
|
8814 |
};
|
|
|
8815 |
|
8816 |
-
|
8817 |
-
|
8818 |
-
|
8819 |
-
|
8820 |
-
|
8821 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8822 |
} else {
|
8823 |
-
|
8824 |
}
|
8825 |
});
|
8826 |
-
|
8827 |
-
|
8828 |
-
|
8829 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8830 |
});
|
8831 |
-
|
8832 |
-
|
8833 |
-
|
8834 |
-
|
8835 |
-
|
8836 |
-
|
8837 |
-
|
8838 |
-
|
8839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8840 |
});
|
8841 |
-
|
8842 |
-
|
8843 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8844 |
});
|
8845 |
-
|
8846 |
-
|
8847 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8848 |
});
|
8849 |
-
|
8850 |
-
|
8851 |
-
|
|
|
|
|
|
|
|
|
8852 |
});
|
8853 |
-
|
8854 |
-
|
8855 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8856 |
});
|
8857 |
-
|
8858 |
-
|
8859 |
-
|
|
|
|
|
|
|
|
|
8860 |
});
|
8861 |
-
|
8862 |
-
|
8863 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8864 |
});
|
8865 |
-
|
8866 |
-
|
8867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8868 |
});
|
8869 |
-
|
8870 |
-
|
8871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8872 |
});
|
8873 |
-
|
8874 |
-
|
8875 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8876 |
});
|
8877 |
-
|
8878 |
-
|
8879 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8880 |
});
|
8881 |
-
|
8882 |
-
|
8883 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8884 |
});
|
8885 |
-
|
8886 |
-
|
8887 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8888 |
});
|
8889 |
-
|
8890 |
-
|
8891 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8892 |
});
|
8893 |
-
|
8894 |
-
|
8895 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8896 |
});
|
8897 |
-
|
8898 |
-
|
8899 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8900 |
});
|
|
|
8901 |
};
|
8902 |
-
var
|
8903 |
-
|
8904 |
-
var
|
8905 |
-
|
8906 |
-
|
8907 |
-
|
8908 |
-
|
8909 |
-
|
8910 |
-
|
|
|
|
|
8911 |
};
|
8912 |
-
|
8913 |
-
|
8914 |
-
|
8915 |
};
|
|
|
|
|
|
|
|
|
|
|
8916 |
|
8917 |
-
|
8918 |
-
|
8919 |
-
|
8920 |
-
|
8921 |
-
|
8922 |
-
|
8923 |
-
|
8924 |
-
|
8925 |
-
|
8926 |
-
|
8927 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8928 |
};
|
8929 |
-
var
|
8930 |
-
|
8931 |
-
|
8932 |
-
|
8933 |
-
noTargetDisable(self);
|
8934 |
-
}, function (targets) {
|
8935 |
-
ctrlEnable(self);
|
8936 |
-
});
|
8937 |
};
|
8938 |
-
var
|
8939 |
-
|
8940 |
-
|
8941 |
-
|
8942 |
-
|
8943 |
-
|
8944 |
-
|
|
|
|
|
|
|
|
|
8945 |
});
|
8946 |
};
|
8947 |
-
var
|
8948 |
-
var
|
8949 |
-
|
8950 |
-
|
8951 |
-
|
8952 |
-
|
8953 |
-
|
8954 |
-
|
|
|
|
|
8955 |
};
|
8956 |
-
var
|
8957 |
-
var
|
8958 |
-
|
8959 |
-
|
8960 |
-
noTargetDisable(self);
|
8961 |
-
}, function (targets) {
|
8962 |
-
self.disabled(targets.unmergable().isNone());
|
8963 |
});
|
8964 |
-
|
8965 |
-
|
8966 |
-
|
8967 |
-
|
8968 |
-
|
8969 |
-
|
8970 |
-
|
8971 |
-
}, function (targets) {
|
8972 |
-
each(tableCtrls, ctrlEnable);
|
8973 |
-
each(cellCtrls, ctrlEnable);
|
8974 |
-
each(mergeCtrls, function (mergeCtrl) {
|
8975 |
-
mergeCtrl.disabled(targets.mergable().isNone());
|
8976 |
-
});
|
8977 |
-
each(unmergeCtrls, function (unmergeCtrl) {
|
8978 |
-
unmergeCtrl.disabled(targets.unmergable().isNone());
|
8979 |
-
});
|
8980 |
});
|
8981 |
-
|
8982 |
-
|
8983 |
-
editor.on('nodechange', function (e) {
|
8984 |
-
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
8985 |
-
targets = cellOpt.bind(function (cellDom) {
|
8986 |
-
var cell = Element$$1.fromDom(cellDom);
|
8987 |
-
var table = TableLookup.table(cell);
|
8988 |
-
return table.map(function (table) {
|
8989 |
-
return TableTargets.forMenu(selections, table, cell);
|
8990 |
-
});
|
8991 |
-
});
|
8992 |
-
setDisabledCtrls();
|
8993 |
});
|
8994 |
-
});
|
8995 |
-
var generateTableGrid = function () {
|
8996 |
-
var html = '';
|
8997 |
-
html = '<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';
|
8998 |
-
for (var y = 0; y < 10; y++) {
|
8999 |
-
html += '<tr>';
|
9000 |
-
for (var x = 0; x < 10; x++) {
|
9001 |
-
html += '<td role="gridcell" tabindex="-1"><a id="mcegrid' + (y * 10 + x) + '" href="#" ' + 'data-mce-x="' + x + '" data-mce-y="' + y + '"></a></td>';
|
9002 |
-
}
|
9003 |
-
html += '</tr>';
|
9004 |
-
}
|
9005 |
-
html += '</table>';
|
9006 |
-
html += '<div class="mce-text-center" role="presentation">1 x 1</div>';
|
9007 |
-
return html;
|
9008 |
-
};
|
9009 |
-
var selectGrid = function (editor, tx, ty, control) {
|
9010 |
-
var table = control.getEl().getElementsByTagName('table')[0];
|
9011 |
-
var x, y, focusCell, cell, active;
|
9012 |
-
var rtl = control.isRtl() || control.parent().rel === 'tl-tr';
|
9013 |
-
table.nextSibling.innerHTML = tx + 1 + ' x ' + (ty + 1);
|
9014 |
-
if (rtl) {
|
9015 |
-
tx = 9 - tx;
|
9016 |
-
}
|
9017 |
-
for (y = 0; y < 10; y++) {
|
9018 |
-
for (x = 0; x < 10; x++) {
|
9019 |
-
cell = table.rows[y].childNodes[x].firstChild;
|
9020 |
-
active = (rtl ? x >= tx : x <= tx) && y <= ty;
|
9021 |
-
editor.dom.toggleClass(cell, 'mce-active', active);
|
9022 |
-
if (active) {
|
9023 |
-
focusCell = cell;
|
9024 |
-
}
|
9025 |
-
}
|
9026 |
-
}
|
9027 |
-
return focusCell.parentNode;
|
9028 |
};
|
9029 |
-
var
|
9030 |
-
|
9031 |
-
icon: 'table',
|
9032 |
-
context: 'table',
|
9033 |
-
onclick: cmd('mceInsertTable')
|
9034 |
-
} : {
|
9035 |
-
text: 'Table',
|
9036 |
-
icon: 'table',
|
9037 |
-
context: 'table',
|
9038 |
-
ariaHideMenu: true,
|
9039 |
-
onclick: function (e) {
|
9040 |
-
if (e.aria) {
|
9041 |
-
this.parent().hideAll();
|
9042 |
-
e.stopImmediatePropagation();
|
9043 |
-
editor.execCommand('mceInsertTable');
|
9044 |
-
}
|
9045 |
-
},
|
9046 |
-
onshow: function () {
|
9047 |
-
selectGrid(editor, 0, 0, this.menu.items()[0]);
|
9048 |
-
},
|
9049 |
-
onhide: function () {
|
9050 |
-
var elements = this.menu.items()[0].getEl().getElementsByTagName('a');
|
9051 |
-
editor.dom.removeClass(elements, 'mce-active');
|
9052 |
-
editor.dom.addClass(elements[0], 'mce-active');
|
9053 |
-
},
|
9054 |
-
menu: [{
|
9055 |
-
type: 'container',
|
9056 |
-
html: generateTableGrid(),
|
9057 |
-
onPostRender: function () {
|
9058 |
-
this.lastX = this.lastY = 0;
|
9059 |
-
},
|
9060 |
-
onmousemove: function (e) {
|
9061 |
-
var target = e.target;
|
9062 |
-
var x, y;
|
9063 |
-
if (target.tagName.toUpperCase() === 'A') {
|
9064 |
-
x = parseInt(target.getAttribute('data-mce-x'), 10);
|
9065 |
-
y = parseInt(target.getAttribute('data-mce-y'), 10);
|
9066 |
-
if (this.isRtl() || this.parent().rel === 'tl-tr') {
|
9067 |
-
x = 9 - x;
|
9068 |
-
}
|
9069 |
-
if (x !== this.lastX || y !== this.lastY) {
|
9070 |
-
selectGrid(editor, x, y, e.control);
|
9071 |
-
this.lastX = x;
|
9072 |
-
this.lastY = y;
|
9073 |
-
}
|
9074 |
-
}
|
9075 |
-
},
|
9076 |
-
onclick: function (e) {
|
9077 |
-
var self = this;
|
9078 |
-
if (e.target.tagName.toUpperCase() === 'A') {
|
9079 |
-
e.preventDefault();
|
9080 |
-
e.stopPropagation();
|
9081 |
-
self.parent().cancel();
|
9082 |
-
editor.undoManager.transact(function () {
|
9083 |
-
InsertTable.insert(editor, self.lastX + 1, self.lastY + 1);
|
9084 |
-
});
|
9085 |
-
editor.addVisual();
|
9086 |
-
}
|
9087 |
-
}
|
9088 |
-
}]
|
9089 |
};
|
9090 |
-
function
|
9091 |
-
|
9092 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9093 |
};
|
9094 |
-
}
|
9095 |
-
var tableProperties = {
|
9096 |
-
text: 'Table properties',
|
9097 |
-
context: 'table',
|
9098 |
-
onPostRender: pushTable,
|
9099 |
-
onclick: cmd('mceTableProps')
|
9100 |
};
|
9101 |
-
var
|
9102 |
-
|
9103 |
-
context: 'table',
|
9104 |
-
onPostRender: pushTable,
|
9105 |
-
cmd: 'mceTableDelete'
|
9106 |
};
|
9107 |
-
var
|
9108 |
-
|
9109 |
-
|
9110 |
-
|
9111 |
-
|
9112 |
-
text: 'Insert row before',
|
9113 |
-
onclick: cmd('mceTableInsertRowBefore'),
|
9114 |
-
onPostRender: pushCell
|
9115 |
-
},
|
9116 |
-
{
|
9117 |
-
text: 'Insert row after',
|
9118 |
-
onclick: cmd('mceTableInsertRowAfter'),
|
9119 |
-
onPostRender: pushCell
|
9120 |
-
},
|
9121 |
-
{
|
9122 |
-
text: 'Delete row',
|
9123 |
-
onclick: cmd('mceTableDeleteRow'),
|
9124 |
-
onPostRender: pushCell
|
9125 |
-
},
|
9126 |
-
{
|
9127 |
-
text: 'Row properties',
|
9128 |
-
onclick: cmd('mceTableRowProps'),
|
9129 |
-
onPostRender: pushCell
|
9130 |
-
},
|
9131 |
-
{ text: '-' },
|
9132 |
-
{
|
9133 |
-
text: 'Cut row',
|
9134 |
-
onclick: cmd('mceTableCutRow'),
|
9135 |
-
onPostRender: pushCell
|
9136 |
-
},
|
9137 |
-
{
|
9138 |
-
text: 'Copy row',
|
9139 |
-
onclick: cmd('mceTableCopyRow'),
|
9140 |
-
onPostRender: pushCell
|
9141 |
-
},
|
9142 |
-
{
|
9143 |
-
text: 'Paste row before',
|
9144 |
-
onclick: cmd('mceTablePasteRowBefore'),
|
9145 |
-
onPostRender: pushCell
|
9146 |
-
},
|
9147 |
-
{
|
9148 |
-
text: 'Paste row after',
|
9149 |
-
onclick: cmd('mceTablePasteRowAfter'),
|
9150 |
-
onPostRender: pushCell
|
9151 |
-
}
|
9152 |
-
]
|
9153 |
};
|
9154 |
-
var
|
9155 |
-
|
9156 |
-
|
9157 |
-
|
9158 |
-
{
|
9159 |
-
text: 'Insert column before',
|
9160 |
-
onclick: cmd('mceTableInsertColBefore'),
|
9161 |
-
onPostRender: pushCell
|
9162 |
-
},
|
9163 |
-
{
|
9164 |
-
text: 'Insert column after',
|
9165 |
-
onclick: cmd('mceTableInsertColAfter'),
|
9166 |
-
onPostRender: pushCell
|
9167 |
-
},
|
9168 |
-
{
|
9169 |
-
text: 'Delete column',
|
9170 |
-
onclick: cmd('mceTableDeleteCol'),
|
9171 |
-
onPostRender: pushCell
|
9172 |
-
}
|
9173 |
-
]
|
9174 |
};
|
9175 |
-
var
|
9176 |
-
|
9177 |
-
|
9178 |
-
|
9179 |
-
|
9180 |
-
|
9181 |
-
|
9182 |
-
|
9183 |
-
|
9184 |
-
},
|
9185 |
-
{
|
9186 |
-
text: 'Merge cells',
|
9187 |
-
onclick: cmd('mceTableMergeCells'),
|
9188 |
-
onPostRender: pushMerge
|
9189 |
-
},
|
9190 |
-
{
|
9191 |
-
text: 'Split cell',
|
9192 |
-
onclick: cmd('mceTableSplitCells'),
|
9193 |
-
onPostRender: pushUnmerge
|
9194 |
-
}
|
9195 |
-
]
|
9196 |
};
|
9197 |
-
editor.
|
9198 |
-
editor.
|
9199 |
-
editor.
|
9200 |
-
editor.
|
9201 |
-
editor.
|
9202 |
-
editor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9203 |
};
|
9204 |
-
|
|
|
|
|
|
|
|
|
9205 |
|
9206 |
-
|
9207 |
-
|
9208 |
-
|
9209 |
-
|
9210 |
-
|
9211 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9212 |
});
|
9213 |
});
|
9214 |
};
|
9215 |
-
|
9216 |
-
|
9217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9218 |
};
|
9219 |
-
|
9220 |
-
return {
|
9221 |
-
|
9222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9223 |
},
|
9224 |
-
|
9225 |
-
|
|
|
|
|
|
|
9226 |
},
|
9227 |
-
|
9228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9229 |
}
|
9230 |
-
|
9231 |
-
};
|
9232 |
-
|
9233 |
-
|
9234 |
-
|
9235 |
-
|
9236 |
-
|
9237 |
-
|
9238 |
-
|
9239 |
-
|
9240 |
-
|
9241 |
-
|
9242 |
-
|
9243 |
-
|
9244 |
-
|
9245 |
-
|
9246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9247 |
});
|
9248 |
-
|
9249 |
-
|
9250 |
-
|
9251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9252 |
}
|
9253 |
-
|
9254 |
-
|
9255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9256 |
});
|
9257 |
-
return getApi(editor, clipboardRows);
|
9258 |
-
}
|
9259 |
-
global.add('table', Plugin);
|
9260 |
-
function Plugin$1 () {
|
9261 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9262 |
|
9263 |
-
|
9264 |
|
9265 |
}());
|
9266 |
})();
|
1 |
(function () {
|
2 |
var table = (function () {
|
3 |
+
'use strict';
|
4 |
|
5 |
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
6 |
|
7 |
+
var noop = function () {
|
8 |
+
var x = [];
|
9 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
10 |
+
x[_i] = arguments[_i];
|
11 |
+
}
|
12 |
+
};
|
13 |
+
|
14 |
+
var compose = function (fa, fb) {
|
15 |
+
return function () {
|
16 |
+
var x = [];
|
17 |
for (var _i = 0; _i < arguments.length; _i++) {
|
18 |
+
x[_i] = arguments[_i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
+
return fa(fb.apply(null, arguments));
|
21 |
+
};
|
22 |
+
};
|
23 |
+
var constant = function (value) {
|
24 |
+
return function () {
|
25 |
+
return value;
|
26 |
+
};
|
27 |
+
};
|
28 |
+
var identity = function (x) {
|
29 |
+
return x;
|
30 |
+
};
|
31 |
+
|
32 |
+
var curry = function (f) {
|
33 |
+
var x = [];
|
34 |
+
for (var _i = 1; _i < arguments.length; _i++) {
|
35 |
+
x[_i - 1] = arguments[_i];
|
36 |
}
|
37 |
+
var args = new Array(arguments.length - 1);
|
38 |
+
for (var i = 1; i < arguments.length; i++)
|
39 |
+
args[i - 1] = arguments[i];
|
40 |
+
return function () {
|
41 |
+
var x = [];
|
42 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
43 |
+
x[_i] = arguments[_i];
|
44 |
+
}
|
45 |
+
var newArgs = new Array(arguments.length);
|
46 |
+
for (var j = 0; j < newArgs.length; j++)
|
47 |
+
newArgs[j] = arguments[j];
|
48 |
+
var all = args.concat(newArgs);
|
49 |
+
return f.apply(null, all);
|
50 |
+
};
|
51 |
+
};
|
52 |
+
var not = function (f) {
|
53 |
+
return function () {
|
54 |
+
var x = [];
|
55 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
56 |
+
x[_i] = arguments[_i];
|
57 |
+
}
|
58 |
+
return !f.apply(null, arguments);
|
59 |
};
|
60 |
+
};
|
61 |
+
var die = function (msg) {
|
62 |
+
return function () {
|
63 |
+
throw new Error(msg);
|
64 |
};
|
65 |
+
};
|
66 |
+
var apply = function (f) {
|
67 |
+
return f();
|
68 |
+
};
|
69 |
|
70 |
+
var never = constant(false);
|
71 |
+
var always = constant(true);
|
72 |
+
|
73 |
+
var never$1 = never;
|
74 |
+
var always$1 = always;
|
75 |
+
var none = function () {
|
76 |
+
return NONE;
|
77 |
+
};
|
78 |
+
var NONE = function () {
|
79 |
+
var eq = function (o) {
|
80 |
+
return o.isNone();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
};
|
82 |
+
var call$$1 = function (thunk) {
|
83 |
+
return thunk();
|
84 |
};
|
85 |
+
var id = function (n) {
|
86 |
+
return n;
|
|
|
|
|
87 |
};
|
88 |
+
var noop$$1 = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
};
|
90 |
+
var nul = function () {
|
91 |
+
return null;
|
|
|
|
|
92 |
};
|
93 |
+
var undef = function () {
|
94 |
+
return undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
};
|
96 |
+
var me = {
|
97 |
+
fold: function (n, s) {
|
98 |
+
return n();
|
99 |
+
},
|
100 |
+
is: never$1,
|
101 |
+
isSome: never$1,
|
102 |
+
isNone: always$1,
|
103 |
+
getOr: id,
|
104 |
+
getOrThunk: call$$1,
|
105 |
+
getOrDie: function (msg) {
|
106 |
+
throw new Error(msg || 'error: getOrDie called on none.');
|
107 |
+
},
|
108 |
+
getOrNull: nul,
|
109 |
+
getOrUndefined: undef,
|
110 |
+
or: id,
|
111 |
+
orThunk: call$$1,
|
112 |
+
map: none,
|
113 |
+
ap: none,
|
114 |
+
each: noop$$1,
|
115 |
+
bind: none,
|
116 |
+
flatten: none,
|
117 |
+
exists: never$1,
|
118 |
+
forall: always$1,
|
119 |
+
filter: none,
|
120 |
+
equals: eq,
|
121 |
+
equals_: eq,
|
122 |
+
toArray: function () {
|
123 |
+
return [];
|
124 |
+
},
|
125 |
+
toString: constant('none()')
|
126 |
};
|
127 |
+
if (Object.freeze)
|
128 |
+
Object.freeze(me);
|
129 |
+
return me;
|
130 |
+
}();
|
131 |
+
var some = function (a) {
|
132 |
+
var constant_a = function () {
|
133 |
+
return a;
|
134 |
};
|
135 |
+
var self = function () {
|
136 |
+
return me;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
};
|
138 |
+
var map = function (f) {
|
139 |
+
return some(f(a));
|
|
|
|
|
|
|
140 |
};
|
141 |
+
var bind = function (f) {
|
142 |
+
return f(a);
|
|
|
|
|
|
|
143 |
};
|
144 |
+
var me = {
|
145 |
+
fold: function (n, s) {
|
146 |
+
return s(a);
|
147 |
+
},
|
148 |
+
is: function (v) {
|
149 |
+
return a === v;
|
150 |
+
},
|
151 |
+
isSome: always$1,
|
152 |
+
isNone: never$1,
|
153 |
+
getOr: constant_a,
|
154 |
+
getOrThunk: constant_a,
|
155 |
+
getOrDie: constant_a,
|
156 |
+
getOrNull: constant_a,
|
157 |
+
getOrUndefined: constant_a,
|
158 |
+
or: self,
|
159 |
+
orThunk: self,
|
160 |
+
map: map,
|
161 |
+
ap: function (optfab) {
|
162 |
+
return optfab.fold(none, function (fab) {
|
163 |
+
return some(fab(a));
|
164 |
+
});
|
165 |
+
},
|
166 |
+
each: function (f) {
|
167 |
+
f(a);
|
168 |
+
},
|
169 |
+
bind: bind,
|
170 |
+
flatten: constant_a,
|
171 |
+
exists: bind,
|
172 |
+
forall: bind,
|
173 |
+
filter: function (f) {
|
174 |
+
return f(a) ? me : NONE;
|
175 |
+
},
|
176 |
+
equals: function (o) {
|
177 |
+
return o.is(a);
|
178 |
+
},
|
179 |
+
equals_: function (o, elementEq) {
|
180 |
+
return o.fold(never$1, function (b) {
|
181 |
+
return elementEq(a, b);
|
182 |
+
});
|
183 |
+
},
|
184 |
+
toArray: function () {
|
185 |
+
return [a];
|
186 |
+
},
|
187 |
+
toString: function () {
|
188 |
+
return 'some(' + a + ')';
|
189 |
}
|
|
|
190 |
};
|
191 |
+
return me;
|
192 |
+
};
|
193 |
+
var from = function (value) {
|
194 |
+
return value === null || value === undefined ? NONE : some(value);
|
195 |
+
};
|
196 |
+
var Option = {
|
197 |
+
some: some,
|
198 |
+
none: none,
|
199 |
+
from: from
|
200 |
+
};
|
201 |
+
|
202 |
+
var typeOf = function (x) {
|
203 |
+
if (x === null)
|
204 |
+
return 'null';
|
205 |
+
var t = typeof x;
|
206 |
+
if (t === 'object' && Array.prototype.isPrototypeOf(x))
|
207 |
+
return 'array';
|
208 |
+
if (t === 'object' && String.prototype.isPrototypeOf(x))
|
209 |
+
return 'string';
|
210 |
+
return t;
|
211 |
+
};
|
212 |
+
var isType = function (type) {
|
213 |
+
return function (value) {
|
214 |
+
return typeOf(value) === type;
|
215 |
+
};
|
216 |
+
};
|
217 |
+
var isString = isType('string');
|
218 |
+
|
219 |
+
var isArray = isType('array');
|
220 |
+
|
221 |
+
var isBoolean = isType('boolean');
|
222 |
+
|
223 |
+
var isFunction = isType('function');
|
224 |
+
var isNumber = isType('number');
|
225 |
+
|
226 |
+
var rawIndexOf = function () {
|
227 |
+
var pIndexOf = Array.prototype.indexOf;
|
228 |
+
var fastIndex = function (xs, x) {
|
229 |
+
return pIndexOf.call(xs, x);
|
230 |
+
};
|
231 |
+
var slowIndex = function (xs, x) {
|
232 |
+
return slowIndexOf(xs, x);
|
233 |
+
};
|
234 |
+
return pIndexOf === undefined ? slowIndex : fastIndex;
|
235 |
+
}();
|
236 |
+
|
237 |
+
var contains = function (xs, x) {
|
238 |
+
return rawIndexOf(xs, x) > -1;
|
239 |
+
};
|
240 |
+
var exists = function (xs, pred) {
|
241 |
+
return findIndex(xs, pred).isSome();
|
242 |
+
};
|
243 |
+
|
244 |
+
|
245 |
+
var map = function (xs, f) {
|
246 |
+
var len = xs.length;
|
247 |
+
var r = new Array(len);
|
248 |
+
for (var i = 0; i < len; i++) {
|
249 |
+
var x = xs[i];
|
250 |
+
r[i] = f(x, i, xs);
|
251 |
+
}
|
252 |
+
return r;
|
253 |
+
};
|
254 |
+
var each = function (xs, f) {
|
255 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
256 |
+
var x = xs[i];
|
257 |
+
f(x, i, xs);
|
258 |
+
}
|
259 |
+
};
|
260 |
+
var eachr = function (xs, f) {
|
261 |
+
for (var i = xs.length - 1; i >= 0; i--) {
|
262 |
+
var x = xs[i];
|
263 |
+
f(x, i, xs);
|
264 |
+
}
|
265 |
+
};
|
266 |
+
|
267 |
+
var filter = function (xs, pred) {
|
268 |
+
var r = [];
|
269 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
270 |
+
var x = xs[i];
|
271 |
+
if (pred(x, i, xs)) {
|
272 |
+
r.push(x);
|
273 |
}
|
274 |
+
}
|
275 |
+
return r;
|
276 |
+
};
|
277 |
+
|
278 |
+
var foldr = function (xs, f, acc) {
|
279 |
+
eachr(xs, function (x) {
|
280 |
+
acc = f(acc, x);
|
281 |
+
});
|
282 |
+
return acc;
|
283 |
+
};
|
284 |
+
var foldl = function (xs, f, acc) {
|
285 |
+
each(xs, function (x) {
|
286 |
+
acc = f(acc, x);
|
287 |
+
});
|
288 |
+
return acc;
|
289 |
+
};
|
290 |
+
var find = function (xs, pred) {
|
291 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
292 |
+
var x = xs[i];
|
293 |
+
if (pred(x, i, xs)) {
|
294 |
+
return Option.some(x);
|
295 |
}
|
296 |
+
}
|
297 |
+
return Option.none();
|
298 |
+
};
|
299 |
+
var findIndex = function (xs, pred) {
|
300 |
+
for (var i = 0, len = xs.length; i < len; i++) {
|
301 |
+
var x = xs[i];
|
302 |
+
if (pred(x, i, xs)) {
|
303 |
+
return Option.some(i);
|
|
|
304 |
}
|
305 |
+
}
|
306 |
+
return Option.none();
|
307 |
+
};
|
308 |
+
var slowIndexOf = function (xs, x) {
|
309 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
310 |
+
if (xs[i] === x) {
|
311 |
+
return i;
|
|
|
|
|
|
|
|
|
|
|
312 |
}
|
313 |
+
}
|
314 |
+
return -1;
|
315 |
+
};
|
316 |
+
var push = Array.prototype.push;
|
317 |
+
var flatten = function (xs) {
|
318 |
+
var r = [];
|
319 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
320 |
+
if (!Array.prototype.isPrototypeOf(xs[i]))
|
321 |
+
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
322 |
+
push.apply(r, xs[i]);
|
323 |
+
}
|
324 |
+
return r;
|
325 |
+
};
|
326 |
+
var bind = function (xs, f) {
|
327 |
+
var output = map(xs, f);
|
328 |
+
return flatten(output);
|
329 |
+
};
|
330 |
+
var forall = function (xs, pred) {
|
331 |
+
for (var i = 0, len = xs.length; i < len; ++i) {
|
332 |
+
var x = xs[i];
|
333 |
+
if (pred(x, i, xs) !== true) {
|
334 |
+
return false;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
return true;
|
338 |
+
};
|
339 |
+
|
340 |
+
var slice = Array.prototype.slice;
|
341 |
+
var reverse = function (xs) {
|
342 |
+
var r = slice.call(xs, 0);
|
343 |
+
r.reverse();
|
344 |
+
return r;
|
345 |
+
};
|
346 |
+
|
347 |
+
|
348 |
|
349 |
+
|
350 |
+
|
351 |
+
var last = function (xs) {
|
352 |
+
return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
|
353 |
+
};
|
354 |
+
var from$1 = isFunction(Array.from) ? Array.from : function (x) {
|
355 |
+
return slice.call(x);
|
356 |
+
};
|
357 |
+
|
358 |
+
var keys = Object.keys;
|
359 |
+
var each$1 = function (obj, f) {
|
360 |
+
var props = keys(obj);
|
361 |
+
for (var k = 0, len = props.length; k < len; k++) {
|
362 |
+
var i = props[k];
|
363 |
+
var x = obj[i];
|
364 |
+
f(x, i, obj);
|
365 |
+
}
|
366 |
+
};
|
367 |
+
var map$1 = function (obj, f) {
|
368 |
+
return tupleMap(obj, function (x, i, obj) {
|
369 |
+
return {
|
370 |
+
k: i,
|
371 |
+
v: f(x, i, obj)
|
372 |
+
};
|
373 |
+
});
|
374 |
+
};
|
375 |
+
var tupleMap = function (obj, f) {
|
376 |
+
var r = {};
|
377 |
+
each$1(obj, function (x, i) {
|
378 |
+
var tuple = f(x, i, obj);
|
379 |
+
r[tuple.k] = tuple.v;
|
380 |
+
});
|
381 |
+
return r;
|
382 |
+
};
|
383 |
+
|
384 |
+
var Immutable = function () {
|
385 |
+
var fields = [];
|
386 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
387 |
+
fields[_i] = arguments[_i];
|
388 |
+
}
|
389 |
+
return function () {
|
390 |
+
var values = [];
|
391 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
392 |
+
values[_i] = arguments[_i];
|
393 |
}
|
394 |
+
if (fields.length !== values.length) {
|
395 |
+
throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
|
396 |
+
}
|
397 |
+
var struct = {};
|
398 |
+
each(fields, function (name, i) {
|
399 |
+
struct[name] = constant(values[i]);
|
400 |
+
});
|
401 |
+
return struct;
|
402 |
+
};
|
403 |
+
};
|
404 |
+
|
405 |
+
var sort$1 = function (arr) {
|
406 |
+
return arr.slice(0).sort();
|
407 |
+
};
|
408 |
+
var reqMessage = function (required, keys) {
|
409 |
+
throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
|
410 |
+
};
|
411 |
+
var unsuppMessage = function (unsupported) {
|
412 |
+
throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
|
413 |
+
};
|
414 |
+
var validateStrArr = function (label, array) {
|
415 |
+
if (!isArray(array))
|
416 |
+
throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
|
417 |
+
each(array, function (a) {
|
418 |
+
if (!isString(a))
|
419 |
+
throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
|
420 |
+
});
|
421 |
+
};
|
422 |
+
var invalidTypeMessage = function (incorrect, type) {
|
423 |
+
throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
|
424 |
+
};
|
425 |
+
var checkDupes = function (everything) {
|
426 |
+
var sorted = sort$1(everything);
|
427 |
+
var dupe = find(sorted, function (s, i) {
|
428 |
+
return i < sorted.length - 1 && s === sorted[i + 1];
|
429 |
+
});
|
430 |
+
dupe.each(function (d) {
|
431 |
+
throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
|
432 |
+
});
|
433 |
+
};
|
434 |
+
|
435 |
+
var MixedBag = function (required, optional) {
|
436 |
+
var everything = required.concat(optional);
|
437 |
+
if (everything.length === 0)
|
438 |
+
throw new Error('You must specify at least one required or optional field.');
|
439 |
+
validateStrArr('required', required);
|
440 |
+
validateStrArr('optional', optional);
|
441 |
+
checkDupes(everything);
|
442 |
+
return function (obj) {
|
443 |
+
var keys$$1 = keys(obj);
|
444 |
+
var allReqd = forall(required, function (req) {
|
445 |
+
return contains(keys$$1, req);
|
446 |
+
});
|
447 |
+
if (!allReqd)
|
448 |
+
reqMessage(required, keys$$1);
|
449 |
+
var unsupported = filter(keys$$1, function (key) {
|
450 |
+
return !contains(everything, key);
|
451 |
});
|
452 |
+
if (unsupported.length > 0)
|
453 |
+
unsuppMessage(unsupported);
|
454 |
var r = {};
|
455 |
+
each(required, function (req) {
|
456 |
+
r[req] = constant(obj[req]);
|
457 |
+
});
|
458 |
+
each(optional, function (opt) {
|
459 |
+
r[opt] = constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]) : Option.none());
|
460 |
});
|
461 |
return r;
|
462 |
};
|
463 |
+
};
|
464 |
+
|
465 |
+
var dimensions = Immutable('width', 'height');
|
466 |
+
var grid = Immutable('rows', 'columns');
|
467 |
+
var address = Immutable('row', 'column');
|
468 |
+
var coords = Immutable('x', 'y');
|
469 |
+
var detail = Immutable('element', 'rowspan', 'colspan');
|
470 |
+
var detailnew = Immutable('element', 'rowspan', 'colspan', 'isNew');
|
471 |
+
var extended = Immutable('element', 'rowspan', 'colspan', 'row', 'column');
|
472 |
+
var rowdata = Immutable('element', 'cells', 'section');
|
473 |
+
var elementnew = Immutable('element', 'isNew');
|
474 |
+
var rowdatanew = Immutable('element', 'cells', 'section', 'isNew');
|
475 |
+
var rowcells = Immutable('cells', 'section');
|
476 |
+
var rowdetails = Immutable('details', 'section');
|
477 |
+
var bounds = Immutable('startRow', 'startCol', 'finishRow', 'finishCol');
|
478 |
+
var $_6lasqllcjjgwed80 = {
|
479 |
+
dimensions: dimensions,
|
480 |
+
grid: grid,
|
481 |
+
address: address,
|
482 |
+
coords: coords,
|
483 |
+
extended: extended,
|
484 |
+
detail: detail,
|
485 |
+
detailnew: detailnew,
|
486 |
+
rowdata: rowdata,
|
487 |
+
elementnew: elementnew,
|
488 |
+
rowdatanew: rowdatanew,
|
489 |
+
rowcells: rowcells,
|
490 |
+
rowdetails: rowdetails,
|
491 |
+
bounds: bounds
|
492 |
+
};
|
493 |
+
|
494 |
+
var fromHtml = function (html, scope) {
|
495 |
+
var doc = scope || document;
|
496 |
+
var div = doc.createElement('div');
|
497 |
+
div.innerHTML = html;
|
498 |
+
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
499 |
+
console.error('HTML does not have a single root node', html);
|
500 |
+
throw 'HTML must have a single root node';
|
501 |
+
}
|
502 |
+
return fromDom(div.childNodes[0]);
|
503 |
+
};
|
504 |
+
var fromTag = function (tag, scope) {
|
505 |
+
var doc = scope || document;
|
506 |
+
var node = doc.createElement(tag);
|
507 |
+
return fromDom(node);
|
508 |
+
};
|
509 |
+
var fromText = function (text, scope) {
|
510 |
+
var doc = scope || document;
|
511 |
+
var node = doc.createTextNode(text);
|
512 |
+
return fromDom(node);
|
513 |
+
};
|
514 |
+
var fromDom = function (node) {
|
515 |
+
if (node === null || node === undefined)
|
516 |
+
throw new Error('Node cannot be null or undefined');
|
517 |
+
return { dom: constant(node) };
|
518 |
+
};
|
519 |
+
var fromPoint = function (docElm, x, y) {
|
520 |
+
var doc = docElm.dom();
|
521 |
+
return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
|
522 |
+
};
|
523 |
+
var Element$$1 = {
|
524 |
+
fromHtml: fromHtml,
|
525 |
+
fromTag: fromTag,
|
526 |
+
fromText: fromText,
|
527 |
+
fromDom: fromDom,
|
528 |
+
fromPoint: fromPoint
|
529 |
+
};
|
530 |
+
|
531 |
+
var $_95eswilijjgwed9s = {
|
532 |
+
ATTRIBUTE: Node.ATTRIBUTE_NODE,
|
533 |
+
CDATA_SECTION: Node.CDATA_SECTION_NODE,
|
534 |
+
COMMENT: Node.COMMENT_NODE,
|
535 |
+
DOCUMENT: Node.DOCUMENT_NODE,
|
536 |
+
DOCUMENT_TYPE: Node.DOCUMENT_TYPE_NODE,
|
537 |
+
DOCUMENT_FRAGMENT: Node.DOCUMENT_FRAGMENT_NODE,
|
538 |
+
ELEMENT: Node.ELEMENT_NODE,
|
539 |
+
TEXT: Node.TEXT_NODE,
|
540 |
+
PROCESSING_INSTRUCTION: Node.PROCESSING_INSTRUCTION_NODE,
|
541 |
+
ENTITY_REFERENCE: Node.ENTITY_REFERENCE_NODE,
|
542 |
+
ENTITY: Node.ENTITY_NODE,
|
543 |
+
NOTATION: Node.NOTATION_NODE
|
544 |
+
};
|
545 |
+
|
546 |
+
var ELEMENT = $_95eswilijjgwed9s.ELEMENT;
|
547 |
+
var DOCUMENT = $_95eswilijjgwed9s.DOCUMENT;
|
548 |
+
var is = function (element, selector) {
|
549 |
+
var elem = element.dom();
|
550 |
+
if (elem.nodeType !== ELEMENT)
|
551 |
+
return false;
|
552 |
+
else if (elem.matches !== undefined)
|
553 |
+
return elem.matches(selector);
|
554 |
+
else if (elem.msMatchesSelector !== undefined)
|
555 |
+
return elem.msMatchesSelector(selector);
|
556 |
+
else if (elem.webkitMatchesSelector !== undefined)
|
557 |
+
return elem.webkitMatchesSelector(selector);
|
558 |
+
else if (elem.mozMatchesSelector !== undefined)
|
559 |
+
return elem.mozMatchesSelector(selector);
|
560 |
+
else
|
561 |
+
throw new Error('Browser lacks native selectors');
|
562 |
+
};
|
563 |
+
var bypassSelector = function (dom) {
|
564 |
+
return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT || dom.childElementCount === 0;
|
565 |
+
};
|
566 |
+
var all = function (selector, scope) {
|
567 |
+
var base = scope === undefined ? document : scope.dom();
|
568 |
+
return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), Element$$1.fromDom);
|
569 |
+
};
|
570 |
+
var one = function (selector, scope) {
|
571 |
+
var base = scope === undefined ? document : scope.dom();
|
572 |
+
return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map(Element$$1.fromDom);
|
573 |
+
};
|
574 |
+
var $_5htea7lfjjgwed94 = {
|
575 |
+
all: all,
|
576 |
+
is: is,
|
577 |
+
one: one
|
578 |
+
};
|
579 |
+
|
580 |
+
var toArray = function (target, f) {
|
581 |
+
var r = [];
|
582 |
+
var recurse = function (e) {
|
583 |
+
r.push(e);
|
584 |
+
return f(e);
|
585 |
+
};
|
586 |
+
var cur = f(target);
|
587 |
+
do {
|
588 |
+
cur = cur.bind(recurse);
|
589 |
+
} while (cur.isSome());
|
590 |
+
return r;
|
591 |
+
};
|
592 |
+
var $_2myahrlkjjgwedad = { toArray: toArray };
|
593 |
+
|
594 |
+
var Global = typeof window !== 'undefined' ? window : Function('return this;')();
|
595 |
+
|
596 |
+
var path = function (parts, scope) {
|
597 |
+
var o = scope !== undefined && scope !== null ? scope : Global;
|
598 |
+
for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
|
599 |
+
o = o[parts[i]];
|
600 |
+
return o;
|
601 |
+
};
|
602 |
+
var resolve = function (p, scope) {
|
603 |
+
var parts = p.split('.');
|
604 |
+
return path(parts, scope);
|
605 |
+
};
|
606 |
+
|
607 |
+
var unsafe = function (name, scope) {
|
608 |
+
return resolve(name, scope);
|
609 |
+
};
|
610 |
+
var getOrDie = function (name, scope) {
|
611 |
+
var actual = unsafe(name, scope);
|
612 |
+
if (actual === undefined || actual === null)
|
613 |
+
throw name + ' not available on this browser';
|
614 |
+
return actual;
|
615 |
+
};
|
616 |
+
var $_6joju7lnjjgwedap = { getOrDie: getOrDie };
|
617 |
+
|
618 |
+
var node = function () {
|
619 |
+
var f = $_6joju7lnjjgwedap.getOrDie('Node');
|
620 |
+
return f;
|
621 |
+
};
|
622 |
+
var compareDocumentPosition = function (a, b, match) {
|
623 |
+
return (a.compareDocumentPosition(b) & match) !== 0;
|
624 |
+
};
|
625 |
+
var documentPositionPreceding = function (a, b) {
|
626 |
+
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
|
627 |
+
};
|
628 |
+
var documentPositionContainedBy = function (a, b) {
|
629 |
+
return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
|
630 |
+
};
|
631 |
+
var $_30vuy6lmjjgwedao = {
|
632 |
+
documentPositionPreceding: documentPositionPreceding,
|
633 |
+
documentPositionContainedBy: documentPositionContainedBy
|
634 |
+
};
|
635 |
+
|
636 |
+
var cached = function (f) {
|
637 |
+
var called = false;
|
638 |
+
var r;
|
639 |
+
return function () {
|
640 |
+
var args = [];
|
641 |
for (var _i = 0; _i < arguments.length; _i++) {
|
642 |
+
args[_i] = arguments[_i];
|
643 |
}
|
644 |
+
if (!called) {
|
645 |
+
called = true;
|
646 |
+
r = f.apply(null, args);
|
647 |
+
}
|
648 |
+
return r;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
};
|
650 |
+
};
|
651 |
|
652 |
+
var firstMatch = function (regexes, s) {
|
653 |
+
for (var i = 0; i < regexes.length; i++) {
|
654 |
+
var x = regexes[i];
|
655 |
+
if (x.test(s))
|
656 |
+
return x;
|
657 |
+
}
|
658 |
+
return undefined;
|
659 |
+
};
|
660 |
+
var find$2 = function (regexes, agent) {
|
661 |
+
var r = firstMatch(regexes, agent);
|
662 |
+
if (!r)
|
663 |
+
return {
|
664 |
+
major: 0,
|
665 |
+
minor: 0
|
666 |
+
};
|
667 |
+
var group = function (i) {
|
668 |
+
return Number(agent.replace(r, '$' + i));
|
669 |
+
};
|
670 |
+
return nu(group(1), group(2));
|
671 |
+
};
|
672 |
+
var detect = function (versionRegexes, agent) {
|
673 |
+
var cleanedAgent = String(agent).toLowerCase();
|
674 |
+
if (versionRegexes.length === 0)
|
675 |
+
return unknown();
|
676 |
+
return find$2(versionRegexes, cleanedAgent);
|
677 |
+
};
|
678 |
+
var unknown = function () {
|
679 |
+
return nu(0, 0);
|
680 |
+
};
|
681 |
+
var nu = function (major, minor) {
|
682 |
+
return {
|
683 |
+
major: major,
|
684 |
+
minor: minor
|
685 |
+
};
|
686 |
+
};
|
687 |
+
var $_9mbc42lujjgwedb3 = {
|
688 |
+
nu: nu,
|
689 |
+
detect: detect,
|
690 |
+
unknown: unknown
|
691 |
+
};
|
692 |
+
|
693 |
+
var edge = 'Edge';
|
694 |
+
var chrome = 'Chrome';
|
695 |
+
var ie = 'IE';
|
696 |
+
var opera = 'Opera';
|
697 |
+
var firefox = 'Firefox';
|
698 |
+
var safari = 'Safari';
|
699 |
+
var isBrowser = function (name, current) {
|
700 |
+
return function () {
|
701 |
+
return current === name;
|
702 |
+
};
|
703 |
+
};
|
704 |
+
var unknown$1 = function () {
|
705 |
+
return nu$1({
|
706 |
+
current: undefined,
|
707 |
+
version: $_9mbc42lujjgwedb3.unknown()
|
708 |
+
});
|
709 |
+
};
|
710 |
+
var nu$1 = function (info) {
|
711 |
+
var current = info.current;
|
712 |
+
var version = info.version;
|
713 |
+
return {
|
714 |
+
current: current,
|
715 |
+
version: version,
|
716 |
+
isEdge: isBrowser(edge, current),
|
717 |
+
isChrome: isBrowser(chrome, current),
|
718 |
+
isIE: isBrowser(ie, current),
|
719 |
+
isOpera: isBrowser(opera, current),
|
720 |
+
isFirefox: isBrowser(firefox, current),
|
721 |
+
isSafari: isBrowser(safari, current)
|
722 |
+
};
|
723 |
+
};
|
724 |
+
var $_4zhqftltjjgwedaz = {
|
725 |
+
unknown: unknown$1,
|
726 |
+
nu: nu$1,
|
727 |
+
edge: constant(edge),
|
728 |
+
chrome: constant(chrome),
|
729 |
+
ie: constant(ie),
|
730 |
+
opera: constant(opera),
|
731 |
+
firefox: constant(firefox),
|
732 |
+
safari: constant(safari)
|
733 |
+
};
|
734 |
+
|
735 |
+
var windows = 'Windows';
|
736 |
+
var ios = 'iOS';
|
737 |
+
var android = 'Android';
|
738 |
+
var linux = 'Linux';
|
739 |
+
var osx = 'OSX';
|
740 |
+
var solaris = 'Solaris';
|
741 |
+
var freebsd = 'FreeBSD';
|
742 |
+
var isOS = function (name, current) {
|
743 |
+
return function () {
|
744 |
+
return current === name;
|
745 |
+
};
|
746 |
+
};
|
747 |
+
var unknown$2 = function () {
|
748 |
+
return nu$2({
|
749 |
+
current: undefined,
|
750 |
+
version: $_9mbc42lujjgwedb3.unknown()
|
751 |
+
});
|
752 |
+
};
|
753 |
+
var nu$2 = function (info) {
|
754 |
+
var current = info.current;
|
755 |
+
var version = info.version;
|
756 |
+
return {
|
757 |
+
current: current,
|
758 |
+
version: version,
|
759 |
+
isWindows: isOS(windows, current),
|
760 |
+
isiOS: isOS(ios, current),
|
761 |
+
isAndroid: isOS(android, current),
|
762 |
+
isOSX: isOS(osx, current),
|
763 |
+
isLinux: isOS(linux, current),
|
764 |
+
isSolaris: isOS(solaris, current),
|
765 |
+
isFreeBSD: isOS(freebsd, current)
|
766 |
+
};
|
767 |
+
};
|
768 |
+
var $_bwkcqmlvjjgwedb5 = {
|
769 |
+
unknown: unknown$2,
|
770 |
+
nu: nu$2,
|
771 |
+
windows: constant(windows),
|
772 |
+
ios: constant(ios),
|
773 |
+
android: constant(android),
|
774 |
+
linux: constant(linux),
|
775 |
+
osx: constant(osx),
|
776 |
+
solaris: constant(solaris),
|
777 |
+
freebsd: constant(freebsd)
|
778 |
+
};
|
779 |
+
|
780 |
+
function DeviceType (os, browser, userAgent) {
|
781 |
+
var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
|
782 |
+
var isiPhone = os.isiOS() && !isiPad;
|
783 |
+
var isAndroid3 = os.isAndroid() && os.version.major === 3;
|
784 |
+
var isAndroid4 = os.isAndroid() && os.version.major === 4;
|
785 |
+
var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
|
786 |
+
var isTouch = os.isiOS() || os.isAndroid();
|
787 |
+
var isPhone = isTouch && !isTablet;
|
788 |
+
var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
|
789 |
+
return {
|
790 |
+
isiPad: constant(isiPad),
|
791 |
+
isiPhone: constant(isiPhone),
|
792 |
+
isTablet: constant(isTablet),
|
793 |
+
isPhone: constant(isPhone),
|
794 |
+
isTouch: constant(isTouch),
|
795 |
+
isAndroid: os.isAndroid,
|
796 |
+
isiOS: os.isiOS,
|
797 |
+
isWebView: constant(iOSwebview)
|
798 |
+
};
|
799 |
+
}
|
800 |
+
|
801 |
+
var detect$1 = function (candidates, userAgent) {
|
802 |
+
var agent = String(userAgent).toLowerCase();
|
803 |
+
return find(candidates, function (candidate) {
|
804 |
+
return candidate.search(agent);
|
805 |
+
});
|
806 |
+
};
|
807 |
+
var detectBrowser = function (browsers, userAgent) {
|
808 |
+
return detect$1(browsers, userAgent).map(function (browser) {
|
809 |
+
var version = $_9mbc42lujjgwedb3.detect(browser.versionRegexes, userAgent);
|
810 |
+
return {
|
811 |
+
current: browser.name,
|
812 |
+
version: version
|
813 |
};
|
814 |
+
});
|
815 |
+
};
|
816 |
+
var detectOs = function (oses, userAgent) {
|
817 |
+
return detect$1(oses, userAgent).map(function (os) {
|
818 |
+
var version = $_9mbc42lujjgwedb3.detect(os.versionRegexes, userAgent);
|
819 |
+
return {
|
820 |
+
current: os.name,
|
821 |
+
version: version
|
822 |
+
};
|
823 |
+
});
|
824 |
+
};
|
825 |
+
var $_5gg2julxjjgwedbb = {
|
826 |
+
detectBrowser: detectBrowser,
|
827 |
+
detectOs: detectOs
|
828 |
+
};
|
829 |
+
|
830 |
+
var checkRange = function (str, substr, start) {
|
831 |
+
if (substr === '')
|
832 |
+
return true;
|
833 |
+
if (str.length < substr.length)
|
834 |
+
return false;
|
835 |
+
var x = str.substr(start, start + substr.length);
|
836 |
+
return x === substr;
|
837 |
+
};
|
838 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
|
|
|
840 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
|
843 |
+
var contains$1 = function (str, substr) {
|
844 |
+
return str.indexOf(substr) !== -1;
|
845 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
846 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
847 |
|
848 |
+
var endsWith = function (str, suffix) {
|
849 |
+
return checkRange(str, suffix, str.length - suffix.length);
|
850 |
+
};
|
851 |
+
var trim = function (str) {
|
852 |
+
return str.replace(/^\s+|\s+$/g, '');
|
853 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
854 |
|
855 |
+
var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
|
856 |
+
var checkContains = function (target) {
|
857 |
+
return function (uastring) {
|
858 |
+
return contains$1(uastring, target);
|
|
|
|
|
|
|
|
|
|
|
|
|
859 |
};
|
860 |
+
};
|
861 |
+
var browsers = [
|
862 |
+
{
|
863 |
+
name: 'Edge',
|
864 |
+
versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
|
865 |
+
search: function (uastring) {
|
866 |
+
var monstrosity = contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');
|
867 |
+
return monstrosity;
|
868 |
+
}
|
869 |
+
},
|
870 |
+
{
|
871 |
+
name: 'Chrome',
|
872 |
+
versionRegexes: [
|
873 |
+
/.*?chrome\/([0-9]+)\.([0-9]+).*/,
|
874 |
+
normalVersionRegex
|
875 |
+
],
|
876 |
+
search: function (uastring) {
|
877 |
+
return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');
|
878 |
+
}
|
879 |
+
},
|
880 |
+
{
|
881 |
+
name: 'IE',
|
882 |
+
versionRegexes: [
|
883 |
+
/.*?msie\ ?([0-9]+)\.([0-9]+).*/,
|
884 |
+
/.*?rv:([0-9]+)\.([0-9]+).*/
|
885 |
+
],
|
886 |
+
search: function (uastring) {
|
887 |
+
return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');
|
888 |
+
}
|
889 |
+
},
|
890 |
+
{
|
891 |
+
name: 'Opera',
|
892 |
+
versionRegexes: [
|
893 |
+
normalVersionRegex,
|
894 |
+
/.*?opera\/([0-9]+)\.([0-9]+).*/
|
895 |
+
],
|
896 |
+
search: checkContains('opera')
|
897 |
+
},
|
898 |
+
{
|
899 |
+
name: 'Firefox',
|
900 |
+
versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
|
901 |
+
search: checkContains('firefox')
|
902 |
+
},
|
903 |
+
{
|
904 |
+
name: 'Safari',
|
905 |
+
versionRegexes: [
|
906 |
+
normalVersionRegex,
|
907 |
+
/.*?cpu os ([0-9]+)_([0-9]+).*/
|
908 |
+
],
|
909 |
+
search: function (uastring) {
|
910 |
+
return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');
|
911 |
+
}
|
912 |
+
}
|
913 |
+
];
|
914 |
+
var oses = [
|
915 |
+
{
|
916 |
+
name: 'Windows',
|
917 |
+
search: checkContains('win'),
|
918 |
+
versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
|
919 |
+
},
|
920 |
+
{
|
921 |
+
name: 'iOS',
|
922 |
+
search: function (uastring) {
|
923 |
+
return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');
|
924 |
+
},
|
925 |
+
versionRegexes: [
|
926 |
+
/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
|
927 |
+
/.*cpu os ([0-9]+)_([0-9]+).*/,
|
928 |
+
/.*cpu iphone os ([0-9]+)_([0-9]+).*/
|
929 |
+
]
|
930 |
+
},
|
931 |
+
{
|
932 |
+
name: 'Android',
|
933 |
+
search: checkContains('android'),
|
934 |
+
versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
|
935 |
+
},
|
936 |
+
{
|
937 |
+
name: 'OSX',
|
938 |
+
search: checkContains('os x'),
|
939 |
+
versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
|
940 |
+
},
|
941 |
+
{
|
942 |
+
name: 'Linux',
|
943 |
+
search: checkContains('linux'),
|
944 |
+
versionRegexes: []
|
945 |
+
},
|
946 |
+
{
|
947 |
+
name: 'Solaris',
|
948 |
+
search: checkContains('sunos'),
|
949 |
+
versionRegexes: []
|
950 |
+
},
|
951 |
+
{
|
952 |
+
name: 'FreeBSD',
|
953 |
+
search: checkContains('freebsd'),
|
954 |
+
versionRegexes: []
|
955 |
+
}
|
956 |
+
];
|
957 |
+
var $_hf4gnlyjjgwedbf = {
|
958 |
+
browsers: constant(browsers),
|
959 |
+
oses: constant(oses)
|
960 |
+
};
|
961 |
+
|
962 |
+
var detect$2 = function (userAgent) {
|
963 |
+
var browsers = $_hf4gnlyjjgwedbf.browsers();
|
964 |
+
var oses = $_hf4gnlyjjgwedbf.oses();
|
965 |
+
var browser = $_5gg2julxjjgwedbb.detectBrowser(browsers, userAgent).fold($_4zhqftltjjgwedaz.unknown, $_4zhqftltjjgwedaz.nu);
|
966 |
+
var os = $_5gg2julxjjgwedbb.detectOs(oses, userAgent).fold($_bwkcqmlvjjgwedb5.unknown, $_bwkcqmlvjjgwedb5.nu);
|
967 |
+
var deviceType = DeviceType(os, browser, userAgent);
|
968 |
+
return {
|
969 |
+
browser: browser,
|
970 |
+
os: os,
|
971 |
+
deviceType: deviceType
|
972 |
+
};
|
973 |
+
};
|
974 |
+
var $_aiopqmlsjjgweday = { detect: detect$2 };
|
975 |
+
|
976 |
+
var detect$3 = cached(function () {
|
977 |
+
var userAgent = navigator.userAgent;
|
978 |
+
return $_aiopqmlsjjgweday.detect(userAgent);
|
979 |
+
});
|
980 |
+
var $_avfe9dlqjjgwedat = { detect: detect$3 };
|
981 |
+
|
982 |
+
var eq = function (e1, e2) {
|
983 |
+
return e1.dom() === e2.dom();
|
984 |
+
};
|
985 |
+
var isEqualNode = function (e1, e2) {
|
986 |
+
return e1.dom().isEqualNode(e2.dom());
|
987 |
+
};
|
988 |
+
var member = function (element, elements) {
|
989 |
+
return exists(elements, curry(eq, element));
|
990 |
+
};
|
991 |
+
var regularContains = function (e1, e2) {
|
992 |
+
var d1 = e1.dom(), d2 = e2.dom();
|
993 |
+
return d1 === d2 ? false : d1.contains(d2);
|
994 |
+
};
|
995 |
+
var ieContains = function (e1, e2) {
|
996 |
+
return $_30vuy6lmjjgwedao.documentPositionContainedBy(e1.dom(), e2.dom());
|
997 |
+
};
|
998 |
+
var browser = $_avfe9dlqjjgwedat.detect().browser;
|
999 |
+
var contains$2 = browser.isIE() ? ieContains : regularContains;
|
1000 |
+
var $_e1yh5slljjgwedae = {
|
1001 |
+
eq: eq,
|
1002 |
+
isEqualNode: isEqualNode,
|
1003 |
+
member: member,
|
1004 |
+
contains: contains$2,
|
1005 |
+
is: $_5htea7lfjjgwed94.is
|
1006 |
+
};
|
1007 |
+
|
1008 |
+
var owner = function (element) {
|
1009 |
+
return Element$$1.fromDom(element.dom().ownerDocument);
|
1010 |
+
};
|
1011 |
+
var documentElement = function (element) {
|
1012 |
+
return Element$$1.fromDom(element.dom().ownerDocument.documentElement);
|
1013 |
+
};
|
1014 |
+
var defaultView = function (element) {
|
1015 |
+
var el = element.dom();
|
1016 |
+
var defaultView = el.ownerDocument.defaultView;
|
1017 |
+
return Element$$1.fromDom(defaultView);
|
1018 |
+
};
|
1019 |
+
var parent = function (element) {
|
1020 |
+
var dom = element.dom();
|
1021 |
+
return Option.from(dom.parentNode).map(Element$$1.fromDom);
|
1022 |
+
};
|
1023 |
+
var findIndex$1 = function (element) {
|
1024 |
+
return parent(element).bind(function (p) {
|
1025 |
+
var kin = children(p);
|
1026 |
+
return findIndex(kin, function (elem) {
|
1027 |
+
return $_e1yh5slljjgwedae.eq(element, elem);
|
1028 |
});
|
1029 |
+
});
|
1030 |
+
};
|
1031 |
+
var parents = function (element, isRoot) {
|
1032 |
+
var stop = isFunction(isRoot) ? isRoot : constant(false);
|
1033 |
+
var dom = element.dom();
|
1034 |
+
var ret = [];
|
1035 |
+
while (dom.parentNode !== null && dom.parentNode !== undefined) {
|
1036 |
+
var rawParent = dom.parentNode;
|
1037 |
+
var parent = Element$$1.fromDom(rawParent);
|
1038 |
+
ret.push(parent);
|
1039 |
+
if (stop(parent) === true)
|
1040 |
+
break;
|
1041 |
+
else
|
1042 |
+
dom = rawParent;
|
1043 |
+
}
|
1044 |
+
return ret;
|
1045 |
+
};
|
1046 |
+
var siblings = function (element) {
|
1047 |
+
var filterSelf = function (elements) {
|
1048 |
+
return filter(elements, function (x) {
|
1049 |
+
return !$_e1yh5slljjgwedae.eq(element, x);
|
1050 |
+
});
|
1051 |
+
};
|
1052 |
+
return parent(element).map(children).map(filterSelf).getOr([]);
|
1053 |
+
};
|
1054 |
+
var offsetParent = function (element) {
|
1055 |
+
var dom = element.dom();
|
1056 |
+
return Option.from(dom.offsetParent).map(Element$$1.fromDom);
|
1057 |
+
};
|
1058 |
+
var prevSibling = function (element) {
|
1059 |
+
var dom = element.dom();
|
1060 |
+
return Option.from(dom.previousSibling).map(Element$$1.fromDom);
|
1061 |
+
};
|
1062 |
+
var nextSibling = function (element) {
|
1063 |
+
var dom = element.dom();
|
1064 |
+
return Option.from(dom.nextSibling).map(Element$$1.fromDom);
|
1065 |
+
};
|
1066 |
+
var prevSiblings = function (element) {
|
1067 |
+
return reverse($_2myahrlkjjgwedad.toArray(element, prevSibling));
|
1068 |
+
};
|
1069 |
+
var nextSiblings = function (element) {
|
1070 |
+
return $_2myahrlkjjgwedad.toArray(element, nextSibling);
|
1071 |
+
};
|
1072 |
+
var children = function (element) {
|
1073 |
+
var dom = element.dom();
|
1074 |
+
return map(dom.childNodes, Element$$1.fromDom);
|
1075 |
+
};
|
1076 |
+
var child = function (element, index) {
|
1077 |
+
var children = element.dom().childNodes;
|
1078 |
+
return Option.from(children[index]).map(Element$$1.fromDom);
|
1079 |
+
};
|
1080 |
+
var firstChild = function (element) {
|
1081 |
+
return child(element, 0);
|
1082 |
+
};
|
1083 |
+
var lastChild = function (element) {
|
1084 |
+
return child(element, element.dom().childNodes.length - 1);
|
1085 |
+
};
|
1086 |
+
var childNodesCount = function (element) {
|
1087 |
+
return element.dom().childNodes.length;
|
1088 |
+
};
|
1089 |
+
var hasChildNodes = function (element) {
|
1090 |
+
return element.dom().hasChildNodes();
|
1091 |
+
};
|
1092 |
+
var spot = Immutable('element', 'offset');
|
1093 |
+
var leaf = function (element, offset) {
|
1094 |
+
var cs = children(element);
|
1095 |
+
return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
|
1096 |
+
};
|
1097 |
+
var $_97vsilljjjgwed9v = {
|
1098 |
+
owner: owner,
|
1099 |
+
defaultView: defaultView,
|
1100 |
+
documentElement: documentElement,
|
1101 |
+
parent: parent,
|
1102 |
+
findIndex: findIndex$1,
|
1103 |
+
parents: parents,
|
1104 |
+
siblings: siblings,
|
1105 |
+
prevSibling: prevSibling,
|
1106 |
+
offsetParent: offsetParent,
|
1107 |
+
prevSiblings: prevSiblings,
|
1108 |
+
nextSibling: nextSibling,
|
1109 |
+
nextSiblings: nextSiblings,
|
1110 |
+
children: children,
|
1111 |
+
child: child,
|
1112 |
+
firstChild: firstChild,
|
1113 |
+
lastChild: lastChild,
|
1114 |
+
childNodesCount: childNodesCount,
|
1115 |
+
hasChildNodes: hasChildNodes,
|
1116 |
+
leaf: leaf
|
1117 |
+
};
|
1118 |
+
|
1119 |
+
var firstLayer = function (scope, selector) {
|
1120 |
+
return filterFirstLayer(scope, selector, constant(true));
|
1121 |
+
};
|
1122 |
+
var filterFirstLayer = function (scope, selector, predicate) {
|
1123 |
+
return bind($_97vsilljjjgwed9v.children(scope), function (x) {
|
1124 |
+
return $_5htea7lfjjgwed94.is(x, selector) ? predicate(x) ? [x] : [] : filterFirstLayer(x, selector, predicate);
|
1125 |
+
});
|
1126 |
+
};
|
1127 |
+
var $_5gvx1dlejjgwed8t = {
|
1128 |
+
firstLayer: firstLayer,
|
1129 |
+
filterFirstLayer: filterFirstLayer
|
1130 |
+
};
|
1131 |
+
|
1132 |
+
var name = function (element) {
|
1133 |
+
var r = element.dom().nodeName;
|
1134 |
+
return r.toLowerCase();
|
1135 |
+
};
|
1136 |
+
var type = function (element) {
|
1137 |
+
return element.dom().nodeType;
|
1138 |
+
};
|
1139 |
+
var value = function (element) {
|
1140 |
+
return element.dom().nodeValue;
|
1141 |
+
};
|
1142 |
+
var isType$1 = function (t) {
|
1143 |
+
return function (element) {
|
1144 |
+
return type(element) === t;
|
1145 |
+
};
|
1146 |
+
};
|
1147 |
+
var isComment = function (element) {
|
1148 |
+
return type(element) === $_95eswilijjgwed9s.COMMENT || name(element) === '#comment';
|
1149 |
+
};
|
1150 |
+
var isElement = isType$1($_95eswilijjgwed9s.ELEMENT);
|
1151 |
+
var isText = isType$1($_95eswilijjgwed9s.TEXT);
|
1152 |
+
var isDocument = isType$1($_95eswilijjgwed9s.DOCUMENT);
|
1153 |
+
var $_g6duvbm3jjgwedby = {
|
1154 |
+
name: name,
|
1155 |
+
type: type,
|
1156 |
+
value: value,
|
1157 |
+
isElement: isElement,
|
1158 |
+
isText: isText,
|
1159 |
+
isDocument: isDocument,
|
1160 |
+
isComment: isComment
|
1161 |
+
};
|
1162 |
+
|
1163 |
+
var rawSet = function (dom, key, value) {
|
1164 |
+
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
1165 |
+
dom.setAttribute(key, value + '');
|
1166 |
+
} else {
|
1167 |
+
console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
|
1168 |
+
throw new Error('Attribute value was not simple');
|
1169 |
+
}
|
1170 |
+
};
|
1171 |
+
var set = function (element, key, value) {
|
1172 |
+
rawSet(element.dom(), key, value);
|
1173 |
+
};
|
1174 |
+
var setAll = function (element, attrs) {
|
1175 |
+
var dom = element.dom();
|
1176 |
+
each$1(attrs, function (v, k) {
|
1177 |
+
rawSet(dom, k, v);
|
1178 |
+
});
|
1179 |
+
};
|
1180 |
+
var get = function (element, key) {
|
1181 |
+
var v = element.dom().getAttribute(key);
|
1182 |
+
return v === null ? undefined : v;
|
1183 |
+
};
|
1184 |
+
var has = function (element, key) {
|
1185 |
+
var dom = element.dom();
|
1186 |
+
return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
|
1187 |
+
};
|
1188 |
+
var remove = function (element, key) {
|
1189 |
+
element.dom().removeAttribute(key);
|
1190 |
+
};
|
1191 |
+
var hasNone = function (element) {
|
1192 |
+
var attrs = element.dom().attributes;
|
1193 |
+
return attrs === undefined || attrs === null || attrs.length === 0;
|
1194 |
+
};
|
1195 |
+
var clone = function (element) {
|
1196 |
+
return foldl(element.dom().attributes, function (acc, attr) {
|
1197 |
+
acc[attr.name] = attr.value;
|
1198 |
+
return acc;
|
1199 |
+
}, {});
|
1200 |
+
};
|
1201 |
+
var transferOne = function (source, destination, attr) {
|
1202 |
+
if (has(source, attr) && !has(destination, attr))
|
1203 |
+
set(destination, attr, get(source, attr));
|
1204 |
+
};
|
1205 |
+
var transfer = function (source, destination, attrs) {
|
1206 |
+
if (!$_g6duvbm3jjgwedby.isElement(source) || !$_g6duvbm3jjgwedby.isElement(destination))
|
1207 |
+
return;
|
1208 |
+
each(attrs, function (attr) {
|
1209 |
+
transferOne(source, destination, attr);
|
1210 |
+
});
|
1211 |
+
};
|
1212 |
+
var $_72hn9pm2jjgwedbq = {
|
1213 |
+
clone: clone,
|
1214 |
+
set: set,
|
1215 |
+
setAll: setAll,
|
1216 |
+
get: get,
|
1217 |
+
has: has,
|
1218 |
+
remove: remove,
|
1219 |
+
hasNone: hasNone,
|
1220 |
+
transfer: transfer
|
1221 |
+
};
|
1222 |
+
|
1223 |
+
var inBody = function (element) {
|
1224 |
+
var dom = $_g6duvbm3jjgwedby.isText(element) ? element.dom().parentNode : element.dom();
|
1225 |
+
return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
|
1226 |
+
};
|
1227 |
+
var body = cached(function () {
|
1228 |
+
return getBody(Element$$1.fromDom(document));
|
1229 |
+
});
|
1230 |
+
var getBody = function (doc) {
|
1231 |
+
var body = doc.dom().body;
|
1232 |
+
if (body === null || body === undefined)
|
1233 |
+
throw 'Body is not available yet';
|
1234 |
+
return Element$$1.fromDom(body);
|
1235 |
+
};
|
1236 |
+
var $_95kxntm6jjgwedc6 = {
|
1237 |
+
body: body,
|
1238 |
+
getBody: getBody,
|
1239 |
+
inBody: inBody
|
1240 |
+
};
|
1241 |
+
|
1242 |
+
var all$1 = function (predicate) {
|
1243 |
+
return descendants($_95kxntm6jjgwedc6.body(), predicate);
|
1244 |
+
};
|
1245 |
+
var ancestors = function (scope, predicate, isRoot) {
|
1246 |
+
return filter($_97vsilljjjgwed9v.parents(scope, isRoot), predicate);
|
1247 |
+
};
|
1248 |
+
var siblings$1 = function (scope, predicate) {
|
1249 |
+
return filter($_97vsilljjjgwed9v.siblings(scope), predicate);
|
1250 |
+
};
|
1251 |
+
var children$1 = function (scope, predicate) {
|
1252 |
+
return filter($_97vsilljjjgwed9v.children(scope), predicate);
|
1253 |
+
};
|
1254 |
+
var descendants = function (scope, predicate) {
|
1255 |
+
var result = [];
|
1256 |
+
each($_97vsilljjjgwed9v.children(scope), function (x) {
|
1257 |
+
if (predicate(x)) {
|
1258 |
+
result = result.concat([x]);
|
1259 |
+
}
|
1260 |
+
result = result.concat(descendants(x, predicate));
|
1261 |
+
});
|
1262 |
+
return result;
|
1263 |
+
};
|
1264 |
+
var $_a2tivmm5jjgwedc3 = {
|
1265 |
+
all: all$1,
|
1266 |
+
ancestors: ancestors,
|
1267 |
+
siblings: siblings$1,
|
1268 |
+
children: children$1,
|
1269 |
+
descendants: descendants
|
1270 |
+
};
|
1271 |
+
|
1272 |
+
var all$2 = function (selector) {
|
1273 |
+
return $_5htea7lfjjgwed94.all(selector);
|
1274 |
+
};
|
1275 |
+
var ancestors$1 = function (scope, selector, isRoot) {
|
1276 |
+
return $_a2tivmm5jjgwedc3.ancestors(scope, function (e) {
|
1277 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1278 |
+
}, isRoot);
|
1279 |
+
};
|
1280 |
+
var siblings$2 = function (scope, selector) {
|
1281 |
+
return $_a2tivmm5jjgwedc3.siblings(scope, function (e) {
|
1282 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1283 |
+
});
|
1284 |
+
};
|
1285 |
+
var children$2 = function (scope, selector) {
|
1286 |
+
return $_a2tivmm5jjgwedc3.children(scope, function (e) {
|
1287 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1288 |
+
});
|
1289 |
+
};
|
1290 |
+
var descendants$1 = function (scope, selector) {
|
1291 |
+
return $_5htea7lfjjgwed94.all(selector, scope);
|
1292 |
+
};
|
1293 |
+
var $_5ko5j3m4jjgwedc0 = {
|
1294 |
+
all: all$2,
|
1295 |
+
ancestors: ancestors$1,
|
1296 |
+
siblings: siblings$2,
|
1297 |
+
children: children$2,
|
1298 |
+
descendants: descendants$1
|
1299 |
+
};
|
1300 |
+
|
1301 |
+
function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
|
1302 |
+
return is(scope, a) ? Option.some(scope) : isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
var first$1 = function (predicate) {
|
1306 |
+
return descendant($_95kxntm6jjgwedc6.body(), predicate);
|
1307 |
+
};
|
1308 |
+
var ancestor = function (scope, predicate, isRoot) {
|
1309 |
+
var element = scope.dom();
|
1310 |
+
var stop = isFunction(isRoot) ? isRoot : constant(false);
|
1311 |
+
while (element.parentNode) {
|
1312 |
+
element = element.parentNode;
|
1313 |
+
var el = Element$$1.fromDom(element);
|
1314 |
+
if (predicate(el))
|
1315 |
+
return Option.some(el);
|
1316 |
+
else if (stop(el))
|
1317 |
+
break;
|
1318 |
+
}
|
1319 |
+
return Option.none();
|
1320 |
+
};
|
1321 |
+
var closest = function (scope, predicate, isRoot) {
|
1322 |
+
var is = function (scope) {
|
1323 |
+
return predicate(scope);
|
1324 |
+
};
|
1325 |
+
return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
|
1326 |
+
};
|
1327 |
+
var sibling = function (scope, predicate) {
|
1328 |
+
var element = scope.dom();
|
1329 |
+
if (!element.parentNode)
|
1330 |
+
return Option.none();
|
1331 |
+
return child$1(Element$$1.fromDom(element.parentNode), function (x) {
|
1332 |
+
return !$_e1yh5slljjgwedae.eq(scope, x) && predicate(x);
|
1333 |
+
});
|
1334 |
+
};
|
1335 |
+
var child$1 = function (scope, predicate) {
|
1336 |
+
var result = find(scope.dom().childNodes, compose(predicate, Element$$1.fromDom));
|
1337 |
+
return result.map(Element$$1.fromDom);
|
1338 |
+
};
|
1339 |
+
var descendant = function (scope, predicate) {
|
1340 |
+
var descend = function (node) {
|
1341 |
+
for (var i = 0; i < node.childNodes.length; i++) {
|
1342 |
+
if (predicate(Element$$1.fromDom(node.childNodes[i])))
|
1343 |
+
return Option.some(Element$$1.fromDom(node.childNodes[i]));
|
1344 |
+
var res = descend(node.childNodes[i]);
|
1345 |
+
if (res.isSome())
|
1346 |
+
return res;
|
1347 |
+
}
|
1348 |
+
return Option.none();
|
1349 |
};
|
1350 |
+
return descend(scope.dom());
|
1351 |
+
};
|
1352 |
+
var $_6l4e4m8jjgwedci = {
|
1353 |
+
first: first$1,
|
1354 |
+
ancestor: ancestor,
|
1355 |
+
closest: closest,
|
1356 |
+
sibling: sibling,
|
1357 |
+
child: child$1,
|
1358 |
+
descendant: descendant
|
1359 |
+
};
|
1360 |
+
|
1361 |
+
var first$2 = function (selector) {
|
1362 |
+
return $_5htea7lfjjgwed94.one(selector);
|
1363 |
+
};
|
1364 |
+
var ancestor$1 = function (scope, selector, isRoot) {
|
1365 |
+
return $_6l4e4m8jjgwedci.ancestor(scope, function (e) {
|
1366 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1367 |
+
}, isRoot);
|
1368 |
+
};
|
1369 |
+
var sibling$1 = function (scope, selector) {
|
1370 |
+
return $_6l4e4m8jjgwedci.sibling(scope, function (e) {
|
1371 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1372 |
+
});
|
1373 |
+
};
|
1374 |
+
var child$2 = function (scope, selector) {
|
1375 |
+
return $_6l4e4m8jjgwedci.child(scope, function (e) {
|
1376 |
+
return $_5htea7lfjjgwed94.is(e, selector);
|
1377 |
+
});
|
1378 |
+
};
|
1379 |
+
var descendant$1 = function (scope, selector) {
|
1380 |
+
return $_5htea7lfjjgwed94.one(selector, scope);
|
1381 |
+
};
|
1382 |
+
var closest$1 = function (scope, selector, isRoot) {
|
1383 |
+
return ClosestOrAncestor($_5htea7lfjjgwed94.is, ancestor$1, scope, selector, isRoot);
|
1384 |
+
};
|
1385 |
+
var $_2e7p77m7jjgwedcg = {
|
1386 |
+
first: first$2,
|
1387 |
+
ancestor: ancestor$1,
|
1388 |
+
sibling: sibling$1,
|
1389 |
+
child: child$2,
|
1390 |
+
descendant: descendant$1,
|
1391 |
+
closest: closest$1
|
1392 |
+
};
|
1393 |
+
|
1394 |
+
var lookup = function (tags, element, _isRoot) {
|
1395 |
+
var isRoot = _isRoot !== undefined ? _isRoot : constant(false);
|
1396 |
+
if (isRoot(element))
|
1397 |
+
return Option.none();
|
1398 |
+
if (contains(tags, $_g6duvbm3jjgwedby.name(element)))
|
1399 |
+
return Option.some(element);
|
1400 |
+
var isRootOrUpperTable = function (element) {
|
1401 |
+
return $_5htea7lfjjgwed94.is(element, 'table') || isRoot(element);
|
1402 |
+
};
|
1403 |
+
return $_2e7p77m7jjgwedcg.ancestor(element, tags.join(','), isRootOrUpperTable);
|
1404 |
+
};
|
1405 |
+
var cell = function (element, isRoot) {
|
1406 |
+
return lookup([
|
1407 |
+
'td',
|
1408 |
+
'th'
|
1409 |
+
], element, isRoot);
|
1410 |
+
};
|
1411 |
+
var cells = function (ancestor) {
|
1412 |
+
return $_5gvx1dlejjgwed8t.firstLayer(ancestor, 'th,td');
|
1413 |
+
};
|
1414 |
+
var notCell = function (element, isRoot) {
|
1415 |
+
return lookup([
|
1416 |
+
'caption',
|
1417 |
+
'tr',
|
1418 |
+
'tbody',
|
1419 |
+
'tfoot',
|
1420 |
+
'thead'
|
1421 |
+
], element, isRoot);
|
1422 |
+
};
|
1423 |
+
var neighbours = function (selector, element) {
|
1424 |
+
return $_97vsilljjjgwed9v.parent(element).map(function (parent) {
|
1425 |
+
return $_5ko5j3m4jjgwedc0.children(parent, selector);
|
1426 |
+
});
|
1427 |
+
};
|
1428 |
+
var neighbourCells = curry(neighbours, 'th,td');
|
1429 |
+
var neighbourRows = curry(neighbours, 'tr');
|
1430 |
+
var firstCell = function (ancestor) {
|
1431 |
+
return $_2e7p77m7jjgwedcg.descendant(ancestor, 'th,td');
|
1432 |
+
};
|
1433 |
+
var table = function (element, isRoot) {
|
1434 |
+
return $_2e7p77m7jjgwedcg.closest(element, 'table', isRoot);
|
1435 |
+
};
|
1436 |
+
var row = function (element, isRoot) {
|
1437 |
+
return lookup(['tr'], element, isRoot);
|
1438 |
+
};
|
1439 |
+
var rows = function (ancestor) {
|
1440 |
+
return $_5gvx1dlejjgwed8t.firstLayer(ancestor, 'tr');
|
1441 |
+
};
|
1442 |
+
var attr = function (element, property) {
|
1443 |
+
return parseInt($_72hn9pm2jjgwedbq.get(element, property), 10);
|
1444 |
+
};
|
1445 |
+
var grid$1 = function (element, rowProp, colProp) {
|
1446 |
+
var rows = attr(element, rowProp);
|
1447 |
+
var cols = attr(element, colProp);
|
1448 |
+
return $_6lasqllcjjgwed80.grid(rows, cols);
|
1449 |
+
};
|
1450 |
+
var $_bmlvw1ldjjgwed84 = {
|
1451 |
+
cell: cell,
|
1452 |
+
firstCell: firstCell,
|
1453 |
+
cells: cells,
|
1454 |
+
neighbourCells: neighbourCells,
|
1455 |
+
table: table,
|
1456 |
+
row: row,
|
1457 |
+
rows: rows,
|
1458 |
+
notCell: notCell,
|
1459 |
+
neighbourRows: neighbourRows,
|
1460 |
+
attr: attr,
|
1461 |
+
grid: grid$1
|
1462 |
+
};
|
1463 |
+
|
1464 |
+
var fromTable = function (table) {
|
1465 |
+
var rows = $_bmlvw1ldjjgwed84.rows(table);
|
1466 |
+
return map(rows, function (row) {
|
1467 |
+
var element = row;
|
1468 |
+
var parent = $_97vsilljjjgwed9v.parent(element);
|
1469 |
+
var parentSection = parent.map(function (parent) {
|
1470 |
+
var parentName = $_g6duvbm3jjgwedby.name(parent);
|
1471 |
+
return parentName === 'tfoot' || parentName === 'thead' || parentName === 'tbody' ? parentName : 'tbody';
|
1472 |
+
}).getOr('tbody');
|
1473 |
+
var cells = map($_bmlvw1ldjjgwed84.cells(row), function (cell) {
|
1474 |
+
var rowspan = $_72hn9pm2jjgwedbq.has(cell, 'rowspan') ? parseInt($_72hn9pm2jjgwedbq.get(cell, 'rowspan'), 10) : 1;
|
1475 |
+
var colspan = $_72hn9pm2jjgwedbq.has(cell, 'colspan') ? parseInt($_72hn9pm2jjgwedbq.get(cell, 'colspan'), 10) : 1;
|
1476 |
+
return $_6lasqllcjjgwed80.detail(cell, rowspan, colspan);
|
1477 |
+
});
|
1478 |
+
return $_6lasqllcjjgwed80.rowdata(element, cells, parentSection);
|
1479 |
+
});
|
1480 |
+
};
|
1481 |
+
var fromPastedRows = function (rows, example) {
|
1482 |
+
return map(rows, function (row) {
|
1483 |
+
var cells = map($_bmlvw1ldjjgwed84.cells(row), function (cell) {
|
1484 |
+
var rowspan = $_72hn9pm2jjgwedbq.has(cell, 'rowspan') ? parseInt($_72hn9pm2jjgwedbq.get(cell, 'rowspan'), 10) : 1;
|
1485 |
+
var colspan = $_72hn9pm2jjgwedbq.has(cell, 'colspan') ? parseInt($_72hn9pm2jjgwedbq.get(cell, 'colspan'), 10) : 1;
|
1486 |
+
return $_6lasqllcjjgwed80.detail(cell, rowspan, colspan);
|
1487 |
+
});
|
1488 |
+
return $_6lasqllcjjgwed80.rowdata(row, cells, example.section());
|
1489 |
+
});
|
1490 |
+
};
|
1491 |
+
var $_da6e59lbjjgwed7r = {
|
1492 |
+
fromTable: fromTable,
|
1493 |
+
fromPastedRows: fromPastedRows
|
1494 |
+
};
|
1495 |
+
|
1496 |
+
var key = function (row, column) {
|
1497 |
+
return row + ',' + column;
|
1498 |
+
};
|
1499 |
+
var getAt = function (warehouse, row, column) {
|
1500 |
+
var raw = warehouse.access()[key(row, column)];
|
1501 |
+
return raw !== undefined ? Option.some(raw) : Option.none();
|
1502 |
+
};
|
1503 |
+
var findItem = function (warehouse, item, comparator) {
|
1504 |
+
var filtered = filterItems(warehouse, function (detail) {
|
1505 |
+
return comparator(item, detail.element());
|
1506 |
+
});
|
1507 |
+
return filtered.length > 0 ? Option.some(filtered[0]) : Option.none();
|
1508 |
+
};
|
1509 |
+
var filterItems = function (warehouse, predicate) {
|
1510 |
+
var all = bind(warehouse.all(), function (r) {
|
1511 |
+
return r.cells();
|
1512 |
+
});
|
1513 |
+
return filter(all, predicate);
|
1514 |
+
};
|
1515 |
+
var generate = function (list) {
|
1516 |
+
var access = {};
|
1517 |
+
var cells = [];
|
1518 |
+
var maxRows = list.length;
|
1519 |
+
var maxColumns = 0;
|
1520 |
+
each(list, function (details, r) {
|
1521 |
+
var currentRow = [];
|
1522 |
+
each(details.cells(), function (detail, c) {
|
1523 |
+
var start = 0;
|
1524 |
+
while (access[key(r, start)] !== undefined) {
|
1525 |
+
start++;
|
1526 |
}
|
1527 |
+
var current = $_6lasqllcjjgwed80.extended(detail.element(), detail.rowspan(), detail.colspan(), r, start);
|
1528 |
+
for (var i = 0; i < detail.colspan(); i++) {
|
1529 |
+
for (var j = 0; j < detail.rowspan(); j++) {
|
1530 |
+
var cr = r + j;
|
1531 |
+
var cc = start + i;
|
1532 |
+
var newpos = key(cr, cc);
|
1533 |
+
access[newpos] = current;
|
1534 |
+
maxColumns = Math.max(maxColumns, cc + 1);
|
1535 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1536 |
}
|
1537 |
+
currentRow.push(current);
|
1538 |
+
});
|
1539 |
+
cells.push($_6lasqllcjjgwed80.rowdata(details.element(), currentRow, details.section()));
|
1540 |
+
});
|
1541 |
+
var grid = $_6lasqllcjjgwed80.grid(maxRows, maxColumns);
|
1542 |
+
return {
|
1543 |
+
grid: constant(grid),
|
1544 |
+
access: constant(access),
|
1545 |
+
all: constant(cells)
|
1546 |
+
};
|
1547 |
+
};
|
1548 |
+
var justCells = function (warehouse) {
|
1549 |
+
var rows = map(warehouse.all(), function (w) {
|
1550 |
+
return w.cells();
|
1551 |
+
});
|
1552 |
+
return flatten(rows);
|
1553 |
+
};
|
1554 |
+
var $_eesv8pmajjgwedcx = {
|
1555 |
+
generate: generate,
|
1556 |
+
getAt: getAt,
|
1557 |
+
findItem: findItem,
|
1558 |
+
filterItems: filterItems,
|
1559 |
+
justCells: justCells
|
1560 |
+
};
|
1561 |
+
|
1562 |
+
var isSupported = function (dom) {
|
1563 |
+
return dom.style !== undefined;
|
1564 |
+
};
|
1565 |
+
var $_5f4hknmcjjgweddm = { isSupported: isSupported };
|
1566 |
+
|
1567 |
+
var internalSet = function (dom, property, value) {
|
1568 |
+
if (!isString(value)) {
|
1569 |
+
console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
|
1570 |
+
throw new Error('CSS value must be a string: ' + value);
|
1571 |
+
}
|
1572 |
+
if ($_5f4hknmcjjgweddm.isSupported(dom))
|
1573 |
+
dom.style.setProperty(property, value);
|
1574 |
+
};
|
1575 |
+
var internalRemove = function (dom, property) {
|
1576 |
+
if ($_5f4hknmcjjgweddm.isSupported(dom))
|
1577 |
+
dom.style.removeProperty(property);
|
1578 |
+
};
|
1579 |
+
var set$1 = function (element, property, value) {
|
1580 |
+
var dom = element.dom();
|
1581 |
+
internalSet(dom, property, value);
|
1582 |
+
};
|
1583 |
+
var setAll$1 = function (element, css) {
|
1584 |
+
var dom = element.dom();
|
1585 |
+
each$1(css, function (v, k) {
|
1586 |
+
internalSet(dom, k, v);
|
1587 |
+
});
|
1588 |
+
};
|
1589 |
+
var setOptions = function (element, css) {
|
1590 |
+
var dom = element.dom();
|
1591 |
+
each$1(css, function (v, k) {
|
1592 |
+
v.fold(function () {
|
1593 |
+
internalRemove(dom, k);
|
1594 |
+
}, function (value) {
|
1595 |
+
internalSet(dom, k, value);
|
1596 |
+
});
|
1597 |
+
});
|
1598 |
+
};
|
1599 |
+
var get$1 = function (element, property) {
|
1600 |
+
var dom = element.dom();
|
1601 |
+
var styles = window.getComputedStyle(dom);
|
1602 |
+
var r = styles.getPropertyValue(property);
|
1603 |
+
var v = r === '' && !$_95kxntm6jjgwedc6.inBody(element) ? getUnsafeProperty(dom, property) : r;
|
1604 |
+
return v === null ? undefined : v;
|
1605 |
+
};
|
1606 |
+
var getUnsafeProperty = function (dom, property) {
|
1607 |
+
return $_5f4hknmcjjgweddm.isSupported(dom) ? dom.style.getPropertyValue(property) : '';
|
1608 |
+
};
|
1609 |
+
var getRaw = function (element, property) {
|
1610 |
+
var dom = element.dom();
|
1611 |
+
var raw = getUnsafeProperty(dom, property);
|
1612 |
+
return Option.from(raw).filter(function (r) {
|
1613 |
+
return r.length > 0;
|
1614 |
+
});
|
1615 |
+
};
|
1616 |
+
var getAllRaw = function (element) {
|
1617 |
+
var css = {};
|
1618 |
+
var dom = element.dom();
|
1619 |
+
if ($_5f4hknmcjjgweddm.isSupported(dom)) {
|
1620 |
+
for (var i = 0; i < dom.style.length; i++) {
|
1621 |
+
var ruleName = dom.style.item(i);
|
1622 |
+
css[ruleName] = dom.style[ruleName];
|
1623 |
}
|
1624 |
+
}
|
1625 |
+
return css;
|
1626 |
+
};
|
1627 |
+
var isValidValue = function (tag, property, value) {
|
1628 |
+
var element = Element$$1.fromTag(tag);
|
1629 |
+
set$1(element, property, value);
|
1630 |
+
var style = getRaw(element, property);
|
1631 |
+
return style.isSome();
|
1632 |
+
};
|
1633 |
+
var remove$1 = function (element, property) {
|
1634 |
+
var dom = element.dom();
|
1635 |
+
internalRemove(dom, property);
|
1636 |
+
if ($_72hn9pm2jjgwedbq.has(element, 'style') && trim($_72hn9pm2jjgwedbq.get(element, 'style')) === '') {
|
1637 |
+
$_72hn9pm2jjgwedbq.remove(element, 'style');
|
1638 |
+
}
|
1639 |
+
};
|
1640 |
+
var preserve = function (element, f) {
|
1641 |
+
var oldStyles = $_72hn9pm2jjgwedbq.get(element, 'style');
|
1642 |
+
var result = f(element);
|
1643 |
+
var restore = oldStyles === undefined ? $_72hn9pm2jjgwedbq.remove : $_72hn9pm2jjgwedbq.set;
|
1644 |
+
restore(element, 'style', oldStyles);
|
1645 |
+
return result;
|
1646 |
+
};
|
1647 |
+
var copy = function (source, target) {
|
1648 |
+
var sourceDom = source.dom();
|
1649 |
+
var targetDom = target.dom();
|
1650 |
+
if ($_5f4hknmcjjgweddm.isSupported(sourceDom) && $_5f4hknmcjjgweddm.isSupported(targetDom)) {
|
1651 |
+
targetDom.style.cssText = sourceDom.style.cssText;
|
1652 |
+
}
|
1653 |
+
};
|
1654 |
+
var reflow = function (e) {
|
1655 |
+
return e.dom().offsetWidth;
|
1656 |
+
};
|
1657 |
+
var transferOne$1 = function (source, destination, style) {
|
1658 |
+
getRaw(source, style).each(function (value) {
|
1659 |
+
if (getRaw(destination, style).isNone())
|
1660 |
+
set$1(destination, style, value);
|
1661 |
+
});
|
1662 |
+
};
|
1663 |
+
var transfer$1 = function (source, destination, styles) {
|
1664 |
+
if (!$_g6duvbm3jjgwedby.isElement(source) || !$_g6duvbm3jjgwedby.isElement(destination))
|
1665 |
+
return;
|
1666 |
+
each(styles, function (style) {
|
1667 |
+
transferOne$1(source, destination, style);
|
1668 |
+
});
|
1669 |
+
};
|
1670 |
+
var $_59neaymbjjgwedd8 = {
|
1671 |
+
copy: copy,
|
1672 |
+
set: set$1,
|
1673 |
+
preserve: preserve,
|
1674 |
+
setAll: setAll$1,
|
1675 |
+
setOptions: setOptions,
|
1676 |
+
remove: remove$1,
|
1677 |
+
get: get$1,
|
1678 |
+
getRaw: getRaw,
|
1679 |
+
getAllRaw: getAllRaw,
|
1680 |
+
isValidValue: isValidValue,
|
1681 |
+
reflow: reflow,
|
1682 |
+
transfer: transfer$1
|
1683 |
+
};
|
1684 |
+
|
1685 |
+
var before = function (marker, element) {
|
1686 |
+
var parent = $_97vsilljjjgwed9v.parent(marker);
|
1687 |
+
parent.each(function (v) {
|
1688 |
+
v.dom().insertBefore(element.dom(), marker.dom());
|
1689 |
+
});
|
1690 |
+
};
|
1691 |
+
var after = function (marker, element) {
|
1692 |
+
var sibling = $_97vsilljjjgwed9v.nextSibling(marker);
|
1693 |
+
sibling.fold(function () {
|
1694 |
+
var parent = $_97vsilljjjgwed9v.parent(marker);
|
1695 |
+
parent.each(function (v) {
|
1696 |
+
append(v, element);
|
1697 |
+
});
|
1698 |
+
}, function (v) {
|
1699 |
+
before(v, element);
|
1700 |
+
});
|
1701 |
+
};
|
1702 |
+
var prepend = function (parent, element) {
|
1703 |
+
var firstChild = $_97vsilljjjgwed9v.firstChild(parent);
|
1704 |
+
firstChild.fold(function () {
|
1705 |
+
append(parent, element);
|
1706 |
+
}, function (v) {
|
1707 |
+
parent.dom().insertBefore(element.dom(), v.dom());
|
1708 |
+
});
|
1709 |
+
};
|
1710 |
+
var append = function (parent, element) {
|
1711 |
+
parent.dom().appendChild(element.dom());
|
1712 |
+
};
|
1713 |
+
var appendAt = function (parent, element, index) {
|
1714 |
+
$_97vsilljjjgwed9v.child(parent, index).fold(function () {
|
1715 |
+
append(parent, element);
|
1716 |
+
}, function (v) {
|
1717 |
+
before(v, element);
|
1718 |
+
});
|
1719 |
+
};
|
1720 |
+
var wrap = function (element, wrapper) {
|
1721 |
+
before(element, wrapper);
|
1722 |
+
append(wrapper, element);
|
1723 |
+
};
|
1724 |
+
var $_1yoqsmmdjjgweddo = {
|
1725 |
+
before: before,
|
1726 |
+
after: after,
|
1727 |
+
prepend: prepend,
|
1728 |
+
append: append,
|
1729 |
+
appendAt: appendAt,
|
1730 |
+
wrap: wrap
|
1731 |
+
};
|
1732 |
+
|
1733 |
+
var before$1 = function (marker, elements) {
|
1734 |
+
each(elements, function (x) {
|
1735 |
+
$_1yoqsmmdjjgweddo.before(marker, x);
|
1736 |
+
});
|
1737 |
+
};
|
1738 |
+
var after$1 = function (marker, elements) {
|
1739 |
+
each(elements, function (x, i) {
|
1740 |
+
var e = i === 0 ? marker : elements[i - 1];
|
1741 |
+
$_1yoqsmmdjjgweddo.after(e, x);
|
1742 |
+
});
|
1743 |
+
};
|
1744 |
+
var prepend$1 = function (parent, elements) {
|
1745 |
+
each(elements.slice().reverse(), function (x) {
|
1746 |
+
$_1yoqsmmdjjgweddo.prepend(parent, x);
|
1747 |
+
});
|
1748 |
+
};
|
1749 |
+
var append$1 = function (parent, elements) {
|
1750 |
+
each(elements, function (x) {
|
1751 |
+
$_1yoqsmmdjjgweddo.append(parent, x);
|
1752 |
+
});
|
1753 |
+
};
|
1754 |
+
var $_7onf0emfjjgweddu = {
|
1755 |
+
before: before$1,
|
1756 |
+
after: after$1,
|
1757 |
+
prepend: prepend$1,
|
1758 |
+
append: append$1
|
1759 |
+
};
|
1760 |
+
|
1761 |
+
var empty = function (element) {
|
1762 |
+
element.dom().textContent = '';
|
1763 |
+
each($_97vsilljjjgwed9v.children(element), function (rogue) {
|
1764 |
+
remove$2(rogue);
|
1765 |
+
});
|
1766 |
+
};
|
1767 |
+
var remove$2 = function (element) {
|
1768 |
+
var dom = element.dom();
|
1769 |
+
if (dom.parentNode !== null)
|
1770 |
+
dom.parentNode.removeChild(dom);
|
1771 |
+
};
|
1772 |
+
var unwrap = function (wrapper) {
|
1773 |
+
var children = $_97vsilljjjgwed9v.children(wrapper);
|
1774 |
+
if (children.length > 0)
|
1775 |
+
$_7onf0emfjjgweddu.before(wrapper, children);
|
1776 |
+
remove$2(wrapper);
|
1777 |
+
};
|
1778 |
+
var $_1y8qodmejjgweddq = {
|
1779 |
+
empty: empty,
|
1780 |
+
remove: remove$2,
|
1781 |
+
unwrap: unwrap
|
1782 |
+
};
|
1783 |
+
|
1784 |
+
var stats = Immutable('minRow', 'minCol', 'maxRow', 'maxCol');
|
1785 |
+
var findSelectedStats = function (house, isSelected) {
|
1786 |
+
var totalColumns = house.grid().columns();
|
1787 |
+
var totalRows = house.grid().rows();
|
1788 |
+
var minRow = totalRows;
|
1789 |
+
var minCol = totalColumns;
|
1790 |
+
var maxRow = 0;
|
1791 |
+
var maxCol = 0;
|
1792 |
+
each$1(house.access(), function (detail) {
|
1793 |
+
if (isSelected(detail)) {
|
1794 |
+
var startRow = detail.row();
|
1795 |
+
var endRow = startRow + detail.rowspan() - 1;
|
1796 |
+
var startCol = detail.column();
|
1797 |
+
var endCol = startCol + detail.colspan() - 1;
|
1798 |
+
if (startRow < minRow)
|
1799 |
+
minRow = startRow;
|
1800 |
+
else if (endRow > maxRow)
|
1801 |
+
maxRow = endRow;
|
1802 |
+
if (startCol < minCol)
|
1803 |
+
minCol = startCol;
|
1804 |
+
else if (endCol > maxCol)
|
1805 |
+
maxCol = endCol;
|
1806 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1807 |
});
|
1808 |
+
return stats(minRow, minCol, maxRow, maxCol);
|
1809 |
+
};
|
1810 |
+
var makeCell = function (list, seenSelected, rowIndex) {
|
1811 |
+
var row = list[rowIndex].element();
|
1812 |
+
var td = Element$$1.fromTag('td');
|
1813 |
+
$_1yoqsmmdjjgweddo.append(td, Element$$1.fromTag('br'));
|
1814 |
+
var f = seenSelected ? $_1yoqsmmdjjgweddo.append : $_1yoqsmmdjjgweddo.prepend;
|
1815 |
+
f(row, td);
|
1816 |
+
};
|
1817 |
+
var fillInGaps = function (list, house, stats, isSelected) {
|
1818 |
+
var totalColumns = house.grid().columns();
|
1819 |
+
var totalRows = house.grid().rows();
|
1820 |
+
for (var i = 0; i < totalRows; i++) {
|
1821 |
+
var seenSelected = false;
|
1822 |
+
for (var j = 0; j < totalColumns; j++) {
|
1823 |
+
if (!(i < stats.minRow() || i > stats.maxRow() || j < stats.minCol() || j > stats.maxCol())) {
|
1824 |
+
var needCell = $_eesv8pmajjgwedcx.getAt(house, i, j).filter(isSelected).isNone();
|
1825 |
+
if (needCell)
|
1826 |
+
makeCell(list, seenSelected, i);
|
1827 |
+
else
|
1828 |
+
seenSelected = true;
|
1829 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1830 |
}
|
1831 |
+
}
|
1832 |
+
};
|
1833 |
+
var clean = function (table, stats) {
|
1834 |
+
var emptyRows = filter($_5gvx1dlejjgwed8t.firstLayer(table, 'tr'), function (row) {
|
1835 |
+
return row.dom().childElementCount === 0;
|
1836 |
+
});
|
1837 |
+
each(emptyRows, $_1y8qodmejjgweddq.remove);
|
1838 |
+
if (stats.minCol() === stats.maxCol() || stats.minRow() === stats.maxRow()) {
|
1839 |
+
each($_5gvx1dlejjgwed8t.firstLayer(table, 'th,td'), function (cell) {
|
1840 |
+
$_72hn9pm2jjgwedbq.remove(cell, 'rowspan');
|
1841 |
+
$_72hn9pm2jjgwedbq.remove(cell, 'colspan');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1842 |
});
|
1843 |
+
}
|
1844 |
+
$_72hn9pm2jjgwedbq.remove(table, 'width');
|
1845 |
+
$_72hn9pm2jjgwedbq.remove(table, 'height');
|
1846 |
+
$_59neaymbjjgwedd8.remove(table, 'width');
|
1847 |
+
$_59neaymbjjgwedd8.remove(table, 'height');
|
1848 |
+
};
|
1849 |
+
var extract = function (table, selectedSelector) {
|
1850 |
+
var isSelected = function (detail) {
|
1851 |
+
return $_5htea7lfjjgwed94.is(detail.element(), selectedSelector);
|
1852 |
+
};
|
1853 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
1854 |
+
var house = $_eesv8pmajjgwedcx.generate(list);
|
1855 |
+
var stats = findSelectedStats(house, isSelected);
|
1856 |
+
var selector = 'th:not(' + selectedSelector + ')' + ',td:not(' + selectedSelector + ')';
|
1857 |
+
var unselectedCells = $_5gvx1dlejjgwed8t.filterFirstLayer(table, 'th,td', function (cell) {
|
1858 |
+
return $_5htea7lfjjgwed94.is(cell, selector);
|
1859 |
+
});
|
1860 |
+
each(unselectedCells, $_1y8qodmejjgweddq.remove);
|
1861 |
+
fillInGaps(list, house, stats, isSelected);
|
1862 |
+
clean(table, stats);
|
1863 |
+
return table;
|
1864 |
+
};
|
1865 |
+
var $_22kbdsl5jjgwed6v = { extract: extract };
|
1866 |
+
|
1867 |
+
var clone$1 = function (original, deep) {
|
1868 |
+
return Element$$1.fromDom(original.dom().cloneNode(deep));
|
1869 |
+
};
|
1870 |
+
var shallow = function (original) {
|
1871 |
+
return clone$1(original, false);
|
1872 |
+
};
|
1873 |
+
var deep = function (original) {
|
1874 |
+
return clone$1(original, true);
|
1875 |
+
};
|
1876 |
+
var shallowAs = function (original, tag) {
|
1877 |
+
var nu = Element$$1.fromTag(tag);
|
1878 |
+
var attributes = $_72hn9pm2jjgwedbq.clone(original);
|
1879 |
+
$_72hn9pm2jjgwedbq.setAll(nu, attributes);
|
1880 |
+
return nu;
|
1881 |
+
};
|
1882 |
+
var copy$1 = function (original, tag) {
|
1883 |
+
var nu = shallowAs(original, tag);
|
1884 |
+
var cloneChildren = $_97vsilljjjgwed9v.children(deep(original));
|
1885 |
+
$_7onf0emfjjgweddu.append(nu, cloneChildren);
|
1886 |
+
return nu;
|
1887 |
+
};
|
1888 |
+
var mutate = function (original, tag) {
|
1889 |
+
var nu = shallowAs(original, tag);
|
1890 |
+
$_1yoqsmmdjjgweddo.before(original, nu);
|
1891 |
+
var children = $_97vsilljjjgwed9v.children(original);
|
1892 |
+
$_7onf0emfjjgweddu.append(nu, children);
|
1893 |
+
$_1y8qodmejjgweddq.remove(original);
|
1894 |
+
return nu;
|
1895 |
+
};
|
1896 |
+
var $_ginehlmhjjgwedet = {
|
1897 |
+
shallow: shallow,
|
1898 |
+
shallowAs: shallowAs,
|
1899 |
+
deep: deep,
|
1900 |
+
copy: copy$1,
|
1901 |
+
mutate: mutate
|
1902 |
+
};
|
1903 |
+
|
1904 |
+
function NodeValue (is, name) {
|
1905 |
+
var get = function (element) {
|
1906 |
+
if (!is(element))
|
1907 |
+
throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
|
1908 |
+
return getOption(element).getOr('');
|
1909 |
+
};
|
1910 |
+
var getOptionIE10 = function (element) {
|
1911 |
+
try {
|
1912 |
+
return getOptionSafe(element);
|
1913 |
+
} catch (e) {
|
1914 |
+
return Option.none();
|
1915 |
}
|
1916 |
};
|
1917 |
+
var getOptionSafe = function (element) {
|
1918 |
+
return is(element) ? Option.from(element.dom().nodeValue) : Option.none();
|
1919 |
+
};
|
1920 |
+
var browser = $_avfe9dlqjjgwedat.detect().browser;
|
1921 |
+
var getOption = browser.isIE() && browser.version.major === 10 ? getOptionIE10 : getOptionSafe;
|
1922 |
+
var set = function (element, value) {
|
1923 |
+
if (!is(element))
|
1924 |
+
throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
|
1925 |
+
element.dom().nodeValue = value;
|
1926 |
+
};
|
1927 |
+
return {
|
1928 |
+
get: get,
|
1929 |
+
getOption: getOption,
|
1930 |
+
set: set
|
1931 |
+
};
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
var api = NodeValue($_g6duvbm3jjgwedby.isText, 'text');
|
1935 |
+
var get$2 = function (element) {
|
1936 |
+
return api.get(element);
|
1937 |
+
};
|
1938 |
+
var getOption = function (element) {
|
1939 |
+
return api.getOption(element);
|
1940 |
+
};
|
1941 |
+
var set$2 = function (element, value) {
|
1942 |
+
api.set(element, value);
|
1943 |
+
};
|
1944 |
+
var $_btltedmkjjgwedf4 = {
|
1945 |
+
get: get$2,
|
1946 |
+
getOption: getOption,
|
1947 |
+
set: set$2
|
1948 |
+
};
|
1949 |
+
|
1950 |
+
var getEnd = function (element) {
|
1951 |
+
return $_g6duvbm3jjgwedby.name(element) === 'img' ? 1 : $_btltedmkjjgwedf4.getOption(element).fold(function () {
|
1952 |
+
return $_97vsilljjjgwed9v.children(element).length;
|
1953 |
+
}, function (v) {
|
1954 |
+
return v.length;
|
1955 |
+
});
|
1956 |
+
};
|
1957 |
+
var isEnd = function (element, offset) {
|
1958 |
+
return getEnd(element) === offset;
|
1959 |
+
};
|
1960 |
+
var isStart = function (element, offset) {
|
1961 |
+
return offset === 0;
|
1962 |
+
};
|
1963 |
+
var NBSP = '\xA0';
|
1964 |
+
var isTextNodeWithCursorPosition = function (el) {
|
1965 |
+
return $_btltedmkjjgwedf4.getOption(el).filter(function (text) {
|
1966 |
+
return text.trim().length !== 0 || text.indexOf(NBSP) > -1;
|
1967 |
+
}).isSome();
|
1968 |
+
};
|
1969 |
+
var elementsWithCursorPosition = [
|
1970 |
+
'img',
|
1971 |
+
'br'
|
1972 |
+
];
|
1973 |
+
var isCursorPosition = function (elem) {
|
1974 |
+
var hasCursorPosition = isTextNodeWithCursorPosition(elem);
|
1975 |
+
return hasCursorPosition || contains(elementsWithCursorPosition, $_g6duvbm3jjgwedby.name(elem));
|
1976 |
+
};
|
1977 |
+
var $_3uimohmjjjgwedf1 = {
|
1978 |
+
getEnd: getEnd,
|
1979 |
+
isEnd: isEnd,
|
1980 |
+
isStart: isStart,
|
1981 |
+
isCursorPosition: isCursorPosition
|
1982 |
+
};
|
1983 |
+
|
1984 |
+
var first$3 = function (element) {
|
1985 |
+
return $_6l4e4m8jjgwedci.descendant(element, $_3uimohmjjjgwedf1.isCursorPosition);
|
1986 |
+
};
|
1987 |
+
var last$2 = function (element) {
|
1988 |
+
return descendantRtl(element, $_3uimohmjjjgwedf1.isCursorPosition);
|
1989 |
+
};
|
1990 |
+
var descendantRtl = function (scope, predicate) {
|
1991 |
+
var descend = function (element) {
|
1992 |
+
var children = $_97vsilljjjgwed9v.children(element);
|
1993 |
+
for (var i = children.length - 1; i >= 0; i--) {
|
1994 |
+
var child = children[i];
|
1995 |
+
if (predicate(child))
|
1996 |
+
return Option.some(child);
|
1997 |
+
var res = descend(child);
|
1998 |
+
if (res.isSome())
|
1999 |
+
return res;
|
2000 |
+
}
|
2001 |
+
return Option.none();
|
2002 |
};
|
2003 |
+
return descend(scope);
|
2004 |
+
};
|
2005 |
+
var $_cww1bpmijjgwedex = {
|
2006 |
+
first: first$3,
|
2007 |
+
last: last$2
|
2008 |
+
};
|
2009 |
+
|
2010 |
+
var cell$1 = function () {
|
2011 |
+
var td = Element$$1.fromTag('td');
|
2012 |
+
$_1yoqsmmdjjgweddo.append(td, Element$$1.fromTag('br'));
|
2013 |
+
return td;
|
2014 |
+
};
|
2015 |
+
var replace = function (cell, tag, attrs) {
|
2016 |
+
var replica = $_ginehlmhjjgwedet.copy(cell, tag);
|
2017 |
+
each$1(attrs, function (v, k) {
|
2018 |
+
if (v === null)
|
2019 |
+
$_72hn9pm2jjgwedbq.remove(replica, k);
|
2020 |
+
else
|
2021 |
+
$_72hn9pm2jjgwedbq.set(replica, k, v);
|
2022 |
+
});
|
2023 |
+
return replica;
|
2024 |
+
};
|
2025 |
+
var pasteReplace = function (cellContent) {
|
2026 |
+
return cellContent;
|
2027 |
+
};
|
2028 |
+
var newRow = function (doc) {
|
2029 |
+
return function () {
|
2030 |
+
return Element$$1.fromTag('tr', doc.dom());
|
2031 |
+
};
|
2032 |
+
};
|
2033 |
+
var cloneFormats = function (oldCell, newCell, formats) {
|
2034 |
+
var first = $_cww1bpmijjgwedex.first(oldCell);
|
2035 |
+
return first.map(function (firstText) {
|
2036 |
+
var formatSelector = formats.join(',');
|
2037 |
+
var parents = $_5ko5j3m4jjgwedc0.ancestors(firstText, formatSelector, function (element) {
|
2038 |
+
return $_e1yh5slljjgwedae.eq(element, oldCell);
|
2039 |
+
});
|
2040 |
+
return foldr(parents, function (last$$1, parent) {
|
2041 |
+
var clonedFormat = $_ginehlmhjjgwedet.shallow(parent);
|
2042 |
+
$_72hn9pm2jjgwedbq.remove(clonedFormat, 'contenteditable');
|
2043 |
+
$_1yoqsmmdjjgweddo.append(last$$1, clonedFormat);
|
2044 |
+
return clonedFormat;
|
2045 |
+
}, newCell);
|
2046 |
+
}).getOr(newCell);
|
2047 |
+
};
|
2048 |
+
var cellOperations = function (mutate, doc, formatsToClone) {
|
2049 |
+
var newCell = function (prev) {
|
2050 |
+
var doc = $_97vsilljjjgwed9v.owner(prev.element());
|
2051 |
+
var td = Element$$1.fromTag($_g6duvbm3jjgwedby.name(prev.element()), doc.dom());
|
2052 |
+
var formats = formatsToClone.getOr([
|
2053 |
+
'strong',
|
2054 |
+
'em',
|
2055 |
+
'b',
|
2056 |
+
'i',
|
2057 |
+
'span',
|
2058 |
+
'font',
|
2059 |
+
'h1',
|
2060 |
+
'h2',
|
2061 |
+
'h3',
|
2062 |
+
'h4',
|
2063 |
+
'h5',
|
2064 |
+
'h6',
|
2065 |
+
'p',
|
2066 |
+
'div'
|
2067 |
+
]);
|
2068 |
+
var lastNode = formats.length > 0 ? cloneFormats(prev.element(), td, formats) : td;
|
2069 |
+
$_1yoqsmmdjjgweddo.append(lastNode, Element$$1.fromTag('br'));
|
2070 |
+
$_59neaymbjjgwedd8.copy(prev.element(), td);
|
2071 |
+
$_59neaymbjjgwedd8.remove(td, 'height');
|
2072 |
+
if (prev.colspan() !== 1)
|
2073 |
+
$_59neaymbjjgwedd8.remove(prev.element(), 'width');
|
2074 |
+
mutate(prev.element(), td);
|
2075 |
+
return td;
|
2076 |
};
|
2077 |
+
return {
|
2078 |
+
row: newRow(doc),
|
2079 |
+
cell: newCell,
|
2080 |
+
replace: replace,
|
2081 |
+
gap: cell$1
|
2082 |
+
};
|
2083 |
+
};
|
2084 |
+
var paste = function (doc) {
|
2085 |
+
return {
|
2086 |
+
row: newRow(doc),
|
2087 |
+
cell: cell$1,
|
2088 |
+
replace: pasteReplace,
|
2089 |
+
gap: cell$1
|
2090 |
+
};
|
2091 |
+
};
|
2092 |
+
var $_cne69smgjjgweddy = {
|
2093 |
+
cellOperations: cellOperations,
|
2094 |
+
paste: paste
|
2095 |
+
};
|
2096 |
+
|
2097 |
+
var fromHtml$1 = function (html, scope) {
|
2098 |
+
var doc = scope || document;
|
2099 |
+
var div = doc.createElement('div');
|
2100 |
+
div.innerHTML = html;
|
2101 |
+
return $_97vsilljjjgwed9v.children(Element$$1.fromDom(div));
|
2102 |
+
};
|
2103 |
+
var fromTags = function (tags, scope) {
|
2104 |
+
return map(tags, function (x) {
|
2105 |
+
return Element$$1.fromTag(x, scope);
|
2106 |
+
});
|
2107 |
+
};
|
2108 |
+
var fromText$1 = function (texts, scope) {
|
2109 |
+
return map(texts, function (x) {
|
2110 |
+
return Element$$1.fromText(x, scope);
|
2111 |
+
});
|
2112 |
+
};
|
2113 |
+
var fromDom$1 = function (nodes) {
|
2114 |
+
return map(nodes, Element$$1.fromDom);
|
2115 |
+
};
|
2116 |
+
var $_4bkah5mmjjgwedfb = {
|
2117 |
+
fromHtml: fromHtml$1,
|
2118 |
+
fromTags: fromTags,
|
2119 |
+
fromText: fromText$1,
|
2120 |
+
fromDom: fromDom$1
|
2121 |
+
};
|
2122 |
+
|
2123 |
+
var TagBoundaries = [
|
2124 |
+
'body',
|
2125 |
+
'p',
|
2126 |
+
'div',
|
2127 |
+
'article',
|
2128 |
+
'aside',
|
2129 |
+
'figcaption',
|
2130 |
+
'figure',
|
2131 |
+
'footer',
|
2132 |
+
'header',
|
2133 |
+
'nav',
|
2134 |
+
'section',
|
2135 |
+
'ol',
|
2136 |
+
'ul',
|
2137 |
+
'li',
|
2138 |
+
'table',
|
2139 |
+
'thead',
|
2140 |
+
'tbody',
|
2141 |
+
'tfoot',
|
2142 |
+
'caption',
|
2143 |
+
'tr',
|
2144 |
+
'td',
|
2145 |
+
'th',
|
2146 |
+
'h1',
|
2147 |
+
'h2',
|
2148 |
+
'h3',
|
2149 |
+
'h4',
|
2150 |
+
'h5',
|
2151 |
+
'h6',
|
2152 |
+
'blockquote',
|
2153 |
+
'pre',
|
2154 |
+
'address'
|
2155 |
+
];
|
2156 |
+
|
2157 |
+
function DomUniverse () {
|
2158 |
var clone = function (element) {
|
2159 |
+
return Element$$1.fromDom(element.dom().cloneNode(false));
|
|
|
|
|
|
|
2160 |
};
|
2161 |
+
var isBoundary = function (element) {
|
2162 |
+
if (!$_g6duvbm3jjgwedby.isElement(element))
|
2163 |
+
return false;
|
2164 |
+
if ($_g6duvbm3jjgwedby.name(element) === 'body')
|
2165 |
+
return true;
|
2166 |
+
return contains(TagBoundaries, $_g6duvbm3jjgwedby.name(element));
|
2167 |
};
|
2168 |
+
var isEmptyTag = function (element) {
|
2169 |
+
if (!$_g6duvbm3jjgwedby.isElement(element))
|
2170 |
+
return false;
|
2171 |
+
return contains([
|
2172 |
+
'br',
|
2173 |
+
'img',
|
2174 |
+
'hr',
|
2175 |
+
'input'
|
2176 |
+
], $_g6duvbm3jjgwedby.name(element));
|
2177 |
+
};
|
2178 |
+
var comparePosition = function (element, other) {
|
2179 |
+
return element.dom().compareDocumentPosition(other.dom());
|
2180 |
+
};
|
2181 |
+
var copyAttributesTo = function (source, destination) {
|
2182 |
+
var as = $_72hn9pm2jjgwedbq.clone(source);
|
2183 |
+
$_72hn9pm2jjgwedbq.setAll(destination, as);
|
2184 |
+
};
|
2185 |
+
return {
|
2186 |
+
up: constant({
|
2187 |
+
selector: $_2e7p77m7jjgwedcg.ancestor,
|
2188 |
+
closest: $_2e7p77m7jjgwedcg.closest,
|
2189 |
+
predicate: $_6l4e4m8jjgwedci.ancestor,
|
2190 |
+
all: $_97vsilljjjgwed9v.parents
|
2191 |
+
}),
|
2192 |
+
down: constant({
|
2193 |
+
selector: $_5ko5j3m4jjgwedc0.descendants,
|
2194 |
+
predicate: $_a2tivmm5jjgwedc3.descendants
|
2195 |
+
}),
|
2196 |
+
styles: constant({
|
2197 |
+
get: $_59neaymbjjgwedd8.get,
|
2198 |
+
getRaw: $_59neaymbjjgwedd8.getRaw,
|
2199 |
+
set: $_59neaymbjjgwedd8.set,
|
2200 |
+
remove: $_59neaymbjjgwedd8.remove
|
2201 |
+
}),
|
2202 |
+
attrs: constant({
|
2203 |
+
get: $_72hn9pm2jjgwedbq.get,
|
2204 |
+
set: $_72hn9pm2jjgwedbq.set,
|
2205 |
+
remove: $_72hn9pm2jjgwedbq.remove,
|
2206 |
+
copyTo: copyAttributesTo
|
2207 |
+
}),
|
2208 |
+
insert: constant({
|
2209 |
+
before: $_1yoqsmmdjjgweddo.before,
|
2210 |
+
after: $_1yoqsmmdjjgweddo.after,
|
2211 |
+
afterAll: $_7onf0emfjjgweddu.after,
|
2212 |
+
append: $_1yoqsmmdjjgweddo.append,
|
2213 |
+
appendAll: $_7onf0emfjjgweddu.append,
|
2214 |
+
prepend: $_1yoqsmmdjjgweddo.prepend,
|
2215 |
+
wrap: $_1yoqsmmdjjgweddo.wrap
|
2216 |
+
}),
|
2217 |
+
remove: constant({
|
2218 |
+
unwrap: $_1y8qodmejjgweddq.unwrap,
|
2219 |
+
remove: $_1y8qodmejjgweddq.remove
|
2220 |
+
}),
|
2221 |
+
create: constant({
|
2222 |
+
nu: Element$$1.fromTag,
|
2223 |
+
clone: clone,
|
2224 |
+
text: Element$$1.fromText
|
2225 |
+
}),
|
2226 |
+
query: constant({
|
2227 |
+
comparePosition: comparePosition,
|
2228 |
+
prevSibling: $_97vsilljjjgwed9v.prevSibling,
|
2229 |
+
nextSibling: $_97vsilljjjgwed9v.nextSibling
|
2230 |
+
}),
|
2231 |
+
property: constant({
|
2232 |
+
children: $_97vsilljjjgwed9v.children,
|
2233 |
+
name: $_g6duvbm3jjgwedby.name,
|
2234 |
+
parent: $_97vsilljjjgwed9v.parent,
|
2235 |
+
isText: $_g6duvbm3jjgwedby.isText,
|
2236 |
+
isComment: $_g6duvbm3jjgwedby.isComment,
|
2237 |
+
isElement: $_g6duvbm3jjgwedby.isElement,
|
2238 |
+
getText: $_btltedmkjjgwedf4.get,
|
2239 |
+
setText: $_btltedmkjjgwedf4.set,
|
2240 |
+
isBoundary: isBoundary,
|
2241 |
+
isEmptyTag: isEmptyTag
|
2242 |
+
}),
|
2243 |
+
eq: $_e1yh5slljjgwedae.eq,
|
2244 |
+
is: $_e1yh5slljjgwedae.is
|
2245 |
+
};
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
var leftRight = Immutable('left', 'right');
|
2249 |
+
var bisect = function (universe, parent, child) {
|
2250 |
+
var children = universe.property().children(parent);
|
2251 |
+
var index = findIndex(children, curry(universe.eq, child));
|
2252 |
+
return index.map(function (ind) {
|
2253 |
+
return {
|
2254 |
+
before: constant(children.slice(0, ind)),
|
2255 |
+
after: constant(children.slice(ind + 1))
|
2256 |
+
};
|
2257 |
});
|
2258 |
+
};
|
2259 |
+
var breakToRight = function (universe, parent, child) {
|
2260 |
+
return bisect(universe, parent, child).map(function (parts) {
|
2261 |
+
var second = universe.create().clone(parent);
|
2262 |
+
universe.insert().appendAll(second, parts.after());
|
2263 |
+
universe.insert().after(parent, second);
|
2264 |
+
return leftRight(parent, second);
|
2265 |
+
});
|
2266 |
+
};
|
2267 |
+
var breakToLeft = function (universe, parent, child) {
|
2268 |
+
return bisect(universe, parent, child).map(function (parts) {
|
2269 |
+
var prior = universe.create().clone(parent);
|
2270 |
+
universe.insert().appendAll(prior, parts.before().concat([child]));
|
2271 |
+
universe.insert().appendAll(parent, parts.after());
|
2272 |
+
universe.insert().before(parent, prior);
|
2273 |
+
return leftRight(prior, parent);
|
2274 |
+
});
|
2275 |
+
};
|
2276 |
+
var breakPath = function (universe, item, isTop, breaker) {
|
2277 |
+
var result = Immutable('first', 'second', 'splits');
|
2278 |
+
var next = function (child, group, splits) {
|
2279 |
+
var fallback = result(child, Option.none(), splits);
|
2280 |
+
if (isTop(child))
|
2281 |
+
return result(child, group, splits);
|
2282 |
+
else {
|
2283 |
+
return universe.property().parent(child).bind(function (parent) {
|
2284 |
+
return breaker(universe, parent, child).map(function (breakage) {
|
2285 |
+
var extra = [{
|
2286 |
+
first: breakage.left,
|
2287 |
+
second: breakage.right
|
2288 |
+
}];
|
2289 |
+
var nextChild = isTop(parent) ? parent : breakage.left();
|
2290 |
+
return next(nextChild, Option.some(breakage.right()), splits.concat(extra));
|
2291 |
+
}).getOr(fallback);
|
2292 |
+
});
|
2293 |
+
}
|
2294 |
};
|
2295 |
+
return next(item, Option.none(), []);
|
2296 |
+
};
|
2297 |
+
var $_3ckk26mvjjgwedin = {
|
2298 |
+
breakToLeft: breakToLeft,
|
2299 |
+
breakToRight: breakToRight,
|
2300 |
+
breakPath: breakPath
|
2301 |
+
};
|
2302 |
+
|
2303 |
+
var all$3 = function (universe, look, elements, f) {
|
2304 |
+
var head$$1 = elements[0];
|
2305 |
+
var tail = elements.slice(1);
|
2306 |
+
return f(universe, look, head$$1, tail);
|
2307 |
+
};
|
2308 |
+
var oneAll = function (universe, look, elements) {
|
2309 |
+
return elements.length > 0 ? all$3(universe, look, elements, unsafeOne) : Option.none();
|
2310 |
+
};
|
2311 |
+
var unsafeOne = function (universe, look, head$$1, tail) {
|
2312 |
+
var start = look(universe, head$$1);
|
2313 |
+
return foldr(tail, function (b, a) {
|
2314 |
+
var current = look(universe, a);
|
2315 |
+
return commonElement(universe, b, current);
|
2316 |
+
}, start);
|
2317 |
+
};
|
2318 |
+
var commonElement = function (universe, start, end) {
|
2319 |
+
return start.bind(function (s) {
|
2320 |
+
return end.filter(curry(universe.eq, s));
|
2321 |
+
});
|
2322 |
+
};
|
2323 |
+
var $_2cqqdzmwjjgwedix = { oneAll: oneAll };
|
2324 |
+
|
2325 |
+
var eq$1 = function (universe, item) {
|
2326 |
+
return curry(universe.eq, item);
|
2327 |
+
};
|
2328 |
+
var unsafeSubset = function (universe, common, ps1, ps2) {
|
2329 |
+
var children = universe.property().children(common);
|
2330 |
+
if (universe.eq(common, ps1[0]))
|
2331 |
+
return Option.some([ps1[0]]);
|
2332 |
+
if (universe.eq(common, ps2[0]))
|
2333 |
+
return Option.some([ps2[0]]);
|
2334 |
+
var finder = function (ps) {
|
2335 |
+
var topDown = reverse(ps);
|
2336 |
+
var index = findIndex(topDown, eq$1(universe, common)).getOr(-1);
|
2337 |
+
var item = index < topDown.length - 1 ? topDown[index + 1] : topDown[index];
|
2338 |
+
return findIndex(children, eq$1(universe, item));
|
2339 |
+
};
|
2340 |
+
var startIndex = finder(ps1);
|
2341 |
+
var endIndex = finder(ps2);
|
2342 |
+
return startIndex.bind(function (sIndex) {
|
2343 |
+
return endIndex.map(function (eIndex) {
|
2344 |
+
var first = Math.min(sIndex, eIndex);
|
2345 |
+
var last$$1 = Math.max(sIndex, eIndex);
|
2346 |
+
return children.slice(first, last$$1 + 1);
|
2347 |
});
|
2348 |
+
});
|
2349 |
+
};
|
2350 |
+
var ancestors$2 = function (universe, start, end, _isRoot) {
|
2351 |
+
var isRoot = _isRoot !== undefined ? _isRoot : constant(false);
|
2352 |
+
var ps1 = [start].concat(universe.up().all(start));
|
2353 |
+
var ps2 = [end].concat(universe.up().all(end));
|
2354 |
+
var prune = function (path) {
|
2355 |
+
var index = findIndex(path, isRoot);
|
2356 |
+
return index.fold(function () {
|
2357 |
+
return path;
|
2358 |
+
}, function (ind) {
|
2359 |
+
return path.slice(0, ind + 1);
|
2360 |
});
|
2361 |
};
|
2362 |
+
var pruned1 = prune(ps1);
|
2363 |
+
var pruned2 = prune(ps2);
|
2364 |
+
var shared = find(pruned1, function (x) {
|
2365 |
+
return exists(pruned2, eq$1(universe, x));
|
2366 |
+
});
|
2367 |
+
return {
|
2368 |
+
firstpath: constant(pruned1),
|
2369 |
+
secondpath: constant(pruned2),
|
2370 |
+
shared: constant(shared)
|
2371 |
+
};
|
2372 |
+
};
|
2373 |
+
var subset = function (universe, start, end) {
|
2374 |
+
var ancs = ancestors$2(universe, start, end);
|
2375 |
+
return ancs.shared().bind(function (shared) {
|
2376 |
+
return unsafeSubset(universe, shared, ancs.firstpath(), ancs.secondpath());
|
2377 |
+
});
|
2378 |
+
};
|
2379 |
+
var $_c0xnnrmxjjgwedj4 = {
|
2380 |
+
subset: subset,
|
2381 |
+
ancestors: ancestors$2
|
2382 |
+
};
|
2383 |
+
|
2384 |
+
var sharedOne = function (universe, look, elements) {
|
2385 |
+
return $_2cqqdzmwjjgwedix.oneAll(universe, look, elements);
|
2386 |
+
};
|
2387 |
+
var subset$1 = function (universe, start, finish) {
|
2388 |
+
return $_c0xnnrmxjjgwedj4.subset(universe, start, finish);
|
2389 |
+
};
|
2390 |
+
var ancestors$3 = function (universe, start, finish, _isRoot) {
|
2391 |
+
return $_c0xnnrmxjjgwedj4.ancestors(universe, start, finish, _isRoot);
|
2392 |
+
};
|
2393 |
+
var breakToLeft$1 = function (universe, parent, child) {
|
2394 |
+
return $_3ckk26mvjjgwedin.breakToLeft(universe, parent, child);
|
2395 |
+
};
|
2396 |
+
var breakToRight$1 = function (universe, parent, child) {
|
2397 |
+
return $_3ckk26mvjjgwedin.breakToRight(universe, parent, child);
|
2398 |
+
};
|
2399 |
+
var breakPath$1 = function (universe, child, isTop, breaker) {
|
2400 |
+
return $_3ckk26mvjjgwedin.breakPath(universe, child, isTop, breaker);
|
2401 |
+
};
|
2402 |
+
var $_1k5g62mujjgwedil = {
|
2403 |
+
sharedOne: sharedOne,
|
2404 |
+
subset: subset$1,
|
2405 |
+
ancestors: ancestors$3,
|
2406 |
+
breakToLeft: breakToLeft$1,
|
2407 |
+
breakToRight: breakToRight$1,
|
2408 |
+
breakPath: breakPath$1
|
2409 |
+
};
|
2410 |
+
|
2411 |
+
var universe = DomUniverse();
|
2412 |
+
var sharedOne$1 = function (look, elements) {
|
2413 |
+
return $_1k5g62mujjgwedil.sharedOne(universe, function (universe, element) {
|
2414 |
+
return look(element);
|
2415 |
+
}, elements);
|
2416 |
+
};
|
2417 |
+
var subset$2 = function (start, finish) {
|
2418 |
+
return $_1k5g62mujjgwedil.subset(universe, start, finish);
|
2419 |
+
};
|
2420 |
+
var ancestors$4 = function (start, finish, _isRoot) {
|
2421 |
+
return $_1k5g62mujjgwedil.ancestors(universe, start, finish, _isRoot);
|
2422 |
+
};
|
2423 |
+
var breakToLeft$2 = function (parent, child) {
|
2424 |
+
return $_1k5g62mujjgwedil.breakToLeft(universe, parent, child);
|
2425 |
+
};
|
2426 |
+
var breakToRight$2 = function (parent, child) {
|
2427 |
+
return $_1k5g62mujjgwedil.breakToRight(universe, parent, child);
|
2428 |
+
};
|
2429 |
+
var breakPath$2 = function (child, isTop, breaker) {
|
2430 |
+
return $_1k5g62mujjgwedil.breakPath(universe, child, isTop, function (u, p, c) {
|
2431 |
+
return breaker(p, c);
|
2432 |
+
});
|
2433 |
+
};
|
2434 |
+
var $_92t9ismrjjgwedhe = {
|
2435 |
+
sharedOne: sharedOne$1,
|
2436 |
+
subset: subset$2,
|
2437 |
+
ancestors: ancestors$4,
|
2438 |
+
breakToLeft: breakToLeft$2,
|
2439 |
+
breakToRight: breakToRight$2,
|
2440 |
+
breakPath: breakPath$2
|
2441 |
+
};
|
2442 |
+
|
2443 |
+
var inSelection = function (bounds, detail) {
|
2444 |
+
var leftEdge = detail.column();
|
2445 |
+
var rightEdge = detail.column() + detail.colspan() - 1;
|
2446 |
+
var topEdge = detail.row();
|
2447 |
+
var bottomEdge = detail.row() + detail.rowspan() - 1;
|
2448 |
+
return leftEdge <= bounds.finishCol() && rightEdge >= bounds.startCol() && (topEdge <= bounds.finishRow() && bottomEdge >= bounds.startRow());
|
2449 |
+
};
|
2450 |
+
var isWithin = function (bounds, detail) {
|
2451 |
+
return detail.column() >= bounds.startCol() && detail.column() + detail.colspan() - 1 <= bounds.finishCol() && detail.row() >= bounds.startRow() && detail.row() + detail.rowspan() - 1 <= bounds.finishRow();
|
2452 |
+
};
|
2453 |
+
var isRectangular = function (warehouse, bounds) {
|
2454 |
+
var isRect = true;
|
2455 |
+
var detailIsWithin = curry(isWithin, bounds);
|
2456 |
+
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
2457 |
+
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
2458 |
+
isRect = isRect && $_eesv8pmajjgwedcx.getAt(warehouse, i, j).exists(detailIsWithin);
|
2459 |
}
|
2460 |
+
}
|
2461 |
+
return isRect ? Option.some(bounds) : Option.none();
|
2462 |
+
};
|
2463 |
+
var $_g3utsdn0jjgwedjo = {
|
2464 |
+
inSelection: inSelection,
|
2465 |
+
isWithin: isWithin,
|
2466 |
+
isRectangular: isRectangular
|
2467 |
+
};
|
2468 |
+
|
2469 |
+
var getBounds = function (detailA, detailB) {
|
2470 |
+
return $_6lasqllcjjgwed80.bounds(Math.min(detailA.row(), detailB.row()), Math.min(detailA.column(), detailB.column()), Math.max(detailA.row() + detailA.rowspan() - 1, detailB.row() + detailB.rowspan() - 1), Math.max(detailA.column() + detailA.colspan() - 1, detailB.column() + detailB.colspan() - 1));
|
2471 |
+
};
|
2472 |
+
var getAnyBox = function (warehouse, startCell, finishCell) {
|
2473 |
+
var startCoords = $_eesv8pmajjgwedcx.findItem(warehouse, startCell, $_e1yh5slljjgwedae.eq);
|
2474 |
+
var finishCoords = $_eesv8pmajjgwedcx.findItem(warehouse, finishCell, $_e1yh5slljjgwedae.eq);
|
2475 |
+
return startCoords.bind(function (sc) {
|
2476 |
+
return finishCoords.map(function (fc) {
|
2477 |
+
return getBounds(sc, fc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2478 |
});
|
2479 |
+
});
|
2480 |
+
};
|
2481 |
+
var getBox = function (warehouse, startCell, finishCell) {
|
2482 |
+
return getAnyBox(warehouse, startCell, finishCell).bind(function (bounds) {
|
2483 |
+
return $_g3utsdn0jjgwedjo.isRectangular(warehouse, bounds);
|
2484 |
+
});
|
2485 |
+
};
|
2486 |
+
var $_g6zsxdn1jjgwedju = {
|
2487 |
+
getAnyBox: getAnyBox,
|
2488 |
+
getBox: getBox
|
2489 |
+
};
|
2490 |
+
|
2491 |
+
var moveBy = function (warehouse, cell, row, column) {
|
2492 |
+
return $_eesv8pmajjgwedcx.findItem(warehouse, cell, $_e1yh5slljjgwedae.eq).bind(function (detail) {
|
2493 |
+
var startRow = row > 0 ? detail.row() + detail.rowspan() - 1 : detail.row();
|
2494 |
+
var startCol = column > 0 ? detail.column() + detail.colspan() - 1 : detail.column();
|
2495 |
+
var dest = $_eesv8pmajjgwedcx.getAt(warehouse, startRow + row, startCol + column);
|
2496 |
+
return dest.map(function (d) {
|
2497 |
+
return d.element();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2498 |
});
|
2499 |
+
});
|
2500 |
+
};
|
2501 |
+
var intercepts = function (warehouse, start, finish) {
|
2502 |
+
return $_g6zsxdn1jjgwedju.getAnyBox(warehouse, start, finish).map(function (bounds) {
|
2503 |
+
var inside = $_eesv8pmajjgwedcx.filterItems(warehouse, curry($_g3utsdn0jjgwedjo.inSelection, bounds));
|
2504 |
+
return map(inside, function (detail) {
|
2505 |
+
return detail.element();
|
2506 |
+
});
|
2507 |
+
});
|
2508 |
+
};
|
2509 |
+
var parentCell = function (warehouse, innerCell) {
|
2510 |
+
var isContainedBy = function (c1, c2) {
|
2511 |
+
return $_e1yh5slljjgwedae.contains(c2, c1);
|
2512 |
};
|
2513 |
+
return $_eesv8pmajjgwedcx.findItem(warehouse, innerCell, isContainedBy).bind(function (detail) {
|
2514 |
+
return detail.element();
|
2515 |
+
});
|
2516 |
+
};
|
2517 |
+
var $_41dnyxmzjjgwedjh = {
|
2518 |
+
moveBy: moveBy,
|
2519 |
+
intercepts: intercepts,
|
2520 |
+
parentCell: parentCell
|
2521 |
+
};
|
2522 |
+
|
2523 |
+
var moveBy$1 = function (cell, deltaRow, deltaColumn) {
|
2524 |
+
return $_bmlvw1ldjjgwed84.table(cell).bind(function (table) {
|
2525 |
+
var warehouse = getWarehouse(table);
|
2526 |
+
return $_41dnyxmzjjgwedjh.moveBy(warehouse, cell, deltaRow, deltaColumn);
|
2527 |
+
});
|
2528 |
+
};
|
2529 |
+
var intercepts$1 = function (table, first, last) {
|
2530 |
+
var warehouse = getWarehouse(table);
|
2531 |
+
return $_41dnyxmzjjgwedjh.intercepts(warehouse, first, last);
|
2532 |
+
};
|
2533 |
+
var nestedIntercepts = function (table, first, firstTable, last, lastTable) {
|
2534 |
+
var warehouse = getWarehouse(table);
|
2535 |
+
var startCell = $_e1yh5slljjgwedae.eq(table, firstTable) ? first : $_41dnyxmzjjgwedjh.parentCell(warehouse, first);
|
2536 |
+
var lastCell = $_e1yh5slljjgwedae.eq(table, lastTable) ? last : $_41dnyxmzjjgwedjh.parentCell(warehouse, last);
|
2537 |
+
return $_41dnyxmzjjgwedjh.intercepts(warehouse, startCell, lastCell);
|
2538 |
+
};
|
2539 |
+
var getBox$1 = function (table, first, last) {
|
2540 |
+
var warehouse = getWarehouse(table);
|
2541 |
+
return $_g6zsxdn1jjgwedju.getBox(warehouse, first, last);
|
2542 |
+
};
|
2543 |
+
var getWarehouse = function (table) {
|
2544 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
2545 |
+
return $_eesv8pmajjgwedcx.generate(list);
|
2546 |
+
};
|
2547 |
+
var $_10bmormyjjgwedjc = {
|
2548 |
+
moveBy: moveBy$1,
|
2549 |
+
intercepts: intercepts$1,
|
2550 |
+
nestedIntercepts: nestedIntercepts,
|
2551 |
+
getBox: getBox$1
|
2552 |
+
};
|
2553 |
+
|
2554 |
+
var lookupTable = function (container, isRoot) {
|
2555 |
+
return $_2e7p77m7jjgwedcg.ancestor(container, 'table');
|
2556 |
+
};
|
2557 |
+
var identified = MixedBag([
|
2558 |
+
'boxes',
|
2559 |
+
'start',
|
2560 |
+
'finish'
|
2561 |
+
], []);
|
2562 |
+
var identify = function (start, finish, isRoot) {
|
2563 |
+
var getIsRoot = function (rootTable) {
|
2564 |
+
return function (element) {
|
2565 |
+
return isRoot(element) || $_e1yh5slljjgwedae.eq(element, rootTable);
|
2566 |
+
};
|
2567 |
};
|
2568 |
+
if ($_e1yh5slljjgwedae.eq(start, finish)) {
|
2569 |
+
return Option.some(identified({
|
2570 |
+
boxes: Option.some([start]),
|
2571 |
+
start: start,
|
2572 |
+
finish: finish
|
2573 |
+
}));
|
2574 |
+
} else {
|
2575 |
+
return lookupTable(start, isRoot).bind(function (startTable) {
|
2576 |
+
return lookupTable(finish, isRoot).bind(function (finishTable) {
|
2577 |
+
if ($_e1yh5slljjgwedae.eq(startTable, finishTable)) {
|
2578 |
+
return Option.some(identified({
|
2579 |
+
boxes: $_10bmormyjjgwedjc.intercepts(startTable, start, finish),
|
2580 |
+
start: start,
|
2581 |
+
finish: finish
|
2582 |
+
}));
|
2583 |
+
} else if ($_e1yh5slljjgwedae.contains(startTable, finishTable)) {
|
2584 |
+
var ancestorCells = $_5ko5j3m4jjgwedc0.ancestors(finish, 'td,th', getIsRoot(startTable));
|
2585 |
+
var finishCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : finish;
|
2586 |
+
return Option.some(identified({
|
2587 |
+
boxes: $_10bmormyjjgwedjc.nestedIntercepts(startTable, start, startTable, finish, finishTable),
|
2588 |
+
start: start,
|
2589 |
+
finish: finishCell
|
2590 |
+
}));
|
2591 |
+
} else if ($_e1yh5slljjgwedae.contains(finishTable, startTable)) {
|
2592 |
+
var ancestorCells = $_5ko5j3m4jjgwedc0.ancestors(start, 'td,th', getIsRoot(finishTable));
|
2593 |
+
var startCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : start;
|
2594 |
+
return Option.some(identified({
|
2595 |
+
boxes: $_10bmormyjjgwedjc.nestedIntercepts(finishTable, start, startTable, finish, finishTable),
|
2596 |
+
start: start,
|
2597 |
+
finish: startCell
|
2598 |
+
}));
|
2599 |
+
} else {
|
2600 |
+
return $_92t9ismrjjgwedhe.ancestors(start, finish).shared().bind(function (lca) {
|
2601 |
+
return $_2e7p77m7jjgwedcg.closest(lca, 'table', isRoot).bind(function (lcaTable) {
|
2602 |
+
var finishAncestorCells = $_5ko5j3m4jjgwedc0.ancestors(finish, 'td,th', getIsRoot(lcaTable));
|
2603 |
+
var finishCell = finishAncestorCells.length > 0 ? finishAncestorCells[finishAncestorCells.length - 1] : finish;
|
2604 |
+
var startAncestorCells = $_5ko5j3m4jjgwedc0.ancestors(start, 'td,th', getIsRoot(lcaTable));
|
2605 |
+
var startCell = startAncestorCells.length > 0 ? startAncestorCells[startAncestorCells.length - 1] : start;
|
2606 |
+
return Option.some(identified({
|
2607 |
+
boxes: $_10bmormyjjgwedjc.nestedIntercepts(lcaTable, start, startTable, finish, finishTable),
|
2608 |
+
start: startCell,
|
2609 |
+
finish: finishCell
|
2610 |
+
}));
|
2611 |
+
});
|
2612 |
+
});
|
2613 |
+
}
|
2614 |
});
|
|
|
2615 |
});
|
2616 |
+
}
|
2617 |
+
};
|
2618 |
+
var retrieve = function (container, selector) {
|
2619 |
+
var sels = $_5ko5j3m4jjgwedc0.descendants(container, selector);
|
2620 |
+
return sels.length > 0 ? Option.some(sels) : Option.none();
|
2621 |
+
};
|
2622 |
+
var getLast = function (boxes, lastSelectedSelector) {
|
2623 |
+
return find(boxes, function (box) {
|
2624 |
+
return $_5htea7lfjjgwed94.is(box, lastSelectedSelector);
|
2625 |
+
});
|
2626 |
+
};
|
2627 |
+
var getEdges = function (container, firstSelectedSelector, lastSelectedSelector) {
|
2628 |
+
return $_2e7p77m7jjgwedcg.descendant(container, firstSelectedSelector).bind(function (first) {
|
2629 |
+
return $_2e7p77m7jjgwedcg.descendant(container, lastSelectedSelector).bind(function (last$$1) {
|
2630 |
+
return $_92t9ismrjjgwedhe.sharedOne(lookupTable, [
|
2631 |
+
first,
|
2632 |
+
last$$1
|
2633 |
+
]).map(function (tbl) {
|
2634 |
+
return {
|
2635 |
+
first: constant(first),
|
2636 |
+
last: constant(last$$1),
|
2637 |
+
table: constant(tbl)
|
2638 |
+
};
|
2639 |
});
|
|
|
2640 |
});
|
2641 |
+
});
|
2642 |
+
};
|
2643 |
+
var expandTo = function (finish, firstSelectedSelector) {
|
2644 |
+
return $_2e7p77m7jjgwedcg.ancestor(finish, 'table').bind(function (table) {
|
2645 |
+
return $_2e7p77m7jjgwedcg.descendant(table, firstSelectedSelector).bind(function (start) {
|
2646 |
+
return identify(start, finish).bind(function (identified) {
|
2647 |
+
return identified.boxes().map(function (boxes) {
|
2648 |
+
return {
|
2649 |
+
boxes: constant(boxes),
|
2650 |
+
start: constant(identified.start()),
|
2651 |
+
finish: constant(identified.finish())
|
2652 |
+
};
|
2653 |
+
});
|
2654 |
+
});
|
|
|
|
|
2655 |
});
|
2656 |
+
});
|
2657 |
+
};
|
2658 |
+
var shiftSelection = function (boxes, deltaRow, deltaColumn, firstSelectedSelector, lastSelectedSelector) {
|
2659 |
+
return getLast(boxes, lastSelectedSelector).bind(function (last$$1) {
|
2660 |
+
return $_10bmormyjjgwedjc.moveBy(last$$1, deltaRow, deltaColumn).bind(function (finish) {
|
2661 |
+
return expandTo(finish, firstSelectedSelector);
|
2662 |
});
|
2663 |
+
});
|
2664 |
+
};
|
2665 |
+
var $_cl87acmqjjgwedgo = {
|
2666 |
+
identify: identify,
|
2667 |
+
retrieve: retrieve,
|
2668 |
+
shiftSelection: shiftSelection,
|
2669 |
+
getEdges: getEdges
|
2670 |
+
};
|
2671 |
+
|
2672 |
+
var retrieve$1 = function (container, selector) {
|
2673 |
+
return $_cl87acmqjjgwedgo.retrieve(container, selector);
|
2674 |
+
};
|
2675 |
+
var retrieveBox = function (container, firstSelectedSelector, lastSelectedSelector) {
|
2676 |
+
return $_cl87acmqjjgwedgo.getEdges(container, firstSelectedSelector, lastSelectedSelector).bind(function (edges) {
|
2677 |
+
var isRoot = function (ancestor) {
|
2678 |
+
return $_e1yh5slljjgwedae.eq(container, ancestor);
|
2679 |
+
};
|
2680 |
+
var firstAncestor = $_2e7p77m7jjgwedcg.ancestor(edges.first(), 'thead,tfoot,tbody,table', isRoot);
|
2681 |
+
var lastAncestor = $_2e7p77m7jjgwedcg.ancestor(edges.last(), 'thead,tfoot,tbody,table', isRoot);
|
2682 |
+
return firstAncestor.bind(function (fA) {
|
2683 |
+
return lastAncestor.bind(function (lA) {
|
2684 |
+
return $_e1yh5slljjgwedae.eq(fA, lA) ? $_10bmormyjjgwedjc.getBox(edges.table(), edges.first(), edges.last()) : Option.none();
|
|
|
|
|
|
|
2685 |
});
|
|
|
2686 |
});
|
2687 |
+
});
|
2688 |
+
};
|
2689 |
+
var $_9sh63kmpjjgwedg7 = {
|
2690 |
+
retrieve: retrieve$1,
|
2691 |
+
retrieveBox: retrieveBox
|
2692 |
+
};
|
2693 |
+
|
2694 |
+
var selected = 'data-mce-selected';
|
2695 |
+
var selectedSelector = 'td[' + selected + '],th[' + selected + ']';
|
2696 |
+
var attributeSelector = '[' + selected + ']';
|
2697 |
+
var firstSelected = 'data-mce-first-selected';
|
2698 |
+
var firstSelectedSelector = 'td[' + firstSelected + '],th[' + firstSelected + ']';
|
2699 |
+
var lastSelected = 'data-mce-last-selected';
|
2700 |
+
var lastSelectedSelector = 'td[' + lastSelected + '],th[' + lastSelected + ']';
|
2701 |
+
var $_b2a4bzn2jjgwedjz = {
|
2702 |
+
selected: constant(selected),
|
2703 |
+
selectedSelector: constant(selectedSelector),
|
2704 |
+
attributeSelector: constant(attributeSelector),
|
2705 |
+
firstSelected: constant(firstSelected),
|
2706 |
+
firstSelectedSelector: constant(firstSelectedSelector),
|
2707 |
+
lastSelected: constant(lastSelected),
|
2708 |
+
lastSelectedSelector: constant(lastSelectedSelector)
|
2709 |
+
};
|
2710 |
+
|
2711 |
+
var generate$1 = function (cases) {
|
2712 |
+
if (!isArray(cases)) {
|
2713 |
+
throw new Error('cases must be an array');
|
2714 |
+
}
|
2715 |
+
if (cases.length === 0) {
|
2716 |
+
throw new Error('there must be at least one case');
|
2717 |
+
}
|
2718 |
+
var constructors = [];
|
2719 |
+
var adt = {};
|
2720 |
+
each(cases, function (acase, count) {
|
2721 |
+
var keys$$1 = keys(acase);
|
2722 |
+
if (keys$$1.length !== 1) {
|
2723 |
+
throw new Error('one and only one name per case');
|
2724 |
}
|
2725 |
+
var key = keys$$1[0];
|
2726 |
+
var value = acase[key];
|
2727 |
+
if (adt[key] !== undefined) {
|
2728 |
+
throw new Error('duplicate key detected:' + key);
|
2729 |
+
} else if (key === 'cata') {
|
2730 |
+
throw new Error('cannot have a case named cata (sorry)');
|
2731 |
+
} else if (!isArray(value)) {
|
2732 |
+
throw new Error('case arguments must be an array');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2733 |
}
|
2734 |
+
constructors.push(key);
|
2735 |
+
adt[key] = function () {
|
2736 |
+
var argLength = arguments.length;
|
2737 |
+
if (argLength !== value.length) {
|
2738 |
+
throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);
|
2739 |
+
}
|
2740 |
+
var args = new Array(argLength);
|
2741 |
+
for (var i = 0; i < args.length; i++)
|
2742 |
+
args[i] = arguments[i];
|
2743 |
+
var match = function (branches) {
|
2744 |
+
var branchKeys = keys(branches);
|
2745 |
+
if (constructors.length !== branchKeys.length) {
|
2746 |
+
throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(','));
|
2747 |
+
}
|
2748 |
+
var allReqd = forall(constructors, function (reqKey) {
|
2749 |
+
return contains(branchKeys, reqKey);
|
2750 |
+
});
|
2751 |
+
if (!allReqd)
|
2752 |
+
throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', '));
|
2753 |
+
return branches[key].apply(null, args);
|
2754 |
+
};
|
2755 |
+
return {
|
2756 |
+
fold: function () {
|
2757 |
+
if (arguments.length !== cases.length) {
|
2758 |
+
throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
|
2759 |
+
}
|
2760 |
+
var target = arguments[count];
|
2761 |
+
return target.apply(null, args);
|
2762 |
+
},
|
2763 |
+
match: match,
|
2764 |
+
log: function (label) {
|
2765 |
+
console.log(label, {
|
2766 |
+
constructors: constructors,
|
2767 |
+
constructor: key,
|
2768 |
+
params: args
|
2769 |
+
});
|
2770 |
+
}
|
2771 |
+
};
|
2772 |
+
};
|
2773 |
+
});
|
2774 |
+
return adt;
|
2775 |
+
};
|
2776 |
+
var Adt = { generate: generate$1 };
|
2777 |
+
|
2778 |
+
var type$1 = Adt.generate([
|
2779 |
+
{ none: [] },
|
2780 |
+
{ multiple: ['elements'] },
|
2781 |
+
{ single: ['selection'] }
|
2782 |
+
]);
|
2783 |
+
var cata = function (subject, onNone, onMultiple, onSingle) {
|
2784 |
+
return subject.fold(onNone, onMultiple, onSingle);
|
2785 |
+
};
|
2786 |
+
var $_a362bzn3jjgwedk2 = {
|
2787 |
+
cata: cata,
|
2788 |
+
none: type$1.none,
|
2789 |
+
multiple: type$1.multiple,
|
2790 |
+
single: type$1.single
|
2791 |
+
};
|
2792 |
+
|
2793 |
+
var selection = function (cell, selections) {
|
2794 |
+
return $_a362bzn3jjgwedk2.cata(selections.get(), constant([]), identity, constant([cell]));
|
2795 |
+
};
|
2796 |
+
var unmergable = function (cell, selections) {
|
2797 |
+
var hasSpan = function (elem) {
|
2798 |
+
return $_72hn9pm2jjgwedbq.has(elem, 'rowspan') && parseInt($_72hn9pm2jjgwedbq.get(elem, 'rowspan'), 10) > 1 || $_72hn9pm2jjgwedbq.has(elem, 'colspan') && parseInt($_72hn9pm2jjgwedbq.get(elem, 'colspan'), 10) > 1;
|
2799 |
+
};
|
2800 |
+
var candidates = selection(cell, selections);
|
2801 |
+
return candidates.length > 0 && forall(candidates, hasSpan) ? Option.some(candidates) : Option.none();
|
2802 |
+
};
|
2803 |
+
var mergable = function (table, selections) {
|
2804 |
+
return $_a362bzn3jjgwedk2.cata(selections.get(), Option.none, function (cells, _env) {
|
2805 |
+
if (cells.length === 0) {
|
2806 |
+
return Option.none();
|
2807 |
}
|
2808 |
+
return $_9sh63kmpjjgwedg7.retrieveBox(table, $_b2a4bzn2jjgwedjz.firstSelectedSelector(), $_b2a4bzn2jjgwedjz.lastSelectedSelector()).bind(function (bounds) {
|
2809 |
+
return cells.length > 1 ? Option.some({
|
2810 |
+
bounds: constant(bounds),
|
2811 |
+
cells: constant(cells)
|
2812 |
+
}) : Option.none();
|
2813 |
+
});
|
2814 |
+
}, Option.none);
|
2815 |
+
};
|
2816 |
+
var $_4hmt1amojjgwedfl = {
|
2817 |
+
mergable: mergable,
|
2818 |
+
unmergable: unmergable,
|
2819 |
+
selection: selection
|
2820 |
+
};
|
2821 |
+
|
2822 |
+
var noMenu = function (cell) {
|
2823 |
+
return {
|
2824 |
+
element: constant(cell),
|
2825 |
+
mergable: Option.none,
|
2826 |
+
unmergable: Option.none,
|
2827 |
+
selection: constant([cell])
|
2828 |
+
};
|
2829 |
+
};
|
2830 |
+
var forMenu = function (selections, table, cell) {
|
2831 |
+
return {
|
2832 |
+
element: constant(cell),
|
2833 |
+
mergable: constant($_4hmt1amojjgwedfl.mergable(table, selections)),
|
2834 |
+
unmergable: constant($_4hmt1amojjgwedfl.unmergable(cell, selections)),
|
2835 |
+
selection: constant($_4hmt1amojjgwedfl.selection(cell, selections))
|
2836 |
+
};
|
2837 |
+
};
|
2838 |
+
var notCell$1 = function (element) {
|
2839 |
+
return noMenu(element);
|
2840 |
+
};
|
2841 |
+
var paste$1 = Immutable('element', 'clipboard', 'generators');
|
2842 |
+
var pasteRows = function (selections, table, cell, clipboard, generators) {
|
2843 |
+
return {
|
2844 |
+
element: constant(cell),
|
2845 |
+
mergable: Option.none,
|
2846 |
+
unmergable: Option.none,
|
2847 |
+
selection: constant($_4hmt1amojjgwedfl.selection(cell, selections)),
|
2848 |
+
clipboard: constant(clipboard),
|
2849 |
+
generators: constant(generators)
|
2850 |
+
};
|
2851 |
+
};
|
2852 |
+
var $_a5s279mnjjgwedff = {
|
2853 |
+
noMenu: noMenu,
|
2854 |
+
forMenu: forMenu,
|
2855 |
+
notCell: notCell$1,
|
2856 |
+
paste: paste$1,
|
2857 |
+
pasteRows: pasteRows
|
2858 |
+
};
|
2859 |
+
|
2860 |
+
var extractSelected = function (cells) {
|
2861 |
+
return $_bmlvw1ldjjgwed84.table(cells[0]).map($_ginehlmhjjgwedet.deep).map(function (replica) {
|
2862 |
+
return [$_22kbdsl5jjgwed6v.extract(replica, $_b2a4bzn2jjgwedjz.attributeSelector())];
|
2863 |
+
});
|
2864 |
+
};
|
2865 |
+
var serializeElement = function (editor, elm) {
|
2866 |
+
return editor.selection.serializer.serialize(elm.dom(), {});
|
2867 |
+
};
|
2868 |
+
var registerEvents = function (editor, selections, actions, cellSelection) {
|
2869 |
+
editor.on('BeforeGetContent', function (e) {
|
2870 |
+
var multiCellContext = function (cells) {
|
2871 |
+
e.preventDefault();
|
2872 |
+
extractSelected(cells).each(function (elements) {
|
2873 |
+
e.content = map(elements, function (elm) {
|
2874 |
+
return serializeElement(editor, elm);
|
2875 |
+
}).join('');
|
2876 |
});
|
2877 |
+
};
|
2878 |
+
if (e.selection === true) {
|
2879 |
+
$_a362bzn3jjgwedk2.cata(selections.get(), noop, multiCellContext, noop);
|
2880 |
+
}
|
2881 |
+
});
|
2882 |
+
editor.on('BeforeSetContent', function (e) {
|
2883 |
+
if (e.selection === true && e.paste === true) {
|
2884 |
+
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
2885 |
+
cellOpt.each(function (domCell) {
|
2886 |
+
var cell = Element$$1.fromDom(domCell);
|
2887 |
+
var table = $_bmlvw1ldjjgwed84.table(cell);
|
2888 |
+
table.bind(function (table) {
|
2889 |
+
var elements = filter($_4bkah5mmjjgwedfb.fromHtml(e.content), function (content) {
|
2890 |
+
return $_g6duvbm3jjgwedby.name(content) !== 'meta';
|
2891 |
+
});
|
2892 |
+
if (elements.length === 1 && $_g6duvbm3jjgwedby.name(elements[0]) === 'table') {
|
2893 |
+
e.preventDefault();
|
2894 |
+
var doc = Element$$1.fromDom(editor.getDoc());
|
2895 |
+
var generators = $_cne69smgjjgweddy.paste(doc);
|
2896 |
+
var targets = $_a5s279mnjjgwedff.paste(cell, elements[0], generators);
|
2897 |
+
actions.pasteCells(table, targets).each(function (rng) {
|
2898 |
+
editor.selection.setRng(rng);
|
2899 |
+
editor.focus();
|
2900 |
+
cellSelection.clear(table);
|
2901 |
+
});
|
2902 |
+
}
|
2903 |
+
});
|
2904 |
+
});
|
2905 |
+
}
|
2906 |
+
});
|
2907 |
+
};
|
2908 |
+
var $_fqjxp5l0jjgwed5s = { registerEvents: registerEvents };
|
|
|
|
|
|
|
|
|
2909 |
|
2910 |
+
function Dimension (name, getOffset) {
|
2911 |
+
var set = function (element, h) {
|
2912 |
+
if (!isNumber(h) && !h.match(/^[0-9]+$/))
|
2913 |
+
throw name + '.set accepts only positive integer values. Value was ' + h;
|
|
|
|
|
|
|
2914 |
var dom = element.dom();
|
2915 |
+
if ($_5f4hknmcjjgweddm.isSupported(dom))
|
2916 |
+
dom.style[name] = h + 'px';
|
2917 |
+
};
|
2918 |
+
var get = function (element) {
|
2919 |
+
var r = getOffset(element);
|
2920 |
+
if (r <= 0 || r === null) {
|
2921 |
+
var css = $_59neaymbjjgwedd8.get(element, name);
|
2922 |
+
return parseFloat(css) || 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2923 |
}
|
2924 |
+
return r;
|
2925 |
};
|
2926 |
+
var getOuter = get;
|
2927 |
+
var aggregate = function (element, properties) {
|
2928 |
+
return foldl(properties, function (acc, property) {
|
2929 |
+
var val = $_59neaymbjjgwedd8.get(element, property);
|
2930 |
+
var value = val === undefined ? 0 : parseInt(val, 10);
|
2931 |
+
return isNaN(value) ? acc : acc + value;
|
2932 |
+
}, 0);
|
2933 |
+
};
|
2934 |
+
var max = function (element, value, properties) {
|
2935 |
+
var cumulativeInclusions = aggregate(element, properties);
|
2936 |
+
var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;
|
2937 |
+
return absoluteMax;
|
2938 |
+
};
|
2939 |
+
return {
|
2940 |
+
set: set,
|
2941 |
+
get: get,
|
2942 |
+
getOuter: getOuter,
|
2943 |
+
aggregate: aggregate,
|
2944 |
+
max: max
|
2945 |
+
};
|
2946 |
+
}
|
2947 |
+
|
2948 |
+
var api$1 = Dimension('height', function (element) {
|
2949 |
+
var dom = element.dom();
|
2950 |
+
return $_95kxntm6jjgwedc6.inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
|
2951 |
+
});
|
2952 |
+
var set$3 = function (element, h) {
|
2953 |
+
api$1.set(element, h);
|
2954 |
+
};
|
2955 |
+
var get$3 = function (element) {
|
2956 |
+
return api$1.get(element);
|
2957 |
+
};
|
2958 |
+
var getOuter = function (element) {
|
2959 |
+
return api$1.getOuter(element);
|
2960 |
+
};
|
2961 |
+
var setMax = function (element, value) {
|
2962 |
+
var inclusions = [
|
2963 |
+
'margin-top',
|
2964 |
+
'border-top-width',
|
2965 |
+
'padding-top',
|
2966 |
+
'padding-bottom',
|
2967 |
+
'border-bottom-width',
|
2968 |
+
'margin-bottom'
|
2969 |
+
];
|
2970 |
+
var absMax = api$1.max(element, value, inclusions);
|
2971 |
+
$_59neaymbjjgwedd8.set(element, 'max-height', absMax + 'px');
|
2972 |
+
};
|
2973 |
+
var $_da9rlin9jjgwedlp = {
|
2974 |
+
set: set$3,
|
2975 |
+
get: get$3,
|
2976 |
+
getOuter: getOuter,
|
2977 |
+
setMax: setMax
|
2978 |
+
};
|
2979 |
+
|
2980 |
+
var api$2 = Dimension('width', function (element) {
|
2981 |
+
return element.dom().offsetWidth;
|
2982 |
+
});
|
2983 |
+
var set$4 = function (element, h) {
|
2984 |
+
api$2.set(element, h);
|
2985 |
+
};
|
2986 |
+
var get$4 = function (element) {
|
2987 |
+
return api$2.get(element);
|
2988 |
+
};
|
2989 |
+
var getOuter$1 = function (element) {
|
2990 |
+
return api$2.getOuter(element);
|
2991 |
+
};
|
2992 |
+
var setMax$1 = function (element, value) {
|
2993 |
+
var inclusions = [
|
2994 |
+
'margin-left',
|
2995 |
+
'border-left-width',
|
2996 |
+
'padding-left',
|
2997 |
+
'padding-right',
|
2998 |
+
'border-right-width',
|
2999 |
+
'margin-right'
|
3000 |
+
];
|
3001 |
+
var absMax = api$2.max(element, value, inclusions);
|
3002 |
+
$_59neaymbjjgwedd8.set(element, 'max-width', absMax + 'px');
|
3003 |
+
};
|
3004 |
+
var $_ga29tsnbjjgwedly = {
|
3005 |
+
set: set$4,
|
3006 |
+
get: get$4,
|
3007 |
+
getOuter: getOuter$1,
|
3008 |
+
setMax: setMax$1
|
3009 |
+
};
|
3010 |
+
|
3011 |
+
var platform = $_avfe9dlqjjgwedat.detect();
|
3012 |
+
var needManualCalc = function () {
|
3013 |
+
return platform.browser.isIE() || platform.browser.isEdge();
|
3014 |
+
};
|
3015 |
+
var toNumber = function (px, fallback) {
|
3016 |
+
var num = parseFloat(px);
|
3017 |
+
return isNaN(num) ? fallback : num;
|
3018 |
+
};
|
3019 |
+
var getProp = function (elm, name, fallback) {
|
3020 |
+
return toNumber($_59neaymbjjgwedd8.get(elm, name), fallback);
|
3021 |
+
};
|
3022 |
+
var getCalculatedHeight = function (cell) {
|
3023 |
+
var paddingTop = getProp(cell, 'padding-top', 0);
|
3024 |
+
var paddingBottom = getProp(cell, 'padding-bottom', 0);
|
3025 |
+
var borderTop = getProp(cell, 'border-top-width', 0);
|
3026 |
+
var borderBottom = getProp(cell, 'border-bottom-width', 0);
|
3027 |
+
var height = cell.dom().getBoundingClientRect().height;
|
3028 |
+
var boxSizing = $_59neaymbjjgwedd8.get(cell, 'box-sizing');
|
3029 |
+
var borders = borderTop + borderBottom;
|
3030 |
+
return boxSizing === 'border-box' ? height : height - paddingTop - paddingBottom - borders;
|
3031 |
+
};
|
3032 |
+
var getWidth = function (cell) {
|
3033 |
+
return getProp(cell, 'width', $_ga29tsnbjjgwedly.get(cell));
|
3034 |
+
};
|
3035 |
+
var getHeight = function (cell) {
|
3036 |
+
return needManualCalc() ? getCalculatedHeight(cell) : getProp(cell, 'height', $_da9rlin9jjgwedlp.get(cell));
|
3037 |
+
};
|
3038 |
+
var $_a9ivafn8jjgwedlg = {
|
3039 |
+
getWidth: getWidth,
|
3040 |
+
getHeight: getHeight
|
3041 |
+
};
|
3042 |
+
|
3043 |
+
var genericSizeRegex = /(\d+(\.\d+)?)(\w|%)*/;
|
3044 |
+
var percentageBasedSizeRegex = /(\d+(\.\d+)?)%/;
|
3045 |
+
var pixelBasedSizeRegex = /(\d+(\.\d+)?)px|em/;
|
3046 |
+
var setPixelWidth = function (cell, amount) {
|
3047 |
+
$_59neaymbjjgwedd8.set(cell, 'width', amount + 'px');
|
3048 |
+
};
|
3049 |
+
var setPercentageWidth = function (cell, amount) {
|
3050 |
+
$_59neaymbjjgwedd8.set(cell, 'width', amount + '%');
|
3051 |
+
};
|
3052 |
+
var setHeight = function (cell, amount) {
|
3053 |
+
$_59neaymbjjgwedd8.set(cell, 'height', amount + 'px');
|
3054 |
+
};
|
3055 |
+
var getHeightValue = function (cell) {
|
3056 |
+
return $_59neaymbjjgwedd8.getRaw(cell, 'height').getOrThunk(function () {
|
3057 |
+
return $_a9ivafn8jjgwedlg.getHeight(cell) + 'px';
|
3058 |
+
});
|
3059 |
+
};
|
3060 |
+
var convert = function (cell, number, getter, setter) {
|
3061 |
+
var newSize = $_bmlvw1ldjjgwed84.table(cell).map(function (table) {
|
3062 |
+
var total = getter(table);
|
3063 |
+
return Math.floor(number / 100 * total);
|
3064 |
+
}).getOr(number);
|
3065 |
+
setter(cell, newSize);
|
3066 |
+
return newSize;
|
3067 |
+
};
|
3068 |
+
var normalizePixelSize = function (value, cell, getter, setter) {
|
3069 |
+
var number = parseInt(value, 10);
|
3070 |
+
return endsWith(value, '%') && $_g6duvbm3jjgwedby.name(cell) !== 'table' ? convert(cell, number, getter, setter) : number;
|
3071 |
+
};
|
3072 |
+
var getTotalHeight = function (cell) {
|
3073 |
+
var value = getHeightValue(cell);
|
3074 |
+
if (!value)
|
3075 |
+
return $_da9rlin9jjgwedlp.get(cell);
|
3076 |
+
return normalizePixelSize(value, cell, $_da9rlin9jjgwedlp.get, setHeight);
|
3077 |
+
};
|
3078 |
+
var get$5 = function (cell, type, f) {
|
3079 |
+
var v = f(cell);
|
3080 |
+
var span = getSpan(cell, type);
|
3081 |
+
return v / span;
|
3082 |
+
};
|
3083 |
+
var getSpan = function (cell, type) {
|
3084 |
+
return $_72hn9pm2jjgwedbq.has(cell, type) ? parseInt($_72hn9pm2jjgwedbq.get(cell, type), 10) : 1;
|
3085 |
+
};
|
3086 |
+
var getRawWidth = function (element) {
|
3087 |
+
var cssWidth = $_59neaymbjjgwedd8.getRaw(element, 'width');
|
3088 |
+
return cssWidth.fold(function () {
|
3089 |
+
return Option.from($_72hn9pm2jjgwedbq.get(element, 'width'));
|
3090 |
+
}, function (width) {
|
3091 |
+
return Option.some(width);
|
3092 |
+
});
|
3093 |
+
};
|
3094 |
+
var normalizePercentageWidth = function (cellWidth, tableSize) {
|
3095 |
+
return cellWidth / tableSize.pixelWidth() * 100;
|
3096 |
+
};
|
3097 |
+
var choosePercentageSize = function (element, width, tableSize) {
|
3098 |
+
if (percentageBasedSizeRegex.test(width)) {
|
3099 |
+
var percentMatch = percentageBasedSizeRegex.exec(width);
|
3100 |
+
return parseFloat(percentMatch[1]);
|
3101 |
+
} else {
|
3102 |
+
var intWidth = $_ga29tsnbjjgwedly.get(element);
|
3103 |
+
return normalizePercentageWidth(intWidth, tableSize);
|
3104 |
+
}
|
3105 |
+
};
|
3106 |
+
var getPercentageWidth = function (cell, tableSize) {
|
3107 |
+
var width = getRawWidth(cell);
|
3108 |
+
return width.fold(function () {
|
3109 |
+
var intWidth = $_ga29tsnbjjgwedly.get(cell);
|
3110 |
+
return normalizePercentageWidth(intWidth, tableSize);
|
3111 |
+
}, function (width) {
|
3112 |
+
return choosePercentageSize(cell, width, tableSize);
|
3113 |
+
});
|
3114 |
+
};
|
3115 |
+
var normalizePixelWidth = function (cellWidth, tableSize) {
|
3116 |
+
return cellWidth / 100 * tableSize.pixelWidth();
|
3117 |
+
};
|
3118 |
+
var choosePixelSize = function (element, width, tableSize) {
|
3119 |
+
if (pixelBasedSizeRegex.test(width)) {
|
3120 |
+
var pixelMatch = pixelBasedSizeRegex.exec(width);
|
3121 |
+
return parseInt(pixelMatch[1], 10);
|
3122 |
+
} else if (percentageBasedSizeRegex.test(width)) {
|
3123 |
+
var percentMatch = percentageBasedSizeRegex.exec(width);
|
3124 |
+
var floatWidth = parseFloat(percentMatch[1]);
|
3125 |
+
return normalizePixelWidth(floatWidth, tableSize);
|
3126 |
+
} else {
|
3127 |
+
return $_ga29tsnbjjgwedly.get(element);
|
3128 |
+
}
|
3129 |
+
};
|
3130 |
+
var getPixelWidth = function (cell, tableSize) {
|
3131 |
+
var width = getRawWidth(cell);
|
3132 |
+
return width.fold(function () {
|
3133 |
+
return $_ga29tsnbjjgwedly.get(cell);
|
3134 |
+
}, function (width) {
|
3135 |
+
return choosePixelSize(cell, width, tableSize);
|
3136 |
+
});
|
3137 |
+
};
|
3138 |
+
var getHeight$1 = function (cell) {
|
3139 |
+
return get$5(cell, 'rowspan', getTotalHeight);
|
3140 |
+
};
|
3141 |
+
var getGenericWidth = function (cell) {
|
3142 |
+
var width = getRawWidth(cell);
|
3143 |
+
return width.bind(function (width) {
|
3144 |
+
if (genericSizeRegex.test(width)) {
|
3145 |
+
var match = genericSizeRegex.exec(width);
|
3146 |
+
return Option.some({
|
3147 |
+
width: constant(match[1]),
|
3148 |
+
unit: constant(match[3])
|
3149 |
});
|
3150 |
+
} else {
|
3151 |
+
return Option.none();
|
3152 |
}
|
3153 |
+
});
|
3154 |
+
};
|
3155 |
+
var setGenericWidth = function (cell, amount, unit) {
|
3156 |
+
$_59neaymbjjgwedd8.set(cell, 'width', amount + unit);
|
3157 |
+
};
|
3158 |
+
var $_b9jva9n7jjgwedkv = {
|
3159 |
+
percentageBasedSizeRegex: constant(percentageBasedSizeRegex),
|
3160 |
+
pixelBasedSizeRegex: constant(pixelBasedSizeRegex),
|
3161 |
+
setPixelWidth: setPixelWidth,
|
3162 |
+
setPercentageWidth: setPercentageWidth,
|
3163 |
+
setHeight: setHeight,
|
3164 |
+
getPixelWidth: getPixelWidth,
|
3165 |
+
getPercentageWidth: getPercentageWidth,
|
3166 |
+
getGenericWidth: getGenericWidth,
|
3167 |
+
setGenericWidth: setGenericWidth,
|
3168 |
+
getHeight: getHeight$1,
|
3169 |
+
getRawWidth: getRawWidth
|
3170 |
+
};
|
3171 |
+
|
3172 |
+
var halve = function (main, other) {
|
3173 |
+
var width = $_b9jva9n7jjgwedkv.getGenericWidth(main);
|
3174 |
+
width.each(function (width) {
|
3175 |
+
var newWidth = width.width() / 2;
|
3176 |
+
$_b9jva9n7jjgwedkv.setGenericWidth(main, newWidth, width.unit());
|
3177 |
+
$_b9jva9n7jjgwedkv.setGenericWidth(other, newWidth, width.unit());
|
3178 |
+
});
|
3179 |
+
};
|
3180 |
+
var $_ajdo6on6jjgwedks = { halve: halve };
|
3181 |
+
|
3182 |
+
var attached = function (element, scope) {
|
3183 |
+
var doc = scope || Element$$1.fromDom(document.documentElement);
|
3184 |
+
return $_6l4e4m8jjgwedci.ancestor(element, curry($_e1yh5slljjgwedae.eq, doc)).isSome();
|
3185 |
+
};
|
3186 |
+
var windowOf = function (element) {
|
3187 |
+
var dom = element.dom();
|
3188 |
+
if (dom === dom.window && element instanceof Window)
|
3189 |
+
return element;
|
3190 |
+
return $_g6duvbm3jjgwedby.isDocument(element) ? dom.defaultView || dom.parentWindow : null;
|
3191 |
+
};
|
3192 |
+
var $_f9m22angjjgwedmn = {
|
3193 |
+
attached: attached,
|
3194 |
+
windowOf: windowOf
|
3195 |
+
};
|
3196 |
+
|
3197 |
+
var r = function (left, top) {
|
3198 |
+
var translate = function (x, y) {
|
3199 |
+
return r(left + x, top + y);
|
3200 |
+
};
|
3201 |
+
return {
|
3202 |
+
left: constant(left),
|
3203 |
+
top: constant(top),
|
3204 |
+
translate: translate
|
3205 |
+
};
|
3206 |
+
};
|
3207 |
+
var Position = r;
|
3208 |
+
|
3209 |
+
var boxPosition = function (dom) {
|
3210 |
+
var box = dom.getBoundingClientRect();
|
3211 |
+
return Position(box.left, box.top);
|
3212 |
+
};
|
3213 |
+
var firstDefinedOrZero = function (a, b) {
|
3214 |
+
return a !== undefined ? a : b !== undefined ? b : 0;
|
3215 |
+
};
|
3216 |
+
var absolute = function (element) {
|
3217 |
+
var doc = element.dom().ownerDocument;
|
3218 |
+
var body = doc.body;
|
3219 |
+
var win = $_f9m22angjjgwedmn.windowOf(Element$$1.fromDom(doc));
|
3220 |
+
var html = doc.documentElement;
|
3221 |
+
var scrollTop = firstDefinedOrZero(win.pageYOffset, html.scrollTop);
|
3222 |
+
var scrollLeft = firstDefinedOrZero(win.pageXOffset, html.scrollLeft);
|
3223 |
+
var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
|
3224 |
+
var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
|
3225 |
+
return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
|
3226 |
+
};
|
3227 |
+
var relative = function (element) {
|
3228 |
+
var dom = element.dom();
|
3229 |
+
return Position(dom.offsetLeft, dom.offsetTop);
|
3230 |
+
};
|
3231 |
+
var viewport = function (element) {
|
3232 |
+
var dom = element.dom();
|
3233 |
+
var doc = dom.ownerDocument;
|
3234 |
+
var body = doc.body;
|
3235 |
+
var html = Element$$1.fromDom(doc.documentElement);
|
3236 |
+
if (body === dom)
|
3237 |
+
return Position(body.offsetLeft, body.offsetTop);
|
3238 |
+
if (!$_f9m22angjjgwedmn.attached(element, html))
|
3239 |
+
return Position(0, 0);
|
3240 |
+
return boxPosition(dom);
|
3241 |
+
};
|
3242 |
+
var $_emicwtnfjjgwedml = {
|
3243 |
+
absolute: absolute,
|
3244 |
+
relative: relative,
|
3245 |
+
viewport: viewport
|
3246 |
+
};
|
3247 |
+
|
3248 |
+
var rowInfo = Immutable('row', 'y');
|
3249 |
+
var colInfo = Immutable('col', 'x');
|
3250 |
+
var rtlEdge = function (cell) {
|
3251 |
+
var pos = $_emicwtnfjjgwedml.absolute(cell);
|
3252 |
+
return pos.left() + $_ga29tsnbjjgwedly.getOuter(cell);
|
3253 |
+
};
|
3254 |
+
var ltrEdge = function (cell) {
|
3255 |
+
return $_emicwtnfjjgwedml.absolute(cell).left();
|
3256 |
+
};
|
3257 |
+
var getLeftEdge = function (index, cell) {
|
3258 |
+
return colInfo(index, ltrEdge(cell));
|
3259 |
+
};
|
3260 |
+
var getRightEdge = function (index, cell) {
|
3261 |
+
return colInfo(index, rtlEdge(cell));
|
3262 |
+
};
|
3263 |
+
var getTop = function (cell) {
|
3264 |
+
return $_emicwtnfjjgwedml.absolute(cell).top();
|
3265 |
+
};
|
3266 |
+
var getTopEdge = function (index, cell) {
|
3267 |
+
return rowInfo(index, getTop(cell));
|
3268 |
+
};
|
3269 |
+
var getBottomEdge = function (index, cell) {
|
3270 |
+
return rowInfo(index, getTop(cell) + $_da9rlin9jjgwedlp.getOuter(cell));
|
3271 |
+
};
|
3272 |
+
var findPositions = function (getInnerEdge, getOuterEdge, array) {
|
3273 |
+
if (array.length === 0)
|
3274 |
+
return [];
|
3275 |
+
var lines = map(array.slice(1), function (cellOption, index) {
|
3276 |
+
return cellOption.map(function (cell) {
|
3277 |
+
return getInnerEdge(index, cell);
|
3278 |
});
|
3279 |
+
});
|
3280 |
+
var lastLine = array[array.length - 1].map(function (cell) {
|
3281 |
+
return getOuterEdge(array.length - 1, cell);
|
3282 |
+
});
|
3283 |
+
return lines.concat([lastLine]);
|
3284 |
+
};
|
3285 |
+
var negate = function (step, _table) {
|
3286 |
+
return -step;
|
3287 |
+
};
|
3288 |
+
var height = {
|
3289 |
+
delta: identity,
|
3290 |
+
positions: curry(findPositions, getTopEdge, getBottomEdge),
|
3291 |
+
edge: getTop
|
3292 |
+
};
|
3293 |
+
var ltr = {
|
3294 |
+
delta: identity,
|
3295 |
+
edge: ltrEdge,
|
3296 |
+
positions: curry(findPositions, getLeftEdge, getRightEdge)
|
3297 |
+
};
|
3298 |
+
var rtl = {
|
3299 |
+
delta: negate,
|
3300 |
+
edge: rtlEdge,
|
3301 |
+
positions: curry(findPositions, getRightEdge, getLeftEdge)
|
3302 |
+
};
|
3303 |
+
var $_fsi6i6nejjgwedm2 = {
|
3304 |
+
height: height,
|
3305 |
+
rtl: rtl,
|
3306 |
+
ltr: ltr
|
3307 |
+
};
|
3308 |
+
|
3309 |
+
var $_ghqfhundjjgwedm1 = {
|
3310 |
+
ltr: $_fsi6i6nejjgwedm2.ltr,
|
3311 |
+
rtl: $_fsi6i6nejjgwedm2.rtl
|
3312 |
+
};
|
3313 |
+
|
3314 |
+
function TableDirection (directionAt) {
|
3315 |
+
var auto = function (table) {
|
3316 |
+
return directionAt(table).isRtl() ? $_ghqfhundjjgwedm1.rtl : $_ghqfhundjjgwedm1.ltr;
|
3317 |
+
};
|
3318 |
+
var delta = function (amount, table) {
|
3319 |
+
return auto(table).delta(amount, table);
|
3320 |
+
};
|
3321 |
+
var positions = function (cols, table) {
|
3322 |
+
return auto(table).positions(cols, table);
|
3323 |
+
};
|
3324 |
+
var edge = function (cell) {
|
3325 |
+
return auto(cell).edge(cell);
|
3326 |
+
};
|
3327 |
+
return {
|
3328 |
+
delta: delta,
|
3329 |
+
edge: edge,
|
3330 |
+
positions: positions
|
3331 |
};
|
3332 |
+
}
|
3333 |
|
3334 |
+
var getGridSize = function (table) {
|
3335 |
+
var input = $_da6e59lbjjgwed7r.fromTable(table);
|
3336 |
+
var warehouse = $_eesv8pmajjgwedcx.generate(input);
|
3337 |
+
return warehouse.grid();
|
3338 |
+
};
|
3339 |
+
var $_6hdhmfnijjgwedmv = { getGridSize: getGridSize };
|
3340 |
+
|
3341 |
+
var Cell = function (initial) {
|
3342 |
+
var value = initial;
|
3343 |
+
var get = function () {
|
3344 |
+
return value;
|
3345 |
};
|
3346 |
+
var set = function (v) {
|
3347 |
+
value = v;
|
3348 |
};
|
3349 |
+
var clone = function () {
|
3350 |
+
return Cell(get());
|
|
|
|
|
|
|
3351 |
};
|
3352 |
+
return {
|
3353 |
+
get: get,
|
3354 |
+
set: set,
|
3355 |
+
clone: clone
|
|
|
3356 |
};
|
3357 |
+
};
|
3358 |
|
3359 |
+
var base = function (handleUnsupported, required) {
|
3360 |
+
return baseWith(handleUnsupported, required, {
|
3361 |
+
validate: isFunction,
|
3362 |
+
label: 'function'
|
3363 |
+
});
|
3364 |
+
};
|
3365 |
+
var baseWith = function (handleUnsupported, required, pred) {
|
3366 |
+
if (required.length === 0)
|
3367 |
+
throw new Error('You must specify at least one required field.');
|
3368 |
+
validateStrArr('required', required);
|
3369 |
+
checkDupes(required);
|
3370 |
+
return function (obj) {
|
3371 |
+
var keys$$1 = keys(obj);
|
3372 |
+
var allReqd = forall(required, function (req) {
|
3373 |
+
return contains(keys$$1, req);
|
3374 |
+
});
|
3375 |
+
if (!allReqd)
|
3376 |
+
reqMessage(required, keys$$1);
|
3377 |
+
handleUnsupported(required, keys$$1);
|
3378 |
+
var invalidKeys = filter(required, function (key) {
|
3379 |
+
return !pred.validate(obj[key], key);
|
3380 |
+
});
|
3381 |
+
if (invalidKeys.length > 0)
|
3382 |
+
invalidTypeMessage(invalidKeys, pred.label);
|
3383 |
+
return obj;
|
3384 |
+
};
|
3385 |
+
};
|
3386 |
+
var handleExact = function (required, keys$$1) {
|
3387 |
+
var unsupported = filter(keys$$1, function (key) {
|
3388 |
+
return !contains(required, key);
|
3389 |
+
});
|
3390 |
+
if (unsupported.length > 0)
|
3391 |
+
unsuppMessage(unsupported);
|
3392 |
+
};
|
3393 |
+
var exactly = function (required) {
|
3394 |
+
return base(handleExact, required);
|
3395 |
+
};
|
3396 |
+
|
3397 |
+
var elementToData = function (element) {
|
3398 |
+
var colspan = $_72hn9pm2jjgwedbq.has(element, 'colspan') ? parseInt($_72hn9pm2jjgwedbq.get(element, 'colspan'), 10) : 1;
|
3399 |
+
var rowspan = $_72hn9pm2jjgwedbq.has(element, 'rowspan') ? parseInt($_72hn9pm2jjgwedbq.get(element, 'rowspan'), 10) : 1;
|
3400 |
+
return {
|
3401 |
+
element: constant(element),
|
3402 |
+
colspan: constant(colspan),
|
3403 |
+
rowspan: constant(rowspan)
|
3404 |
+
};
|
3405 |
+
};
|
3406 |
+
var modification = function (generators, _toData) {
|
3407 |
+
contract(generators);
|
3408 |
+
var position = Cell(Option.none());
|
3409 |
+
var toData = _toData !== undefined ? _toData : elementToData;
|
3410 |
+
var nu = function (data) {
|
3411 |
+
return generators.cell(data);
|
3412 |
+
};
|
3413 |
+
var nuFrom = function (element) {
|
3414 |
+
var data = toData(element);
|
3415 |
+
return nu(data);
|
3416 |
+
};
|
3417 |
+
var add = function (element) {
|
3418 |
+
var replacement = nuFrom(element);
|
3419 |
+
if (position.get().isNone())
|
3420 |
+
position.set(Option.some(replacement));
|
3421 |
+
recent = Option.some({
|
3422 |
+
item: element,
|
3423 |
+
replacement: replacement
|
3424 |
+
});
|
3425 |
+
return replacement;
|
3426 |
+
};
|
3427 |
+
var recent = Option.none();
|
3428 |
+
var getOrInit = function (element, comparator) {
|
3429 |
+
return recent.fold(function () {
|
3430 |
+
return add(element);
|
3431 |
+
}, function (p) {
|
3432 |
+
return comparator(element, p.item) ? p.replacement : add(element);
|
3433 |
+
});
|
3434 |
+
};
|
3435 |
+
return {
|
3436 |
+
getOrInit: getOrInit,
|
3437 |
+
cursor: position.get
|
3438 |
+
};
|
3439 |
+
};
|
3440 |
+
var transform = function (scope, tag) {
|
3441 |
+
return function (generators) {
|
3442 |
+
var position = Cell(Option.none());
|
3443 |
+
contract(generators);
|
3444 |
+
var list = [];
|
3445 |
+
var find$$1 = function (element, comparator) {
|
3446 |
+
return find(list, function (x) {
|
3447 |
+
return comparator(x.item, element);
|
3448 |
+
});
|
3449 |
};
|
3450 |
+
var makeNew = function (element) {
|
3451 |
+
var cell = generators.replace(element, tag, { scope: scope });
|
3452 |
+
list.push({
|
3453 |
+
item: element,
|
3454 |
+
sub: cell
|
3455 |
+
});
|
3456 |
+
if (position.get().isNone())
|
3457 |
+
position.set(Option.some(cell));
|
3458 |
+
return cell;
|
3459 |
};
|
3460 |
+
var replaceOrInit = function (element, comparator) {
|
3461 |
+
return find$$1(element, comparator).fold(function () {
|
3462 |
+
return makeNew(element);
|
3463 |
+
}, function (p) {
|
3464 |
+
return comparator(element, p.item) ? p.sub : makeNew(element);
|
3465 |
+
});
|
3466 |
};
|
3467 |
return {
|
3468 |
+
replaceOrInit: replaceOrInit,
|
3469 |
+
cursor: position.get
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3470 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3471 |
};
|
3472 |
+
};
|
3473 |
+
var merging = function (generators) {
|
3474 |
+
contract(generators);
|
3475 |
+
var position = Cell(Option.none());
|
3476 |
+
var combine = function (cell) {
|
3477 |
+
if (position.get().isNone())
|
3478 |
+
position.set(Option.some(cell));
|
3479 |
return function () {
|
3480 |
+
var raw = generators.cell({
|
3481 |
+
element: constant(cell),
|
3482 |
+
colspan: constant(1),
|
3483 |
+
rowspan: constant(1)
|
|
|
|
|
|
|
|
|
|
|
3484 |
});
|
3485 |
+
$_59neaymbjjgwedd8.remove(raw, 'width');
|
3486 |
+
$_59neaymbjjgwedd8.remove(cell, 'width');
|
3487 |
+
return raw;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3488 |
};
|
3489 |
};
|
3490 |
+
return {
|
3491 |
+
combine: combine,
|
3492 |
+
cursor: position.get
|
3493 |
+
};
|
3494 |
+
};
|
3495 |
+
var contract = exactly([
|
3496 |
+
'cell',
|
3497 |
+
'row',
|
3498 |
+
'replace',
|
3499 |
+
'gap'
|
3500 |
+
]);
|
3501 |
+
var $_5kytwlnkjjgwednf = {
|
3502 |
+
modification: modification,
|
3503 |
+
transform: transform,
|
3504 |
+
merging: merging
|
3505 |
+
};
|
3506 |
+
|
3507 |
+
var blockList = [
|
3508 |
+
'body',
|
3509 |
+
'p',
|
3510 |
+
'div',
|
3511 |
+
'article',
|
3512 |
+
'aside',
|
3513 |
+
'figcaption',
|
3514 |
+
'figure',
|
3515 |
+
'footer',
|
3516 |
+
'header',
|
3517 |
+
'nav',
|
3518 |
+
'section',
|
3519 |
+
'ol',
|
3520 |
+
'ul',
|
3521 |
+
'table',
|
3522 |
+
'thead',
|
3523 |
+
'tfoot',
|
3524 |
+
'tbody',
|
3525 |
+
'caption',
|
3526 |
+
'tr',
|
3527 |
+
'td',
|
3528 |
+
'th',
|
3529 |
+
'h1',
|
3530 |
+
'h2',
|
3531 |
+
'h3',
|
3532 |
+
'h4',
|
3533 |
+
'h5',
|
3534 |
+
'h6',
|
3535 |
+
'blockquote',
|
3536 |
+
'pre',
|
3537 |
+
'address'
|
3538 |
+
];
|
3539 |
+
var isList = function (universe, item) {
|
3540 |
+
var tagName = universe.property().name(item);
|
3541 |
+
return contains([
|
3542 |
'ol',
|
3543 |
+
'ul'
|
3544 |
+
], tagName);
|
3545 |
+
};
|
3546 |
+
var isBlock = function (universe, item) {
|
3547 |
+
var tagName = universe.property().name(item);
|
3548 |
+
return contains(blockList, tagName);
|
3549 |
+
};
|
3550 |
+
var isFormatting = function (universe, item) {
|
3551 |
+
var tagName = universe.property().name(item);
|
3552 |
+
return contains([
|
3553 |
+
'address',
|
3554 |
+
'pre',
|
3555 |
+
'p',
|
3556 |
+
'h1',
|
3557 |
+
'h2',
|
3558 |
+
'h3',
|
3559 |
+
'h4',
|
3560 |
+
'h5',
|
3561 |
+
'h6'
|
3562 |
+
], tagName);
|
3563 |
+
};
|
3564 |
+
var isHeading = function (universe, item) {
|
3565 |
+
var tagName = universe.property().name(item);
|
3566 |
+
return contains([
|
3567 |
'h1',
|
3568 |
'h2',
|
3569 |
'h3',
|
3570 |
'h4',
|
3571 |
'h5',
|
3572 |
+
'h6'
|
3573 |
+
], tagName);
|
3574 |
+
};
|
3575 |
+
var isContainer = function (universe, item) {
|
3576 |
+
return contains([
|
3577 |
+
'div',
|
3578 |
+
'li',
|
3579 |
+
'td',
|
3580 |
+
'th',
|
3581 |
'blockquote',
|
3582 |
+
'body',
|
3583 |
+
'caption'
|
3584 |
+
], universe.property().name(item));
|
3585 |
+
};
|
3586 |
+
var isEmptyTag = function (universe, item) {
|
3587 |
+
return contains([
|
3588 |
+
'br',
|
3589 |
+
'img',
|
3590 |
+
'hr',
|
3591 |
+
'input'
|
3592 |
+
], universe.property().name(item));
|
3593 |
+
};
|
3594 |
+
var isFrame = function (universe, item) {
|
3595 |
+
return universe.property().name(item) === 'iframe';
|
3596 |
+
};
|
3597 |
+
var isInline = function (universe, item) {
|
3598 |
+
return !(isBlock(universe, item) || isEmptyTag(universe, item)) && universe.property().name(item) !== 'li';
|
3599 |
+
};
|
3600 |
+
var $_foqbk4npjjgwedoy = {
|
3601 |
+
isBlock: isBlock,
|
3602 |
+
isList: isList,
|
3603 |
+
isFormatting: isFormatting,
|
3604 |
+
isHeading: isHeading,
|
3605 |
+
isContainer: isContainer,
|
3606 |
+
isEmptyTag: isEmptyTag,
|
3607 |
+
isFrame: isFrame,
|
3608 |
+
isInline: isInline
|
3609 |
+
};
|
3610 |
+
|
3611 |
+
var universe$1 = DomUniverse();
|
3612 |
+
var isBlock$1 = function (element) {
|
3613 |
+
return $_foqbk4npjjgwedoy.isBlock(universe$1, element);
|
3614 |
+
};
|
3615 |
+
var isList$1 = function (element) {
|
3616 |
+
return $_foqbk4npjjgwedoy.isList(universe$1, element);
|
3617 |
+
};
|
3618 |
+
var isFormatting$1 = function (element) {
|
3619 |
+
return $_foqbk4npjjgwedoy.isFormatting(universe$1, element);
|
3620 |
+
};
|
3621 |
+
var isHeading$1 = function (element) {
|
3622 |
+
return $_foqbk4npjjgwedoy.isHeading(universe$1, element);
|
3623 |
+
};
|
3624 |
+
var isContainer$1 = function (element) {
|
3625 |
+
return $_foqbk4npjjgwedoy.isContainer(universe$1, element);
|
3626 |
+
};
|
3627 |
+
var isEmptyTag$1 = function (element) {
|
3628 |
+
return $_foqbk4npjjgwedoy.isEmptyTag(universe$1, element);
|
3629 |
+
};
|
3630 |
+
var isFrame$1 = function (element) {
|
3631 |
+
return $_foqbk4npjjgwedoy.isFrame(universe$1, element);
|
3632 |
+
};
|
3633 |
+
var isInline$1 = function (element) {
|
3634 |
+
return $_foqbk4npjjgwedoy.isInline(universe$1, element);
|
3635 |
+
};
|
3636 |
+
var $_2d7i0tnojjgwedou = {
|
3637 |
+
isBlock: isBlock$1,
|
3638 |
+
isList: isList$1,
|
3639 |
+
isFormatting: isFormatting$1,
|
3640 |
+
isHeading: isHeading$1,
|
3641 |
+
isContainer: isContainer$1,
|
3642 |
+
isEmptyTag: isEmptyTag$1,
|
3643 |
+
isFrame: isFrame$1,
|
3644 |
+
isInline: isInline$1
|
3645 |
+
};
|
3646 |
+
|
3647 |
+
var merge = function (cells) {
|
3648 |
+
var isBr = function (el) {
|
3649 |
+
return $_g6duvbm3jjgwedby.name(el) === 'br';
|
3650 |
+
};
|
3651 |
+
var advancedBr = function (children) {
|
3652 |
+
return forall(children, function (c) {
|
3653 |
+
return isBr(c) || $_g6duvbm3jjgwedby.isText(c) && $_btltedmkjjgwedf4.get(c).trim().length === 0;
|
3654 |
+
});
|
3655 |
+
};
|
3656 |
+
var isListItem = function (el) {
|
3657 |
+
return $_g6duvbm3jjgwedby.name(el) === 'li' || $_6l4e4m8jjgwedci.ancestor(el, $_2d7i0tnojjgwedou.isList).isSome();
|
3658 |
+
};
|
3659 |
+
var siblingIsBlock = function (el) {
|
3660 |
+
return $_97vsilljjjgwed9v.nextSibling(el).map(function (rightSibling) {
|
3661 |
+
if ($_2d7i0tnojjgwedou.isBlock(rightSibling))
|
3662 |
return true;
|
3663 |
+
if ($_2d7i0tnojjgwedou.isEmptyTag(rightSibling)) {
|
3664 |
+
return $_g6duvbm3jjgwedby.name(rightSibling) === 'img' ? false : true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3665 |
}
|
3666 |
+
}).getOr(false);
|
|
|
3667 |
};
|
3668 |
+
var markCell = function (cell) {
|
3669 |
+
return $_cww1bpmijjgwedex.last(cell).bind(function (rightEdge) {
|
3670 |
+
var rightSiblingIsBlock = siblingIsBlock(rightEdge);
|
3671 |
+
return $_97vsilljjjgwed9v.parent(rightEdge).map(function (parent) {
|
3672 |
+
return rightSiblingIsBlock === true || isListItem(parent) || isBr(rightEdge) || $_2d7i0tnojjgwedou.isBlock(parent) && !$_e1yh5slljjgwedae.eq(cell, parent) ? [] : [Element$$1.fromTag('br')];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3673 |
});
|
3674 |
+
}).getOr([]);
|
3675 |
+
};
|
3676 |
+
var markContent = function () {
|
3677 |
+
var content = bind(cells, function (cell) {
|
3678 |
+
var children = $_97vsilljjjgwed9v.children(cell);
|
3679 |
+
return advancedBr(children) ? [] : children.concat(markCell(cell));
|
3680 |
+
});
|
3681 |
+
return content.length === 0 ? [Element$$1.fromTag('br')] : content;
|
3682 |
+
};
|
3683 |
+
var contents = markContent();
|
3684 |
+
$_1y8qodmejjgweddq.empty(cells[0]);
|
3685 |
+
$_7onf0emfjjgweddu.append(cells[0], contents);
|
3686 |
+
};
|
3687 |
+
var $_bbrz1bnnjjgwedo6 = { merge: merge };
|
3688 |
+
|
3689 |
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3690 |
+
var shallow$1 = function (old, nu) {
|
3691 |
+
return nu;
|
3692 |
+
};
|
3693 |
+
var baseMerge = function (merger) {
|
3694 |
+
return function () {
|
3695 |
+
var objects = new Array(arguments.length);
|
3696 |
+
for (var i = 0; i < objects.length; i++)
|
3697 |
+
objects[i] = arguments[i];
|
3698 |
+
if (objects.length === 0)
|
3699 |
+
throw new Error('Can\'t merge zero objects');
|
3700 |
+
var ret = {};
|
3701 |
+
for (var j = 0; j < objects.length; j++) {
|
3702 |
+
var curObject = objects[j];
|
3703 |
+
for (var key in curObject)
|
3704 |
+
if (hasOwnProperty.call(curObject, key)) {
|
3705 |
+
ret[key] = merger(ret[key], curObject[key]);
|
3706 |
+
}
|
3707 |
+
}
|
3708 |
+
return ret;
|
3709 |
};
|
3710 |
+
};
|
3711 |
|
3712 |
+
var merge$1 = baseMerge(shallow$1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3713 |
|
3714 |
+
var cat = function (arr) {
|
3715 |
+
var r = [];
|
3716 |
+
var push = function (x) {
|
3717 |
+
r.push(x);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3718 |
};
|
3719 |
+
for (var i = 0; i < arr.length; i++) {
|
3720 |
+
arr[i].each(push);
|
3721 |
+
}
|
3722 |
+
return r;
|
3723 |
+
};
|
3724 |
+
var findMap = function (arr, f) {
|
3725 |
+
for (var i = 0; i < arr.length; i++) {
|
3726 |
+
var r = f(arr[i], i);
|
3727 |
+
if (r.isSome()) {
|
3728 |
+
return r;
|
3729 |
+
}
|
3730 |
+
}
|
3731 |
+
return Option.none();
|
3732 |
+
};
|
3733 |
+
|
3734 |
+
var addCell = function (gridRow, index, cell) {
|
3735 |
+
var cells = gridRow.cells();
|
3736 |
+
var before = cells.slice(0, index);
|
3737 |
+
var after = cells.slice(index);
|
3738 |
+
var newCells = before.concat([cell]).concat(after);
|
3739 |
+
return setCells(gridRow, newCells);
|
3740 |
+
};
|
3741 |
+
var mutateCell = function (gridRow, index, cell) {
|
3742 |
+
var cells = gridRow.cells();
|
3743 |
+
cells[index] = cell;
|
3744 |
+
};
|
3745 |
+
var setCells = function (gridRow, cells) {
|
3746 |
+
return $_6lasqllcjjgwed80.rowcells(cells, gridRow.section());
|
3747 |
+
};
|
3748 |
+
var mapCells = function (gridRow, f) {
|
3749 |
+
var cells = gridRow.cells();
|
3750 |
+
var r = map(cells, f);
|
3751 |
+
return $_6lasqllcjjgwed80.rowcells(r, gridRow.section());
|
3752 |
+
};
|
3753 |
+
var getCell = function (gridRow, index) {
|
3754 |
+
return gridRow.cells()[index];
|
3755 |
+
};
|
3756 |
+
var getCellElement = function (gridRow, index) {
|
3757 |
+
return getCell(gridRow, index).element();
|
3758 |
+
};
|
3759 |
+
var cellLength = function (gridRow) {
|
3760 |
+
return gridRow.cells().length;
|
3761 |
+
};
|
3762 |
+
var $_4q9s6anvjjgwedq7 = {
|
3763 |
+
addCell: addCell,
|
3764 |
+
setCells: setCells,
|
3765 |
+
mutateCell: mutateCell,
|
3766 |
+
getCell: getCell,
|
3767 |
+
getCellElement: getCellElement,
|
3768 |
+
mapCells: mapCells,
|
3769 |
+
cellLength: cellLength
|
3770 |
+
};
|
3771 |
+
|
3772 |
+
var getColumn = function (grid, index) {
|
3773 |
+
return map(grid, function (row) {
|
3774 |
+
return $_4q9s6anvjjgwedq7.getCell(row, index);
|
3775 |
+
});
|
3776 |
+
};
|
3777 |
+
var getRow = function (grid, index) {
|
3778 |
+
return grid[index];
|
3779 |
+
};
|
3780 |
+
var findDiff = function (xs, comp) {
|
3781 |
+
if (xs.length === 0)
|
3782 |
+
return 0;
|
3783 |
+
var first = xs[0];
|
3784 |
+
var index = findIndex(xs, function (x) {
|
3785 |
+
return !comp(first.element(), x.element());
|
3786 |
+
});
|
3787 |
+
return index.fold(function () {
|
3788 |
+
return xs.length;
|
3789 |
+
}, function (ind) {
|
3790 |
+
return ind;
|
3791 |
+
});
|
3792 |
+
};
|
3793 |
+
var subgrid = function (grid, row, column, comparator) {
|
3794 |
+
var restOfRow = getRow(grid, row).cells().slice(column);
|
3795 |
+
var endColIndex = findDiff(restOfRow, comparator);
|
3796 |
+
var restOfColumn = getColumn(grid, column).slice(row);
|
3797 |
+
var endRowIndex = findDiff(restOfColumn, comparator);
|
3798 |
+
return {
|
3799 |
+
colspan: constant(endColIndex),
|
3800 |
+
rowspan: constant(endRowIndex)
|
3801 |
+
};
|
3802 |
+
};
|
3803 |
+
var $_e2rfo9nujjgwedq1 = { subgrid: subgrid };
|
3804 |
+
|
3805 |
+
var toDetails = function (grid, comparator) {
|
3806 |
+
var seen = map(grid, function (row, ri) {
|
3807 |
+
return map(row.cells(), function (col, ci) {
|
3808 |
+
return false;
|
3809 |
});
|
3810 |
+
});
|
3811 |
+
var updateSeen = function (ri, ci, rowspan, colspan) {
|
3812 |
+
for (var r = ri; r < ri + rowspan; r++) {
|
3813 |
+
for (var c = ci; c < ci + colspan; c++) {
|
3814 |
+
seen[r][c] = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3815 |
}
|
3816 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3817 |
};
|
3818 |
+
return map(grid, function (row, ri) {
|
3819 |
+
var details = bind(row.cells(), function (cell, ci) {
|
3820 |
+
if (seen[ri][ci] === false) {
|
3821 |
+
var result = $_e2rfo9nujjgwedq1.subgrid(grid, ri, ci, comparator);
|
3822 |
+
updateSeen(ri, ci, result.rowspan(), result.colspan());
|
3823 |
+
return [$_6lasqllcjjgwed80.detailnew(cell.element(), result.rowspan(), result.colspan(), cell.isNew())];
|
3824 |
+
} else {
|
3825 |
+
return [];
|
3826 |
+
}
|
3827 |
+
});
|
3828 |
+
return $_6lasqllcjjgwed80.rowdetails(details, row.section());
|
3829 |
+
});
|
3830 |
+
};
|
3831 |
+
var toGrid = function (warehouse, generators, isNew) {
|
3832 |
+
var grid = [];
|
3833 |
+
for (var i = 0; i < warehouse.grid().rows(); i++) {
|
3834 |
+
var rowCells = [];
|
3835 |
+
for (var j = 0; j < warehouse.grid().columns(); j++) {
|
3836 |
+
var element = $_eesv8pmajjgwedcx.getAt(warehouse, i, j).map(function (item) {
|
3837 |
+
return $_6lasqllcjjgwed80.elementnew(item.element(), isNew);
|
3838 |
+
}).getOrThunk(function () {
|
3839 |
+
return $_6lasqllcjjgwed80.elementnew(generators.gap(), true);
|
3840 |
+
});
|
3841 |
+
rowCells.push(element);
|
3842 |
+
}
|
3843 |
+
var row = $_6lasqllcjjgwed80.rowcells(rowCells, warehouse.all()[i].section());
|
3844 |
+
grid.push(row);
|
3845 |
+
}
|
3846 |
+
return grid;
|
3847 |
+
};
|
3848 |
+
var $_7omv2yntjjgwedpr = {
|
3849 |
+
toDetails: toDetails,
|
3850 |
+
toGrid: toGrid
|
3851 |
+
};
|
3852 |
+
|
3853 |
+
var setIfNot = function (element, property, value, ignore) {
|
3854 |
+
if (value === ignore)
|
3855 |
+
$_72hn9pm2jjgwedbq.remove(element, property);
|
3856 |
+
else
|
3857 |
+
$_72hn9pm2jjgwedbq.set(element, property, value);
|
3858 |
+
};
|
3859 |
+
var render = function (table, grid) {
|
3860 |
+
var newRows = [];
|
3861 |
+
var newCells = [];
|
3862 |
+
var renderSection = function (gridSection, sectionName) {
|
3863 |
+
var section = $_2e7p77m7jjgwedcg.child(table, sectionName).getOrThunk(function () {
|
3864 |
+
var tb = Element$$1.fromTag(sectionName, $_97vsilljjjgwed9v.owner(table).dom());
|
3865 |
+
$_1yoqsmmdjjgweddo.append(table, tb);
|
3866 |
+
return tb;
|
3867 |
+
});
|
3868 |
+
$_1y8qodmejjgweddq.empty(section);
|
3869 |
+
var rows = map(gridSection, function (row) {
|
3870 |
+
if (row.isNew()) {
|
3871 |
+
newRows.push(row.element());
|
3872 |
+
}
|
3873 |
+
var tr = row.element();
|
3874 |
+
$_1y8qodmejjgweddq.empty(tr);
|
3875 |
+
each(row.cells(), function (cell) {
|
3876 |
+
if (cell.isNew()) {
|
3877 |
+
newCells.push(cell.element());
|
3878 |
+
}
|
3879 |
+
setIfNot(cell.element(), 'colspan', cell.colspan(), 1);
|
3880 |
+
setIfNot(cell.element(), 'rowspan', cell.rowspan(), 1);
|
3881 |
+
$_1yoqsmmdjjgweddo.append(tr, cell.element());
|
3882 |
});
|
3883 |
+
return tr;
|
3884 |
});
|
3885 |
+
$_7onf0emfjjgweddu.append(section, rows);
|
3886 |
};
|
3887 |
+
var removeSection = function (sectionName) {
|
3888 |
+
$_2e7p77m7jjgwedcg.child(table, sectionName).each($_1y8qodmejjgweddq.remove);
|
|
|
|
|
3889 |
};
|
3890 |
+
var renderOrRemoveSection = function (gridSection, sectionName) {
|
3891 |
+
if (gridSection.length > 0) {
|
3892 |
+
renderSection(gridSection, sectionName);
|
3893 |
+
} else {
|
3894 |
+
removeSection(sectionName);
|
3895 |
+
}
|
3896 |
};
|
3897 |
+
var headSection = [];
|
3898 |
+
var bodySection = [];
|
3899 |
+
var footSection = [];
|
3900 |
+
each(grid, function (row) {
|
3901 |
+
switch (row.section()) {
|
3902 |
+
case 'thead':
|
3903 |
+
headSection.push(row);
|
3904 |
+
break;
|
3905 |
+
case 'tbody':
|
3906 |
+
bodySection.push(row);
|
3907 |
+
break;
|
3908 |
+
case 'tfoot':
|
3909 |
+
footSection.push(row);
|
3910 |
+
break;
|
3911 |
+
}
|
3912 |
+
});
|
3913 |
+
renderOrRemoveSection(headSection, 'thead');
|
3914 |
+
renderOrRemoveSection(bodySection, 'tbody');
|
3915 |
+
renderOrRemoveSection(footSection, 'tfoot');
|
3916 |
+
return {
|
3917 |
+
newRows: constant(newRows),
|
3918 |
+
newCells: constant(newCells)
|
3919 |
+
};
|
3920 |
+
};
|
3921 |
+
var copy$2 = function (grid) {
|
3922 |
+
var rows = map(grid, function (row) {
|
3923 |
+
var tr = $_ginehlmhjjgwedet.shallow(row.element());
|
3924 |
+
each(row.cells(), function (cell) {
|
3925 |
+
var clonedCell = $_ginehlmhjjgwedet.deep(cell.element());
|
3926 |
+
setIfNot(clonedCell, 'colspan', cell.colspan(), 1);
|
3927 |
+
setIfNot(clonedCell, 'rowspan', cell.rowspan(), 1);
|
3928 |
+
$_1yoqsmmdjjgweddo.append(tr, clonedCell);
|
3929 |
+
});
|
3930 |
+
return tr;
|
3931 |
+
});
|
3932 |
+
return rows;
|
3933 |
+
};
|
3934 |
+
var $_fdgjk7nwjjgwedqb = {
|
3935 |
+
render: render,
|
3936 |
+
copy: copy$2
|
3937 |
+
};
|
3938 |
+
|
3939 |
+
var repeat = function (repititions, f) {
|
3940 |
+
var r = [];
|
3941 |
+
for (var i = 0; i < repititions; i++) {
|
3942 |
+
r.push(f(i));
|
3943 |
+
}
|
3944 |
+
return r;
|
3945 |
+
};
|
3946 |
+
var range$1 = function (start, end) {
|
3947 |
+
var r = [];
|
3948 |
+
for (var i = start; i < end; i++) {
|
3949 |
+
r.push(i);
|
3950 |
+
}
|
3951 |
+
return r;
|
3952 |
+
};
|
3953 |
+
var unique = function (xs, comparator) {
|
3954 |
+
var result = [];
|
3955 |
+
each(xs, function (x, i) {
|
3956 |
+
if (i < xs.length - 1 && !comparator(x, xs[i + 1])) {
|
3957 |
+
result.push(x);
|
3958 |
+
} else if (i === xs.length - 1) {
|
3959 |
+
result.push(x);
|
3960 |
+
}
|
3961 |
+
});
|
3962 |
+
return result;
|
3963 |
+
};
|
3964 |
+
var deduce = function (xs, index) {
|
3965 |
+
if (index < 0 || index >= xs.length - 1)
|
3966 |
+
return Option.none();
|
3967 |
+
var current = xs[index].fold(function () {
|
3968 |
+
var rest = reverse(xs.slice(0, index));
|
3969 |
+
return findMap(rest, function (a, i) {
|
3970 |
+
return a.map(function (aa) {
|
3971 |
+
return {
|
3972 |
+
value: aa,
|
3973 |
+
delta: i + 1
|
3974 |
+
};
|
3975 |
+
});
|
3976 |
});
|
3977 |
+
}, function (c) {
|
3978 |
+
return Option.some({
|
3979 |
+
value: c,
|
3980 |
+
delta: 0
|
3981 |
+
});
|
3982 |
+
});
|
3983 |
+
var next = xs[index + 1].fold(function () {
|
3984 |
+
var rest = xs.slice(index + 1);
|
3985 |
+
return findMap(rest, function (a, i) {
|
3986 |
+
return a.map(function (aa) {
|
3987 |
+
return {
|
3988 |
+
value: aa,
|
3989 |
+
delta: i + 1
|
3990 |
+
};
|
3991 |
});
|
3992 |
});
|
3993 |
+
}, function (n) {
|
3994 |
+
return Option.some({
|
3995 |
+
value: n,
|
3996 |
+
delta: 1
|
|
|
|
|
|
|
3997 |
});
|
3998 |
+
});
|
3999 |
+
return current.bind(function (c) {
|
4000 |
+
return next.map(function (n) {
|
4001 |
+
var extras = n.delta + c.delta;
|
4002 |
+
return Math.abs(n.value - c.value) / extras;
|
|
|
|
|
|
|
|
|
|
|
|
|
4003 |
});
|
4004 |
+
});
|
4005 |
+
};
|
4006 |
+
var $_2pc8lnnzjjgwedrw = {
|
4007 |
+
repeat: repeat,
|
4008 |
+
range: range$1,
|
4009 |
+
unique: unique,
|
4010 |
+
deduce: deduce
|
4011 |
+
};
|
4012 |
+
|
4013 |
+
var columns = function (warehouse) {
|
4014 |
+
var grid = warehouse.grid();
|
4015 |
+
var cols = $_2pc8lnnzjjgwedrw.range(0, grid.columns());
|
4016 |
+
var rows = $_2pc8lnnzjjgwedrw.range(0, grid.rows());
|
4017 |
+
return map(cols, function (col) {
|
4018 |
+
var getBlock = function () {
|
4019 |
+
return bind(rows, function (r) {
|
4020 |
+
return $_eesv8pmajjgwedcx.getAt(warehouse, r, col).filter(function (detail) {
|
4021 |
+
return detail.column() === col;
|
4022 |
+
}).fold(constant([]), function (detail) {
|
4023 |
+
return [detail];
|
4024 |
+
});
|
4025 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4026 |
};
|
4027 |
+
var isSingle = function (detail) {
|
4028 |
+
return detail.colspan() === 1;
|
4029 |
+
};
|
4030 |
+
var getFallback = function () {
|
4031 |
+
return $_eesv8pmajjgwedcx.getAt(warehouse, 0, col);
|
4032 |
+
};
|
4033 |
+
return decide(getBlock, isSingle, getFallback);
|
4034 |
+
});
|
4035 |
+
};
|
4036 |
+
var decide = function (getBlock, isSingle, getFallback) {
|
4037 |
+
var inBlock = getBlock();
|
4038 |
+
var singleInBlock = find(inBlock, isSingle);
|
4039 |
+
var detailOption = singleInBlock.orThunk(function () {
|
4040 |
+
return Option.from(inBlock[0]).orThunk(getFallback);
|
4041 |
+
});
|
4042 |
+
return detailOption.map(function (detail) {
|
4043 |
+
return detail.element();
|
4044 |
+
});
|
4045 |
+
};
|
4046 |
+
var rows$1 = function (warehouse) {
|
4047 |
+
var grid = warehouse.grid();
|
4048 |
+
var rows = $_2pc8lnnzjjgwedrw.range(0, grid.rows());
|
4049 |
+
var cols = $_2pc8lnnzjjgwedrw.range(0, grid.columns());
|
4050 |
+
return map(rows, function (row) {
|
4051 |
+
var getBlock = function () {
|
4052 |
+
return bind(cols, function (c) {
|
4053 |
+
return $_eesv8pmajjgwedcx.getAt(warehouse, row, c).filter(function (detail) {
|
4054 |
+
return detail.row() === row;
|
4055 |
+
}).fold(constant([]), function (detail) {
|
4056 |
+
return [detail];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4057 |
});
|
4058 |
});
|
4059 |
+
};
|
4060 |
+
var isSingle = function (detail) {
|
4061 |
+
return detail.rowspan() === 1;
|
4062 |
+
};
|
4063 |
+
var getFallback = function () {
|
4064 |
+
return $_eesv8pmajjgwedcx.getAt(warehouse, row, 0);
|
4065 |
+
};
|
4066 |
+
return decide(getBlock, isSingle, getFallback);
|
4067 |
+
});
|
4068 |
+
};
|
4069 |
+
var $_4xn2lhnyjjgwedrj = {
|
4070 |
+
columns: columns,
|
4071 |
+
rows: rows$1
|
4072 |
+
};
|
4073 |
+
|
4074 |
+
var col = function (column, x, y, w, h) {
|
4075 |
+
var blocker = Element$$1.fromTag('div');
|
4076 |
+
$_59neaymbjjgwedd8.setAll(blocker, {
|
4077 |
+
position: 'absolute',
|
4078 |
+
left: x - w / 2 + 'px',
|
4079 |
+
top: y + 'px',
|
4080 |
+
height: h + 'px',
|
4081 |
+
width: w + 'px'
|
4082 |
+
});
|
4083 |
+
$_72hn9pm2jjgwedbq.setAll(blocker, {
|
4084 |
+
'data-column': column,
|
4085 |
+
'role': 'presentation'
|
4086 |
+
});
|
4087 |
+
return blocker;
|
4088 |
+
};
|
4089 |
+
var row$1 = function (row, x, y, w, h) {
|
4090 |
+
var blocker = Element$$1.fromTag('div');
|
4091 |
+
$_59neaymbjjgwedd8.setAll(blocker, {
|
4092 |
+
position: 'absolute',
|
4093 |
+
left: x + 'px',
|
4094 |
+
top: y - h / 2 + 'px',
|
4095 |
+
height: h + 'px',
|
4096 |
+
width: w + 'px'
|
4097 |
+
});
|
4098 |
+
$_72hn9pm2jjgwedbq.setAll(blocker, {
|
4099 |
+
'data-row': row,
|
4100 |
+
'role': 'presentation'
|
4101 |
+
});
|
4102 |
+
return blocker;
|
4103 |
+
};
|
4104 |
+
var $_4tsfdko0jjgweds5 = {
|
4105 |
+
col: col,
|
4106 |
+
row: row$1
|
4107 |
+
};
|
4108 |
+
|
4109 |
+
var css = function (namespace) {
|
4110 |
+
var dashNamespace = namespace.replace(/\./g, '-');
|
4111 |
+
var resolve = function (str) {
|
4112 |
+
return dashNamespace + '-' + str;
|
4113 |
+
};
|
4114 |
+
return { resolve: resolve };
|
4115 |
+
};
|
4116 |
+
|
4117 |
+
var styles = css('ephox-snooker');
|
4118 |
+
var $_a7mbdxo1jjgwedsc = { resolve: styles.resolve };
|
4119 |
+
|
4120 |
+
function Toggler (turnOff, turnOn, initial) {
|
4121 |
+
var active = initial || false;
|
4122 |
+
var on = function () {
|
4123 |
+
turnOn();
|
4124 |
+
active = true;
|
4125 |
+
};
|
4126 |
+
var off = function () {
|
4127 |
+
turnOff();
|
4128 |
+
active = false;
|
4129 |
+
};
|
4130 |
+
var toggle = function () {
|
4131 |
+
var f = active ? off : on;
|
4132 |
+
f();
|
4133 |
+
};
|
4134 |
+
var isOn = function () {
|
4135 |
+
return active;
|
4136 |
+
};
|
4137 |
+
return {
|
4138 |
+
on: on,
|
4139 |
+
off: off,
|
4140 |
+
toggle: toggle,
|
4141 |
+
isOn: isOn
|
4142 |
+
};
|
4143 |
+
}
|
4144 |
+
|
4145 |
+
var read = function (element, attr) {
|
4146 |
+
var value = $_72hn9pm2jjgwedbq.get(element, attr);
|
4147 |
+
return value === undefined || value === '' ? [] : value.split(' ');
|
4148 |
+
};
|
4149 |
+
var add = function (element, attr, id) {
|
4150 |
+
var old = read(element, attr);
|
4151 |
+
var nu = old.concat([id]);
|
4152 |
+
$_72hn9pm2jjgwedbq.set(element, attr, nu.join(' '));
|
4153 |
+
return true;
|
4154 |
+
};
|
4155 |
+
var remove$3 = function (element, attr, id) {
|
4156 |
+
var nu = filter(read(element, attr), function (v) {
|
4157 |
+
return v !== id;
|
4158 |
+
});
|
4159 |
+
if (nu.length > 0)
|
4160 |
+
$_72hn9pm2jjgwedbq.set(element, attr, nu.join(' '));
|
4161 |
+
else
|
4162 |
+
$_72hn9pm2jjgwedbq.remove(element, attr);
|
4163 |
+
return false;
|
4164 |
+
};
|
4165 |
+
var $_fr3zqno6jjgwedsr = {
|
4166 |
+
read: read,
|
4167 |
+
add: add,
|
4168 |
+
remove: remove$3
|
4169 |
+
};
|
4170 |
+
|
4171 |
+
var supports = function (element) {
|
4172 |
+
return element.dom().classList !== undefined;
|
4173 |
+
};
|
4174 |
+
var get$6 = function (element) {
|
4175 |
+
return $_fr3zqno6jjgwedsr.read(element, 'class');
|
4176 |
+
};
|
4177 |
+
var add$1 = function (element, clazz) {
|
4178 |
+
return $_fr3zqno6jjgwedsr.add(element, 'class', clazz);
|
4179 |
+
};
|
4180 |
+
var remove$4 = function (element, clazz) {
|
4181 |
+
return $_fr3zqno6jjgwedsr.remove(element, 'class', clazz);
|
4182 |
+
};
|
4183 |
+
var toggle = function (element, clazz) {
|
4184 |
+
if (contains(get$6(element), clazz)) {
|
4185 |
+
return remove$4(element, clazz);
|
4186 |
+
} else {
|
4187 |
+
return add$1(element, clazz);
|
4188 |
+
}
|
4189 |
+
};
|
4190 |
+
var $_f1c8m0o5jjgwedsj = {
|
4191 |
+
get: get$6,
|
4192 |
+
add: add$1,
|
4193 |
+
remove: remove$4,
|
4194 |
+
toggle: toggle,
|
4195 |
+
supports: supports
|
4196 |
+
};
|
4197 |
+
|
4198 |
+
var add$2 = function (element, clazz) {
|
4199 |
+
if ($_f1c8m0o5jjgwedsj.supports(element))
|
4200 |
+
element.dom().classList.add(clazz);
|
4201 |
+
else
|
4202 |
+
$_f1c8m0o5jjgwedsj.add(element, clazz);
|
4203 |
+
};
|
4204 |
+
var cleanClass = function (element) {
|
4205 |
+
var classList = $_f1c8m0o5jjgwedsj.supports(element) ? element.dom().classList : $_f1c8m0o5jjgwedsj.get(element);
|
4206 |
+
if (classList.length === 0) {
|
4207 |
+
$_72hn9pm2jjgwedbq.remove(element, 'class');
|
4208 |
+
}
|
4209 |
+
};
|
4210 |
+
var remove$5 = function (element, clazz) {
|
4211 |
+
if ($_f1c8m0o5jjgwedsj.supports(element)) {
|
4212 |
+
var classList = element.dom().classList;
|
4213 |
+
classList.remove(clazz);
|
4214 |
+
} else
|
4215 |
+
$_f1c8m0o5jjgwedsj.remove(element, clazz);
|
4216 |
+
cleanClass(element);
|
4217 |
+
};
|
4218 |
+
var toggle$1 = function (element, clazz) {
|
4219 |
+
return $_f1c8m0o5jjgwedsj.supports(element) ? element.dom().classList.toggle(clazz) : $_f1c8m0o5jjgwedsj.toggle(element, clazz);
|
4220 |
+
};
|
4221 |
+
var toggler = function (element, clazz) {
|
4222 |
+
var hasClasslist = $_f1c8m0o5jjgwedsj.supports(element);
|
4223 |
+
var classList = element.dom().classList;
|
4224 |
+
var off = function () {
|
4225 |
+
if (hasClasslist)
|
4226 |
+
classList.remove(clazz);
|
4227 |
+
else
|
4228 |
+
$_f1c8m0o5jjgwedsj.remove(element, clazz);
|
4229 |
};
|
4230 |
+
var on = function () {
|
4231 |
+
if (hasClasslist)
|
4232 |
+
classList.add(clazz);
|
4233 |
+
else
|
4234 |
+
$_f1c8m0o5jjgwedsj.add(element, clazz);
|
4235 |
+
};
|
4236 |
+
return Toggler(off, on, has$1(element, clazz));
|
4237 |
+
};
|
4238 |
+
var has$1 = function (element, clazz) {
|
4239 |
+
return $_f1c8m0o5jjgwedsj.supports(element) && element.dom().classList.contains(clazz);
|
4240 |
+
};
|
4241 |
+
var $_btizb5o3jjgwedsg = {
|
4242 |
+
add: add$2,
|
4243 |
+
remove: remove$5,
|
4244 |
+
toggle: toggle$1,
|
4245 |
+
toggler: toggler,
|
4246 |
+
has: has$1
|
4247 |
+
};
|
4248 |
+
|
4249 |
+
var resizeBar = $_a7mbdxo1jjgwedsc.resolve('resizer-bar');
|
4250 |
+
var resizeRowBar = $_a7mbdxo1jjgwedsc.resolve('resizer-rows');
|
4251 |
+
var resizeColBar = $_a7mbdxo1jjgwedsc.resolve('resizer-cols');
|
4252 |
+
var BAR_THICKNESS = 7;
|
4253 |
+
var clear = function (wire) {
|
4254 |
+
var previous = $_5ko5j3m4jjgwedc0.descendants(wire.parent(), '.' + resizeBar);
|
4255 |
+
each(previous, $_1y8qodmejjgweddq.remove);
|
4256 |
+
};
|
4257 |
+
var drawBar = function (wire, positions, create) {
|
4258 |
+
var origin = wire.origin();
|
4259 |
+
each(positions, function (cpOption, i) {
|
4260 |
+
cpOption.each(function (cp) {
|
4261 |
+
var bar = create(origin, cp);
|
4262 |
+
$_btizb5o3jjgwedsg.add(bar, resizeBar);
|
4263 |
+
$_1yoqsmmdjjgweddo.append(wire.parent(), bar);
|
4264 |
});
|
4265 |
+
});
|
4266 |
+
};
|
4267 |
+
var refreshCol = function (wire, colPositions, position, tableHeight) {
|
4268 |
+
drawBar(wire, colPositions, function (origin, cp) {
|
4269 |
+
var colBar = $_4tsfdko0jjgweds5.col(cp.col(), cp.x() - origin.left(), position.top() - origin.top(), BAR_THICKNESS, tableHeight);
|
4270 |
+
$_btizb5o3jjgwedsg.add(colBar, resizeColBar);
|
4271 |
+
return colBar;
|
4272 |
+
});
|
4273 |
+
};
|
4274 |
+
var refreshRow = function (wire, rowPositions, position, tableWidth) {
|
4275 |
+
drawBar(wire, rowPositions, function (origin, cp) {
|
4276 |
+
var rowBar = $_4tsfdko0jjgweds5.row(cp.row(), position.left() - origin.left(), cp.y() - origin.top(), tableWidth, BAR_THICKNESS);
|
4277 |
+
$_btizb5o3jjgwedsg.add(rowBar, resizeRowBar);
|
4278 |
+
return rowBar;
|
4279 |
+
});
|
4280 |
+
};
|
4281 |
+
var refreshGrid = function (wire, table, rows, cols, hdirection, vdirection) {
|
4282 |
+
var position = $_emicwtnfjjgwedml.absolute(table);
|
4283 |
+
var rowPositions = rows.length > 0 ? hdirection.positions(rows, table) : [];
|
4284 |
+
refreshRow(wire, rowPositions, position, $_ga29tsnbjjgwedly.getOuter(table));
|
4285 |
+
var colPositions = cols.length > 0 ? vdirection.positions(cols, table) : [];
|
4286 |
+
refreshCol(wire, colPositions, position, $_da9rlin9jjgwedlp.getOuter(table));
|
4287 |
+
};
|
4288 |
+
var refresh = function (wire, table, hdirection, vdirection) {
|
4289 |
+
clear(wire);
|
4290 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
4291 |
+
var warehouse = $_eesv8pmajjgwedcx.generate(list);
|
4292 |
+
var rows = $_4xn2lhnyjjgwedrj.rows(warehouse);
|
4293 |
+
var cols = $_4xn2lhnyjjgwedrj.columns(warehouse);
|
4294 |
+
refreshGrid(wire, table, rows, cols, hdirection, vdirection);
|
4295 |
+
};
|
4296 |
+
var each$2 = function (wire, f) {
|
4297 |
+
var bars = $_5ko5j3m4jjgwedc0.descendants(wire.parent(), '.' + resizeBar);
|
4298 |
+
each(bars, f);
|
4299 |
+
};
|
4300 |
+
var hide = function (wire) {
|
4301 |
+
each$2(wire, function (bar) {
|
4302 |
+
$_59neaymbjjgwedd8.set(bar, 'display', 'none');
|
4303 |
+
});
|
4304 |
+
};
|
4305 |
+
var show = function (wire) {
|
4306 |
+
each$2(wire, function (bar) {
|
4307 |
+
$_59neaymbjjgwedd8.set(bar, 'display', 'block');
|
4308 |
+
});
|
4309 |
+
};
|
4310 |
+
var isRowBar = function (element) {
|
4311 |
+
return $_btizb5o3jjgwedsg.has(element, resizeRowBar);
|
4312 |
+
};
|
4313 |
+
var isColBar = function (element) {
|
4314 |
+
return $_btizb5o3jjgwedsg.has(element, resizeColBar);
|
4315 |
+
};
|
4316 |
+
var $_anyrprnxjjgwedqz = {
|
4317 |
+
refresh: refresh,
|
4318 |
+
hide: hide,
|
4319 |
+
show: show,
|
4320 |
+
destroy: clear,
|
4321 |
+
isRowBar: isRowBar,
|
4322 |
+
isColBar: isColBar
|
4323 |
+
};
|
4324 |
+
|
4325 |
+
var fromWarehouse = function (warehouse, generators) {
|
4326 |
+
return $_7omv2yntjjgwedpr.toGrid(warehouse, generators, false);
|
4327 |
+
};
|
4328 |
+
var deriveRows = function (rendered, generators) {
|
4329 |
+
var findRow = function (details) {
|
4330 |
+
var rowOfCells = findMap(details, function (detail) {
|
4331 |
+
return $_97vsilljjjgwed9v.parent(detail.element()).map(function (row) {
|
4332 |
+
var isNew = $_97vsilljjjgwed9v.parent(row).isNone();
|
4333 |
+
return $_6lasqllcjjgwed80.elementnew(row, isNew);
|
4334 |
});
|
4335 |
});
|
4336 |
+
return rowOfCells.getOrThunk(function () {
|
4337 |
+
return $_6lasqllcjjgwed80.elementnew(generators.row(), true);
|
4338 |
+
});
|
4339 |
};
|
4340 |
+
return map(rendered, function (details) {
|
4341 |
+
var row = findRow(details.details());
|
4342 |
+
return $_6lasqllcjjgwed80.rowdatanew(row.element(), details.details(), details.section(), row.isNew());
|
4343 |
+
});
|
4344 |
+
};
|
4345 |
+
var toDetailList = function (grid, generators) {
|
4346 |
+
var rendered = $_7omv2yntjjgwedpr.toDetails(grid, $_e1yh5slljjgwedae.eq);
|
4347 |
+
return deriveRows(rendered, generators);
|
4348 |
+
};
|
4349 |
+
var findInWarehouse = function (warehouse, element) {
|
4350 |
+
var all = flatten(map(warehouse.all(), function (r) {
|
4351 |
+
return r.cells();
|
4352 |
+
}));
|
4353 |
+
return find(all, function (e) {
|
4354 |
+
return $_e1yh5slljjgwedae.eq(element, e.element());
|
4355 |
+
});
|
4356 |
+
};
|
4357 |
+
var run = function (operation, extract, adjustment, postAction, genWrappers) {
|
4358 |
+
return function (wire, table, target, generators, direction) {
|
4359 |
+
var input = $_da6e59lbjjgwed7r.fromTable(table);
|
4360 |
+
var warehouse = $_eesv8pmajjgwedcx.generate(input);
|
4361 |
+
var output = extract(warehouse, target).map(function (info) {
|
4362 |
+
var model = fromWarehouse(warehouse, generators);
|
4363 |
+
var result = operation(model, info, $_e1yh5slljjgwedae.eq, genWrappers(generators));
|
4364 |
+
var grid = toDetailList(result.grid(), generators);
|
4365 |
+
return {
|
4366 |
+
grid: constant(grid),
|
4367 |
+
cursor: result.cursor
|
4368 |
+
};
|
4369 |
+
});
|
4370 |
+
return output.fold(function () {
|
4371 |
+
return Option.none();
|
4372 |
+
}, function (out) {
|
4373 |
+
var newElements = $_fdgjk7nwjjgwedqb.render(table, out.grid());
|
4374 |
+
adjustment(table, out.grid(), direction);
|
4375 |
+
postAction(table);
|
4376 |
+
$_anyrprnxjjgwedqz.refresh(wire, table, $_fsi6i6nejjgwedm2.height, direction);
|
4377 |
+
return Option.some({
|
4378 |
+
cursor: out.cursor,
|
4379 |
+
newRows: newElements.newRows,
|
4380 |
+
newCells: newElements.newCells
|
4381 |
});
|
4382 |
});
|
4383 |
};
|
4384 |
+
};
|
4385 |
+
var onCell = function (warehouse, target) {
|
4386 |
+
return $_bmlvw1ldjjgwed84.cell(target.element()).bind(function (cell) {
|
4387 |
+
return findInWarehouse(warehouse, cell);
|
4388 |
+
});
|
4389 |
+
};
|
4390 |
+
var onPaste = function (warehouse, target) {
|
4391 |
+
return $_bmlvw1ldjjgwed84.cell(target.element()).bind(function (cell) {
|
4392 |
+
return findInWarehouse(warehouse, cell).map(function (details) {
|
4393 |
+
return merge$1(details, {
|
4394 |
+
generators: target.generators,
|
4395 |
+
clipboard: target.clipboard
|
4396 |
});
|
4397 |
});
|
4398 |
+
});
|
4399 |
+
};
|
4400 |
+
var onPasteRows = function (warehouse, target) {
|
4401 |
+
var details = map(target.selection(), function (cell) {
|
4402 |
+
return $_bmlvw1ldjjgwed84.cell(cell).bind(function (lc) {
|
4403 |
+
return findInWarehouse(warehouse, lc);
|
4404 |
+
});
|
4405 |
+
});
|
4406 |
+
var cells = cat(details);
|
4407 |
+
return cells.length > 0 ? Option.some(merge$1({ cells: cells }, {
|
4408 |
+
generators: target.generators,
|
4409 |
+
clipboard: target.clipboard
|
4410 |
+
})) : Option.none();
|
4411 |
+
};
|
4412 |
+
var onMergable = function (warehouse, target) {
|
4413 |
+
return target.mergable();
|
4414 |
+
};
|
4415 |
+
var onUnmergable = function (warehouse, target) {
|
4416 |
+
return target.unmergable();
|
4417 |
+
};
|
4418 |
+
var onCells = function (warehouse, target) {
|
4419 |
+
var details = map(target.selection(), function (cell) {
|
4420 |
+
return $_bmlvw1ldjjgwed84.cell(cell).bind(function (lc) {
|
4421 |
+
return findInWarehouse(warehouse, lc);
|
4422 |
+
});
|
4423 |
+
});
|
4424 |
+
var cells = cat(details);
|
4425 |
+
return cells.length > 0 ? Option.some(cells) : Option.none();
|
4426 |
+
};
|
4427 |
+
var $_a3xhvcnqjjgwedp4 = {
|
4428 |
+
run: run,
|
4429 |
+
toDetailList: toDetailList,
|
4430 |
+
onCell: onCell,
|
4431 |
+
onCells: onCells,
|
4432 |
+
onPaste: onPaste,
|
4433 |
+
onPasteRows: onPasteRows,
|
4434 |
+
onMergable: onMergable,
|
4435 |
+
onUnmergable: onUnmergable
|
4436 |
+
};
|
4437 |
+
|
4438 |
+
var value$1 = function (o) {
|
4439 |
+
var is = function (v) {
|
4440 |
+
return o === v;
|
4441 |
+
};
|
4442 |
+
var or = function (opt) {
|
4443 |
+
return value$1(o);
|
4444 |
+
};
|
4445 |
+
var orThunk = function (f) {
|
4446 |
+
return value$1(o);
|
4447 |
+
};
|
4448 |
+
var map = function (f) {
|
4449 |
+
return value$1(f(o));
|
4450 |
+
};
|
4451 |
+
var each = function (f) {
|
4452 |
+
f(o);
|
4453 |
+
};
|
4454 |
+
var bind = function (f) {
|
4455 |
+
return f(o);
|
4456 |
+
};
|
4457 |
+
var fold = function (_, onValue) {
|
4458 |
+
return onValue(o);
|
4459 |
+
};
|
4460 |
+
var exists = function (f) {
|
4461 |
+
return f(o);
|
4462 |
+
};
|
4463 |
+
var forall = function (f) {
|
4464 |
+
return f(o);
|
4465 |
+
};
|
4466 |
+
var toOption = function () {
|
4467 |
+
return Option.some(o);
|
4468 |
+
};
|
4469 |
+
return {
|
4470 |
+
is: is,
|
4471 |
+
isValue: always,
|
4472 |
+
isError: never,
|
4473 |
+
getOr: constant(o),
|
4474 |
+
getOrThunk: constant(o),
|
4475 |
+
getOrDie: constant(o),
|
4476 |
+
or: or,
|
4477 |
+
orThunk: orThunk,
|
4478 |
+
fold: fold,
|
4479 |
+
map: map,
|
4480 |
+
each: each,
|
4481 |
+
bind: bind,
|
4482 |
+
exists: exists,
|
4483 |
+
forall: forall,
|
4484 |
+
toOption: toOption
|
4485 |
+
};
|
4486 |
+
};
|
4487 |
+
var error = function (message) {
|
4488 |
+
var getOrThunk = function (f) {
|
4489 |
+
return f();
|
4490 |
};
|
4491 |
+
var getOrDie = function () {
|
4492 |
+
return die(String(message))();
|
|
|
|
|
|
|
4493 |
};
|
4494 |
+
var or = function (opt) {
|
4495 |
+
return opt;
|
|
|
4496 |
};
|
4497 |
+
var orThunk = function (f) {
|
4498 |
+
return f();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4499 |
};
|
4500 |
+
var map = function (f) {
|
4501 |
+
return error(message);
|
4502 |
+
};
|
4503 |
+
var bind = function (f) {
|
4504 |
+
return error(message);
|
4505 |
+
};
|
4506 |
+
var fold = function (onError, _) {
|
4507 |
+
return onError(message);
|
4508 |
+
};
|
4509 |
+
return {
|
4510 |
+
is: never,
|
4511 |
+
isValue: never,
|
4512 |
+
isError: always,
|
4513 |
+
getOr: identity,
|
4514 |
+
getOrThunk: getOrThunk,
|
4515 |
+
getOrDie: getOrDie,
|
4516 |
+
or: or,
|
4517 |
+
orThunk: orThunk,
|
4518 |
+
fold: fold,
|
4519 |
+
map: map,
|
4520 |
+
each: noop,
|
4521 |
+
bind: bind,
|
4522 |
+
exists: never,
|
4523 |
+
forall: always,
|
4524 |
+
toOption: Option.none
|
4525 |
+
};
|
4526 |
+
};
|
4527 |
+
var Result = {
|
4528 |
+
value: value$1,
|
4529 |
+
error: error
|
4530 |
+
};
|
4531 |
+
|
4532 |
+
var measure = function (startAddress, gridA, gridB) {
|
4533 |
+
if (startAddress.row() >= gridA.length || startAddress.column() > $_4q9s6anvjjgwedq7.cellLength(gridA[0]))
|
4534 |
+
return Result.error('invalid start address out of table bounds, row: ' + startAddress.row() + ', column: ' + startAddress.column());
|
4535 |
+
var rowRemainder = gridA.slice(startAddress.row());
|
4536 |
+
var colRemainder = rowRemainder[0].cells().slice(startAddress.column());
|
4537 |
+
var colRequired = $_4q9s6anvjjgwedq7.cellLength(gridB[0]);
|
4538 |
+
var rowRequired = gridB.length;
|
4539 |
+
return Result.value({
|
4540 |
+
rowDelta: constant(rowRemainder.length - rowRequired),
|
4541 |
+
colDelta: constant(colRemainder.length - colRequired)
|
4542 |
+
});
|
4543 |
+
};
|
4544 |
+
var measureWidth = function (gridA, gridB) {
|
4545 |
+
var colLengthA = $_4q9s6anvjjgwedq7.cellLength(gridA[0]);
|
4546 |
+
var colLengthB = $_4q9s6anvjjgwedq7.cellLength(gridB[0]);
|
4547 |
+
return {
|
4548 |
+
rowDelta: constant(0),
|
4549 |
+
colDelta: constant(colLengthA - colLengthB)
|
4550 |
+
};
|
4551 |
+
};
|
4552 |
+
var fill = function (cells, generator) {
|
4553 |
+
return map(cells, function () {
|
4554 |
+
return $_6lasqllcjjgwed80.elementnew(generator.cell(), true);
|
4555 |
+
});
|
4556 |
+
};
|
4557 |
+
var rowFill = function (grid, amount, generator) {
|
4558 |
+
return grid.concat($_2pc8lnnzjjgwedrw.repeat(amount, function (_row) {
|
4559 |
+
return $_4q9s6anvjjgwedq7.setCells(grid[grid.length - 1], fill(grid[grid.length - 1].cells(), generator));
|
4560 |
+
}));
|
4561 |
+
};
|
4562 |
+
var colFill = function (grid, amount, generator) {
|
4563 |
+
return map(grid, function (row) {
|
4564 |
+
return $_4q9s6anvjjgwedq7.setCells(row, row.cells().concat(fill($_2pc8lnnzjjgwedrw.range(0, amount), generator)));
|
4565 |
+
});
|
4566 |
+
};
|
4567 |
+
var tailor = function (gridA, delta, generator) {
|
4568 |
+
var fillCols = delta.colDelta() < 0 ? colFill : identity;
|
4569 |
+
var fillRows = delta.rowDelta() < 0 ? rowFill : identity;
|
4570 |
+
var modifiedCols = fillCols(gridA, Math.abs(delta.colDelta()), generator);
|
4571 |
+
var tailoredGrid = fillRows(modifiedCols, Math.abs(delta.rowDelta()), generator);
|
4572 |
+
return tailoredGrid;
|
4573 |
+
};
|
4574 |
+
var $_cgbpano8jjgwedt3 = {
|
4575 |
+
measure: measure,
|
4576 |
+
measureWidth: measureWidth,
|
4577 |
+
tailor: tailor
|
4578 |
+
};
|
4579 |
+
|
4580 |
+
var merge$2 = function (grid, bounds, comparator, substitution) {
|
4581 |
+
if (grid.length === 0)
|
4582 |
+
return grid;
|
4583 |
+
for (var i = bounds.startRow(); i <= bounds.finishRow(); i++) {
|
4584 |
+
for (var j = bounds.startCol(); j <= bounds.finishCol(); j++) {
|
4585 |
+
$_4q9s6anvjjgwedq7.mutateCell(grid[i], j, $_6lasqllcjjgwed80.elementnew(substitution(), false));
|
4586 |
}
|
4587 |
+
}
|
4588 |
+
return grid;
|
4589 |
+
};
|
4590 |
+
var unmerge = function (grid, target, comparator, substitution) {
|
4591 |
+
var first = true;
|
4592 |
+
for (var i = 0; i < grid.length; i++) {
|
4593 |
+
for (var j = 0; j < $_4q9s6anvjjgwedq7.cellLength(grid[0]); j++) {
|
4594 |
+
var current = $_4q9s6anvjjgwedq7.getCellElement(grid[i], j);
|
4595 |
+
var isToReplace = comparator(current, target);
|
4596 |
+
if (isToReplace === true && first === false) {
|
4597 |
+
$_4q9s6anvjjgwedq7.mutateCell(grid[i], j, $_6lasqllcjjgwed80.elementnew(substitution(), true));
|
4598 |
+
} else if (isToReplace === true) {
|
4599 |
+
first = false;
|
|
|
|
|
4600 |
}
|
4601 |
+
}
|
4602 |
+
}
|
4603 |
+
return grid;
|
4604 |
+
};
|
4605 |
+
var uniqueCells = function (row, comparator) {
|
4606 |
+
return foldl(row, function (rest, cell) {
|
4607 |
+
return exists(rest, function (currentCell) {
|
4608 |
+
return comparator(currentCell.element(), cell.element());
|
4609 |
+
}) ? rest : rest.concat([cell]);
|
4610 |
+
}, []);
|
4611 |
+
};
|
4612 |
+
var splitRows = function (grid, index, comparator, substitution) {
|
4613 |
+
if (index > 0 && index < grid.length) {
|
4614 |
+
var rowPrevCells = grid[index - 1].cells();
|
4615 |
+
var cells = uniqueCells(rowPrevCells, comparator);
|
4616 |
+
each(cells, function (cell) {
|
4617 |
+
var replacement = Option.none();
|
4618 |
+
for (var i = index; i < grid.length; i++) {
|
4619 |
+
for (var j = 0; j < $_4q9s6anvjjgwedq7.cellLength(grid[0]); j++) {
|
4620 |
+
var current = grid[i].cells()[j];
|
4621 |
+
var isToReplace = comparator(current.element(), cell.element());
|
4622 |
+
if (isToReplace) {
|
4623 |
+
if (replacement.isNone()) {
|
4624 |
+
replacement = Option.some(substitution());
|
|
|
4625 |
}
|
4626 |
+
replacement.each(function (sub) {
|
4627 |
+
$_4q9s6anvjjgwedq7.mutateCell(grid[i], j, $_6lasqllcjjgwed80.elementnew(sub, true));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4628 |
});
|
4629 |
}
|
4630 |
+
}
|
4631 |
+
}
|
4632 |
});
|
4633 |
+
}
|
4634 |
+
return grid;
|
4635 |
+
};
|
4636 |
+
var $_g5x9r0oajjgwedtg = {
|
4637 |
+
merge: merge$2,
|
4638 |
+
unmerge: unmerge,
|
4639 |
+
splitRows: splitRows
|
4640 |
+
};
|
4641 |
+
|
4642 |
+
var isSpanning = function (grid, row, col, comparator) {
|
4643 |
+
var candidate = $_4q9s6anvjjgwedq7.getCell(grid[row], col);
|
4644 |
+
var matching = curry(comparator, candidate.element());
|
4645 |
+
var currentRow = grid[row];
|
4646 |
+
return grid.length > 1 && $_4q9s6anvjjgwedq7.cellLength(currentRow) > 1 && (col > 0 && matching($_4q9s6anvjjgwedq7.getCellElement(currentRow, col - 1)) || col < currentRow.length - 1 && matching($_4q9s6anvjjgwedq7.getCellElement(currentRow, col + 1)) || row > 0 && matching($_4q9s6anvjjgwedq7.getCellElement(grid[row - 1], col)) || row < grid.length - 1 && matching($_4q9s6anvjjgwedq7.getCellElement(grid[row + 1], col)));
|
4647 |
+
};
|
4648 |
+
var mergeTables = function (startAddress, gridA, gridB, generator, comparator) {
|
4649 |
+
var startRow = startAddress.row();
|
4650 |
+
var startCol = startAddress.column();
|
4651 |
+
var mergeHeight = gridB.length;
|
4652 |
+
var mergeWidth = $_4q9s6anvjjgwedq7.cellLength(gridB[0]);
|
4653 |
+
var endRow = startRow + mergeHeight;
|
4654 |
+
var endCol = startCol + mergeWidth;
|
4655 |
+
for (var r = startRow; r < endRow; r++) {
|
4656 |
+
for (var c = startCol; c < endCol; c++) {
|
4657 |
+
if (isSpanning(gridA, r, c, comparator)) {
|
4658 |
+
$_g5x9r0oajjgwedtg.unmerge(gridA, $_4q9s6anvjjgwedq7.getCellElement(gridA[r], c), comparator, generator.cell);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4659 |
}
|
4660 |
+
var newCell = $_4q9s6anvjjgwedq7.getCellElement(gridB[r - startRow], c - startCol);
|
4661 |
+
var replacement = generator.replace(newCell);
|
4662 |
+
$_4q9s6anvjjgwedq7.mutateCell(gridA[r], c, $_6lasqllcjjgwed80.elementnew(replacement, true));
|
4663 |
+
}
|
4664 |
+
}
|
4665 |
+
return gridA;
|
4666 |
+
};
|
4667 |
+
var merge$3 = function (startAddress, gridA, gridB, generator, comparator) {
|
4668 |
+
var result = $_cgbpano8jjgwedt3.measure(startAddress, gridA, gridB);
|
4669 |
+
return result.map(function (delta) {
|
4670 |
+
var fittedGrid = $_cgbpano8jjgwedt3.tailor(gridA, delta, generator);
|
4671 |
+
return mergeTables(startAddress, fittedGrid, gridB, generator, comparator);
|
4672 |
+
});
|
4673 |
+
};
|
4674 |
+
var insert = function (index, gridA, gridB, generator, comparator) {
|
4675 |
+
$_g5x9r0oajjgwedtg.splitRows(gridA, index, comparator, generator.cell);
|
4676 |
+
var delta = $_cgbpano8jjgwedt3.measureWidth(gridB, gridA);
|
4677 |
+
var fittedNewGrid = $_cgbpano8jjgwedt3.tailor(gridB, delta, generator);
|
4678 |
+
var secondDelta = $_cgbpano8jjgwedt3.measureWidth(gridA, fittedNewGrid);
|
4679 |
+
var fittedOldGrid = $_cgbpano8jjgwedt3.tailor(gridA, secondDelta, generator);
|
4680 |
+
return fittedOldGrid.slice(0, index).concat(fittedNewGrid).concat(fittedOldGrid.slice(index, fittedOldGrid.length));
|
4681 |
+
};
|
4682 |
+
var $_1gr31eo7jjgwedsx = {
|
4683 |
+
merge: merge$3,
|
4684 |
+
insert: insert
|
4685 |
+
};
|
4686 |
+
|
4687 |
+
var insertRowAt = function (grid, index, example, comparator, substitution) {
|
4688 |
+
var before = grid.slice(0, index);
|
4689 |
+
var after = grid.slice(index);
|
4690 |
+
var between = $_4q9s6anvjjgwedq7.mapCells(grid[example], function (ex, c) {
|
4691 |
+
var withinSpan = index > 0 && index < grid.length && comparator($_4q9s6anvjjgwedq7.getCellElement(grid[index - 1], c), $_4q9s6anvjjgwedq7.getCellElement(grid[index], c));
|
4692 |
+
var ret = withinSpan ? $_4q9s6anvjjgwedq7.getCell(grid[index], c) : $_6lasqllcjjgwed80.elementnew(substitution(ex.element(), comparator), true);
|
4693 |
+
return ret;
|
4694 |
+
});
|
4695 |
+
return before.concat([between]).concat(after);
|
4696 |
+
};
|
4697 |
+
var insertColumnAt = function (grid, index, example, comparator, substitution) {
|
4698 |
+
return map(grid, function (row) {
|
4699 |
+
var withinSpan = index > 0 && index < $_4q9s6anvjjgwedq7.cellLength(row) && comparator($_4q9s6anvjjgwedq7.getCellElement(row, index - 1), $_4q9s6anvjjgwedq7.getCellElement(row, index));
|
4700 |
+
var sub = withinSpan ? $_4q9s6anvjjgwedq7.getCell(row, index) : $_6lasqllcjjgwed80.elementnew(substitution($_4q9s6anvjjgwedq7.getCellElement(row, example), comparator), true);
|
4701 |
+
return $_4q9s6anvjjgwedq7.addCell(row, index, sub);
|
4702 |
+
});
|
4703 |
+
};
|
4704 |
+
var splitCellIntoColumns = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
4705 |
+
var index = exampleCol + 1;
|
4706 |
+
return map(grid, function (row, i) {
|
4707 |
+
var isTargetCell = i === exampleRow;
|
4708 |
+
var sub = isTargetCell ? $_6lasqllcjjgwed80.elementnew(substitution($_4q9s6anvjjgwedq7.getCellElement(row, exampleCol), comparator), true) : $_4q9s6anvjjgwedq7.getCell(row, exampleCol);
|
4709 |
+
return $_4q9s6anvjjgwedq7.addCell(row, index, sub);
|
4710 |
+
});
|
4711 |
+
};
|
4712 |
+
var splitCellIntoRows = function (grid, exampleRow, exampleCol, comparator, substitution) {
|
4713 |
+
var index = exampleRow + 1;
|
4714 |
+
var before = grid.slice(0, index);
|
4715 |
+
var after = grid.slice(index);
|
4716 |
+
var between = $_4q9s6anvjjgwedq7.mapCells(grid[exampleRow], function (ex, i) {
|
4717 |
+
var isTargetCell = i === exampleCol;
|
4718 |
+
return isTargetCell ? $_6lasqllcjjgwed80.elementnew(substitution(ex.element(), comparator), true) : ex;
|
4719 |
+
});
|
4720 |
+
return before.concat([between]).concat(after);
|
4721 |
+
};
|
4722 |
+
var deleteColumnsAt = function (grid, start, finish) {
|
4723 |
+
var rows = map(grid, function (row) {
|
4724 |
+
var cells = row.cells().slice(0, start).concat(row.cells().slice(finish + 1));
|
4725 |
+
return $_6lasqllcjjgwed80.rowcells(cells, row.section());
|
4726 |
+
});
|
4727 |
+
return filter(rows, function (row) {
|
4728 |
+
return row.cells().length > 0;
|
4729 |
+
});
|
4730 |
+
};
|
4731 |
+
var deleteRowsAt = function (grid, start, finish) {
|
4732 |
+
return grid.slice(0, start).concat(grid.slice(finish + 1));
|
4733 |
+
};
|
4734 |
+
var $_6ilb5mobjjgwedtn = {
|
4735 |
+
insertRowAt: insertRowAt,
|
4736 |
+
insertColumnAt: insertColumnAt,
|
4737 |
+
splitCellIntoColumns: splitCellIntoColumns,
|
4738 |
+
splitCellIntoRows: splitCellIntoRows,
|
4739 |
+
deleteRowsAt: deleteRowsAt,
|
4740 |
+
deleteColumnsAt: deleteColumnsAt
|
4741 |
+
};
|
4742 |
+
|
4743 |
+
var replaceIn = function (grid, targets, comparator, substitution) {
|
4744 |
+
var isTarget = function (cell) {
|
4745 |
+
return exists(targets, function (target) {
|
4746 |
+
return comparator(cell.element(), target.element());
|
4747 |
+
});
|
4748 |
+
};
|
4749 |
+
return map(grid, function (row) {
|
4750 |
+
return $_4q9s6anvjjgwedq7.mapCells(row, function (cell) {
|
4751 |
+
return isTarget(cell) ? $_6lasqllcjjgwed80.elementnew(substitution(cell.element(), comparator), true) : cell;
|
4752 |
+
});
|
4753 |
+
});
|
4754 |
+
};
|
4755 |
+
var notStartRow = function (grid, rowIndex, colIndex, comparator) {
|
4756 |
+
return $_4q9s6anvjjgwedq7.getCellElement(grid[rowIndex], colIndex) !== undefined && (rowIndex > 0 && comparator($_4q9s6anvjjgwedq7.getCellElement(grid[rowIndex - 1], colIndex), $_4q9s6anvjjgwedq7.getCellElement(grid[rowIndex], colIndex)));
|
4757 |
+
};
|
4758 |
+
var notStartColumn = function (row, index, comparator) {
|
4759 |
+
return index > 0 && comparator($_4q9s6anvjjgwedq7.getCellElement(row, index - 1), $_4q9s6anvjjgwedq7.getCellElement(row, index));
|
4760 |
+
};
|
4761 |
+
var replaceColumn = function (grid, index, comparator, substitution) {
|
4762 |
+
var targets = bind(grid, function (row, i) {
|
4763 |
+
var alreadyAdded = notStartRow(grid, i, index, comparator) || notStartColumn(row, index, comparator);
|
4764 |
+
return alreadyAdded ? [] : [$_4q9s6anvjjgwedq7.getCell(row, index)];
|
4765 |
+
});
|
4766 |
+
return replaceIn(grid, targets, comparator, substitution);
|
4767 |
+
};
|
4768 |
+
var replaceRow = function (grid, index, comparator, substitution) {
|
4769 |
+
var targetRow = grid[index];
|
4770 |
+
var targets = bind(targetRow.cells(), function (item, i) {
|
4771 |
+
var alreadyAdded = notStartRow(grid, index, i, comparator) || notStartColumn(targetRow, i, comparator);
|
4772 |
+
return alreadyAdded ? [] : [item];
|
4773 |
+
});
|
4774 |
+
return replaceIn(grid, targets, comparator, substitution);
|
4775 |
+
};
|
4776 |
+
var $_a2f8x6ocjjgwedtt = {
|
4777 |
+
replaceColumn: replaceColumn,
|
4778 |
+
replaceRow: replaceRow
|
4779 |
+
};
|
4780 |
+
|
4781 |
+
var none$1 = function () {
|
4782 |
+
return folder(function (n, o, l, m, r) {
|
4783 |
+
return n();
|
4784 |
+
});
|
4785 |
+
};
|
4786 |
+
var only = function (index) {
|
4787 |
+
return folder(function (n, o, l, m, r) {
|
4788 |
+
return o(index);
|
4789 |
+
});
|
4790 |
+
};
|
4791 |
+
var left = function (index, next) {
|
4792 |
+
return folder(function (n, o, l, m, r) {
|
4793 |
+
return l(index, next);
|
4794 |
+
});
|
4795 |
+
};
|
4796 |
+
var middle = function (prev, index, next) {
|
4797 |
+
return folder(function (n, o, l, m, r) {
|
4798 |
+
return m(prev, index, next);
|
4799 |
+
});
|
4800 |
+
};
|
4801 |
+
var right = function (prev, index) {
|
4802 |
+
return folder(function (n, o, l, m, r) {
|
4803 |
+
return r(prev, index);
|
4804 |
+
});
|
4805 |
+
};
|
4806 |
+
var folder = function (fold) {
|
4807 |
+
return { fold: fold };
|
4808 |
+
};
|
4809 |
+
var $_dy5p7gofjjgweduj = {
|
4810 |
+
none: none$1,
|
4811 |
+
only: only,
|
4812 |
+
left: left,
|
4813 |
+
middle: middle,
|
4814 |
+
right: right
|
4815 |
+
};
|
4816 |
+
|
4817 |
+
var neighbours$1 = function (input, index) {
|
4818 |
+
if (input.length === 0)
|
4819 |
+
return $_dy5p7gofjjgweduj.none();
|
4820 |
+
if (input.length === 1)
|
4821 |
+
return $_dy5p7gofjjgweduj.only(0);
|
4822 |
+
if (index === 0)
|
4823 |
+
return $_dy5p7gofjjgweduj.left(0, 1);
|
4824 |
+
if (index === input.length - 1)
|
4825 |
+
return $_dy5p7gofjjgweduj.right(index - 1, index);
|
4826 |
+
if (index > 0 && index < input.length - 1)
|
4827 |
+
return $_dy5p7gofjjgweduj.middle(index - 1, index, index + 1);
|
4828 |
+
return $_dy5p7gofjjgweduj.none();
|
4829 |
+
};
|
4830 |
+
var determine = function (input, column, step, tableSize) {
|
4831 |
+
var result = input.slice(0);
|
4832 |
+
var context = neighbours$1(input, column);
|
4833 |
+
var zero = function (array) {
|
4834 |
+
return map(array, constant(0));
|
4835 |
+
};
|
4836 |
+
var onNone = constant(zero(result));
|
4837 |
+
var onOnly = function (index) {
|
4838 |
+
return tableSize.singleColumnWidth(result[index], step);
|
4839 |
+
};
|
4840 |
+
var onChange = function (index, next) {
|
4841 |
+
if (step >= 0) {
|
4842 |
+
var newNext = Math.max(tableSize.minCellWidth(), result[next] - step);
|
4843 |
+
return zero(result.slice(0, index)).concat([
|
4844 |
+
step,
|
4845 |
+
newNext - result[next]
|
4846 |
+
]).concat(zero(result.slice(next + 1)));
|
4847 |
+
} else {
|
4848 |
+
var newThis = Math.max(tableSize.minCellWidth(), result[index] + step);
|
4849 |
+
var diffx = result[index] - newThis;
|
4850 |
+
return zero(result.slice(0, index)).concat([
|
4851 |
+
newThis - result[index],
|
4852 |
+
diffx
|
4853 |
+
]).concat(zero(result.slice(next + 1)));
|
4854 |
+
}
|
4855 |
};
|
4856 |
+
var onLeft = onChange;
|
4857 |
+
var onMiddle = function (prev, index, next) {
|
4858 |
+
return onChange(index, next);
|
|
|
4859 |
};
|
4860 |
+
var onRight = function (prev, index) {
|
4861 |
+
if (step >= 0) {
|
4862 |
+
return zero(result.slice(0, index)).concat([step]);
|
4863 |
+
} else {
|
4864 |
+
var size = Math.max(tableSize.minCellWidth(), result[index] + step);
|
4865 |
+
return zero(result.slice(0, index)).concat([size - result[index]]);
|
4866 |
+
}
|
4867 |
+
};
|
4868 |
+
return context.fold(onNone, onOnly, onLeft, onMiddle, onRight);
|
4869 |
+
};
|
4870 |
+
var $_5hh8p8oejjgwedub = { determine: determine };
|
4871 |
+
|
4872 |
+
var getSpan$1 = function (cell, type) {
|
4873 |
+
return $_72hn9pm2jjgwedbq.has(cell, type) && parseInt($_72hn9pm2jjgwedbq.get(cell, type), 10) > 1;
|
4874 |
+
};
|
4875 |
+
var hasColspan = function (cell) {
|
4876 |
+
return getSpan$1(cell, 'colspan');
|
4877 |
+
};
|
4878 |
+
var hasRowspan = function (cell) {
|
4879 |
+
return getSpan$1(cell, 'rowspan');
|
4880 |
+
};
|
4881 |
+
var getInt = function (element, property) {
|
4882 |
+
return parseInt($_59neaymbjjgwedd8.get(element, property), 10);
|
4883 |
+
};
|
4884 |
+
var $_6gfmi1ohjjgweduu = {
|
4885 |
+
hasColspan: hasColspan,
|
4886 |
+
hasRowspan: hasRowspan,
|
4887 |
+
minWidth: constant(10),
|
4888 |
+
minHeight: constant(10),
|
4889 |
+
getInt: getInt
|
4890 |
+
};
|
4891 |
+
|
4892 |
+
var getRaw$1 = function (cell, property, getter) {
|
4893 |
+
return $_59neaymbjjgwedd8.getRaw(cell, property).fold(function () {
|
4894 |
+
return getter(cell) + 'px';
|
4895 |
+
}, function (raw) {
|
4896 |
+
return raw;
|
4897 |
+
});
|
4898 |
+
};
|
4899 |
+
var getRawW = function (cell) {
|
4900 |
+
return getRaw$1(cell, 'width', $_b9jva9n7jjgwedkv.getPixelWidth);
|
4901 |
+
};
|
4902 |
+
var getRawH = function (cell) {
|
4903 |
+
return getRaw$1(cell, 'height', $_b9jva9n7jjgwedkv.getHeight);
|
4904 |
+
};
|
4905 |
+
var getWidthFrom = function (warehouse, direction, getWidth, fallback, tableSize) {
|
4906 |
+
var columns = $_4xn2lhnyjjgwedrj.columns(warehouse);
|
4907 |
+
var backups = map(columns, function (cellOption) {
|
4908 |
+
return cellOption.map(direction.edge);
|
4909 |
+
});
|
4910 |
+
return map(columns, function (cellOption, c) {
|
4911 |
+
var columnCell = cellOption.filter(not($_6gfmi1ohjjgweduu.hasColspan));
|
4912 |
+
return columnCell.fold(function () {
|
4913 |
+
var deduced = $_2pc8lnnzjjgwedrw.deduce(backups, c);
|
4914 |
+
return fallback(deduced);
|
4915 |
+
}, function (cell) {
|
4916 |
+
return getWidth(cell, tableSize);
|
4917 |
+
});
|
4918 |
+
});
|
4919 |
+
};
|
4920 |
+
var getDeduced = function (deduced) {
|
4921 |
+
return deduced.map(function (d) {
|
4922 |
+
return d + 'px';
|
4923 |
+
}).getOr('');
|
4924 |
+
};
|
4925 |
+
var getRawWidths = function (warehouse, direction) {
|
4926 |
+
return getWidthFrom(warehouse, direction, getRawW, getDeduced);
|
4927 |
+
};
|
4928 |
+
var getPercentageWidths = function (warehouse, direction, tableSize) {
|
4929 |
+
return getWidthFrom(warehouse, direction, $_b9jva9n7jjgwedkv.getPercentageWidth, function (deduced) {
|
4930 |
+
return deduced.fold(function () {
|
4931 |
+
return tableSize.minCellWidth();
|
4932 |
+
}, function (cellWidth) {
|
4933 |
+
return cellWidth / tableSize.pixelWidth() * 100;
|
4934 |
+
});
|
4935 |
+
}, tableSize);
|
4936 |
+
};
|
4937 |
+
var getPixelWidths = function (warehouse, direction, tableSize) {
|
4938 |
+
return getWidthFrom(warehouse, direction, $_b9jva9n7jjgwedkv.getPixelWidth, function (deduced) {
|
4939 |
+
return deduced.getOrThunk(tableSize.minCellWidth);
|
4940 |
+
}, tableSize);
|
4941 |
+
};
|
4942 |
+
var getHeightFrom = function (warehouse, direction, getHeight, fallback) {
|
4943 |
+
var rows = $_4xn2lhnyjjgwedrj.rows(warehouse);
|
4944 |
+
var backups = map(rows, function (cellOption) {
|
4945 |
+
return cellOption.map(direction.edge);
|
4946 |
+
});
|
4947 |
+
return map(rows, function (cellOption, c) {
|
4948 |
+
var rowCell = cellOption.filter(not($_6gfmi1ohjjgweduu.hasRowspan));
|
4949 |
+
return rowCell.fold(function () {
|
4950 |
+
var deduced = $_2pc8lnnzjjgwedrw.deduce(backups, c);
|
4951 |
+
return fallback(deduced);
|
4952 |
+
}, function (cell) {
|
4953 |
+
return getHeight(cell);
|
4954 |
+
});
|
4955 |
+
});
|
4956 |
+
};
|
4957 |
+
var getPixelHeights = function (warehouse, direction) {
|
4958 |
+
return getHeightFrom(warehouse, direction, $_b9jva9n7jjgwedkv.getHeight, function (deduced) {
|
4959 |
+
return deduced.getOrThunk($_6gfmi1ohjjgweduu.minHeight);
|
4960 |
+
});
|
4961 |
+
};
|
4962 |
+
var getRawHeights = function (warehouse, direction) {
|
4963 |
+
return getHeightFrom(warehouse, direction, getRawH, getDeduced);
|
4964 |
+
};
|
4965 |
+
var $_8hy1x9ogjjgwedul = {
|
4966 |
+
getRawWidths: getRawWidths,
|
4967 |
+
getPixelWidths: getPixelWidths,
|
4968 |
+
getPercentageWidths: getPercentageWidths,
|
4969 |
+
getPixelHeights: getPixelHeights,
|
4970 |
+
getRawHeights: getRawHeights
|
4971 |
+
};
|
4972 |
+
|
4973 |
+
var total = function (start, end, measures) {
|
4974 |
+
var r = 0;
|
4975 |
+
for (var i = start; i < end; i++) {
|
4976 |
+
r += measures[i] !== undefined ? measures[i] : 0;
|
4977 |
+
}
|
4978 |
+
return r;
|
4979 |
+
};
|
4980 |
+
var recalculateWidth = function (warehouse, widths) {
|
4981 |
+
var all = $_eesv8pmajjgwedcx.justCells(warehouse);
|
4982 |
+
return map(all, function (cell) {
|
4983 |
+
var width = total(cell.column(), cell.column() + cell.colspan(), widths);
|
4984 |
return {
|
4985 |
+
element: cell.element,
|
4986 |
+
width: constant(width),
|
4987 |
+
colspan: cell.colspan
|
|
|
4988 |
};
|
4989 |
+
});
|
4990 |
+
};
|
4991 |
+
var recalculateHeight = function (warehouse, heights) {
|
4992 |
+
var all = $_eesv8pmajjgwedcx.justCells(warehouse);
|
4993 |
+
return map(all, function (cell) {
|
4994 |
+
var height = total(cell.row(), cell.row() + cell.rowspan(), heights);
|
4995 |
return {
|
4996 |
+
element: cell.element,
|
4997 |
+
height: constant(height),
|
4998 |
+
rowspan: cell.rowspan
|
|
|
4999 |
};
|
5000 |
+
});
|
5001 |
+
};
|
5002 |
+
var matchRowHeight = function (warehouse, heights) {
|
5003 |
+
return map(warehouse.all(), function (row, i) {
|
|
|
|
|
5004 |
return {
|
5005 |
+
element: row.element,
|
5006 |
+
height: constant(heights[i])
|
|
|
|
|
|
|
|
|
5007 |
};
|
5008 |
+
});
|
5009 |
+
};
|
5010 |
+
var $_1f5uvboijjgwedv1 = {
|
5011 |
+
recalculateWidth: recalculateWidth,
|
5012 |
+
recalculateHeight: recalculateHeight,
|
5013 |
+
matchRowHeight: matchRowHeight
|
5014 |
+
};
|
5015 |
+
|
5016 |
+
var percentageSize = function (width, element) {
|
5017 |
+
var floatWidth = parseFloat(width);
|
5018 |
+
var pixelWidth = $_ga29tsnbjjgwedly.get(element);
|
5019 |
+
var getCellDelta = function (delta) {
|
5020 |
+
return delta / pixelWidth * 100;
|
5021 |
+
};
|
5022 |
+
var singleColumnWidth = function (width, _delta) {
|
5023 |
+
return [100 - width];
|
5024 |
+
};
|
5025 |
+
var minCellWidth = function () {
|
5026 |
+
return $_6gfmi1ohjjgweduu.minWidth() / pixelWidth * 100;
|
5027 |
+
};
|
5028 |
+
var setTableWidth = function (table, _newWidths, delta) {
|
5029 |
+
var total = floatWidth + delta;
|
5030 |
+
$_b9jva9n7jjgwedkv.setPercentageWidth(table, total);
|
5031 |
+
};
|
5032 |
+
return {
|
5033 |
+
width: constant(floatWidth),
|
5034 |
+
pixelWidth: constant(pixelWidth),
|
5035 |
+
getWidths: $_8hy1x9ogjjgwedul.getPercentageWidths,
|
5036 |
+
getCellDelta: getCellDelta,
|
5037 |
+
singleColumnWidth: singleColumnWidth,
|
5038 |
+
minCellWidth: minCellWidth,
|
5039 |
+
setElementWidth: $_b9jva9n7jjgwedkv.setPercentageWidth,
|
5040 |
+
setTableWidth: setTableWidth
|
5041 |
+
};
|
5042 |
+
};
|
5043 |
+
var pixelSize = function (width) {
|
5044 |
+
var intWidth = parseInt(width, 10);
|
5045 |
+
var getCellDelta = identity;
|
5046 |
+
var singleColumnWidth = function (width, delta) {
|
5047 |
+
var newNext = Math.max($_6gfmi1ohjjgweduu.minWidth(), width + delta);
|
5048 |
+
return [newNext - width];
|
5049 |
+
};
|
5050 |
+
var setTableWidth = function (table, newWidths, _delta) {
|
5051 |
+
var total = foldr(newWidths, function (b, a) {
|
5052 |
+
return b + a;
|
5053 |
+
}, 0);
|
5054 |
+
$_b9jva9n7jjgwedkv.setPixelWidth(table, total);
|
5055 |
+
};
|
5056 |
+
return {
|
5057 |
+
width: constant(intWidth),
|
5058 |
+
pixelWidth: constant(intWidth),
|
5059 |
+
getWidths: $_8hy1x9ogjjgwedul.getPixelWidths,
|
5060 |
+
getCellDelta: getCellDelta,
|
5061 |
+
singleColumnWidth: singleColumnWidth,
|
5062 |
+
minCellWidth: $_6gfmi1ohjjgweduu.minWidth,
|
5063 |
+
setElementWidth: $_b9jva9n7jjgwedkv.setPixelWidth,
|
5064 |
+
setTableWidth: setTableWidth
|
5065 |
+
};
|
5066 |
+
};
|
5067 |
+
var chooseSize = function (element, width) {
|
5068 |
+
if ($_b9jva9n7jjgwedkv.percentageBasedSizeRegex().test(width)) {
|
5069 |
+
var percentMatch = $_b9jva9n7jjgwedkv.percentageBasedSizeRegex().exec(width);
|
5070 |
+
return percentageSize(percentMatch[1], element);
|
5071 |
+
} else if ($_b9jva9n7jjgwedkv.pixelBasedSizeRegex().test(width)) {
|
5072 |
+
var pixelMatch = $_b9jva9n7jjgwedkv.pixelBasedSizeRegex().exec(width);
|
5073 |
+
return pixelSize(pixelMatch[1]);
|
5074 |
+
} else {
|
5075 |
+
var fallbackWidth = $_ga29tsnbjjgwedly.get(element);
|
5076 |
+
return pixelSize(fallbackWidth);
|
5077 |
+
}
|
5078 |
+
};
|
5079 |
+
var getTableSize = function (element) {
|
5080 |
+
var width = $_b9jva9n7jjgwedkv.getRawWidth(element);
|
5081 |
+
return width.fold(function () {
|
5082 |
+
var fallbackWidth = $_ga29tsnbjjgwedly.get(element);
|
5083 |
+
return pixelSize(fallbackWidth);
|
5084 |
+
}, function (width) {
|
5085 |
+
return chooseSize(element, width);
|
5086 |
+
});
|
5087 |
+
};
|
5088 |
+
var $_6si1ajojjjgwedv7 = { getTableSize: getTableSize };
|
5089 |
+
|
5090 |
+
var getWarehouse$1 = function (list) {
|
5091 |
+
return $_eesv8pmajjgwedcx.generate(list);
|
5092 |
+
};
|
5093 |
+
var sumUp = function (newSize) {
|
5094 |
+
return foldr(newSize, function (b, a) {
|
5095 |
+
return b + a;
|
5096 |
+
}, 0);
|
5097 |
+
};
|
5098 |
+
var getTableWarehouse = function (table) {
|
5099 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
5100 |
+
return getWarehouse$1(list);
|
5101 |
+
};
|
5102 |
+
var adjustWidth = function (table, delta, index, direction) {
|
5103 |
+
var tableSize = $_6si1ajojjjgwedv7.getTableSize(table);
|
5104 |
+
var step = tableSize.getCellDelta(delta);
|
5105 |
+
var warehouse = getTableWarehouse(table);
|
5106 |
+
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
5107 |
+
var deltas = $_5hh8p8oejjgwedub.determine(widths, index, step, tableSize);
|
5108 |
+
var newWidths = map(deltas, function (dx, i) {
|
5109 |
+
return dx + widths[i];
|
5110 |
+
});
|
5111 |
+
var newSizes = $_1f5uvboijjgwedv1.recalculateWidth(warehouse, newWidths);
|
5112 |
+
each(newSizes, function (cell) {
|
5113 |
+
tableSize.setElementWidth(cell.element(), cell.width());
|
5114 |
+
});
|
5115 |
+
if (index === warehouse.grid().columns() - 1) {
|
5116 |
+
tableSize.setTableWidth(table, newWidths, step);
|
5117 |
+
}
|
5118 |
+
};
|
5119 |
+
var adjustHeight = function (table, delta, index, direction) {
|
5120 |
+
var warehouse = getTableWarehouse(table);
|
5121 |
+
var heights = $_8hy1x9ogjjgwedul.getPixelHeights(warehouse, direction);
|
5122 |
+
var newHeights = map(heights, function (dy, i) {
|
5123 |
+
return index === i ? Math.max(delta + dy, $_6gfmi1ohjjgweduu.minHeight()) : dy;
|
5124 |
+
});
|
5125 |
+
var newCellSizes = $_1f5uvboijjgwedv1.recalculateHeight(warehouse, newHeights);
|
5126 |
+
var newRowSizes = $_1f5uvboijjgwedv1.matchRowHeight(warehouse, newHeights);
|
5127 |
+
each(newRowSizes, function (row) {
|
5128 |
+
$_b9jva9n7jjgwedkv.setHeight(row.element(), row.height());
|
5129 |
+
});
|
5130 |
+
each(newCellSizes, function (cell) {
|
5131 |
+
$_b9jva9n7jjgwedkv.setHeight(cell.element(), cell.height());
|
5132 |
+
});
|
5133 |
+
var total = sumUp(newHeights);
|
5134 |
+
$_b9jva9n7jjgwedkv.setHeight(table, total);
|
5135 |
+
};
|
5136 |
+
var adjustWidthTo = function (table, list, direction) {
|
5137 |
+
var tableSize = $_6si1ajojjjgwedv7.getTableSize(table);
|
5138 |
+
var warehouse = getWarehouse$1(list);
|
5139 |
+
var widths = tableSize.getWidths(warehouse, direction, tableSize);
|
5140 |
+
var newSizes = $_1f5uvboijjgwedv1.recalculateWidth(warehouse, widths);
|
5141 |
+
each(newSizes, function (cell) {
|
5142 |
+
tableSize.setElementWidth(cell.element(), cell.width());
|
5143 |
+
});
|
5144 |
+
var total = foldr(widths, function (b, a) {
|
5145 |
+
return a + b;
|
5146 |
+
}, 0);
|
5147 |
+
if (newSizes.length > 0) {
|
5148 |
+
tableSize.setElementWidth(table, total);
|
5149 |
+
}
|
5150 |
+
};
|
5151 |
+
var $_5zl29zodjjgwedu6 = {
|
5152 |
+
adjustWidth: adjustWidth,
|
5153 |
+
adjustHeight: adjustHeight,
|
5154 |
+
adjustWidthTo: adjustWidthTo
|
5155 |
+
};
|
5156 |
+
|
5157 |
+
var prune = function (table) {
|
5158 |
+
var cells = $_bmlvw1ldjjgwed84.cells(table);
|
5159 |
+
if (cells.length === 0)
|
5160 |
+
$_1y8qodmejjgweddq.remove(table);
|
5161 |
+
};
|
5162 |
+
var outcome = Immutable('grid', 'cursor');
|
5163 |
+
var elementFromGrid = function (grid, row, column) {
|
5164 |
+
return findIn(grid, row, column).orThunk(function () {
|
5165 |
+
return findIn(grid, 0, 0);
|
5166 |
+
});
|
5167 |
+
};
|
5168 |
+
var findIn = function (grid, row, column) {
|
5169 |
+
return Option.from(grid[row]).bind(function (r) {
|
5170 |
+
return Option.from(r.cells()[column]).bind(function (c) {
|
5171 |
+
return Option.from(c.element());
|
5172 |
});
|
5173 |
+
});
|
5174 |
+
};
|
5175 |
+
var bundle = function (grid, row, column) {
|
5176 |
+
return outcome(grid, findIn(grid, row, column));
|
5177 |
+
};
|
5178 |
+
var uniqueRows = function (details) {
|
5179 |
+
return foldl(details, function (rest, detail) {
|
5180 |
+
return exists(rest, function (currentDetail) {
|
5181 |
+
return currentDetail.row() === detail.row();
|
5182 |
+
}) ? rest : rest.concat([detail]);
|
5183 |
+
}, []).sort(function (detailA, detailB) {
|
5184 |
+
return detailA.row() - detailB.row();
|
5185 |
+
});
|
5186 |
+
};
|
5187 |
+
var uniqueColumns = function (details) {
|
5188 |
+
return foldl(details, function (rest, detail) {
|
5189 |
+
return exists(rest, function (currentDetail) {
|
5190 |
+
return currentDetail.column() === detail.column();
|
5191 |
+
}) ? rest : rest.concat([detail]);
|
5192 |
+
}, []).sort(function (detailA, detailB) {
|
5193 |
+
return detailA.column() - detailB.column();
|
5194 |
+
});
|
5195 |
+
};
|
5196 |
+
var insertRowBefore = function (grid, detail, comparator, genWrappers) {
|
5197 |
+
var example = detail.row();
|
5198 |
+
var targetIndex = detail.row();
|
5199 |
+
var newGrid = $_6ilb5mobjjgwedtn.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5200 |
+
return bundle(newGrid, targetIndex, detail.column());
|
5201 |
+
};
|
5202 |
+
var insertRowsBefore = function (grid, details, comparator, genWrappers) {
|
5203 |
+
var example = details[0].row();
|
5204 |
+
var targetIndex = details[0].row();
|
5205 |
+
var rows = uniqueRows(details);
|
5206 |
+
var newGrid = foldl(rows, function (newGrid, _row) {
|
5207 |
+
return $_6ilb5mobjjgwedtn.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5208 |
+
}, grid);
|
5209 |
+
return bundle(newGrid, targetIndex, details[0].column());
|
5210 |
+
};
|
5211 |
+
var insertRowAfter = function (grid, detail, comparator, genWrappers) {
|
5212 |
+
var example = detail.row();
|
5213 |
+
var targetIndex = detail.row() + detail.rowspan();
|
5214 |
+
var newGrid = $_6ilb5mobjjgwedtn.insertRowAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5215 |
+
return bundle(newGrid, targetIndex, detail.column());
|
5216 |
+
};
|
5217 |
+
var insertRowsAfter = function (grid, details, comparator, genWrappers) {
|
5218 |
+
var rows = uniqueRows(details);
|
5219 |
+
var example = rows[rows.length - 1].row();
|
5220 |
+
var targetIndex = rows[rows.length - 1].row() + rows[rows.length - 1].rowspan();
|
5221 |
+
var newGrid = foldl(rows, function (newGrid, _row) {
|
5222 |
+
return $_6ilb5mobjjgwedtn.insertRowAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5223 |
+
}, grid);
|
5224 |
+
return bundle(newGrid, targetIndex, details[0].column());
|
5225 |
+
};
|
5226 |
+
var insertColumnBefore = function (grid, detail, comparator, genWrappers) {
|
5227 |
+
var example = detail.column();
|
5228 |
+
var targetIndex = detail.column();
|
5229 |
+
var newGrid = $_6ilb5mobjjgwedtn.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5230 |
+
return bundle(newGrid, detail.row(), targetIndex);
|
5231 |
+
};
|
5232 |
+
var insertColumnsBefore = function (grid, details, comparator, genWrappers) {
|
5233 |
+
var columns = uniqueColumns(details);
|
5234 |
+
var example = columns[0].column();
|
5235 |
+
var targetIndex = columns[0].column();
|
5236 |
+
var newGrid = foldl(columns, function (newGrid, _row) {
|
5237 |
+
return $_6ilb5mobjjgwedtn.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5238 |
+
}, grid);
|
5239 |
+
return bundle(newGrid, details[0].row(), targetIndex);
|
5240 |
+
};
|
5241 |
+
var insertColumnAfter = function (grid, detail, comparator, genWrappers) {
|
5242 |
+
var example = detail.column();
|
5243 |
+
var targetIndex = detail.column() + detail.colspan();
|
5244 |
+
var newGrid = $_6ilb5mobjjgwedtn.insertColumnAt(grid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5245 |
+
return bundle(newGrid, detail.row(), targetIndex);
|
5246 |
+
};
|
5247 |
+
var insertColumnsAfter = function (grid, details, comparator, genWrappers) {
|
5248 |
+
var example = details[details.length - 1].column();
|
5249 |
+
var targetIndex = details[details.length - 1].column() + details[details.length - 1].colspan();
|
5250 |
+
var columns = uniqueColumns(details);
|
5251 |
+
var newGrid = foldl(columns, function (newGrid, _row) {
|
5252 |
+
return $_6ilb5mobjjgwedtn.insertColumnAt(newGrid, targetIndex, example, comparator, genWrappers.getOrInit);
|
5253 |
+
}, grid);
|
5254 |
+
return bundle(newGrid, details[0].row(), targetIndex);
|
5255 |
+
};
|
5256 |
+
var makeRowHeader = function (grid, detail, comparator, genWrappers) {
|
5257 |
+
var newGrid = $_a2f8x6ocjjgwedtt.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
5258 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5259 |
+
};
|
5260 |
+
var makeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
5261 |
+
var newGrid = $_a2f8x6ocjjgwedtt.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
5262 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5263 |
+
};
|
5264 |
+
var unmakeRowHeader = function (grid, detail, comparator, genWrappers) {
|
5265 |
+
var newGrid = $_a2f8x6ocjjgwedtt.replaceRow(grid, detail.row(), comparator, genWrappers.replaceOrInit);
|
5266 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5267 |
+
};
|
5268 |
+
var unmakeColumnHeader = function (grid, detail, comparator, genWrappers) {
|
5269 |
+
var newGrid = $_a2f8x6ocjjgwedtt.replaceColumn(grid, detail.column(), comparator, genWrappers.replaceOrInit);
|
5270 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5271 |
+
};
|
5272 |
+
var splitCellIntoColumns$1 = function (grid, detail, comparator, genWrappers) {
|
5273 |
+
var newGrid = $_6ilb5mobjjgwedtn.splitCellIntoColumns(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
5274 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5275 |
+
};
|
5276 |
+
var splitCellIntoRows$1 = function (grid, detail, comparator, genWrappers) {
|
5277 |
+
var newGrid = $_6ilb5mobjjgwedtn.splitCellIntoRows(grid, detail.row(), detail.column(), comparator, genWrappers.getOrInit);
|
5278 |
+
return bundle(newGrid, detail.row(), detail.column());
|
5279 |
+
};
|
5280 |
+
var eraseColumns = function (grid, details, comparator, _genWrappers) {
|
5281 |
+
var columns = uniqueColumns(details);
|
5282 |
+
var newGrid = $_6ilb5mobjjgwedtn.deleteColumnsAt(grid, columns[0].column(), columns[columns.length - 1].column());
|
5283 |
+
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
5284 |
+
return outcome(newGrid, cursor);
|
5285 |
+
};
|
5286 |
+
var eraseRows = function (grid, details, comparator, _genWrappers) {
|
5287 |
+
var rows = uniqueRows(details);
|
5288 |
+
var newGrid = $_6ilb5mobjjgwedtn.deleteRowsAt(grid, rows[0].row(), rows[rows.length - 1].row());
|
5289 |
+
var cursor = elementFromGrid(newGrid, details[0].row(), details[0].column());
|
5290 |
+
return outcome(newGrid, cursor);
|
5291 |
+
};
|
5292 |
+
var mergeCells = function (grid, mergable, comparator, _genWrappers) {
|
5293 |
+
var cells = mergable.cells();
|
5294 |
+
$_bbrz1bnnjjgwedo6.merge(cells);
|
5295 |
+
var newGrid = $_g5x9r0oajjgwedtg.merge(grid, mergable.bounds(), comparator, constant(cells[0]));
|
5296 |
+
return outcome(newGrid, Option.from(cells[0]));
|
5297 |
+
};
|
5298 |
+
var unmergeCells = function (grid, unmergable, comparator, genWrappers) {
|
5299 |
+
var newGrid = foldr(unmergable, function (b, cell) {
|
5300 |
+
return $_g5x9r0oajjgwedtg.unmerge(b, cell, comparator, genWrappers.combine(cell));
|
5301 |
+
}, grid);
|
5302 |
+
return outcome(newGrid, Option.from(unmergable[0]));
|
5303 |
+
};
|
5304 |
+
var pasteCells = function (grid, pasteDetails, comparator, genWrappers) {
|
5305 |
+
var gridify = function (table, generators) {
|
5306 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
5307 |
+
var wh = $_eesv8pmajjgwedcx.generate(list);
|
5308 |
+
return $_7omv2yntjjgwedpr.toGrid(wh, generators, true);
|
5309 |
+
};
|
5310 |
+
var gridB = gridify(pasteDetails.clipboard(), pasteDetails.generators());
|
5311 |
+
var startAddress = $_6lasqllcjjgwed80.address(pasteDetails.row(), pasteDetails.column());
|
5312 |
+
var mergedGrid = $_1gr31eo7jjgwedsx.merge(startAddress, grid, gridB, pasteDetails.generators(), comparator);
|
5313 |
+
return mergedGrid.fold(function () {
|
5314 |
+
return outcome(grid, Option.some(pasteDetails.element()));
|
5315 |
+
}, function (nuGrid) {
|
5316 |
+
var cursor = elementFromGrid(nuGrid, pasteDetails.row(), pasteDetails.column());
|
5317 |
+
return outcome(nuGrid, cursor);
|
5318 |
+
});
|
5319 |
+
};
|
5320 |
+
var gridifyRows = function (rows, generators, example) {
|
5321 |
+
var pasteDetails = $_da6e59lbjjgwed7r.fromPastedRows(rows, example);
|
5322 |
+
var wh = $_eesv8pmajjgwedcx.generate(pasteDetails);
|
5323 |
+
return $_7omv2yntjjgwedpr.toGrid(wh, generators, true);
|
5324 |
+
};
|
5325 |
+
var pasteRowsBefore = function (grid, pasteDetails, comparator, genWrappers) {
|
5326 |
+
var example = grid[pasteDetails.cells[0].row()];
|
5327 |
+
var index = pasteDetails.cells[0].row();
|
5328 |
+
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
5329 |
+
var mergedGrid = $_1gr31eo7jjgwedsx.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
5330 |
+
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
5331 |
+
return outcome(mergedGrid, cursor);
|
5332 |
+
};
|
5333 |
+
var pasteRowsAfter = function (grid, pasteDetails, comparator, genWrappers) {
|
5334 |
+
var example = grid[pasteDetails.cells[0].row()];
|
5335 |
+
var index = pasteDetails.cells[pasteDetails.cells.length - 1].row() + pasteDetails.cells[pasteDetails.cells.length - 1].rowspan();
|
5336 |
+
var gridB = gridifyRows(pasteDetails.clipboard(), pasteDetails.generators(), example);
|
5337 |
+
var mergedGrid = $_1gr31eo7jjgwedsx.insert(index, grid, gridB, pasteDetails.generators(), comparator);
|
5338 |
+
var cursor = elementFromGrid(mergedGrid, pasteDetails.cells[0].row(), pasteDetails.cells[0].column());
|
5339 |
+
return outcome(mergedGrid, cursor);
|
5340 |
+
};
|
5341 |
+
var resize = $_5zl29zodjjgwedu6.adjustWidthTo;
|
5342 |
+
var $_1evrpxnjjjgwedmy = {
|
5343 |
+
insertRowBefore: $_a3xhvcnqjjgwedp4.run(insertRowBefore, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5344 |
+
insertRowsBefore: $_a3xhvcnqjjgwedp4.run(insertRowsBefore, $_a3xhvcnqjjgwedp4.onCells, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5345 |
+
insertRowAfter: $_a3xhvcnqjjgwedp4.run(insertRowAfter, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5346 |
+
insertRowsAfter: $_a3xhvcnqjjgwedp4.run(insertRowsAfter, $_a3xhvcnqjjgwedp4.onCells, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5347 |
+
insertColumnBefore: $_a3xhvcnqjjgwedp4.run(insertColumnBefore, $_a3xhvcnqjjgwedp4.onCell, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5348 |
+
insertColumnsBefore: $_a3xhvcnqjjgwedp4.run(insertColumnsBefore, $_a3xhvcnqjjgwedp4.onCells, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5349 |
+
insertColumnAfter: $_a3xhvcnqjjgwedp4.run(insertColumnAfter, $_a3xhvcnqjjgwedp4.onCell, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5350 |
+
insertColumnsAfter: $_a3xhvcnqjjgwedp4.run(insertColumnsAfter, $_a3xhvcnqjjgwedp4.onCells, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5351 |
+
splitCellIntoColumns: $_a3xhvcnqjjgwedp4.run(splitCellIntoColumns$1, $_a3xhvcnqjjgwedp4.onCell, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5352 |
+
splitCellIntoRows: $_a3xhvcnqjjgwedp4.run(splitCellIntoRows$1, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5353 |
+
eraseColumns: $_a3xhvcnqjjgwedp4.run(eraseColumns, $_a3xhvcnqjjgwedp4.onCells, resize, prune, $_5kytwlnkjjgwednf.modification),
|
5354 |
+
eraseRows: $_a3xhvcnqjjgwedp4.run(eraseRows, $_a3xhvcnqjjgwedp4.onCells, noop, prune, $_5kytwlnkjjgwednf.modification),
|
5355 |
+
makeColumnHeader: $_a3xhvcnqjjgwedp4.run(makeColumnHeader, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.transform('row', 'th')),
|
5356 |
+
unmakeColumnHeader: $_a3xhvcnqjjgwedp4.run(unmakeColumnHeader, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.transform(null, 'td')),
|
5357 |
+
makeRowHeader: $_a3xhvcnqjjgwedp4.run(makeRowHeader, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.transform('col', 'th')),
|
5358 |
+
unmakeRowHeader: $_a3xhvcnqjjgwedp4.run(unmakeRowHeader, $_a3xhvcnqjjgwedp4.onCell, noop, noop, $_5kytwlnkjjgwednf.transform(null, 'td')),
|
5359 |
+
mergeCells: $_a3xhvcnqjjgwedp4.run(mergeCells, $_a3xhvcnqjjgwedp4.onMergable, noop, noop, $_5kytwlnkjjgwednf.merging),
|
5360 |
+
unmergeCells: $_a3xhvcnqjjgwedp4.run(unmergeCells, $_a3xhvcnqjjgwedp4.onUnmergable, resize, noop, $_5kytwlnkjjgwednf.merging),
|
5361 |
+
pasteCells: $_a3xhvcnqjjgwedp4.run(pasteCells, $_a3xhvcnqjjgwedp4.onPaste, resize, noop, $_5kytwlnkjjgwednf.modification),
|
5362 |
+
pasteRowsBefore: $_a3xhvcnqjjgwedp4.run(pasteRowsBefore, $_a3xhvcnqjjgwedp4.onPasteRows, noop, noop, $_5kytwlnkjjgwednf.modification),
|
5363 |
+
pasteRowsAfter: $_a3xhvcnqjjgwedp4.run(pasteRowsAfter, $_a3xhvcnqjjgwedp4.onPasteRows, noop, noop, $_5kytwlnkjjgwednf.modification)
|
5364 |
+
};
|
5365 |
+
|
5366 |
+
var getBody$1 = function (editor) {
|
5367 |
+
return Element$$1.fromDom(editor.getBody());
|
5368 |
+
};
|
5369 |
+
var getPixelWidth$1 = function (elm) {
|
5370 |
+
return elm.getBoundingClientRect().width;
|
5371 |
+
};
|
5372 |
+
var getPixelHeight = function (elm) {
|
5373 |
+
return elm.getBoundingClientRect().height;
|
5374 |
+
};
|
5375 |
+
var getIsRoot = function (editor) {
|
5376 |
+
return function (element) {
|
5377 |
+
return $_e1yh5slljjgwedae.eq(element, getBody$1(editor));
|
5378 |
+
};
|
5379 |
+
};
|
5380 |
+
var removePxSuffix = function (size) {
|
5381 |
+
return size ? size.replace(/px$/, '') : '';
|
5382 |
+
};
|
5383 |
+
var addSizeSuffix = function (size) {
|
5384 |
+
if (/^[0-9]+$/.test(size)) {
|
5385 |
+
size += 'px';
|
5386 |
+
}
|
5387 |
+
return size;
|
5388 |
+
};
|
5389 |
+
var removeDataStyle = function (table) {
|
5390 |
+
var dataStyleCells = $_5ko5j3m4jjgwedc0.descendants(table, 'td[data-mce-style],th[data-mce-style]');
|
5391 |
+
$_72hn9pm2jjgwedbq.remove(table, 'data-mce-style');
|
5392 |
+
each(dataStyleCells, function (cell) {
|
5393 |
+
$_72hn9pm2jjgwedbq.remove(cell, 'data-mce-style');
|
5394 |
+
});
|
5395 |
+
};
|
5396 |
+
|
5397 |
+
var onDirection = function (isLtr, isRtl) {
|
5398 |
+
return function (element) {
|
5399 |
+
return getDirection(element) === 'rtl' ? isRtl : isLtr;
|
5400 |
+
};
|
5401 |
+
};
|
5402 |
+
var getDirection = function (element) {
|
5403 |
+
return $_59neaymbjjgwedd8.get(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';
|
5404 |
+
};
|
5405 |
+
var $_1xze07omjjgwedvt = {
|
5406 |
+
onDirection: onDirection,
|
5407 |
+
getDirection: getDirection
|
5408 |
+
};
|
5409 |
+
|
5410 |
+
var ltr$1 = { isRtl: constant(false) };
|
5411 |
+
var rtl$1 = { isRtl: constant(true) };
|
5412 |
+
var directionAt = function (element) {
|
5413 |
+
var dir = $_1xze07omjjgwedvt.getDirection(element);
|
5414 |
+
return dir === 'rtl' ? rtl$1 : ltr$1;
|
5415 |
+
};
|
5416 |
+
var $_dowdxdoljjgwedvp = { directionAt: directionAt };
|
5417 |
+
|
5418 |
+
var defaultTableToolbar = [
|
5419 |
+
'tableprops',
|
5420 |
+
'tabledelete',
|
5421 |
+
'|',
|
5422 |
+
'tableinsertrowbefore',
|
5423 |
+
'tableinsertrowafter',
|
5424 |
+
'tabledeleterow',
|
5425 |
+
'|',
|
5426 |
+
'tableinsertcolbefore',
|
5427 |
+
'tableinsertcolafter',
|
5428 |
+
'tabledeletecol'
|
5429 |
+
];
|
5430 |
+
var defaultStyles = {
|
5431 |
+
'border-collapse': 'collapse',
|
5432 |
+
'width': '100%'
|
5433 |
+
};
|
5434 |
+
var defaultAttributes = { border: '1' };
|
5435 |
+
var getDefaultAttributes = function (editor) {
|
5436 |
+
return editor.getParam('table_default_attributes', defaultAttributes, 'object');
|
5437 |
+
};
|
5438 |
+
var getDefaultStyles = function (editor) {
|
5439 |
+
return editor.getParam('table_default_styles', defaultStyles, 'object');
|
5440 |
+
};
|
5441 |
+
var hasTableResizeBars = function (editor) {
|
5442 |
+
return editor.getParam('table_resize_bars', true, 'boolean');
|
5443 |
+
};
|
5444 |
+
var hasTabNavigation = function (editor) {
|
5445 |
+
return editor.getParam('table_tab_navigation', true, 'boolean');
|
5446 |
+
};
|
5447 |
+
var hasAdvancedCellTab = function (editor) {
|
5448 |
+
return editor.getParam('table_cell_advtab', true, 'boolean');
|
5449 |
+
};
|
5450 |
+
var hasAdvancedRowTab = function (editor) {
|
5451 |
+
return editor.getParam('table_row_advtab', true, 'boolean');
|
5452 |
+
};
|
5453 |
+
var hasAdvancedTableTab = function (editor) {
|
5454 |
+
return editor.getParam('table_advtab', true, 'boolean');
|
5455 |
+
};
|
5456 |
+
var hasAppearanceOptions = function (editor) {
|
5457 |
+
return editor.getParam('table_appearance_options', true, 'boolean');
|
5458 |
+
};
|
5459 |
+
var hasTableGrid = function (editor) {
|
5460 |
+
return editor.getParam('table_grid', true, 'boolean');
|
5461 |
+
};
|
5462 |
+
var shouldStyleWithCss = function (editor) {
|
5463 |
+
return editor.getParam('table_style_by_css', false, 'boolean');
|
5464 |
+
};
|
5465 |
+
var getCellClassList = function (editor) {
|
5466 |
+
return editor.getParam('table_cell_class_list', [], 'array');
|
5467 |
+
};
|
5468 |
+
var getRowClassList = function (editor) {
|
5469 |
+
return editor.getParam('table_row_class_list', [], 'array');
|
5470 |
+
};
|
5471 |
+
var getTableClassList = function (editor) {
|
5472 |
+
return editor.getParam('table_class_list', [], 'array');
|
5473 |
+
};
|
5474 |
+
var getColorPickerCallback = function (editor) {
|
5475 |
+
return editor.getParam('color_picker_callback');
|
5476 |
+
};
|
5477 |
+
var isPixelsForced = function (editor) {
|
5478 |
+
return editor.getParam('table_responsive_width') === false;
|
5479 |
+
};
|
5480 |
+
var getCloneElements = function (editor) {
|
5481 |
+
var cloneElements = editor.getParam('table_clone_elements');
|
5482 |
+
if (isString(cloneElements)) {
|
5483 |
+
return Option.some(cloneElements.split(/[ ,]/));
|
5484 |
+
} else if (Array.isArray(cloneElements)) {
|
5485 |
+
return Option.some(cloneElements);
|
5486 |
+
} else {
|
5487 |
+
return Option.none();
|
5488 |
+
}
|
5489 |
+
};
|
5490 |
+
var hasObjectResizing = function (editor) {
|
5491 |
+
var objectResizing = editor.getParam('object_resizing', true);
|
5492 |
+
return objectResizing === 'table' || objectResizing;
|
5493 |
+
};
|
5494 |
+
var getToolbar = function (editor) {
|
5495 |
+
var toolbar = editor.getParam('table_toolbar', defaultTableToolbar);
|
5496 |
+
if (toolbar === '' || toolbar === false) {
|
5497 |
+
return [];
|
5498 |
+
} else if (isString(toolbar)) {
|
5499 |
+
return toolbar.split(/[ ,]/);
|
5500 |
+
} else if (isArray(toolbar)) {
|
5501 |
+
return toolbar;
|
5502 |
+
} else {
|
5503 |
+
return [];
|
5504 |
+
}
|
5505 |
+
};
|
5506 |
+
|
5507 |
+
var fireNewRow = function (editor, row) {
|
5508 |
+
return editor.fire('newrow', { node: row });
|
5509 |
+
};
|
5510 |
+
var fireNewCell = function (editor, cell) {
|
5511 |
+
return editor.fire('newcell', { node: cell });
|
5512 |
+
};
|
5513 |
+
var fireObjectResizeStart = function (editor, target, width, height) {
|
5514 |
+
editor.fire('ObjectResizeStart', {
|
5515 |
+
target: target,
|
5516 |
+
width: width,
|
5517 |
+
height: height
|
5518 |
+
});
|
5519 |
+
};
|
5520 |
+
var fireObjectResized = function (editor, target, width, height) {
|
5521 |
+
editor.fire('ObjectResized', {
|
5522 |
+
target: target,
|
5523 |
+
width: width,
|
5524 |
+
height: height
|
5525 |
+
});
|
5526 |
+
};
|
5527 |
+
|
5528 |
+
var TableActions = function (editor, lazyWire) {
|
5529 |
+
var isTableBody = function (editor) {
|
5530 |
+
return $_g6duvbm3jjgwedby.name(getBody$1(editor)) === 'table';
|
5531 |
+
};
|
5532 |
+
var lastRowGuard = function (table) {
|
5533 |
+
var size = $_6hdhmfnijjgwedmv.getGridSize(table);
|
5534 |
+
return isTableBody(editor) === false || size.rows() > 1;
|
5535 |
+
};
|
5536 |
+
var lastColumnGuard = function (table) {
|
5537 |
+
var size = $_6hdhmfnijjgwedmv.getGridSize(table);
|
5538 |
+
return isTableBody(editor) === false || size.columns() > 1;
|
5539 |
+
};
|
5540 |
+
var cloneFormats = getCloneElements(editor);
|
5541 |
+
var execute = function (operation, guard, mutate, lazyWire) {
|
5542 |
+
return function (table, target) {
|
5543 |
+
removeDataStyle(table);
|
5544 |
+
var wire = lazyWire();
|
5545 |
+
var doc = Element$$1.fromDom(editor.getDoc());
|
5546 |
+
var direction = TableDirection($_dowdxdoljjgwedvp.directionAt);
|
5547 |
+
var generators = $_cne69smgjjgweddy.cellOperations(mutate, doc, cloneFormats);
|
5548 |
+
return guard(table) ? operation(wire, table, target, generators, direction).bind(function (result) {
|
5549 |
+
each(result.newRows(), function (row) {
|
5550 |
+
fireNewRow(editor, row.dom());
|
5551 |
});
|
5552 |
+
each(result.newCells(), function (cell) {
|
5553 |
+
fireNewCell(editor, cell.dom());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5554 |
});
|
5555 |
+
return result.cursor().map(function (cell) {
|
5556 |
+
var rng = editor.dom.createRng();
|
5557 |
+
rng.setStart(cell.dom(), 0);
|
5558 |
+
rng.setEnd(cell.dom(), 0);
|
5559 |
+
return rng;
|
5560 |
+
});
|
5561 |
+
}) : Option.none();
|
5562 |
+
};
|
5563 |
+
};
|
5564 |
+
var deleteRow = execute($_1evrpxnjjjgwedmy.eraseRows, lastRowGuard, noop, lazyWire);
|
5565 |
+
var deleteColumn = execute($_1evrpxnjjjgwedmy.eraseColumns, lastColumnGuard, noop, lazyWire);
|
5566 |
+
var insertRowsBefore = execute($_1evrpxnjjjgwedmy.insertRowsBefore, always, noop, lazyWire);
|
5567 |
+
var insertRowsAfter = execute($_1evrpxnjjjgwedmy.insertRowsAfter, always, noop, lazyWire);
|
5568 |
+
var insertColumnsBefore = execute($_1evrpxnjjjgwedmy.insertColumnsBefore, always, $_ajdo6on6jjgwedks.halve, lazyWire);
|
5569 |
+
var insertColumnsAfter = execute($_1evrpxnjjjgwedmy.insertColumnsAfter, always, $_ajdo6on6jjgwedks.halve, lazyWire);
|
5570 |
+
var mergeCells = execute($_1evrpxnjjjgwedmy.mergeCells, always, noop, lazyWire);
|
5571 |
+
var unmergeCells = execute($_1evrpxnjjjgwedmy.unmergeCells, always, noop, lazyWire);
|
5572 |
+
var pasteRowsBefore = execute($_1evrpxnjjjgwedmy.pasteRowsBefore, always, noop, lazyWire);
|
5573 |
+
var pasteRowsAfter = execute($_1evrpxnjjjgwedmy.pasteRowsAfter, always, noop, lazyWire);
|
5574 |
+
var pasteCells = execute($_1evrpxnjjjgwedmy.pasteCells, always, noop, lazyWire);
|
5575 |
+
return {
|
5576 |
+
deleteRow: deleteRow,
|
5577 |
+
deleteColumn: deleteColumn,
|
5578 |
+
insertRowsBefore: insertRowsBefore,
|
5579 |
+
insertRowsAfter: insertRowsAfter,
|
5580 |
+
insertColumnsBefore: insertColumnsBefore,
|
5581 |
+
insertColumnsAfter: insertColumnsAfter,
|
5582 |
+
mergeCells: mergeCells,
|
5583 |
+
unmergeCells: unmergeCells,
|
5584 |
+
pasteRowsBefore: pasteRowsBefore,
|
5585 |
+
pasteRowsAfter: pasteRowsAfter,
|
5586 |
+
pasteCells: pasteCells
|
5587 |
+
};
|
5588 |
+
};
|
5589 |
+
|
5590 |
+
var copyRows = function (table, target, generators) {
|
5591 |
+
var list = $_da6e59lbjjgwed7r.fromTable(table);
|
5592 |
+
var house = $_eesv8pmajjgwedcx.generate(list);
|
5593 |
+
var details = $_a3xhvcnqjjgwedp4.onCells(house, target);
|
5594 |
+
return details.map(function (selectedCells) {
|
5595 |
+
var grid = $_7omv2yntjjgwedpr.toGrid(house, generators, false);
|
5596 |
+
var slicedGrid = grid.slice(selectedCells[0].row(), selectedCells[selectedCells.length - 1].row() + selectedCells[selectedCells.length - 1].rowspan());
|
5597 |
+
var slicedDetails = $_a3xhvcnqjjgwedp4.toDetailList(slicedGrid, generators);
|
5598 |
+
return $_fdgjk7nwjjgwedqb.copy(slicedDetails);
|
5599 |
+
});
|
5600 |
+
};
|
5601 |
+
var $_1cz66ioqjjgwedwq = { copyRows: copyRows };
|
5602 |
+
|
5603 |
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
5604 |
+
|
5605 |
+
var getTDTHOverallStyle = function (dom, elm, name) {
|
5606 |
+
var cells = dom.select('td,th', elm);
|
5607 |
+
var firstChildStyle;
|
5608 |
+
var checkChildren = function (firstChildStyle, elms) {
|
5609 |
+
for (var i = 0; i < elms.length; i++) {
|
5610 |
+
var currentStyle = dom.getStyle(elms[i], name);
|
5611 |
+
if (typeof firstChildStyle === 'undefined') {
|
5612 |
+
firstChildStyle = currentStyle;
|
5613 |
}
|
5614 |
+
if (firstChildStyle !== currentStyle) {
|
5615 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5616 |
}
|
5617 |
+
}
|
5618 |
+
return firstChildStyle;
|
5619 |
+
};
|
5620 |
+
firstChildStyle = checkChildren(firstChildStyle, cells);
|
5621 |
+
return firstChildStyle;
|
5622 |
+
};
|
5623 |
+
var applyAlign = function (editor, elm, name) {
|
5624 |
+
if (name) {
|
5625 |
+
editor.formatter.apply('align' + name, {}, elm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5626 |
}
|
5627 |
+
};
|
5628 |
+
var applyVAlign = function (editor, elm, name) {
|
5629 |
+
if (name) {
|
5630 |
+
editor.formatter.apply('valign' + name, {}, elm);
|
5631 |
+
}
|
5632 |
+
};
|
5633 |
+
var unApplyAlign = function (editor, elm) {
|
5634 |
+
global$1.each('left center right'.split(' '), function (name) {
|
5635 |
+
editor.formatter.remove('align' + name, {}, elm);
|
5636 |
});
|
5637 |
+
};
|
5638 |
+
var unApplyVAlign = function (editor, elm) {
|
5639 |
+
global$1.each('top middle bottom'.split(' '), function (name) {
|
5640 |
+
editor.formatter.remove('valign' + name, {}, elm);
|
|
|
|
|
|
|
|
|
|
|
5641 |
});
|
5642 |
+
};
|
5643 |
+
var $_cmvolcotjjgwedx1 = {
|
5644 |
+
applyAlign: applyAlign,
|
5645 |
+
applyVAlign: applyVAlign,
|
5646 |
+
unApplyAlign: unApplyAlign,
|
5647 |
+
unApplyVAlign: unApplyVAlign,
|
5648 |
+
getTDTHOverallStyle: getTDTHOverallStyle
|
5649 |
+
};
|
5650 |
+
|
5651 |
+
var buildListItems = function (inputList, itemCallback, startItems) {
|
5652 |
+
var appendItems = function (values, output) {
|
5653 |
+
output = output || [];
|
5654 |
+
global$1.each(values, function (item) {
|
5655 |
+
var menuItem = { text: item.text || item.title };
|
5656 |
+
if (item.menu) {
|
5657 |
+
menuItem.menu = appendItems(item.menu);
|
5658 |
+
} else {
|
5659 |
+
menuItem.value = item.value;
|
5660 |
+
if (itemCallback) {
|
5661 |
+
itemCallback(menuItem);
|
5662 |
+
}
|
5663 |
+
}
|
5664 |
+
output.push(menuItem);
|
5665 |
+
});
|
5666 |
+
return output;
|
5667 |
+
};
|
5668 |
+
return appendItems(inputList, startItems || []);
|
5669 |
+
};
|
5670 |
+
function styleFieldHasFocus(e) {
|
5671 |
+
return e.control.rootControl.find('#style')[0].getEl().isEqualNode(document.activeElement);
|
5672 |
+
}
|
5673 |
+
var syncAdvancedStyleFields = function (editor, evt) {
|
5674 |
+
if (styleFieldHasFocus(evt)) {
|
5675 |
+
updateAdvancedFields(editor, evt);
|
5676 |
+
} else {
|
5677 |
+
updateStyleField(editor, evt);
|
5678 |
+
}
|
5679 |
+
};
|
5680 |
+
var updateStyleField = function (editor, evt) {
|
5681 |
+
var dom = editor.dom;
|
5682 |
+
var rootControl = evt.control.rootControl;
|
5683 |
+
var data = rootControl.toJSON();
|
5684 |
+
var css = dom.parseStyle(data.style);
|
5685 |
+
css['border-style'] = data.borderStyle;
|
5686 |
+
css['border-color'] = data.borderColor;
|
5687 |
+
css['background-color'] = data.backgroundColor;
|
5688 |
+
css.width = data.width ? addSizeSuffix(data.width) : '';
|
5689 |
+
css.height = data.height ? addSizeSuffix(data.height) : '';
|
5690 |
+
rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
5691 |
+
};
|
5692 |
+
var updateAdvancedFields = function (editor, evt) {
|
5693 |
+
var dom = editor.dom;
|
5694 |
+
var rootControl = evt.control.rootControl;
|
5695 |
+
var data = rootControl.toJSON();
|
5696 |
+
var css = dom.parseStyle(data.style);
|
5697 |
+
rootControl.find('#borderStyle').value(css['border-style'] || '');
|
5698 |
+
rootControl.find('#borderColor').value(css['border-color'] || '');
|
5699 |
+
rootControl.find('#backgroundColor').value(css['background-color'] || '');
|
5700 |
+
rootControl.find('#width').value(css.width || '');
|
5701 |
+
rootControl.find('#height').value(css.height || '');
|
5702 |
+
};
|
5703 |
+
var extractAdvancedStyles = function (dom, elm) {
|
5704 |
+
var css = dom.parseStyle(dom.getAttrib(elm, 'style'));
|
5705 |
+
var data = {};
|
5706 |
+
if (css['border-style']) {
|
5707 |
+
data.borderStyle = css['border-style'];
|
5708 |
+
}
|
5709 |
+
if (css['border-color']) {
|
5710 |
+
data.borderColor = css['border-color'];
|
5711 |
+
}
|
5712 |
+
if (css['background-color']) {
|
5713 |
+
data.backgroundColor = css['background-color'];
|
5714 |
+
}
|
5715 |
+
data.style = dom.serializeStyle(css);
|
5716 |
+
return data;
|
5717 |
+
};
|
5718 |
+
var createStyleForm = function (editor) {
|
5719 |
+
var createColorPickAction = function () {
|
5720 |
+
var colorPickerCallback = getColorPickerCallback(editor);
|
5721 |
+
if (colorPickerCallback) {
|
5722 |
+
return function (evt) {
|
5723 |
+
return colorPickerCallback.call(editor, function (value) {
|
5724 |
+
evt.control.value(value).fire('change');
|
5725 |
+
}, evt.control.value());
|
5726 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5727 |
}
|
5728 |
};
|
5729 |
+
return {
|
5730 |
+
title: 'Advanced',
|
5731 |
+
type: 'form',
|
5732 |
+
defaults: { onchange: curry(updateStyleField, editor) },
|
5733 |
+
items: [
|
5734 |
+
{
|
5735 |
+
label: 'Style',
|
5736 |
+
name: 'style',
|
5737 |
+
type: 'textbox',
|
5738 |
+
onchange: curry(updateAdvancedFields, editor)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5739 |
},
|
5740 |
+
{
|
5741 |
+
type: 'form',
|
5742 |
+
padding: 0,
|
5743 |
+
formItemDefaults: {
|
5744 |
+
layout: 'grid',
|
5745 |
+
alignH: [
|
5746 |
+
'start',
|
5747 |
+
'right'
|
5748 |
+
]
|
5749 |
+
},
|
5750 |
+
defaults: { size: 7 },
|
5751 |
+
items: [
|
5752 |
+
{
|
5753 |
+
label: 'Border style',
|
5754 |
+
type: 'listbox',
|
5755 |
+
name: 'borderStyle',
|
5756 |
+
width: 90,
|
5757 |
+
onselect: curry(updateStyleField, editor),
|
5758 |
+
values: [
|
5759 |
+
{
|
5760 |
+
text: 'Select...',
|
5761 |
+
value: ''
|
5762 |
+
},
|
5763 |
+
{
|
5764 |
+
text: 'Solid',
|
5765 |
+
value: 'solid'
|
5766 |
+
},
|
5767 |
+
{
|
5768 |
+
text: 'Dotted',
|
5769 |
+
value: 'dotted'
|
5770 |
+
},
|
5771 |
+
{
|
5772 |
+
text: 'Dashed',
|
5773 |
+
value: 'dashed'
|
5774 |
+
},
|
5775 |
+
{
|
5776 |
+
text: 'Double',
|
5777 |
+
value: 'double'
|
5778 |
+
},
|
5779 |
+
{
|
5780 |
+
text: 'Groove',
|
5781 |
+
value: 'groove'
|
5782 |
+
},
|
5783 |
+
{
|
5784 |
+
text: 'Ridge',
|
5785 |
+
value: 'ridge'
|
5786 |
+
},
|
5787 |
+
{
|
5788 |
+
text: 'Inset',
|
5789 |
+
value: 'inset'
|
5790 |
+
},
|
5791 |
+
{
|
5792 |
+
text: 'Outset',
|
5793 |
+
value: 'outset'
|
5794 |
+
},
|
5795 |
+
{
|
5796 |
+
text: 'None',
|
5797 |
+
value: 'none'
|
5798 |
+
},
|
5799 |
+
{
|
5800 |
+
text: 'Hidden',
|
5801 |
+
value: 'hidden'
|
5802 |
+
}
|
5803 |
+
]
|
5804 |
+
},
|
5805 |
+
{
|
5806 |
+
label: 'Border color',
|
5807 |
+
type: 'colorbox',
|
5808 |
+
name: 'borderColor',
|
5809 |
+
onaction: createColorPickAction()
|
5810 |
+
},
|
5811 |
+
{
|
5812 |
+
label: 'Background color',
|
5813 |
+
type: 'colorbox',
|
5814 |
+
name: 'backgroundColor',
|
5815 |
+
onaction: createColorPickAction()
|
5816 |
+
}
|
5817 |
+
]
|
|
|
|
|
5818 |
}
|
5819 |
+
]
|
5820 |
+
};
|
5821 |
+
};
|
5822 |
+
var $_fex2z1oujjgwedx4 = {
|
5823 |
+
createStyleForm: createStyleForm,
|
5824 |
+
buildListItems: buildListItems,
|
5825 |
+
updateStyleField: updateStyleField,
|
5826 |
+
extractAdvancedStyles: extractAdvancedStyles,
|
5827 |
+
updateAdvancedFields: updateAdvancedFields,
|
5828 |
+
syncAdvancedStyleFields: syncAdvancedStyleFields
|
5829 |
+
};
|
5830 |
+
|
5831 |
+
var updateStyles = function (elm, cssText) {
|
5832 |
+
delete elm.dataset.mceStyle;
|
5833 |
+
elm.style.cssText += ';' + cssText;
|
5834 |
+
};
|
5835 |
+
var extractDataFromElement = function (editor, elm) {
|
5836 |
+
var dom = editor.dom;
|
5837 |
+
var data = {
|
5838 |
+
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
|
5839 |
+
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
5840 |
+
scope: dom.getAttrib(elm, 'scope'),
|
5841 |
+
class: dom.getAttrib(elm, 'class'),
|
5842 |
+
type: elm.nodeName.toLowerCase(),
|
5843 |
+
style: '',
|
5844 |
+
align: '',
|
5845 |
+
valign: ''
|
5846 |
+
};
|
5847 |
+
global$1.each('left center right'.split(' '), function (name) {
|
5848 |
+
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
5849 |
+
data.align = name;
|
5850 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5851 |
});
|
5852 |
+
global$1.each('top middle bottom'.split(' '), function (name) {
|
5853 |
+
if (editor.formatter.matchNode(elm, 'valign' + name)) {
|
5854 |
+
data.valign = name;
|
5855 |
+
}
|
5856 |
+
});
|
5857 |
+
if (hasAdvancedCellTab(editor)) {
|
5858 |
+
global$1.extend(data, $_fex2z1oujjgwedx4.extractAdvancedStyles(dom, elm));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5859 |
}
|
5860 |
+
return data;
|
5861 |
+
};
|
5862 |
+
var onSubmitCellForm = function (editor, cells, evt) {
|
5863 |
+
var dom = editor.dom;
|
5864 |
+
var data;
|
5865 |
+
function setAttrib(elm, name, value) {
|
5866 |
+
if (cells.length === 1 || value) {
|
5867 |
+
dom.setAttrib(elm, name, value);
|
5868 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5869 |
}
|
5870 |
+
function setStyle(elm, name, value) {
|
5871 |
+
if (cells.length === 1 || value) {
|
5872 |
+
dom.setStyle(elm, name, value);
|
5873 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5874 |
}
|
5875 |
+
if (hasAdvancedCellTab(editor)) {
|
5876 |
+
$_fex2z1oujjgwedx4.syncAdvancedStyleFields(editor, evt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5877 |
}
|
5878 |
+
data = evt.control.rootControl.toJSON();
|
5879 |
+
editor.undoManager.transact(function () {
|
5880 |
+
global$1.each(cells, function (cellElm) {
|
5881 |
+
setAttrib(cellElm, 'scope', data.scope);
|
5882 |
+
if (cells.length === 1) {
|
5883 |
+
setAttrib(cellElm, 'style', data.style);
|
5884 |
+
} else {
|
5885 |
+
updateStyles(cellElm, data.style);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5886 |
}
|
5887 |
+
setAttrib(cellElm, 'class', data.class);
|
5888 |
+
setStyle(cellElm, 'width', addSizeSuffix(data.width));
|
5889 |
+
setStyle(cellElm, 'height', addSizeSuffix(data.height));
|
5890 |
+
if (data.type && cellElm.nodeName.toLowerCase() !== data.type) {
|
5891 |
+
cellElm = dom.rename(cellElm, data.type);
|
|
|
5892 |
}
|
5893 |
+
if (cells.length === 1) {
|
5894 |
+
$_cmvolcotjjgwedx1.unApplyAlign(editor, cellElm);
|
5895 |
+
$_cmvolcotjjgwedx1.unApplyVAlign(editor, cellElm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5896 |
}
|
5897 |
+
if (data.align) {
|
5898 |
+
$_cmvolcotjjgwedx1.applyAlign(editor, cellElm, data.align);
|
5899 |
+
}
|
5900 |
+
if (data.valign) {
|
5901 |
+
$_cmvolcotjjgwedx1.applyVAlign(editor, cellElm, data.valign);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5902 |
}
|
5903 |
});
|
5904 |
+
editor.focus();
|
5905 |
+
});
|
5906 |
+
};
|
5907 |
+
var open = function (editor) {
|
5908 |
+
var cellElm, data, classListCtrl, cells = [];
|
5909 |
+
cells = editor.dom.select('td[data-mce-selected],th[data-mce-selected]');
|
5910 |
+
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
|
5911 |
+
if (!cells.length && cellElm) {
|
5912 |
+
cells.push(cellElm);
|
5913 |
+
}
|
5914 |
+
cellElm = cellElm || cells[0];
|
5915 |
+
if (!cellElm) {
|
5916 |
+
return;
|
5917 |
+
}
|
5918 |
+
if (cells.length > 1) {
|
5919 |
+
data = {
|
5920 |
+
width: '',
|
5921 |
+
height: '',
|
5922 |
+
scope: '',
|
5923 |
+
class: '',
|
5924 |
+
align: '',
|
5925 |
+
valign: '',
|
5926 |
+
style: '',
|
5927 |
+
type: cellElm.nodeName.toLowerCase()
|
5928 |
+
};
|
5929 |
+
} else {
|
5930 |
+
data = extractDataFromElement(editor, cellElm);
|
5931 |
+
}
|
5932 |
+
if (getCellClassList(editor).length > 0) {
|
5933 |
+
classListCtrl = {
|
5934 |
+
name: 'class',
|
5935 |
+
type: 'listbox',
|
5936 |
+
label: 'Class',
|
5937 |
+
values: $_fex2z1oujjgwedx4.buildListItems(getCellClassList(editor), function (item) {
|
5938 |
+
if (item.value) {
|
5939 |
+
item.textStyle = function () {
|
5940 |
+
return editor.formatter.getCssText({
|
5941 |
+
block: 'td',
|
5942 |
+
classes: [item.value]
|
5943 |
+
});
|
5944 |
+
};
|
5945 |
+
}
|
5946 |
+
})
|
5947 |
+
};
|
5948 |
+
}
|
5949 |
+
var generalCellForm = {
|
5950 |
+
type: 'form',
|
5951 |
+
layout: 'flex',
|
5952 |
+
direction: 'column',
|
5953 |
+
labelGapCalc: 'children',
|
5954 |
+
padding: 0,
|
5955 |
+
items: [
|
5956 |
+
{
|
5957 |
+
type: 'form',
|
5958 |
+
layout: 'grid',
|
5959 |
+
columns: 2,
|
5960 |
+
labelGapCalc: false,
|
5961 |
+
padding: 0,
|
5962 |
+
defaults: {
|
5963 |
+
type: 'textbox',
|
5964 |
+
maxWidth: 50
|
5965 |
+
},
|
5966 |
+
items: [
|
5967 |
+
{
|
5968 |
+
label: 'Width',
|
5969 |
+
name: 'width',
|
5970 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
5971 |
+
},
|
5972 |
+
{
|
5973 |
+
label: 'Height',
|
5974 |
+
name: 'height',
|
5975 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
5976 |
+
},
|
5977 |
+
{
|
5978 |
+
label: 'Cell type',
|
5979 |
+
name: 'type',
|
5980 |
+
type: 'listbox',
|
5981 |
+
text: 'None',
|
5982 |
+
minWidth: 90,
|
5983 |
+
maxWidth: null,
|
5984 |
+
values: [
|
5985 |
+
{
|
5986 |
+
text: 'Cell',
|
5987 |
+
value: 'td'
|
5988 |
+
},
|
5989 |
+
{
|
5990 |
+
text: 'Header cell',
|
5991 |
+
value: 'th'
|
5992 |
+
}
|
5993 |
+
]
|
5994 |
+
},
|
5995 |
+
{
|
5996 |
+
label: 'Scope',
|
5997 |
+
name: 'scope',
|
5998 |
+
type: 'listbox',
|
5999 |
+
text: 'None',
|
6000 |
+
minWidth: 90,
|
6001 |
+
maxWidth: null,
|
6002 |
+
values: [
|
6003 |
+
{
|
6004 |
+
text: 'None',
|
6005 |
+
value: ''
|
6006 |
+
},
|
6007 |
+
{
|
6008 |
+
text: 'Row',
|
6009 |
+
value: 'row'
|
6010 |
+
},
|
6011 |
+
{
|
6012 |
+
text: 'Column',
|
6013 |
+
value: 'col'
|
6014 |
+
},
|
6015 |
+
{
|
6016 |
+
text: 'Row group',
|
6017 |
+
value: 'rowgroup'
|
6018 |
+
},
|
6019 |
+
{
|
6020 |
+
text: 'Column group',
|
6021 |
+
value: 'colgroup'
|
6022 |
+
}
|
6023 |
+
]
|
6024 |
+
},
|
6025 |
+
{
|
6026 |
+
label: 'H Align',
|
6027 |
+
name: 'align',
|
6028 |
+
type: 'listbox',
|
6029 |
+
text: 'None',
|
6030 |
+
minWidth: 90,
|
6031 |
+
maxWidth: null,
|
6032 |
+
values: [
|
6033 |
+
{
|
6034 |
+
text: 'None',
|
6035 |
+
value: ''
|
6036 |
+
},
|
6037 |
+
{
|
6038 |
+
text: 'Left',
|
6039 |
+
value: 'left'
|
6040 |
+
},
|
6041 |
+
{
|
6042 |
+
text: 'Center',
|
6043 |
+
value: 'center'
|
6044 |
+
},
|
6045 |
+
{
|
6046 |
+
text: 'Right',
|
6047 |
+
value: 'right'
|
6048 |
+
}
|
6049 |
+
]
|
6050 |
+
},
|
6051 |
+
{
|
6052 |
+
label: 'V Align',
|
6053 |
+
name: 'valign',
|
6054 |
+
type: 'listbox',
|
6055 |
+
text: 'None',
|
6056 |
+
minWidth: 90,
|
6057 |
+
maxWidth: null,
|
6058 |
+
values: [
|
6059 |
+
{
|
6060 |
+
text: 'None',
|
6061 |
+
value: ''
|
6062 |
+
},
|
6063 |
+
{
|
6064 |
+
text: 'Top',
|
6065 |
+
value: 'top'
|
6066 |
+
},
|
6067 |
+
{
|
6068 |
+
text: 'Middle',
|
6069 |
+
value: 'middle'
|
6070 |
+
},
|
6071 |
+
{
|
6072 |
+
text: 'Bottom',
|
6073 |
+
value: 'bottom'
|
6074 |
+
}
|
6075 |
+
]
|
6076 |
+
}
|
6077 |
+
]
|
6078 |
+
},
|
6079 |
+
classListCtrl
|
6080 |
+
]
|
6081 |
};
|
6082 |
+
if (hasAdvancedCellTab(editor)) {
|
6083 |
+
editor.windowManager.open({
|
6084 |
+
title: 'Cell properties',
|
6085 |
+
bodyType: 'tabpanel',
|
6086 |
+
data: data,
|
6087 |
+
body: [
|
6088 |
+
{
|
6089 |
+
title: 'General',
|
6090 |
+
type: 'form',
|
6091 |
+
items: generalCellForm
|
6092 |
+
},
|
6093 |
+
$_fex2z1oujjgwedx4.createStyleForm(editor)
|
6094 |
+
],
|
6095 |
+
onsubmit: curry(onSubmitCellForm, editor, cells)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6096 |
});
|
6097 |
+
} else {
|
6098 |
+
editor.windowManager.open({
|
6099 |
+
title: 'Cell properties',
|
6100 |
+
data: data,
|
6101 |
+
body: generalCellForm,
|
6102 |
+
onsubmit: curry(onSubmitCellForm, editor, cells)
|
|
|
|
|
6103 |
});
|
6104 |
+
}
|
6105 |
+
};
|
6106 |
+
var $_i574vosjjgwedwu = { open: open };
|
6107 |
+
|
6108 |
+
var extractDataFromElement$1 = function (editor, elm) {
|
6109 |
+
var dom = editor.dom;
|
6110 |
+
var data = {
|
6111 |
+
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
|
6112 |
+
scope: dom.getAttrib(elm, 'scope'),
|
6113 |
+
class: dom.getAttrib(elm, 'class'),
|
6114 |
+
align: '',
|
6115 |
+
style: '',
|
6116 |
+
type: elm.parentNode.nodeName.toLowerCase()
|
6117 |
+
};
|
6118 |
+
global$1.each('left center right'.split(' '), function (name) {
|
6119 |
+
if (editor.formatter.matchNode(elm, 'align' + name)) {
|
6120 |
+
data.align = name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6121 |
}
|
6122 |
+
});
|
6123 |
+
if (hasAdvancedRowTab(editor)) {
|
6124 |
+
global$1.extend(data, $_fex2z1oujjgwedx4.extractAdvancedStyles(dom, elm));
|
6125 |
+
}
|
6126 |
+
return data;
|
6127 |
+
};
|
6128 |
+
var switchRowType = function (dom, rowElm, toType) {
|
6129 |
+
var tableElm = dom.getParent(rowElm, 'table');
|
6130 |
+
var oldParentElm = rowElm.parentNode;
|
6131 |
+
var parentElm = dom.select(toType, tableElm)[0];
|
6132 |
+
if (!parentElm) {
|
6133 |
+
parentElm = dom.create(toType);
|
6134 |
+
if (tableElm.firstChild) {
|
6135 |
+
if (tableElm.firstChild.nodeName === 'CAPTION') {
|
6136 |
+
dom.insertAfter(parentElm, tableElm.firstChild);
|
6137 |
+
} else {
|
6138 |
+
tableElm.insertBefore(parentElm, tableElm.firstChild);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6139 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6140 |
} else {
|
6141 |
+
tableElm.appendChild(parentElm);
|
6142 |
}
|
6143 |
+
}
|
6144 |
+
parentElm.appendChild(rowElm);
|
6145 |
+
if (!oldParentElm.hasChildNodes()) {
|
6146 |
+
dom.remove(oldParentElm);
|
6147 |
+
}
|
6148 |
+
};
|
6149 |
+
function onSubmitRowForm(editor, rows, oldData, evt) {
|
6150 |
+
var dom = editor.dom;
|
6151 |
+
function setAttrib(elm, name, value) {
|
6152 |
+
if (rows.length === 1 || value) {
|
6153 |
+
dom.setAttrib(elm, name, value);
|
6154 |
+
}
|
6155 |
+
}
|
6156 |
+
function setStyle(elm, name, value) {
|
6157 |
+
if (rows.length === 1 || value) {
|
6158 |
+
dom.setStyle(elm, name, value);
|
6159 |
+
}
|
6160 |
+
}
|
6161 |
+
if (hasAdvancedRowTab(editor)) {
|
6162 |
+
$_fex2z1oujjgwedx4.syncAdvancedStyleFields(editor, evt);
|
6163 |
+
}
|
6164 |
+
var data = evt.control.rootControl.toJSON();
|
6165 |
+
editor.undoManager.transact(function () {
|
6166 |
+
global$1.each(rows, function (rowElm) {
|
6167 |
+
setAttrib(rowElm, 'scope', data.scope);
|
6168 |
+
setAttrib(rowElm, 'style', data.style);
|
6169 |
+
setAttrib(rowElm, 'class', data.class);
|
6170 |
+
setStyle(rowElm, 'height', addSizeSuffix(data.height));
|
6171 |
+
if (data.type !== rowElm.parentNode.nodeName.toLowerCase()) {
|
6172 |
+
switchRowType(editor.dom, rowElm, data.type);
|
6173 |
+
}
|
6174 |
+
if (data.align !== oldData.align) {
|
6175 |
+
$_cmvolcotjjgwedx1.unApplyAlign(editor, rowElm);
|
6176 |
+
$_cmvolcotjjgwedx1.applyAlign(editor, rowElm, data.align);
|
6177 |
}
|
6178 |
});
|
6179 |
+
editor.focus();
|
6180 |
+
});
|
6181 |
+
}
|
6182 |
+
var open$1 = function (editor) {
|
6183 |
+
var dom = editor.dom;
|
6184 |
+
var tableElm, cellElm, rowElm, classListCtrl, data;
|
6185 |
+
var rows = [];
|
6186 |
+
var generalRowForm;
|
6187 |
+
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
6188 |
+
cellElm = dom.getParent(editor.selection.getStart(), 'td,th');
|
6189 |
+
global$1.each(tableElm.rows, function (row) {
|
6190 |
+
global$1.each(row.cells, function (cell) {
|
6191 |
+
if (dom.getAttrib(cell, 'data-mce-selected') || cell === cellElm) {
|
6192 |
+
rows.push(row);
|
6193 |
+
return false;
|
|
|
|
|
|
|
|
|
6194 |
}
|
6195 |
+
});
|
6196 |
+
});
|
6197 |
+
rowElm = rows[0];
|
6198 |
+
if (!rowElm) {
|
6199 |
+
return;
|
6200 |
+
}
|
6201 |
+
if (rows.length > 1) {
|
6202 |
+
data = {
|
6203 |
+
height: '',
|
6204 |
+
scope: '',
|
6205 |
+
style: '',
|
6206 |
+
class: '',
|
6207 |
+
align: '',
|
6208 |
+
type: rowElm.parentNode.nodeName.toLowerCase()
|
6209 |
};
|
6210 |
+
} else {
|
6211 |
+
data = extractDataFromElement$1(editor, rowElm);
|
6212 |
+
}
|
6213 |
+
if (getRowClassList(editor).length > 0) {
|
6214 |
+
classListCtrl = {
|
6215 |
+
name: 'class',
|
6216 |
+
type: 'listbox',
|
6217 |
+
label: 'Class',
|
6218 |
+
values: $_fex2z1oujjgwedx4.buildListItems(getRowClassList(editor), function (item) {
|
6219 |
+
if (item.value) {
|
6220 |
+
item.textStyle = function () {
|
6221 |
+
return editor.formatter.getCssText({
|
6222 |
+
block: 'tr',
|
6223 |
+
classes: [item.value]
|
6224 |
+
});
|
6225 |
+
};
|
6226 |
+
}
|
6227 |
+
})
|
6228 |
};
|
6229 |
+
}
|
6230 |
+
generalRowForm = {
|
6231 |
+
type: 'form',
|
6232 |
+
columns: 2,
|
6233 |
+
padding: 0,
|
6234 |
+
defaults: { type: 'textbox' },
|
6235 |
+
items: [
|
6236 |
+
{
|
6237 |
+
type: 'listbox',
|
6238 |
+
name: 'type',
|
6239 |
+
label: 'Row type',
|
6240 |
+
text: 'Header',
|
6241 |
+
maxWidth: null,
|
6242 |
+
values: [
|
6243 |
+
{
|
6244 |
+
text: 'Header',
|
6245 |
+
value: 'thead'
|
6246 |
+
},
|
6247 |
+
{
|
6248 |
+
text: 'Body',
|
6249 |
+
value: 'tbody'
|
6250 |
+
},
|
6251 |
+
{
|
6252 |
+
text: 'Footer',
|
6253 |
+
value: 'tfoot'
|
6254 |
+
}
|
6255 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6256 |
},
|
6257 |
+
{
|
6258 |
+
type: 'listbox',
|
6259 |
+
name: 'align',
|
6260 |
+
label: 'Alignment',
|
6261 |
+
text: 'None',
|
6262 |
+
maxWidth: null,
|
6263 |
+
values: [
|
6264 |
+
{
|
6265 |
+
text: 'None',
|
6266 |
+
value: ''
|
6267 |
+
},
|
6268 |
+
{
|
6269 |
+
text: 'Left',
|
6270 |
+
value: 'left'
|
6271 |
+
},
|
6272 |
+
{
|
6273 |
+
text: 'Center',
|
6274 |
+
value: 'center'
|
6275 |
+
},
|
6276 |
+
{
|
6277 |
+
text: 'Right',
|
6278 |
+
value: 'right'
|
6279 |
}
|
6280 |
+
]
|
6281 |
+
},
|
6282 |
+
{
|
6283 |
+
label: 'Height',
|
6284 |
+
name: 'height'
|
6285 |
+
},
|
6286 |
+
classListCtrl
|
6287 |
+
]
|
|
|
|
|
|
|
|
|
|
|
6288 |
};
|
6289 |
+
if (hasAdvancedRowTab(editor)) {
|
6290 |
+
editor.windowManager.open({
|
6291 |
+
title: 'Row properties',
|
6292 |
+
data: data,
|
6293 |
+
bodyType: 'tabpanel',
|
6294 |
+
body: [
|
6295 |
+
{
|
6296 |
+
title: 'General',
|
6297 |
+
type: 'form',
|
6298 |
+
items: generalRowForm
|
6299 |
+
},
|
6300 |
+
$_fex2z1oujjgwedx4.createStyleForm(editor)
|
6301 |
+
],
|
6302 |
+
onsubmit: curry(onSubmitRowForm, editor, rows, data)
|
6303 |
});
|
6304 |
+
} else {
|
6305 |
+
editor.windowManager.open({
|
6306 |
+
title: 'Row properties',
|
6307 |
+
data: data,
|
6308 |
+
body: generalRowForm,
|
6309 |
+
onsubmit: curry(onSubmitRowForm, editor, rows, data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6310 |
});
|
6311 |
+
}
|
6312 |
+
};
|
6313 |
+
var $_39xpksovjjgwedxd = { open: open$1 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6314 |
|
6315 |
+
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
|
6316 |
|
6317 |
+
var DefaultRenderOptions = {
|
6318 |
+
styles: {
|
6319 |
+
'border-collapse': 'collapse',
|
6320 |
+
width: '100%'
|
6321 |
+
},
|
6322 |
+
attributes: { border: '1' },
|
6323 |
+
percentages: true
|
6324 |
+
};
|
6325 |
+
var makeTable = function () {
|
6326 |
+
return Element$$1.fromTag('table');
|
6327 |
+
};
|
6328 |
+
var tableBody = function () {
|
6329 |
+
return Element$$1.fromTag('tbody');
|
6330 |
+
};
|
6331 |
+
var tableRow = function () {
|
6332 |
+
return Element$$1.fromTag('tr');
|
6333 |
+
};
|
6334 |
+
var tableHeaderCell = function () {
|
6335 |
+
return Element$$1.fromTag('th');
|
6336 |
+
};
|
6337 |
+
var tableCell = function () {
|
6338 |
+
return Element$$1.fromTag('td');
|
6339 |
+
};
|
6340 |
+
var render$1 = function (rows, columns, rowHeaders, columnHeaders, renderOpts) {
|
6341 |
+
if (renderOpts === void 0) {
|
6342 |
+
renderOpts = DefaultRenderOptions;
|
6343 |
+
}
|
6344 |
+
var table = makeTable();
|
6345 |
+
$_59neaymbjjgwedd8.setAll(table, renderOpts.styles);
|
6346 |
+
$_72hn9pm2jjgwedbq.setAll(table, renderOpts.attributes);
|
6347 |
+
var tbody = tableBody();
|
6348 |
+
$_1yoqsmmdjjgweddo.append(table, tbody);
|
6349 |
+
var trs = [];
|
6350 |
+
for (var i = 0; i < rows; i++) {
|
6351 |
+
var tr = tableRow();
|
6352 |
+
for (var j = 0; j < columns; j++) {
|
6353 |
+
var td = i < rowHeaders || j < columnHeaders ? tableHeaderCell() : tableCell();
|
6354 |
+
if (j < columnHeaders) {
|
6355 |
+
$_72hn9pm2jjgwedbq.set(td, 'scope', 'row');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6356 |
}
|
6357 |
+
if (i < rowHeaders) {
|
6358 |
+
$_72hn9pm2jjgwedbq.set(td, 'scope', 'col');
|
6359 |
+
}
|
6360 |
+
$_1yoqsmmdjjgweddo.append(td, Element$$1.fromTag('br'));
|
6361 |
+
if (renderOpts.percentages) {
|
6362 |
+
$_59neaymbjjgwedd8.set(td, 'width', 100 / columns + '%');
|
6363 |
+
}
|
6364 |
+
$_1yoqsmmdjjgweddo.append(tr, td);
|
6365 |
}
|
6366 |
+
trs.push(tr);
|
6367 |
+
}
|
6368 |
+
$_7onf0emfjjgweddu.append(tbody, trs);
|
6369 |
+
return table;
|
6370 |
+
};
|
6371 |
+
|
6372 |
+
var get$7 = function (element) {
|
6373 |
+
return element.dom().innerHTML;
|
6374 |
+
};
|
6375 |
+
var set$5 = function (element, content) {
|
6376 |
+
var owner = $_97vsilljjjgwed9v.owner(element);
|
6377 |
+
var docDom = owner.dom();
|
6378 |
+
var fragment = Element$$1.fromDom(docDom.createDocumentFragment());
|
6379 |
+
var contentElements = $_4bkah5mmjjgwedfb.fromHtml(content, docDom);
|
6380 |
+
$_7onf0emfjjgweddu.append(fragment, contentElements);
|
6381 |
+
$_1y8qodmejjgweddq.empty(element);
|
6382 |
+
$_1yoqsmmdjjgweddo.append(element, fragment);
|
6383 |
+
};
|
6384 |
+
var getOuter$2 = function (element) {
|
6385 |
+
var container = Element$$1.fromTag('div');
|
6386 |
+
var clone = Element$$1.fromDom(element.dom().cloneNode(true));
|
6387 |
+
$_1yoqsmmdjjgweddo.append(container, clone);
|
6388 |
+
return get$7(container);
|
6389 |
+
};
|
6390 |
+
var $_gc54c4p1jjgwedys = {
|
6391 |
+
get: get$7,
|
6392 |
+
set: set$5,
|
6393 |
+
getOuter: getOuter$2
|
6394 |
+
};
|
6395 |
+
|
6396 |
+
var placeCaretInCell = function (editor, cell) {
|
6397 |
+
editor.selection.select(cell.dom(), true);
|
6398 |
+
editor.selection.collapse(true);
|
6399 |
+
};
|
6400 |
+
var selectFirstCellInTable = function (editor, tableElm) {
|
6401 |
+
$_2e7p77m7jjgwedcg.descendant(tableElm, 'td,th').each(curry(placeCaretInCell, editor));
|
6402 |
+
};
|
6403 |
+
var fireEvents = function (editor, table) {
|
6404 |
+
each($_5ko5j3m4jjgwedc0.descendants(table, 'tr'), function (row) {
|
6405 |
+
fireNewRow(editor, row.dom());
|
6406 |
+
each($_5ko5j3m4jjgwedc0.descendants(row, 'th,td'), function (cell) {
|
6407 |
+
fireNewCell(editor, cell.dom());
|
6408 |
+
});
|
6409 |
+
});
|
6410 |
+
};
|
6411 |
+
var isPercentage = function (width) {
|
6412 |
+
return isString(width) && width.indexOf('%') !== -1;
|
6413 |
+
};
|
6414 |
+
var insert$1 = function (editor, columns, rows) {
|
6415 |
+
var defaultStyles = getDefaultStyles(editor);
|
6416 |
+
var options = {
|
6417 |
+
styles: defaultStyles,
|
6418 |
+
attributes: getDefaultAttributes(editor),
|
6419 |
+
percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
|
6420 |
+
};
|
6421 |
+
var table = render$1(rows, columns, 0, 0, options);
|
6422 |
+
$_72hn9pm2jjgwedbq.set(table, 'data-mce-id', '__mce');
|
6423 |
+
var html = $_gc54c4p1jjgwedys.getOuter(table);
|
6424 |
+
editor.insertContent(html);
|
6425 |
+
return $_2e7p77m7jjgwedcg.descendant(getBody$1(editor), 'table[data-mce-id="__mce"]').map(function (table) {
|
6426 |
+
if (isPixelsForced(editor)) {
|
6427 |
+
$_59neaymbjjgwedd8.set(table, 'width', $_59neaymbjjgwedd8.get(table, 'width'));
|
6428 |
+
}
|
6429 |
+
$_72hn9pm2jjgwedbq.remove(table, 'data-mce-id');
|
6430 |
+
fireEvents(editor, table);
|
6431 |
+
selectFirstCellInTable(editor, table);
|
6432 |
+
return table.dom();
|
6433 |
+
}).getOr(null);
|
6434 |
+
};
|
6435 |
+
var $_2ync79oyjjgwedxx = { insert: insert$1 };
|
6436 |
+
|
6437 |
+
function styleTDTH(dom, elm, name, value) {
|
6438 |
+
if (elm.tagName === 'TD' || elm.tagName === 'TH') {
|
6439 |
+
dom.setStyle(elm, name, value);
|
6440 |
+
} else {
|
6441 |
+
if (elm.children) {
|
6442 |
+
for (var i = 0; i < elm.children.length; i++) {
|
6443 |
+
styleTDTH(dom, elm.children[i], name, value);
|
6444 |
+
}
|
6445 |
+
}
|
6446 |
+
}
|
6447 |
+
}
|
6448 |
+
var extractDataFromElement$2 = function (editor, tableElm) {
|
6449 |
+
var dom = editor.dom;
|
6450 |
+
var data = {
|
6451 |
+
width: dom.getStyle(tableElm, 'width') || dom.getAttrib(tableElm, 'width'),
|
6452 |
+
height: dom.getStyle(tableElm, 'height') || dom.getAttrib(tableElm, 'height'),
|
6453 |
+
cellspacing: dom.getStyle(tableElm, 'border-spacing') || dom.getAttrib(tableElm, 'cellspacing'),
|
6454 |
+
cellpadding: dom.getAttrib(tableElm, 'data-mce-cell-padding') || dom.getAttrib(tableElm, 'cellpadding') || $_cmvolcotjjgwedx1.getTDTHOverallStyle(editor.dom, tableElm, 'padding'),
|
6455 |
+
border: dom.getAttrib(tableElm, 'data-mce-border') || dom.getAttrib(tableElm, 'border') || $_cmvolcotjjgwedx1.getTDTHOverallStyle(editor.dom, tableElm, 'border'),
|
6456 |
+
borderColor: dom.getAttrib(tableElm, 'data-mce-border-color'),
|
6457 |
+
caption: !!dom.select('caption', tableElm)[0],
|
6458 |
+
class: dom.getAttrib(tableElm, 'class')
|
6459 |
+
};
|
6460 |
+
global$1.each('left center right'.split(' '), function (name) {
|
6461 |
+
if (editor.formatter.matchNode(tableElm, 'align' + name)) {
|
6462 |
+
data.align = name;
|
6463 |
+
}
|
6464 |
+
});
|
6465 |
+
if (hasAdvancedTableTab(editor)) {
|
6466 |
+
global$1.extend(data, $_fex2z1oujjgwedx4.extractAdvancedStyles(dom, tableElm));
|
6467 |
+
}
|
6468 |
+
return data;
|
6469 |
+
};
|
6470 |
+
var applyDataToElement = function (editor, tableElm, data) {
|
6471 |
+
var dom = editor.dom;
|
6472 |
+
var attrs = {};
|
6473 |
+
var styles = {};
|
6474 |
+
attrs.class = data.class;
|
6475 |
+
styles.height = addSizeSuffix(data.height);
|
6476 |
+
if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {
|
6477 |
+
attrs.width = removePxSuffix(data.width);
|
6478 |
+
} else {
|
6479 |
+
styles.width = addSizeSuffix(data.width);
|
6480 |
+
}
|
6481 |
+
if (shouldStyleWithCss(editor)) {
|
6482 |
+
styles['border-width'] = addSizeSuffix(data.border);
|
6483 |
+
styles['border-spacing'] = addSizeSuffix(data.cellspacing);
|
6484 |
+
global$1.extend(attrs, {
|
6485 |
+
'data-mce-border-color': data.borderColor,
|
6486 |
+
'data-mce-cell-padding': data.cellpadding,
|
6487 |
+
'data-mce-border': data.border
|
6488 |
+
});
|
6489 |
+
} else {
|
6490 |
+
global$1.extend(attrs, {
|
6491 |
+
border: data.border,
|
6492 |
+
cellpadding: data.cellpadding,
|
6493 |
+
cellspacing: data.cellspacing
|
6494 |
+
});
|
6495 |
+
}
|
6496 |
+
if (shouldStyleWithCss(editor)) {
|
6497 |
+
if (tableElm.children) {
|
6498 |
+
for (var i = 0; i < tableElm.children.length; i++) {
|
6499 |
+
styleTDTH(dom, tableElm.children[i], {
|
6500 |
+
'border-width': addSizeSuffix(data.border),
|
6501 |
+
'border-color': data.borderColor,
|
6502 |
+
'padding': addSizeSuffix(data.cellpadding)
|
6503 |
+
});
|
6504 |
+
}
|
6505 |
+
}
|
6506 |
+
}
|
6507 |
+
if (data.style) {
|
6508 |
+
global$1.extend(styles, dom.parseStyle(data.style));
|
6509 |
+
} else {
|
6510 |
+
styles = global$1.extend({}, dom.parseStyle(dom.getAttrib(tableElm, 'style')), styles);
|
6511 |
+
}
|
6512 |
+
attrs.style = dom.serializeStyle(styles);
|
6513 |
+
dom.setAttribs(tableElm, attrs);
|
6514 |
+
};
|
6515 |
+
var onSubmitTableForm = function (editor, tableElm, evt) {
|
6516 |
+
var dom = editor.dom;
|
6517 |
+
var captionElm;
|
6518 |
+
var data;
|
6519 |
+
if (hasAdvancedTableTab(editor)) {
|
6520 |
+
$_fex2z1oujjgwedx4.syncAdvancedStyleFields(editor, evt);
|
6521 |
+
}
|
6522 |
+
data = evt.control.rootControl.toJSON();
|
6523 |
+
if (data.class === false) {
|
6524 |
+
delete data.class;
|
6525 |
+
}
|
6526 |
+
editor.undoManager.transact(function () {
|
6527 |
+
if (!tableElm) {
|
6528 |
+
tableElm = $_2ync79oyjjgwedxx.insert(editor, data.cols || 1, data.rows || 1);
|
6529 |
+
}
|
6530 |
+
applyDataToElement(editor, tableElm, data);
|
6531 |
+
captionElm = dom.select('caption', tableElm)[0];
|
6532 |
+
if (captionElm && !data.caption) {
|
6533 |
+
dom.remove(captionElm);
|
6534 |
+
}
|
6535 |
+
if (!captionElm && data.caption) {
|
6536 |
+
captionElm = dom.create('caption');
|
6537 |
+
captionElm.innerHTML = !global$2.ie ? '<br data-mce-bogus="1"/>' : '\xA0';
|
6538 |
+
tableElm.insertBefore(captionElm, tableElm.firstChild);
|
6539 |
+
}
|
6540 |
+
$_cmvolcotjjgwedx1.unApplyAlign(editor, tableElm);
|
6541 |
+
if (data.align) {
|
6542 |
+
$_cmvolcotjjgwedx1.applyAlign(editor, tableElm, data.align);
|
6543 |
+
}
|
6544 |
+
editor.focus();
|
6545 |
+
editor.addVisual();
|
6546 |
+
});
|
6547 |
+
};
|
6548 |
+
var open$2 = function (editor, isProps) {
|
6549 |
+
var dom = editor.dom;
|
6550 |
+
var tableElm, colsCtrl, rowsCtrl, classListCtrl, data = {}, generalTableForm;
|
6551 |
+
if (isProps === true) {
|
6552 |
+
tableElm = dom.getParent(editor.selection.getStart(), 'table');
|
6553 |
+
if (tableElm) {
|
6554 |
+
data = extractDataFromElement$2(editor, tableElm);
|
6555 |
+
}
|
6556 |
+
} else {
|
6557 |
+
colsCtrl = {
|
6558 |
+
label: 'Cols',
|
6559 |
+
name: 'cols'
|
6560 |
};
|
6561 |
+
rowsCtrl = {
|
6562 |
+
label: 'Rows',
|
6563 |
+
name: 'rows'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6564 |
};
|
6565 |
}
|
6566 |
+
if (getTableClassList(editor).length > 0) {
|
6567 |
+
if (data.class) {
|
6568 |
+
data.class = data.class.replace(/\s*mce\-item\-table\s*/g, '');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6569 |
}
|
6570 |
+
classListCtrl = {
|
6571 |
+
name: 'class',
|
6572 |
+
type: 'listbox',
|
6573 |
+
label: 'Class',
|
6574 |
+
values: $_fex2z1oujjgwedx4.buildListItems(getTableClassList(editor), function (item) {
|
6575 |
+
if (item.value) {
|
6576 |
+
item.textStyle = function () {
|
6577 |
+
return editor.formatter.getCssText({
|
6578 |
+
block: 'table',
|
6579 |
+
classes: [item.value]
|
6580 |
+
});
|
6581 |
+
};
|
6582 |
}
|
6583 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6584 |
};
|
6585 |
+
}
|
6586 |
+
generalTableForm = {
|
6587 |
+
type: 'form',
|
6588 |
+
layout: 'flex',
|
6589 |
+
direction: 'column',
|
6590 |
+
labelGapCalc: 'children',
|
6591 |
+
padding: 0,
|
6592 |
+
items: [
|
6593 |
+
{
|
6594 |
+
type: 'form',
|
6595 |
+
labelGapCalc: false,
|
6596 |
+
padding: 0,
|
6597 |
+
layout: 'grid',
|
6598 |
+
columns: 2,
|
6599 |
+
defaults: {
|
6600 |
+
type: 'textbox',
|
6601 |
+
maxWidth: 50
|
6602 |
+
},
|
6603 |
+
items: hasAppearanceOptions(editor) ? [
|
6604 |
+
colsCtrl,
|
6605 |
+
rowsCtrl,
|
6606 |
+
{
|
6607 |
+
label: 'Width',
|
6608 |
+
name: 'width',
|
6609 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
6610 |
+
},
|
6611 |
+
{
|
6612 |
+
label: 'Height',
|
6613 |
+
name: 'height',
|
6614 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
6615 |
+
},
|
6616 |
+
{
|
6617 |
+
label: 'Cell spacing',
|
6618 |
+
name: 'cellspacing'
|
6619 |
+
},
|
6620 |
+
{
|
6621 |
+
label: 'Cell padding',
|
6622 |
+
name: 'cellpadding'
|
6623 |
+
},
|
6624 |
+
{
|
6625 |
+
label: 'Border',
|
6626 |
+
name: 'border'
|
6627 |
+
},
|
6628 |
+
{
|
6629 |
+
label: 'Caption',
|
6630 |
+
name: 'caption',
|
6631 |
+
type: 'checkbox'
|
6632 |
+
}
|
6633 |
+
] : [
|
6634 |
+
colsCtrl,
|
6635 |
+
rowsCtrl,
|
6636 |
+
{
|
6637 |
+
label: 'Width',
|
6638 |
+
name: 'width',
|
6639 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
6640 |
+
},
|
6641 |
+
{
|
6642 |
+
label: 'Height',
|
6643 |
+
name: 'height',
|
6644 |
+
onchange: curry($_fex2z1oujjgwedx4.updateStyleField, editor)
|
6645 |
+
}
|
6646 |
+
]
|
6647 |
+
},
|
6648 |
+
{
|
6649 |
+
label: 'Alignment',
|
6650 |
+
name: 'align',
|
6651 |
+
type: 'listbox',
|
6652 |
+
text: 'None',
|
6653 |
+
values: [
|
6654 |
+
{
|
6655 |
+
text: 'None',
|
6656 |
+
value: ''
|
6657 |
+
},
|
6658 |
+
{
|
6659 |
+
text: 'Left',
|
6660 |
+
value: 'left'
|
6661 |
+
},
|
6662 |
+
{
|
6663 |
+
text: 'Center',
|
6664 |
+
value: 'center'
|
6665 |
+
},
|
6666 |
+
{
|
6667 |
+
text: 'Right',
|
6668 |
+
value: 'right'
|
6669 |
+
}
|
6670 |
+
]
|
6671 |
+
},
|
6672 |
+
classListCtrl
|
6673 |
+
]
|
6674 |
};
|
6675 |
+
if (hasAdvancedTableTab(editor)) {
|
6676 |
+
editor.windowManager.open({
|
6677 |
+
title: 'Table properties',
|
6678 |
+
data: data,
|
6679 |
+
bodyType: 'tabpanel',
|
6680 |
+
body: [
|
6681 |
+
{
|
6682 |
+
title: 'General',
|
6683 |
+
type: 'form',
|
6684 |
+
items: generalTableForm
|
6685 |
+
},
|
6686 |
+
$_fex2z1oujjgwedx4.createStyleForm(editor)
|
6687 |
+
],
|
6688 |
+
onsubmit: curry(onSubmitTableForm, editor, tableElm)
|
6689 |
});
|
6690 |
+
} else {
|
6691 |
+
editor.windowManager.open({
|
6692 |
+
title: 'Table properties',
|
6693 |
+
data: data,
|
6694 |
+
body: generalTableForm,
|
6695 |
+
onsubmit: curry(onSubmitTableForm, editor, tableElm)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6696 |
});
|
6697 |
+
}
|
6698 |
+
};
|
6699 |
+
var $_c0uiorowjjgwedxk = { open: open$2 };
|
6700 |
+
|
6701 |
+
var each$3 = global$1.each;
|
6702 |
+
var registerCommands = function (editor, actions, cellSelection, selections, clipboardRows) {
|
6703 |
+
var isRoot = getIsRoot(editor);
|
6704 |
+
var eraseTable = function () {
|
6705 |
+
var cell = Element$$1.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
6706 |
+
var table = $_bmlvw1ldjjgwed84.table(cell, isRoot);
|
6707 |
+
table.filter(not(isRoot)).each(function (table) {
|
6708 |
+
var cursor = Element$$1.fromText('');
|
6709 |
+
$_1yoqsmmdjjgweddo.after(table, cursor);
|
6710 |
+
$_1y8qodmejjgweddq.remove(table);
|
6711 |
+
var rng = editor.dom.createRng();
|
6712 |
+
rng.setStart(cursor.dom(), 0);
|
6713 |
+
rng.setEnd(cursor.dom(), 0);
|
6714 |
+
editor.selection.setRng(rng);
|
6715 |
+
});
|
6716 |
+
};
|
6717 |
+
var getSelectionStartCell = function () {
|
6718 |
+
return Element$$1.fromDom(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
6719 |
+
};
|
6720 |
+
var getTableFromCell = function (cell) {
|
6721 |
+
return $_bmlvw1ldjjgwed84.table(cell, isRoot);
|
6722 |
+
};
|
6723 |
+
var getSize = function (table) {
|
6724 |
+
return {
|
6725 |
+
width: getPixelWidth$1(table.dom()),
|
6726 |
+
height: getPixelWidth$1(table.dom())
|
6727 |
+
};
|
6728 |
};
|
6729 |
+
var resizeChange = function (editor, oldSize, table) {
|
6730 |
+
var newSize = getSize(table);
|
6731 |
+
if (oldSize.width !== newSize.width || oldSize.height !== newSize.height) {
|
6732 |
+
fireObjectResizeStart(editor, table.dom(), oldSize.width, oldSize.height);
|
6733 |
+
fireObjectResized(editor, table.dom(), newSize.width, newSize.height);
|
6734 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6735 |
};
|
6736 |
+
var actOnSelection = function (execute) {
|
6737 |
+
var cell = getSelectionStartCell();
|
6738 |
+
var table = getTableFromCell(cell);
|
6739 |
+
table.each(function (table) {
|
6740 |
+
var targets = $_a5s279mnjjgwedff.forMenu(selections, table, cell);
|
6741 |
+
var beforeSize = getSize(table);
|
6742 |
+
execute(table, targets).each(function (rng) {
|
6743 |
+
resizeChange(editor, beforeSize, table);
|
6744 |
+
editor.selection.setRng(rng);
|
6745 |
+
editor.focus();
|
6746 |
+
cellSelection.clear(table);
|
6747 |
+
removeDataStyle(table);
|
6748 |
+
});
|
6749 |
});
|
6750 |
};
|
6751 |
+
var copyRowSelection = function (execute) {
|
6752 |
+
var cell = getSelectionStartCell();
|
6753 |
+
var table = getTableFromCell(cell);
|
6754 |
+
return table.bind(function (table) {
|
6755 |
+
var doc = Element$$1.fromDom(editor.getDoc());
|
6756 |
+
var targets = $_a5s279mnjjgwedff.forMenu(selections, table, cell);
|
6757 |
+
var generators = $_cne69smgjjgweddy.cellOperations(noop, doc, Option.none());
|
6758 |
+
return $_1cz66ioqjjgwedwq.copyRows(table, targets, generators);
|
6759 |
});
|
6760 |
};
|
6761 |
+
var pasteOnSelection = function (execute) {
|
6762 |
+
clipboardRows.get().each(function (rows) {
|
6763 |
+
var clonedRows = map(rows, function (row) {
|
6764 |
+
return $_ginehlmhjjgwedet.deep(row);
|
6765 |
+
});
|
6766 |
+
var cell = getSelectionStartCell();
|
6767 |
+
var table = getTableFromCell(cell);
|
6768 |
+
table.bind(function (table) {
|
6769 |
+
var doc = Element$$1.fromDom(editor.getDoc());
|
6770 |
+
var generators = $_cne69smgjjgweddy.paste(doc);
|
6771 |
+
var targets = $_a5s279mnjjgwedff.pasteRows(selections, table, cell, clonedRows, generators);
|
6772 |
+
execute(table, targets).each(function (rng) {
|
6773 |
+
editor.selection.setRng(rng);
|
6774 |
+
editor.focus();
|
6775 |
+
cellSelection.clear(table);
|
6776 |
+
});
|
6777 |
+
});
|
6778 |
});
|
6779 |
};
|
6780 |
+
each$3({
|
6781 |
+
mceTableSplitCells: function () {
|
6782 |
+
actOnSelection(actions.unmergeCells);
|
|
|
|
|
6783 |
},
|
6784 |
+
mceTableMergeCells: function () {
|
6785 |
+
actOnSelection(actions.mergeCells);
|
|
|
|
|
6786 |
},
|
6787 |
+
mceTableInsertRowBefore: function () {
|
6788 |
+
actOnSelection(actions.insertRowsBefore);
|
6789 |
+
},
|
6790 |
+
mceTableInsertRowAfter: function () {
|
6791 |
+
actOnSelection(actions.insertRowsAfter);
|
6792 |
+
},
|
6793 |
+
mceTableInsertColBefore: function () {
|
6794 |
+
actOnSelection(actions.insertColumnsBefore);
|
6795 |
+
},
|
6796 |
+
mceTableInsertColAfter: function () {
|
6797 |
+
actOnSelection(actions.insertColumnsAfter);
|
6798 |
+
},
|
6799 |
+
mceTableDeleteCol: function () {
|
6800 |
+
actOnSelection(actions.deleteColumn);
|
6801 |
+
},
|
6802 |
+
mceTableDeleteRow: function () {
|
6803 |
+
actOnSelection(actions.deleteRow);
|
6804 |
+
},
|
6805 |
+
mceTableCutRow: function (grid) {
|
6806 |
+
clipboardRows.set(copyRowSelection());
|
6807 |
+
actOnSelection(actions.deleteRow);
|
6808 |
+
},
|
6809 |
+
mceTableCopyRow: function (grid) {
|
6810 |
+
clipboardRows.set(copyRowSelection());
|
6811 |
+
},
|
6812 |
+
mceTablePasteRowBefore: function (grid) {
|
6813 |
+
pasteOnSelection(actions.pasteRowsBefore);
|
6814 |
+
},
|
6815 |
+
mceTablePasteRowAfter: function (grid) {
|
6816 |
+
pasteOnSelection(actions.pasteRowsAfter);
|
6817 |
+
},
|
6818 |
+
mceTableDelete: eraseTable
|
6819 |
+
}, function (func, name) {
|
6820 |
+
editor.addCommand(name, func);
|
6821 |
+
});
|
6822 |
+
each$3({
|
6823 |
+
mceInsertTable: curry($_c0uiorowjjgwedxk.open, editor),
|
6824 |
+
mceTableProps: curry($_c0uiorowjjgwedxk.open, editor, true),
|
6825 |
+
mceTableRowProps: curry($_39xpksovjjgwedxd.open, editor),
|
6826 |
+
mceTableCellProps: curry($_i574vosjjgwedwu.open, editor)
|
6827 |
+
}, function (func, name) {
|
6828 |
+
editor.addCommand(name, function (ui, val) {
|
6829 |
+
func(val);
|
6830 |
});
|
6831 |
+
});
|
6832 |
+
};
|
6833 |
+
var $_cnyxavopjjgwedw9 = { registerCommands: registerCommands };
|
6834 |
+
|
6835 |
+
var only$1 = function (element) {
|
6836 |
+
var parent = Option.from(element.dom().documentElement).map(Element$$1.fromDom).getOr(element);
|
6837 |
+
return {
|
6838 |
+
parent: constant(parent),
|
6839 |
+
view: constant(element),
|
6840 |
+
origin: constant(Position(0, 0))
|
6841 |
+
};
|
6842 |
+
};
|
6843 |
+
var detached = function (editable, chrome) {
|
6844 |
+
var origin = curry($_emicwtnfjjgwedml.absolute, chrome);
|
6845 |
+
return {
|
6846 |
+
parent: constant(chrome),
|
6847 |
+
view: constant(editable),
|
6848 |
+
origin: origin
|
6849 |
+
};
|
6850 |
+
};
|
6851 |
+
var body$1 = function (editable, chrome) {
|
6852 |
+
return {
|
6853 |
+
parent: constant(chrome),
|
6854 |
+
view: constant(editable),
|
6855 |
+
origin: constant(Position(0, 0))
|
6856 |
+
};
|
6857 |
+
};
|
6858 |
+
var $_6fstdvp3jjgwedz7 = {
|
6859 |
+
only: only$1,
|
6860 |
+
detached: detached,
|
6861 |
+
body: body$1
|
6862 |
+
};
|
6863 |
+
|
6864 |
+
function Event (fields) {
|
6865 |
+
var struct = Immutable.apply(null, fields);
|
6866 |
+
var handlers = [];
|
6867 |
+
var bind$$1 = function (handler) {
|
6868 |
+
if (handler === undefined) {
|
6869 |
+
throw 'Event bind error: undefined handler';
|
6870 |
+
}
|
6871 |
+
handlers.push(handler);
|
6872 |
};
|
6873 |
+
var unbind = function (handler) {
|
6874 |
+
handlers = filter(handlers, function (h) {
|
6875 |
+
return h !== handler;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6876 |
});
|
6877 |
};
|
6878 |
+
var trigger = function () {
|
6879 |
+
var event = struct.apply(null, arguments);
|
6880 |
+
each(handlers, function (handler) {
|
6881 |
+
handler(event);
|
6882 |
+
});
|
6883 |
};
|
6884 |
+
return {
|
6885 |
+
bind: bind$$1,
|
6886 |
+
unbind: unbind,
|
6887 |
+
trigger: trigger
|
6888 |
};
|
6889 |
+
}
|
6890 |
|
6891 |
+
var create = function (typeDefs) {
|
6892 |
+
var registry = map$1(typeDefs, function (event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6893 |
return {
|
6894 |
+
bind: event.bind,
|
6895 |
+
unbind: event.unbind
|
6896 |
};
|
6897 |
+
});
|
6898 |
+
var trigger = map$1(typeDefs, function (event) {
|
6899 |
+
return event.trigger;
|
6900 |
+
});
|
6901 |
+
return {
|
6902 |
+
registry: registry,
|
6903 |
+
trigger: trigger
|
6904 |
+
};
|
6905 |
+
};
|
6906 |
+
var $_a0n03hp6jjgwee01 = { create: create };
|
6907 |
+
|
6908 |
+
var mode = exactly([
|
6909 |
+
'compare',
|
6910 |
+
'extract',
|
6911 |
+
'mutate',
|
6912 |
+
'sink'
|
6913 |
+
]);
|
6914 |
+
var sink = exactly([
|
6915 |
+
'element',
|
6916 |
+
'start',
|
6917 |
+
'stop',
|
6918 |
+
'destroy'
|
6919 |
+
]);
|
6920 |
+
var api$3 = exactly([
|
6921 |
+
'forceDrop',
|
6922 |
+
'drop',
|
6923 |
+
'move',
|
6924 |
+
'delayDrop'
|
6925 |
+
]);
|
6926 |
+
var $_fzx0ozpajjgwee1b = {
|
6927 |
+
mode: mode,
|
6928 |
+
sink: sink,
|
6929 |
+
api: api$3
|
6930 |
+
};
|
6931 |
+
|
6932 |
+
var styles$1 = css('ephox-dragster');
|
6933 |
+
var $_gdibacpcjjgwee1u = { resolve: styles$1.resolve };
|
6934 |
+
|
6935 |
+
function Blocker (options) {
|
6936 |
+
var settings = merge$1({ 'layerClass': $_gdibacpcjjgwee1u.resolve('blocker') }, options);
|
6937 |
+
var div = Element$$1.fromTag('div');
|
6938 |
+
$_72hn9pm2jjgwedbq.set(div, 'role', 'presentation');
|
6939 |
+
$_59neaymbjjgwedd8.setAll(div, {
|
6940 |
+
position: 'fixed',
|
6941 |
+
left: '0px',
|
6942 |
+
top: '0px',
|
6943 |
+
width: '100%',
|
6944 |
+
height: '100%'
|
6945 |
+
});
|
6946 |
+
$_btizb5o3jjgwedsg.add(div, $_gdibacpcjjgwee1u.resolve('blocker'));
|
6947 |
+
$_btizb5o3jjgwedsg.add(div, settings.layerClass);
|
6948 |
+
var element = function () {
|
6949 |
+
return div;
|
6950 |
+
};
|
6951 |
+
var destroy = function () {
|
6952 |
+
$_1y8qodmejjgweddq.remove(div);
|
6953 |
+
};
|
6954 |
+
return {
|
6955 |
+
element: element,
|
6956 |
+
destroy: destroy
|
6957 |
+
};
|
6958 |
+
}
|
6959 |
+
|
6960 |
+
var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
|
6961 |
+
return {
|
6962 |
+
'target': constant(target),
|
6963 |
+
'x': constant(x),
|
6964 |
+
'y': constant(y),
|
6965 |
+
'stop': stop,
|
6966 |
+
'prevent': prevent,
|
6967 |
+
'kill': kill,
|
6968 |
+
'raw': constant(raw)
|
6969 |
+
};
|
6970 |
+
};
|
6971 |
+
var handle = function (filter, handler) {
|
6972 |
+
return function (rawEvent) {
|
6973 |
+
if (!filter(rawEvent))
|
6974 |
+
return;
|
6975 |
+
var target = Element$$1.fromDom(rawEvent.target);
|
6976 |
+
var stop = function () {
|
6977 |
+
rawEvent.stopPropagation();
|
6978 |
+
};
|
6979 |
+
var prevent = function () {
|
6980 |
+
rawEvent.preventDefault();
|
6981 |
+
};
|
6982 |
+
var kill = compose(prevent, stop);
|
6983 |
+
var evt = mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
|
6984 |
+
handler(evt);
|
6985 |
+
};
|
6986 |
+
};
|
6987 |
+
var binder = function (element, event, filter, handler, useCapture) {
|
6988 |
+
var wrapped = handle(filter, handler);
|
6989 |
+
element.dom().addEventListener(event, wrapped, useCapture);
|
6990 |
+
return { unbind: curry(unbind, element, event, wrapped, useCapture) };
|
6991 |
+
};
|
6992 |
+
var bind$1 = function (element, event, filter, handler) {
|
6993 |
+
return binder(element, event, filter, handler, false);
|
6994 |
+
};
|
6995 |
+
var capture = function (element, event, filter, handler) {
|
6996 |
+
return binder(element, event, filter, handler, true);
|
6997 |
+
};
|
6998 |
+
var unbind = function (element, event, handler, useCapture) {
|
6999 |
+
element.dom().removeEventListener(event, handler, useCapture);
|
7000 |
+
};
|
7001 |
+
var $_b75tmfpejjgwee20 = {
|
7002 |
+
bind: bind$1,
|
7003 |
+
capture: capture
|
7004 |
+
};
|
7005 |
+
|
7006 |
+
var filter$1 = constant(true);
|
7007 |
+
var bind$2 = function (element, event, handler) {
|
7008 |
+
return $_b75tmfpejjgwee20.bind(element, event, filter$1, handler);
|
7009 |
+
};
|
7010 |
+
var capture$1 = function (element, event, handler) {
|
7011 |
+
return $_b75tmfpejjgwee20.capture(element, event, filter$1, handler);
|
7012 |
+
};
|
7013 |
+
var $_b2tdiypdjjgwee1x = {
|
7014 |
+
bind: bind$2,
|
7015 |
+
capture: capture$1
|
7016 |
+
};
|
7017 |
+
|
7018 |
+
var compare = function (old, nu) {
|
7019 |
+
return Position(nu.left() - old.left(), nu.top() - old.top());
|
7020 |
+
};
|
7021 |
+
var extract$1 = function (event) {
|
7022 |
+
return Option.some(Position(event.x(), event.y()));
|
7023 |
+
};
|
7024 |
+
var mutate$1 = function (mutation, info) {
|
7025 |
+
mutation.mutate(info.left(), info.top());
|
7026 |
+
};
|
7027 |
+
var sink$1 = function (dragApi, settings) {
|
7028 |
+
var blocker = Blocker(settings);
|
7029 |
+
var mdown = $_b2tdiypdjjgwee1x.bind(blocker.element(), 'mousedown', dragApi.forceDrop);
|
7030 |
+
var mup = $_b2tdiypdjjgwee1x.bind(blocker.element(), 'mouseup', dragApi.drop);
|
7031 |
+
var mmove = $_b2tdiypdjjgwee1x.bind(blocker.element(), 'mousemove', dragApi.move);
|
7032 |
+
var mout = $_b2tdiypdjjgwee1x.bind(blocker.element(), 'mouseout', dragApi.delayDrop);
|
7033 |
+
var destroy = function () {
|
7034 |
+
blocker.destroy();
|
7035 |
+
mup.unbind();
|
7036 |
+
mmove.unbind();
|
7037 |
+
mout.unbind();
|
7038 |
+
mdown.unbind();
|
7039 |
+
};
|
7040 |
+
var start = function (parent) {
|
7041 |
+
$_1yoqsmmdjjgweddo.append(parent, blocker.element());
|
7042 |
+
};
|
7043 |
+
var stop = function () {
|
7044 |
+
$_1y8qodmejjgweddq.remove(blocker.element());
|
7045 |
+
};
|
7046 |
+
return $_fzx0ozpajjgwee1b.sink({
|
7047 |
+
element: blocker.element,
|
7048 |
+
start: start,
|
7049 |
+
stop: stop,
|
7050 |
+
destroy: destroy
|
7051 |
+
});
|
7052 |
+
};
|
7053 |
+
var MouseDrag = $_fzx0ozpajjgwee1b.mode({
|
7054 |
+
compare: compare,
|
7055 |
+
extract: extract$1,
|
7056 |
+
sink: sink$1,
|
7057 |
+
mutate: mutate$1
|
7058 |
+
});
|
7059 |
+
|
7060 |
+
function InDrag () {
|
7061 |
+
var previous = Option.none();
|
7062 |
+
var reset = function () {
|
7063 |
+
previous = Option.none();
|
7064 |
+
};
|
7065 |
+
var update = function (mode, nu) {
|
7066 |
+
var result = previous.map(function (old) {
|
7067 |
+
return mode.compare(old, nu);
|
7068 |
+
});
|
7069 |
+
previous = Option.some(nu);
|
7070 |
+
return result;
|
7071 |
};
|
7072 |
+
var onEvent = function (event, mode) {
|
7073 |
+
var dataOption = mode.extract(event);
|
7074 |
+
dataOption.each(function (data) {
|
7075 |
+
var offset = update(mode, data);
|
7076 |
+
offset.each(function (d) {
|
7077 |
+
events.trigger.move(d);
|
7078 |
+
});
|
7079 |
+
});
|
7080 |
};
|
7081 |
+
var events = $_a0n03hp6jjgwee01.create({ move: Event(['info']) });
|
7082 |
+
return {
|
7083 |
+
onEvent: onEvent,
|
7084 |
+
reset: reset,
|
7085 |
+
events: events.registry
|
|
|
|
|
|
|
|
|
|
|
7086 |
};
|
7087 |
+
}
|
7088 |
|
7089 |
+
function NoDrag (anchor) {
|
7090 |
+
var onEvent = function (event, mode) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7091 |
};
|
7092 |
+
return {
|
7093 |
+
onEvent: onEvent,
|
7094 |
+
reset: noop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7095 |
};
|
7096 |
+
}
|
7097 |
|
7098 |
+
function Movement () {
|
7099 |
+
var noDragState = NoDrag();
|
7100 |
+
var inDragState = InDrag();
|
7101 |
+
var dragState = noDragState;
|
7102 |
+
var on = function () {
|
7103 |
+
dragState.reset();
|
7104 |
+
dragState = inDragState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7105 |
};
|
7106 |
+
var off = function () {
|
7107 |
+
dragState.reset();
|
7108 |
+
dragState = noDragState;
|
7109 |
};
|
7110 |
+
var onEvent = function (event, mode) {
|
7111 |
+
dragState.onEvent(event, mode);
|
|
|
|
|
|
|
|
|
|
|
7112 |
};
|
7113 |
+
var isOn = function () {
|
7114 |
+
return dragState === inDragState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7115 |
};
|
7116 |
+
return {
|
7117 |
+
on: on,
|
7118 |
+
off: off,
|
7119 |
+
isOn: isOn,
|
7120 |
+
onEvent: onEvent,
|
7121 |
+
events: inDragState.events
|
7122 |
+
};
|
7123 |
+
}
|
7124 |
+
|
7125 |
+
var last$3 = function (fn, rate) {
|
7126 |
+
var timer = null;
|
7127 |
+
var cancel = function () {
|
7128 |
+
if (timer !== null) {
|
7129 |
+
clearTimeout(timer);
|
7130 |
+
timer = null;
|
7131 |
+
}
|
7132 |
};
|
7133 |
+
var throttle = function () {
|
7134 |
+
var args = [];
|
7135 |
+
for (var _i = 0; _i < arguments.length; _i++) {
|
7136 |
+
args[_i] = arguments[_i];
|
7137 |
+
}
|
7138 |
+
if (timer !== null)
|
7139 |
+
clearTimeout(timer);
|
7140 |
+
timer = setTimeout(function () {
|
7141 |
+
fn.apply(null, args);
|
7142 |
+
timer = null;
|
7143 |
+
}, rate);
|
7144 |
+
};
|
7145 |
+
return {
|
7146 |
+
cancel: cancel,
|
7147 |
+
throttle: throttle
|
7148 |
+
};
|
7149 |
+
};
|
7150 |
+
|
7151 |
+
var setup = function (mutation, mode, settings) {
|
7152 |
+
var active = false;
|
7153 |
+
var events = $_a0n03hp6jjgwee01.create({
|
7154 |
+
start: Event([]),
|
7155 |
+
stop: Event([])
|
7156 |
+
});
|
7157 |
+
var movement = Movement();
|
7158 |
+
var drop = function () {
|
7159 |
+
sink.stop();
|
7160 |
+
if (movement.isOn()) {
|
7161 |
+
movement.off();
|
7162 |
+
events.trigger.stop();
|
7163 |
+
}
|
7164 |
};
|
7165 |
+
var throttledDrop = last$3(drop, 200);
|
7166 |
+
var go = function (parent) {
|
7167 |
+
sink.start(parent);
|
7168 |
+
movement.on();
|
7169 |
+
events.trigger.start();
|
7170 |
};
|
7171 |
+
var mousemove = function (event, ui) {
|
7172 |
+
throttledDrop.cancel();
|
7173 |
+
movement.onEvent(event, mode);
|
7174 |
};
|
7175 |
+
movement.events.move.bind(function (event) {
|
7176 |
+
mode.mutate(mutation, event.info());
|
7177 |
+
});
|
7178 |
+
var on = function () {
|
7179 |
+
active = true;
|
7180 |
};
|
7181 |
+
var off = function () {
|
7182 |
+
active = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7183 |
};
|
7184 |
+
var runIfActive = function (f) {
|
7185 |
+
return function () {
|
7186 |
+
var args = Array.prototype.slice.call(arguments, 0);
|
7187 |
+
if (active) {
|
7188 |
+
return f.apply(null, args);
|
7189 |
+
}
|
7190 |
+
};
|
7191 |
};
|
7192 |
+
var sink = mode.sink($_fzx0ozpajjgwee1b.api({
|
7193 |
+
forceDrop: drop,
|
7194 |
+
drop: runIfActive(drop),
|
7195 |
+
move: runIfActive(mousemove),
|
7196 |
+
delayDrop: runIfActive(throttledDrop.throttle)
|
7197 |
+
}), settings);
|
7198 |
+
var destroy = function () {
|
7199 |
+
sink.destroy();
|
7200 |
};
|
7201 |
+
return {
|
7202 |
+
element: sink.element,
|
7203 |
+
go: go,
|
7204 |
+
on: on,
|
7205 |
+
off: off,
|
7206 |
+
destroy: destroy,
|
7207 |
+
events: events.registry
|
7208 |
+
};
|
7209 |
+
};
|
7210 |
+
var $_e6j9k7pfjjgwee25 = { setup: setup };
|
7211 |
+
|
7212 |
+
var transform$1 = function (mutation, options) {
|
7213 |
+
var settings = options !== undefined ? options : {};
|
7214 |
+
var mode = settings.mode !== undefined ? settings.mode : MouseDrag;
|
7215 |
+
return $_e6j9k7pfjjgwee25.setup(mutation, mode, options);
|
7216 |
+
};
|
7217 |
+
var $_2jnhotp8jjgwee0z = { transform: transform$1 };
|
7218 |
+
|
7219 |
+
function Mutation () {
|
7220 |
+
var events = $_a0n03hp6jjgwee01.create({
|
7221 |
+
'drag': Event([
|
7222 |
+
'xDelta',
|
7223 |
+
'yDelta'
|
7224 |
+
])
|
7225 |
+
});
|
7226 |
+
var mutate = function (x, y) {
|
7227 |
+
events.trigger.drag(x, y);
|
7228 |
+
};
|
7229 |
+
return {
|
7230 |
+
mutate: mutate,
|
7231 |
+
events: events.registry
|
7232 |
+
};
|
7233 |
+
}
|
7234 |
+
|
7235 |
+
function BarMutation () {
|
7236 |
+
var events = $_a0n03hp6jjgwee01.create({
|
7237 |
+
drag: Event([
|
7238 |
+
'xDelta',
|
7239 |
+
'yDelta',
|
7240 |
+
'target'
|
7241 |
+
])
|
7242 |
+
});
|
7243 |
+
var target = Option.none();
|
7244 |
+
var delegate = Mutation();
|
7245 |
+
delegate.events.drag.bind(function (event) {
|
7246 |
+
target.each(function (t) {
|
7247 |
+
events.trigger.drag(event.xDelta(), event.yDelta(), t);
|
7248 |
});
|
7249 |
+
});
|
7250 |
+
var assign = function (t) {
|
7251 |
+
target = Option.some(t);
|
7252 |
+
};
|
7253 |
+
var get = function () {
|
7254 |
+
return target;
|
7255 |
+
};
|
7256 |
+
return {
|
7257 |
+
assign: assign,
|
7258 |
+
get: get,
|
7259 |
+
mutate: delegate.mutate,
|
7260 |
+
events: events.registry
|
7261 |
+
};
|
7262 |
+
}
|
7263 |
+
|
7264 |
+
var any = function (selector) {
|
7265 |
+
return $_2e7p77m7jjgwedcg.first(selector).isSome();
|
7266 |
+
};
|
7267 |
+
var ancestor$2 = function (scope, selector, isRoot) {
|
7268 |
+
return $_2e7p77m7jjgwedcg.ancestor(scope, selector, isRoot).isSome();
|
7269 |
+
};
|
7270 |
+
var sibling$2 = function (scope, selector) {
|
7271 |
+
return $_2e7p77m7jjgwedcg.sibling(scope, selector).isSome();
|
7272 |
+
};
|
7273 |
+
var child$3 = function (scope, selector) {
|
7274 |
+
return $_2e7p77m7jjgwedcg.child(scope, selector).isSome();
|
7275 |
+
};
|
7276 |
+
var descendant$2 = function (scope, selector) {
|
7277 |
+
return $_2e7p77m7jjgwedcg.descendant(scope, selector).isSome();
|
7278 |
+
};
|
7279 |
+
var closest$2 = function (scope, selector, isRoot) {
|
7280 |
+
return $_2e7p77m7jjgwedcg.closest(scope, selector, isRoot).isSome();
|
7281 |
+
};
|
7282 |
+
var $_61rv34pmjjgwee34 = {
|
7283 |
+
any: any,
|
7284 |
+
ancestor: ancestor$2,
|
7285 |
+
sibling: sibling$2,
|
7286 |
+
child: child$3,
|
7287 |
+
descendant: descendant$2,
|
7288 |
+
closest: closest$2
|
7289 |
+
};
|
7290 |
+
|
7291 |
+
var resizeBarDragging = $_a7mbdxo1jjgwedsc.resolve('resizer-bar-dragging');
|
7292 |
+
function BarManager (wire, direction, hdirection) {
|
7293 |
+
var mutation = BarMutation();
|
7294 |
+
var resizing = $_2jnhotp8jjgwee0z.transform(mutation, {});
|
7295 |
+
var hoverTable = Option.none();
|
7296 |
+
var getResizer = function (element, type) {
|
7297 |
+
return Option.from($_72hn9pm2jjgwedbq.get(element, type));
|
7298 |
+
};
|
7299 |
+
mutation.events.drag.bind(function (event) {
|
7300 |
+
getResizer(event.target(), 'data-row').each(function (_dataRow) {
|
7301 |
+
var currentRow = $_6gfmi1ohjjgweduu.getInt(event.target(), 'top');
|
7302 |
+
$_59neaymbjjgwedd8.set(event.target(), 'top', currentRow + event.yDelta() + 'px');
|
7303 |
+
});
|
7304 |
+
getResizer(event.target(), 'data-column').each(function (_dataCol) {
|
7305 |
+
var currentCol = $_6gfmi1ohjjgweduu.getInt(event.target(), 'left');
|
7306 |
+
$_59neaymbjjgwedd8.set(event.target(), 'left', currentCol + event.xDelta() + 'px');
|
7307 |
});
|
7308 |
+
});
|
7309 |
+
var getDelta = function (target, direction) {
|
7310 |
+
var newX = $_6gfmi1ohjjgweduu.getInt(target, direction);
|
7311 |
+
var oldX = parseInt($_72hn9pm2jjgwedbq.get(target, 'data-initial-' + direction), 10);
|
7312 |
+
return newX - oldX;
|
7313 |
+
};
|
7314 |
+
resizing.events.stop.bind(function () {
|
7315 |
+
mutation.get().each(function (target) {
|
7316 |
+
hoverTable.each(function (table) {
|
7317 |
+
getResizer(target, 'data-row').each(function (row) {
|
7318 |
+
var delta = getDelta(target, 'top');
|
7319 |
+
$_72hn9pm2jjgwedbq.remove(target, 'data-initial-top');
|
7320 |
+
events.trigger.adjustHeight(table, delta, parseInt(row, 10));
|
7321 |
});
|
7322 |
+
getResizer(target, 'data-column').each(function (column) {
|
7323 |
+
var delta = getDelta(target, 'left');
|
7324 |
+
$_72hn9pm2jjgwedbq.remove(target, 'data-initial-left');
|
7325 |
+
events.trigger.adjustWidth(table, delta, parseInt(column, 10));
|
7326 |
+
});
|
7327 |
+
$_anyrprnxjjgwedqz.refresh(wire, table, hdirection, direction);
|
7328 |
});
|
7329 |
});
|
7330 |
+
});
|
7331 |
+
var handler = function (target, direction) {
|
7332 |
+
events.trigger.startAdjust();
|
7333 |
+
mutation.assign(target);
|
7334 |
+
$_72hn9pm2jjgwedbq.set(target, 'data-initial-' + direction, parseInt($_59neaymbjjgwedd8.get(target, direction), 10));
|
7335 |
+
$_btizb5o3jjgwedsg.add(target, resizeBarDragging);
|
7336 |
+
$_59neaymbjjgwedd8.set(target, 'opacity', '0.2');
|
7337 |
+
resizing.go(wire.parent());
|
7338 |
+
};
|
7339 |
+
var mousedown = $_b2tdiypdjjgwee1x.bind(wire.parent(), 'mousedown', function (event) {
|
7340 |
+
if ($_anyrprnxjjgwedqz.isRowBar(event.target()))
|
7341 |
+
handler(event.target(), 'top');
|
7342 |
+
if ($_anyrprnxjjgwedqz.isColBar(event.target()))
|
7343 |
+
handler(event.target(), 'left');
|
7344 |
+
});
|
7345 |
+
var isRoot = function (e) {
|
7346 |
+
return $_e1yh5slljjgwedae.eq(e, wire.view());
|
7347 |
+
};
|
7348 |
+
var mouseover = $_b2tdiypdjjgwee1x.bind(wire.view(), 'mouseover', function (event) {
|
7349 |
+
if ($_g6duvbm3jjgwedby.name(event.target()) === 'table' || $_61rv34pmjjgwee34.closest(event.target(), 'table', isRoot)) {
|
7350 |
+
hoverTable = $_g6duvbm3jjgwedby.name(event.target()) === 'table' ? Option.some(event.target()) : $_2e7p77m7jjgwedcg.ancestor(event.target(), 'table', isRoot);
|
7351 |
+
hoverTable.each(function (ht) {
|
7352 |
+
$_anyrprnxjjgwedqz.refresh(wire, ht, hdirection, direction);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7353 |
});
|
7354 |
+
} else if ($_95kxntm6jjgwedc6.inBody(event.target())) {
|
7355 |
+
$_anyrprnxjjgwedqz.destroy(wire);
|
7356 |
+
}
|
7357 |
+
});
|
7358 |
+
var destroy = function () {
|
7359 |
+
mousedown.unbind();
|
7360 |
+
mouseover.unbind();
|
7361 |
+
resizing.destroy();
|
7362 |
+
$_anyrprnxjjgwedqz.destroy(wire);
|
7363 |
+
};
|
7364 |
+
var refresh = function (tbl) {
|
7365 |
+
$_anyrprnxjjgwedqz.refresh(wire, tbl, hdirection, direction);
|
7366 |
+
};
|
7367 |
+
var events = $_a0n03hp6jjgwee01.create({
|
7368 |
+
adjustHeight: Event([
|
7369 |
+
'table',
|
7370 |
+
'delta',
|
7371 |
+
'row'
|
7372 |
+
]),
|
7373 |
+
adjustWidth: Event([
|
7374 |
+
'table',
|
7375 |
+
'delta',
|
7376 |
+
'column'
|
7377 |
+
]),
|
7378 |
+
startAdjust: Event([])
|
7379 |
+
});
|
7380 |
+
return {
|
7381 |
+
destroy: destroy,
|
7382 |
+
refresh: refresh,
|
7383 |
+
on: resizing.on,
|
7384 |
+
off: resizing.off,
|
7385 |
+
hideBars: curry($_anyrprnxjjgwedqz.hide, wire),
|
7386 |
+
showBars: curry($_anyrprnxjjgwedqz.show, wire),
|
7387 |
+
events: events.registry
|
7388 |
+
};
|
7389 |
+
}
|
7390 |
+
|
7391 |
+
function TableResize (wire, vdirection) {
|
7392 |
+
var hdirection = $_fsi6i6nejjgwedm2.height;
|
7393 |
+
var manager = BarManager(wire, vdirection, hdirection);
|
7394 |
+
var events = $_a0n03hp6jjgwee01.create({
|
7395 |
+
beforeResize: Event(['table']),
|
7396 |
+
afterResize: Event(['table']),
|
7397 |
+
startDrag: Event([])
|
7398 |
+
});
|
7399 |
+
manager.events.adjustHeight.bind(function (event) {
|
7400 |
+
events.trigger.beforeResize(event.table());
|
7401 |
+
var delta = hdirection.delta(event.delta(), event.table());
|
7402 |
+
$_5zl29zodjjgwedu6.adjustHeight(event.table(), delta, event.row(), hdirection);
|
7403 |
+
events.trigger.afterResize(event.table());
|
7404 |
+
});
|
7405 |
+
manager.events.startAdjust.bind(function (event) {
|
7406 |
+
events.trigger.startDrag();
|
7407 |
+
});
|
7408 |
+
manager.events.adjustWidth.bind(function (event) {
|
7409 |
+
events.trigger.beforeResize(event.table());
|
7410 |
+
var delta = vdirection.delta(event.delta(), event.table());
|
7411 |
+
$_5zl29zodjjgwedu6.adjustWidth(event.table(), delta, event.column(), vdirection);
|
7412 |
+
events.trigger.afterResize(event.table());
|
7413 |
+
});
|
7414 |
+
return {
|
7415 |
+
on: manager.on,
|
7416 |
+
off: manager.off,
|
7417 |
+
hideBars: manager.hideBars,
|
7418 |
+
showBars: manager.showBars,
|
7419 |
+
destroy: manager.destroy,
|
7420 |
+
events: events.registry
|
7421 |
+
};
|
7422 |
+
}
|
7423 |
+
|
7424 |
+
var createContainer = function () {
|
7425 |
+
var container = Element$$1.fromTag('div');
|
7426 |
+
$_59neaymbjjgwedd8.setAll(container, {
|
7427 |
+
position: 'static',
|
7428 |
+
height: '0',
|
7429 |
+
width: '0',
|
7430 |
+
padding: '0',
|
7431 |
+
margin: '0',
|
7432 |
+
border: '0'
|
7433 |
+
});
|
7434 |
+
$_1yoqsmmdjjgweddo.append($_95kxntm6jjgwedc6.body(), container);
|
7435 |
+
return container;
|
7436 |
+
};
|
7437 |
+
var get$8 = function (editor, container) {
|
7438 |
+
return editor.inline ? $_6fstdvp3jjgwedz7.body(getBody$1(editor), createContainer()) : $_6fstdvp3jjgwedz7.only(Element$$1.fromDom(editor.getDoc()));
|
7439 |
+
};
|
7440 |
+
var remove$6 = function (editor, wire) {
|
7441 |
+
if (editor.inline) {
|
7442 |
+
$_1y8qodmejjgweddq.remove(wire.parent());
|
7443 |
+
}
|
7444 |
+
};
|
7445 |
+
var $_bcpe2qpnjjgwee36 = {
|
7446 |
+
get: get$8,
|
7447 |
+
remove: remove$6
|
7448 |
+
};
|
7449 |
+
|
7450 |
+
var ResizeHandler = function (editor) {
|
7451 |
+
var selectionRng = Option.none();
|
7452 |
+
var resize = Option.none();
|
7453 |
+
var wire = Option.none();
|
7454 |
+
var percentageBasedSizeRegex = /(\d+(\.\d+)?)%/;
|
7455 |
+
var startW, startRawW;
|
7456 |
+
var isTable = function (elm) {
|
7457 |
+
return elm.nodeName === 'TABLE';
|
7458 |
};
|
7459 |
+
var getRawWidth = function (elm) {
|
7460 |
+
return editor.dom.getStyle(elm, 'width') || editor.dom.getAttrib(elm, 'width');
|
|
|
|
|
7461 |
};
|
7462 |
+
var lazyResize = function () {
|
7463 |
+
return resize;
|
|
|
|
|
|
|
|
|
|
|
7464 |
};
|
7465 |
+
var lazyWire = function () {
|
7466 |
+
return wire.getOr($_6fstdvp3jjgwedz7.only(Element$$1.fromDom(editor.getBody())));
|
|
|
|
|
7467 |
};
|
7468 |
+
var destroy = function () {
|
7469 |
+
resize.each(function (sz) {
|
7470 |
+
sz.destroy();
|
7471 |
});
|
7472 |
+
wire.each(function (w) {
|
7473 |
+
$_bcpe2qpnjjgwee36.remove(editor, w);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7474 |
});
|
7475 |
};
|
7476 |
+
editor.on('init', function () {
|
7477 |
+
var direction = TableDirection($_dowdxdoljjgwedvp.directionAt);
|
7478 |
+
var rawWire = $_bcpe2qpnjjgwee36.get(editor);
|
7479 |
+
wire = Option.some(rawWire);
|
7480 |
+
if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {
|
7481 |
+
var sz = TableResize(rawWire, direction);
|
7482 |
+
sz.on();
|
7483 |
+
sz.events.startDrag.bind(function (event) {
|
7484 |
+
selectionRng = Option.some(editor.selection.getRng());
|
|
|
|
|
|
|
|
|
|
|
7485 |
});
|
7486 |
+
sz.events.beforeResize.bind(function (event) {
|
7487 |
+
var rawTable = event.table().dom();
|
7488 |
+
fireObjectResizeStart(editor, rawTable, getPixelWidth$1(rawTable), getPixelHeight(rawTable));
|
7489 |
+
});
|
7490 |
+
sz.events.afterResize.bind(function (event) {
|
7491 |
+
var table = event.table();
|
7492 |
+
var rawTable = table.dom();
|
7493 |
+
removeDataStyle(table);
|
7494 |
+
selectionRng.each(function (rng) {
|
7495 |
+
editor.selection.setRng(rng);
|
7496 |
+
editor.focus();
|
7497 |
});
|
7498 |
+
fireObjectResized(editor, rawTable, getPixelWidth$1(rawTable), getPixelHeight(rawTable));
|
7499 |
+
editor.undoManager.add();
|
7500 |
});
|
7501 |
+
resize = Option.some(sz);
|
7502 |
}
|
7503 |
+
});
|
7504 |
+
editor.on('ObjectResizeStart', function (e) {
|
7505 |
+
var targetElm = e.target;
|
7506 |
+
if (isTable(targetElm)) {
|
7507 |
+
startW = e.width;
|
7508 |
+
startRawW = getRawWidth(targetElm);
|
7509 |
+
}
|
7510 |
+
});
|
7511 |
+
editor.on('ObjectResized', function (e) {
|
7512 |
+
var targetElm = e.target;
|
7513 |
+
if (isTable(targetElm)) {
|
7514 |
+
var table = targetElm;
|
7515 |
+
if (percentageBasedSizeRegex.test(startRawW)) {
|
7516 |
+
var percentW = parseFloat(percentageBasedSizeRegex.exec(startRawW)[1]);
|
7517 |
+
var targetPercentW = e.width * percentW / startW;
|
7518 |
+
editor.dom.setStyle(table, 'width', targetPercentW + '%');
|
7519 |
+
} else {
|
7520 |
+
var newCellSizes_1 = [];
|
7521 |
+
global$1.each(table.rows, function (row) {
|
7522 |
+
global$1.each(row.cells, function (cell) {
|
7523 |
+
var width = editor.dom.getStyle(cell, 'width', true);
|
7524 |
+
newCellSizes_1.push({
|
7525 |
+
cell: cell,
|
7526 |
+
width: width
|
7527 |
+
});
|
7528 |
});
|
7529 |
+
});
|
7530 |
+
global$1.each(newCellSizes_1, function (newCellSize) {
|
7531 |
+
editor.dom.setStyle(newCellSize.cell, 'width', newCellSize.width);
|
7532 |
+
editor.dom.setAttrib(newCellSize.cell, 'width', null);
|
7533 |
+
});
|
7534 |
+
}
|
7535 |
+
}
|
7536 |
+
});
|
7537 |
+
return {
|
7538 |
+
lazyResize: lazyResize,
|
7539 |
+
lazyWire: lazyWire,
|
7540 |
+
destroy: destroy
|
7541 |
};
|
7542 |
+
};
|
7543 |
+
|
7544 |
+
var none$2 = function (current) {
|
7545 |
+
return folder$1(function (n, f, m, l) {
|
7546 |
+
return n(current);
|
7547 |
+
});
|
7548 |
+
};
|
7549 |
+
var first$5 = function (current) {
|
7550 |
+
return folder$1(function (n, f, m, l) {
|
7551 |
+
return f(current);
|
7552 |
+
});
|
7553 |
+
};
|
7554 |
+
var middle$1 = function (current, target) {
|
7555 |
+
return folder$1(function (n, f, m, l) {
|
7556 |
+
return m(current, target);
|
7557 |
+
});
|
7558 |
+
};
|
7559 |
+
var last$4 = function (current) {
|
7560 |
+
return folder$1(function (n, f, m, l) {
|
7561 |
+
return l(current);
|
7562 |
+
});
|
7563 |
+
};
|
7564 |
+
var folder$1 = function (fold) {
|
7565 |
+
return { fold: fold };
|
7566 |
+
};
|
7567 |
+
var $_fd56gwpqjjgwee4c = {
|
7568 |
+
none: none$2,
|
7569 |
+
first: first$5,
|
7570 |
+
middle: middle$1,
|
7571 |
+
last: last$4
|
7572 |
+
};
|
7573 |
+
|
7574 |
+
var detect$4 = function (current, isRoot) {
|
7575 |
+
return $_bmlvw1ldjjgwed84.table(current, isRoot).bind(function (table) {
|
7576 |
+
var all = $_bmlvw1ldjjgwed84.cells(table);
|
7577 |
+
var index = findIndex(all, function (x) {
|
7578 |
+
return $_e1yh5slljjgwedae.eq(current, x);
|
7579 |
});
|
7580 |
+
return index.map(function (ind) {
|
7581 |
+
return {
|
7582 |
+
index: constant(ind),
|
7583 |
+
all: constant(all)
|
7584 |
+
};
|
7585 |
});
|
7586 |
+
});
|
7587 |
+
};
|
7588 |
+
var next = function (current, isRoot) {
|
7589 |
+
var detection = detect$4(current, isRoot);
|
7590 |
+
return detection.fold(function () {
|
7591 |
+
return $_fd56gwpqjjgwee4c.none(current);
|
7592 |
+
}, function (info) {
|
7593 |
+
return info.index() + 1 < info.all().length ? $_fd56gwpqjjgwee4c.middle(current, info.all()[info.index() + 1]) : $_fd56gwpqjjgwee4c.last(current);
|
7594 |
+
});
|
7595 |
+
};
|
7596 |
+
var prev = function (current, isRoot) {
|
7597 |
+
var detection = detect$4(current, isRoot);
|
7598 |
+
return detection.fold(function () {
|
7599 |
+
return $_fd56gwpqjjgwee4c.none();
|
7600 |
+
}, function (info) {
|
7601 |
+
return info.index() - 1 >= 0 ? $_fd56gwpqjjgwee4c.middle(current, info.all()[info.index() - 1]) : $_fd56gwpqjjgwee4c.first(current);
|
7602 |
+
});
|
7603 |
+
};
|
7604 |
+
var $_37sftsppjjgwee45 = {
|
7605 |
+
next: next,
|
7606 |
+
prev: prev
|
7607 |
+
};
|
7608 |
+
|
7609 |
+
var adt = Adt.generate([
|
7610 |
+
{ 'before': ['element'] },
|
7611 |
+
{
|
7612 |
+
'on': [
|
7613 |
+
'element',
|
7614 |
+
'offset'
|
7615 |
+
]
|
7616 |
+
},
|
7617 |
+
{ after: ['element'] }
|
7618 |
+
]);
|
7619 |
+
var cata$1 = function (subject, onBefore, onOn, onAfter) {
|
7620 |
+
return subject.fold(onBefore, onOn, onAfter);
|
7621 |
+
};
|
7622 |
+
var getStart = function (situ) {
|
7623 |
+
return situ.fold(identity, identity, identity);
|
7624 |
+
};
|
7625 |
+
var $_6assppsjjgwee4k = {
|
7626 |
+
before: adt.before,
|
7627 |
+
on: adt.on,
|
7628 |
+
after: adt.after,
|
7629 |
+
cata: cata$1,
|
7630 |
+
getStart: getStart
|
7631 |
+
};
|
7632 |
+
|
7633 |
+
var type$2 = Adt.generate([
|
7634 |
+
{ domRange: ['rng'] },
|
7635 |
+
{
|
7636 |
+
relative: [
|
7637 |
+
'startSitu',
|
7638 |
+
'finishSitu'
|
7639 |
+
]
|
7640 |
+
},
|
7641 |
+
{
|
7642 |
+
exact: [
|
7643 |
+
'start',
|
7644 |
+
'soffset',
|
7645 |
+
'finish',
|
7646 |
+
'foffset'
|
7647 |
+
]
|
7648 |
}
|
7649 |
+
]);
|
7650 |
+
var range$2 = Immutable('start', 'soffset', 'finish', 'foffset');
|
7651 |
+
var exactFromRange = function (simRange) {
|
7652 |
+
return type$2.exact(simRange.start(), simRange.soffset(), simRange.finish(), simRange.foffset());
|
7653 |
+
};
|
7654 |
+
var getStart$1 = function (selection) {
|
7655 |
+
return selection.match({
|
7656 |
+
domRange: function (rng) {
|
7657 |
+
return Element$$1.fromDom(rng.startContainer);
|
7658 |
},
|
7659 |
+
relative: function (startSitu, finishSitu) {
|
7660 |
+
return $_6assppsjjgwee4k.getStart(startSitu);
|
7661 |
+
},
|
7662 |
+
exact: function (start, soffset, finish, foffset) {
|
7663 |
+
return start;
|
|
|
|
|
7664 |
}
|
7665 |
+
});
|
7666 |
+
};
|
7667 |
+
var getWin = function (selection) {
|
7668 |
+
var start = getStart$1(selection);
|
7669 |
+
return $_97vsilljjjgwed9v.defaultView(start);
|
7670 |
+
};
|
7671 |
+
var $_afru5jprjjgwee4e = {
|
7672 |
+
domRange: type$2.domRange,
|
7673 |
+
relative: type$2.relative,
|
7674 |
+
exact: type$2.exact,
|
7675 |
+
exactFromRange: exactFromRange,
|
7676 |
+
range: range$2,
|
7677 |
+
getWin: getWin
|
7678 |
+
};
|
7679 |
+
|
7680 |
+
var makeRange = function (start, soffset, finish, foffset) {
|
7681 |
+
var doc = $_97vsilljjjgwed9v.owner(start);
|
7682 |
+
var rng = doc.dom().createRange();
|
7683 |
+
rng.setStart(start.dom(), soffset);
|
7684 |
+
rng.setEnd(finish.dom(), foffset);
|
7685 |
+
return rng;
|
7686 |
+
};
|
7687 |
+
var commonAncestorContainer = function (start, soffset, finish, foffset) {
|
7688 |
+
var r = makeRange(start, soffset, finish, foffset);
|
7689 |
+
return Element$$1.fromDom(r.commonAncestorContainer);
|
7690 |
+
};
|
7691 |
+
var after$2 = function (start, soffset, finish, foffset) {
|
7692 |
+
var r = makeRange(start, soffset, finish, foffset);
|
7693 |
+
var same = $_e1yh5slljjgwedae.eq(start, finish) && soffset === foffset;
|
7694 |
+
return r.collapsed && !same;
|
7695 |
+
};
|
7696 |
+
var $_10rk8wpujjgwee4x = {
|
7697 |
+
after: after$2,
|
7698 |
+
commonAncestorContainer: commonAncestorContainer
|
7699 |
+
};
|
7700 |
+
|
7701 |
+
var fromElements = function (elements, scope) {
|
7702 |
+
var doc = scope || document;
|
7703 |
+
var fragment = doc.createDocumentFragment();
|
7704 |
+
each(elements, function (element) {
|
7705 |
+
fragment.appendChild(element.dom());
|
7706 |
+
});
|
7707 |
+
return Element$$1.fromDom(fragment);
|
7708 |
+
};
|
7709 |
+
var $_aous4opvjjgwee4z = { fromElements: fromElements };
|
7710 |
+
|
7711 |
+
var selectNodeContents = function (win, element) {
|
7712 |
+
var rng = win.document.createRange();
|
7713 |
+
selectNodeContentsUsing(rng, element);
|
7714 |
+
return rng;
|
7715 |
+
};
|
7716 |
+
var selectNodeContentsUsing = function (rng, element) {
|
7717 |
+
rng.selectNodeContents(element.dom());
|
7718 |
+
};
|
7719 |
+
var isWithin$1 = function (outerRange, innerRange) {
|
7720 |
+
return innerRange.compareBoundaryPoints(outerRange.END_TO_START, outerRange) < 1 && innerRange.compareBoundaryPoints(outerRange.START_TO_END, outerRange) > -1;
|
7721 |
+
};
|
7722 |
+
var create$1 = function (win) {
|
7723 |
+
return win.document.createRange();
|
7724 |
+
};
|
7725 |
+
var setStart = function (rng, situ) {
|
7726 |
+
situ.fold(function (e) {
|
7727 |
+
rng.setStartBefore(e.dom());
|
7728 |
+
}, function (e, o) {
|
7729 |
+
rng.setStart(e.dom(), o);
|
7730 |
+
}, function (e) {
|
7731 |
+
rng.setStartAfter(e.dom());
|
7732 |
+
});
|
7733 |
+
};
|
7734 |
+
var setFinish = function (rng, situ) {
|
7735 |
+
situ.fold(function (e) {
|
7736 |
+
rng.setEndBefore(e.dom());
|
7737 |
+
}, function (e, o) {
|
7738 |
+
rng.setEnd(e.dom(), o);
|
7739 |
+
}, function (e) {
|
7740 |
+
rng.setEndAfter(e.dom());
|
7741 |
+
});
|
7742 |
+
};
|
7743 |
+
var replaceWith = function (rng, fragment) {
|
7744 |
+
deleteContents(rng);
|
7745 |
+
rng.insertNode(fragment.dom());
|
7746 |
+
};
|
7747 |
+
var relativeToNative = function (win, startSitu, finishSitu) {
|
7748 |
+
var range = win.document.createRange();
|
7749 |
+
setStart(range, startSitu);
|
7750 |
+
setFinish(range, finishSitu);
|
7751 |
+
return range;
|
7752 |
+
};
|
7753 |
+
var exactToNative = function (win, start, soffset, finish, foffset) {
|
7754 |
+
var rng = win.document.createRange();
|
7755 |
+
rng.setStart(start.dom(), soffset);
|
7756 |
+
rng.setEnd(finish.dom(), foffset);
|
7757 |
+
return rng;
|
7758 |
+
};
|
7759 |
+
var deleteContents = function (rng) {
|
7760 |
+
rng.deleteContents();
|
7761 |
+
};
|
7762 |
+
var cloneFragment = function (rng) {
|
7763 |
+
var fragment = rng.cloneContents();
|
7764 |
+
return Element$$1.fromDom(fragment);
|
7765 |
+
};
|
7766 |
+
var toRect = function (rect) {
|
7767 |
+
return {
|
7768 |
+
left: constant(rect.left),
|
7769 |
+
top: constant(rect.top),
|
7770 |
+
right: constant(rect.right),
|
7771 |
+
bottom: constant(rect.bottom),
|
7772 |
+
width: constant(rect.width),
|
7773 |
+
height: constant(rect.height)
|
7774 |
+
};
|
7775 |
+
};
|
7776 |
+
var getFirstRect = function (rng) {
|
7777 |
+
var rects = rng.getClientRects();
|
7778 |
+
var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect();
|
7779 |
+
return rect.width > 0 || rect.height > 0 ? Option.some(rect).map(toRect) : Option.none();
|
7780 |
+
};
|
7781 |
+
var getBounds$1 = function (rng) {
|
7782 |
+
var rect = rng.getBoundingClientRect();
|
7783 |
+
return rect.width > 0 || rect.height > 0 ? Option.some(rect).map(toRect) : Option.none();
|
7784 |
+
};
|
7785 |
+
var toString = function (rng) {
|
7786 |
+
return rng.toString();
|
7787 |
+
};
|
7788 |
+
var $_fwf7cnpwjjgwee53 = {
|
7789 |
+
create: create$1,
|
7790 |
+
replaceWith: replaceWith,
|
7791 |
+
selectNodeContents: selectNodeContents,
|
7792 |
+
selectNodeContentsUsing: selectNodeContentsUsing,
|
7793 |
+
relativeToNative: relativeToNative,
|
7794 |
+
exactToNative: exactToNative,
|
7795 |
+
deleteContents: deleteContents,
|
7796 |
+
cloneFragment: cloneFragment,
|
7797 |
+
getFirstRect: getFirstRect,
|
7798 |
+
getBounds: getBounds$1,
|
7799 |
+
isWithin: isWithin$1,
|
7800 |
+
toString: toString
|
7801 |
+
};
|
7802 |
+
|
7803 |
+
var adt$1 = Adt.generate([
|
7804 |
+
{
|
7805 |
+
ltr: [
|
7806 |
+
'start',
|
7807 |
+
'soffset',
|
7808 |
+
'finish',
|
7809 |
+
'foffset'
|
7810 |
+
]
|
7811 |
+
},
|
7812 |
+
{
|
7813 |
+
rtl: [
|
7814 |
+
'start',
|
7815 |
+
'soffset',
|
7816 |
+
'finish',
|
7817 |
+
'foffset'
|
7818 |
+
]
|
7819 |
+
}
|
7820 |
+
]);
|
7821 |
+
var fromRange = function (win, type, range) {
|
7822 |
+
return type(Element$$1.fromDom(range.startContainer), range.startOffset, Element$$1.fromDom(range.endContainer), range.endOffset);
|
7823 |
+
};
|
7824 |
+
var getRanges = function (win, selection) {
|
7825 |
+
return selection.match({
|
7826 |
+
domRange: function (rng) {
|
7827 |
+
return {
|
7828 |
+
ltr: constant(rng),
|
7829 |
+
rtl: Option.none
|
7830 |
+
};
|
7831 |
+
},
|
7832 |
+
relative: function (startSitu, finishSitu) {
|
7833 |
+
return {
|
7834 |
+
ltr: cached(function () {
|
7835 |
+
return $_fwf7cnpwjjgwee53.relativeToNative(win, startSitu, finishSitu);
|
7836 |
+
}),
|
7837 |
+
rtl: cached(function () {
|
7838 |
+
return Option.some($_fwf7cnpwjjgwee53.relativeToNative(win, finishSitu, startSitu));
|
7839 |
+
})
|
7840 |
+
};
|
7841 |
+
},
|
7842 |
+
exact: function (start, soffset, finish, foffset) {
|
7843 |
+
return {
|
7844 |
+
ltr: cached(function () {
|
7845 |
+
return $_fwf7cnpwjjgwee53.exactToNative(win, start, soffset, finish, foffset);
|
7846 |
+
}),
|
7847 |
+
rtl: cached(function () {
|
7848 |
+
return Option.some($_fwf7cnpwjjgwee53.exactToNative(win, finish, foffset, start, soffset));
|
7849 |
+
})
|
7850 |
+
};
|
7851 |
+
}
|
7852 |
+
});
|
7853 |
+
};
|
7854 |
+
var doDiagnose = function (win, ranges) {
|
7855 |
+
var rng = ranges.ltr();
|
7856 |
+
if (rng.collapsed) {
|
7857 |
+
var reversed = ranges.rtl().filter(function (rev) {
|
7858 |
+
return rev.collapsed === false;
|
7859 |
+
});
|
7860 |
+
return reversed.map(function (rev) {
|
7861 |
+
return adt$1.rtl(Element$$1.fromDom(rev.endContainer), rev.endOffset, Element$$1.fromDom(rev.startContainer), rev.startOffset);
|
7862 |
+
}).getOrThunk(function () {
|
7863 |
+
return fromRange(win, adt$1.ltr, rng);
|
7864 |
+
});
|
7865 |
+
} else {
|
7866 |
+
return fromRange(win, adt$1.ltr, rng);
|
7867 |
+
}
|
7868 |
+
};
|
7869 |
+
var diagnose = function (win, selection) {
|
7870 |
+
var ranges = getRanges(win, selection);
|
7871 |
+
return doDiagnose(win, ranges);
|
7872 |
+
};
|
7873 |
+
var asLtrRange = function (win, selection) {
|
7874 |
+
var diagnosis = diagnose(win, selection);
|
7875 |
+
return diagnosis.match({
|
7876 |
+
ltr: function (start, soffset, finish, foffset) {
|
7877 |
+
var rng = win.document.createRange();
|
7878 |
+
rng.setStart(start.dom(), soffset);
|
7879 |
+
rng.setEnd(finish.dom(), foffset);
|
7880 |
+
return rng;
|
7881 |
+
},
|
7882 |
+
rtl: function (start, soffset, finish, foffset) {
|
7883 |
+
var rng = win.document.createRange();
|
7884 |
+
rng.setStart(finish.dom(), foffset);
|
7885 |
+
rng.setEnd(start.dom(), soffset);
|
7886 |
+
return rng;
|
7887 |
+
}
|
7888 |
+
});
|
7889 |
+
};
|
7890 |
+
var $_5s2zljpxjjgwee5b = {
|
7891 |
+
ltr: adt$1.ltr,
|
7892 |
+
rtl: adt$1.rtl,
|
7893 |
+
diagnose: diagnose,
|
7894 |
+
asLtrRange: asLtrRange
|
7895 |
+
};
|
7896 |
+
|
7897 |
+
var searchForPoint = function (rectForOffset, x, y, maxX, length) {
|
7898 |
+
if (length === 0)
|
7899 |
+
return 0;
|
7900 |
+
else if (x === maxX)
|
7901 |
+
return length - 1;
|
7902 |
+
var xDelta = maxX;
|
7903 |
+
for (var i = 1; i < length; i++) {
|
7904 |
+
var rect = rectForOffset(i);
|
7905 |
+
var curDeltaX = Math.abs(x - rect.left);
|
7906 |
+
if (y <= rect.bottom) {
|
7907 |
+
if (y < rect.top || curDeltaX > xDelta) {
|
7908 |
+
return i - 1;
|
7909 |
+
} else {
|
7910 |
+
xDelta = curDeltaX;
|
7911 |
+
}
|
7912 |
+
}
|
7913 |
+
}
|
7914 |
+
return 0;
|
7915 |
+
};
|
7916 |
+
var inRect = function (rect, x, y) {
|
7917 |
+
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
7918 |
+
};
|
7919 |
+
var $_czh05dq0jjgwee61 = {
|
7920 |
+
inRect: inRect,
|
7921 |
+
searchForPoint: searchForPoint
|
7922 |
+
};
|
7923 |
+
|
7924 |
+
var locateOffset = function (doc, textnode, x, y, rect) {
|
7925 |
+
var rangeForOffset = function (offset) {
|
7926 |
+
var r = doc.dom().createRange();
|
7927 |
+
r.setStart(textnode.dom(), offset);
|
7928 |
+
r.collapse(true);
|
7929 |
+
return r;
|
7930 |
};
|
7931 |
+
var rectForOffset = function (offset) {
|
7932 |
+
var r = rangeForOffset(offset);
|
7933 |
+
return r.getBoundingClientRect();
|
7934 |
+
};
|
7935 |
+
var length = $_btltedmkjjgwedf4.get(textnode).length;
|
7936 |
+
var offset = $_czh05dq0jjgwee61.searchForPoint(rectForOffset, x, y, rect.right, length);
|
7937 |
+
return rangeForOffset(offset);
|
7938 |
+
};
|
7939 |
+
var locate = function (doc, node, x, y) {
|
7940 |
+
var r = doc.dom().createRange();
|
7941 |
+
r.selectNode(node.dom());
|
7942 |
+
var rects = r.getClientRects();
|
7943 |
+
var foundRect = findMap(rects, function (rect) {
|
7944 |
+
return $_czh05dq0jjgwee61.inRect(rect, x, y) ? Option.some(rect) : Option.none();
|
7945 |
+
});
|
7946 |
+
return foundRect.map(function (rect) {
|
7947 |
+
return locateOffset(doc, node, x, y, rect);
|
7948 |
+
});
|
7949 |
+
};
|
7950 |
+
var $_fau798q1jjgwee62 = { locate: locate };
|
7951 |
+
|
7952 |
+
var searchInChildren = function (doc, node, x, y) {
|
7953 |
+
var r = doc.dom().createRange();
|
7954 |
+
var nodes = $_97vsilljjjgwed9v.children(node);
|
7955 |
+
return findMap(nodes, function (n) {
|
7956 |
+
r.selectNode(n.dom());
|
7957 |
+
return $_czh05dq0jjgwee61.inRect(r.getBoundingClientRect(), x, y) ? locateNode(doc, n, x, y) : Option.none();
|
7958 |
+
});
|
7959 |
+
};
|
7960 |
+
var locateNode = function (doc, node, x, y) {
|
7961 |
+
var locator = $_g6duvbm3jjgwedby.isText(node) ? $_fau798q1jjgwee62.locate : searchInChildren;
|
7962 |
+
return locator(doc, node, x, y);
|
7963 |
+
};
|
7964 |
+
var locate$1 = function (doc, node, x, y) {
|
7965 |
+
var r = doc.dom().createRange();
|
7966 |
+
r.selectNode(node.dom());
|
7967 |
+
var rect = r.getBoundingClientRect();
|
7968 |
+
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
7969 |
+
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
7970 |
+
return locateNode(doc, node, boundedX, boundedY);
|
7971 |
+
};
|
7972 |
+
var $_8hmrc5pzjjgwee5v = { locate: locate$1 };
|
7973 |
+
|
7974 |
+
var COLLAPSE_TO_LEFT = true;
|
7975 |
+
var COLLAPSE_TO_RIGHT = false;
|
7976 |
+
var getCollapseDirection = function (rect, x) {
|
7977 |
+
return x - rect.left < rect.right - x ? COLLAPSE_TO_LEFT : COLLAPSE_TO_RIGHT;
|
7978 |
+
};
|
7979 |
+
var createCollapsedNode = function (doc, target, collapseDirection) {
|
7980 |
+
var r = doc.dom().createRange();
|
7981 |
+
r.selectNode(target.dom());
|
7982 |
+
r.collapse(collapseDirection);
|
7983 |
+
return r;
|
7984 |
+
};
|
7985 |
+
var locateInElement = function (doc, node, x) {
|
7986 |
+
var cursorRange = doc.dom().createRange();
|
7987 |
+
cursorRange.selectNode(node.dom());
|
7988 |
+
var rect = cursorRange.getBoundingClientRect();
|
7989 |
+
var collapseDirection = getCollapseDirection(rect, x);
|
7990 |
+
var f = collapseDirection === COLLAPSE_TO_LEFT ? $_cww1bpmijjgwedex.first : $_cww1bpmijjgwedex.last;
|
7991 |
+
return f(node).map(function (target) {
|
7992 |
+
return createCollapsedNode(doc, target, collapseDirection);
|
7993 |
+
});
|
7994 |
+
};
|
7995 |
+
var locateInEmpty = function (doc, node, x) {
|
7996 |
+
var rect = node.dom().getBoundingClientRect();
|
7997 |
+
var collapseDirection = getCollapseDirection(rect, x);
|
7998 |
+
return Option.some(createCollapsedNode(doc, node, collapseDirection));
|
7999 |
+
};
|
8000 |
+
var search = function (doc, node, x) {
|
8001 |
+
var f = $_97vsilljjjgwed9v.children(node).length === 0 ? locateInEmpty : locateInElement;
|
8002 |
+
return f(doc, node, x);
|
8003 |
+
};
|
8004 |
+
var $_d2n08oq2jjgwee68 = { search: search };
|
8005 |
+
|
8006 |
+
var caretPositionFromPoint = function (doc, x, y) {
|
8007 |
+
return Option.from(doc.dom().caretPositionFromPoint(x, y)).bind(function (pos) {
|
8008 |
+
if (pos.offsetNode === null)
|
8009 |
return Option.none();
|
8010 |
+
var r = doc.dom().createRange();
|
8011 |
+
r.setStart(pos.offsetNode, pos.offset);
|
8012 |
+
r.collapse();
|
8013 |
+
return Option.some(r);
|
8014 |
+
});
|
8015 |
+
};
|
8016 |
+
var caretRangeFromPoint = function (doc, x, y) {
|
8017 |
+
return Option.from(doc.dom().caretRangeFromPoint(x, y));
|
8018 |
+
};
|
8019 |
+
var searchTextNodes = function (doc, node, x, y) {
|
8020 |
+
var r = doc.dom().createRange();
|
8021 |
+
r.selectNode(node.dom());
|
8022 |
+
var rect = r.getBoundingClientRect();
|
8023 |
+
var boundedX = Math.max(rect.left, Math.min(rect.right, x));
|
8024 |
+
var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));
|
8025 |
+
return $_8hmrc5pzjjgwee5v.locate(doc, node, boundedX, boundedY);
|
8026 |
+
};
|
8027 |
+
var searchFromPoint = function (doc, x, y) {
|
8028 |
+
return Element$$1.fromPoint(doc, x, y).bind(function (elem) {
|
8029 |
+
var fallback = function () {
|
8030 |
+
return $_d2n08oq2jjgwee68.search(doc, elem, x);
|
8031 |
+
};
|
8032 |
+
return $_97vsilljjjgwed9v.children(elem).length === 0 ? fallback() : searchTextNodes(doc, elem, x, y).orThunk(fallback);
|
8033 |
+
});
|
8034 |
+
};
|
8035 |
+
var availableSearch = document.caretPositionFromPoint ? caretPositionFromPoint : document.caretRangeFromPoint ? caretRangeFromPoint : searchFromPoint;
|
8036 |
+
var fromPoint$1 = function (win, x, y) {
|
8037 |
+
var doc = Element$$1.fromDom(win.document);
|
8038 |
+
return availableSearch(doc, x, y).map(function (rng) {
|
8039 |
+
return $_afru5jprjjgwee4e.range(Element$$1.fromDom(rng.startContainer), rng.startOffset, Element$$1.fromDom(rng.endContainer), rng.endOffset);
|
8040 |
+
});
|
8041 |
+
};
|
8042 |
+
var $_ox0jupyjjgwee5r = { fromPoint: fromPoint$1 };
|
8043 |
+
|
8044 |
+
var withinContainer = function (win, ancestor, outerRange, selector) {
|
8045 |
+
var innerRange = $_fwf7cnpwjjgwee53.create(win);
|
8046 |
+
var self = $_5htea7lfjjgwed94.is(ancestor, selector) ? [ancestor] : [];
|
8047 |
+
var elements = self.concat($_5ko5j3m4jjgwedc0.descendants(ancestor, selector));
|
8048 |
+
return filter(elements, function (elem) {
|
8049 |
+
$_fwf7cnpwjjgwee53.selectNodeContentsUsing(innerRange, elem);
|
8050 |
+
return $_fwf7cnpwjjgwee53.isWithin(outerRange, innerRange);
|
8051 |
+
});
|
8052 |
+
};
|
8053 |
+
var find$3 = function (win, selection, selector) {
|
8054 |
+
var outerRange = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8055 |
+
var ancestor = Element$$1.fromDom(outerRange.commonAncestorContainer);
|
8056 |
+
return $_g6duvbm3jjgwedby.isElement(ancestor) ? withinContainer(win, ancestor, outerRange, selector) : [];
|
8057 |
+
};
|
8058 |
+
var $_dyll96q3jjgwee6c = { find: find$3 };
|
8059 |
+
|
8060 |
+
var beforeSpecial = function (element, offset) {
|
8061 |
+
var name = $_g6duvbm3jjgwedby.name(element);
|
8062 |
+
if ('input' === name)
|
8063 |
+
return $_6assppsjjgwee4k.after(element);
|
8064 |
+
else if (!contains([
|
8065 |
+
'br',
|
8066 |
+
'img'
|
8067 |
+
], name))
|
8068 |
+
return $_6assppsjjgwee4k.on(element, offset);
|
8069 |
+
else
|
8070 |
+
return offset === 0 ? $_6assppsjjgwee4k.before(element) : $_6assppsjjgwee4k.after(element);
|
8071 |
+
};
|
8072 |
+
var preprocessRelative = function (startSitu, finishSitu) {
|
8073 |
+
var start = startSitu.fold($_6assppsjjgwee4k.before, beforeSpecial, $_6assppsjjgwee4k.after);
|
8074 |
+
var finish = finishSitu.fold($_6assppsjjgwee4k.before, beforeSpecial, $_6assppsjjgwee4k.after);
|
8075 |
+
return $_afru5jprjjgwee4e.relative(start, finish);
|
8076 |
+
};
|
8077 |
+
var preprocessExact = function (start, soffset, finish, foffset) {
|
8078 |
+
var startSitu = beforeSpecial(start, soffset);
|
8079 |
+
var finishSitu = beforeSpecial(finish, foffset);
|
8080 |
+
return $_afru5jprjjgwee4e.relative(startSitu, finishSitu);
|
8081 |
+
};
|
8082 |
+
var preprocess = function (selection) {
|
8083 |
+
return selection.match({
|
8084 |
+
domRange: function (rng) {
|
8085 |
+
var start = Element$$1.fromDom(rng.startContainer);
|
8086 |
+
var finish = Element$$1.fromDom(rng.endContainer);
|
8087 |
+
return preprocessExact(start, rng.startOffset, finish, rng.endOffset);
|
8088 |
+
},
|
8089 |
+
relative: preprocessRelative,
|
8090 |
+
exact: preprocessExact
|
8091 |
+
});
|
8092 |
+
};
|
8093 |
+
var $_6b8yzzq4jjgwee6g = {
|
8094 |
+
beforeSpecial: beforeSpecial,
|
8095 |
+
preprocess: preprocess,
|
8096 |
+
preprocessRelative: preprocessRelative,
|
8097 |
+
preprocessExact: preprocessExact
|
8098 |
+
};
|
8099 |
+
|
8100 |
+
var doSetNativeRange = function (win, rng) {
|
8101 |
+
Option.from(win.getSelection()).each(function (selection) {
|
8102 |
+
selection.removeAllRanges();
|
8103 |
+
selection.addRange(rng);
|
8104 |
+
});
|
8105 |
+
};
|
8106 |
+
var doSetRange = function (win, start, soffset, finish, foffset) {
|
8107 |
+
var rng = $_fwf7cnpwjjgwee53.exactToNative(win, start, soffset, finish, foffset);
|
8108 |
+
doSetNativeRange(win, rng);
|
8109 |
+
};
|
8110 |
+
var findWithin = function (win, selection, selector) {
|
8111 |
+
return $_dyll96q3jjgwee6c.find(win, selection, selector);
|
8112 |
+
};
|
8113 |
+
var setLegacyRtlRange = function (win, selection, start, soffset, finish, foffset) {
|
8114 |
+
selection.collapse(start.dom(), soffset);
|
8115 |
+
selection.extend(finish.dom(), foffset);
|
8116 |
+
};
|
8117 |
+
var setRangeFromRelative = function (win, relative) {
|
8118 |
+
return $_5s2zljpxjjgwee5b.diagnose(win, relative).match({
|
8119 |
+
ltr: function (start, soffset, finish, foffset) {
|
8120 |
+
doSetRange(win, start, soffset, finish, foffset);
|
8121 |
+
},
|
8122 |
+
rtl: function (start, soffset, finish, foffset) {
|
8123 |
+
var selection = win.getSelection();
|
8124 |
+
if (selection.setBaseAndExtent) {
|
8125 |
+
selection.setBaseAndExtent(start.dom(), soffset, finish.dom(), foffset);
|
8126 |
+
} else if (selection.extend) {
|
8127 |
+
try {
|
8128 |
+
setLegacyRtlRange(win, selection, start, soffset, finish, foffset);
|
8129 |
+
} catch (e) {
|
8130 |
+
doSetRange(win, finish, foffset, start, soffset);
|
8131 |
}
|
8132 |
+
} else {
|
8133 |
+
doSetRange(win, finish, foffset, start, soffset);
|
8134 |
+
}
|
8135 |
+
}
|
8136 |
+
});
|
8137 |
+
};
|
8138 |
+
var setExact = function (win, start, soffset, finish, foffset) {
|
8139 |
+
var relative = $_6b8yzzq4jjgwee6g.preprocessExact(start, soffset, finish, foffset);
|
8140 |
+
setRangeFromRelative(win, relative);
|
8141 |
+
};
|
8142 |
+
var setRelative = function (win, startSitu, finishSitu) {
|
8143 |
+
var relative = $_6b8yzzq4jjgwee6g.preprocessRelative(startSitu, finishSitu);
|
8144 |
+
setRangeFromRelative(win, relative);
|
8145 |
+
};
|
8146 |
+
var toNative = function (selection) {
|
8147 |
+
var win = $_afru5jprjjgwee4e.getWin(selection).dom();
|
8148 |
+
var getDomRange = function (start, soffset, finish, foffset) {
|
8149 |
+
return $_fwf7cnpwjjgwee53.exactToNative(win, start, soffset, finish, foffset);
|
8150 |
+
};
|
8151 |
+
var filtered = $_6b8yzzq4jjgwee6g.preprocess(selection);
|
8152 |
+
return $_5s2zljpxjjgwee5b.diagnose(win, filtered).match({
|
8153 |
+
ltr: getDomRange,
|
8154 |
+
rtl: getDomRange
|
8155 |
+
});
|
8156 |
+
};
|
8157 |
+
var readRange = function (selection) {
|
8158 |
+
if (selection.rangeCount > 0) {
|
8159 |
+
var firstRng = selection.getRangeAt(0);
|
8160 |
+
var lastRng = selection.getRangeAt(selection.rangeCount - 1);
|
8161 |
+
return Option.some($_afru5jprjjgwee4e.range(Element$$1.fromDom(firstRng.startContainer), firstRng.startOffset, Element$$1.fromDom(lastRng.endContainer), lastRng.endOffset));
|
8162 |
+
} else {
|
8163 |
+
return Option.none();
|
8164 |
+
}
|
8165 |
+
};
|
8166 |
+
var doGetExact = function (selection) {
|
8167 |
+
var anchorNode = Element$$1.fromDom(selection.anchorNode);
|
8168 |
+
var focusNode = Element$$1.fromDom(selection.focusNode);
|
8169 |
+
return $_10rk8wpujjgwee4x.after(anchorNode, selection.anchorOffset, focusNode, selection.focusOffset) ? Option.some($_afru5jprjjgwee4e.range(Element$$1.fromDom(selection.anchorNode), selection.anchorOffset, Element$$1.fromDom(selection.focusNode), selection.focusOffset)) : readRange(selection);
|
8170 |
+
};
|
8171 |
+
var setToElement = function (win, element) {
|
8172 |
+
var rng = $_fwf7cnpwjjgwee53.selectNodeContents(win, element);
|
8173 |
+
doSetNativeRange(win, rng);
|
8174 |
+
};
|
8175 |
+
var forElement = function (win, element) {
|
8176 |
+
var rng = $_fwf7cnpwjjgwee53.selectNodeContents(win, element);
|
8177 |
+
return $_afru5jprjjgwee4e.range(Element$$1.fromDom(rng.startContainer), rng.startOffset, Element$$1.fromDom(rng.endContainer), rng.endOffset);
|
8178 |
+
};
|
8179 |
+
var getExact = function (win) {
|
8180 |
+
return Option.from(win.getSelection()).filter(function (sel) {
|
8181 |
+
return sel.rangeCount > 0;
|
8182 |
+
}).bind(doGetExact);
|
8183 |
+
};
|
8184 |
+
var get$9 = function (win) {
|
8185 |
+
return getExact(win).map(function (range) {
|
8186 |
+
return $_afru5jprjjgwee4e.exact(range.start(), range.soffset(), range.finish(), range.foffset());
|
8187 |
+
});
|
8188 |
+
};
|
8189 |
+
var getFirstRect$1 = function (win, selection) {
|
8190 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8191 |
+
return $_fwf7cnpwjjgwee53.getFirstRect(rng);
|
8192 |
+
};
|
8193 |
+
var getBounds$2 = function (win, selection) {
|
8194 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8195 |
+
return $_fwf7cnpwjjgwee53.getBounds(rng);
|
8196 |
+
};
|
8197 |
+
var getAtPoint = function (win, x, y) {
|
8198 |
+
return $_ox0jupyjjgwee5r.fromPoint(win, x, y);
|
8199 |
+
};
|
8200 |
+
var getAsString = function (win, selection) {
|
8201 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8202 |
+
return $_fwf7cnpwjjgwee53.toString(rng);
|
8203 |
+
};
|
8204 |
+
var clear$1 = function (win) {
|
8205 |
+
var selection = win.getSelection();
|
8206 |
+
selection.removeAllRanges();
|
8207 |
+
};
|
8208 |
+
var clone$2 = function (win, selection) {
|
8209 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8210 |
+
return $_fwf7cnpwjjgwee53.cloneFragment(rng);
|
8211 |
+
};
|
8212 |
+
var replace$1 = function (win, selection, elements) {
|
8213 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8214 |
+
var fragment = $_aous4opvjjgwee4z.fromElements(elements, win.document);
|
8215 |
+
$_fwf7cnpwjjgwee53.replaceWith(rng, fragment);
|
8216 |
+
};
|
8217 |
+
var deleteAt = function (win, selection) {
|
8218 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8219 |
+
$_fwf7cnpwjjgwee53.deleteContents(rng);
|
8220 |
+
};
|
8221 |
+
var isCollapsed = function (start, soffset, finish, foffset) {
|
8222 |
+
return $_e1yh5slljjgwedae.eq(start, finish) && soffset === foffset;
|
8223 |
+
};
|
8224 |
+
var $_biw8ebptjjgwee4r = {
|
8225 |
+
setExact: setExact,
|
8226 |
+
getExact: getExact,
|
8227 |
+
get: get$9,
|
8228 |
+
setRelative: setRelative,
|
8229 |
+
toNative: toNative,
|
8230 |
+
setToElement: setToElement,
|
8231 |
+
clear: clear$1,
|
8232 |
+
clone: clone$2,
|
8233 |
+
replace: replace$1,
|
8234 |
+
deleteAt: deleteAt,
|
8235 |
+
forElement: forElement,
|
8236 |
+
getFirstRect: getFirstRect$1,
|
8237 |
+
getBounds: getBounds$2,
|
8238 |
+
getAtPoint: getAtPoint,
|
8239 |
+
findWithin: findWithin,
|
8240 |
+
getAsString: getAsString,
|
8241 |
+
isCollapsed: isCollapsed
|
8242 |
+
};
|
8243 |
+
|
8244 |
+
var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
8245 |
+
|
8246 |
+
var forward = function (editor, isRoot, cell, lazyWire) {
|
8247 |
+
return go(editor, isRoot, $_37sftsppjjgwee45.next(cell), lazyWire);
|
8248 |
+
};
|
8249 |
+
var backward = function (editor, isRoot, cell, lazyWire) {
|
8250 |
+
return go(editor, isRoot, $_37sftsppjjgwee45.prev(cell), lazyWire);
|
8251 |
+
};
|
8252 |
+
var getCellFirstCursorPosition = function (editor, cell) {
|
8253 |
+
var selection = $_afru5jprjjgwee4e.exact(cell, 0, cell, 0);
|
8254 |
+
return $_biw8ebptjjgwee4r.toNative(selection);
|
8255 |
+
};
|
8256 |
+
var getNewRowCursorPosition = function (editor, table) {
|
8257 |
+
var rows = $_5ko5j3m4jjgwedc0.descendants(table, 'tr');
|
8258 |
+
return last(rows).bind(function (last$$1) {
|
8259 |
+
return $_2e7p77m7jjgwedcg.descendant(last$$1, 'td,th').map(function (first) {
|
8260 |
+
return getCellFirstCursorPosition(editor, first);
|
8261 |
+
});
|
8262 |
+
});
|
8263 |
+
};
|
8264 |
+
var go = function (editor, isRoot, cell, actions, lazyWire) {
|
8265 |
+
return cell.fold(Option.none, Option.none, function (current, next) {
|
8266 |
+
return $_cww1bpmijjgwedex.first(next).map(function (cell) {
|
8267 |
+
return getCellFirstCursorPosition(editor, cell);
|
8268 |
+
});
|
8269 |
+
}, function (current) {
|
8270 |
+
return $_bmlvw1ldjjgwed84.table(current, isRoot).bind(function (table) {
|
8271 |
+
var targets = $_a5s279mnjjgwedff.noMenu(current);
|
8272 |
+
editor.undoManager.transact(function () {
|
8273 |
+
actions.insertRowsAfter(table, targets);
|
8274 |
});
|
8275 |
+
return getNewRowCursorPosition(editor, table);
|
8276 |
+
});
|
8277 |
+
});
|
8278 |
+
};
|
8279 |
+
var rootElements = [
|
8280 |
+
'table',
|
8281 |
+
'li',
|
8282 |
+
'dl'
|
8283 |
+
];
|
8284 |
+
var handle$1 = function (event, editor, actions, lazyWire) {
|
8285 |
+
if (event.keyCode === global$3.TAB) {
|
8286 |
+
var body_1 = getBody$1(editor);
|
8287 |
+
var isRoot_1 = function (element) {
|
8288 |
+
var name = $_g6duvbm3jjgwedby.name(element);
|
8289 |
+
return $_e1yh5slljjgwedae.eq(element, body_1) || contains(rootElements, name);
|
8290 |
+
};
|
8291 |
+
var rng = editor.selection.getRng();
|
8292 |
+
if (rng.collapsed) {
|
8293 |
+
var start = Element$$1.fromDom(rng.startContainer);
|
8294 |
+
$_bmlvw1ldjjgwed84.cell(start, isRoot_1).each(function (cell) {
|
8295 |
+
event.preventDefault();
|
8296 |
+
var navigation = event.shiftKey ? backward : forward;
|
8297 |
+
var rng = navigation(editor, isRoot_1, cell, actions, lazyWire);
|
8298 |
+
rng.each(function (range$$1) {
|
8299 |
+
editor.selection.setRng(range$$1);
|
8300 |
+
});
|
8301 |
+
});
|
8302 |
+
}
|
8303 |
+
}
|
8304 |
+
};
|
8305 |
+
var $_9cogwlpojjgwee3l = { handle: handle$1 };
|
8306 |
+
|
8307 |
+
var response = Immutable('selection', 'kill');
|
8308 |
+
var $_3na9igq8jjgwee7o = { response: response };
|
8309 |
+
|
8310 |
+
var isKey = function (key) {
|
8311 |
+
return function (keycode) {
|
8312 |
+
return keycode === key;
|
8313 |
+
};
|
8314 |
+
};
|
8315 |
+
var isUp = isKey(38);
|
8316 |
+
var isDown = isKey(40);
|
8317 |
+
var isNavigation = function (keycode) {
|
8318 |
+
return keycode >= 37 && keycode <= 40;
|
8319 |
+
};
|
8320 |
+
var $_gu1pzq9jjgwee7r = {
|
8321 |
+
ltr: {
|
8322 |
+
isBackward: isKey(37),
|
8323 |
+
isForward: isKey(39)
|
8324 |
+
},
|
8325 |
+
rtl: {
|
8326 |
+
isBackward: isKey(39),
|
8327 |
+
isForward: isKey(37)
|
8328 |
+
},
|
8329 |
+
isUp: isUp,
|
8330 |
+
isDown: isDown,
|
8331 |
+
isNavigation: isNavigation
|
8332 |
+
};
|
8333 |
+
|
8334 |
+
var convertToRange = function (win, selection) {
|
8335 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, selection);
|
8336 |
+
return {
|
8337 |
+
start: constant(Element$$1.fromDom(rng.startContainer)),
|
8338 |
+
soffset: constant(rng.startOffset),
|
8339 |
+
finish: constant(Element$$1.fromDom(rng.endContainer)),
|
8340 |
+
foffset: constant(rng.endOffset)
|
8341 |
+
};
|
8342 |
+
};
|
8343 |
+
var makeSitus = function (start, soffset, finish, foffset) {
|
8344 |
+
return {
|
8345 |
+
start: constant($_6assppsjjgwee4k.on(start, soffset)),
|
8346 |
+
finish: constant($_6assppsjjgwee4k.on(finish, foffset))
|
8347 |
+
};
|
8348 |
+
};
|
8349 |
+
var $_9ndew9qbjjgwee88 = {
|
8350 |
+
convertToRange: convertToRange,
|
8351 |
+
makeSitus: makeSitus
|
8352 |
+
};
|
8353 |
+
|
8354 |
+
var isSafari = $_avfe9dlqjjgwedat.detect().browser.isSafari();
|
8355 |
+
var get$10 = function (_doc) {
|
8356 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
8357 |
+
var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
|
8358 |
+
var y = doc.body.scrollTop || doc.documentElement.scrollTop;
|
8359 |
+
return Position(x, y);
|
8360 |
+
};
|
8361 |
+
var to = function (x, y, _doc) {
|
8362 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
8363 |
+
var win = doc.defaultView;
|
8364 |
+
win.scrollTo(x, y);
|
8365 |
+
};
|
8366 |
+
var by = function (x, y, _doc) {
|
8367 |
+
var doc = _doc !== undefined ? _doc.dom() : document;
|
8368 |
+
var win = doc.defaultView;
|
8369 |
+
win.scrollBy(x, y);
|
8370 |
+
};
|
8371 |
+
var setToElement$1 = function (win, element) {
|
8372 |
+
var pos = $_emicwtnfjjgwedml.absolute(element);
|
8373 |
+
var doc = Element$$1.fromDom(win.document);
|
8374 |
+
to(pos.left(), pos.top(), doc);
|
8375 |
+
};
|
8376 |
+
var preserve$1 = function (doc, f) {
|
8377 |
+
var before = get$10(doc);
|
8378 |
+
f();
|
8379 |
+
var after = get$10(doc);
|
8380 |
+
if (before.top() !== after.top() || before.left() !== after.left()) {
|
8381 |
+
to(before.left(), before.top(), doc);
|
8382 |
+
}
|
8383 |
+
};
|
8384 |
+
var capture$2 = function (doc) {
|
8385 |
+
var previous = Option.none();
|
8386 |
+
var save = function () {
|
8387 |
+
previous = Option.some(get$10(doc));
|
8388 |
+
};
|
8389 |
+
var restore = function () {
|
8390 |
+
previous.each(function (p) {
|
8391 |
+
to(p.left(), p.top(), doc);
|
8392 |
+
});
|
8393 |
+
};
|
8394 |
+
save();
|
8395 |
+
return {
|
8396 |
+
save: save,
|
8397 |
+
restore: restore
|
8398 |
+
};
|
8399 |
+
};
|
8400 |
+
var intoView = function (element, alignToTop) {
|
8401 |
+
if (isSafari && isFunction(element.dom().scrollIntoViewIfNeeded)) {
|
8402 |
+
element.dom().scrollIntoViewIfNeeded(false);
|
8403 |
+
} else {
|
8404 |
+
element.dom().scrollIntoView(alignToTop);
|
8405 |
+
}
|
8406 |
+
};
|
8407 |
+
var intoViewIfNeeded = function (element, container) {
|
8408 |
+
var containerBox = container.dom().getBoundingClientRect();
|
8409 |
+
var elementBox = element.dom().getBoundingClientRect();
|
8410 |
+
if (elementBox.top < containerBox.top) {
|
8411 |
+
intoView(element, true);
|
8412 |
+
} else if (elementBox.bottom > containerBox.bottom) {
|
8413 |
+
intoView(element, false);
|
8414 |
+
}
|
8415 |
+
};
|
8416 |
+
var scrollBarWidth = function () {
|
8417 |
+
var scrollDiv = Element$$1.fromHtml('<div style="width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px;"></div>');
|
8418 |
+
$_1yoqsmmdjjgweddo.after($_95kxntm6jjgwedc6.body(), scrollDiv);
|
8419 |
+
var w = scrollDiv.dom().offsetWidth - scrollDiv.dom().clientWidth;
|
8420 |
+
$_1y8qodmejjgweddq.remove(scrollDiv);
|
8421 |
+
return w;
|
8422 |
+
};
|
8423 |
+
var $_93bakiqcjjgwee8h = {
|
8424 |
+
get: get$10,
|
8425 |
+
to: to,
|
8426 |
+
by: by,
|
8427 |
+
preserve: preserve$1,
|
8428 |
+
capture: capture$2,
|
8429 |
+
intoView: intoView,
|
8430 |
+
intoViewIfNeeded: intoViewIfNeeded,
|
8431 |
+
setToElement: setToElement$1,
|
8432 |
+
scrollBarWidth: scrollBarWidth
|
8433 |
+
};
|
8434 |
+
|
8435 |
+
function WindowBridge (win) {
|
8436 |
+
var elementFromPoint = function (x, y) {
|
8437 |
+
return Element$$1.fromPoint(Element$$1.fromDom(win.document), x, y);
|
8438 |
+
};
|
8439 |
+
var getRect = function (element) {
|
8440 |
+
return element.dom().getBoundingClientRect();
|
8441 |
+
};
|
8442 |
+
var getRangedRect = function (start, soffset, finish, foffset) {
|
8443 |
+
var sel = $_afru5jprjjgwee4e.exact(start, soffset, finish, foffset);
|
8444 |
+
return $_biw8ebptjjgwee4r.getFirstRect(win, sel).map(function (structRect) {
|
8445 |
+
return map$1(structRect, apply);
|
8446 |
+
});
|
8447 |
+
};
|
8448 |
+
var getSelection = function () {
|
8449 |
+
return $_biw8ebptjjgwee4r.get(win).map(function (exactAdt) {
|
8450 |
+
return $_9ndew9qbjjgwee88.convertToRange(win, exactAdt);
|
8451 |
+
});
|
8452 |
+
};
|
8453 |
+
var fromSitus = function (situs) {
|
8454 |
+
var relative = $_afru5jprjjgwee4e.relative(situs.start(), situs.finish());
|
8455 |
+
return $_9ndew9qbjjgwee88.convertToRange(win, relative);
|
8456 |
+
};
|
8457 |
+
var situsFromPoint = function (x, y) {
|
8458 |
+
return $_biw8ebptjjgwee4r.getAtPoint(win, x, y).map(function (exact) {
|
8459 |
+
return {
|
8460 |
+
start: constant($_6assppsjjgwee4k.on(exact.start(), exact.soffset())),
|
8461 |
+
finish: constant($_6assppsjjgwee4k.on(exact.finish(), exact.foffset()))
|
8462 |
+
};
|
8463 |
+
});
|
8464 |
};
|
8465 |
+
var clearSelection = function () {
|
8466 |
+
$_biw8ebptjjgwee4r.clear(win);
|
|
|
8467 |
};
|
8468 |
+
var selectContents = function (element) {
|
8469 |
+
$_biw8ebptjjgwee4r.setToElement(win, element);
|
|
|
|
|
|
|
8470 |
};
|
8471 |
+
var setSelection = function (sel) {
|
8472 |
+
$_biw8ebptjjgwee4r.setExact(win, sel.start(), sel.soffset(), sel.finish(), sel.foffset());
|
|
|
|
|
|
|
8473 |
};
|
8474 |
+
var setRelativeSelection = function (start, finish) {
|
8475 |
+
$_biw8ebptjjgwee4r.setRelative(win, start, finish);
|
|
|
|
|
8476 |
};
|
8477 |
+
var getInnerHeight = function () {
|
8478 |
+
return win.innerHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8479 |
};
|
8480 |
+
var getScrollY = function () {
|
8481 |
+
var pos = $_93bakiqcjjgwee8h.get(Element$$1.fromDom(win.document));
|
8482 |
+
return pos.top();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8483 |
};
|
8484 |
+
var scrollBy = function (x, y) {
|
8485 |
+
$_93bakiqcjjgwee8h.by(x, y, Element$$1.fromDom(win.document));
|
8486 |
+
};
|
8487 |
+
return {
|
8488 |
+
elementFromPoint: elementFromPoint,
|
8489 |
+
getRect: getRect,
|
8490 |
+
getRangedRect: getRangedRect,
|
8491 |
+
getSelection: getSelection,
|
8492 |
+
fromSitus: fromSitus,
|
8493 |
+
situsFromPoint: situsFromPoint,
|
8494 |
+
clearSelection: clearSelection,
|
8495 |
+
setSelection: setSelection,
|
8496 |
+
setRelativeSelection: setRelativeSelection,
|
8497 |
+
selectContents: selectContents,
|
8498 |
+
getInnerHeight: getInnerHeight,
|
8499 |
+
getScrollY: getScrollY,
|
8500 |
+
scrollBy: scrollBy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8501 |
};
|
8502 |
+
}
|
8503 |
|
8504 |
+
var sync = function (container, isRoot, start, soffset, finish, foffset, selectRange) {
|
8505 |
+
if (!($_e1yh5slljjgwedae.eq(start, finish) && soffset === foffset)) {
|
8506 |
+
return $_2e7p77m7jjgwedcg.closest(start, 'td,th', isRoot).bind(function (s) {
|
8507 |
+
return $_2e7p77m7jjgwedcg.closest(finish, 'td,th', isRoot).bind(function (f) {
|
8508 |
+
return detect$5(container, isRoot, s, f, selectRange);
|
8509 |
+
});
|
8510 |
+
});
|
8511 |
+
} else {
|
8512 |
+
return Option.none();
|
8513 |
+
}
|
8514 |
+
};
|
8515 |
+
var detect$5 = function (container, isRoot, start, finish, selectRange) {
|
8516 |
+
if (!$_e1yh5slljjgwedae.eq(start, finish)) {
|
8517 |
+
return $_cl87acmqjjgwedgo.identify(start, finish, isRoot).bind(function (cellSel) {
|
8518 |
+
var boxes = cellSel.boxes().getOr([]);
|
8519 |
+
if (boxes.length > 0) {
|
8520 |
+
selectRange(container, boxes, cellSel.start(), cellSel.finish());
|
8521 |
+
return Option.some($_3na9igq8jjgwee7o.response(Option.some($_9ndew9qbjjgwee88.makeSitus(start, 0, start, $_3uimohmjjjgwedf1.getEnd(start))), true));
|
8522 |
} else {
|
8523 |
+
return Option.none();
|
8524 |
}
|
8525 |
});
|
8526 |
+
} else {
|
8527 |
+
return Option.none();
|
8528 |
+
}
|
8529 |
+
};
|
8530 |
+
var update = function (rows, columns, container, selected, annotations) {
|
8531 |
+
var updateSelection = function (newSels) {
|
8532 |
+
annotations.clear(container);
|
8533 |
+
annotations.selectRange(container, newSels.boxes(), newSels.start(), newSels.finish());
|
8534 |
+
return newSels.boxes();
|
8535 |
+
};
|
8536 |
+
return $_cl87acmqjjgwedgo.shiftSelection(selected, rows, columns, annotations.firstSelectedSelector(), annotations.lastSelectedSelector()).map(updateSelection);
|
8537 |
+
};
|
8538 |
+
var $_4jzcyzqdjjgwee8r = {
|
8539 |
+
sync: sync,
|
8540 |
+
detect: detect$5,
|
8541 |
+
update: update
|
8542 |
+
};
|
8543 |
+
|
8544 |
+
var nu$3 = MixedBag([
|
8545 |
+
'left',
|
8546 |
+
'top',
|
8547 |
+
'right',
|
8548 |
+
'bottom'
|
8549 |
+
], []);
|
8550 |
+
var moveDown = function (caret, amount) {
|
8551 |
+
return nu$3({
|
8552 |
+
left: caret.left(),
|
8553 |
+
top: caret.top() + amount,
|
8554 |
+
right: caret.right(),
|
8555 |
+
bottom: caret.bottom() + amount
|
8556 |
+
});
|
8557 |
+
};
|
8558 |
+
var moveUp = function (caret, amount) {
|
8559 |
+
return nu$3({
|
8560 |
+
left: caret.left(),
|
8561 |
+
top: caret.top() - amount,
|
8562 |
+
right: caret.right(),
|
8563 |
+
bottom: caret.bottom() - amount
|
8564 |
+
});
|
8565 |
+
};
|
8566 |
+
var moveBottomTo = function (caret, bottom) {
|
8567 |
+
var height = caret.bottom() - caret.top();
|
8568 |
+
return nu$3({
|
8569 |
+
left: caret.left(),
|
8570 |
+
top: bottom - height,
|
8571 |
+
right: caret.right(),
|
8572 |
+
bottom: bottom
|
8573 |
+
});
|
8574 |
+
};
|
8575 |
+
var moveTopTo = function (caret, top) {
|
8576 |
+
var height = caret.bottom() - caret.top();
|
8577 |
+
return nu$3({
|
8578 |
+
left: caret.left(),
|
8579 |
+
top: top,
|
8580 |
+
right: caret.right(),
|
8581 |
+
bottom: top + height
|
8582 |
+
});
|
8583 |
+
};
|
8584 |
+
var translate = function (caret, xDelta, yDelta) {
|
8585 |
+
return nu$3({
|
8586 |
+
left: caret.left() + xDelta,
|
8587 |
+
top: caret.top() + yDelta,
|
8588 |
+
right: caret.right() + xDelta,
|
8589 |
+
bottom: caret.bottom() + yDelta
|
8590 |
+
});
|
8591 |
+
};
|
8592 |
+
var getTop$1 = function (caret) {
|
8593 |
+
return caret.top();
|
8594 |
+
};
|
8595 |
+
var getBottom = function (caret) {
|
8596 |
+
return caret.bottom();
|
8597 |
+
};
|
8598 |
+
var toString$1 = function (caret) {
|
8599 |
+
return '(' + caret.left() + ', ' + caret.top() + ') -> (' + caret.right() + ', ' + caret.bottom() + ')';
|
8600 |
+
};
|
8601 |
+
var $_bdolgrqgjjgweea8 = {
|
8602 |
+
nu: nu$3,
|
8603 |
+
moveUp: moveUp,
|
8604 |
+
moveDown: moveDown,
|
8605 |
+
moveBottomTo: moveBottomTo,
|
8606 |
+
moveTopTo: moveTopTo,
|
8607 |
+
getTop: getTop$1,
|
8608 |
+
getBottom: getBottom,
|
8609 |
+
translate: translate,
|
8610 |
+
toString: toString$1
|
8611 |
+
};
|
8612 |
+
|
8613 |
+
var getPartialBox = function (bridge, element, offset) {
|
8614 |
+
if (offset >= 0 && offset < $_3uimohmjjjgwedf1.getEnd(element))
|
8615 |
+
return bridge.getRangedRect(element, offset, element, offset + 1);
|
8616 |
+
else if (offset > 0)
|
8617 |
+
return bridge.getRangedRect(element, offset - 1, element, offset);
|
8618 |
+
return Option.none();
|
8619 |
+
};
|
8620 |
+
var toCaret = function (rect) {
|
8621 |
+
return $_bdolgrqgjjgweea8.nu({
|
8622 |
+
left: rect.left,
|
8623 |
+
top: rect.top,
|
8624 |
+
right: rect.right,
|
8625 |
+
bottom: rect.bottom
|
8626 |
+
});
|
8627 |
+
};
|
8628 |
+
var getElemBox = function (bridge, element) {
|
8629 |
+
return Option.some(bridge.getRect(element));
|
8630 |
+
};
|
8631 |
+
var getBoxAt = function (bridge, element, offset) {
|
8632 |
+
if ($_g6duvbm3jjgwedby.isElement(element))
|
8633 |
+
return getElemBox(bridge, element).map(toCaret);
|
8634 |
+
else if ($_g6duvbm3jjgwedby.isText(element))
|
8635 |
+
return getPartialBox(bridge, element, offset).map(toCaret);
|
8636 |
+
else
|
8637 |
+
return Option.none();
|
8638 |
+
};
|
8639 |
+
var getEntireBox = function (bridge, element) {
|
8640 |
+
if ($_g6duvbm3jjgwedby.isElement(element))
|
8641 |
+
return getElemBox(bridge, element).map(toCaret);
|
8642 |
+
else if ($_g6duvbm3jjgwedby.isText(element))
|
8643 |
+
return bridge.getRangedRect(element, 0, element, $_3uimohmjjjgwedf1.getEnd(element)).map(toCaret);
|
8644 |
+
else
|
8645 |
+
return Option.none();
|
8646 |
+
};
|
8647 |
+
var $_av2mpcqhjjgweeac = {
|
8648 |
+
getBoxAt: getBoxAt,
|
8649 |
+
getEntireBox: getEntireBox
|
8650 |
+
};
|
8651 |
+
|
8652 |
+
var traverse = Immutable('item', 'mode');
|
8653 |
+
var backtrack = function (universe, item, direction, _transition) {
|
8654 |
+
var transition = _transition !== undefined ? _transition : sidestep;
|
8655 |
+
return universe.property().parent(item).map(function (p) {
|
8656 |
+
return traverse(p, transition);
|
8657 |
+
});
|
8658 |
+
};
|
8659 |
+
var sidestep = function (universe, item, direction, _transition) {
|
8660 |
+
var transition = _transition !== undefined ? _transition : advance;
|
8661 |
+
return direction.sibling(universe, item).map(function (p) {
|
8662 |
+
return traverse(p, transition);
|
8663 |
+
});
|
8664 |
+
};
|
8665 |
+
var advance = function (universe, item, direction, _transition) {
|
8666 |
+
var transition = _transition !== undefined ? _transition : advance;
|
8667 |
+
var children = universe.property().children(item);
|
8668 |
+
var result = direction.first(children);
|
8669 |
+
return result.map(function (r) {
|
8670 |
+
return traverse(r, transition);
|
8671 |
+
});
|
8672 |
+
};
|
8673 |
+
var successors = [
|
8674 |
+
{
|
8675 |
+
current: backtrack,
|
8676 |
+
next: sidestep,
|
8677 |
+
fallback: Option.none()
|
8678 |
+
},
|
8679 |
+
{
|
8680 |
+
current: sidestep,
|
8681 |
+
next: advance,
|
8682 |
+
fallback: Option.some(backtrack)
|
8683 |
+
},
|
8684 |
+
{
|
8685 |
+
current: advance,
|
8686 |
+
next: advance,
|
8687 |
+
fallback: Option.some(sidestep)
|
8688 |
+
}
|
8689 |
+
];
|
8690 |
+
var go$1 = function (universe, item, mode, direction, rules) {
|
8691 |
+
var rules = rules !== undefined ? rules : successors;
|
8692 |
+
var ruleOpt = find(rules, function (succ) {
|
8693 |
+
return succ.current === mode;
|
8694 |
+
});
|
8695 |
+
return ruleOpt.bind(function (rule) {
|
8696 |
+
return rule.current(universe, item, direction, rule.next).orThunk(function () {
|
8697 |
+
return rule.fallback.bind(function (fb) {
|
8698 |
+
return go$1(universe, item, fb, direction);
|
8699 |
+
});
|
8700 |
});
|
8701 |
+
});
|
8702 |
+
};
|
8703 |
+
var $_e965oqmjjgweebk = {
|
8704 |
+
backtrack: backtrack,
|
8705 |
+
sidestep: sidestep,
|
8706 |
+
advance: advance,
|
8707 |
+
go: go$1
|
8708 |
+
};
|
8709 |
+
|
8710 |
+
var left$1 = function () {
|
8711 |
+
var sibling = function (universe, item) {
|
8712 |
+
return universe.query().prevSibling(item);
|
8713 |
+
};
|
8714 |
+
var first = function (children) {
|
8715 |
+
return children.length > 0 ? Option.some(children[children.length - 1]) : Option.none();
|
8716 |
+
};
|
8717 |
+
return {
|
8718 |
+
sibling: sibling,
|
8719 |
+
first: first
|
8720 |
+
};
|
8721 |
+
};
|
8722 |
+
var right$1 = function () {
|
8723 |
+
var sibling = function (universe, item) {
|
8724 |
+
return universe.query().nextSibling(item);
|
8725 |
+
};
|
8726 |
+
var first = function (children) {
|
8727 |
+
return children.length > 0 ? Option.some(children[0]) : Option.none();
|
8728 |
+
};
|
8729 |
+
return {
|
8730 |
+
sibling: sibling,
|
8731 |
+
first: first
|
8732 |
+
};
|
8733 |
+
};
|
8734 |
+
var $_34xghxqnjjgweebt = {
|
8735 |
+
left: left$1,
|
8736 |
+
right: right$1
|
8737 |
+
};
|
8738 |
+
|
8739 |
+
var hone = function (universe, item, predicate, mode, direction, isRoot) {
|
8740 |
+
var next = $_e965oqmjjgweebk.go(universe, item, mode, direction);
|
8741 |
+
return next.bind(function (n) {
|
8742 |
+
if (isRoot(n.item()))
|
8743 |
+
return Option.none();
|
8744 |
+
else
|
8745 |
+
return predicate(n.item()) ? Option.some(n.item()) : hone(universe, n.item(), predicate, n.mode(), direction, isRoot);
|
8746 |
+
});
|
8747 |
+
};
|
8748 |
+
var left$2 = function (universe, item, predicate, isRoot) {
|
8749 |
+
return hone(universe, item, predicate, $_e965oqmjjgweebk.sidestep, $_34xghxqnjjgweebt.left(), isRoot);
|
8750 |
+
};
|
8751 |
+
var right$2 = function (universe, item, predicate, isRoot) {
|
8752 |
+
return hone(universe, item, predicate, $_e965oqmjjgweebk.sidestep, $_34xghxqnjjgweebt.right(), isRoot);
|
8753 |
+
};
|
8754 |
+
var $_28flk6qljjgweebh = {
|
8755 |
+
left: left$2,
|
8756 |
+
right: right$2
|
8757 |
+
};
|
8758 |
+
|
8759 |
+
var isLeaf = function (universe, element) {
|
8760 |
+
return universe.property().children(element).length === 0;
|
8761 |
+
};
|
8762 |
+
var before$2 = function (universe, item, isRoot) {
|
8763 |
+
return seekLeft(universe, item, curry(isLeaf, universe), isRoot);
|
8764 |
+
};
|
8765 |
+
var after$3 = function (universe, item, isRoot) {
|
8766 |
+
return seekRight(universe, item, curry(isLeaf, universe), isRoot);
|
8767 |
+
};
|
8768 |
+
var seekLeft = function (universe, item, predicate, isRoot) {
|
8769 |
+
return $_28flk6qljjgweebh.left(universe, item, predicate, isRoot);
|
8770 |
+
};
|
8771 |
+
var seekRight = function (universe, item, predicate, isRoot) {
|
8772 |
+
return $_28flk6qljjgweebh.right(universe, item, predicate, isRoot);
|
8773 |
+
};
|
8774 |
+
var walkers = function () {
|
8775 |
+
return {
|
8776 |
+
left: $_34xghxqnjjgweebt.left,
|
8777 |
+
right: $_34xghxqnjjgweebt.right
|
8778 |
+
};
|
8779 |
+
};
|
8780 |
+
var walk = function (universe, item, mode, direction, _rules) {
|
8781 |
+
return $_e965oqmjjgweebk.go(universe, item, mode, direction, _rules);
|
8782 |
+
};
|
8783 |
+
var $_3wluwaqkjjgweebd = {
|
8784 |
+
before: before$2,
|
8785 |
+
after: after$3,
|
8786 |
+
seekLeft: seekLeft,
|
8787 |
+
seekRight: seekRight,
|
8788 |
+
walkers: walkers,
|
8789 |
+
walk: walk,
|
8790 |
+
backtrack: $_e965oqmjjgweebk.backtrack,
|
8791 |
+
sidestep: $_e965oqmjjgweebk.sidestep,
|
8792 |
+
advance: $_e965oqmjjgweebk.advance
|
8793 |
+
};
|
8794 |
+
|
8795 |
+
var universe$2 = DomUniverse();
|
8796 |
+
var gather = function (element, prune, transform) {
|
8797 |
+
return $_3wluwaqkjjgweebd.gather(universe$2, element, prune, transform);
|
8798 |
+
};
|
8799 |
+
var before$3 = function (element, isRoot) {
|
8800 |
+
return $_3wluwaqkjjgweebd.before(universe$2, element, isRoot);
|
8801 |
+
};
|
8802 |
+
var after$4 = function (element, isRoot) {
|
8803 |
+
return $_3wluwaqkjjgweebd.after(universe$2, element, isRoot);
|
8804 |
+
};
|
8805 |
+
var seekLeft$1 = function (element, predicate, isRoot) {
|
8806 |
+
return $_3wluwaqkjjgweebd.seekLeft(universe$2, element, predicate, isRoot);
|
8807 |
+
};
|
8808 |
+
var seekRight$1 = function (element, predicate, isRoot) {
|
8809 |
+
return $_3wluwaqkjjgweebd.seekRight(universe$2, element, predicate, isRoot);
|
8810 |
+
};
|
8811 |
+
var walkers$1 = function () {
|
8812 |
+
return $_3wluwaqkjjgweebd.walkers();
|
8813 |
+
};
|
8814 |
+
var walk$1 = function (item, mode, direction, _rules) {
|
8815 |
+
return $_3wluwaqkjjgweebd.walk(universe$2, item, mode, direction, _rules);
|
8816 |
+
};
|
8817 |
+
var $_5u2dgeqjjjgweeb9 = {
|
8818 |
+
gather: gather,
|
8819 |
+
before: before$3,
|
8820 |
+
after: after$4,
|
8821 |
+
seekLeft: seekLeft$1,
|
8822 |
+
seekRight: seekRight$1,
|
8823 |
+
walkers: walkers$1,
|
8824 |
+
walk: walk$1
|
8825 |
+
};
|
8826 |
+
|
8827 |
+
var JUMP_SIZE = 5;
|
8828 |
+
var NUM_RETRIES = 100;
|
8829 |
+
var adt$2 = Adt.generate([
|
8830 |
+
{ 'none': [] },
|
8831 |
+
{ 'retry': ['caret'] }
|
8832 |
+
]);
|
8833 |
+
var isOutside = function (caret, box) {
|
8834 |
+
return caret.left() < box.left() || Math.abs(box.right() - caret.left()) < 1 || caret.left() > box.right();
|
8835 |
+
};
|
8836 |
+
var inOutsideBlock = function (bridge, element, caret) {
|
8837 |
+
return $_6l4e4m8jjgwedci.closest(element, $_2d7i0tnojjgwedou.isBlock).fold(constant(false), function (cell) {
|
8838 |
+
return $_av2mpcqhjjgweeac.getEntireBox(bridge, cell).exists(function (box) {
|
8839 |
+
return isOutside(caret, box);
|
8840 |
});
|
8841 |
+
});
|
8842 |
+
};
|
8843 |
+
var adjustDown = function (bridge, element, guessBox, original, caret) {
|
8844 |
+
var lowerCaret = $_bdolgrqgjjgweea8.moveDown(caret, JUMP_SIZE);
|
8845 |
+
if (Math.abs(guessBox.bottom() - original.bottom()) < 1)
|
8846 |
+
return adt$2.retry(lowerCaret);
|
8847 |
+
else if (guessBox.top() > caret.bottom())
|
8848 |
+
return adt$2.retry(lowerCaret);
|
8849 |
+
else if (guessBox.top() === caret.bottom())
|
8850 |
+
return adt$2.retry($_bdolgrqgjjgweea8.moveDown(caret, 1));
|
8851 |
+
else
|
8852 |
+
return inOutsideBlock(bridge, element, caret) ? adt$2.retry($_bdolgrqgjjgweea8.translate(lowerCaret, JUMP_SIZE, 0)) : adt$2.none();
|
8853 |
+
};
|
8854 |
+
var adjustUp = function (bridge, element, guessBox, original, caret) {
|
8855 |
+
var higherCaret = $_bdolgrqgjjgweea8.moveUp(caret, JUMP_SIZE);
|
8856 |
+
if (Math.abs(guessBox.top() - original.top()) < 1)
|
8857 |
+
return adt$2.retry(higherCaret);
|
8858 |
+
else if (guessBox.bottom() < caret.top())
|
8859 |
+
return adt$2.retry(higherCaret);
|
8860 |
+
else if (guessBox.bottom() === caret.top())
|
8861 |
+
return adt$2.retry($_bdolgrqgjjgweea8.moveUp(caret, 1));
|
8862 |
+
else
|
8863 |
+
return inOutsideBlock(bridge, element, caret) ? adt$2.retry($_bdolgrqgjjgweea8.translate(higherCaret, JUMP_SIZE, 0)) : adt$2.none();
|
8864 |
+
};
|
8865 |
+
var upMovement = {
|
8866 |
+
point: $_bdolgrqgjjgweea8.getTop,
|
8867 |
+
adjuster: adjustUp,
|
8868 |
+
move: $_bdolgrqgjjgweea8.moveUp,
|
8869 |
+
gather: $_5u2dgeqjjjgweeb9.before
|
8870 |
+
};
|
8871 |
+
var downMovement = {
|
8872 |
+
point: $_bdolgrqgjjgweea8.getBottom,
|
8873 |
+
adjuster: adjustDown,
|
8874 |
+
move: $_bdolgrqgjjgweea8.moveDown,
|
8875 |
+
gather: $_5u2dgeqjjjgweeb9.after
|
8876 |
+
};
|
8877 |
+
var isAtTable = function (bridge, x, y) {
|
8878 |
+
return bridge.elementFromPoint(x, y).filter(function (elm) {
|
8879 |
+
return $_g6duvbm3jjgwedby.name(elm) === 'table';
|
8880 |
+
}).isSome();
|
8881 |
+
};
|
8882 |
+
var adjustForTable = function (bridge, movement, original, caret, numRetries) {
|
8883 |
+
return adjustTil(bridge, movement, original, movement.move(caret, JUMP_SIZE), numRetries);
|
8884 |
+
};
|
8885 |
+
var adjustTil = function (bridge, movement, original, caret, numRetries) {
|
8886 |
+
if (numRetries === 0)
|
8887 |
+
return Option.some(caret);
|
8888 |
+
if (isAtTable(bridge, caret.left(), movement.point(caret)))
|
8889 |
+
return adjustForTable(bridge, movement, original, caret, numRetries - 1);
|
8890 |
+
return bridge.situsFromPoint(caret.left(), movement.point(caret)).bind(function (guess) {
|
8891 |
+
return guess.start().fold(Option.none, function (element, offset) {
|
8892 |
+
return $_av2mpcqhjjgweeac.getEntireBox(bridge, element, offset).bind(function (guessBox) {
|
8893 |
+
return movement.adjuster(bridge, element, guessBox, original, caret).fold(Option.none, function (newCaret) {
|
8894 |
+
return adjustTil(bridge, movement, original, newCaret, numRetries - 1);
|
8895 |
+
});
|
8896 |
+
}).orThunk(function () {
|
8897 |
+
return Option.some(caret);
|
8898 |
+
});
|
8899 |
+
}, Option.none);
|
8900 |
+
});
|
8901 |
+
};
|
8902 |
+
var ieTryDown = function (bridge, caret) {
|
8903 |
+
return bridge.situsFromPoint(caret.left(), caret.bottom() + JUMP_SIZE);
|
8904 |
+
};
|
8905 |
+
var ieTryUp = function (bridge, caret) {
|
8906 |
+
return bridge.situsFromPoint(caret.left(), caret.top() - JUMP_SIZE);
|
8907 |
+
};
|
8908 |
+
var checkScroll = function (movement, adjusted, bridge) {
|
8909 |
+
if (movement.point(adjusted) > bridge.getInnerHeight())
|
8910 |
+
return Option.some(movement.point(adjusted) - bridge.getInnerHeight());
|
8911 |
+
else if (movement.point(adjusted) < 0)
|
8912 |
+
return Option.some(-movement.point(adjusted));
|
8913 |
+
else
|
8914 |
+
return Option.none();
|
8915 |
+
};
|
8916 |
+
var retry = function (movement, bridge, caret) {
|
8917 |
+
var moved = movement.move(caret, JUMP_SIZE);
|
8918 |
+
var adjusted = adjustTil(bridge, movement, caret, moved, NUM_RETRIES).getOr(moved);
|
8919 |
+
return checkScroll(movement, adjusted, bridge).fold(function () {
|
8920 |
+
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted));
|
8921 |
+
}, function (delta) {
|
8922 |
+
bridge.scrollBy(0, delta);
|
8923 |
+
return bridge.situsFromPoint(adjusted.left(), movement.point(adjusted) - delta);
|
8924 |
+
});
|
8925 |
+
};
|
8926 |
+
var $_1fi03fqijjgweeak = {
|
8927 |
+
tryUp: curry(retry, upMovement),
|
8928 |
+
tryDown: curry(retry, downMovement),
|
8929 |
+
ieTryUp: ieTryUp,
|
8930 |
+
ieTryDown: ieTryDown,
|
8931 |
+
getJumpSize: constant(JUMP_SIZE)
|
8932 |
+
};
|
8933 |
+
|
8934 |
+
var adt$3 = Adt.generate([
|
8935 |
+
{ 'none': ['message'] },
|
8936 |
+
{ 'success': [] },
|
8937 |
+
{ 'failedUp': ['cell'] },
|
8938 |
+
{ 'failedDown': ['cell'] }
|
8939 |
+
]);
|
8940 |
+
var isOverlapping = function (bridge, before, after) {
|
8941 |
+
var beforeBounds = bridge.getRect(before);
|
8942 |
+
var afterBounds = bridge.getRect(after);
|
8943 |
+
return afterBounds.right > beforeBounds.left && afterBounds.left < beforeBounds.right;
|
8944 |
+
};
|
8945 |
+
var verify = function (bridge, before, beforeOffset, after, afterOffset, failure, isRoot) {
|
8946 |
+
return $_2e7p77m7jjgwedcg.closest(after, 'td,th', isRoot).bind(function (afterCell) {
|
8947 |
+
return $_2e7p77m7jjgwedcg.closest(before, 'td,th', isRoot).map(function (beforeCell) {
|
8948 |
+
if (!$_e1yh5slljjgwedae.eq(afterCell, beforeCell)) {
|
8949 |
+
return $_92t9ismrjjgwedhe.sharedOne(isRow, [
|
8950 |
+
afterCell,
|
8951 |
+
beforeCell
|
8952 |
+
]).fold(function () {
|
8953 |
+
return isOverlapping(bridge, beforeCell, afterCell) ? adt$3.success() : failure(beforeCell);
|
8954 |
+
}, function (sharedRow) {
|
8955 |
+
return failure(beforeCell);
|
8956 |
+
});
|
8957 |
+
} else {
|
8958 |
+
return $_e1yh5slljjgwedae.eq(after, afterCell) && $_3uimohmjjjgwedf1.getEnd(afterCell) === afterOffset ? failure(beforeCell) : adt$3.none('in same cell');
|
8959 |
+
}
|
8960 |
});
|
8961 |
+
}).getOr(adt$3.none('default'));
|
8962 |
+
};
|
8963 |
+
var isRow = function (elem) {
|
8964 |
+
return $_2e7p77m7jjgwedcg.closest(elem, 'tr');
|
8965 |
+
};
|
8966 |
+
var cata$2 = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) {
|
8967 |
+
return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown);
|
8968 |
+
};
|
8969 |
+
var $_a6kfh3qojjgweebx = {
|
8970 |
+
verify: verify,
|
8971 |
+
cata: cata$2,
|
8972 |
+
adt: adt$3
|
8973 |
+
};
|
8974 |
+
|
8975 |
+
var point = Immutable('element', 'offset');
|
8976 |
+
var delta = Immutable('element', 'deltaOffset');
|
8977 |
+
var range$3 = Immutable('element', 'start', 'finish');
|
8978 |
+
var points = Immutable('begin', 'end');
|
8979 |
+
var text = Immutable('element', 'text');
|
8980 |
+
var $_1x8ha4qqjjgweecy = {
|
8981 |
+
point: point,
|
8982 |
+
delta: delta,
|
8983 |
+
range: range$3,
|
8984 |
+
points: points,
|
8985 |
+
text: text
|
8986 |
+
};
|
8987 |
+
|
8988 |
+
var inAncestor = Immutable('ancestor', 'descendants', 'element', 'index');
|
8989 |
+
var inParent = Immutable('parent', 'children', 'element', 'index');
|
8990 |
+
var childOf = function (element, ancestor) {
|
8991 |
+
return $_6l4e4m8jjgwedci.closest(element, function (elem) {
|
8992 |
+
return $_97vsilljjjgwed9v.parent(elem).exists(function (parent) {
|
8993 |
+
return $_e1yh5slljjgwedae.eq(parent, ancestor);
|
8994 |
});
|
8995 |
+
});
|
8996 |
+
};
|
8997 |
+
var indexInParent = function (element) {
|
8998 |
+
return $_97vsilljjjgwed9v.parent(element).bind(function (parent) {
|
8999 |
+
var children = $_97vsilljjjgwed9v.children(parent);
|
9000 |
+
return indexOf$1(children, element).map(function (index) {
|
9001 |
+
return inParent(parent, children, element, index);
|
9002 |
});
|
9003 |
+
});
|
9004 |
+
};
|
9005 |
+
var indexOf$1 = function (elements, element) {
|
9006 |
+
return findIndex(elements, curry($_e1yh5slljjgwedae.eq, element));
|
9007 |
+
};
|
9008 |
+
var selectorsInParent = function (element, selector) {
|
9009 |
+
return $_97vsilljjjgwed9v.parent(element).bind(function (parent) {
|
9010 |
+
var children = $_5ko5j3m4jjgwedc0.children(parent, selector);
|
9011 |
+
return indexOf$1(children, element).map(function (index) {
|
9012 |
+
return inParent(parent, children, element, index);
|
9013 |
});
|
9014 |
+
});
|
9015 |
+
};
|
9016 |
+
var descendantsInAncestor = function (element, ancestorSelector, descendantSelector) {
|
9017 |
+
return $_2e7p77m7jjgwedcg.closest(element, ancestorSelector).bind(function (ancestor) {
|
9018 |
+
var descendants = $_5ko5j3m4jjgwedc0.descendants(ancestor, descendantSelector);
|
9019 |
+
return indexOf$1(descendants, element).map(function (index) {
|
9020 |
+
return inAncestor(ancestor, descendants, element, index);
|
9021 |
});
|
9022 |
+
});
|
9023 |
+
};
|
9024 |
+
var $_e4dnznqrjjgweed1 = {
|
9025 |
+
childOf: childOf,
|
9026 |
+
indexOf: indexOf$1,
|
9027 |
+
indexInParent: indexInParent,
|
9028 |
+
selectorsInParent: selectorsInParent,
|
9029 |
+
descendantsInAncestor: descendantsInAncestor
|
9030 |
+
};
|
9031 |
+
|
9032 |
+
var isBr = function (elem) {
|
9033 |
+
return $_g6duvbm3jjgwedby.name(elem) === 'br';
|
9034 |
+
};
|
9035 |
+
var gatherer = function (cand, gather, isRoot) {
|
9036 |
+
return gather(cand, isRoot).bind(function (target) {
|
9037 |
+
return $_g6duvbm3jjgwedby.isText(target) && $_btltedmkjjgwedf4.get(target).trim().length === 0 ? gatherer(target, gather, isRoot) : Option.some(target);
|
9038 |
+
});
|
9039 |
+
};
|
9040 |
+
var handleBr = function (isRoot, element, direction) {
|
9041 |
+
return direction.traverse(element).orThunk(function () {
|
9042 |
+
return gatherer(element, direction.gather, isRoot);
|
9043 |
+
}).map(direction.relative);
|
9044 |
+
};
|
9045 |
+
var findBr = function (element, offset) {
|
9046 |
+
return $_97vsilljjjgwed9v.child(element, offset).filter(isBr).orThunk(function () {
|
9047 |
+
return $_97vsilljjjgwed9v.child(element, offset - 1).filter(isBr);
|
9048 |
+
});
|
9049 |
+
};
|
9050 |
+
var handleParent = function (isRoot, element, offset, direction) {
|
9051 |
+
return findBr(element, offset).bind(function (br) {
|
9052 |
+
return direction.traverse(br).fold(function () {
|
9053 |
+
return gatherer(br, direction.gather, isRoot).map(direction.relative);
|
9054 |
+
}, function (adjacent) {
|
9055 |
+
return $_e4dnznqrjjgweed1.indexInParent(adjacent).map(function (info) {
|
9056 |
+
return $_6assppsjjgwee4k.on(info.parent(), info.index());
|
9057 |
+
});
|
9058 |
});
|
9059 |
+
});
|
9060 |
+
};
|
9061 |
+
var tryBr = function (isRoot, element, offset, direction) {
|
9062 |
+
var target = isBr(element) ? handleBr(isRoot, element, direction) : handleParent(isRoot, element, offset, direction);
|
9063 |
+
return target.map(function (tgt) {
|
9064 |
+
return {
|
9065 |
+
start: constant(tgt),
|
9066 |
+
finish: constant(tgt)
|
9067 |
+
};
|
9068 |
+
});
|
9069 |
+
};
|
9070 |
+
var process = function (analysis) {
|
9071 |
+
return $_a6kfh3qojjgweebx.cata(analysis, function (message) {
|
9072 |
+
return Option.none();
|
9073 |
+
}, function () {
|
9074 |
+
return Option.none();
|
9075 |
+
}, function (cell) {
|
9076 |
+
return Option.some($_1x8ha4qqjjgweecy.point(cell, 0));
|
9077 |
+
}, function (cell) {
|
9078 |
+
return Option.some($_1x8ha4qqjjgweecy.point(cell, $_3uimohmjjjgwedf1.getEnd(cell)));
|
9079 |
+
});
|
9080 |
+
};
|
9081 |
+
var $_dudr5cqpjjgweec9 = {
|
9082 |
+
tryBr: tryBr,
|
9083 |
+
process: process
|
9084 |
+
};
|
9085 |
+
|
9086 |
+
var MAX_RETRIES = 20;
|
9087 |
+
var platform$1 = $_avfe9dlqjjgwedat.detect();
|
9088 |
+
var findSpot = function (bridge, isRoot, direction) {
|
9089 |
+
return bridge.getSelection().bind(function (sel) {
|
9090 |
+
return $_dudr5cqpjjgweec9.tryBr(isRoot, sel.finish(), sel.foffset(), direction).fold(function () {
|
9091 |
+
return Option.some($_1x8ha4qqjjgweecy.point(sel.finish(), sel.foffset()));
|
9092 |
+
}, function (brNeighbour) {
|
9093 |
+
var range = bridge.fromSitus(brNeighbour);
|
9094 |
+
var analysis = $_a6kfh3qojjgweebx.verify(bridge, sel.finish(), sel.foffset(), range.finish(), range.foffset(), direction.failure, isRoot);
|
9095 |
+
return $_dudr5cqpjjgweec9.process(analysis);
|
9096 |
});
|
9097 |
+
});
|
9098 |
+
};
|
9099 |
+
var scan = function (bridge, isRoot, element, offset, direction, numRetries) {
|
9100 |
+
if (numRetries === 0)
|
9101 |
+
return Option.none();
|
9102 |
+
return tryCursor(bridge, isRoot, element, offset, direction).bind(function (situs) {
|
9103 |
+
var range = bridge.fromSitus(situs);
|
9104 |
+
var analysis = $_a6kfh3qojjgweebx.verify(bridge, element, offset, range.finish(), range.foffset(), direction.failure, isRoot);
|
9105 |
+
return $_a6kfh3qojjgweebx.cata(analysis, function () {
|
9106 |
+
return Option.none();
|
9107 |
+
}, function () {
|
9108 |
+
return Option.some(situs);
|
9109 |
+
}, function (cell) {
|
9110 |
+
if ($_e1yh5slljjgwedae.eq(element, cell) && offset === 0)
|
9111 |
+
return tryAgain(bridge, element, offset, $_bdolgrqgjjgweea8.moveUp, direction);
|
9112 |
+
else
|
9113 |
+
return scan(bridge, isRoot, cell, 0, direction, numRetries - 1);
|
9114 |
+
}, function (cell) {
|
9115 |
+
if ($_e1yh5slljjgwedae.eq(element, cell) && offset === $_3uimohmjjjgwedf1.getEnd(cell))
|
9116 |
+
return tryAgain(bridge, element, offset, $_bdolgrqgjjgweea8.moveDown, direction);
|
9117 |
+
else
|
9118 |
+
return scan(bridge, isRoot, cell, $_3uimohmjjjgwedf1.getEnd(cell), direction, numRetries - 1);
|
9119 |
});
|
9120 |
+
});
|
9121 |
+
};
|
9122 |
+
var tryAgain = function (bridge, element, offset, move, direction) {
|
9123 |
+
return $_av2mpcqhjjgweeac.getBoxAt(bridge, element, offset).bind(function (box) {
|
9124 |
+
return tryAt(bridge, direction, move(box, $_1fi03fqijjgweeak.getJumpSize()));
|
9125 |
+
});
|
9126 |
+
};
|
9127 |
+
var tryAt = function (bridge, direction, box) {
|
9128 |
+
if (platform$1.browser.isChrome() || platform$1.browser.isSafari() || platform$1.browser.isFirefox() || platform$1.browser.isEdge())
|
9129 |
+
return direction.otherRetry(bridge, box);
|
9130 |
+
else if (platform$1.browser.isIE())
|
9131 |
+
return direction.ieRetry(bridge, box);
|
9132 |
+
else
|
9133 |
+
return Option.none();
|
9134 |
+
};
|
9135 |
+
var tryCursor = function (bridge, isRoot, element, offset, direction) {
|
9136 |
+
return $_av2mpcqhjjgweeac.getBoxAt(bridge, element, offset).bind(function (box) {
|
9137 |
+
return tryAt(bridge, direction, box);
|
9138 |
+
});
|
9139 |
+
};
|
9140 |
+
var handle$2 = function (bridge, isRoot, direction) {
|
9141 |
+
return findSpot(bridge, isRoot, direction).bind(function (spot) {
|
9142 |
+
return scan(bridge, isRoot, spot.element(), spot.offset(), direction, MAX_RETRIES).map(bridge.fromSitus);
|
9143 |
+
});
|
9144 |
+
};
|
9145 |
+
var $_9xio5dqfjjgwee9v = { handle: handle$2 };
|
9146 |
+
|
9147 |
+
var any$1 = function (predicate) {
|
9148 |
+
return $_6l4e4m8jjgwedci.first(predicate).isSome();
|
9149 |
+
};
|
9150 |
+
var ancestor$3 = function (scope, predicate, isRoot) {
|
9151 |
+
return $_6l4e4m8jjgwedci.ancestor(scope, predicate, isRoot).isSome();
|
9152 |
+
};
|
9153 |
+
var closest$3 = function (scope, predicate, isRoot) {
|
9154 |
+
return $_6l4e4m8jjgwedci.closest(scope, predicate, isRoot).isSome();
|
9155 |
+
};
|
9156 |
+
var sibling$3 = function (scope, predicate) {
|
9157 |
+
return $_6l4e4m8jjgwedci.sibling(scope, predicate).isSome();
|
9158 |
+
};
|
9159 |
+
var child$4 = function (scope, predicate) {
|
9160 |
+
return $_6l4e4m8jjgwedci.child(scope, predicate).isSome();
|
9161 |
+
};
|
9162 |
+
var descendant$3 = function (scope, predicate) {
|
9163 |
+
return $_6l4e4m8jjgwedci.descendant(scope, predicate).isSome();
|
9164 |
+
};
|
9165 |
+
var $_bi1r7cqsjjgweedb = {
|
9166 |
+
any: any$1,
|
9167 |
+
ancestor: ancestor$3,
|
9168 |
+
closest: closest$3,
|
9169 |
+
sibling: sibling$3,
|
9170 |
+
child: child$4,
|
9171 |
+
descendant: descendant$3
|
9172 |
+
};
|
9173 |
+
|
9174 |
+
var detection = $_avfe9dlqjjgwedat.detect();
|
9175 |
+
var inSameTable = function (elem, table) {
|
9176 |
+
return $_bi1r7cqsjjgweedb.ancestor(elem, function (e) {
|
9177 |
+
return $_97vsilljjjgwed9v.parent(e).exists(function (p) {
|
9178 |
+
return $_e1yh5slljjgwedae.eq(p, table);
|
9179 |
});
|
9180 |
+
});
|
9181 |
+
};
|
9182 |
+
|
9183 |
+
var simulate = function (bridge, isRoot, direction, initial, anchor) {
|
9184 |
+
return $_2e7p77m7jjgwedcg.closest(initial, 'td,th', isRoot).bind(function (start) {
|
9185 |
+
return $_2e7p77m7jjgwedcg.closest(start, 'table', isRoot).bind(function (table) {
|
9186 |
+
if (!inSameTable(anchor, table))
|
9187 |
+
return Option.none();
|
9188 |
+
return $_9xio5dqfjjgwee9v.handle(bridge, isRoot, direction).bind(function (range) {
|
9189 |
+
return $_2e7p77m7jjgwedcg.closest(range.finish(), 'td,th', isRoot).map(function (finish) {
|
9190 |
+
return {
|
9191 |
+
start: constant(start),
|
9192 |
+
finish: constant(finish),
|
9193 |
+
range: constant(range)
|
9194 |
+
};
|
9195 |
+
});
|
9196 |
+
});
|
9197 |
});
|
9198 |
+
});
|
9199 |
+
};
|
9200 |
+
var navigate = function (bridge, isRoot, direction, initial, anchor, precheck) {
|
9201 |
+
if (detection.browser.isIE()) {
|
9202 |
+
return Option.none();
|
9203 |
+
} else {
|
9204 |
+
return precheck(initial, isRoot).orThunk(function () {
|
9205 |
+
return simulate(bridge, isRoot, direction, initial, anchor).map(function (info) {
|
9206 |
+
var range = info.range();
|
9207 |
+
return $_3na9igq8jjgwee7o.response(Option.some($_9ndew9qbjjgwee88.makeSitus(range.start(), range.soffset(), range.finish(), range.foffset())), true);
|
9208 |
+
});
|
9209 |
});
|
9210 |
+
}
|
9211 |
+
};
|
9212 |
+
var firstUpCheck = function (initial, isRoot) {
|
9213 |
+
return $_2e7p77m7jjgwedcg.closest(initial, 'tr', isRoot).bind(function (startRow) {
|
9214 |
+
return $_2e7p77m7jjgwedcg.closest(startRow, 'table', isRoot).bind(function (table) {
|
9215 |
+
var rows = $_5ko5j3m4jjgwedc0.descendants(table, 'tr');
|
9216 |
+
if ($_e1yh5slljjgwedae.eq(startRow, rows[0])) {
|
9217 |
+
return $_5u2dgeqjjjgweeb9.seekLeft(table, function (element) {
|
9218 |
+
return $_cww1bpmijjgwedex.last(element).isSome();
|
9219 |
+
}, isRoot).map(function (last) {
|
9220 |
+
var lastOffset = $_3uimohmjjjgwedf1.getEnd(last);
|
9221 |
+
return $_3na9igq8jjgwee7o.response(Option.some($_9ndew9qbjjgwee88.makeSitus(last, lastOffset, last, lastOffset)), true);
|
9222 |
+
});
|
9223 |
+
} else {
|
9224 |
+
return Option.none();
|
9225 |
+
}
|
9226 |
});
|
9227 |
+
});
|
9228 |
+
};
|
9229 |
+
var lastDownCheck = function (initial, isRoot) {
|
9230 |
+
return $_2e7p77m7jjgwedcg.closest(initial, 'tr', isRoot).bind(function (startRow) {
|
9231 |
+
return $_2e7p77m7jjgwedcg.closest(startRow, 'table', isRoot).bind(function (table) {
|
9232 |
+
var rows = $_5ko5j3m4jjgwedc0.descendants(table, 'tr');
|
9233 |
+
if ($_e1yh5slljjgwedae.eq(startRow, rows[rows.length - 1])) {
|
9234 |
+
return $_5u2dgeqjjjgweeb9.seekRight(table, function (element) {
|
9235 |
+
return $_cww1bpmijjgwedex.first(element).isSome();
|
9236 |
+
}, isRoot).map(function (first) {
|
9237 |
+
return $_3na9igq8jjgwee7o.response(Option.some($_9ndew9qbjjgwee88.makeSitus(first, 0, first, 0)), true);
|
9238 |
+
});
|
9239 |
+
} else {
|
9240 |
+
return Option.none();
|
9241 |
+
}
|
9242 |
});
|
9243 |
+
});
|
9244 |
+
};
|
9245 |
+
var select = function (bridge, container, isRoot, direction, initial, anchor, selectRange) {
|
9246 |
+
return simulate(bridge, isRoot, direction, initial, anchor).bind(function (info) {
|
9247 |
+
return $_4jzcyzqdjjgwee8r.detect(container, isRoot, info.start(), info.finish(), selectRange);
|
9248 |
+
});
|
9249 |
+
};
|
9250 |
+
var $_eh32iiqejjgwee96 = {
|
9251 |
+
navigate: navigate,
|
9252 |
+
select: select,
|
9253 |
+
firstUpCheck: firstUpCheck,
|
9254 |
+
lastDownCheck: lastDownCheck
|
9255 |
+
};
|
9256 |
+
|
9257 |
+
var findCell = function (target, isRoot) {
|
9258 |
+
return $_2e7p77m7jjgwedcg.closest(target, 'td,th', isRoot);
|
9259 |
+
};
|
9260 |
+
function MouseSelection (bridge, container, isRoot, annotations) {
|
9261 |
+
var cursor = Option.none();
|
9262 |
+
var clearState = function () {
|
9263 |
+
cursor = Option.none();
|
9264 |
+
};
|
9265 |
+
var mousedown = function (event) {
|
9266 |
+
annotations.clear(container);
|
9267 |
+
cursor = findCell(event.target(), isRoot);
|
9268 |
+
};
|
9269 |
+
var mouseover = function (event) {
|
9270 |
+
cursor.each(function (start) {
|
9271 |
+
annotations.clear(container);
|
9272 |
+
findCell(event.target(), isRoot).each(function (finish) {
|
9273 |
+
$_cl87acmqjjgwedgo.identify(start, finish, isRoot).each(function (cellSel) {
|
9274 |
+
var boxes = cellSel.boxes().getOr([]);
|
9275 |
+
if (boxes.length > 1 || boxes.length === 1 && !$_e1yh5slljjgwedae.eq(start, finish)) {
|
9276 |
+
annotations.selectRange(container, boxes, cellSel.start(), cellSel.finish());
|
9277 |
+
bridge.selectContents(finish);
|
9278 |
+
}
|
9279 |
+
});
|
9280 |
+
});
|
9281 |
});
|
9282 |
+
};
|
9283 |
+
var mouseup = function () {
|
9284 |
+
cursor.each(clearState);
|
9285 |
+
};
|
9286 |
+
return {
|
9287 |
+
mousedown: mousedown,
|
9288 |
+
mouseover: mouseover,
|
9289 |
+
mouseup: mouseup
|
9290 |
+
};
|
9291 |
+
}
|
9292 |
+
|
9293 |
+
var $_4cnew2qujjgweedl = {
|
9294 |
+
down: {
|
9295 |
+
traverse: $_97vsilljjjgwed9v.nextSibling,
|
9296 |
+
gather: $_5u2dgeqjjjgweeb9.after,
|
9297 |
+
relative: $_6assppsjjgwee4k.before,
|
9298 |
+
otherRetry: $_1fi03fqijjgweeak.tryDown,
|
9299 |
+
ieRetry: $_1fi03fqijjgweeak.ieTryDown,
|
9300 |
+
failure: $_a6kfh3qojjgweebx.adt.failedDown
|
9301 |
+
},
|
9302 |
+
up: {
|
9303 |
+
traverse: $_97vsilljjjgwed9v.prevSibling,
|
9304 |
+
gather: $_5u2dgeqjjjgweeb9.before,
|
9305 |
+
relative: $_6assppsjjgwee4k.before,
|
9306 |
+
otherRetry: $_1fi03fqijjgweeak.tryUp,
|
9307 |
+
ieRetry: $_1fi03fqijjgweeak.ieTryUp,
|
9308 |
+
failure: $_a6kfh3qojjgweebx.adt.failedUp
|
9309 |
+
}
|
9310 |
+
};
|
9311 |
+
|
9312 |
+
var rc = Immutable('rows', 'cols');
|
9313 |
+
var mouse = function (win, container, isRoot, annotations) {
|
9314 |
+
var bridge = WindowBridge(win);
|
9315 |
+
var handlers = MouseSelection(bridge, container, isRoot, annotations);
|
9316 |
+
return {
|
9317 |
+
mousedown: handlers.mousedown,
|
9318 |
+
mouseover: handlers.mouseover,
|
9319 |
+
mouseup: handlers.mouseup
|
9320 |
+
};
|
9321 |
+
};
|
9322 |
+
var keyboard = function (win, container, isRoot, annotations) {
|
9323 |
+
var bridge = WindowBridge(win);
|
9324 |
+
var clearToNavigate = function () {
|
9325 |
+
annotations.clear(container);
|
9326 |
+
return Option.none();
|
9327 |
+
};
|
9328 |
+
var keydown = function (event, start, soffset, finish, foffset, direction) {
|
9329 |
+
var keycode = event.raw().which;
|
9330 |
+
var shiftKey = event.raw().shiftKey === true;
|
9331 |
+
var handler = $_cl87acmqjjgwedgo.retrieve(container, annotations.selectedSelector()).fold(function () {
|
9332 |
+
if ($_gu1pzq9jjgwee7r.isDown(keycode) && shiftKey) {
|
9333 |
+
return curry($_eh32iiqejjgwee96.select, bridge, container, isRoot, $_4cnew2qujjgweedl.down, finish, start, annotations.selectRange);
|
9334 |
+
} else if ($_gu1pzq9jjgwee7r.isUp(keycode) && shiftKey) {
|
9335 |
+
return curry($_eh32iiqejjgwee96.select, bridge, container, isRoot, $_4cnew2qujjgweedl.up, finish, start, annotations.selectRange);
|
9336 |
+
} else if ($_gu1pzq9jjgwee7r.isDown(keycode)) {
|
9337 |
+
return curry($_eh32iiqejjgwee96.navigate, bridge, isRoot, $_4cnew2qujjgweedl.down, finish, start, $_eh32iiqejjgwee96.lastDownCheck);
|
9338 |
+
} else if ($_gu1pzq9jjgwee7r.isUp(keycode)) {
|
9339 |
+
return curry($_eh32iiqejjgwee96.navigate, bridge, isRoot, $_4cnew2qujjgweedl.up, finish, start, $_eh32iiqejjgwee96.firstUpCheck);
|
9340 |
+
} else {
|
9341 |
+
return Option.none;
|
9342 |
+
}
|
9343 |
+
}, function (selected) {
|
9344 |
+
var update = function (attempts) {
|
9345 |
+
return function () {
|
9346 |
+
var navigation = findMap(attempts, function (delta) {
|
9347 |
+
return $_4jzcyzqdjjgwee8r.update(delta.rows(), delta.cols(), container, selected, annotations);
|
9348 |
+
});
|
9349 |
+
return navigation.fold(function () {
|
9350 |
+
return $_cl87acmqjjgwedgo.getEdges(container, annotations.firstSelectedSelector(), annotations.lastSelectedSelector()).map(function (edges) {
|
9351 |
+
var relative = $_gu1pzq9jjgwee7r.isDown(keycode) || direction.isForward(keycode) ? $_6assppsjjgwee4k.after : $_6assppsjjgwee4k.before;
|
9352 |
+
bridge.setRelativeSelection($_6assppsjjgwee4k.on(edges.first(), 0), relative(edges.table()));
|
9353 |
+
annotations.clear(container);
|
9354 |
+
return $_3na9igq8jjgwee7o.response(Option.none(), true);
|
9355 |
+
});
|
9356 |
+
}, function (_) {
|
9357 |
+
return Option.some($_3na9igq8jjgwee7o.response(Option.none(), true));
|
9358 |
+
});
|
9359 |
+
};
|
9360 |
+
};
|
9361 |
+
if ($_gu1pzq9jjgwee7r.isDown(keycode) && shiftKey)
|
9362 |
+
return update([rc(+1, 0)]);
|
9363 |
+
else if ($_gu1pzq9jjgwee7r.isUp(keycode) && shiftKey)
|
9364 |
+
return update([rc(-1, 0)]);
|
9365 |
+
else if (direction.isBackward(keycode) && shiftKey)
|
9366 |
+
return update([
|
9367 |
+
rc(0, -1),
|
9368 |
+
rc(-1, 0)
|
9369 |
+
]);
|
9370 |
+
else if (direction.isForward(keycode) && shiftKey)
|
9371 |
+
return update([
|
9372 |
+
rc(0, +1),
|
9373 |
+
rc(+1, 0)
|
9374 |
+
]);
|
9375 |
+
else if ($_gu1pzq9jjgwee7r.isNavigation(keycode) && shiftKey === false)
|
9376 |
+
return clearToNavigate;
|
9377 |
+
else
|
9378 |
+
return Option.none;
|
9379 |
});
|
9380 |
+
return handler();
|
9381 |
};
|
9382 |
+
var keyup = function (event, start, soffset, finish, foffset) {
|
9383 |
+
return $_cl87acmqjjgwedgo.retrieve(container, annotations.selectedSelector()).fold(function () {
|
9384 |
+
var keycode = event.raw().which;
|
9385 |
+
var shiftKey = event.raw().shiftKey === true;
|
9386 |
+
if (shiftKey === false)
|
9387 |
+
return Option.none();
|
9388 |
+
if ($_gu1pzq9jjgwee7r.isNavigation(keycode))
|
9389 |
+
return $_4jzcyzqdjjgwee8r.sync(container, isRoot, start, soffset, finish, foffset, annotations.selectRange);
|
9390 |
+
else
|
9391 |
+
return Option.none();
|
9392 |
+
}, Option.none);
|
9393 |
};
|
9394 |
+
return {
|
9395 |
+
keydown: keydown,
|
9396 |
+
keyup: keyup
|
9397 |
};
|
9398 |
+
};
|
9399 |
+
var $_7p3759q7jjgwee7b = {
|
9400 |
+
mouse: mouse,
|
9401 |
+
keyboard: keyboard
|
9402 |
+
};
|
9403 |
|
9404 |
+
var add$3 = function (element, classes) {
|
9405 |
+
each(classes, function (x) {
|
9406 |
+
$_btizb5o3jjgwedsg.add(element, x);
|
9407 |
+
});
|
9408 |
+
};
|
9409 |
+
var remove$7 = function (element, classes) {
|
9410 |
+
each(classes, function (x) {
|
9411 |
+
$_btizb5o3jjgwedsg.remove(element, x);
|
9412 |
+
});
|
9413 |
+
};
|
9414 |
+
var toggle$2 = function (element, classes) {
|
9415 |
+
each(classes, function (x) {
|
9416 |
+
$_btizb5o3jjgwedsg.toggle(element, x);
|
9417 |
+
});
|
9418 |
+
};
|
9419 |
+
var hasAll = function (element, classes) {
|
9420 |
+
return forall(classes, function (clazz) {
|
9421 |
+
return $_btizb5o3jjgwedsg.has(element, clazz);
|
9422 |
+
});
|
9423 |
+
};
|
9424 |
+
var hasAny = function (element, classes) {
|
9425 |
+
return exists(classes, function (clazz) {
|
9426 |
+
return $_btizb5o3jjgwedsg.has(element, clazz);
|
9427 |
+
});
|
9428 |
+
};
|
9429 |
+
var getNative = function (element) {
|
9430 |
+
var classList = element.dom().classList;
|
9431 |
+
var r = new Array(classList.length);
|
9432 |
+
for (var i = 0; i < classList.length; i++) {
|
9433 |
+
r[i] = classList.item(i);
|
9434 |
+
}
|
9435 |
+
return r;
|
9436 |
+
};
|
9437 |
+
var get$11 = function (element) {
|
9438 |
+
return $_f1c8m0o5jjgwedsj.supports(element) ? getNative(element) : $_f1c8m0o5jjgwedsj.get(element);
|
9439 |
+
};
|
9440 |
+
var $_ao71zoqxjjgweee6 = {
|
9441 |
+
add: add$3,
|
9442 |
+
remove: remove$7,
|
9443 |
+
toggle: toggle$2,
|
9444 |
+
hasAll: hasAll,
|
9445 |
+
hasAny: hasAny,
|
9446 |
+
get: get$11
|
9447 |
+
};
|
9448 |
+
|
9449 |
+
var addClass = function (clazz) {
|
9450 |
+
return function (element) {
|
9451 |
+
$_btizb5o3jjgwedsg.add(element, clazz);
|
9452 |
+
};
|
9453 |
+
};
|
9454 |
+
var removeClass = function (clazz) {
|
9455 |
+
return function (element) {
|
9456 |
+
$_btizb5o3jjgwedsg.remove(element, clazz);
|
9457 |
+
};
|
9458 |
+
};
|
9459 |
+
var removeClasses = function (classes) {
|
9460 |
+
return function (element) {
|
9461 |
+
$_ao71zoqxjjgweee6.remove(element, classes);
|
9462 |
+
};
|
9463 |
+
};
|
9464 |
+
var hasClass = function (clazz) {
|
9465 |
+
return function (element) {
|
9466 |
+
return $_btizb5o3jjgwedsg.has(element, clazz);
|
9467 |
+
};
|
9468 |
+
};
|
9469 |
+
var $_ef67inqwjjgweee5 = {
|
9470 |
+
addClass: addClass,
|
9471 |
+
removeClass: removeClass,
|
9472 |
+
removeClasses: removeClasses,
|
9473 |
+
hasClass: hasClass
|
9474 |
+
};
|
9475 |
+
|
9476 |
+
var byClass = function (ephemera) {
|
9477 |
+
var addSelectionClass = $_ef67inqwjjgweee5.addClass(ephemera.selected());
|
9478 |
+
var removeSelectionClasses = $_ef67inqwjjgweee5.removeClasses([
|
9479 |
+
ephemera.selected(),
|
9480 |
+
ephemera.lastSelected(),
|
9481 |
+
ephemera.firstSelected()
|
9482 |
+
]);
|
9483 |
+
var clear = function (container) {
|
9484 |
+
var sels = $_5ko5j3m4jjgwedc0.descendants(container, ephemera.selectedSelector());
|
9485 |
+
each(sels, removeSelectionClasses);
|
9486 |
+
};
|
9487 |
+
var selectRange = function (container, cells, start, finish) {
|
9488 |
+
clear(container);
|
9489 |
+
each(cells, addSelectionClass);
|
9490 |
+
$_btizb5o3jjgwedsg.add(start, ephemera.firstSelected());
|
9491 |
+
$_btizb5o3jjgwedsg.add(finish, ephemera.lastSelected());
|
9492 |
+
};
|
9493 |
+
return {
|
9494 |
+
clear: clear,
|
9495 |
+
selectRange: selectRange,
|
9496 |
+
selectedSelector: ephemera.selectedSelector,
|
9497 |
+
firstSelectedSelector: ephemera.firstSelectedSelector,
|
9498 |
+
lastSelectedSelector: ephemera.lastSelectedSelector
|
9499 |
+
};
|
9500 |
+
};
|
9501 |
+
var byAttr = function (ephemera) {
|
9502 |
+
var removeSelectionAttributes = function (element) {
|
9503 |
+
$_72hn9pm2jjgwedbq.remove(element, ephemera.selected());
|
9504 |
+
$_72hn9pm2jjgwedbq.remove(element, ephemera.firstSelected());
|
9505 |
+
$_72hn9pm2jjgwedbq.remove(element, ephemera.lastSelected());
|
9506 |
+
};
|
9507 |
+
var addSelectionAttribute = function (element) {
|
9508 |
+
$_72hn9pm2jjgwedbq.set(element, ephemera.selected(), '1');
|
9509 |
+
};
|
9510 |
+
var clear = function (container) {
|
9511 |
+
var sels = $_5ko5j3m4jjgwedc0.descendants(container, ephemera.selectedSelector());
|
9512 |
+
each(sels, removeSelectionAttributes);
|
9513 |
+
};
|
9514 |
+
var selectRange = function (container, cells, start, finish) {
|
9515 |
+
clear(container);
|
9516 |
+
each(cells, addSelectionAttribute);
|
9517 |
+
$_72hn9pm2jjgwedbq.set(start, ephemera.firstSelected(), '1');
|
9518 |
+
$_72hn9pm2jjgwedbq.set(finish, ephemera.lastSelected(), '1');
|
9519 |
+
};
|
9520 |
+
return {
|
9521 |
+
clear: clear,
|
9522 |
+
selectRange: selectRange,
|
9523 |
+
selectedSelector: ephemera.selectedSelector,
|
9524 |
+
firstSelectedSelector: ephemera.firstSelectedSelector,
|
9525 |
+
lastSelectedSelector: ephemera.lastSelectedSelector
|
9526 |
+
};
|
9527 |
+
};
|
9528 |
+
var $_4jpay1qvjjgweedt = {
|
9529 |
+
byClass: byClass,
|
9530 |
+
byAttr: byAttr
|
9531 |
+
};
|
9532 |
+
|
9533 |
+
var hasInternalTarget = function (e) {
|
9534 |
+
return $_btizb5o3jjgwedsg.has(Element$$1.fromDom(e.target), 'ephox-snooker-resizer-bar') === false;
|
9535 |
+
};
|
9536 |
+
function CellSelection$1 (editor, lazyResize) {
|
9537 |
+
var handlerStruct = MixedBag([
|
9538 |
+
'mousedown',
|
9539 |
+
'mouseover',
|
9540 |
+
'mouseup',
|
9541 |
+
'keyup',
|
9542 |
+
'keydown'
|
9543 |
+
], []);
|
9544 |
+
var handlers = Option.none();
|
9545 |
+
var annotations = $_4jpay1qvjjgweedt.byAttr($_b2a4bzn2jjgwedjz);
|
9546 |
+
editor.on('init', function (e) {
|
9547 |
+
var win = editor.getWin();
|
9548 |
+
var body = getBody$1(editor);
|
9549 |
+
var isRoot = getIsRoot(editor);
|
9550 |
+
var syncSelection = function () {
|
9551 |
+
var sel = editor.selection;
|
9552 |
+
var start = Element$$1.fromDom(sel.getStart());
|
9553 |
+
var end = Element$$1.fromDom(sel.getEnd());
|
9554 |
+
var shared = $_92t9ismrjjgwedhe.sharedOne($_bmlvw1ldjjgwed84.table, [
|
9555 |
+
start,
|
9556 |
+
end
|
9557 |
+
]);
|
9558 |
+
shared.fold(function () {
|
9559 |
+
annotations.clear(body);
|
9560 |
+
}, noop);
|
9561 |
};
|
9562 |
+
var mouseHandlers = $_7p3759q7jjgwee7b.mouse(win, body, isRoot, annotations);
|
9563 |
+
var keyHandlers = $_7p3759q7jjgwee7b.keyboard(win, body, isRoot, annotations);
|
9564 |
+
var hasShiftKey = function (event) {
|
9565 |
+
return event.raw().shiftKey === true;
|
|
|
|
|
|
|
|
|
9566 |
};
|
9567 |
+
var handleResponse = function (event, response) {
|
9568 |
+
if (!hasShiftKey(event)) {
|
9569 |
+
return;
|
9570 |
+
}
|
9571 |
+
if (response.kill()) {
|
9572 |
+
event.kill();
|
9573 |
+
}
|
9574 |
+
response.selection().each(function (ns) {
|
9575 |
+
var relative = $_afru5jprjjgwee4e.relative(ns.start(), ns.finish());
|
9576 |
+
var rng = $_5s2zljpxjjgwee5b.asLtrRange(win, relative);
|
9577 |
+
editor.selection.setRng(rng);
|
9578 |
});
|
9579 |
};
|
9580 |
+
var keyup = function (event) {
|
9581 |
+
var wrappedEvent = wrapEvent(event);
|
9582 |
+
if (wrappedEvent.raw().shiftKey && $_gu1pzq9jjgwee7r.isNavigation(wrappedEvent.raw().which)) {
|
9583 |
+
var rng = editor.selection.getRng();
|
9584 |
+
var start = Element$$1.fromDom(rng.startContainer);
|
9585 |
+
var end = Element$$1.fromDom(rng.endContainer);
|
9586 |
+
keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) {
|
9587 |
+
handleResponse(wrappedEvent, response);
|
9588 |
+
});
|
9589 |
+
}
|
9590 |
};
|
9591 |
+
var keydown = function (event) {
|
9592 |
+
var wrappedEvent = wrapEvent(event);
|
9593 |
+
lazyResize().each(function (resize) {
|
9594 |
+
resize.hideBars();
|
|
|
|
|
|
|
9595 |
});
|
9596 |
+
var rng = editor.selection.getRng();
|
9597 |
+
var startContainer = Element$$1.fromDom(editor.selection.getStart());
|
9598 |
+
var start = Element$$1.fromDom(rng.startContainer);
|
9599 |
+
var end = Element$$1.fromDom(rng.endContainer);
|
9600 |
+
var direction = $_dowdxdoljjgwedvp.directionAt(startContainer).isRtl() ? $_gu1pzq9jjgwee7r.rtl : $_gu1pzq9jjgwee7r.ltr;
|
9601 |
+
keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) {
|
9602 |
+
handleResponse(wrappedEvent, response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9603 |
});
|
9604 |
+
lazyResize().each(function (resize) {
|
9605 |
+
resize.showBars();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9606 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9607 |
};
|
9608 |
+
var isMouseEvent = function (event) {
|
9609 |
+
return event.hasOwnProperty('x') && event.hasOwnProperty('y');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9610 |
};
|
9611 |
+
var wrapEvent = function (event) {
|
9612 |
+
var target = Element$$1.fromDom(event.target);
|
9613 |
+
var stop = function () {
|
9614 |
+
event.stopPropagation();
|
9615 |
+
};
|
9616 |
+
var prevent = function () {
|
9617 |
+
event.preventDefault();
|
9618 |
+
};
|
9619 |
+
var kill = compose(prevent, stop);
|
9620 |
+
return {
|
9621 |
+
target: constant(target),
|
9622 |
+
x: constant(isMouseEvent(event) ? event.x : null),
|
9623 |
+
y: constant(isMouseEvent(event) ? event.y : null),
|
9624 |
+
stop: stop,
|
9625 |
+
prevent: prevent,
|
9626 |
+
kill: kill,
|
9627 |
+
raw: constant(event)
|
9628 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
9629 |
};
|
9630 |
+
var isLeftMouse = function (raw) {
|
9631 |
+
return raw.button === 0;
|
|
|
|
|
|
|
9632 |
};
|
9633 |
+
var isLeftButtonPressed = function (raw) {
|
9634 |
+
if (raw.buttons === undefined) {
|
9635 |
+
return true;
|
9636 |
+
}
|
9637 |
+
return (raw.buttons & 1) !== 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9638 |
};
|
9639 |
+
var mouseDown = function (e) {
|
9640 |
+
if (isLeftMouse(e) && hasInternalTarget(e)) {
|
9641 |
+
mouseHandlers.mousedown(wrapEvent(e));
|
9642 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9643 |
};
|
9644 |
+
var mouseOver = function (e) {
|
9645 |
+
if (isLeftButtonPressed(e) && hasInternalTarget(e)) {
|
9646 |
+
mouseHandlers.mouseover(wrapEvent(e));
|
9647 |
+
}
|
9648 |
+
};
|
9649 |
+
var mouseUp = function (e) {
|
9650 |
+
if (isLeftMouse(e) && hasInternalTarget(e)) {
|
9651 |
+
mouseHandlers.mouseup(wrapEvent(e));
|
9652 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9653 |
};
|
9654 |
+
editor.on('mousedown', mouseDown);
|
9655 |
+
editor.on('mouseover', mouseOver);
|
9656 |
+
editor.on('mouseup', mouseUp);
|
9657 |
+
editor.on('keyup', keyup);
|
9658 |
+
editor.on('keydown', keydown);
|
9659 |
+
editor.on('nodechange', syncSelection);
|
9660 |
+
handlers = Option.some(handlerStruct({
|
9661 |
+
mousedown: mouseDown,
|
9662 |
+
mouseover: mouseOver,
|
9663 |
+
mouseup: mouseUp,
|
9664 |
+
keyup: keyup,
|
9665 |
+
keydown: keydown
|
9666 |
+
}));
|
9667 |
+
});
|
9668 |
+
var destroy = function () {
|
9669 |
+
handlers.each(function (handlers) {
|
9670 |
+
});
|
9671 |
};
|
9672 |
+
return {
|
9673 |
+
clear: annotations.clear,
|
9674 |
+
destroy: destroy
|
9675 |
+
};
|
9676 |
+
}
|
9677 |
|
9678 |
+
var Selections = function (editor) {
|
9679 |
+
var get = function () {
|
9680 |
+
var body = getBody$1(editor);
|
9681 |
+
return $_9sh63kmpjjgwedg7.retrieve(body, $_b2a4bzn2jjgwedjz.selectedSelector()).fold(function () {
|
9682 |
+
if (editor.selection.getStart() === undefined) {
|
9683 |
+
return $_a362bzn3jjgwedk2.none();
|
9684 |
+
} else {
|
9685 |
+
return $_a362bzn3jjgwedk2.single(editor.selection);
|
9686 |
+
}
|
9687 |
+
}, function (cells) {
|
9688 |
+
return $_a362bzn3jjgwedk2.multiple(cells);
|
9689 |
+
});
|
9690 |
+
};
|
9691 |
+
return { get: get };
|
9692 |
+
};
|
9693 |
+
|
9694 |
+
var each$4 = global$1.each;
|
9695 |
+
var addButtons = function (editor) {
|
9696 |
+
var menuItems = [];
|
9697 |
+
each$4('inserttable tableprops deletetable | cell row column'.split(' '), function (name) {
|
9698 |
+
if (name === '|') {
|
9699 |
+
menuItems.push({ text: '-' });
|
9700 |
+
} else {
|
9701 |
+
menuItems.push(editor.menuItems[name]);
|
9702 |
+
}
|
9703 |
+
});
|
9704 |
+
editor.addButton('table', {
|
9705 |
+
type: 'menubutton',
|
9706 |
+
title: 'Table',
|
9707 |
+
menu: menuItems
|
9708 |
+
});
|
9709 |
+
function cmd(command) {
|
9710 |
+
return function () {
|
9711 |
+
editor.execCommand(command);
|
9712 |
+
};
|
9713 |
+
}
|
9714 |
+
editor.addButton('tableprops', {
|
9715 |
+
title: 'Table properties',
|
9716 |
+
onclick: cmd('mceTableProps'),
|
9717 |
+
icon: 'table'
|
9718 |
+
});
|
9719 |
+
editor.addButton('tabledelete', {
|
9720 |
+
title: 'Delete table',
|
9721 |
+
onclick: cmd('mceTableDelete')
|
9722 |
+
});
|
9723 |
+
editor.addButton('tablecellprops', {
|
9724 |
+
title: 'Cell properties',
|
9725 |
+
onclick: cmd('mceTableCellProps')
|
9726 |
+
});
|
9727 |
+
editor.addButton('tablemergecells', {
|
9728 |
+
title: 'Merge cells',
|
9729 |
+
onclick: cmd('mceTableMergeCells')
|
9730 |
+
});
|
9731 |
+
editor.addButton('tablesplitcells', {
|
9732 |
+
title: 'Split cell',
|
9733 |
+
onclick: cmd('mceTableSplitCells')
|
9734 |
+
});
|
9735 |
+
editor.addButton('tableinsertrowbefore', {
|
9736 |
+
title: 'Insert row before',
|
9737 |
+
onclick: cmd('mceTableInsertRowBefore')
|
9738 |
+
});
|
9739 |
+
editor.addButton('tableinsertrowafter', {
|
9740 |
+
title: 'Insert row after',
|
9741 |
+
onclick: cmd('mceTableInsertRowAfter')
|
9742 |
+
});
|
9743 |
+
editor.addButton('tabledeleterow', {
|
9744 |
+
title: 'Delete row',
|
9745 |
+
onclick: cmd('mceTableDeleteRow')
|
9746 |
+
});
|
9747 |
+
editor.addButton('tablerowprops', {
|
9748 |
+
title: 'Row properties',
|
9749 |
+
onclick: cmd('mceTableRowProps')
|
9750 |
+
});
|
9751 |
+
editor.addButton('tablecutrow', {
|
9752 |
+
title: 'Cut row',
|
9753 |
+
onclick: cmd('mceTableCutRow')
|
9754 |
+
});
|
9755 |
+
editor.addButton('tablecopyrow', {
|
9756 |
+
title: 'Copy row',
|
9757 |
+
onclick: cmd('mceTableCopyRow')
|
9758 |
+
});
|
9759 |
+
editor.addButton('tablepasterowbefore', {
|
9760 |
+
title: 'Paste row before',
|
9761 |
+
onclick: cmd('mceTablePasteRowBefore')
|
9762 |
+
});
|
9763 |
+
editor.addButton('tablepasterowafter', {
|
9764 |
+
title: 'Paste row after',
|
9765 |
+
onclick: cmd('mceTablePasteRowAfter')
|
9766 |
+
});
|
9767 |
+
editor.addButton('tableinsertcolbefore', {
|
9768 |
+
title: 'Insert column before',
|
9769 |
+
onclick: cmd('mceTableInsertColBefore')
|
9770 |
+
});
|
9771 |
+
editor.addButton('tableinsertcolafter', {
|
9772 |
+
title: 'Insert column after',
|
9773 |
+
onclick: cmd('mceTableInsertColAfter')
|
9774 |
+
});
|
9775 |
+
editor.addButton('tabledeletecol', {
|
9776 |
+
title: 'Delete column',
|
9777 |
+
onclick: cmd('mceTableDeleteCol')
|
9778 |
+
});
|
9779 |
+
};
|
9780 |
+
var addToolbars = function (editor) {
|
9781 |
+
var isTable = function (table) {
|
9782 |
+
var selectorMatched = editor.dom.is(table, 'table') && editor.getBody().contains(table);
|
9783 |
+
return selectorMatched;
|
9784 |
+
};
|
9785 |
+
var toolbar = getToolbar(editor);
|
9786 |
+
if (toolbar.length > 0) {
|
9787 |
+
editor.addContextToolbar(isTable, toolbar.join(' '));
|
9788 |
+
}
|
9789 |
+
};
|
9790 |
+
var $_daea7jqzjjgweeee = {
|
9791 |
+
addButtons: addButtons,
|
9792 |
+
addToolbars: addToolbars
|
9793 |
+
};
|
9794 |
+
|
9795 |
+
var addMenuItems = function (editor, selections) {
|
9796 |
+
var targets = Option.none();
|
9797 |
+
var tableCtrls = [];
|
9798 |
+
var cellCtrls = [];
|
9799 |
+
var mergeCtrls = [];
|
9800 |
+
var unmergeCtrls = [];
|
9801 |
+
var noTargetDisable = function (ctrl) {
|
9802 |
+
ctrl.disabled(true);
|
9803 |
+
};
|
9804 |
+
var ctrlEnable = function (ctrl) {
|
9805 |
+
ctrl.disabled(false);
|
9806 |
+
};
|
9807 |
+
var pushTable = function () {
|
9808 |
+
var self = this;
|
9809 |
+
tableCtrls.push(self);
|
9810 |
+
targets.fold(function () {
|
9811 |
+
noTargetDisable(self);
|
9812 |
+
}, function (targets) {
|
9813 |
+
ctrlEnable(self);
|
9814 |
+
});
|
9815 |
+
};
|
9816 |
+
var pushCell = function () {
|
9817 |
+
var self = this;
|
9818 |
+
cellCtrls.push(self);
|
9819 |
+
targets.fold(function () {
|
9820 |
+
noTargetDisable(self);
|
9821 |
+
}, function (targets) {
|
9822 |
+
ctrlEnable(self);
|
9823 |
+
});
|
9824 |
+
};
|
9825 |
+
var pushMerge = function () {
|
9826 |
+
var self = this;
|
9827 |
+
mergeCtrls.push(self);
|
9828 |
+
targets.fold(function () {
|
9829 |
+
noTargetDisable(self);
|
9830 |
+
}, function (targets) {
|
9831 |
+
self.disabled(targets.mergable().isNone());
|
9832 |
+
});
|
9833 |
+
};
|
9834 |
+
var pushUnmerge = function () {
|
9835 |
+
var self = this;
|
9836 |
+
unmergeCtrls.push(self);
|
9837 |
+
targets.fold(function () {
|
9838 |
+
noTargetDisable(self);
|
9839 |
+
}, function (targets) {
|
9840 |
+
self.disabled(targets.unmergable().isNone());
|
9841 |
+
});
|
9842 |
+
};
|
9843 |
+
var setDisabledCtrls = function () {
|
9844 |
+
targets.fold(function () {
|
9845 |
+
each(tableCtrls, noTargetDisable);
|
9846 |
+
each(cellCtrls, noTargetDisable);
|
9847 |
+
each(mergeCtrls, noTargetDisable);
|
9848 |
+
each(unmergeCtrls, noTargetDisable);
|
9849 |
+
}, function (targets) {
|
9850 |
+
each(tableCtrls, ctrlEnable);
|
9851 |
+
each(cellCtrls, ctrlEnable);
|
9852 |
+
each(mergeCtrls, function (mergeCtrl) {
|
9853 |
+
mergeCtrl.disabled(targets.mergable().isNone());
|
9854 |
+
});
|
9855 |
+
each(unmergeCtrls, function (unmergeCtrl) {
|
9856 |
+
unmergeCtrl.disabled(targets.unmergable().isNone());
|
9857 |
});
|
9858 |
});
|
9859 |
};
|
9860 |
+
editor.on('init', function () {
|
9861 |
+
editor.on('nodechange', function (e) {
|
9862 |
+
var cellOpt = Option.from(editor.dom.getParent(editor.selection.getStart(), 'th,td'));
|
9863 |
+
targets = cellOpt.bind(function (cellDom) {
|
9864 |
+
var cell = Element$$1.fromDom(cellDom);
|
9865 |
+
var table = $_bmlvw1ldjjgwed84.table(cell);
|
9866 |
+
return table.map(function (table) {
|
9867 |
+
return $_a5s279mnjjgwedff.forMenu(selections, table, cell);
|
9868 |
+
});
|
9869 |
+
});
|
9870 |
+
setDisabledCtrls();
|
9871 |
+
});
|
9872 |
+
});
|
9873 |
+
var generateTableGrid = function () {
|
9874 |
+
var html = '';
|
9875 |
+
html = '<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';
|
9876 |
+
for (var y = 0; y < 10; y++) {
|
9877 |
+
html += '<tr>';
|
9878 |
+
for (var x = 0; x < 10; x++) {
|
9879 |
+
html += '<td role="gridcell" tabindex="-1"><a id="mcegrid' + (y * 10 + x) + '" href="#" ' + 'data-mce-x="' + x + '" data-mce-y="' + y + '"></a></td>';
|
9880 |
+
}
|
9881 |
+
html += '</tr>';
|
9882 |
+
}
|
9883 |
+
html += '</table>';
|
9884 |
+
html += '<div class="mce-text-center" role="presentation">1 x 1</div>';
|
9885 |
+
return html;
|
9886 |
+
};
|
9887 |
+
var selectGrid = function (editor, tx, ty, control) {
|
9888 |
+
var table = control.getEl().getElementsByTagName('table')[0];
|
9889 |
+
var x, y, focusCell, cell, active;
|
9890 |
+
var rtl = control.isRtl() || control.parent().rel === 'tl-tr';
|
9891 |
+
table.nextSibling.innerHTML = tx + 1 + ' x ' + (ty + 1);
|
9892 |
+
if (rtl) {
|
9893 |
+
tx = 9 - tx;
|
9894 |
+
}
|
9895 |
+
for (y = 0; y < 10; y++) {
|
9896 |
+
for (x = 0; x < 10; x++) {
|
9897 |
+
cell = table.rows[y].childNodes[x].firstChild;
|
9898 |
+
active = (rtl ? x >= tx : x <= tx) && y <= ty;
|
9899 |
+
editor.dom.toggleClass(cell, 'mce-active', active);
|
9900 |
+
if (active) {
|
9901 |
+
focusCell = cell;
|
9902 |
+
}
|
9903 |
+
}
|
9904 |
+
}
|
9905 |
+
return focusCell.parentNode;
|
9906 |
+
};
|
9907 |
+
var insertTable = hasTableGrid(editor) === false ? {
|
9908 |
+
text: 'Table',
|
9909 |
+
icon: 'table',
|
9910 |
+
context: 'table',
|
9911 |
+
onclick: cmd('mceInsertTable')
|
9912 |
+
} : {
|
9913 |
+
text: 'Table',
|
9914 |
+
icon: 'table',
|
9915 |
+
context: 'table',
|
9916 |
+
ariaHideMenu: true,
|
9917 |
+
onclick: function (e) {
|
9918 |
+
if (e.aria) {
|
9919 |
+
this.parent().hideAll();
|
9920 |
+
e.stopImmediatePropagation();
|
9921 |
+
editor.execCommand('mceInsertTable');
|
9922 |
+
}
|
9923 |
+
},
|
9924 |
+
onshow: function () {
|
9925 |
+
selectGrid(editor, 0, 0, this.menu.items()[0]);
|
9926 |
+
},
|
9927 |
+
onhide: function () {
|
9928 |
+
var elements = this.menu.items()[0].getEl().getElementsByTagName('a');
|
9929 |
+
editor.dom.removeClass(elements, 'mce-active');
|
9930 |
+
editor.dom.addClass(elements[0], 'mce-active');
|
9931 |
+
},
|
9932 |
+
menu: [{
|
9933 |
+
type: 'container',
|
9934 |
+
html: generateTableGrid(),
|
9935 |
+
onPostRender: function () {
|
9936 |
+
this.lastX = this.lastY = 0;
|
9937 |
+
},
|
9938 |
+
onmousemove: function (e) {
|
9939 |
+
var target = e.target;
|
9940 |
+
var x, y;
|
9941 |
+
if (target.tagName.toUpperCase() === 'A') {
|
9942 |
+
x = parseInt(target.getAttribute('data-mce-x'), 10);
|
9943 |
+
y = parseInt(target.getAttribute('data-mce-y'), 10);
|
9944 |
+
if (this.isRtl() || this.parent().rel === 'tl-tr') {
|
9945 |
+
x = 9 - x;
|
9946 |
+
}
|
9947 |
+
if (x !== this.lastX || y !== this.lastY) {
|
9948 |
+
selectGrid(editor, x, y, e.control);
|
9949 |
+
this.lastX = x;
|
9950 |
+
this.lastY = y;
|
9951 |
+
}
|
9952 |
+
}
|
9953 |
+
},
|
9954 |
+
onclick: function (e) {
|
9955 |
+
var self = this;
|
9956 |
+
if (e.target.tagName.toUpperCase() === 'A') {
|
9957 |
+
e.preventDefault();
|
9958 |
+
e.stopPropagation();
|
9959 |
+
self.parent().cancel();
|
9960 |
+
editor.undoManager.transact(function () {
|
9961 |
+
$_2ync79oyjjgwedxx.insert(editor, self.lastX + 1, self.lastY + 1);
|
9962 |
+
});
|
9963 |
+
editor.addVisual();
|
9964 |
+
}
|
9965 |
+
}
|
9966 |
+
}]
|
9967 |
};
|
9968 |
+
function cmd(command) {
|
9969 |
+
return function () {
|
9970 |
+
editor.execCommand(command);
|
9971 |
+
};
|
9972 |
+
}
|
9973 |
+
var tableProperties = {
|
9974 |
+
text: 'Table properties',
|
9975 |
+
context: 'table',
|
9976 |
+
onPostRender: pushTable,
|
9977 |
+
onclick: cmd('mceTableProps')
|
9978 |
+
};
|
9979 |
+
var deleteTable = {
|
9980 |
+
text: 'Delete table',
|
9981 |
+
context: 'table',
|
9982 |
+
onPostRender: pushTable,
|
9983 |
+
cmd: 'mceTableDelete'
|
9984 |
+
};
|
9985 |
+
var row = {
|
9986 |
+
text: 'Row',
|
9987 |
+
context: 'table',
|
9988 |
+
menu: [
|
9989 |
+
{
|
9990 |
+
text: 'Insert row before',
|
9991 |
+
onclick: cmd('mceTableInsertRowBefore'),
|
9992 |
+
onPostRender: pushCell
|
9993 |
+
},
|
9994 |
+
{
|
9995 |
+
text: 'Insert row after',
|
9996 |
+
onclick: cmd('mceTableInsertRowAfter'),
|
9997 |
+
onPostRender: pushCell
|
9998 |
+
},
|
9999 |
+
{
|
10000 |
+
text: 'Delete row',
|
10001 |
+
onclick: cmd('mceTableDeleteRow'),
|
10002 |
+
onPostRender: pushCell
|
10003 |
+
},
|
10004 |
+
{
|
10005 |
+
text: 'Row properties',
|
10006 |
+
onclick: cmd('mceTableRowProps'),
|
10007 |
+
onPostRender: pushCell
|
10008 |
},
|
10009 |
+
{ text: '-' },
|
10010 |
+
{
|
10011 |
+
text: 'Cut row',
|
10012 |
+
onclick: cmd('mceTableCutRow'),
|
10013 |
+
onPostRender: pushCell
|
10014 |
},
|
10015 |
+
{
|
10016 |
+
text: 'Copy row',
|
10017 |
+
onclick: cmd('mceTableCopyRow'),
|
10018 |
+
onPostRender: pushCell
|
10019 |
+
},
|
10020 |
+
{
|
10021 |
+
text: 'Paste row before',
|
10022 |
+
onclick: cmd('mceTablePasteRowBefore'),
|
10023 |
+
onPostRender: pushCell
|
10024 |
+
},
|
10025 |
+
{
|
10026 |
+
text: 'Paste row after',
|
10027 |
+
onclick: cmd('mceTablePasteRowAfter'),
|
10028 |
+
onPostRender: pushCell
|
10029 |
}
|
10030 |
+
]
|
10031 |
+
};
|
10032 |
+
var column = {
|
10033 |
+
text: 'Column',
|
10034 |
+
context: 'table',
|
10035 |
+
menu: [
|
10036 |
+
{
|
10037 |
+
text: 'Insert column before',
|
10038 |
+
onclick: cmd('mceTableInsertColBefore'),
|
10039 |
+
onPostRender: pushCell
|
10040 |
+
},
|
10041 |
+
{
|
10042 |
+
text: 'Insert column after',
|
10043 |
+
onclick: cmd('mceTableInsertColAfter'),
|
10044 |
+
onPostRender: pushCell
|
10045 |
+
},
|
10046 |
+
{
|
10047 |
+
text: 'Delete column',
|
10048 |
+
onclick: cmd('mceTableDeleteCol'),
|
10049 |
+
onPostRender: pushCell
|
10050 |
+
}
|
10051 |
+
]
|
10052 |
+
};
|
10053 |
+
var cell = {
|
10054 |
+
separator: 'before',
|
10055 |
+
text: 'Cell',
|
10056 |
+
context: 'table',
|
10057 |
+
menu: [
|
10058 |
+
{
|
10059 |
+
text: 'Cell properties',
|
10060 |
+
onclick: cmd('mceTableCellProps'),
|
10061 |
+
onPostRender: pushCell
|
10062 |
+
},
|
10063 |
+
{
|
10064 |
+
text: 'Merge cells',
|
10065 |
+
onclick: cmd('mceTableMergeCells'),
|
10066 |
+
onPostRender: pushMerge
|
10067 |
+
},
|
10068 |
+
{
|
10069 |
+
text: 'Split cell',
|
10070 |
+
onclick: cmd('mceTableSplitCells'),
|
10071 |
+
onPostRender: pushUnmerge
|
10072 |
+
}
|
10073 |
+
]
|
10074 |
+
};
|
10075 |
+
editor.addMenuItem('inserttable', insertTable);
|
10076 |
+
editor.addMenuItem('tableprops', tableProperties);
|
10077 |
+
editor.addMenuItem('deletetable', deleteTable);
|
10078 |
+
editor.addMenuItem('row', row);
|
10079 |
+
editor.addMenuItem('column', column);
|
10080 |
+
editor.addMenuItem('cell', cell);
|
10081 |
+
};
|
10082 |
+
var $_dgc9gzr0jjgweeei = { addMenuItems: addMenuItems };
|
10083 |
+
|
10084 |
+
var getClipboardRows = function (clipboardRows) {
|
10085 |
+
return clipboardRows.get().fold(function () {
|
10086 |
+
return;
|
10087 |
+
}, function (rows) {
|
10088 |
+
return map(rows, function (row) {
|
10089 |
+
return row.dom();
|
10090 |
});
|
10091 |
+
});
|
10092 |
+
};
|
10093 |
+
var setClipboardRows = function (rows, clipboardRows) {
|
10094 |
+
var sugarRows = map(rows, Element$$1.fromDom);
|
10095 |
+
clipboardRows.set(Option.from(sugarRows));
|
10096 |
+
};
|
10097 |
+
var getApi = function (editor, clipboardRows) {
|
10098 |
+
return {
|
10099 |
+
insertTable: function (columns, rows) {
|
10100 |
+
return $_2ync79oyjjgwedxx.insert(editor, columns, rows);
|
10101 |
+
},
|
10102 |
+
setClipboardRows: function (rows) {
|
10103 |
+
return setClipboardRows(rows, clipboardRows);
|
10104 |
+
},
|
10105 |
+
getClipboardRows: function () {
|
10106 |
+
return getClipboardRows(clipboardRows);
|
10107 |
}
|
10108 |
+
};
|
10109 |
+
};
|
10110 |
+
|
10111 |
+
function Plugin(editor) {
|
10112 |
+
var resizeHandler = ResizeHandler(editor);
|
10113 |
+
var cellSelection = CellSelection$1(editor, resizeHandler.lazyResize);
|
10114 |
+
var actions = TableActions(editor, resizeHandler.lazyWire);
|
10115 |
+
var selections = Selections(editor);
|
10116 |
+
var clipboardRows = Cell(Option.none());
|
10117 |
+
$_cnyxavopjjgwedw9.registerCommands(editor, actions, cellSelection, selections, clipboardRows);
|
10118 |
+
$_fqjxp5l0jjgwed5s.registerEvents(editor, selections, actions, cellSelection);
|
10119 |
+
$_dgc9gzr0jjgweeei.addMenuItems(editor, selections);
|
10120 |
+
$_daea7jqzjjgweeee.addButtons(editor);
|
10121 |
+
$_daea7jqzjjgweeee.addToolbars(editor);
|
10122 |
+
editor.on('PreInit', function () {
|
10123 |
+
editor.serializer.addTempAttr($_b2a4bzn2jjgwedjz.firstSelected());
|
10124 |
+
editor.serializer.addTempAttr($_b2a4bzn2jjgwedjz.lastSelected());
|
10125 |
+
});
|
10126 |
+
if (hasTabNavigation(editor)) {
|
10127 |
+
editor.on('keydown', function (e) {
|
10128 |
+
$_9cogwlpojjgwee3l.handle(e, editor, actions, resizeHandler.lazyWire);
|
10129 |
});
|
|
|
|
|
|
|
|
|
10130 |
}
|
10131 |
+
editor.on('remove', function () {
|
10132 |
+
resizeHandler.destroy();
|
10133 |
+
cellSelection.destroy();
|
10134 |
+
});
|
10135 |
+
return getApi(editor, clipboardRows);
|
10136 |
+
}
|
10137 |
+
global.add('table', Plugin);
|
10138 |
+
function Plugin$1 () {
|
10139 |
+
}
|
10140 |
|
10141 |
+
return Plugin$1;
|
10142 |
|
10143 |
}());
|
10144 |
})();
|
mce/table/plugin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},x=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},C=function(e){return function(){return e}},o=function(e){return e};function b(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.concat(e);return r.apply(null,n)}}var t,n,r,i,u,m=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},c=function(e){return e()},a=C(!1),l=C(!0),f=a,s=l,d=function(){return g},g=(i={fold:function(e,t){return e()},is:f,isSome:f,isNone:s,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:n,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:f,forall:s,filter:d,equals:t=function(e){return e.isNone()},equals_:t,toArray:function(){return[]},toString:C("none()")},Object.freeze&&Object.freeze(i),i),h=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:s,isNone:f,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return h(e(n))},ap:function(e){return e.fold(d,function(e){return h(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:g},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(f,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},R={some:h,none:d,from:function(e){return null===e||e===undefined?g:h(e)}},p=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},v=p("string"),w=p("array"),S=p("boolean"),T=p("function"),D=p("number"),O=(u=Array.prototype.indexOf)===undefined?function(e,t){return _(e,t)}:function(e,t){return u.call(e,t)},k=function(e,t){return-1<O(e,t)},N=function(e,t){return M(e,t).isSome()},E=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},A=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},P=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},I=function(e,t,n){return function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)}(e,function(e){n=t(n,e)}),n},B=function(e,t,n){return A(e,function(e){n=t(n,e)}),n},W=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return R.some(o)}return R.none()},M=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return R.some(n);return R.none()},_=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},L=Array.prototype.push,j=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);L.apply(t,e[n])}return t},F=function(e,t){var n=E(e,t);return j(n)},z=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},H=Array.prototype.slice,U=function(e){var t=H.call(e,0);return t.reverse(),t},q=(T(Array.from)&&Array.from,Object.keys),V=function(e,t){for(var n=q(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},G=function(e,r){return Y(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},Y=function(r,o){var i={};return V(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},X=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return A(t,function(e,t){r[e]=C(n[t])}),r}},K=function(e){return e.slice(0).sort()},J=function(e,t){throw new Error("All required keys ("+K(e).join(", ")+") were not specified. Specified keys were: "+K(t).join(", ")+".")},$=function(e){throw new Error("Unsupported keys for object: "+K(e).join(", "))},Q=function(t,e){if(!w(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");A(e,function(e){if(!v(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},Z=function(e){var n=K(e);W(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})},ee=function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return Q("required",o),Q("optional",i),Z(u),function(t){var n=q(t);z(o,function(e){return k(n,e)})||J(o,n);var e=P(n,function(e){return!k(u,e)});0<e.length&&$(e);var r={};return A(o,function(e){r[e]=C(t[e])}),A(i,function(e){r[e]=C(Object.prototype.hasOwnProperty.call(t,e)?R.some(t[e]):R.none())}),r}},te=X("width","height"),ne=X("rows","columns"),re=X("row","column"),oe=X("x","y"),ie=X("element","rowspan","colspan"),ue=X("element","rowspan","colspan","isNew"),ae={dimensions:te,grid:ne,address:re,coords:oe,extended:X("element","rowspan","colspan","row","column"),detail:ie,detailnew:ue,rowdata:X("element","cells","section"),elementnew:X("element","isNew"),rowdatanew:X("element","cells","section","isNew"),rowcells:X("cells","section"),rowdetails:X("details","section"),bounds:X("startRow","startCol","finishRow","finishCol")},ce=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:C(e)}},le={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return ce(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return ce(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return ce(n)},fromDom:ce,fromPoint:function(e,t,n){var r=e.dom();return R.from(r.elementFromPoint(t,n)).map(ce)}},fe=(Node.ATTRIBUTE_NODE,Node.CDATA_SECTION_NODE,Node.COMMENT_NODE),se=Node.DOCUMENT_NODE,de=(Node.DOCUMENT_TYPE_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE),me=Node.TEXT_NODE,ge=(Node.PROCESSING_INSTRUCTION_NODE,Node.ENTITY_REFERENCE_NODE,Node.ENTITY_NODE,Node.NOTATION_NODE,de),he=se,pe=function(e,t){var n=e.dom();if(n.nodeType!==ge)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},ve=function(e){return e.nodeType!==ge&&e.nodeType!==he||0===e.childElementCount},be="undefined"!=typeof window?window:Function("return this;")(),we=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:be,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},ye=function(e,t){var n=we(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},xe=function(){return ye("Node")},Ce=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Re=function(e,t){return Ce(e,t,xe().DOCUMENT_POSITION_CONTAINED_BY)},Se=function(n){var r,o=!1;return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o||(o=!0,r=n.apply(null,e)),r}},Te=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return Oe(r(1),r(2))},De=function(){return Oe(0,0)},Oe=function(e,t){return{major:e,minor:t}},ke={nu:Oe,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?De():Te(e,n)},unknown:De},Ne="Firefox",Ee=function(e,t){return function(){return t===e}},Ae=function(e){var t=e.current;return{current:t,version:e.version,isEdge:Ee("Edge",t),isChrome:Ee("Chrome",t),isIE:Ee("IE",t),isOpera:Ee("Opera",t),isFirefox:Ee(Ne,t),isSafari:Ee("Safari",t)}},Pe={unknown:function(){return Ae({current:undefined,version:ke.unknown()})},nu:Ae,edge:C("Edge"),chrome:C("Chrome"),ie:C("IE"),opera:C("Opera"),firefox:C(Ne),safari:C("Safari")},Ie="Windows",Be="Android",We="Solaris",Me="FreeBSD",_e=function(e,t){return function(){return t===e}},Le=function(e){var t=e.current;return{current:t,version:e.version,isWindows:_e(Ie,t),isiOS:_e("iOS",t),isAndroid:_e(Be,t),isOSX:_e("OSX",t),isLinux:_e("Linux",t),isSolaris:_e(We,t),isFreeBSD:_e(Me,t)}},je={unknown:function(){return Le({current:undefined,version:ke.unknown()})},nu:Le,windows:C(Ie),ios:C("iOS"),android:C(Be),linux:C("Linux"),osx:C("OSX"),solaris:C(We),freebsd:C(Me)},Fe=function(e,t){var n=String(t).toLowerCase();return W(e,function(e){return e.search(n)})},ze=function(e,n){return Fe(e,n).map(function(e){var t=ke.detect(e.versionRegexes,n);return{current:e.name,version:t}})},He=function(e,n){return Fe(e,n).map(function(e){var t=ke.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ue=function(e,t){return-1!==e.indexOf(t)},qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Ve=function(t){return function(e){return Ue(e,t)}},Ge=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Ue(e,"edge/")&&Ue(e,"chrome")&&Ue(e,"safari")&&Ue(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,qe],search:function(e){return Ue(e,"chrome")&&!Ue(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Ue(e,"msie")||Ue(e,"trident")}},{name:"Opera",versionRegexes:[qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Ve("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Ve("firefox")},{name:"Safari",versionRegexes:[qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Ue(e,"safari")||Ue(e,"mobile/"))&&Ue(e,"applewebkit")}}],Ye=[{name:"Windows",search:Ve("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Ue(e,"iphone")||Ue(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Ve("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Ve("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Ve("linux"),versionRegexes:[]},{name:"Solaris",search:Ve("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Ve("freebsd"),versionRegexes:[]}],Xe={browsers:C(Ge),oses:C(Ye)},Ke=function(e){var t,n,r,o,i,u,a,c,l,f,s,d=Xe.browsers(),m=Xe.oses(),g=ze(d,e).fold(Pe.unknown,Pe.nu),h=He(m,e).fold(je.unknown,je.nu);return{browser:g,os:h,deviceType:(n=g,r=e,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),f=l&&!c,s=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:C(o),isiPhone:C(i),isTablet:C(c),isPhone:C(f),isTouch:C(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:C(s)})}},Je={detect:Se(function(){var e=navigator.userAgent;return Ke(e)})},$e=function(e,t){return e.dom()===t.dom()},Qe=Je.detect().browser.isIE()?function(e,t){return Re(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Ze=pe,et=function(e){return le.fromDom(e.dom().ownerDocument)},tt=function(e){var t=e.dom();return R.from(t.parentNode).map(le.fromDom)},nt=function(e,t){for(var n=T(t)?t:C(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=le.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},rt=function(e){var t=e.dom();return R.from(t.previousSibling).map(le.fromDom)},ot=function(e){var t=e.dom();return R.from(t.nextSibling).map(le.fromDom)},it=function(e){var t=e.dom();return E(t.childNodes,le.fromDom)},ut=function(e,t){var n=e.dom().childNodes;return R.from(n[t]).map(le.fromDom)},at=(X("element","offset"),function(e,t,n){return F(it(e),function(e){return pe(e,t)?n(e)?[e]:[]:at(e,t,n)})}),ct={firstLayer:function(e,t){return at(e,t,C(!0))},filterFirstLayer:at},lt=function(e){return e.dom().nodeName.toLowerCase()},ft=function(e){return e.dom().nodeType},st=function(t){return function(e){return ft(e)===t}},dt=function(e){return ft(e)===fe||"#comment"===lt(e)},mt=st(de),gt=st(me),ht=st(se),pt=function(e,t,n){if(!(v(n)||S(n)||D(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},vt=function(e,t,n){pt(e.dom(),t,n)},bt=function(e,t){var n=e.dom();V(t,function(e,t){pt(n,t,e)})},wt=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},yt=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},xt=function(e,t){e.dom().removeAttribute(t)},Ct=function(e){return B(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},Rt=function(e){var t=gt(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},St=Se(function(){return Tt(le.fromDom(document))}),Tt=function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return le.fromDom(t)},Dt=function(e,t){var n=[];return A(it(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(Dt(e,t))}),n},Ot=function(e,t,n){return r=function(e){return pe(e,t)},P(nt(e,n),r);var r},kt=function(e,t){return n=function(e){return pe(e,t)},P(it(e),n);var n},Nt=function(e,t){return n=t,o=(r=e)===undefined?document:r.dom(),ve(o)?[]:E(o.querySelectorAll(n),le.fromDom);var n,r,o};function Et(e,t,n,r,o){return e(n,r)?R.some(n):T(o)&&o(n)?R.none():t(n,r,o)}var At,Pt,It,Bt,Wt,Mt=function(e,t,n){for(var r=e.dom(),o=T(n)?n:C(!1);r.parentNode;){r=r.parentNode;var i=le.fromDom(r);if(t(i))return R.some(i);if(o(i))break}return R.none()},_t=function(e,t,n){return Mt(e,function(e){return pe(e,t)},n)},Lt=function(e,t){return n=function(e){return pe(e,t)},W(e.dom().childNodes,x(n,le.fromDom)).map(le.fromDom);var n},jt=function(e,t){return n=t,o=(r=e)===undefined?document:r.dom(),ve(o)?R.none():R.from(o.querySelector(n)).map(le.fromDom);var n,r,o},Ft=function(e,t,n){return Et(pe,_t,e,t,n)},zt=function(e,t,n){var r=n!==undefined?n:C(!1);return r(t)?R.none():k(e,lt(t))?R.some(t):_t(t,e.join(","),function(e){return pe(e,"table")||r(e)})},Ht=function(t,e){return tt(e).map(function(e){return kt(e,t)})},Ut=b(Ht,"th,td"),qt=b(Ht,"tr"),Vt=function(e,t){return parseInt(wt(e,t),10)},Gt={cell:function(e,t){return zt(["td","th"],e,t)},firstCell:function(e){return jt(e,"th,td")},cells:function(e){return ct.firstLayer(e,"th,td")},neighbourCells:Ut,table:function(e,t){return Ft(e,"table",t)},row:function(e,t){return zt(["tr"],e,t)},rows:function(e){return ct.firstLayer(e,"tr")},notCell:function(e,t){return zt(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:qt,attr:Vt,grid:function(e,t,n){var r=Vt(e,t),o=Vt(e,n);return ae.grid(r,o)}},Yt=function(e){var t=Gt.rows(e);return E(t,function(e){var t=e,n=tt(t).map(function(e){var t=lt(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=E(Gt.cells(e),function(e){var t=yt(e,"rowspan")?parseInt(wt(e,"rowspan"),10):1,n=yt(e,"colspan")?parseInt(wt(e,"colspan"),10):1;return ae.detail(e,t,n)});return ae.rowdata(t,r,n)})},Xt=function(e,n){return E(e,function(e){var t=E(Gt.cells(e),function(e){var t=yt(e,"rowspan")?parseInt(wt(e,"rowspan"),10):1,n=yt(e,"colspan")?parseInt(wt(e,"colspan"),10):1;return ae.detail(e,t,n)});return ae.rowdata(e,t,n.section())})},Kt=function(e,t){return e+","+t},Jt=function(e,t){var n=F(e.all(),function(e){return e.cells()});return P(n,t)},$t={generate:function(e){var f={},t=[],n=e.length,s=0;A(e,function(e,c){var l=[];A(e.cells(),function(e,t){for(var n=0;f[Kt(c,n)]!==undefined;)n++;for(var r=ae.extended(e.element(),e.rowspan(),e.colspan(),c,n),o=0;o<e.colspan();o++)for(var i=0;i<e.rowspan();i++){var u=n+o,a=Kt(c+i,u);f[a]=r,s=Math.max(s,u+1)}l.push(r)}),t.push(ae.rowdata(e.element(),l,e.section()))});var r=ae.grid(n,s);return{grid:C(r),access:C(f),all:C(t)}},getAt:function(e,t,n){var r=e.access()[Kt(t,n)];return r!==undefined?R.some(r):R.none()},findItem:function(e,t,n){var r=Jt(e,function(e){return n(t,e.element())});return 0<r.length?R.some(r[0]):R.none()},filterItems:Jt,justCells:function(e){var t=E(e.all(),function(e){return e.cells()});return j(t)}},Qt=function(e){return e.style!==undefined},Zt=function(e,t,n){if(!v(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Qt(e)&&e.style.setProperty(t,n)},en=function(e,t,n){var r=e.dom();Zt(r,t,n)},tn=function(e,t){var n=e.dom();V(t,function(e,t){Zt(n,t,e)})},nn=function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||Rt(e)?r:rn(n,t);return null===o?undefined:o},rn=function(e,t){return Qt(e)?e.style.getPropertyValue(t):""},on=function(e,t){var n=e.dom(),r=rn(n,t);return R.from(r).filter(function(e){return 0<e.length})},un=function(e,t){var n,r,o=e.dom();r=t,Qt(n=o)&&n.style.removeProperty(r),yt(e,"style")&&""===wt(e,"style").replace(/^\s+|\s+$/g,"")&&xt(e,"style")},an=function(t,n){tt(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})},cn=function(e,t){ot(e).fold(function(){tt(e).each(function(e){fn(e,t)})},function(e){an(e,t)})},ln=function(t,n){ut(t,0).fold(function(){fn(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},fn=function(e,t){e.dom().appendChild(t.dom())},sn=function(e,t){an(e,t),fn(t,e)},dn=function(r,o){A(o,function(e,t){var n=0===t?r:o[t-1];cn(n,e)})},mn=function(t,e){A(e,function(e){fn(t,e)})},gn=function(e){e.dom().textContent="",A(it(e),function(e){hn(e)})},hn=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},pn=function(e){var t,n=it(e);0<n.length&&(t=e,A(n,function(e){an(t,e)})),hn(e)},vn=X("minRow","minCol","maxRow","maxCol"),bn=function(e,t){var n,i,r,u,a,c,l,o,f,s,d=function(e){return pe(e.element(),t)},m=Yt(e),g=$t.generate(m),h=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),a=r,l=c=0,V(n.access(),function(e){if(i(e)){var t=e.row(),n=t+e.rowspan()-1,r=e.column(),o=r+e.colspan()-1;t<u?u=t:c<n&&(c=n),r<a?a=r:l<o&&(l=o)}}),vn(u,a,c,l)),p="th:not("+t+"),td:not("+t+")",v=ct.filterFirstLayer(e,"th,td",function(e){return pe(e,p)});return A(v,hn),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var f=!1,s=0;s<a;s++)l<n.minRow()||l>n.maxRow()||s<n.minCol()||s>n.maxCol()||($t.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=le.fromTag("td"),fn(u,le.fromTag("br")),(o?fn:ln)(i,u)):f=!0)}(m,g,h,d),o=e,f=h,s=P(ct.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),A(s,hn),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||A(ct.firstLayer(o,"th,td"),function(e){xt(e,"rowspan"),xt(e,"colspan")}),xt(o,"width"),xt(o,"height"),un(o,"width"),un(o,"height"),e},wn=function(e,t){return le.fromDom(e.dom().cloneNode(t))},yn=function(e){return wn(e,!1)},xn=function(e){return wn(e,!0)},Cn=function(e,t){var n,r,o,i,u=(n=e,r=t,o=le.fromTag(r),i=Ct(n),bt(o,i),o),a=it(xn(e));return mn(u,a),u},Rn=(At=gt,Pt="text",It=function(e){return At(e)?R.from(e.dom().nodeValue):R.none()},Bt=Je.detect().browser,{get:function(e){if(!At(e))throw new Error("Can only get "+Pt+" value of a "+Pt+" node");return Wt(e).getOr("")},getOption:Wt=Bt.isIE()&&10===Bt.version.major?function(e){try{return It(e)}catch(t){return R.none()}}:It,set:function(e,t){if(!At(e))throw new Error("Can only set raw "+Pt+" value of a "+Pt+" node");e.dom().nodeValue=t}}),Sn=function(e){return Rn.get(e)},Tn=function(e){return Rn.getOption(e)},Dn=function(e,t){Rn.set(e,t)},On=function(e){return"img"===lt(e)?1:Tn(e).fold(function(){return it(e).length},function(e){return e.length})},kn=["img","br"],Nn=function(e){return Tn(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||k(kn,lt(e))},En=function(e){return r=Nn,(o=function(e){for(var t=0;t<e.childNodes.length;t++){if(r(le.fromDom(e.childNodes[t])))return R.some(le.fromDom(e.childNodes[t]));var n=o(e.childNodes[t]);if(n.isSome())return n}return R.none()})(e.dom());var r,o},An=function(e){return Pn(e,Nn)},Pn=function(e,i){var u=function(e){for(var t=it(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return R.some(r);var o=u(r);if(o.isSome())return o}return R.none()};return u(e)},In=function(){var e=le.fromTag("td");return fn(e,le.fromTag("br")),e},Bn=function(e,t,n){var r=Cn(e,t);return V(n,function(e,t){null===e?xt(r,t):vt(r,t,e)}),r},Wn=function(e){return e},Mn=function(e){return function(){return le.fromTag("tr",e.dom())}},_n=function(d,e,m){return{row:Mn(e),cell:function(e){var r,o,i,t,n,u,a,c=et(e.element()),l=le.fromTag(lt(e.element()),c.dom()),f=m.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),s=0<f.length?(r=e.element(),o=l,i=f,En(r).map(function(e){var t=i.join(","),n=Ot(e,t,function(e){return $e(e,r)});return I(n,function(e,t){var n=yn(t);return xt(n,"contenteditable"),fn(e,n),n},o)}).getOr(o)):l;return fn(s,le.fromTag("br")),t=e.element(),n=l,u=t.dom(),a=n.dom(),Qt(u)&&Qt(a)&&(a.style.cssText=u.style.cssText),un(l,"height"),1!==e.colspan()&&un(e.element(),"width"),d(e.element(),l),l},replace:Bn,gap:In}},Ln=function(e){return{row:Mn(e),cell:In,replace:Wn,gap:In}},jn=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function Fn(){return{up:C({selector:_t,closest:Ft,predicate:Mt,all:nt}),down:C({selector:Nt,predicate:Dt}),styles:C({get:nn,getRaw:on,set:en,remove:un}),attrs:C({get:wt,set:vt,remove:xt,copyTo:function(e,t){var n=Ct(e);bt(t,n)}}),insert:C({before:an,after:cn,afterAll:dn,append:fn,appendAll:mn,prepend:ln,wrap:sn}),remove:C({unwrap:pn,remove:hn}),create:C({nu:le.fromTag,clone:function(e){return le.fromDom(e.dom().cloneNode(!1))},text:le.fromText}),query:C({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:rt,nextSibling:ot}),property:C({children:it,name:lt,parent:tt,isText:gt,isComment:dt,isElement:mt,getText:Sn,setText:Dn,isBoundary:function(e){return!!mt(e)&&("body"===lt(e)||k(jn,lt(e)))},isEmptyTag:function(e){return!!mt(e)&&k(["br","img","hr","input"],lt(e))}}),eq:$e,is:Ze}}var zn=X("left","right"),Hn=function(e,t,n){var r=e.property().children(t);return M(r,b(e.eq,n)).map(function(e){return{before:C(r.slice(0,e)),after:C(r.slice(e+1))}})},Un=function(n,r,o){return Hn(n,r,o).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.before().concat([o])),n.insert().appendAll(r,e.after()),n.insert().before(r,t),zn(t,r)})},qn=function(n,r,e){return Hn(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),zn(r,t)})},Vn=function(i,e,u,a){var r=X("first","second","splits"),c=function(e,t,o){var n=r(e,R.none(),o);return u(e)?r(e,t,o):i.property().parent(e).bind(function(r){return a(i,r,e).map(function(e){var t=[{first:e.left,second:e.right}],n=u(r)?r:e.left();return c(n,R.some(e.right()),o.concat(t))}).getOr(n)})};return c(e,R.none(),[])},Gn=function(r,o,e,t){var n=o(r,e);return I(t,function(e,t){var n=o(r,t);return Yn(r,e,n)},n)},Yn=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},Xn=function(e,t,n){return 0<n.length?Gn(e,t,(r=n)[0],r.slice(1)):R.none();var r},Kn=function(e,t){return b(e.eq,t)},Jn=function(t,e,n,r){var o=r!==undefined?r:C(!1),i=[e].concat(t.up().all(e)),u=[n].concat(t.up().all(n)),a=function(t){return M(t,o).fold(function(){return t},function(e){return t.slice(0,e+1)})},c=a(i),l=a(u),f=W(c,function(e){return N(l,Kn(t,e))});return{firstpath:C(c),secondpath:C(l),shared:C(f)}},$n=function(t,e,n){var r=Jn(t,e,n);return r.shared().bind(function(e){return function(o,i,e,t){var u=o.property().children(i);if(o.eq(i,e[0]))return R.some([e[0]]);if(o.eq(i,t[0]))return R.some([t[0]]);var n=function(e){var t=U(e),n=M(t,Kn(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return M(u,Kn(o,r))},r=n(e),a=n(t);return r.bind(function(r){return a.map(function(e){var t=Math.min(r,e),n=Math.max(r,e);return u.slice(t,n+1)})})}(t,e,r.firstpath(),r.secondpath())})},Qn=Jn,Zn=function(e,t,n){return Xn(e,t,n)},er=function(e,t,n){return $n(e,t,n)},tr=function(e,t,n,r){return Qn(e,t,n,r)},nr=function(e,t,n){return Un(e,t,n)},rr=function(e,t,n){return qn(e,t,n)},or=function(e,t,n,r){return Vn(e,t,n,r)},ir=Fn(),ur={sharedOne:function(n,e){return Zn(ir,function(e,t){return n(t)},e)},subset:function(e,t){return er(ir,e,t)},ancestors:function(e,t,n){return tr(ir,e,t,n)},breakToLeft:function(e,t){return nr(ir,e,t)},breakToRight:function(e,t){return rr(ir,e,t)},breakPath:function(e,t,r){return or(ir,e,t,function(e,t,n){return r(t,n)})}},ar=function(e,t){return t.column()>=e.startCol()&&t.column()+t.colspan()-1<=e.finishCol()&&t.row()>=e.startRow()&&t.row()+t.rowspan()-1<=e.finishRow()},cr=function(e,t){var n=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return n<=e.finishCol()&&r>=e.startCol()&&o<=e.finishRow()&&i>=e.startRow()},lr=function(e,t){for(var n=!0,r=b(ar,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&$t.getAt(e,o,i).exists(r);return n?R.some(t):R.none()},fr=function(e,t,n){var r=$t.findItem(e,t,$e),o=$t.findItem(e,n,$e);return r.bind(function(r){return o.map(function(e){return t=r,n=e,ae.bounds(Math.min(t.row(),n.row()),Math.min(t.column(),n.column()),Math.max(t.row()+t.rowspan()-1,n.row()+n.rowspan()-1),Math.max(t.column()+t.colspan()-1,n.column()+n.colspan()-1));var t,n})})},sr=fr,dr=function(t,e,n){return fr(t,e,n).bind(function(e){return lr(t,e)})},mr=function(r,e,o,i){return $t.findItem(r,e,$e).bind(function(e){var t=0<o?e.row()+e.rowspan()-1:e.row(),n=0<i?e.column()+e.colspan()-1:e.column();return $t.getAt(r,t+o,n+i).map(function(e){return e.element()})})},gr=function(n,e,t){return sr(n,e,t).map(function(e){var t=$t.filterItems(n,b(cr,e));return E(t,function(e){return e.element()})})},hr=function(e,t){return $t.findItem(e,t,function(e,t){return Qe(t,e)}).bind(function(e){return e.element()})},pr=function(e){var t=Yt(e);return $t.generate(t)},vr=function(n,r,o){return Gt.table(n).bind(function(e){var t=pr(e);return mr(t,n,r,o)})},br=function(e,t,n){var r=pr(e);return gr(r,t,n)},wr=function(e,t,n,r,o){var i=pr(e),u=$e(e,n)?t:hr(i,t),a=$e(e,o)?r:hr(i,r);return gr(i,u,a)},yr=function(e,t,n){var r=pr(e);return dr(r,t,n)},xr=function(e,t){return _t(e,"table")},Cr=ee(["boxes","start","finish"],[]),Rr=function(a,c,r){var l=function(t){return function(e){return r(e)||$e(e,t)}};return $e(a,c)?R.some(Cr({boxes:R.some([a]),start:a,finish:c})):xr(a).bind(function(u){return xr(c).bind(function(i){if($e(u,i))return R.some(Cr({boxes:br(u,a,c),start:a,finish:c}));if(Qe(u,i)){var e=0<(t=Ot(c,"td,th",l(u))).length?t[t.length-1]:c;return R.some(Cr({boxes:wr(u,a,u,c,i),start:a,finish:e}))}if(Qe(i,u)){var t,n=0<(t=Ot(a,"td,th",l(i))).length?t[t.length-1]:a;return R.some(Cr({boxes:wr(i,a,u,c,i),start:a,finish:n}))}return ur.ancestors(a,c).shared().bind(function(e){return Ft(e,"table",r).bind(function(e){var t=Ot(c,"td,th",l(e)),n=0<t.length?t[t.length-1]:c,r=Ot(a,"td,th",l(e)),o=0<r.length?r[r.length-1]:a;return R.some(Cr({boxes:wr(e,a,u,c,i),start:o,finish:n}))})})})})},Sr=Rr,Tr=function(e,t){var n=Nt(e,t);return 0<n.length?R.some(n):R.none()},Dr=function(e,t,n,r,o){return(i=e,u=o,W(i,function(e){return pe(e,u)})).bind(function(e){return vr(e,t,n).bind(function(e){return n=r,_t(t=e,"table").bind(function(e){return jt(e,n).bind(function(e){return Rr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:C(e),start:C(t.start()),finish:C(t.finish())}})})})});var t,n})});var i,u},Or=function(e,t,r){return jt(e,t).bind(function(n){return jt(e,r).bind(function(t){return ur.sharedOne(xr,[n,t]).map(function(e){return{first:C(n),last:C(t),table:C(e)}})})})},kr=function(e,t){return Tr(e,t)},Nr=function(o,e,t){return Or(o,e,t).bind(function(n){var e=function(e){return $e(o,e)},t=_t(n.first(),"thead,tfoot,tbody,table",e),r=_t(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return $e(t,e)?yr(n.table(),n.first(),n.last()):R.none()})})})},Er="data-mce-selected",Ar="data-mce-first-selected",Pr="data-mce-last-selected",Ir={selected:C(Er),selectedSelector:C("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:C("[data-mce-selected]"),firstSelected:C(Ar),firstSelectedSelector:C("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:C(Pr),lastSelectedSelector:C("td[data-mce-last-selected],th[data-mce-last-selected]")},Br=function(u){if(!w(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],n={};return A(u,function(e,r){var t=q(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!w(i))throw new Error("case arguments must be an array");a.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=q(e);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!z(a,function(e){return k(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return e[o].apply(null,n)},log:function(e){console.log(e,{constructors:a,constructor:o,params:n})}}}}),n},Wr=Br([{none:[]},{multiple:["elements"]},{single:["selection"]}]),Mr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Wr.none,multiple:Wr.multiple,single:Wr.single},_r=function(e,t){return Mr.cata(t.get(),C([]),o,C([e]))},Lr=function(n,e){return Mr.cata(e.get(),R.none,function(t,e){return 0===t.length?R.none():Nr(n,Ir.firstSelectedSelector(),Ir.lastSelectedSelector()).bind(function(e){return 1<t.length?R.some({bounds:C(e),cells:C(t)}):R.none()})},R.none)},jr=function(e,t){var n=_r(e,t);return 0<n.length&&z(n,function(e){return yt(e,"rowspan")&&1<parseInt(wt(e,"rowspan"),10)||yt(e,"colspan")&&1<parseInt(wt(e,"colspan"),10)})?R.some(n):R.none()},Fr=_r,zr=function(e){return{element:C(e),mergable:R.none,unmergable:R.none,selection:C([e])}},Hr=X("element","clipboard","generators"),Ur={noMenu:zr,forMenu:function(e,t,n){return{element:C(n),mergable:C(Lr(t,e)),unmergable:C(jr(n,e)),selection:C(Fr(n,e))}},notCell:function(e){return zr(e)},paste:Hr,pasteRows:function(e,t,n,r,o){return{element:C(n),mergable:R.none,unmergable:R.none,selection:C(Fr(n,e)),clipboard:C(r),generators:C(o)}}},qr=function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&Mr.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,Gt.table(t[0]).map(xn).map(function(e){return[bn(e,Ir.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?E(e,function(e){return e.dom().innerText}).join(""):(t=f,E(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&R.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var c=le.fromDom(e);Gt.table(c).bind(function(t){var e,n,r,o=P((e=l.content,(r=(n||document).createElement("div")).innerHTML=e,it(le.fromDom(r))),function(e){return"meta"!==lt(e)});if(1===o.length&&"table"===lt(o[0])){l.preventDefault();var i=le.fromDom(f.getDoc()),u=Ln(i),a=Ur.paste(c,o[0],u);s.pasteCells(t,a).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})};function Vr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=nn(e,r);return parseFloat(n)||0}return t},i=function(o,e){return B(e,function(e,t){var n=nn(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!D(t)&&!t.match(/^[0-9]+$/))throw r+".set accepts only positive integer values. Value was "+t;var n=e.dom();Qt(n)&&(n.style[r]=t+"px")},get:e,getOuter:e,aggregate:i,max:function(e,t,n){var r=i(e,n);return r<t?t-r:0}}}var Gr=Vr("height",function(e){var t=e.dom();return Rt(e)?t.getBoundingClientRect().height:t.offsetHeight}),Yr=function(e){return Gr.get(e)},Xr=function(e){return Gr.getOuter(e)},Kr=Vr("width",function(e){return e.dom().offsetWidth}),Jr=function(e){return Kr.get(e)},$r=function(e){return Kr.getOuter(e)},Qr=Je.detect(),Zr=function(e,t,n){return r=nn(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},eo=function(e){return Qr.browser.isIE()||Qr.browser.isEdge()?(n=Zr(t=e,"padding-top",0),r=Zr(t,"padding-bottom",0),o=Zr(t,"border-top-width",0),i=Zr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===nn(t,"box-sizing")?u:u-n-r-(o+i)):Zr(e,"height",Yr(e));var t,n,r,o,i,u},to=/(\d+(\.\d+)?)(\w|%)*/,no=/(\d+(\.\d+)?)%/,ro=/(\d+(\.\d+)?)px|em/,oo=function(e,t){en(e,"height",t+"px")},io=function(e,t,n,r){var o,i,u,a,c,l,f,s,d,m=parseInt(e,10);return s=l="%",d=(f=e).length-l.length,""!==s&&(f.length<s.length||f.substr(d,d+s.length)!==s)||"table"===lt(t)?m:(o=t,i=m,u=n,a=r,c=Gt.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c)},uo=function(e){var t,n=on(t=e,"height").getOrThunk(function(){return eo(t)+"px"});return n?io(n,e,Yr,oo):Yr(e)},ao=function(e,t){return yt(e,t)?parseInt(wt(e,t),10):1},co=function(e){return on(e,"width").fold(function(){return R.from(wt(e,"width"))},function(e){return R.some(e)})},lo=function(e,t){return e/t.pixelWidth()*100},fo={percentageBasedSizeRegex:C(no),pixelBasedSizeRegex:C(ro),setPixelWidth:function(e,t){en(e,"width",t+"px")},setPercentageWidth:function(e,t){en(e,"width",t+"%")},setHeight:oo,getPixelWidth:function(t,n){return co(t).fold(function(){return Jr(t)},function(e){return function(e,t,n){if(ro.test(t)){var r=ro.exec(t);return parseInt(r[1],10)}if(no.test(t)){var o=no.exec(t),i=parseFloat(o[1]);return i/100*n.pixelWidth()}return Jr(e)}(t,e,n)})},getPercentageWidth:function(t,n){return co(t).fold(function(){var e=Jr(t);return lo(e,n)},function(e){return function(e,t,n){if(no.test(t)){var r=no.exec(t);return parseFloat(r[1])}var o=Jr(e);return lo(o,n)}(t,e,n)})},getGenericWidth:function(e){return co(e).bind(function(e){if(to.test(e)){var t=to.exec(e);return R.some({width:C(t[1]),unit:C(t[3])})}return R.none()})},setGenericWidth:function(e,t,n){en(e,"width",t+n)},getHeight:function(e){return n="rowspan",uo(t=e)/ao(t,n);var t,n},getRawWidth:co},so=function(n,r){fo.getGenericWidth(n).each(function(e){var t=e.width()/2;fo.setGenericWidth(n,t,e.unit()),fo.setGenericWidth(r,t,e.unit())})},mo=function(n,r){return{left:C(n),top:C(r),translate:function(e,t){return mo(n+e,r+t)}}},go=mo,ho=function(e,t){return e!==undefined?e:t!==undefined?t:0},po=function(e){var t,n,r=e.dom().ownerDocument,o=r.body,i=(t=le.fromDom(r),(n=t.dom())===n.window&&t instanceof Window?t:ht(t)?n.defaultView||n.parentWindow:null),u=r.documentElement,a=ho(i.pageYOffset,u.scrollTop),c=ho(i.pageXOffset,u.scrollLeft),l=ho(u.clientTop,o.clientTop),f=ho(u.clientLeft,o.clientLeft);return vo(e).translate(c-f,a-l)},vo=function(e){var t,n,r,o=e.dom(),i=o.ownerDocument,u=i.body,a=le.fromDom(i.documentElement);return u===o?go(u.offsetLeft,u.offsetTop):(t=e,n=a||le.fromDom(document.documentElement),Mt(t,b($e,n)).isSome()?(r=o.getBoundingClientRect(),go(r.left,r.top)):go(0,0))},bo=X("row","y"),wo=X("col","x"),yo=function(e){return po(e).left()+$r(e)},xo=function(e){return po(e).left()},Co=function(e,t){return wo(e,xo(t))},Ro=function(e,t){return wo(e,yo(t))},So=function(e){return po(e).top()},To=function(n,t,r){if(0===r.length)return[];var e=E(r.slice(1),function(e,t){return e.map(function(e){return n(t,e)})}),o=r[r.length-1].map(function(e){return t(r.length-1,e)});return e.concat([o])},Do={delta:o,positions:b(To,function(e,t){return bo(e,So(t))},function(e,t){return bo(e,So(t)+Xr(t))}),edge:So},Oo={delta:o,edge:xo,positions:b(To,Co,Ro)},ko={height:Do,rtl:{delta:function(e,t){return-e},edge:yo,positions:b(To,Ro,Co)},ltr:Oo},No={ltr:ko.ltr,rtl:ko.rtl};function Eo(t){var n=function(e){return t(e).isRtl()?No.rtl:No.ltr};return{delta:function(e,t){return n(t).delta(e,t)},edge:function(e){return n(e).edge(e)},positions:function(e,t){return n(t).positions(e,t)}}}var Ao,Po=function(e){var t=Yt(e);return $t.generate(t).grid()},Io=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return Io(n())}}},Bo=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return Q("required",o),Z(o),function(t){var n=q(t);z(o,function(e){return k(n,e)})||J(o,n),r(o,n);var e=P(o,function(e){return!i.validate(t[e],e)});return 0<e.length&&function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+K(e).join(", ")+") were not.")}(e,i.label),t}},Wo=function(t,e){var n=P(e,function(e){return!k(t,e)});0<n.length&&$(n)},Mo=function(e){return Bo(Wo,e,{validate:T,label:"function"})},_o=function(e){var t=yt(e,"colspan")?parseInt(wt(e,"colspan"),10):1,n=yt(e,"rowspan")?parseInt(wt(e,"rowspan"),10):1;return{element:C(e),colspan:C(t),rowspan:C(n)}},Lo=Mo(["cell","row","replace","gap"]),jo=function(r,e){Lo(r);var n=Io(R.none()),o=e!==undefined?e:_o,i=function(e){var t,n=o(e);return t=n,r.cell(t)},u=function(e){var t=i(e);return n.get().isNone()&&n.set(R.some(t)),a=R.some({item:e,replacement:t}),t},a=R.none();return{getOrInit:function(t,n){return a.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},Fo=function(o,a){return function(n){var r=Io(R.none());Lo(n);var i=[],u=function(e){var t=n.replace(e,a,{scope:o});return i.push({item:e,sub:t}),r.get().isNone()&&r.set(R.some(t)),t};return{replaceOrInit:function(t,n){return(r=t,o=n,W(i,function(e){return o(e.item,r)})).fold(function(){return u(t)},function(e){return n(t,e.item)?e.sub:u(t)});var r,o},cursor:r.get}}},zo=function(n){Lo(n);var e=Io(R.none());return{combine:function(t){return e.get().isNone()&&e.set(R.some(t)),function(){var e=n.cell({element:C(t),colspan:C(1),rowspan:C(1)});return un(e,"width"),un(t,"width"),e}},cursor:e.get}},Ho=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Uo=function(e,t){var n=e.property().name(t);return k(Ho,n)},qo=function(e,t){return k(["br","img","hr","input"],e.property().name(t))},Vo=Uo,Go=function(e,t){var n=e.property().name(t);return k(["ol","ul"],n)},Yo=qo,Xo=Fn(),Ko=function(e){return Vo(Xo,e)},Jo=function(e){return Go(Xo,e)},$o=function(e){return Yo(Xo,e)},Qo=function(e){var t,i=function(e){return"br"===lt(e)},n=function(o){return An(o).bind(function(n){var r=ot(n).map(function(e){return!!Ko(e)||($o(e)?"img"!==lt(e):void 0)}).getOr(!1);return tt(n).map(function(e){return!0===r||"li"===lt(t=e)||Mt(t,Jo).isSome()||i(n)||Ko(e)&&!$e(o,e)?[]:[le.fromTag("br")];var t})}).getOr([])},r=0===(t=F(e,function(e){var t=it(e);return z(t,function(e){return i(e)||gt(e)&&0===Sn(e).trim().length})?[]:t.concat(n(e))})).length?[le.fromTag("br")]:t;gn(e[0]),mn(e[0],r)},Zo=Object.prototype.hasOwnProperty,ei=(Ao=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)Zo.call(o,i)&&(n[i]=Ao(n[i],o[i]))}return n}),ti=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},ni=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return R.none()},ri=function(e,t){return ae.rowcells(t,e.section())},oi=function(e,t){return e.cells()[t]},ii={addCell:function(e,t,n){var r=e.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([n]).concat(i);return ri(e,u)},setCells:ri,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:oi,getCellElement:function(e,t){return oi(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=E(n,t);return ae.rowcells(r,e.section())},cellLength:function(e){return e.cells().length}},ui=function(e,t){if(0===e.length)return 0;var n=e[0];return M(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},ai=function(e,t,n,r){var o,i,u,a,c=(o=e,i=t,o[i]).cells().slice(n),l=ui(c,r),f=(u=e,a=n,E(u,function(e){return ii.getCell(e,a)})).slice(t),s=ui(f,r);return{colspan:C(l),rowspan:C(s)}},ci=function(o,i){var u=E(o,function(e,t){return E(e.cells(),function(e,t){return!1})});return E(o,function(e,r){var t=F(e.cells(),function(e,t){if(!1===u[r][t]){var n=ai(o,r,t,i);return function(e,t,n,r){for(var o=e;o<e+n;o++)for(var i=t;i<t+r;i++)u[o][i]=!0}(r,t,n.rowspan(),n.colspan()),[ae.detailnew(e.element(),n.rowspan(),n.colspan(),e.isNew())]}return[]});return ae.rowdetails(t,e.section())})},li=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=$t.getAt(e,o,u).map(function(e){return ae.elementnew(e.element(),n)}).getOrThunk(function(){return ae.elementnew(t.gap(),!0)});i.push(a)}var c=ae.rowcells(i,e.all()[o].section());r.push(c)}return r},fi=function(e,t,n,r){n===r?xt(e,t):vt(e,t,n)},si=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=Lt(o,t).getOrThunk(function(){var e=le.fromTag(t,et(o).dom());return fn(o,e),e});gn(n);var r=E(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return gn(t),A(e.cells(),function(e){e.isNew()&&u.push(e.element()),fi(e.element(),"colspan",e.colspan(),1),fi(e.element(),"rowspan",e.rowspan(),1),fn(t,e.element())}),t});mn(n,r)}(e,t):Lt(o,t).each(hn)},n=[],r=[],a=[];return A(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":a.push(e)}}),t(n,"thead"),t(r,"tbody"),t(a,"tfoot"),{newRows:C(i),newCells:C(u)}},di=function(e){return E(e,function(e){var n=yn(e.element());return A(e.cells(),function(e){var t=xn(e.element());fi(t,"colspan",e.colspan(),1),fi(t,"rowspan",e.rowspan(),1),fn(n,t)}),n})},mi=function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},gi=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},hi=function(t,n){if(n<0||n>=t.length-1)return R.none();var e=t[n].fold(function(){var e=U(t.slice(0,n));return ni(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return ni(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.some({value:e,delta:1})});return e.bind(function(n){return r.map(function(e){var t=e.delta+n.delta;return Math.abs(e.value-n.value)/t})})},pi=function(e,t,n){var r=e();return W(r,t).orThunk(function(){return R.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},vi=function(n){var e=n.grid(),t=gi(0,e.columns()),r=gi(0,e.rows());return E(t,function(t){return pi(function(){return F(r,function(e){return $t.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return $t.getAt(n,0,t)})})},bi=function(n){var e=n.grid(),t=gi(0,e.rows()),r=gi(0,e.columns());return E(t,function(t){return pi(function(){return F(r,function(e){return $t.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return $t.getAt(n,t,0)})})},wi=function(e,t,n,r,o){var i=le.fromTag("div");return tn(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),bt(i,{"data-column":e,role:"presentation"}),i},yi=function(e,t,n,r,o){var i=le.fromTag("div");return tn(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),bt(i,{"data-row":e,role:"presentation"}),i},xi=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},Ci={resolve:xi("ephox-snooker").resolve},Ri=function(e,t){var n=wt(e,t);return n===undefined||""===n?[]:n.split(" ")},Si=function(e){return e.dom().classList!==undefined},Ti=function(e,t){return o=t,i=Ri(n=e,r="class").concat([o]),vt(n,r,i.join(" ")),!0;var n,r,o,i},Di=function(e,t){return o=t,0<(i=P(Ri(n=e,r="class"),function(e){return e!==o})).length?vt(n,r,i.join(" ")):xt(n,r),!1;var n,r,o,i},Oi=function(e,t){Si(e)?e.dom().classList.add(t):Ti(e,t)},ki=function(e){0===(Si(e)?e.dom().classList:Ri(e,"class")).length&&xt(e,"class")},Ni=function(e,t){return Si(e)&&e.dom().classList.contains(t)},Ei=Ci.resolve("resizer-bar"),Ai=Ci.resolve("resizer-rows"),Pi=Ci.resolve("resizer-cols"),Ii=function(e){var t=Nt(e.parent(),"."+Ei);A(t,hn)},Bi=function(n,e,r){var o=n.origin();A(e,function(e,t){e.each(function(e){var t=r(o,e);Oi(t,Ei),fn(n.parent(),t)})})},Wi=function(e,t,n,r,o,i){var u,a,c,l,f=po(t),s=0<n.length?o.positions(n,t):[];u=e,a=s,c=f,l=$r(t),Bi(u,a,function(e,t){var n=yi(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return Oi(n,Ai),n});var d,m,g,h,p=0<r.length?i.positions(r,t):[];d=e,m=p,g=f,h=Xr(t),Bi(d,m,function(e,t){var n=wi(t.col(),t.x()-e.left(),g.top()-e.top(),7,h);return Oi(n,Pi),n})},Mi=function(e,t){var n=Nt(e.parent(),"."+Ei);A(n,t)},_i={refresh:function(e,t,n,r){Ii(e);var o=Yt(t),i=$t.generate(o),u=bi(i),a=vi(i);Wi(e,t,u,a,n,r)},hide:function(e){Mi(e,function(e){en(e,"display","none")})},show:function(e){Mi(e,function(e){en(e,"display","block")})},destroy:Ii,isRowBar:function(e){return Ni(e,Ai)},isColBar:function(e){return Ni(e,Pi)}},Li=function(e,r){return E(e,function(e){var t,n=(t=e.details(),ni(t,function(e){return tt(e.element()).map(function(e){var t=tt(e).isNone();return ae.elementnew(e,t)})}).getOrThunk(function(){return ae.elementnew(r.row(),!0)}));return ae.rowdatanew(n.element(),e.details(),e.section(),n.isNew())})},ji=function(e,t){var n=ci(e,$e);return Li(n,t)},Fi=function(e,t){var n=j(E(e.all(),function(e){return e.cells()}));return W(n,function(e){return $e(t,e.element())})},zi=function(a,c,l,f,s){return function(n,r,e,o,i){var t=Yt(r),u=$t.generate(t);return c(u,e).map(function(e){var t=li(u,o,!1),n=a(t,e,$e,s(o)),r=ji(n.grid(),o);return{grid:C(r),cursor:n.cursor}}).fold(function(){return R.none()},function(e){var t=si(r,e.grid());return l(r,e.grid(),i),f(r),_i.refresh(n,r,ko.height,i),R.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},Hi=ji,Ui=function(t,e){return Gt.cell(e.element()).bind(function(e){return Fi(t,e)})},qi=function(t,e){var n=E(e.selection(),function(e){return Gt.cell(e).bind(function(e){return Fi(t,e)})}),r=ti(n);return 0<r.length?R.some(r):R.none()},Vi=function(t,n){return Gt.cell(n.element()).bind(function(e){return Fi(t,e).map(function(e){return ei(e,{generators:n.generators,clipboard:n.clipboard})})})},Gi=function(t,e){var n=E(e.selection(),function(e){return Gt.cell(e).bind(function(e){return Fi(t,e)})}),r=ti(n);return 0<r.length?R.some(ei({cells:r},{generators:e.generators,clipboard:e.clipboard})):R.none()},Yi=function(e,t){return t.mergable()},Xi=function(e,t){return t.unmergable()},Ki=function(n){return{is:function(e){return n===e},isValue:l,isError:a,getOr:C(n),getOrThunk:C(n),getOrDie:C(n),or:function(e){return Ki(n)},orThunk:function(e){return Ki(n)},fold:function(e,t){return t(n)},map:function(e){return Ki(e(n))},mapError:function(e){return Ki(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return R.some(n)}}},Ji=function(n){return{is:a,isValue:a,isError:l,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return Ji(n)},mapError:function(e){return Ji(e(n))},each:y,bind:function(e){return Ji(n)},exists:a,forall:l,toOption:R.none}},$i={value:Ki,error:Ji},Qi=function(e,t){return E(e,function(){return ae.elementnew(t.cell(),!0)})},Zi=function(t,e,n){return t.concat(mi(e,function(e){return ii.setCells(t[t.length-1],Qi(t[t.length-1].cells(),n))}))},eu=function(e,t,n){return E(e,function(e){return ii.setCells(e,e.cells().concat(Qi(gi(0,t),n)))})},tu=function(e,t,n){if(e.row()>=t.length||e.column()>ii.cellLength(t[0]))return $i.error("invalid start address out of table bounds, row: "+e.row()+", column: "+e.column());var r=t.slice(e.row()),o=r[0].cells().slice(e.column()),i=ii.cellLength(n[0]),u=n.length;return $i.value({rowDelta:C(r.length-u),colDelta:C(o.length-i)})},nu=function(e,t){var n=ii.cellLength(e[0]),r=ii.cellLength(t[0]);return{rowDelta:C(0),colDelta:C(n-r)}},ru=function(e,t,n){var r=t.colDelta()<0?eu:o;return(t.rowDelta()<0?Zi:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},ou=function(e,t,n,r){if(0===e.length)return e;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)ii.mutateCell(e[o],i,ae.elementnew(r(),!1));return e},iu=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<ii.cellLength(e[0]);u++){var a=n(ii.getCellElement(e[i],u),t);!0===a&&!1===o?ii.mutateCell(e[i],u,ae.elementnew(r(),!0)):!0===a&&(o=!1)}return e},uu=function(i,u,a,c){if(0<u&&u<i.length){var e=i[u-1].cells(),t=(n=a,B(e,function(e,t){return N(e,function(e){return n(e.element(),t.element())})?e:e.concat([t])},[]));A(t,function(e){for(var t=R.none(),n=u;n<i.length;n++)for(var r=0;r<ii.cellLength(i[0]);r++){var o=i[n].cells()[r];a(o.element(),e.element())&&(t.isNone()&&(t=R.some(c())),t.each(function(e){ii.mutateCell(i[n],r,ae.elementnew(e,!0))}))}})}var n;return i},au=function(n,r,o,i,u){return tu(n,r,o).map(function(e){var t=ru(r,e,i);return function(e,t,n,r,o){for(var i,u,a,c,l,f=e.row(),s=e.column(),d=f+n.length,m=s+ii.cellLength(n[0]),g=f;g<d;g++)for(var h=s;h<m;h++){i=t,u=g,a=h,c=void 0,c=b(o,ii.getCell(i[u],a).element()),l=i[u],1<i.length&&1<ii.cellLength(l)&&(0<a&&c(ii.getCellElement(l,a-1))||a<l.length-1&&c(ii.getCellElement(l,a+1))||0<u&&c(ii.getCellElement(i[u-1],a))||u<i.length-1&&c(ii.getCellElement(i[u+1],a)))&&iu(t,ii.getCellElement(t[g],h),o,r.cell);var p=ii.getCellElement(n[g-f],h-s),v=r.replace(p);ii.mutateCell(t[g],h,ae.elementnew(v,!0))}return t}(n,t,o,i,u)})},cu=function(e,t,n,r,o){uu(t,e,o,r.cell);var i=nu(n,t),u=ru(n,i,r),a=nu(t,u),c=ru(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},lu=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),a=ii.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(ii.getCellElement(n[r-1],t),ii.getCellElement(n[r],t))?ii.getCell(n[r],t):ae.elementnew(i(e.element(),o),!0)});return t.concat([a]).concat(u)},fu=function(e,n,r,o,i){return E(e,function(e){var t=0<n&&n<ii.cellLength(e)&&o(ii.getCellElement(e,n-1),ii.getCellElement(e,n))?ii.getCell(e,n):ae.elementnew(i(ii.getCellElement(e,r),o),!0);return ii.addCell(e,n,t)})},su=function(e,r,o,i,u){var a=o+1;return E(e,function(e,t){var n=t===r?ae.elementnew(u(ii.getCellElement(e,o),i),!0):ii.getCell(e,o);return ii.addCell(e,a,n)})},du=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=ii.mapCells(e[t],function(e,t){return t===n?ae.elementnew(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},mu=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},gu=function(e,n,r){var t=E(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return ae.rowcells(t,e.section())});return P(t,function(e){return 0<e.cells().length})},hu=function(e,n,r,o){return E(e,function(e){return ii.mapCells(e,function(e){return t=e,N(n,function(e){return r(t.element(),e.element())})?ae.elementnew(o(e.element(),r),!0):e;var t})})},pu=function(e,t,n,r){return ii.getCellElement(e[t],n)!==undefined&&0<t&&r(ii.getCellElement(e[t-1],n),ii.getCellElement(e[t],n))},vu=function(e,t,n){return 0<t&&n(ii.getCellElement(e,t-1),ii.getCellElement(e,t))},bu=function(n,r,o,e){var t=F(n,function(e,t){return pu(n,t,r,o)||vu(e,r,o)?[]:[ii.getCell(e,r)]});return hu(n,t,o,e)},wu=function(n,r,o,e){var i=n[r],t=F(i.cells(),function(e,t){return pu(n,r,t,o)||vu(i,t,o)?[]:[e]});return hu(n,t,o,e)},yu=function(e){return{fold:e}},xu=function(){return yu(function(e,t,n,r,o){return e()})},Cu=function(i){return yu(function(e,t,n,r,o){return t(i)})},Ru=function(i,u){return yu(function(e,t,n,r,o){return n(i,u)})},Su=function(i,u,a){return yu(function(e,t,n,r,o){return r(i,u,a)})},Tu=function(i,u){return yu(function(e,t,n,r,o){return o(i,u)})},Du=function(e,t,i,u){var n,r,a=e.slice(0),o=(r=t,0===(n=e).length?xu():1===n.length?Cu(0):0===r?Ru(0,1):r===n.length-1?Tu(r-1,r):0<r&&r<n.length-1?Su(r-1,r,r+1):xu()),c=function(e){return E(e,C(0))},l=C(c(a)),f=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),a[t]-i);return c(a.slice(0,e)).concat([i,n-a[t]]).concat(c(a.slice(t+1)))}var r=Math.max(u.minCellWidth(),a[e]+i),o=a[e]-r;return c(a.slice(0,e)).concat([r-a[e],o]).concat(c(a.slice(t+1)))},s=f;return o.fold(l,function(e){return u.singleColumnWidth(a[e],i)},s,function(e,t,n){return f(t,n)},function(e,t){if(0<=i)return c(a.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),a[t]+i);return c(a.slice(0,t)).concat([n-a[t]])})},Ou=function(e,t){return yt(e,t)&&1<parseInt(wt(e,t),10)},ku={hasColspan:function(e){return Ou(e,"colspan")},hasRowspan:function(e){return Ou(e,"rowspan")},minWidth:C(10),minHeight:C(10),getInt:function(e,t){return parseInt(nn(e,t),10)}},Nu=function(e,t,n){return on(e,t).fold(function(){return n(e)+"px"},function(e){return e})},Eu=function(e){return Nu(e,"width",fo.getPixelWidth)},Au=function(e){return Nu(e,"height",fo.getHeight)},Pu=function(e,t,n,r,o){var i=vi(e),u=E(i,function(e){return e.map(t.edge)});return E(i,function(e,t){return e.filter(m(ku.hasColspan)).fold(function(){var e=hi(u,t);return r(e)},function(e){return n(e,o)})})},Iu=function(e){return e.map(function(e){return e+"px"}).getOr("")},Bu=function(e,t,n,r){var o=bi(e),i=E(o,function(e){return e.map(t.edge)});return E(o,function(e,t){return e.filter(m(ku.hasRowspan)).fold(function(){var e=hi(i,t);return r(e)},function(e){return n(e)})})},Wu={getRawWidths:function(e,t){return Pu(e,t,Eu,Iu)},getPixelWidths:function(e,t,n){return Pu(e,t,fo.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return Pu(e,t,fo.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Bu(e,t,fo.getHeight,function(e){return e.getOrThunk(ku.minHeight)})},getRawHeights:function(e,t){return Bu(e,t,Au,Iu)}},Mu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},_u=function(e,n){var t=$t.justCells(e);return E(t,function(e){var t=Mu(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:C(t),colspan:e.colspan}})},Lu=function(e,n){var t=$t.justCells(e);return E(t,function(e){var t=Mu(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:C(t),rowspan:e.rowspan}})},ju=function(e,n){return E(e.all(),function(e,t){return{element:e.element,height:C(n[t])}})},Fu=function(e){var t=parseInt(e,10),n=o;return{width:C(t),pixelWidth:C(t),getWidths:Wu.getPixelWidths,getCellDelta:n,singleColumnWidth:function(e,t){return[Math.max(ku.minWidth(),e+t)-e]},minCellWidth:ku.minWidth,setElementWidth:fo.setPixelWidth,setTableWidth:function(e,t,n){var r=I(t,function(e,t){return e+t},0);fo.setPixelWidth(e,r)}}},zu=function(e,t){if(fo.percentageBasedSizeRegex().test(t)){var n=fo.percentageBasedSizeRegex().exec(t);return o=n[1],i=e,u=parseFloat(o),a=Jr(i),{width:C(u),pixelWidth:C(a),getWidths:Wu.getPercentageWidths,getCellDelta:function(e){return e/a*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return ku.minWidth()/a*100},setElementWidth:fo.setPercentageWidth,setTableWidth:function(e,t,n){var r=u+n;fo.setPercentageWidth(e,r)}}}if(fo.pixelBasedSizeRegex().test(t)){var r=fo.pixelBasedSizeRegex().exec(t);return Fu(r[1])}var o,i,u,a,c=Jr(e);return Fu(c)},Hu=function(t){return fo.getRawWidth(t).fold(function(){var e=Jr(t);return Fu(e)},function(e){return zu(t,e)})},Uu=function(e){return $t.generate(e)},qu=function(e){var t=Yt(e);return Uu(t)},Vu=function(e,t,n,r){var o=Hu(e),i=o.getCellDelta(t),u=qu(e),a=o.getWidths(u,r,o),c=Du(a,n,i,o),l=E(c,function(e,t){return e+a[t]}),f=_u(u,l);A(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},Gu=function(e,n,r,t){var o=qu(e),i=Wu.getPixelHeights(o,t),u=E(i,function(e,t){return r===t?Math.max(n+e,ku.minHeight()):e}),a=Lu(o,u),c=ju(o,u);A(c,function(e){fo.setHeight(e.element(),e.height())}),A(a,function(e){fo.setHeight(e.element(),e.height())});var l=I(u,function(e,t){return e+t},0);fo.setHeight(e,l)},Yu=function(e,t,n){var r=Hu(e),o=Uu(t),i=r.getWidths(o,n,r),u=_u(o,i);A(u,function(e){r.setElementWidth(e.element(),e.width())});var a=I(i,function(e,t){return t+e},0);0<u.length&&r.setElementWidth(e,a)},Xu=function(e){0===Gt.cells(e).length&&hn(e)},Ku=X("grid","cursor"),Ju=function(e,t,n){return $u(e,t,n).orThunk(function(){return $u(e,0,0)})},$u=function(e,t,n){return R.from(e[t]).bind(function(e){return R.from(e.cells()[n]).bind(function(e){return R.from(e.element())})})},Qu=function(e,t,n){return Ku(e,$u(e,t,n))},Zu=function(e){return B(e,function(e,t){return N(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},ea=function(e){return B(e,function(e,t){return N(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},ta=function(e,t,n){var r=Xt(e,n),o=$t.generate(r);return li(o,t,!0)},na=Yu,ra={insertRowBefore:zi(function(e,t,n,r){var o=t.row(),i=t.row(),u=lu(e,i,o,n,r.getOrInit);return Qu(u,i,t.column())},Ui,y,y,jo),insertRowsBefore:zi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Zu(t),a=B(u,function(e,t){return lu(e,i,o,n,r.getOrInit)},e);return Qu(a,i,t[0].column())},qi,y,y,jo),insertRowAfter:zi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=lu(e,i,o,n,r.getOrInit);return Qu(u,i,t.column())},Ui,y,y,jo),insertRowsAfter:zi(function(e,t,n,r){var o=Zu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=B(o,function(e,t){return lu(e,u,i,n,r.getOrInit)},e);return Qu(a,u,t[0].column())},qi,y,y,jo),insertColumnBefore:zi(function(e,t,n,r){var o=t.column(),i=t.column(),u=fu(e,i,o,n,r.getOrInit);return Qu(u,t.row(),i)},Ui,na,y,jo),insertColumnsBefore:zi(function(e,t,n,r){var o=ea(t),i=o[0].column(),u=o[0].column(),a=B(o,function(e,t){return fu(e,u,i,n,r.getOrInit)},e);return Qu(a,t[0].row(),u)},qi,na,y,jo),insertColumnAfter:zi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=fu(e,i,o,n,r.getOrInit);return Qu(u,t.row(),i)},Ui,na,y,jo),insertColumnsAfter:zi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=ea(t),a=B(u,function(e,t){return fu(e,i,o,n,r.getOrInit)},e);return Qu(a,t[0].row(),i)},qi,na,y,jo),splitCellIntoColumns:zi(function(e,t,n,r){var o=su(e,t.row(),t.column(),n,r.getOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,jo),splitCellIntoRows:zi(function(e,t,n,r){var o=du(e,t.row(),t.column(),n,r.getOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,jo),eraseColumns:zi(function(e,t,n,r){var o=ea(t),i=gu(e,o[0].column(),o[o.length-1].column()),u=Ju(i,t[0].row(),t[0].column());return Ku(i,u)},qi,na,Xu,jo),eraseRows:zi(function(e,t,n,r){var o=Zu(t),i=mu(e,o[0].row(),o[o.length-1].row()),u=Ju(i,t[0].row(),t[0].column());return Ku(i,u)},qi,y,Xu,jo),makeColumnHeader:zi(function(e,t,n,r){var o=bu(e,t.column(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,Fo("row","th")),unmakeColumnHeader:zi(function(e,t,n,r){var o=bu(e,t.column(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,Fo(null,"td")),makeRowHeader:zi(function(e,t,n,r){var o=wu(e,t.row(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,Fo("col","th")),unmakeRowHeader:zi(function(e,t,n,r){var o=wu(e,t.row(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,Fo(null,"td")),mergeCells:zi(function(e,t,n,r){var o=t.cells();Qo(o);var i=ou(e,t.bounds(),n,C(o[0]));return Ku(i,R.from(o[0]))},Yi,y,y,zo),unmergeCells:zi(function(e,t,n,r){var o=I(t,function(e,t){return iu(e,t,n,r.combine(t))},e);return Ku(o,R.from(t[0]))},Xi,y,y,zo),pasteCells:zi(function(e,n,t,r){var o,i,u,a,c=(o=n.clipboard(),i=n.generators(),u=Yt(o),a=$t.generate(u),li(a,i,!0)),l=ae.address(n.row(),n.column());return au(l,e,c,n.generators(),t).fold(function(){return Ku(e,R.some(n.element()))},function(e){var t=Ju(e,n.row(),n.column());return Ku(e,t)})},Vi,na,y,jo),pasteRowsBefore:zi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=ta(t.clipboard(),t.generators(),o),a=cu(i,e,u,t.generators(),n),c=Ju(a,t.cells[0].row(),t.cells[0].column());return Ku(a,c)},Gi,y,y,jo),pasteRowsAfter:zi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=ta(t.clipboard(),t.generators(),o),a=cu(i,e,u,t.generators(),n),c=Ju(a,t.cells[0].row(),t.cells[0].column());return Ku(a,c)},Gi,y,y,jo)},oa=function(e){return le.fromDom(e.getBody())},ia=function(e){return e.getBoundingClientRect().width},ua=function(e){return e.getBoundingClientRect().height},aa=function(t){return function(e){return $e(e,oa(t))}},ca=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},la=function(e){var t=Nt(e,"td[data-mce-style],th[data-mce-style]");xt(e,"data-mce-style"),A(t,function(e){xt(e,"data-mce-style")})},fa={isRtl:C(!1)},sa={isRtl:C(!0)},da={directionAt:function(e){return"rtl"==("rtl"===nn(e,"direction")?"rtl":"ltr")?sa:fa}},ma=["tableprops","tabledelete","|","tableinsertrowbefore","tableinsertrowafter","tabledeleterow","|","tableinsertcolbefore","tableinsertcolafter","tabledeletecol"],ga={"border-collapse":"collapse",width:"100%"},ha={border:"1"},pa=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},va=function(e){return e.getParam("table_row_advtab",!0,"boolean")},ba=function(e){return e.getParam("table_advtab",!0,"boolean")},wa=function(e){return e.getParam("table_style_by_css",!1,"boolean")},ya=function(e){return e.getParam("table_cell_class_list",[],"array")},xa=function(e){return e.getParam("table_row_class_list",[],"array")},Ca=function(e){return e.getParam("table_class_list",[],"array")},Ra=function(e){return!1===e.getParam("table_responsive_width")},Sa=function(e,t){return e.fire("newrow",{node:t})},Ta=function(e,t){return e.fire("newcell",{node:t})},Da=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},Oa=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},ka=function(f,e){var t,n=function(e){return"table"===lt(oa(e))},s=(t=f.getParam("table_clone_elements"),v(t)?R.some(t.split(/[ ,]/)):Array.isArray(t)?R.some(t):R.none()),r=function(u,a,c,l){return function(e,t){la(e);var n=l(),r=le.fromDom(f.getDoc()),o=Eo(da.directionAt),i=_n(c,r,s);return a(e)?u(n,e,t,i,o).bind(function(e){return A(e.newRows(),function(e){Sa(f,e.dom())}),A(e.newCells(),function(e){Ta(f,e.dom())}),e.cursor().map(function(e){var t=f.dom.createRng();return t.setStart(e.dom(),0),t.setEnd(e.dom(),0),t})}):R.none()}};return{deleteRow:r(ra.eraseRows,function(e){var t=Po(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(ra.eraseColumns,function(e){var t=Po(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(ra.insertRowsBefore,l,y,e),insertRowsAfter:r(ra.insertRowsAfter,l,y,e),insertColumnsBefore:r(ra.insertColumnsBefore,l,so,e),insertColumnsAfter:r(ra.insertColumnsAfter,l,so,e),mergeCells:r(ra.mergeCells,l,y,e),unmergeCells:r(ra.unmergeCells,l,y,e),pasteRowsBefore:r(ra.pasteRowsBefore,l,y,e),pasteRowsAfter:r(ra.pasteRowsAfter,l,y,e),pasteCells:r(ra.pasteCells,l,y,e)}},Na=function(e,t,r){var n=Yt(e),o=$t.generate(n);return qi(o,t).map(function(e){var t=li(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=Hi(t,r);return di(n)})},Ea=tinymce.util.Tools.resolve("tinymce.util.Tools"),Aa=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},Pa=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},Ia=function(t,n){Ea.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},Ba=function(t,n){Ea.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},Wa=function(o,e,i){var t;return t=function(e,t){for(var n=0;n<t.length;n++){var r=o.getStyle(t[n],i);if(void 0===e&&(e=r),e!==r)return""}return e}(t,o.select("td,th",e))},Ma=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?ca(o.width):"",i.height=o.height?ca(o.height):"",r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},_a=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);r.find("#borderStyle").value(i["border-style"]||""),r.find("#borderColor").value(i["border-color"]||""),r.find("#backgroundColor").value(i["background-color"]||""),r.find("#width").value(i.width||""),r.find("#height").value(i.height||"")},La={createStyleForm:function(n){var e=function(){var e=n.getParam("color_picker_callback");if(e)return function(t){return e.call(n,function(e){t.control.value(e).fire("change")},t.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:b(Ma,n)},items:[{label:"Style",name:"style",type:"textbox",onchange:b(_a,n)},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:b(Ma,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}},buildListItems:function(e,r,t){var o=function(e,n){return n=n||[],Ea.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=o(e.menu):(t.value=e.value,r&&r(t)),n.push(t)}),n};return o(e,t||[])},updateStyleField:Ma,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r},updateAdvancedFields:_a,syncAdvancedStyleFields:function(e,t){t.control.rootControl.find("#style")[0].getEl().isEqualNode(document.activeElement)?_a(e,t):Ma(e,t)}},ja=function(r,o,e){var i,u=r.dom;function a(e,t,n){(1===o.length||n)&&u.setAttrib(e,t,n)}function c(e,t,n){(1===o.length||n)&&u.setStyle(e,t,n)}pa(r)&&La.syncAdvancedStyleFields(r,e),i=e.control.rootControl.toJSON(),r.undoManager.transact(function(){Ea.each(o,function(e){var t,n;a(e,"scope",i.scope),1===o.length?a(e,"style",i.style):(t=e,n=i.style,delete t.dataset.mceStyle,t.style.cssText+=";"+n),a(e,"class",i["class"]),c(e,"width",ca(i.width)),c(e,"height",ca(i.height)),i.type&&e.nodeName.toLowerCase()!==i.type&&(e=u.rename(e,i.type)),1===o.length&&(Ia(r,e),Ba(r,e)),i.align&&Aa(r,e,i.align),i.valign&&Pa(r,e,i.valign)}),r.focus()})},Fa=function(t){var e,n,r,o=[];if(o=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!o.length&&e&&o.push(e),e=e||o[0]){var i,u,a,c;1<o.length?n={width:"",height:"",scope:"","class":"",align:"",valign:"",style:"",type:e.nodeName.toLowerCase()}:(u=e,a=(i=t).dom,c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class"),type:u.nodeName.toLowerCase(),style:"",align:"",valign:""},Ea.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(c.align=e)}),Ea.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(c.valign=e)}),pa(i)&&Ea.extend(c,La.extractAdvancedStyles(a,u)),n=c),0<ya(t).length&&(r={name:"class",type:"listbox",label:"Class",values:La.buildListItems(ya(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"td",classes:[e.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:b(La.updateStyleField,t)},{label:"Height",name:"height",onchange:b(La.updateStyleField,t)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};pa(t)?t.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:l},La.createStyleForm(t)],onsubmit:b(ja,t,o)}):t.windowManager.open({title:"Cell properties",data:n,body:l,onsubmit:b(ja,t,o)})}};function za(f,s,d,e){var m=f.dom;function g(e,t,n){(1===s.length||n)&&m.setAttrib(e,t,n)}va(f)&&La.syncAdvancedStyleFields(f,e);var h=e.control.rootControl.toJSON();f.undoManager.transact(function(){Ea.each(s,function(e){var t,n,r,o,i,u,a,c,l;g(e,"scope",h.scope),g(e,"style",h.style),g(e,"class",h["class"]),t=e,n="height",r=ca(h.height),(1===s.length||r)&&m.setStyle(t,n,r),h.type!==e.parentNode.nodeName.toLowerCase()&&(o=f.dom,i=e,u=h.type,a=o.getParent(i,"table"),c=i.parentNode,(l=o.select(u,a)[0])||(l=o.create(u),a.firstChild?"CAPTION"===a.firstChild.nodeName?o.insertAfter(l,a.firstChild):a.insertBefore(l,a.firstChild):a.appendChild(l)),l.appendChild(i),c.hasChildNodes()||o.remove(c)),h.align!==d.align&&(Ia(f,e),Aa(f,e,h.align))}),f.focus()})}var Ha=function(t){var e,n,r,o,i,u,a,c,l,f,s=t.dom,d=[];e=s.getParent(t.selection.getStart(),"table"),n=s.getParent(t.selection.getStart(),"td,th"),Ea.each(e.rows,function(t){Ea.each(t.cells,function(e){if(s.getAttrib(e,"data-mce-selected")||e===n)return d.push(t),!1})}),(r=d[0])&&(1<d.length?i={height:"",scope:"",style:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=t).dom,f={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class"),align:"",style:"",type:c.parentNode.nodeName.toLowerCase()},Ea.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),va(a)&&Ea.extend(f,La.extractAdvancedStyles(l,c)),i=f),0<xa(t).length&&(o={name:"class",type:"listbox",label:"Class",values:La.buildListItems(xa(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},va(t)?t.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},La.createStyleForm(t)],onsubmit:b(za,t,d,i)}):t.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:b(za,t,d,i)}))},Ua=tinymce.util.Tools.resolve("tinymce.Env"),qa={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},Va=function(e,t,n,r,o){void 0===o&&(o=qa);var i=le.fromTag("table");tn(i,o.styles),bt(i,o.attributes);var u=le.fromTag("tbody");fn(i,u);for(var a=[],c=0;c<e;c++){for(var l=le.fromTag("tr"),f=0;f<t;f++){var s=c<n||f<r?le.fromTag("th"):le.fromTag("td");f<r&&vt(s,"scope","row"),c<n&&vt(s,"scope","col"),fn(s,le.fromTag("br")),o.percentages&&en(s,"width",100/t+"%"),fn(l,s)}a.push(l)}return mn(u,a),i},Ga=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Ya=function(r,e,t){var n,o,i=r.getParam("table_default_styles",ga,"object"),u={styles:i,attributes:(o=r,o.getParam("table_default_attributes",ha,"object")),percentages:(n=i.width,v(n)&&-1!==n.indexOf("%")&&!Ra(r))},a=Va(t,e,0,0,u);vt(a,"data-mce-id","__mce");var c,l,f,s=(c=a,l=le.fromTag("div"),f=le.fromDom(c.dom().cloneNode(!0)),fn(l,f),l.dom().innerHTML);return r.insertContent(s),jt(oa(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return Ra(r)&&en(e,"width",nn(e,"width")),xt(e,"data-mce-id"),t=r,A(Nt(e,"tr"),function(e){Sa(t,e.dom()),A(Nt(e,"th,td"),function(e){Ta(t,e.dom())})}),n=r,jt(e,"td,th").each(b(Ga,n)),e.dom()}).getOr(null)};function Xa(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)Xa(e,t.children[o],n,r)}var Ka=function(e,t,n){var r,o,i=e.dom;ba(e)&&La.syncAdvancedStyleFields(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Ya(e,o.cols||1,o.rows||1)),function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=ca(n.height),o.getAttrib(t,"width")&&!wa(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=ca(n.width),wa(e)?(u["border-width"]=ca(n.border),u["border-spacing"]=ca(n.cellspacing),Ea.extend(i,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):Ea.extend(i,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),wa(e)&&t.children)for(var a=0;a<t.children.length;a++)Xa(o,t.children[a],{"border-width":ca(n.border),"border-color":n.borderColor,padding:ca(n.cellpadding)});n.style?Ea.extend(u,o.parseStyle(n.style)):u=Ea.extend({},o.parseStyle(o.getAttrib(t,"style")),u),i.style=o.serializeStyle(u),o.setAttribs(t,i)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=Ua.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),Ia(e,t),o.align&&Aa(e,t,o.align),e.focus(),e.addVisual()})},Ja=function(t,e){var n,r,o,i,u,a,c,l,f,s,d=t.dom,m={};!0===e?(n=d.getParent(t.selection.getStart(),"table"))&&(c=n,l=(a=t).dom,f={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||Wa(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||Wa(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},Ea.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),ba(a)&&Ea.extend(f,La.extractAdvancedStyles(l,c)),m=f):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),0<Ca(t).length&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:La.buildListItems(Ca(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:(s=t,s.getParam("table_appearance_options",!0,"boolean")?[r,o,{label:"Width",name:"width",onchange:b(La.updateStyleField,t)},{label:"Height",name:"height",onchange:b(La.updateStyleField,t)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:b(La.updateStyleField,t)},{label:"Height",name:"height",onchange:b(La.updateStyleField,t)}])},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},ba(t)?t.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},La.createStyleForm(t)],onsubmit:b(Ka,t,n)}):t.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:b(Ka,t,n)})},$a=Ea.each,Qa=function(a,t,c,l,n){var r=aa(a),f=function(){return le.fromDom(a.dom.getParent(a.selection.getStart(),"th,td"))},s=function(e){return Gt.table(e,r)},d=function(e){return{width:ia(e.dom()),height:ia(e.dom())}},o=function(t){var n=f();s(n).each(function(i){var e=Ur.forMenu(l,i,n),u=d(i);t(i,e).each(function(e){var t,n,r,o;t=a,n=u,o=d(r=i),n.width===o.width&&n.height===o.height||(Da(t,r.dom(),n.width,n.height),Oa(t,r.dom(),o.width,o.height)),a.selection.setRng(e),a.focus(),c.clear(i),la(i)})})},i=function(e){var o=f();return s(o).bind(function(e){var t=le.fromDom(a.getDoc()),n=Ur.forMenu(l,e,o),r=_n(y,t,R.none());return Na(e,n,r)})},u=function(u){n.get().each(function(e){var o=E(e,function(e){return xn(e)}),i=f();s(i).bind(function(t){var e=le.fromDom(a.getDoc()),n=Ln(e),r=Ur.pasteRows(l,t,i,o,n);u(t,r).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})})};$a({mceTableSplitCells:function(){o(t.unmergeCells)},mceTableMergeCells:function(){o(t.mergeCells)},mceTableInsertRowBefore:function(){o(t.insertRowsBefore)},mceTableInsertRowAfter:function(){o(t.insertRowsAfter)},mceTableInsertColBefore:function(){o(t.insertColumnsBefore)},mceTableInsertColAfter:function(){o(t.insertColumnsAfter)},mceTableDeleteCol:function(){o(t.deleteColumn)},mceTableDeleteRow:function(){o(t.deleteRow)},mceTableCutRow:function(e){n.set(i()),o(t.deleteRow)},mceTableCopyRow:function(e){n.set(i())},mceTablePasteRowBefore:function(e){u(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){u(t.pasteRowsAfter)},mceTableDelete:function(){var e=le.fromDom(a.dom.getParent(a.selection.getStart(),"th,td"));Gt.table(e,r).filter(m(r)).each(function(e){var t=le.fromText("");cn(e,t),hn(e);var n=a.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),a.selection.setRng(n)})}},function(e,t){a.addCommand(t,e)}),$a({mceInsertTable:b(Ja,a),mceTableProps:b(Ja,a,!0),mceTableRowProps:b(Ha,a),mceTableCellProps:b(Fa,a)},function(n,e){a.addCommand(e,function(e,t){n(t)})})},Za=function(e){var t=R.from(e.dom().documentElement).map(le.fromDom).getOr(e);return{parent:C(t),view:C(e),origin:C(go(0,0))}},ec=function(e,t){return{parent:C(t),view:C(e),origin:C(go(0,0))}};function tc(e){var n=X.apply(null,e),r=[];return{bind:function(e){if(e===undefined)throw"Event bind error: undefined handler";r.push(e)},unbind:function(t){r=P(r,function(e){return e!==t})},trigger:function(){var t=n.apply(null,arguments);A(r,function(e){e(t)})}}}var nc={create:function(e){return{registry:G(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:G(e,function(e){return e.trigger})}}},rc={mode:Mo(["compare","extract","mutate","sink"]),sink:Mo(["element","start","stop","destroy"]),api:Mo(["forceDrop","drop","move","delayDrop"])},oc={resolve:xi("ephox-dragster").resolve},ic=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,a,c=le.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=x(f,l),d=(t=c,n=e.clientX,r=e.clientY,o=l,i=f,u=s,a=e,{target:C(t),x:C(n),y:C(r),stop:o,prevent:i,kill:u,raw:C(a)});g(d)}}},uc=function(e,t,n,r){return o=e,i=t,u=!1,a=ic(n,r),o.dom().addEventListener(i,a,u),{unbind:b(ac,o,i,a,u)};var o,i,u,a},ac=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},cc=C(!0),lc=function(e,t,n){return uc(e,t,cc,n)},fc=rc.mode({compare:function(e,t){return go(t.left()-e.left(),t.top()-e.top())},extract:function(e){return R.some(go(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=ei({layerClass:oc.resolve("blocker")},n),o=le.fromTag("div"),vt(o,"role","presentation"),tn(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Oi(o,oc.resolve("blocker")),Oi(o,r.layerClass),{element:function(){return o},destroy:function(){hn(o)}}),u=lc(i.element(),"mousedown",e.forceDrop),a=lc(i.element(),"mouseup",e.drop),c=lc(i.element(),"mousemove",e.move),l=lc(i.element(),"mouseout",e.delayDrop);return rc.sink({element:i.element,start:function(e){fn(e,i.element())},stop:function(){hn(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function sc(){var i=R.none(),u=nc.create({move:tc(["info"])});return{onEvent:function(e,o){o.extract(e).each(function(e){var t,n,r;(t=o,n=e,r=i.map(function(e){return t.compare(e,n)}),i=R.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=R.none()},events:u.registry}}function dc(){var e={onEvent:function(e,t){},reset:y},t=sc(),n=e;return{on:function(){n.reset(),n=t},off:function(){n.reset(),n=e},isOn:function(){return n===t},onEvent:function(e,t){n.onEvent(e,t)},events:t.events}}var mc=function(t,n,e){var r,o,i,u=!1,a=nc.create({start:tc([]),stop:tc([])}),c=dc(),l=function(){d.stop(),c.isOn()&&(c.off(),a.trigger.stop())},f=(r=l,o=200,i=null,{cancel:function(){null!==i&&(clearTimeout(i),i=null)},throttle:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null!==i&&clearTimeout(i),i=setTimeout(function(){r.apply(null,e),i=null},o)}});c.events.move.bind(function(e){n.mutate(t,e.info())});var s=function(t){return function(){var e=Array.prototype.slice.call(arguments,0);if(u)return t.apply(null,e)}},d=n.sink(rc.api({forceDrop:l,drop:s(l),move:s(function(e,t){f.cancel(),c.onEvent(e,n)}),delayDrop:s(f.throttle)}),e);return{element:d.element,go:function(e){d.start(e),c.on(),a.trigger.start()},on:function(){u=!0},off:function(){u=!1},destroy:function(){d.destroy()},events:a.registry}},gc={transform:function(e,t){var n=t!==undefined?t:{},r=n.mode!==undefined?n.mode:fc;return mc(e,r,t)}};function hc(){var n,r=nc.create({drag:tc(["xDelta","yDelta","target"])}),o=R.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=nc.create({drag:tc(["xDelta","yDelta"])})).registry};return e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){o=R.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}}var pc=function(e,t,n){return Ft(e,t,n).isSome()},vc=Ci.resolve("resizer-bar-dragging");function bc(e,n){var r=ko.height,t=function(o,t,i){var n=hc(),r=gc.transform(n,{}),u=R.none(),e=function(e,t){return R.from(wt(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=ku.getInt(n.target(),"top");en(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=ku.getInt(n.target(),"left");en(n.target(),"left",t+n.xDelta()+"px")})});var a=function(e,t){return ku.getInt(e,t)-parseInt(wt(e,"data-initial-"+t),10)};r.events.stop.bind(function(){n.get().each(function(r){u.each(function(n){e(r,"data-row").each(function(e){var t=a(r,"top");xt(r,"data-initial-top"),d.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=a(r,"left");xt(r,"data-initial-left"),d.trigger.adjustWidth(n,t,parseInt(e,10))}),_i.refresh(o,n,i,t)})})});var c=function(e,t){d.trigger.startAdjust(),n.assign(e),vt(e,"data-initial-"+t,parseInt(nn(e,t),10)),Oi(e,vc),en(e,"opacity","0.2"),r.go(o.parent())},l=lc(o.parent(),"mousedown",function(e){_i.isRowBar(e.target())&&c(e.target(),"top"),_i.isColBar(e.target())&&c(e.target(),"left")}),f=function(e){return $e(e,o.view())},s=lc(o.view(),"mouseover",function(e){"table"===lt(e.target())||pc(e.target(),"table",f)?(u="table"===lt(e.target())?R.some(e.target()):_t(e.target(),"table",f)).each(function(e){_i.refresh(o,e,i,t)}):Rt(e.target())&&_i.destroy(o)}),d=nc.create({adjustHeight:tc(["table","delta","row"]),adjustWidth:tc(["table","delta","column"]),startAdjust:tc([])});return{destroy:function(){l.unbind(),s.unbind(),r.destroy(),_i.destroy(o)},refresh:function(e){_i.refresh(o,e,i,t)},on:r.on,off:r.off,hideBars:b(_i.hide,o),showBars:b(_i.show,o),events:d.registry}}(e,n,r),o=nc.create({beforeResize:tc(["table"]),afterResize:tc(["table"]),startDrag:tc([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());Gu(e.table(),t,e.row(),r),o.trigger.afterResize(e.table())}),t.events.startAdjust.bind(function(e){o.trigger.startDrag()}),t.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());Vu(e.table(),t,e.column(),n),o.trigger.afterResize(e.table())}),{on:t.on,off:t.off,hideBars:t.hideBars,showBars:t.showBars,destroy:t.destroy,events:o.registry}}var wc=function(e,t){return e.inline?ec(oa(e),(n=le.fromTag("div"),tn(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),fn(St(),n),n)):Za(le.fromDom(e.getDoc()));var n},yc=function(e,t){e.inline&&hn(t.parent())},xc=function(u){var a,c,o=R.none(),i=R.none(),l=R.none(),f=/(\d+(\.\d+)?)%/,s=function(e){return"TABLE"===e.nodeName};return u.on("init",function(){var e,t=Eo(da.directionAt),n=wc(u);if(l=R.some(n),("table"===(e=u.getParam("object_resizing",!0))||e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=bc(n,t);r.on(),r.events.startDrag.bind(function(e){o=R.some(u.selection.getRng())}),r.events.beforeResize.bind(function(e){var t=e.table().dom();Da(u,t,ia(t),ua(t))}),r.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();la(t),o.each(function(e){u.selection.setRng(e),u.focus()}),Oa(u,n,ia(n),ua(n)),u.undoManager.add()}),i=R.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;s(n)&&(a=e.width,t=n,c=u.dom.getStyle(t,"width")||u.dom.getAttrib(t,"width"))}),u.on("ObjectResized",function(e){var t=e.target;if(s(t)){var n=t;if(f.test(c)){var r=parseFloat(f.exec(c)[1]),o=e.width*r/a;u.dom.setStyle(n,"width",o+"%")}else{var i=[];Ea.each(n.rows,function(e){Ea.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),Ea.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return i},lazyWire:function(){return l.getOr(Za(le.fromDom(u.getBody())))},destroy:function(){i.each(function(e){e.destroy()}),l.each(function(e){yc(u,e)})}}},Cc=function(e){return{fold:e}},Rc=function(o){return Cc(function(e,t,n,r){return e(o)})},Sc=function(o){return Cc(function(e,t,n,r){return t(o)})},Tc=function(o,i){return Cc(function(e,t,n,r){return n(o,i)})},Dc=function(o){return Cc(function(e,t,n,r){return r(o)})},Oc=function(n,e){return Gt.table(n,e).bind(function(e){var t=Gt.cells(e);return M(t,function(e){return $e(n,e)}).map(function(e){return{index:C(e),all:C(t)}})})},kc=function(t,e){return Oc(t,e).fold(function(){return Rc(t)},function(e){return e.index()+1<e.all().length?Tc(t,e.all()[e.index()+1]):Dc(t)})},Nc=function(t,e){return Oc(t,e).fold(function(){return Rc()},function(e){return 0<=e.index()-1?Tc(t,e.all()[e.index()-1]):Sc(t)})},Ec=Br([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Ac={before:Ec.before,on:Ec.on,after:Ec.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},Pc=Br([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Ic=X("start","soffset","finish","foffset"),Bc=function(e){var t,n=e.match({domRange:function(e){return le.fromDom(e.startContainer)},relative:function(e,t){return Ac.getStart(e)},exact:function(e,t,n,r){return e}});return t=n.dom().ownerDocument.defaultView,le.fromDom(t)},Wc=(Pc.domRange,Pc.relative),Mc=Pc.exact,_c=function(e,t,n,r){var o,i,u,a,c,l=(i=t,u=n,a=r,(c=et(o=e).dom().createRange()).setStart(o.dom(),i),c.setEnd(u.dom(),a),c),f=$e(e,n)&&t===r;return l.collapsed&&!f},Lc=function(e,t){e.selectNodeContents(t.dom())},jc=function(e,t,n){var r,o,i=e.document.createRange();return r=i,t.fold(function(e){r.setStartBefore(e.dom())},function(e,t){r.setStart(e.dom(),t)},function(e){r.setStartAfter(e.dom())}),o=i,n.fold(function(e){o.setEndBefore(e.dom())},function(e,t){o.setEnd(e.dom(),t)},function(e){o.setEndAfter(e.dom())}),i},Fc=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},zc=function(e){return{left:C(e.left),top:C(e.top),right:C(e.right),bottom:C(e.bottom),width:C(e.width),height:C(e.height)}},Hc=Br([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Uc=function(e,t,n){return t(le.fromDom(n.startContainer),n.startOffset,le.fromDom(n.endContainer),n.endOffset)},qc=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:C(e),rtl:R.none}},relative:function(e,t){return{ltr:Se(function(){return jc(o,e,t)}),rtl:Se(function(){return R.some(jc(o,t,e))})}},exact:function(e,t,n,r){return{ltr:Se(function(){return Fc(o,e,t,n,r)}),rtl:Se(function(){return R.some(Fc(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return Hc.rtl(le.fromDom(e.endContainer),e.endOffset,le.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return Uc(0,Hc.ltr,r)}):Uc(0,Hc.ltr,r)},Vc=function(i,e){return qc(i,e).match({ltr:function(e,t,n,r){var o=i.document.createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},rtl:function(e,t,n,r){var o=i.document.createRange();return o.setStart(n.dom(),r),o.setEnd(e.dom(),t),o}})},Gc=(Hc.ltr,Hc.rtl,function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}),Yc=function(n,r,e,t,o){var i=function(e){var t=n.dom().createRange();return t.setStart(r.dom(),e),t.collapse(!0),t},u=Sn(r).length,a=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n<=a.bottom){if(n<a.top||i<c)return u-1;i=c}}return 0}(function(e){return i(e).getBoundingClientRect()},e,t,o.right,u);return i(a)},Xc=function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return ni(i,function(e){return Gc(e,r,o)?R.some(e):R.none()}).map(function(e){return Yc(t,n,r,o,e)})},Kc=function(t,e,n,r){var o=t.dom().createRange(),i=it(e);return ni(i,function(e){return o.selectNode(e.dom()),Gc(o.getBoundingClientRect(),n,r)?Jc(t,e,n,r):R.none()})},Jc=function(e,t,n,r){return(gt(t)?Xc:Kc)(e,t,n,r)},$c=function(e,t){return t-e.left<e.right-t},Qc=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},Zc=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=$c(o,n);return(!0===i?En:An)(e).map(function(e){return Qc(t,e,i)})},el=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=$c(r,n);return R.some(Qc(e,t,o))},tl=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect();return function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return Jc(e,t,u,a)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},nl=document.caretPositionFromPoint?function(n,e,t){return R.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return R.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),R.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return R.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return le.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===it(t=r).length?el:Zc)(e,t,n);var e,t,n};return 0===it(r).length?e():tl(o,r,i,t).orThunk(e)})},rl=function(e,t){var n=lt(e);return"input"===n?Ac.after(e):k(["br","img"],n)?0===t?Ac.before(e):Ac.after(e):Ac.on(e,t)},ol=function(e,t){var n=e.fold(Ac.before,rl,Ac.after),r=t.fold(Ac.before,rl,Ac.after);return Wc(n,r)},il=function(e,t,n,r){var o=rl(e,t),i=rl(n,r);return Wc(o,i)},ul=function(e,t){R.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},al=function(e,t,n,r,o){var i=Fc(e,t,n,r,o);ul(e,i)},cl=function(s,e){return qc(s,e).match({ltr:function(e,t,n,r){al(s,e,t,n,r)},rtl:function(e,t,n,r){var o,i,u,a,c,l=s.getSelection();if(l.setBaseAndExtent)l.setBaseAndExtent(e.dom(),t,n.dom(),r);else if(l.extend)try{i=e,u=t,a=n,c=r,(o=l).collapse(i.dom(),u),o.extend(a.dom(),c)}catch(f){al(s,n,r,e,t)}else al(s,n,r,e,t)}})},ll=function(e){var o=Bc(e).dom(),t=function(e,t,n,r){return Fc(o,e,t,n,r)},n=e.match({domRange:function(e){var t=le.fromDom(e.startContainer),n=le.fromDom(e.endContainer);return il(t,e.startOffset,n,e.endOffset)},relative:ol,exact:il});return qc(o,n).match({ltr:t,rtl:t})},fl=function(e){var t=le.fromDom(e.anchorNode),n=le.fromDom(e.focusNode);return _c(t,e.anchorOffset,n,e.focusOffset)?R.some(Ic(le.fromDom(e.anchorNode),e.anchorOffset,le.fromDom(e.focusNode),e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return R.some(Ic(le.fromDom(t.startContainer),t.startOffset,le.fromDom(n.endContainer),n.endOffset))}return R.none()}(e)},sl=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),Lc(r,n),r);ul(e,o)},dl=function(e){return(t=e,R.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(fl)).map(function(e){return Mc(e.start(),e.soffset(),e.finish(),e.foffset())});var t},ml=function(e,t){var n,r,o,i=Vc(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?R.some(o).map(zc):R.none()},gl=function(e,t,n){return r=e,o=t,i=n,u=le.fromDom(r.document),nl(u,o,i).map(function(e){return Ic(le.fromDom(e.startContainer),e.startOffset,le.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},hl=tinymce.util.Tools.resolve("tinymce.util.VK"),pl=function(e,t,n,r){return yl(e,t,kc(n),r)},vl=function(e,t,n,r){return yl(e,t,Nc(n),r)},bl=function(e,t){var n=Mc(t,0,t,0);return ll(n)},wl=function(e,t){var n,r=Nt(t,"tr");return(n=r,0===n.length?R.none():R.some(n[n.length-1])).bind(function(e){return jt(e,"td,th").map(function(e){return bl(0,e)})})},yl=function(r,e,t,o,n){return t.fold(R.none,R.none,function(e,t){return En(t).map(function(e){return bl(0,e)})},function(n){return Gt.table(n,e).bind(function(e){var t=Ur.noMenu(n);return r.undoManager.transact(function(){o.insertRowsAfter(e,t)}),wl(0,e)})})},xl=["table","li","dl"],Cl=function(t,n,r,o){if(t.keyCode===hl.TAB){var i=oa(n),u=function(e){var t=lt(e);return $e(e,i)||k(xl,t)},e=n.selection.getRng();if(e.collapsed){var a=le.fromDom(e.startContainer);Gt.cell(a,u).each(function(e){t.preventDefault(),(t.shiftKey?vl:pl)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}},Rl={response:X("selection","kill")},Sl=function(t){return function(e){return e===t}},Tl=Sl(38),Dl=Sl(40),Ol={ltr:{isBackward:Sl(37),isForward:Sl(39)},rtl:{isBackward:Sl(39),isForward:Sl(37)},isUp:Tl,isDown:Dl,isNavigation:function(e){return 37<=e&&e<=40}},kl=function(e,t){var n=Vc(e,t);return{start:C(le.fromDom(n.startContainer)),soffset:C(n.startOffset),finish:C(le.fromDom(n.endContainer)),foffset:C(n.endOffset)}},Nl=function(e,t,n,r){return{start:C(Ac.on(e,t)),finish:C(Ac.on(n,r))}};function El(a){return{elementFromPoint:function(e,t){return le.fromPoint(le.fromDom(a.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=Mc(e,t,n,r);return ml(a,o).map(function(e){return G(e,c)})},getSelection:function(){return dl(a).map(function(e){return kl(a,e)})},fromSitus:function(e){var t=Wc(e.start(),e.finish());return kl(a,t)},situsFromPoint:function(e,t){return gl(a,e,t).map(function(e){return{start:C(Ac.on(e.start(),e.soffset())),finish:C(Ac.on(e.finish(),e.foffset()))}})},clearSelection:function(){a.getSelection().removeAllRanges()},setSelection:function(e){var t,n,r,o,i,u;t=a,n=e.start(),r=e.soffset(),o=e.finish(),i=e.foffset(),u=il(n,r,o,i),cl(t,u)},setRelativeSelection:function(e,t){var n,r;n=a,r=ol(e,t),cl(n,r)},selectContents:function(e){sl(a,e)},getInnerHeight:function(){return a.innerHeight},getScrollY:function(){var e,t,n,r;return(e=le.fromDom(a.document),t=e!==undefined?e.dom():document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,go(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=le.fromDom(a.document))!==undefined?o.dom():document).defaultView.scrollBy(n,r)}}}Je.detect().browser.isSafari();var Al=function(n,e,r,t,o){return $e(r,t)?R.none():Sr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),R.some(Rl.response(R.some(Nl(r,0,r,On(r))),!0))):R.none()})},Pl={sync:function(n,r,e,t,o,i,u){return $e(e,o)&&t===i?R.none():Ft(e,"td,th",r).bind(function(t){return Ft(o,"td,th",r).bind(function(e){return Al(n,r,t,e,u)})})},detect:Al,update:function(e,t,n,r,o){return Dr(r,e,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(e){return o.clear(n),o.selectRange(n,e.boxes(),e.start(),e.finish()),e.boxes()})}},Il=ee(["left","top","right","bottom"],[]),Bl={nu:Il,moveUp:function(e,t){return Il({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return Il({left:e.left(),top:e.top()+t,right:e.right(),bottom:e.bottom()+t})},moveBottomTo:function(e,t){var n=e.bottom()-e.top();return Il({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return Il({left:e.left(),top:t,right:e.right(),bottom:t+n})},getTop:function(e){return e.top()},getBottom:function(e){return e.bottom()},translate:function(e,t,n){return Il({left:e.left()+t,top:e.top()+n,right:e.right()+t,bottom:e.bottom()+n})},toString:function(e){return"("+e.left()+", "+e.top()+") -> ("+e.right()+", "+e.bottom()+")"}},Wl=function(e){return Bl.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},Ml=function(e,t){return R.some(e.getRect(t))},_l=function(e,t,n){return mt(t)?Ml(e,t).map(Wl):gt(t)?(r=e,o=t,i=n,0<=i&&i<On(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):R.none()).map(Wl):R.none();var r,o,i},Ll=function(e,t){return mt(t)?Ml(e,t).map(Wl):gt(t)?e.getRangedRect(t,0,t,On(t)).map(Wl):R.none()},jl=X("item","mode"),Fl=function(e,t,n,r){var o=r!==undefined?r:zl;return e.property().parent(t).map(function(e){return jl(e,o)})},zl=function(e,t,n,r){var o=r!==undefined?r:Hl;return n.sibling(e,t).map(function(e){return jl(e,o)})},Hl=function(e,t,n,r){var o=r!==undefined?r:Hl,i=e.property().children(t);return n.first(i).map(function(e){return jl(e,o)})},Ul=[{current:Fl,next:zl,fallback:R.none()},{current:zl,next:Hl,fallback:R.some(Fl)},{current:Hl,next:Hl,fallback:R.some(zl)}],ql=function(t,n,r,o,e){return e=e!==undefined?e:Ul,W(e,function(e){return e.current===r}).bind(function(e){return e.current(t,n,o,e.next).orThunk(function(){return e.fallback.bind(function(e){return ql(t,n,e,o)})})})},Vl={backtrack:Fl,sidestep:zl,advance:Hl,go:ql},Gl={left:function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?R.some(e[e.length-1]):R.none()}}},right:function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?R.some(e[0]):R.none()}}}},Yl=function(t,e,n,r,o,i){return Vl.go(t,e,r,o).bind(function(e){return i(e.item())?R.none():n(e.item())?R.some(e.item()):Yl(t,e.item(),n,e.mode(),o,i)})},Xl=function(e,t,n,r){return Yl(e,t,n,Vl.sidestep,Gl.left(),r)},Kl=function(e,t,n,r){return Yl(e,t,n,Vl.sidestep,Gl.right(),r)},Jl=function(e,t){return 0===e.property().children(t).length},$l=function(e,t,n,r){return Xl(e,t,n,r)},Ql=function(e,t,n,r){return Kl(e,t,n,r)},Zl={before:function(e,t,n){return $l(e,t,b(Jl,e),n)},after:function(e,t,n){return Ql(e,t,b(Jl,e),n)},seekLeft:$l,seekRight:Ql,walkers:function(){return{left:Gl.left,right:Gl.right}},walk:function(e,t,n,r,o){return Vl.go(e,t,n,r,o)},backtrack:Vl.backtrack,sidestep:Vl.sidestep,advance:Vl.advance},ef=Fn(),tf={gather:function(e,t,n){return Zl.gather(ef,e,t,n)},before:function(e,t){return Zl.before(ef,e,t)},after:function(e,t){return Zl.after(ef,e,t)},seekLeft:function(e,t,n){return Zl.seekLeft(ef,e,t,n)},seekRight:function(e,t,n){return Zl.seekRight(ef,e,t,n)},walkers:function(){return Zl.walkers()},walk:function(e,t,n,r){return Zl.walk(ef,e,t,n,r)}},nf=Br([{none:[]},{retry:["caret"]}]),rf=function(t,e,r){return(n=e,o=Ko,Et(function(e){return o(e)},Mt,n,o,i)).fold(C(!1),function(e){return Ll(t,e).exists(function(e){return n=e,(t=r).left()<n.left()||Math.abs(n.right()-t.left())<1||t.left()>n.right();var t,n})});var n,o,i},of={point:Bl.getTop,adjuster:function(e,t,n,r,o){var i=Bl.moveUp(o,5);return Math.abs(n.top()-r.top())<1?nf.retry(i):n.bottom()<o.top()?nf.retry(i):n.bottom()===o.top()?nf.retry(Bl.moveUp(o,1)):rf(e,t,o)?nf.retry(Bl.translate(i,5,0)):nf.none()},move:Bl.moveUp,gather:tf.before},uf={point:Bl.getBottom,adjuster:function(e,t,n,r,o){var i=Bl.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?nf.retry(i):n.top()>o.bottom()?nf.retry(i):n.top()===o.bottom()?nf.retry(Bl.moveDown(o,1)):rf(e,t,o)?nf.retry(Bl.translate(i,5,0)):nf.none()},move:Bl.moveDown,gather:tf.after},af=function(n,r,o,i,u){return 0===u?R.some(i):(c=n,l=i.left(),f=r.point(i),c.elementFromPoint(l,f).filter(function(e){return"table"===lt(e)}).isSome()?(t=i,a=u-1,af(n,e=r,o,e.move(t,5),a)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(R.none,function(t,e){return Ll(n,t,e).bind(function(e){return r.adjuster(n,t,e,o,i).fold(R.none,function(e){return af(n,r,o,e,u-1)})}).orThunk(function(){return R.some(i)})},R.none)}));var e,t,a,c,l,f},cf=function(t,n,e){var r,o,i,u=t.move(e,5),a=af(n,t,e,u,100).getOr(u);return(r=t,o=a,i=n,r.point(o)>i.getInnerHeight()?R.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?R.some(-r.point(o)):R.none()).fold(function(){return n.situsFromPoint(a.left(),t.point(a))},function(e){return n.scrollBy(0,e),n.situsFromPoint(a.left(),t.point(a)-e)})},lf={tryUp:b(cf,of),tryDown:b(cf,uf),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:C(5)},ff=Br([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),sf=function(e){return Ft(e,"tr")},df={verify:function(a,e,t,n,r,c,o){return Ft(n,"td,th",o).bind(function(u){return Ft(e,"td,th",o).map(function(i){return $e(u,i)?$e(n,u)&&On(u)===r?c(i):ff.none("in same cell"):ur.sharedOne(sf,[u,i]).fold(function(){return t=i,n=u,r=(e=a).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?ff.success():c(i);var e,t,n,r,o},function(e){return c(i)})})}).getOr(ff.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)},adt:ff},mf={point:X("element","offset"),delta:X("element","deltaOffset"),range:X("element","start","finish"),points:X("begin","end"),text:X("element","text")},gf=(X("ancestor","descendants","element","index"),X("parent","children","element","index")),hf=function(e,t){return M(e,b($e,t))},pf=function(e){return"br"===lt(e)},vf=function(e,t,n){return t(e,n).bind(function(e){return gt(e)&&0===Sn(e).trim().length?vf(e,t,n):R.some(e)})},bf=function(t,e,n,r){return(o=e,i=n,ut(o,i).filter(pf).orThunk(function(){return ut(o,i-1).filter(pf)})).bind(function(e){return r.traverse(e).fold(function(){return vf(e,r.gather,t).map(r.relative)},function(e){return(r=e,tt(r).bind(function(t){var n=it(t);return hf(n,r).map(function(e){return gf(t,n,r,e)})})).map(function(e){return Ac.on(e.parent(),e.index())});var r})});var o,i},wf=function(e,t,n,r){var o,i,u;return(pf(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return vf(i,u.gather,o)}).map(u.relative)):bf(e,t,n,r)).map(function(e){return{start:C(e),finish:C(e)}})},yf=function(e){return df.cata(e,function(e){return R.none()},function(){return R.none()},function(e){return R.some(mf.point(e,0))},function(e){return R.some(mf.point(e,On(e)))})},xf=Je.detect(),Cf=function(r,o,i,u,a,c){return 0===c?R.none():Tf(r,o,i,u,a).bind(function(e){var t=r.fromSitus(e),n=df.verify(r,i,u,t.finish(),t.foffset(),a.failure,o);return df.cata(n,function(){return R.none()},function(){return R.some(e)},function(e){return $e(i,e)&&0===u?Rf(r,i,u,Bl.moveUp,a):Cf(r,o,e,0,a,c-1)},function(e){return $e(i,e)&&u===On(e)?Rf(r,i,u,Bl.moveDown,a):Cf(r,o,e,On(e),a,c-1)})})},Rf=function(t,e,n,r,o){return _l(t,e,n).bind(function(e){return Sf(t,o,r(e,lf.getJumpSize()))})},Sf=function(e,t,n){return xf.browser.isChrome()||xf.browser.isSafari()||xf.browser.isFirefox()||xf.browser.isEdge()?t.otherRetry(e,n):xf.browser.isIE()?t.ieRetry(e,n):R.none()},Tf=function(t,e,n,r,o){return _l(t,n,r).bind(function(e){return Sf(t,o,e)})},Df=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return wf(i,r.finish(),r.foffset(),u).fold(function(){return R.some(mf.point(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=df.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return yf(n)})})).bind(function(e){return Cf(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},Of=Je.detect(),kf=function(e,t){return Mt(e,function(e){return tt(e).exists(function(e){return $e(e,t)})},n).isSome();var n},Nf=function(t,r,o,e,i){return Ft(e,"td,th",r).bind(function(n){return Ft(n,"table",r).bind(function(e){return kf(i,e)?Df(t,r,o).bind(function(t){return Ft(t.finish(),"td,th",r).map(function(e){return{start:C(n),finish:C(e),range:C(t)}})}):R.none()})})},Ef=function(e,t,n,r,o,i){return Of.browser.isIE()?R.none():i(r,t).orThunk(function(){return Nf(e,t,n,r,o).map(function(e){var t=e.range();return Rl.response(R.some(Nl(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},Af=function(e,t,n,r,o,i,u){return Nf(e,n,r,o,i).bind(function(e){return Pl.detect(t,n,e.start(),e.finish(),u)})},Pf=function(e,r){return Ft(e,"tr",r).bind(function(n){return Ft(n,"table",r).bind(function(e){var t=Nt(e,"tr");return $e(n,t[0])?tf.seekLeft(e,function(e){return An(e).isSome()},r).map(function(e){var t=On(e);return Rl.response(R.some(Nl(e,t,e,t)),!0)}):R.none()})})},If=function(e,r){return Ft(e,"tr",r).bind(function(n){return Ft(n,"table",r).bind(function(e){var t=Nt(e,"tr");return $e(n,t[t.length-1])?tf.seekRight(e,function(e){return En(e).isSome()},r).map(function(e){return Rl.response(R.some(Nl(e,0,e,0)),!0)}):R.none()})})},Bf=function(e,t){return Ft(e,"td,th",t)},Wf={down:{traverse:ot,gather:tf.after,relative:Ac.before,otherRetry:lf.tryDown,ieRetry:lf.ieTryDown,failure:df.adt.failedDown},up:{traverse:rt,gather:tf.before,relative:Ac.before,otherRetry:lf.tryUp,ieRetry:lf.ieTryUp,failure:df.adt.failedUp}},Mf=X("rows","cols"),_f={mouse:function(e,t,n,r){var o,i,u,a,c,l,f=El(e),s=(o=f,i=t,u=n,a=r,c=R.none(),l=function(){c=R.none()},{mousedown:function(e){a.clear(i),c=Bf(e.target(),u)},mouseover:function(e){c.each(function(r){a.clear(i),Bf(e.target(),u).each(function(n){Sr(r,n,u).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!$e(r,n))&&(a.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(){c.each(l)}});return{mousedown:s.mousedown,mouseover:s.mouseover,mouseup:s.mouseup}},keyboard:function(e,c,l,f){var s=El(e),d=function(){return f.clear(c),R.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw().which,a=!0===e.raw().shiftKey;return Tr(c,f.selectedSelector()).fold(function(){return Ol.isDown(u)&&a?b(Af,s,c,l,Wf.down,r,t,f.selectRange):Ol.isUp(u)&&a?b(Af,s,c,l,Wf.up,r,t,f.selectRange):Ol.isDown(u)?b(Ef,s,l,Wf.down,r,t,If):Ol.isUp(u)?b(Ef,s,l,Wf.up,r,t,Pf):R.none},function(t){var e=function(e){return function(){return ni(e,function(e){return Pl.update(e.rows(),e.cols(),c,t,f)}).fold(function(){return Or(c,f.firstSelectedSelector(),f.lastSelectedSelector()).map(function(e){var t=Ol.isDown(u)||i.isForward(u)?Ac.after:Ac.before;return s.setRelativeSelection(Ac.on(e.first(),0),t(e.table())),f.clear(c),Rl.response(R.none(),!0)})},function(e){return R.some(Rl.response(R.none(),!0))})}};return Ol.isDown(u)&&a?e([Mf(1,0)]):Ol.isUp(u)&&a?e([Mf(-1,0)]):i.isBackward(u)&&a?e([Mf(0,-1),Mf(-1,0)]):i.isForward(u)&&a?e([Mf(0,1),Mf(1,0)]):Ol.isNavigation(u)&&!1===a?d:R.none})()},keyup:function(t,n,r,o,i){return Tr(c,f.selectedSelector()).fold(function(){var e=t.raw().which;return 0==(!0===t.raw().shiftKey)?R.none():Ol.isNavigation(e)?Pl.sync(c,l,n,r,o,i,f.selectRange):R.none()},R.none)}}}},Lf=function(r,e){A(e,function(e){var t,n;n=e,Si(t=r)?t.dom().classList.remove(n):Di(t,n),ki(t)})},jf={byClass:function(o){var t,n,i=(t=o.selected(),function(e){Oi(e,t)}),r=(n=[o.selected(),o.lastSelected(),o.firstSelected()],function(e){Lf(e,n)}),u=function(e){var t=Nt(e,o.selectedSelector());A(t,r)};return{clear:u,selectRange:function(e,t,n,r){u(e),A(t,i),Oi(n,o.firstSelected()),Oi(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){xt(e,o.selected()),xt(e,o.firstSelected()),xt(e,o.lastSelected())},i=function(e){vt(e,o.selected(),"1")},u=function(e){var t=Nt(e,o.selectedSelector());A(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),A(t,i),vt(n,o.firstSelected(),"1"),vt(r,o.lastSelected(),"1")},selectedSelecto
|
|