├── README.md ├── _config.yml ├── block-tune-layout.ts ├── checklist.js ├── delimiter.js ├── editor.js ├── embed.js ├── header.js ├── image.js ├── index.html ├── list.js ├── minus.svg ├── padding.svg ├── paragraph.js ├── plus.svg ├── quote.js ├── script.js ├── style.css └── table.js /README.md: -------------------------------------------------------------------------------- 1 | ## EditorJS Multiple Column Layout 2 | 3 | This is a test for multiple columns without nested elements. Using Bootstrap like grid system and display float (rather than flex) for each block. 4 | 5 | UPDATED: Please refer to this https://github.com/codex-team/editor.js/issues/836 there is a better solution now 6 | CHECKOUT THIS https://github.com/hata6502/editorjs-layout#readme [Multi Column Layout] 7 | 8 | 9 | [Test With Demo](https://oodeveloper.github.io/editorjs-multicolumn/) 10 | 11 | * Please note that this is just a test and this is not for production 12 | [Related Topic](https://github.com/codex-team/editor.js/issues/836) 13 | 14 | ### Installation 15 | Use editor.js file 16 | ```HTML 17 | 18 | ``` 19 | Please add this css styles 20 | ```CSS 21 | /* Editor CSS */ 22 | #editorjs{max-width: 650px;margin: 0 auto} 23 | /* .codex-editor__redactor{display: flex;flex-wrap: wrap;flex-direction: row;} */ 24 | .codex-editor__redactor{} 25 | /* .ce-block{width: 100%;padding-left: 0;padding-right: 0;} */ 26 | .ce-block{width: 100%;float: left;padding-left: 0;padding-right: 0;} 27 | 28 | .es-col-1 { 29 | -ms-flex: 0 0 8.333333%; 30 | flex: 0 0 8.333333%; 31 | max-width: 8.333333%; 32 | } 33 | 34 | .es-col-2 { 35 | -ms-flex: 0 0 16.666667%; 36 | flex: 0 0 16.666667%; 37 | max-width: 16.666667%; 38 | } 39 | 40 | .es-col-3 { 41 | -ms-flex: 0 0 25%; 42 | flex: 0 0 25%; 43 | max-width: 25%; 44 | } 45 | 46 | .es-col-4 { 47 | -ms-flex: 0 0 33.333333%; 48 | flex: 0 0 33.333333%; 49 | max-width: 33.333333%; 50 | } 51 | 52 | .es-col-5 { 53 | -ms-flex: 0 0 41.666667%; 54 | flex: 0 0 41.666667%; 55 | max-width: 41.666667%; 56 | } 57 | 58 | .es-col-6 { 59 | -ms-flex: 0 0 50%; 60 | flex: 0 0 50%; 61 | max-width: 50%; 62 | } 63 | 64 | .es-col-7 { 65 | -ms-flex: 0 0 58.333333%; 66 | flex: 0 0 58.333333%; 67 | max-width: 58.333333%; 68 | } 69 | 70 | .es-col-8 { 71 | -ms-flex: 0 0 66.666667%; 72 | flex: 0 0 66.666667%; 73 | max-width: 66.666667%; 74 | } 75 | 76 | .es-col-9 { 77 | -ms-flex: 0 0 75%; 78 | flex: 0 0 75%; 79 | max-width: 75%; 80 | } 81 | 82 | .es-col-10 { 83 | -ms-flex: 0 0 83.333333%; 84 | flex: 0 0 83.333333%; 85 | max-width: 83.333333%; 86 | } 87 | 88 | .es-col-11 { 89 | -ms-flex: 0 0 91.666667%; 90 | flex: 0 0 91.666667%; 91 | max-width: 91.666667%; 92 | } 93 | 94 | .es-col-12 { 95 | -ms-flex: 0 0 100%; 96 | flex: 0 0 100%; 97 | max-width: 100%; 98 | } 99 | 100 | .cdx-settings-input{border: 1px solid rgba(201,201,204,.48);-webkit-box-shadow: inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow: inset 0 1px 2px 0 rgba(35,44,72,.06);border-radius: 3px;padding: 3px 8px;outline: none;width: 100%;-webkit-box-sizing: border-box;box-sizing: border-box;} 101 | .cdx-small{font-size: .6rem} 102 | .ce-block__content{max-width: 100%} 103 | 104 | .cdx-settings-button.disabled,.ce-settings__button.disabled{pointer-events: none;opacity: .5} 105 | .cdx-settings-sidebar{position: absolute;left: 100%;bottom:0;background: #fff;width: 108px;height: 145px;box-shadow: 0 3px 15px -3px rgba(13,20,33,.13);border-radius: 0 4px 4px 0;z-index: 0;} 106 | /* Editor CSS - END */ 107 | ``` 108 | 109 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /block-tune-layout.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @class MoveDownTune 3 | * @classdesc Editor's default tune - Moves down highlighted block 4 | * 5 | * @copyright 2018 6 | */ 7 | 8 | import $ from '../dom'; 9 | import { API, BlockTune } from '../../../types'; 10 | 11 | /** 12 | * 13 | */ 14 | export default class LayoutTune implements BlockTune { 15 | /** 16 | * Property that contains Editor.js API methods 17 | * 18 | * @see {@link docs/api.md} 19 | */ 20 | private readonly api: API; 21 | private data; 22 | private wrapper; 23 | private sidebar; 24 | 25 | /** 26 | * Styles 27 | * 28 | * @type {{wrapper: string}} 29 | */ 30 | private CSS = { 31 | button: 'ce-settings__button', 32 | wrapper: 'ce-tune-layout', 33 | sidebar: 'cdx-settings-sidebar', 34 | animation: 'wobble', 35 | }; 36 | 37 | /** 38 | * MoveDownTune constructor 39 | * 40 | * @param {API} api — Editor's API 41 | */ 42 | constructor({ api, settings }) { 43 | this.api = api; 44 | this.data = {colWidth:12,pl:0,pr:0,pt:0,pb:0}; 45 | this.wrapper = undefined; 46 | this.sidebar = undefined; 47 | } 48 | 49 | /** 50 | * Return 'move down' button 51 | * 52 | * @returns {HTMLElement} 53 | */ 54 | public render(): HTMLElement { 55 | const layoutWrapper = $.make('div', this.CSS.wrapper, {}); 56 | const decreaseWidthButton = $.make('button', this.CSS.button, {}); 57 | const increaseWidthButton = $.make('button', this.CSS.button, {}); 58 | const paddingButton = $.make('button', this.CSS.button, {}); 59 | 60 | layoutWrapper.appendChild(decreaseWidthButton); 61 | layoutWrapper.appendChild(increaseWidthButton); 62 | layoutWrapper.appendChild(paddingButton); 63 | 64 | decreaseWidthButton.appendChild($.svg('decrease-width', 15, 15)); 65 | this.api.listeners.on( 66 | decreaseWidthButton, 67 | 'click', 68 | (event) => this.decreaseWidth(event as MouseEvent, decreaseWidthButton), 69 | false 70 | ); 71 | 72 | increaseWidthButton.appendChild($.svg('increase-width', 15, 15)); 73 | this.api.listeners.on( 74 | increaseWidthButton, 75 | 'click', 76 | (event) => this.increaseWidth(event as MouseEvent, increaseWidthButton), 77 | false 78 | ); 79 | 80 | 81 | paddingButton.appendChild($.svg('padding', 15, 15)); 82 | this.api.listeners.on( 83 | paddingButton, 84 | 'click', 85 | (event) => this.showPadding(event as MouseEvent, paddingButton), 86 | false 87 | ); 88 | 89 | /** 90 | * Enable tooltip module on button 91 | */ 92 | this.wrapper = layoutWrapper; 93 | return layoutWrapper; 94 | } 95 | 96 | 97 | /** 98 | * Handle clicks on 'move down' button 99 | * 100 | * @param {MouseEvent} event - click event 101 | * @param {HTMLElement} button - clicked button 102 | */ 103 | public decreaseWidth(event: MouseEvent, button: HTMLElement): void { 104 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 105 | 106 | if(currentBlockIndex < 0){ 107 | return; 108 | } 109 | 110 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 111 | if (!currentBlock){ 112 | return; 113 | } 114 | 115 | const currentBlockElement = currentBlock.holder; 116 | 117 | // let block = this.api.blocks.getBlock(currentBlockElement); 118 | let className = 'col-12'; 119 | const colClass = new RegExp(/\bcol-.+?\b/, 'g'); 120 | if (currentBlockElement.className.match(colClass)) { 121 | currentBlockElement.classList.forEach( cn => { 122 | if(cn.match(colClass)){ 123 | className = cn; 124 | } 125 | }); 126 | let parts = className.split('-'); 127 | let width = parseInt(parts[1]); 128 | if(width >= 2){ 129 | currentBlockElement.classList.remove('col-'+width); 130 | width = width - 1; 131 | currentBlockElement.classList.add('col-'+width); 132 | } 133 | } 134 | } 135 | 136 | public increaseWidth(event: MouseEvent, button: HTMLElement): void { 137 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 138 | 139 | if(currentBlockIndex < 0){ 140 | return; 141 | } 142 | 143 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 144 | if (!currentBlock){ 145 | return; 146 | } 147 | 148 | const currentBlockElement = currentBlock.holder; 149 | 150 | // let block = this.api.blocks.getBlock(currentBlockElement); 151 | let className = 'col-12'; 152 | const colClass = new RegExp(/\bcol-.+?\b/, 'g'); 153 | if (currentBlockElement.className.match(colClass)) { 154 | currentBlockElement.classList.forEach( cn => { 155 | if(cn.match(colClass)){ 156 | className = cn; 157 | } 158 | }); 159 | let parts = className.split('-'); 160 | let width = parseInt(parts[1]); 161 | if(width <= 11){ 162 | currentBlockElement.classList.remove('col-'+width); 163 | width = width + 1; 164 | currentBlockElement.classList.add('col-'+width); 165 | } 166 | } 167 | } 168 | 169 | public showPadding(event: MouseEvent, button: HTMLElement): void { 170 | if(button.classList.contains('cdx-settings-button--active')){ 171 | this.sidebar.remove(); 172 | button.classList.remove('cdx-settings-button--active'); 173 | } else { 174 | button.classList.add('cdx-settings-button--active'); 175 | const sidebarWrapper = $.make('div', this.CSS.sidebar, {}); 176 | const paddingLeftCaption = $.make('button', [this.CSS.button,'disabled'], {}); 177 | paddingLeftCaption.appendChild($.svg('arrow-left', 10, 10)); 178 | 179 | const paddingRightCaption = $.make('button', [this.CSS.button,'disabled'], {}); 180 | paddingRightCaption.appendChild($.svg('arrow-right', 10, 10)); 181 | 182 | const paddingTopCaption = $.make('button', [this.CSS.button,'disabled'], {}); 183 | paddingTopCaption.appendChild($.svg('arrow-up', 10, 10)); 184 | 185 | const paddingBottomCaption = $.make('button', [this.CSS.button,'disabled'], {}); 186 | paddingBottomCaption.appendChild($.svg('arrow-down', 10, 10)); 187 | 188 | const increasePaddingLeft = $.make('button', this.CSS.button, {}); 189 | const decreasePaddingLeft = $.make('button', this.CSS.button, {}); 190 | const increasePaddingRight = $.make('button', this.CSS.button, {}); 191 | const decreasePaddingRight = $.make('button', this.CSS.button, {}); 192 | const increasePaddingTop = $.make('button', this.CSS.button, {}); 193 | const decreasePaddingTop = $.make('button', this.CSS.button, {}); 194 | const increasePaddingBottom = $.make('button', this.CSS.button, {}); 195 | const decreasePaddingBottom = $.make('button', this.CSS.button, {}); 196 | this.sidebar = sidebarWrapper; 197 | 198 | 199 | 200 | // Left Padding 201 | sidebarWrapper.appendChild(paddingLeftCaption); 202 | 203 | increasePaddingLeft.appendChild($.svg('plus', 15, 15)); 204 | this.api.listeners.on( 205 | increasePaddingLeft, 206 | 'click', 207 | (event) => this.increasePaddingLeft(event as MouseEvent, increasePaddingLeft), 208 | false 209 | ); 210 | sidebarWrapper.appendChild(increasePaddingLeft); 211 | 212 | decreasePaddingLeft.appendChild($.svg('minus', 15, 15)); 213 | this.api.listeners.on( 214 | decreasePaddingLeft, 215 | 'click', 216 | (event) => this.decreasePaddingLeft(event as MouseEvent, decreasePaddingLeft), 217 | false 218 | ); 219 | sidebarWrapper.appendChild(decreasePaddingLeft); 220 | 221 | // Right Padding 222 | sidebarWrapper.appendChild(paddingRightCaption); 223 | increasePaddingRight.appendChild($.svg('plus', 15, 15)); 224 | this.api.listeners.on( 225 | increasePaddingRight, 226 | 'click', 227 | (event) => this.increasePaddingRight(event as MouseEvent, increasePaddingRight), 228 | false 229 | ); 230 | sidebarWrapper.appendChild(increasePaddingRight); 231 | 232 | decreasePaddingRight.appendChild($.svg('minus', 15, 15)); 233 | this.api.listeners.on( 234 | decreasePaddingRight, 235 | 'click', 236 | (event) => this.decreasePaddingRight(event as MouseEvent, decreasePaddingRight), 237 | false 238 | ); 239 | sidebarWrapper.appendChild(decreasePaddingRight); 240 | 241 | // Top Padding 242 | sidebarWrapper.appendChild(paddingTopCaption); 243 | increasePaddingTop.appendChild($.svg('plus', 15, 15)); 244 | this.api.listeners.on( 245 | increasePaddingTop, 246 | 'click', 247 | (event) => this.increasePaddingTop(event as MouseEvent, increasePaddingTop), 248 | false 249 | ); 250 | sidebarWrapper.appendChild(increasePaddingTop); 251 | 252 | decreasePaddingTop.appendChild($.svg('minus', 15, 15)); 253 | this.api.listeners.on( 254 | decreasePaddingTop, 255 | 'click', 256 | (event) => this.decreasePaddingTop(event as MouseEvent, decreasePaddingTop), 257 | false 258 | ); 259 | sidebarWrapper.appendChild(decreasePaddingTop); 260 | 261 | // Bottom Padding 262 | sidebarWrapper.appendChild(paddingBottomCaption); 263 | increasePaddingBottom.appendChild($.svg('plus', 15, 15)); 264 | this.api.listeners.on( 265 | increasePaddingBottom, 266 | 'click', 267 | (event) => this.increasePaddingBottom(event as MouseEvent, increasePaddingBottom), 268 | false 269 | ); 270 | sidebarWrapper.appendChild(increasePaddingBottom); 271 | 272 | decreasePaddingBottom.appendChild($.svg('minus', 15, 15)); 273 | this.api.listeners.on( 274 | decreasePaddingBottom, 275 | 'click', 276 | (event) => this.decreasePaddingBottom(event as MouseEvent, decreasePaddingBottom), 277 | false 278 | ); 279 | sidebarWrapper.appendChild(decreasePaddingBottom); 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | this.wrapper.appendChild(sidebarWrapper); 288 | } 289 | 290 | } 291 | 292 | public increasePaddingLeft(event: MouseEvent, button: HTMLElement): void { 293 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 294 | 295 | if(currentBlockIndex < 0){ 296 | return; 297 | } 298 | 299 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 300 | if (!currentBlock){ 301 | return; 302 | } 303 | 304 | const currentBlockElement = currentBlock.holder; 305 | 306 | // let block = this.api.blocks.getBlock(currentBlockElement); 307 | let className = 'pl-0'; 308 | const paddingClass = new RegExp(/\pl-.+?\b/, 'g'); 309 | if (currentBlockElement.className.match(paddingClass)) { 310 | currentBlockElement.classList.forEach( cn => { 311 | if(cn.match(paddingClass)){ 312 | className = cn; 313 | } 314 | }); 315 | let parts = className.split('-'); 316 | let padding = parseInt(parts[1]); 317 | if(padding <= 4){ 318 | currentBlockElement.classList.remove('pl-'+padding); 319 | padding = padding + 1; 320 | currentBlockElement.classList.add('pl-'+padding); 321 | } 322 | } 323 | 324 | } 325 | 326 | public decreasePaddingLeft(event: MouseEvent, button: HTMLElement): void { 327 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 328 | 329 | if(currentBlockIndex < 0){ 330 | return; 331 | } 332 | 333 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 334 | if (!currentBlock){ 335 | return; 336 | } 337 | 338 | const currentBlockElement = currentBlock.holder; 339 | 340 | // let block = this.api.blocks.getBlock(currentBlockElement); 341 | let className = 'pl-0'; 342 | const paddingClass = new RegExp(/\pl-.+?\b/, 'g'); 343 | if (currentBlockElement.className.match(paddingClass)) { 344 | currentBlockElement.classList.forEach( cn => { 345 | if(cn.match(paddingClass)){ 346 | className = cn; 347 | } 348 | }); 349 | let parts = className.split('-'); 350 | let padding = parseInt(parts[1]); 351 | if(padding >= 1){ 352 | currentBlockElement.classList.remove('pl-'+padding); 353 | padding = padding - 1; 354 | currentBlockElement.classList.add('pl-'+padding); 355 | } 356 | } 357 | 358 | } 359 | 360 | public increasePaddingRight(event: MouseEvent, button: HTMLElement): void { 361 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 362 | 363 | if(currentBlockIndex < 0){ 364 | return; 365 | } 366 | 367 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 368 | if (!currentBlock){ 369 | return; 370 | } 371 | 372 | const currentBlockElement = currentBlock.holder; 373 | 374 | // let block = this.api.blocks.getBlock(currentBlockElement); 375 | let className = 'pr-0'; 376 | const paddingClass = new RegExp(/\pr-.+?\b/, 'g'); 377 | if (currentBlockElement.className.match(paddingClass)) { 378 | currentBlockElement.classList.forEach( cn => { 379 | if(cn.match(paddingClass)){ 380 | className = cn; 381 | } 382 | }); 383 | let parts = className.split('-'); 384 | let padding = parseInt(parts[1]); 385 | if(padding <= 4){ 386 | currentBlockElement.classList.remove('pr-'+padding); 387 | padding = padding + 1; 388 | currentBlockElement.classList.add('pr-'+padding); 389 | } 390 | } 391 | 392 | 393 | } 394 | 395 | public decreasePaddingRight(event: MouseEvent, button: HTMLElement): void { 396 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 397 | 398 | if(currentBlockIndex < 0){ 399 | return; 400 | } 401 | 402 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 403 | if (!currentBlock){ 404 | return; 405 | } 406 | 407 | const currentBlockElement = currentBlock.holder; 408 | 409 | // let block = this.api.blocks.getBlock(currentBlockElement); 410 | let className = 'pr-0'; 411 | const paddingClass = new RegExp(/\pr-.+?\b/, 'g'); 412 | if (currentBlockElement.className.match(paddingClass)) { 413 | currentBlockElement.classList.forEach( cn => { 414 | if(cn.match(paddingClass)){ 415 | className = cn; 416 | } 417 | }); 418 | let parts = className.split('-'); 419 | let padding = parseInt(parts[1]); 420 | if(padding >= 1){ 421 | currentBlockElement.classList.remove('pr-'+padding); 422 | padding = padding - 1; 423 | currentBlockElement.classList.add('pr-'+padding); 424 | } 425 | } 426 | 427 | } 428 | 429 | public increasePaddingTop(event: MouseEvent, button: HTMLElement): void { 430 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 431 | 432 | if(currentBlockIndex < 0){ 433 | return; 434 | } 435 | 436 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 437 | if (!currentBlock){ 438 | return; 439 | } 440 | 441 | const currentBlockElement = currentBlock.holder; 442 | 443 | // let block = this.api.blocks.getBlock(currentBlockElement); 444 | let className = 'pt-0'; 445 | const paddingClass = new RegExp(/\pt-.+?\b/, 'g'); 446 | if (currentBlockElement.className.match(paddingClass)) { 447 | currentBlockElement.classList.forEach( cn => { 448 | if(cn.match(paddingClass)){ 449 | className = cn; 450 | } 451 | }); 452 | let parts = className.split('-'); 453 | let padding = parseInt(parts[1]); 454 | if(padding <= 4){ 455 | currentBlockElement.classList.remove('pt-'+padding); 456 | padding = padding + 1; 457 | currentBlockElement.classList.add('pt-'+padding); 458 | } 459 | } 460 | 461 | 462 | } 463 | 464 | public decreasePaddingTop(event: MouseEvent, button: HTMLElement): void { 465 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 466 | 467 | if(currentBlockIndex < 0){ 468 | return; 469 | } 470 | 471 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 472 | if (!currentBlock){ 473 | return; 474 | } 475 | 476 | const currentBlockElement = currentBlock.holder; 477 | 478 | // let block = this.api.blocks.getBlock(currentBlockElement); 479 | let className = 'pt-0'; 480 | const paddingClass = new RegExp(/\pt-.+?\b/, 'g'); 481 | if (currentBlockElement.className.match(paddingClass)) { 482 | currentBlockElement.classList.forEach( cn => { 483 | if(cn.match(paddingClass)){ 484 | className = cn; 485 | } 486 | }); 487 | let parts = className.split('-'); 488 | let padding = parseInt(parts[1]); 489 | if(padding >= 1){ 490 | currentBlockElement.classList.remove('pt-'+padding); 491 | padding = padding - 1; 492 | currentBlockElement.classList.add('pt-'+padding); 493 | } 494 | } 495 | 496 | } 497 | 498 | public increasePaddingBottom(event: MouseEvent, button: HTMLElement): void { 499 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 500 | 501 | if(currentBlockIndex < 0){ 502 | return; 503 | } 504 | 505 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 506 | if (!currentBlock){ 507 | return; 508 | } 509 | 510 | const currentBlockElement = currentBlock.holder; 511 | 512 | // let block = this.api.blocks.getBlock(currentBlockElement); 513 | let className = 'pb-0'; 514 | const paddingClass = new RegExp(/\pb-.+?\b/, 'g'); 515 | if (currentBlockElement.className.match(paddingClass)) { 516 | currentBlockElement.classList.forEach( cn => { 517 | if(cn.match(paddingClass)){ 518 | className = cn; 519 | } 520 | }); 521 | let parts = className.split('-'); 522 | let padding = parseInt(parts[1]); 523 | if(padding <= 4){ 524 | currentBlockElement.classList.remove('pb-'+padding); 525 | padding = padding + 1; 526 | currentBlockElement.classList.add('pb-'+padding); 527 | } 528 | } 529 | 530 | } 531 | 532 | public decreasePaddingBottom(event: MouseEvent, button: HTMLElement): void { 533 | const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); 534 | 535 | if(currentBlockIndex < 0){ 536 | return; 537 | } 538 | 539 | const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); 540 | if (!currentBlock){ 541 | return; 542 | } 543 | 544 | const currentBlockElement = currentBlock.holder; 545 | 546 | // let block = this.api.blocks.getBlock(currentBlockElement); 547 | let className = 'pb-0'; 548 | const paddingClass = new RegExp(/\pb-.+?\b/, 'g'); 549 | if (currentBlockElement.className.match(paddingClass)) { 550 | currentBlockElement.classList.forEach( cn => { 551 | if(cn.match(paddingClass)){ 552 | className = cn; 553 | } 554 | }); 555 | let parts = className.split('-'); 556 | let padding = parseInt(parts[1]); 557 | if(padding >= 1){ 558 | currentBlockElement.classList.remove('pb-'+padding); 559 | padding = padding - 1; 560 | currentBlockElement.classList.add('pb-'+padding); 561 | } 562 | } 563 | } 564 | 565 | } 566 | -------------------------------------------------------------------------------- /checklist.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Checklist=t():e.Checklist=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=6)}([function(e,t,n){var r=n(1);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(3)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".cdx-checklist__item {\n display: flex;\n box-sizing: content-box;\n }\n\n .cdx-checklist__item-text {\n outline: none;\n flex-grow: 1;\n padding: 5px 0;\n }\n\n .cdx-checklist__item-checkbox {\n display: inline-block;\n flex-shrink: 0;\n position: relative;\n width: 20px;\n height: 20px;\n margin: 5px;\n margin-left: 0;\n margin-right: 7px;\n border-radius: 50%;\n border: 1px solid #d0d0d0;\n background: #fff;\n cursor: pointer;\n user-select: none;\n }\n\n .cdx-checklist__item-checkbox:hover {\n border-color: #b5b5b5;\n }\n\n .cdx-checklist__item-checkbox::after {\n position: absolute;\n top: 6px;\n left: 5px;\n width: 9px;\n height: 4px;\n border: 2px solid #fff;\n border-top: none;\n border-right: none;\n background: transparent;\n content: '';\n opacity: 0;\n transform: rotate(-45deg);\n }\n\n .cdx-checklist__item--checked .cdx-checklist__item-checkbox {\n background: #388ae5;\n border-color: #388ae5;\n }\n\n .cdx-checklist__item--checked .cdx-checklist__item-checkbox:hover {\n background: #307cd1;\n }\n\n .cdx-checklist__item--checked .cdx-checklist__item-checkbox::after {\n opacity: 1;\n }\n",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(s=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),o=r.sources.map((function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"}));return[n].concat(o).concat([i]).join("\n")}var s;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i=0&&f.splice(t,1)}function b(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),g(t,e.attrs),m(e,t),t}function g(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function y(e,t){var n,r,i,o;if(t.transform&&e.css){if(!(o=t.transform(e.css)))return function(){};e.css=o}if(t.singleton){var s=u++;n=l||(l=b(t)),r=w.bind(null,n,s,!1),i=w.bind(null,n,s,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),m(e,t),t}(t),r=C.bind(null,n,t),i=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=b(t),r=S.bind(null,n),i=function(){v(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=s()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return d(n,t),function(e){for(var r=[],i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(e);Array.isArray(n)?(t=o.classList).add.apply(t,r(n)):n&&o.classList.add(n);for(var s in i)o[s]=i[s];return o}function c(e){return e.innerHTML.replace("
"," ").trim()}function a(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=document.createRange(),i=window.getSelection();r.selectNodeContents(e),void 0!==n&&(r.setStart(e,n),r.setEnd(e,n)),r.collapse(t),i.removeAllRanges(),i.addRange(r)}n.r(t),n.d(t,"default",(function(){return f}));n(0),n(5);function l(e,t){for(var n=0;n',title:"Checklist"}}},{key:"conversionConfig",get:function(){return{export:function(e){return e.items.map((function(e){return e.text})).join(". ")},import:function(e){return{items:[{text:e,checked:!1}]}}}}}]),u(e,[{key:"render",value:function(){var e=this;return this._elements.wrapper=s("div",[this.CSS.baseBlock,this.CSS.wrapper]),this.data.items||(this.data.items=[{text:"",checked:!1}]),this.data.items.forEach((function(t){var n=e.createChecklistItem(t);e._elements.wrapper.appendChild(n)})),this.readOnly||(this._elements.wrapper.addEventListener("keydown",(function(t){switch(t.keyCode){case 13:e.enterPressed(t);break;case 8:e.backspace(t)}}),!1),this._elements.wrapper.addEventListener("click",(function(t){e.toggleCheckbox(t)}))),this._elements.wrapper}},{key:"rendered",value:function(){var e=this._elements.wrapper.parentNode.parentNode;e.classList.add("col-"+this.col),e.classList.add("pt-"+this.pt),e.classList.add("pr-"+this.pr),e.classList.add("pb-"+this.pb),e.classList.add("pl-"+this.pl)}},{key:"_getCol",value:function(){var e=12,t="col-12",n=this._elements.wrapper.parentNode.parentNode,r=new RegExp(/\bcol-.+?\b/,"g");if(n.className.match(r)){n.classList.forEach((function(e){e.match(r)&&(t=e)}));var i=t.split("-");e=parseInt(i[1])}return e}},{key:"_getPadding",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",t=0,n="p"+e+"-0",r=this._elements.wrapper.parentNode.parentNode,i=new RegExp(/\pl-.+?\b/,"g"),o=new RegExp(/\pr-.+?\b/,"g"),s=new RegExp(/\pt-.+?\b/,"g"),c=new RegExp(/\pb-.+?\b/,"g");if("l"==e){if(r.className.match(i)){r.classList.forEach((function(e){e.match(i)&&(n=e)}));var a=n.split("-");t=parseInt(a[1])}}else if("r"==e){if(r.className.match(o)){r.classList.forEach((function(e){e.match(o)&&(n=e)}));var l=n.split("-");t=parseInt(l[1])}}else if("t"==e){if(r.className.match(s)){r.classList.forEach((function(e){e.match(s)&&(n=e)}));var u=n.split("-");t=parseInt(u[1])}}else if("b"==e&&r.className.match(c)){r.classList.forEach((function(e){e.match(c)&&(n=e)}));var f=n.split("-");t=parseInt(f[1])}return t}},{key:"save",value:function(){var e=this,t=this.items.map((function(t){return{text:c(e.getItemInput(t)),checked:t.classList.contains(e.CSS.itemChecked)}}));return{items:t=t.filter((function(e){return 0!==e.text.trim().length})),col:this._getCol(),pt:this._getPadding("t"),pr:this._getPadding("r"),pb:this._getPadding("b"),pl:this._getPadding("l")}}},{key:"validate",value:function(e){return!!e.items.length}},{key:"toggleCheckbox",value:function(e){var t=e.target.closest(".".concat(this.CSS.item));t.querySelector(".".concat(this.CSS.checkbox)).contains(e.target)&&t.classList.toggle(this.CSS.itemChecked)}},{key:"createChecklistItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=s("div",this.CSS.item),n=s("span",this.CSS.checkbox),r=s("div",this.CSS.textField,{innerHTML:e.text?e.text:"",contentEditable:!this.readOnly});return e.checked&&t.classList.add(this.CSS.itemChecked),t.appendChild(n),t.appendChild(r),t}},{key:"enterPressed",value:function(e){e.preventDefault();var t=this.items,n=document.activeElement.closest(".".concat(this.CSS.item));if(t.indexOf(n)===t.length-1&&0===c(this.getItemInput(n)).length){var r=this.api.blocks.getCurrentBlockIndex();return n.remove(),this.api.blocks.insert(),void this.api.caret.setToBlock(r+1)}var i,s,l=o(),u=(i=l,(s=document.createElement("div")).appendChild(i),s.innerHTML),f=this.createChecklistItem({text:u,checked:!1});this._elements.wrapper.insertBefore(f,n.nextSibling),a(this.getItemInput(f),!0)}},{key:"backspace",value:function(e){var t=e.target.closest(".".concat(this.CSS.item)),n=this.items.indexOf(t),r=this.items[n-1];if(r&&0===window.getSelection().focusOffset){e.preventDefault();var i=o(),s=this.getItemInput(r),c=s.childNodes.length;s.appendChild(i),a(s,void 0,c),t.remove()}}},{key:"getItemInput",value:function(e){return e.querySelector(".".concat(this.CSS.textField))}},{key:"CSS",get:function(){return{baseBlock:this.api.styles.block,wrapper:"cdx-checklist",item:"cdx-checklist__item",itemChecked:"cdx-checklist__item--checked",checkbox:"cdx-checklist__item-checkbox",textField:"cdx-checklist__item-text"}}},{key:"items",get:function(){return Array.from(this._elements.wrapper.querySelectorAll(".".concat(this.CSS.item)))}}]),e}()}]).default})); -------------------------------------------------------------------------------- /delimiter.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Delimiter=e():t.Delimiter=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=0)}([function(t,e,n){function r(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"l",e=0,n="p"+t+"-0",r=this._element.parentNode.parentNode,i=new RegExp(/\pl-.+?\b/,"g"),o=new RegExp(/\pr-.+?\b/,"g"),a=new RegExp(/\pt-.+?\b/,"g"),s=new RegExp(/\pb-.+?\b/,"g");if("l"==t){if(r.className.match(i)){r.classList.forEach((function(t){t.match(i)&&(n=t)}));var c=n.split("-");e=parseInt(c[1])}}else if("r"==t){if(r.className.match(o)){r.classList.forEach((function(t){t.match(o)&&(n=t)}));var l=n.split("-");e=parseInt(l[1])}}else if("t"==t){if(r.className.match(a)){r.classList.forEach((function(t){t.match(a)&&(n=t)}));var u=n.split("-");e=parseInt(u[1])}}else if("b"==t&&r.className.match(s)){r.classList.forEach((function(t){t.match(s)&&(n=t)}));var f=n.split("-");e=parseInt(f[1])}return e}},{key:"save",value:function(t){return this.data.col=this._getCol(),this.data.pt=this._getPadding("t"),this.data.pr=this._getPadding("r"),this.data.pb=this._getPadding("b"),this.data.pl=this._getPadding("l"),this.data}}],[{key:"toolbox",get:function(){return{icon:'',title:"Delimiter"}}}]),t}();t.exports=o},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(4)(r,i);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,'.ce-delimiter {\n line-height: 1.6em;\n width: 100%;\n text-align: center;\n}\n\n.ce-delimiter:before {\n display: inline-block;\n content: "***";\n font-size: 30px;\n line-height: 65px;\n height: 30px;\n letter-spacing: 0.2em;\n}',""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(o).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i=0&&f.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),v(t,e),e}function g(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o=e.transform(t.css)))return function(){};t.css=o}if(e.singleton){var a=u++;n=l||(l=m(e)),r=L.bind(null,n,a,!1),i=L.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),v(t,e),e}(e),r=S.bind(null,n,e),i=function(){b(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=j.bind(null,n),i=function(){b(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=h(t,e);return d(n,e),function(t){for(var r=[],i=0;i=0?r=setTimeout(l,t-c):(r=null,n||(s=e.apply(o,i),o=i=null))}null==t&&(t=100);var c=function(){o=this,i=arguments,a=Date.now();var c=n&&!r;return r||(r=setTimeout(l,t)),c&&(s=e.apply(o,i),o=i=null),s};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(s=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},c}n.debounce=n,e.exports=n},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}},function(e,t,n){var r=n(8);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n?title=0&byline=0",html:'',height:320,width:580},youtube:{regex:/(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,embedUrl:"https://www.youtube.com/embed/<%= remote_id %>",html:'',height:320,width:580,id:function(e){var t=a()(e,2),n=t[0],r=t[1];if(!r&&n)return n;var i={start:"start",end:"end",t:"start",time_continue:"start",list:"list"};return r=r.slice(1).split("&").map((function(e){var t=e.split("="),r=a()(t,2),o=r[0],s=r[1];if(n||"v"!==o){if(i[o])return"".concat(i[o],"=").concat(s)}else n=s})).filter((function(e){return!!e})),n+"?"+r.join("&")}},coub:{regex:/https?:\/\/coub\.com\/view\/([^\/\?\&]+)/,embedUrl:"https://coub.com/embed/<%= remote_id %>",html:'',height:320,width:580},vine:{regex:/https?:\/\/vine\.co\/v\/([^\/\?\&]+)/,embedUrl:"https://vine.co/v/<%= remote_id %>/embed/simple/",html:'',height:320,width:580},imgur:{regex:/https?:\/\/(?:i\.)?imgur\.com.*\/([a-zA-Z0-9]+)(?:\.gifv)?/,embedUrl:"http://imgur.com/<%= remote_id %>/embed",html:'',height:500,width:540},gfycat:{regex:/https?:\/\/gfycat\.com(?:\/detail)?\/([a-zA-Z]+)/,embedUrl:"https://gfycat.com/ifr/<%= remote_id %>",html:"",height:436,width:580},"twitch-channel":{regex:/https?:\/\/www\.twitch\.tv\/([^\/\?\&]*)\/?$/,embedUrl:"https://player.twitch.tv/?channel=<%= remote_id %>",html:'',height:366,width:600},"twitch-video":{regex:/https?:\/\/www\.twitch\.tv\/(?:[^\/\?\&]*\/v|videos)\/([0-9]*)/,embedUrl:"https://player.twitch.tv/?video=v<%= remote_id %>",html:'',height:366,width:600},"yandex-music-album":{regex:/https?:\/\/music\.yandex\.ru\/album\/([0-9]*)\/?$/,embedUrl:"https://music.yandex.ru/iframe/#album/<%= remote_id %>/",html:'',height:400,width:540},"yandex-music-track":{regex:/https?:\/\/music\.yandex\.ru\/album\/([0-9]*)\/track\/([0-9]*)/,embedUrl:"https://music.yandex.ru/iframe/#track/<%= remote_id %>/",html:'',height:100,width:540,id:function(e){return e.join("/")}},"yandex-music-playlist":{regex:/https?:\/\/music\.yandex\.ru\/users\/([^\/\?\&]*)\/playlists\/([0-9]*)/,embedUrl:"https://music.yandex.ru/iframe/#playlist/<%= remote_id %>/show/cover/description/",html:'',height:400,width:540,id:function(e){return e.join("/")}},codepen:{regex:/https?:\/\/codepen\.io\/([^\/\?\&]*)\/pen\/([^\/\?\&]*)/,embedUrl:"https://codepen.io/<%= remote_id %>?height=300&theme-id=0&default-tab=css,result&embed-version=2",html:"",height:300,width:600,id:function(e){return e.join("/embed/")}},instagram:{regex:/https?:\/\/www\.instagram\.com\/p\/([^\/\?\&]+)\/?/,embedUrl:"https://www.instagram.com/p/<%= remote_id %>/embed",html:'',height:505,width:400},twitter:{regex:/^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+)(?:\/.*)?$/,embedUrl:"https://twitframe.com/show?url=https://twitter.com/<%= remote_id %>",html:'',height:300,width:600,id:function(e){return e.join("/status/")}},slideshare:{regex:/(?:http[s]?:\/\/)?(?:www.)?slideshare\.net\/slideshow\/embed_code\/key\/([^\/\?\&]+)/,embedUrl:"https://www.slideshare.net/slideshow/embed_code/key/<%= remote_id %>?title=0&byline=0",html:'',height:"auto",width:"100%"}},h=(n(10),n(4)),f=function(){function e(t){var n=t.data,r=t.api,i=t.readOnly;l()(this,e),this.api=r,this._data={},this.element=null,this.readOnly=i,this.data=n,this.col=n.col?n.col:"12",this.pt=n.pt?n.pt:"0",this.pr=n.pr?n.pr:"0",this.pb=n.pb?n.pb:"0",this.pl=n.pl?n.pl:"0"}return d()(e,[{key:"render",value:function(){var t=this;if(!this.data.service){var n=document.createElement("div");return this.element=n,n}var r=e.services[this.data.service].html,i=document.createElement("div"),o=document.createElement("div"),a=document.createElement("template"),s=this.createPreloader();i.classList.add(this.CSS.baseClass,this.CSS.container,this.CSS.containerLoading),o.classList.add(this.CSS.input,this.CSS.caption),i.appendChild(s),o.contentEditable=!this.readOnly,o.dataset.placeholder="Enter a caption",o.innerHTML=this.data.caption||"",a.innerHTML=r,a.content.firstChild.setAttribute("src",this.data.embed),a.content.firstChild.classList.add(this.CSS.content);var l=this.embedIsReady(i);return i.appendChild(a.content.firstChild),i.appendChild(o),l.then((function(){i.classList.remove(t.CSS.containerLoading)})),this.element=i,i}},{key:"createPreloader",value:function(){var e=document.createElement("preloader"),t=document.createElement("div");return t.textContent=this.data.source,e.classList.add(this.CSS.preloader),t.classList.add(this.CSS.url),e.appendChild(t),e}},{key:"rendered",value:function(){var e=this.element.parentNode.parentNode;e.classList.add("col-"+this.col),e.classList.add("pt-"+this.pt),e.classList.add("pr-"+this.pr),e.classList.add("pb-"+this.pb),e.classList.add("pl-"+this.pl)}},{key:"_getCol",value:function(){var e=12,t="col-12",n=this.element.parentNode.parentNode,r=new RegExp(/\bcol-.+?\b/,"g");if(n.className.match(r)){n.classList.forEach((function(e){e.match(r)&&(t=e)}));var i=t.split("-");e=parseInt(i[1])}return e}},{key:"_getPadding",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",t=0,n="p"+e+"-0",r=this.element.parentNode.parentNode,i=new RegExp(/\pl-.+?\b/,"g"),o=new RegExp(/\pr-.+?\b/,"g"),a=new RegExp(/\pt-.+?\b/,"g"),s=new RegExp(/\pb-.+?\b/,"g");if("l"==e){if(r.className.match(i)){r.classList.forEach((function(e){e.match(i)&&(n=e)}));var l=n.split("-");t=parseInt(l[1])}}else if("r"==e){if(r.className.match(o)){r.classList.forEach((function(e){e.match(o)&&(n=e)}));var c=n.split("-");t=parseInt(c[1])}}else if("t"==e){if(r.className.match(a)){r.classList.forEach((function(e){e.match(a)&&(n=e)}));var d=n.split("-");t=parseInt(d[1])}}else if("b"==e&&r.className.match(s)){r.classList.forEach((function(e){e.match(s)&&(n=e)}));var u=n.split("-");t=parseInt(u[1])}return t}},{key:"save",value:function(){return this.data.col=this._getCol(),this.data.pt=this._getPadding("t"),this.data.pr=this._getPadding("r"),this.data.pb=this._getPadding("b"),this.data.pl=this._getPadding("l"),this.data}},{key:"onPaste",value:function(t){var n=t.detail,r=n.key,i=n.data,o=e.services[r],a=o.regex,s=o.embedUrl,l=o.width,c=o.height,d=o.id,u=void 0===d?function(e){return e.shift()}:d,h=a.exec(i).slice(1),f=s.replace(/<\%\= remote\_id \%\>/g,u(h));this.data={service:r,source:i,embed:f,width:l,height:c}}},{key:"embedIsReady",value:function(e){var t=null;return new Promise((function(n,r){(t=new MutationObserver(Object(h.debounce)(n,450))).observe(e,{childList:!0,subtree:!0})})).then((function(){t.disconnect()}))}},{key:"data",set:function(e){if(!(e instanceof Object))throw Error("Embed Tool data should be object");var t=e.service,n=e.source,r=e.embed,i=e.width,o=e.height,a=e.caption,s=void 0===a?"":a;this._data={service:t||this.data.service,source:n||this.data.source,embed:r||this.data.embed,width:i||this.data.width,height:o||this.data.height,caption:s||this.data.caption||""};var l=this.element;l&&l.parentNode.replaceChild(this.render(),l)},get:function(){if(this.element){var e=this.element.querySelector(".".concat(this.api.styles.input));this._data.caption=e?e.innerHTML:""}return this._data}},{key:"CSS",get:function(){return{baseClass:this.api.styles.block,input:this.api.styles.input,container:"embed-tool",containerLoading:"embed-tool--loading",preloader:"embed-tool__preloader",caption:"embed-tool__caption",url:"embed-tool__url",content:"embed-tool__content"}}}],[{key:"prepare",value:function(t){var n=t.config,r=(void 0===n?{}:n).services,o=void 0===r?{}:r,s=Object.entries(u),l=Object.entries(o).filter((function(e){var t=a()(e,2),n=(t[0],t[1]);return"boolean"==typeof n&&!0===n})).map((function(e){return a()(e,1)[0]})),c=Object.entries(o).filter((function(e){var t=a()(e,2),n=(t[0],t[1]);return"object"===i()(n)})).filter((function(t){var n=a()(t,2),r=(n[0],n[1]);return e.checkServiceConfig(r)})).map((function(e){var t=a()(e,2),n=t[0],r=t[1];return[n,{regex:r.regex,embedUrl:r.embedUrl,html:r.html,height:r.height,width:r.width,id:r.id}]}));l.length&&(s=s.filter((function(e){var t=a()(e,1)[0];return l.includes(t)}))),s=s.concat(c),e.services=s.reduce((function(e,t){var n=a()(t,2),r=n[0],i=n[1];return r in e?(e[r]=Object.assign({},e[r],i),e):(e[r]=i,e)}),{}),e.patterns=s.reduce((function(e,t){var n=a()(t,2),r=n[0],i=n[1];return e[r]=i.regex,e}),{})}},{key:"checkServiceConfig",value:function(e){var t=e.regex,n=e.embedUrl,r=e.html,i=e.height,o=e.width,a=e.id,s=t&&t instanceof RegExp&&n&&"string"==typeof n&&r&&"string"==typeof r;return s=(s=(s=s&&(void 0===a||a instanceof Function))&&(void 0===i||Number.isFinite(i)))&&(void 0===o||Number.isFinite(o))}},{key:"pasteConfig",get:function(){return{patterns:e.patterns}}},{key:"isReadOnlySupported",get:function(){return!0}}]),e}()}]).default})); -------------------------------------------------------------------------------- /header.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Header=e():t.Header=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=0)}([function(t,e,n){function r(t){return(r="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 a(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"l",e=0,n="p"+t+"-0",r=this._element.parentNode.parentNode,a=new RegExp(/\pl-.+?\b/,"g"),i=new RegExp(/\pr-.+?\b/,"g"),s=new RegExp(/\pt-.+?\b/,"g"),o=new RegExp(/\pb-.+?\b/,"g");if("l"==t){if(r.className.match(a)){r.classList.forEach((function(t){t.match(a)&&(n=t)}));var c=n.split("-");e=parseInt(c[1])}}else if("r"==t){if(r.className.match(i)){r.classList.forEach((function(t){t.match(i)&&(n=t)}));var l=n.split("-");e=parseInt(l[1])}}else if("t"==t){if(r.className.match(s)){r.classList.forEach((function(t){t.match(s)&&(n=t)}));var u=n.split("-");e=parseInt(u[1])}}else if("b"==t&&r.className.match(o)){r.classList.forEach((function(t){t.match(o)&&(n=t)}));var f=n.split("-");e=parseInt(f[1])}return e}},{key:"save",value:function(t){return{text:t.innerHTML,level:this.currentLevel.number,col:this._getCol(),pt:this._getPadding("t"),pr:this._getPadding("r"),pb:this._getPadding("b"),pl:this._getPadding("l")}}},{key:"getTag",value:function(){var t=document.createElement(this.currentLevel.tag);return t.innerHTML=this._data.text||"",t.classList.add(this._CSS.wrapper),t.contentEditable=this.readOnly?"false":"true",t.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),t}},{key:"onPaste",value:function(t){var e=t.detail.data,n=this.defaultLevel.number;switch(e.tagName){case"H1":n=1;break;case"H2":n=2;break;case"H3":n=3;break;case"H4":n=4;break;case"H5":n=5;break;case"H6":n=6}this._settings.levels&&(n=this._settings.levels.reduce((function(t,e){return Math.abs(e-n)'},{number:2,tag:"H2",svg:''},{number:3,tag:"H3",svg:''},{number:4,tag:"H4",svg:''},{number:5,tag:"H5",svg:''},{number:6,tag:"H6",svg:''}];return this._settings.levels?e.filter((function(e){return t._settings.levels.includes(e.number)})):e}}])&&a(e.prototype,i),s&&a(e,s),t}();t.exports=i},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(4)(r,a);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,"/**\n * Plugin styles\n */\n.ce-header {\n padding: 1em 0;\n margin: 0;\n margin-bottom: -0.9em;\n line-height: 1.5em;\n outline: none;\n}\n\n.ce-header p,\n.ce-header div{\n padding: 0 !important;\n margin: 0 !important;\n}\n\n/**\n * Styles for Plugin icon in Toolbar\n */\n.ce-header__icon {}\n\n.ce-header[contentEditable=true][data-placeholder]::before{\n position: absolute;\n content: attr(data-placeholder);\n color: #707684;\n font-weight: normal;\n display: none;\n cursor: text;\n}\n\n.ce-header[contentEditable=true][data-placeholder]:empty::before {\n display: block;\n}\n\n.ce-header[contentEditable=true][data-placeholder]:empty:focus::before {\n display: none;\n}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var a=(s=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([a]).join("\n")}var s;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},a=0;a=0&&f.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),v(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,a,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var s=u++;n=l||(l=m(e)),r=L.bind(null,n,s,!1),a=L.bind(null,n,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),v(t,e),e}(e),r=H.bind(null,n,e),a=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=_.bind(null,n),a=function(){g(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else a()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return h(n,e),function(t){for(var r=[],a=0;a0&&void 0!==arguments[0]?arguments[0]:{};if(t.url&&"string"!=typeof t.url)throw new Error("Url must be a string");if(t.url=t.url||"",t.method&&"string"!=typeof t.method)throw new Error("`method` must be a string or null");if(t.method=t.method?t.method.toUpperCase():"GET",t.headers&&"object"!==r(t.headers))throw new Error("`headers` must be an object or null");if(t.headers=t.headers||{},t.type&&("string"!=typeof t.type||!Object.values(o).includes(t.type)))throw new Error("`type` must be taken from module's «contentType» library");if(t.progress&&"function"!=typeof t.progress)throw new Error("`progress` must be a function or null");if(t.progress=t.progress||function(t){},t.beforeSend=t.beforeSend||function(t){},t.ratio&&"number"!=typeof t.ratio)throw new Error("`ratio` must be a number");if(t.ratio<0||t.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(t.ratio=t.ratio||90,t.accept&&"string"!=typeof t.accept)throw new Error("`accept` must be a string with a list of allowed mime-types");if(t.accept=t.accept||"*/*",t.multiple&&"boolean"!=typeof t.multiple)throw new Error("`multiple` must be a true or false");if(t.multiple=t.multiple||!1,t.fieldName&&"string"!=typeof t.fieldName)throw new Error("`fieldName` must be a string");return t.fieldName=t.fieldName||"files",t},c=function(t){switch(t.method){case"GET":var e=u(t.data,o.URLENCODED);delete t.data,t.url=/\?/.test(t.url)?t.url+"&"+e:t.url+"?"+e;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var n=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).type||o.JSON}(t);(f.isFormData(t.data)||f.isFormElement(t.data))&&(n=o.FORM),t.data=u(t.data,n),n!==d.contentType.FORM&&(t.headers["content-type"]=n)}return t},u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case o.URLENCODED:return f.urlEncode(t);case o.JSON:return f.jsonEncode(t);case o.FORM:return f.formEncode(t);default:return t}},l=function(t){return t>=200&&t<300},{contentType:o={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:i,get:function(t){return t.method="GET",i(t)},post:a,transport:function(t){return t=s(t),f.selectFiles(t).then((function(e){for(var n=new FormData,r=0;r=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(6),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,o,i,a,s,c=1,u={},l=!1,f=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){h(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&h(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}):t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){h(t.data)},r=function(t){i.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):r=function(t){setTimeout(h,0,t)},d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n HTMLElement")}},{key:"isObject",value:function(t){return"[object Object]"===Object.prototype.toString.call(t)}},{key:"isFormData",value:function(t){return t instanceof FormData}},{key:"isFormElement",value:function(t){return t instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(e,n){var r=document.createElement("INPUT");r.type="file",t.multiple&&r.setAttribute("multiple","multiple"),t.accept&&r.setAttribute("accept",t.accept),r.style.display="none",document.body.appendChild(r),r.addEventListener("change",(function(t){var n=t.target.files;e(n),document.body.removeChild(r)}),!1),r.click()}))}},{key:"parseHeaders",value:function(t){var e=t.trim().split(/[\r\n]+/),n={};return e.forEach((function(t){var e=t.split(": "),r=e.shift(),o=e.join(": ");r&&(n[r]=o)})),n}}])&&r(e,n),t}()},function(t,e){var n=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},r=function(t,e,o,i){return e=e||null,o=o||"&",i=i||null,t?function(t){for(var e=new Array,n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){var r=n(16),o=n(17);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[t.i,o,""]]);var i={insert:"head",singleton:!1};r(o,i);t.exports=o.locals||{}},function(t,e,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),a=[];function s(t){for(var e=-1,n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);Array.isArray(n)?(e=o.classList).add.apply(e,d()(n)):n&&o.classList.add(n);for(var i in r)o[i]=r[i];return o},v=n(9),y=n.n(v),b=n(10),w=n.n(b),_=n(11),E=n.n(_),x=function(){function t(e){var n=e.api,r=e.actions,o=e.onChange;c()(this,t),this.api=n,this.actions=r,this.onChange=o,this.buttons=[]}return l()(t,[{key:"render",value:function(e){var n=this,r=g("div",this.CSS.wrapper);return this.buttons=[],t.tunes.concat(this.actions).forEach((function(t){var o=n.api.i18n.t(t.title),i=g("div",[n.CSS.buttonBase,n.CSS.button],{innerHTML:t.icon,title:o});i.addEventListener("click",(function(){n.tuneClicked(t.name,t.action)})),i.dataset.tune=t.name,i.classList.toggle(n.CSS.buttonActive,e[t.name]),n.buttons.push(i),n.api.tooltip.onHover(i,o,{placement:"top"}),r.appendChild(i)})),r}},{key:"tuneClicked",value:function(t,e){if("function"==typeof e&&!e(t))return!1;var n=this.buttons.find((function(e){return e.dataset.tune===t}));n.classList.toggle(this.CSS.buttonActive,!n.classList.contains(this.CSS.buttonActive)),this.onChange(t)}},{key:"CSS",get:function(){return{wrapper:"",buttonBase:this.api.styles.settingsButton,button:"image-tool__tune",buttonActive:this.api.styles.settingsButtonActive}}}],[{key:"tunes",get:function(){return[{name:"withBorder",icon:w.a,title:"With border"},{name:"stretched",icon:E.a,title:"Stretch image"},{name:"withBackground",icon:y.a,title:"With background"}]}}]),t}(),S=n(12),k=n.n(S),T=n(13),L=n.n(T),O=n(2),j=n.n(O),C=function(){function t(e){var n=e.config,r=e.onUpload,o=e.onError;c()(this,t),this.config=n,this.onUpload=r,this.onError=o}return l()(t,[{key:"uploadSelectedFile",value:function(t){var e=this,n=t.onPreview,r=function(t){var e=new FileReader;e.readAsDataURL(t),e.onload=function(t){n(t.target.result)}};(this.config.uploader&&"function"==typeof this.config.uploader.uploadByFile?j.a.selectFiles({accept:this.config.types}).then((function(t){r(t[0]);var n=e.config.uploader.uploadByFile(t[0]);return P(n)||console.warn("Custom uploader method uploadByFile should return a Promise"),n})):j.a.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types,headers:this.config.additionalRequestHeaders,beforeSend:function(t){r(t[0])},fieldName:this.config.field}).then((function(t){return t.body}))).then((function(t){e.onUpload(t)})).catch((function(t){e.onError(t)}))}},{key:"uploadByUrl",value:function(t){var e,n=this;this.config.uploader&&"function"==typeof this.config.uploader.uploadByUrl?P(e=this.config.uploader.uploadByUrl(t))||console.warn("Custom uploader method uploadByUrl should return a Promise"):e=j.a.post({url:this.config.endpoints.byUrl,data:Object.assign({url:t},this.config.additionalRequestData),type:j.a.contentType.JSON,headers:this.config.additionalRequestHeaders}).then((function(t){return t.body})),e.then((function(t){n.onUpload(t)})).catch((function(t){n.onError(t)}))}},{key:"uploadByFile",value:function(t,e){var n,r=this,o=e.onPreview,i=new FileReader;if(i.readAsDataURL(t),i.onload=function(t){o(t.target.result)},this.config.uploader&&"function"==typeof this.config.uploader.uploadByFile)P(n=this.config.uploader.uploadByFile(t))||console.warn("Custom uploader method uploadByFile should return a Promise");else{var a=new FormData;a.append(this.config.field,t),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEach((function(t){var e=L()(t,2),n=e[0],r=e[1];a.append(n,r)})),n=j.a.post({url:this.config.endpoints.byFile,data:a,type:j.a.contentType.JSON,headers:this.config.additionalRequestHeaders}).then((function(t){return t.body}))}n.then((function(t){r.onUpload(t)})).catch((function(t){r.onError(t)}))}}]),t}();function P(t){return Promise.resolve(t)===t} 2 | /** 3 | * Image Tool for the Editor.js 4 | * 5 | * @author CodeX 6 | * @license MIT 7 | * @see {@link https://github.com/editor-js/image} 8 | * 9 | * To developers. 10 | * To simplify Tool structure, we split it to 4 parts: 11 | * 1) index.js — main Tool's interface, public API and methods for working with data 12 | * 2) uploader.js — module that has methods for sending files via AJAX: from device, by URL or File pasting 13 | * 3) ui.js — module for UI manipulations: render, showing preloader, etc 14 | * 4) tunes.js — working with Block Tunes: render buttons, handle clicks 15 | * 16 | * For debug purposes there is a testing server 17 | * that can save uploaded files and return a Response {@link UploadResponseFormat} 18 | * 19 | * $ node dev/server.js 20 | * 21 | * It will expose 8008 port, so you can pass http://localhost:8008 with the Tools config: 22 | * 23 | * image: { 24 | * class: ImageTool, 25 | * config: { 26 | * endpoints: { 27 | * byFile: 'http://localhost:8008/uploadFile', 28 | * byUrl: 'http://localhost:8008/fetchUrl', 29 | * } 30 | * }, 31 | * }, 32 | */var F=function(){function t(e){var n=this,r=e.data,o=e.config,i=e.api,a=e.readOnly;c()(this,t),this.api=i,this.readOnly=a,this.config={endpoints:o.endpoints||"",additionalRequestData:o.additionalRequestData||{},additionalRequestHeaders:o.additionalRequestHeaders||{},field:o.field||"image",types:o.types||"image/*",captionPlaceholder:this.api.i18n.t(o.captionPlaceholder||"Caption"),buttonContent:o.buttonContent||"",uploader:o.uploader||void 0,actions:o.actions||[]},this.uploader=new C({config:this.config,onUpload:function(t){return n.onUpload(t)},onError:function(t){return n.uploadingFailed(t)}}),this.ui=new m({api:i,config:this.config,onSelectFile:function(){n.uploader.uploadSelectedFile({onPreview:function(t){n.ui.showPreloader(t)}})},readOnly:a}),this.tunes=new x({api:i,actions:this.config.actions,onChange:function(t){return n.tuneToggled(t)}}),this._data={},this.data=r,this.data.col=r.col?r.col:"12",this.data.pt=r.pt?r.pt:"0",this.data.pr=r.pr?r.pr:"0",this.data.pb=r.pb?r.pb:"0",this.data.pl=r.pl?r.pl:"0"}var e;return l()(t,null,[{key:"isReadOnlySupported",get:function(){return!0}},{key:"toolbox",get:function(){return{icon:k.a,title:"Image"}}}]),l()(t,[{key:"render",value:function(){return this.ui.render(this.data)}},{key:"rendered",value:function(){var t=this.ui.nodes.wrapper.parentNode.parentNode;t.classList.add("col-"+this.data.col),t.classList.add("pt-"+this.data.pt),t.classList.add("pr-"+this.data.pr),t.classList.add("pb-"+this.data.pb),t.classList.add("pl-"+this.data.pl)}},{key:"_getCol",value:function(){var t=12,e="col-12",n=this.ui.nodes.wrapper.parentNode.parentNode,r=new RegExp(/\bcol-.+?\b/,"g");if(n.className.match(r)){n.classList.forEach((function(t){t.match(r)&&(e=t)}));var o=e.split("-");t=parseInt(o[1])}return t}},{key:"_getPadding",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",e=0,n="p"+t+"-0",r=this.ui.nodes.wrapper.parentNode.parentNode,o=new RegExp(/\pl-.+?\b/,"g"),i=new RegExp(/\pr-.+?\b/,"g"),a=new RegExp(/\pt-.+?\b/,"g"),s=new RegExp(/\pb-.+?\b/,"g");if("l"==t){if(r.className.match(o)){r.classList.forEach((function(t){t.match(o)&&(n=t)}));var c=n.split("-");e=parseInt(c[1])}}else if("r"==t){if(r.className.match(i)){r.classList.forEach((function(t){t.match(i)&&(n=t)}));var u=n.split("-");e=parseInt(u[1])}}else if("t"==t){if(r.className.match(a)){r.classList.forEach((function(t){t.match(a)&&(n=t)}));var l=n.split("-");e=parseInt(l[1])}}else if("b"==t&&r.className.match(s)){r.classList.forEach((function(t){t.match(s)&&(n=t)}));var f=n.split("-");e=parseInt(f[1])}return e}},{key:"save",value:function(){var t=this.ui.nodes.caption;return this._data.caption=t.innerHTML,this.data.col=this._getCol(),this.data.pt=this._getPadding("t"),this.data.pr=this._getPadding("r"),this.data.pb=this._getPadding("b"),this.data.pl=this._getPadding("l"),this.data}},{key:"renderSettings",value:function(){return this.tunes.render(this.data)}},{key:"appendCallback",value:function(){this.ui.nodes.fileButton.click()}},{key:"onPaste",value:(e=a()(o.a.mark((function t(e){var n,r,i,a,s;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=e.type,t.next="tag"===t.t0?3:"pattern"===t.t0?15:"file"===t.t0?18:21;break;case 3:if(n=e.detail.data,!/^blob:/.test(n.src)){t.next=13;break}return t.next=7,fetch(n.src);case 7:return r=t.sent,t.next=10,r.blob();case 10:return i=t.sent,this.uploadFile(i),t.abrupt("break",21);case 13:return this.uploadUrl(n.src),t.abrupt("break",21);case 15:return a=e.detail.data,this.uploadUrl(a),t.abrupt("break",21);case 18:return s=e.detail.file,this.uploadFile(s),t.abrupt("break",21);case 21:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"onUpload",value:function(t){t.success&&t.file?this.image=t.file:this.uploadingFailed("incorrect response: "+JSON.stringify(t))}},{key:"uploadingFailed",value:function(t){console.log("Image Tool: uploading failed because of",t),this.api.notifier.show({message:this.api.i18n.t("Couldn’t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}},{key:"tuneToggled",value:function(t){this.setTune(t,!this._data[t])}},{key:"setTune",value:function(t,e){var n=this;this._data[t]=e,this.ui.applyTune(t,e),"stretched"===t&&Promise.resolve().then((function(){var t=n.api.blocks.getCurrentBlockIndex();n.api.blocks.stretchBlock(t,e)})).catch((function(t){console.error(t)}))}},{key:"uploadFile",value:function(t){var e=this;this.uploader.uploadByFile(t,{onPreview:function(t){e.ui.showPreloader(t)}})}},{key:"uploadUrl",value:function(t){this.ui.showPreloader(t),this.uploader.uploadByUrl(t)}},{key:"data",set:function(t){var e=this;this.image=t.file,this._data.caption=t.caption||"",this.ui.fillCaption(this._data.caption),x.tunes.forEach((function(n){var r=n.name,o=void 0!==t[r]&&(!0===t[r]||"true"===t[r]);e.setTune(r,o)}))},get:function(){return this._data}},{key:"image",set:function(t){this._data.file=t||{},t&&t.url&&this.ui.fillImage(t.url)}}],[{key:"pasteConfig",get:function(){return{tags:["img"],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png)$/i},files:{mimeTypes:["image/*"]}}}}]),t}()}]).default})); -------------------------------------------------------------------------------- /list.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.List=t():e.List=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){function r(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n ',default:!1},{name:"ordered",title:this.api.i18n.t("Ordered"),icon:'',default:!0}],this._data={style:this.settings.find((function(e){return!0===e.default})).name,items:[]},this.data=n,this.col=n.col?n.col:"12",this.pt=n.pt?n.pt:"0",this.pr=n.pr?n.pr:"0",this.pb=n.pb?n.pb:"0",this.pl=n.pl?n.pl:"0"}return s(e,null,[{key:"isReadOnlySupported",get:function(){return!0}},{key:"enableLineBreaks",get:function(){return!0}},{key:"toolbox",get:function(){return{icon:' ',title:"List"}}}]),s(e,[{key:"render",value:function(){var e=this;return this._elements.wrapper=this.makeMainTag(this._data.style),this._data.items.length?this._data.items.forEach((function(t){e._elements.wrapper.appendChild(e._make("li",e.CSS.item,{innerHTML:t}))})):this._elements.wrapper.appendChild(this._make("li",this.CSS.item)),this.readOnly||this._elements.wrapper.addEventListener("keydown",(function(t){switch(t.keyCode){case 13:e.getOutofList(t);break;case 8:e.backspace(t)}}),!1),this._elements.wrapper}},{key:"rendered",value:function(){var e=this._elements.wrapper.parentNode.parentNode;e.classList.add("col-"+this.col),e.classList.add("pt-"+this.pt),e.classList.add("pr-"+this.pr),e.classList.add("pb-"+this.pb),e.classList.add("pl-"+this.pl)}},{key:"_getCol",value:function(){var e=12,t="col-12",n=this._elements.wrapper.parentNode.parentNode,r=new RegExp(/\bcol-.+?\b/,"g");if(n.className.match(r)){n.classList.forEach((function(e){e.match(r)&&(t=e)}));var i=t.split("-");e=parseInt(i[1])}return e}},{key:"_getPadding",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",t=0,n="p"+e+"-0",r=this._elements.wrapper.parentNode.parentNode,i=new RegExp(/\pl-.+?\b/,"g"),a=new RegExp(/\pr-.+?\b/,"g"),s=new RegExp(/\pt-.+?\b/,"g"),o=new RegExp(/\pb-.+?\b/,"g");if("l"==e){if(r.className.match(i)){r.classList.forEach((function(e){e.match(i)&&(n=e)}));var c=n.split("-");t=parseInt(c[1])}}else if("r"==e){if(r.className.match(a)){r.classList.forEach((function(e){e.match(a)&&(n=e)}));var l=n.split("-");t=parseInt(l[1])}}else if("t"==e){if(r.className.match(s)){r.classList.forEach((function(e){e.match(s)&&(n=e)}));var u=n.split("-");t=parseInt(u[1])}}else if("b"==e&&r.className.match(o)){r.classList.forEach((function(e){e.match(o)&&(n=e)}));var d=n.split("-");t=parseInt(d[1])}return t}},{key:"save",value:function(){return this.data.col=this._getCol(),this.data.pt=this._getPadding("t"),this.data.pr=this._getPadding("r"),this.data.pb=this._getPadding("b"),this.data.pl=this._getPadding("l"),this.data}},{key:"renderSettings",value:function(){var e=this,t=this._make("div",[this.CSS.settingsWrapper],{});return this.settings.forEach((function(n){var r=e._make("div",e.CSS.settingsButton,{innerHTML:n.icon});r.addEventListener("click",(function(){e.toggleTune(n.name);var t=r.parentNode.querySelectorAll("."+e.CSS.settingsButton);Array.from(t).forEach((function(t){return t.classList.remove(e.CSS.settingsButtonActive)})),r.classList.toggle(e.CSS.settingsButtonActive)})),e.api.tooltip.onHover(r,n.title,{placement:"top",hidingDelay:500}),e._data.style===n.name&&r.classList.add(e.CSS.settingsButtonActive),t.appendChild(r)})),t}},{key:"onPaste",value:function(e){var t=e.detail.data;this.data=this.pasteHandler(t)}},{key:"makeMainTag",value:function(e){var t="ordered"===e?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered,n="ordered"===e?"ol":"ul";return this._make(n,[this.CSS.baseBlock,this.CSS.wrapper,t],{contentEditable:!this.readOnly})}},{key:"toggleTune",value:function(e){for(var t=this.makeMainTag(e);this._elements.wrapper.hasChildNodes();)t.appendChild(this._elements.wrapper.firstChild);this._elements.wrapper.replaceWith(t),this._elements.wrapper=t,this._data.style=e}},{key:"_make",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=document.createElement(e);Array.isArray(n)?(t=a.classList).add.apply(t,r(n)):n&&a.classList.add(n);for(var s in i)a[s]=i[s];return a}},{key:"getOutofList",value:function(e){var t=this._elements.wrapper.querySelectorAll("."+this.CSS.item);if(!(t.length<2)){var n=t[t.length-1],r=this.currentItem;r!==n||n.textContent.trim().length||(r.parentElement.removeChild(r),this.api.blocks.insert(void 0,void 0,void 0,void 0,!0),e.preventDefault(),e.stopPropagation())}}},{key:"backspace",value:function(e){var t=this._elements.wrapper.querySelectorAll("."+this.CSS.item),n=t[0];n&&t.length<2&&!n.innerHTML.replace("
"," ").trim()&&e.preventDefault()}},{key:"selectItem",value:function(e){e.preventDefault();var t=window.getSelection(),n=t.anchorNode.parentNode.closest("."+this.CSS.item),r=new Range;r.selectNodeContents(n),t.removeAllRanges(),t.addRange(r)}},{key:"pasteHandler",value:function(e){var t,n=e.tagName;switch(n){case"OL":t="ordered";break;case"UL":case"LI":t="unordered"}var r={style:t,items:[]};if("LI"===n)r.items=[e.innerHTML];else{var i=Array.from(e.querySelectorAll("LI"));r.items=i.map((function(e){return e.innerHTML})).filter((function(e){return!!e.trim()}))}return r}},{key:"CSS",get:function(){return{baseBlock:this.api.styles.block,wrapper:"cdx-list",wrapperOrdered:"cdx-list--ordered",wrapperUnordered:"cdx-list--unordered",item:"cdx-list__item",settingsWrapper:"cdx-list-settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}},{key:"data",set:function(e){e||(e={}),this._data.style=e.style||this.settings.find((function(e){return!0===e.default})).name,this._data.items=e.items||[];var t=this._elements.wrapper;t&&t.parentNode.replaceChild(this.render(),t)},get:function(){this._data.items=[];for(var e=this._elements.wrapper.querySelectorAll(".".concat(this.CSS.item)),t=0;t"," ").trim()&&this._data.items.push(e[t].innerHTML)}return this._data}},{key:"currentItem",get:function(){var e=window.getSelection().anchorNode;return e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentNode),e.closest(".".concat(this.CSS.item))}}],[{key:"conversionConfig",get:function(){return{export:function(e){return e.items.join(". ")},import:function(e){return{items:[e],style:"unordered"}}}}},{key:"sanitize",get:function(){return{style:{},items:{br:!0}}}},{key:"pasteConfig",get:function(){return{tags:["OL","UL","LI"]}}}]),e}();e.exports=o},function(e,t,n){var r=n(2),i=n(3);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var a={insert:"head",singleton:!1};r(i,a);e.exports=i.locals||{}},function(e,t,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function o(e){for(var t=-1,n=0;n 3 | 4 | 5 | -------------------------------------------------------------------------------- /padding.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /paragraph.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Paragraph=t():e.Paragraph=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){function r(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"l",t=0,n="p"+e+"-0",r=this._element.parentNode.parentNode,a=new RegExp(/\pl-.+?\b/,"g"),i=new RegExp(/\pr-.+?\b/,"g"),o=new RegExp(/\pt-.+?\b/,"g"),c=new RegExp(/\pb-.+?\b/,"g");if("l"==e){if(r.className.match(a)){r.classList.forEach((function(e){e.match(a)&&(n=e)}));var s=n.split("-");t=parseInt(s[1])}}else if("r"==e){if(r.className.match(i)){r.classList.forEach((function(e){e.match(i)&&(n=e)}));var l=n.split("-");t=parseInt(l[1])}}else if("t"==e){if(r.className.match(o)){r.classList.forEach((function(e){e.match(o)&&(n=e)}));var u=n.split("-");t=parseInt(u[1])}}else if("b"==e&&r.className.match(c)){r.classList.forEach((function(e){e.match(c)&&(n=e)}));var p=n.split("-");t=parseInt(p[1])}return t}},{key:"save",value:function(e){return{text:e.innerHTML,col:this._getCol(),pt:this._getPadding("t"),pr:this._getPadding("r"),pb:this._getPadding("b"),pl:this._getPadding("l")}}},{key:"onPaste",value:function(e){var t={text:e.detail.data.innerHTML};this.data=t}},{key:"data",get:function(){var e=this._element.innerHTML;return this._data.text=e,this._data},set:function(e){this._data=e||{},this._element.innerHTML=this._data.text||""}}],[{key:"conversionConfig",get:function(){return{export:"text",import:"text"}}},{key:"sanitize",get:function(){return{text:{br:!0}}}},{key:"isReadOnlySupported",get:function(){return!0}},{key:"pasteConfig",get:function(){return{tags:["P"]}}},{key:"toolbox",get:function(){return{icon:n(5).default,title:"Text"}}}]),e}();e.exports=i},function(e,t,n){var r=n(2),a=n(3);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var i={insert:"head",singleton:!1};r(a,i);e.exports=a.locals||{}},function(e,t,n){"use strict";var r,a=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function c(e){for(var t=-1,n=0;n 2 | 3 | 4 | -------------------------------------------------------------------------------- /quote.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Quote=e():t.Quote=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=0)}([function(t,e,n){function r(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n'},{name:"center",icon:''}]}}],[{key:"isReadOnlySupported",get:function(){return!0}},{key:"toolbox",get:function(){return{icon:'',title:"Quote"}}},{key:"contentless",get:function(){return!0}},{key:"enableLineBreaks",get:function(){return!0}},{key:"DEFAULT_QUOTE_PLACEHOLDER",get:function(){return"Enter a quote"}},{key:"DEFAULT_CAPTION_PLACEHOLDER",get:function(){return"Enter a caption"}},{key:"ALIGNMENTS",get:function(){return{left:"left",center:"center"}}},{key:"DEFAULT_ALIGNMENT",get:function(){return t.ALIGNMENTS.left}},{key:"conversionConfig",get:function(){return{import:"text",export:function(t){return t.caption?"".concat(t.text," — ").concat(t.caption):t.text}}}}]),a(t,[{key:"render",value:function(){var t=this._make("blockquote",[this.CSS.baseClass,this.CSS.wrapper]),e=this._make("div",[this.CSS.input,this.CSS.text],{contentEditable:!this.readOnly,innerHTML:this.data.text}),n=this._make("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly,innerHTML:this.data.caption});return e.dataset.placeholder=this.quotePlaceholder,n.dataset.placeholder=this.captionPlaceholder,t.appendChild(e),t.appendChild(n),this._element=t,t}},{key:"rendered",value:function(){var t=this._element.parentNode.parentNode;t.classList.add("col-"+this.data.col),t.classList.add("pt-"+this.data.pt),t.classList.add("pr-"+this.data.pr),t.classList.add("pb-"+this.data.pb),t.classList.add("pl-"+this.data.pl)}},{key:"_getCol",value:function(){var t=12,e="col-12",n=this._element.parentNode.parentNode,r=new RegExp(/\bcol-.+?\b/,"g");if(n.className.match(r)){n.classList.forEach((function(t){t.match(r)&&(e=t)}));var o=e.split("-");t=parseInt(o[1])}return t}},{key:"_getPadding",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",e=0,n="p"+t+"-0",r=this._element.parentNode.parentNode,o=new RegExp(/\pl-.+?\b/,"g"),i=new RegExp(/\pr-.+?\b/,"g"),a=new RegExp(/\pt-.+?\b/,"g"),s=new RegExp(/\pb-.+?\b/,"g");if("l"==t){if(r.className.match(o)){r.classList.forEach((function(t){t.match(o)&&(n=t)}));var c=n.split("-");e=parseInt(c[1])}}else if("r"==t){if(r.className.match(i)){r.classList.forEach((function(t){t.match(i)&&(n=t)}));var l=n.split("-");e=parseInt(l[1])}}else if("t"==t){if(r.className.match(a)){r.classList.forEach((function(t){t.match(a)&&(n=t)}));var u=n.split("-");e=parseInt(u[1])}}else if("b"==t&&r.className.match(s)){r.classList.forEach((function(t){t.match(s)&&(n=t)}));var f=n.split("-");e=parseInt(f[1])}return e}},{key:"save",value:function(t){var e=t.querySelector(".".concat(this.CSS.text)),n=t.querySelector(".".concat(this.CSS.caption));return Object.assign(this.data,{text:e.innerHTML,caption:n.innerHTML,col:this._getCol(),pt:this._getPadding("t"),pr:this._getPadding("r"),pb:this._getPadding("b"),pl:this._getPadding("l")})}},{key:"renderSettings",value:function(){var t=this,e=this._make("div",[this.CSS.settingsWrapper],{});return this.settings.map((function(n){var r,o=t._make("div",t.CSS.settingsButton,{innerHTML:n.icon,title:"".concat((r=n.name,r[0].toUpperCase()+r.substr(1))," alignment")});return o.classList.toggle(t.CSS.settingsButtonActive,n.name===t.data.alignment),e.appendChild(o),o})).forEach((function(e,n,r){e.addEventListener("click",(function(){t._toggleTune(t.settings[n].name),r.forEach((function(e,n){var r=t.settings[n].name;e.classList.toggle(t.CSS.settingsButtonActive,r===t.data.alignment)}))}))})),e}},{key:"_toggleTune",value:function(t){this.data.alignment=t}},{key:"_make",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);Array.isArray(n)?(e=i.classList).add.apply(e,r(n)):n&&i.classList.add(n);for(var a in o)i[a]=o[a];return i}}],[{key:"sanitize",get:function(){return{text:{br:!0},caption:{br:!0},alignment:{}}}}]),t}();t.exports=s},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(4)(r,o);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,".cdx-quote-icon svg {\n transform: rotate(180deg);\n}\n\n.cdx-quote {\n margin: 0;\n}\n\n.cdx-quote__text {\n min-height: 158px;\n margin-bottom: 10px;\n}\n\n.cdx-quote__caption {}\n\n.cdx-quote [contentEditable=true][data-placeholder]::before{\n position: absolute;\n content: attr(data-placeholder);\n color: #707684;\n font-weight: normal;\n opacity: 0;\n}\n\n.cdx-quote [contentEditable=true][data-placeholder]:empty::before {\n opacity: 1;\n}\n\n.cdx-quote [contentEditable=true][data-placeholder]:empty:focus::before {\n opacity: 0;\n}\n\n\n.cdx-quote-settings {\n display: flex;\n}\n\n.cdx-quote-settings .cdx-settings-button {\n width: 50%;\n}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=(a=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o=0&&f.splice(e,1)}function m(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),b(e,t.attrs),g(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var a=u++;n=l||(l=m(e)),r=L.bind(null,n,a,!1),o=L.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),g(t,e),e}(e),r=E.bind(null,n,e),o=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),r=S.bind(null,n),o=function(){v(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=h(t,e);return d(n,e),function(t){for(var r=[],o=0;o=0&&d.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var n=function(){0;return o.nc}();n&&(t.attrs.nonce=n)}return v(e,t.attrs),b(t,e),e}function v(t,e){Object.keys(e).forEach((function(o){t.setAttribute(o,e[o])}))}function m(t,e){var o,n,i,r;if(e.transform&&t.css){if(!(r="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=r}if(e.singleton){var s=h++;o=c||(c=g(e)),n=x.bind(null,o,s,!1),i=x.bind(null,o,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),b(t,e),e}(e),n=E.bind(null,o,e),i=function(){_(o),o.href&&URL.revokeObjectURL(o.href)}):(o=g(e),n=C.bind(null,o),i=function(){_(o)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var o=f(t,e);return p(o,e),function(t){for(var n=[],i=0;i'},function(t,e,o){const n=o(12).TableConstructor,i=o(11),r="tc-table__inp";t.exports=class{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:i,title:"Table"}}constructor({data:t,config:e,api:o,readOnly:i}){this.api=o,this.readOnly=i,this._tableConstructor=new n(t,e,o,i),this.col=t.col?t.col:"12",this.pt=t.pt?t.pt:"0",this.pr=t.pr?t.pr:"0",this.pb=t.pb?t.pb:"0",this.pl=t.pl?t.pl:"0"}render(){return this._tableConstructor.htmlElement}rendered(){let t=this._tableConstructor.htmlElement.parentNode.parentNode;t.classList.add("col-"+this.col),t.classList.add("pt-"+this.pt),t.classList.add("pr-"+this.pr),t.classList.add("pb-"+this.pb),t.classList.add("pl-"+this.pl)}_getCol(){let t=12,e="col-12",o=this._tableConstructor.htmlElement.parentNode.parentNode;const n=new RegExp(/\bcol-.+?\b/,"g");if(o.className.match(n)){o.classList.forEach(t=>{t.match(n)&&(e=t)});let i=e.split("-");t=parseInt(i[1])}return t}_getPadding(t="l"){let e=0,o="p"+t+"-0",n=this._tableConstructor.htmlElement.parentNode.parentNode;const i=new RegExp(/\pl-.+?\b/,"g"),r=new RegExp(/\pr-.+?\b/,"g"),s=new RegExp(/\pt-.+?\b/,"g"),l=new RegExp(/\pb-.+?\b/,"g");if("l"==t){if(n.className.match(i)){n.classList.forEach(t=>{t.match(i)&&(o=t)});let t=o.split("-");e=parseInt(t[1])}}else if("r"==t){if(n.className.match(r)){n.classList.forEach(t=>{t.match(r)&&(o=t)});let t=o.split("-");e=parseInt(t[1])}}else if("t"==t){if(n.className.match(s)){n.classList.forEach(t=>{t.match(s)&&(o=t)});let t=o.split("-");e=parseInt(t[1])}}else if("b"==t&&n.className.match(l)){n.classList.forEach(t=>{t.match(l)&&(o=t)});let t=o.split("-");e=parseInt(t[1])}return e}save(t){const e=[],o=t.querySelector("table").rows;for(let t=0;tt.querySelector("."+r));i.every(this._isEmpty)||e.push(i.map(t=>t.innerHTML))}return{content:e,col:this._getCol(),pt:this._getPadding("t"),pr:this._getPadding("r"),pb:this._getPadding("b"),pl:this._getPadding("l")}}_isEmpty(t){return!t.textContent.trim()}}},function(t,e,o){var n=o(5);"string"==typeof n&&(n=[[t.i,n,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o(1)(n,i);n.locals&&(t.exports=n.locals)},function(t,e,o){(t.exports=o(0)(!1)).push([t.i,".tc-editor{padding:10px;position:relative;box-sizing:content-box;width:100%;left:-10px}",""])},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var o=e.protocol+"//"+e.host,n=o+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var i,r=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(i=0===r.indexOf("//")?r:0===r.indexOf("/")?o+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(t,e,o){var n=o(8);"string"==typeof n&&(n=[[t.i,n,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o(1)(n,i);n.locals&&(t.exports=n.locals)},function(t,e,o){(t.exports=o(0)(!1)).push([t.i,".tc-toolbar{background:#368be6;}.tc-toolbar--hidden{visibility:hidden}.tc-toolbar--hor{width:100%;height:21px;flex-direction:row;left:0;top:1px}.tc-toolbar--hor,.tc-toolbar--ver{display:flex;align-items:center;position:absolute;z-index:100}.tc-toolbar--ver{height:100%;width:21px;flex-direction:column;top:0;left:-1px}.tc-toolbar__plus{height:21px;width:21px;margin-top:0;}.tc-toolbar__plus--hor{margin-left:-10px}.tc-toolbar__plus--ver{margin-top:-10px}.tc-toolbar__shine-line--hor{min-height:1px;width:100%}.tc-toolbar__shine-line--ver{min-width:1px;height:100%}",""])},function(t,e,o){var n=o(10);"string"==typeof n&&(n=[[t.i,n,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};o(1)(n,i);n.locals&&(t.exports=n.locals)},function(t,e,o){(t.exports=o(0)(!1)).push([t.i,".tc-table{width:100%;height:100%;border-collapse:collapse;table-layout:fixed;}.tc-table__wrap{border:1px solid #dbdbe2;border-radius:3px;position:relative;height:100%;width:100%;box-sizing:border-box}.tc-table__cell{border:1px solid #dbdbe2;padding:0;vertical-align:top}.tc-table__area{padding:10px;height:100%}.tc-table__inp{outline:none;flex-grow:100;min-height:1.5em;height:100%;overflow:hidden}.tc-table tbody tr:first-child td{border-top:none}.tc-table tbody tr:last-child td{border-bottom:none}.tc-table tbody tr td:last-child{border-right:none}.tc-table tbody tr td:first-child{border-left:none}",""])},function(t,e){t.exports=''},function(t,e,o){"use strict";o.r(e),o.d(e,"TableConstructor",(function(){return I}));o(4);function n(t){return!(null==t)}function i(t,e=null,o=null,i=null){const r=document.createElement(t);if(n(e))for(let t=0;t=-1&&e-t.x1<=11&&(n="left"),t.x2-e>=-1&&t.x2-e<=11&&(n="right"),o-t.y1>=-1&&o-t.y1<=11&&(n="top"),t.y2-o>=-1&&t.y2-o<=11&&(n="bottom"),n}o(7);var l=o(2),a=o.n(l);const c="tc-toolbar",h="tc-toolbar--hidden",d="tc-toolbar--hor",u="tc-toolbar__shine-line--hor",p="tc-toolbar--ver",f="tc-toolbar__shine-line--ver",b="tc-toolbar__plus",_="tc-toolbar__plus--hor",g="tc-toolbar__plus--ver",v="tc-table__area";class m{constructor(){this._plusButton=this._generatePlusButton(),this._highlightingLine=this._generateHighlightingLine(),this._toolbar=this._generateToolBar([this._plusButton,this._highlightingLine])}hide(){this._toolbar.classList.add(h)}show(){this._toolbar.classList.remove(h),this._highlightingLine.classList.remove(h)}hideLine(){this._highlightingLine.classList.add(h)}get htmlElement(){return this._toolbar}_generatePlusButton(){const t=i("div",[b]);return t.innerHTML=a.a,t.addEventListener("click",t=>{t.stopPropagation();const e=new CustomEvent("click",{detail:{x:t.pageX,y:t.pageY},bubbles:!0});this._toolbar.dispatchEvent(e)}),t}_generateHighlightingLine(){const t=i("div",[c]);return t.addEventListener("click",t=>{t.stopPropagation();const e=new CustomEvent("click",{bubbles:!0});this._toolbar.dispatchEvent(e)}),t}_generateToolBar(t){const e=i("div",[h],null,t);return e.addEventListener("mouseleave",t=>{this._recalcMousePos(t)}),e}_recalcMousePos(t){this.hide();const e=document.elementFromPoint(t.pageX,t.pageY);if(null!==e&&e.classList.contains(v)){const o=new MouseEvent("mouseover",{clientX:t.pageX,clientY:t.pageY});e.dispatchEvent(o)}}}class y extends m{constructor(){super(),this._toolbar.classList.add(d),this._plusButton.classList.add(_),this._highlightingLine.classList.add(u)}showIn(t){const e=Math.floor(Number.parseInt(window.getComputedStyle(this._toolbar).height)/2);this._toolbar.style.top=t-e+"px",this.show()}}class w extends m{constructor(){super(),this._toolbar.classList.add(p),this._plusButton.classList.add(g),this._highlightingLine.classList.add(f)}showIn(t){const e=Math.floor(Number.parseInt(window.getComputedStyle(this._toolbar).width)/2);this._toolbar.style.left=t-e+"px",this.show()}}o(9);const x="tc-table",C="tc-table__inp",E="tc-table__cell",L="tc-table__wrap",T="tc-table__area";class B{constructor(t){this.readOnly=t,this._numberOfColumns=0,this._numberOfRows=0,this._element=this._createTableWrapper(),this._table=this._element.querySelector("table"),this.readOnly||this._hangEvents()}addColumn(t=-1){this._numberOfColumns++;const e=this._table.rows;for(let o=0;o{this._focusEditField(t)},!0),this._table.addEventListener("blur",t=>{this._blurEditField(t)},!0),this._table.addEventListener("keydown",t=>{this._pressedEnterInEditField(t)}),this._table.addEventListener("click",t=>{this._clickedOnCell(t)}),this._table.addEventListener("mouseover",t=>{this._mouseEnterInDetectArea(t),t.stopPropagation()},!0)}_focusEditField(t){t.target.classList.contains(C)&&(this._selectedCell=t.target.closest("."+E))}_blurEditField(t){t.target.classList.contains(C)&&(this._selectedCell=null)}_pressedEnterInEditField(t){t.target.classList.contains(C)&&(13!==t.keyCode||t.shiftKey||t.preventDefault())}_clickedOnCell(t){if(!t.target.classList.contains(E))return;t.target.querySelector("."+C).focus()}_mouseEnterInDetectArea(t){if(!t.target.classList.contains(T))return;const e=s(r(t.target.closest("TD")),t.pageX,t.pageY);t.target.dispatchEvent(new CustomEvent("mouseInActivatingArea",{detail:{side:e},bubbles:!0}))}}const O="tc-editor",R="tc-toolbar--hor",S="tc-toolbar--ver",A="tc-table__inp";class I{constructor(t,e,o,n){this.readOnly=n,this._table=new B(n);const r=this._resizeTable(t,e);this._fillTable(t,r),this._container=i("div",[O,o.styles.block],null,[this._table.htmlElement]),this._verticalToolBar=new w,this._horizontalToolBar=new y,this._table.htmlElement.appendChild(this._horizontalToolBar.htmlElement),this._table.htmlElement.appendChild(this._verticalToolBar.htmlElement),this._hoveredCell=null,this._activatedToolBar=null,this._hoveredCellSide=null,this._plusButDelay=null,this._toolbarShowDelay=null,this.readOnly||this._hangEvents()}get htmlElement(){return this._container}_fillTable(t,e){if(void 0!==t.content)for(let o=0;o0?s:void 0,c=!isNaN(l)&&l>0?l:void 0,h=i||a||2,d=r||c||2;for(let t=0;t{this._toolbarCalling(t)}),this._container.addEventListener("click",t=>{this._clickToolbar(t)}),this._container.addEventListener("input",()=>{this._hideToolBar()}),this._container.addEventListener("keydown",t=>{this._containerKeydown(t)}),this._container.addEventListener("mouseout",t=>{this._leaveDetectArea(t)}),this._container.addEventListener("mouseover",t=>{this._mouseEnterInDetectArea(t)})}_mouseInActivatingAreaListener(t){this._hoveredCellSide=t.detail.side;const e=r(t.target),o=r(this._table.htmlElement);if(this._hoveredCell=t.target.closest("TD"),null===this._hoveredCell){const t=11;this._hoveredCell=this._container,e.x1+=t,e.y1+=t,e.x2-=t,e.y2-=t}"top"===this._hoveredCellSide&&this._showToolBar(this._horizontalToolBar,e.y1-o.y1-2),"bottom"===this._hoveredCellSide&&this._showToolBar(this._horizontalToolBar,e.y2-o.y1-1),"left"===this._hoveredCellSide&&this._showToolBar(this._verticalToolBar,e.x1-o.x1-2),"right"===this._hoveredCellSide&&this._showToolBar(this._verticalToolBar,e.x2-o.x1-1)}_isToolbar(t){return!(!t.closest("."+R)&&!t.closest("."+S))}_leaveDetectArea(t){this._isToolbar(t.relatedTarget)||(clearTimeout(this._toolbarShowDelay),this._hideToolBar())}_toolbarCalling(t){this._isToolbar(t.target)||(clearTimeout(this._toolbarShowDelay),this._toolbarShowDelay=setTimeout(()=>{this._mouseInActivatingAreaListener(t)},125))}_clickToolbar(t){if(!this._isToolbar(t.target))return;let e;this._activatedToolBar===this._horizontalToolBar?(this._addRow(),e="y"):(this._addColumn(),e="x");if(isNaN(t.detail)&&null!==t.detail){const o=r(this._table.htmlElement);let n;n="x"===e?t.detail.x-o.x1:t.detail.y-o.y1,this._delayAddButtonForMultiClickingNearMouse(n)}else this._hideToolBar()}_containerKeydown(t){13===t.keyCode&&this._containerEnterPressed(t)}_delayAddButtonForMultiClickingNearMouse(t){this._showToolBar(this._activatedToolBar,t),this._activatedToolBar.hideLine(),clearTimeout(this._plusButDelay),this._plusButDelay=setTimeout(()=>{this._hideToolBar()},500)}_getHoveredSideOfContainer(){return this._hoveredCell===this._container?this._isBottomOrRight()?0:-1:1}_isBottomOrRight(){return"bottom"===this._hoveredCellSide||"right"===this._hoveredCellSide}_addRow(){const t=this._hoveredCell.closest("TR");let e=this._getHoveredSideOfContainer();1===e&&(e=t.sectionRowIndex,e+=this._isBottomOrRight()),this._table.addRow(e)}_addColumn(){let t=this._getHoveredSideOfContainer();1===t&&(t=this._hoveredCell.cellIndex,t+=this._isBottomOrRight()),this._table.addColumn(t)}_containerEnterPressed(t){if(null===this._table.selectedCell||t.shiftKey)return;const e=this._table.selectedCell.closest("TR");let o=this._getHoveredSideOfContainer();1===o&&(o=e.sectionRowIndex+1);this._table.addRow(o).cells[0].click()}_mouseEnterInDetectArea(t){let e=s(r(this._container),t.pageX,t.pageY);t.target.dispatchEvent(new CustomEvent("mouseInActivatingArea",{detail:{side:e},bubbles:!0}))}}}])})); --------------------------------------------------------------------------------