From ee74f3c9a01be5d6f176a1a05fbd652c61bbdf70 Mon Sep 17 00:00:00 2001 From: AGiantSquid Date: Mon, 13 Apr 2020 13:49:35 -0700 Subject: [PATCH] run npm run build command on repo to generate minified files --- dist/demo/demo1.js | 43 +++++------- dist/demo/demo1.js.css | 117 +-------------------------------- dist/quill-better-table.css | 117 +-------------------------------- dist/quill-better-table.js | 43 +++++------- dist/quill-better-table.min.js | 2 +- 5 files changed, 39 insertions(+), 283 deletions(-) diff --git a/dist/demo/demo1.js b/dist/demo/demo1.js index 6ef2322..1426158 100644 --- a/dist/demo/demo1.js +++ b/dist/demo/demo1.js @@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ var hotApplyOnUpdate = true; /******/ // eslint-disable-next-line no-unused-vars -/******/ var hotCurrentHash = "b2ee69a9ed01aab8434c"; +/******/ var hotCurrentHash = "7c1a0f2951cfd8773c10"; /******/ var hotRequestTimeout = 10000; /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; @@ -271,7 +271,6 @@ return /******/ (function(modules) { // webpackBootstrap /******/ var chunkId = 0; /******/ // eslint-disable-next-line no-lone-blocks /******/ { -/******/ /*globals chunkId */ /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if ( @@ -869,6 +868,7 @@ module.exports = " 1 && arguments[1] !== undefined ? arguments[1] : []; - let editorWrapper = arguments.length > 2 ? arguments[2] : undefined; + deleteColumns(compareRect, delIndexes = [], editorWrapper) { const [body] = this.descendants(TableBody); if (body == null || body.children.head == null) return; const tableCells = this.descendants(TableCell); @@ -1808,9 +1806,7 @@ class table_TableContainer extends Container { } } - insertColumn(compareRect, colIndex) { - let isRight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - let editorWrapper = arguments.length > 3 ? arguments[3] : undefined; + insertColumn(compareRect, colIndex, isRight = true, editorWrapper) { const [body] = this.descendants(TableBody); const [tableColGroup] = this.descendants(TableColGroup); const tableCols = this.descendants(TableCol); @@ -2122,10 +2118,10 @@ class table_selection_TableSelection { this.dragging = false; this.selectingHandler = this.mouseDownHandler.bind(this); - this.clearSelectionHandler = this.clearSelection.bind(this); + this.clearSelectionHandler = this.clearSelection.bind(this); this.helpLinesInitial(); this.quill.root.addEventListener('mousedown', this.selectingHandler, false); - this.quill.on('text-change', this.clearSelectionHandler ); + this.quill.on('text-change', this.clearSelectionHandler); } helpLinesInitial() { @@ -2267,7 +2263,7 @@ class table_selection_TableSelection { this[direction] = null; }); this.quill.root.removeEventListener('mousedown', this.selectingHandler, false); - this.quill.off('text-change', this.clearSelectionHandler ); + this.quill.off('text-change', this.clearSelectionHandler); return null; } @@ -2540,12 +2536,11 @@ class table_operation_menu_TableOperationMenu { return null; } - menuInitial(_ref) { - let { - table, - left, - top - } = _ref; + menuInitial({ + table, + left, + top + }) { this.domNode = document.createElement('div'); this.domNode.classList.add('qlbt-operation-menu'); css(this.domNode, { @@ -2618,12 +2613,11 @@ class table_operation_menu_TableOperationMenu { return node; } - menuItemCreator(_ref2) { - let { - text, - iconSrc, - handler - } = _ref2; + menuItemCreator({ + text, + iconSrc, + handler + }) { const node = document.createElement('div'); node.classList.add('qlbt-operation-menu-item'); const iconSpan = document.createElement('span'); @@ -2990,8 +2984,7 @@ class quill_better_table_BetterTable extends Module { }); } - getTable() { - let range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.quill.getSelection(); + getTable(range = this.quill.getSelection()) { if (range == null) return [null, null, null, -1]; const [cellLine, offset] = this.quill.getLine(range.index); diff --git a/dist/demo/demo1.js.css b/dist/demo/demo1.js.css index cec18b9..72d9433 100644 --- a/dist/demo/demo1.js.css +++ b/dist/demo/demo1.js.css @@ -1,117 +1,2 @@ -.ql-container .qlbt-selection-line.qlbt-selection-line-left::before { - position: absolute; - left: -2px; - top: -2px; - content: ''; - width: 5px; - height: 5px; - background-color: #0589f3; - border-radius: 5px; } - -.ql-container .qlbt-selection-line.qlbt-selection-line-right::before { - position: absolute; - right: -2px; - bottom: -3px; - content: ''; - width: 5px; - height: 5px; - background-color: #0589f3; - border-radius: 5px; } - -.quill-better-table-wrapper { - overflow-x: auto; } - -table.quill-better-table { - table-layout: fixed; - border-collapse: collapse; } - table.quill-better-table td { - border: 1px solid #000; - padding: 2px 5px; } - -.qlbt-operation-menu { - background-color: #fff; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); - font-size: 14px; - z-index: 100; - overflow: hidden; } - .qlbt-operation-menu .qlbt-operation-menu-dividing { - height: 1px; - background-color: #efefef; } - .qlbt-operation-menu .qlbt-operation-menu-subtitle { - color: #999; - font-size: 14px; - padding: 5px 16px; } - .qlbt-operation-menu .qlbt-operation-color-picker { - display: flex; - align-items: center; - flex-wrap: wrap; - padding: 0 16px 10px; - background-color: #fff; - overflow: hidden; } - .qlbt-operation-menu .qlbt-operation-color-picker .qlbt-operation-color-picker-item { - width: 20px; - height: 20px; - border: 1px solid #595959; - margin-right: 5px; - margin-bottom: 5px; - cursor: pointer; } - .qlbt-operation-menu .qlbt-operation-menu-item { - display: flex; - align-items: center; - padding: 10px 16px; - background-color: #fff; - cursor: pointer; - color: #595959; - overflow: hidden; - text-overflow: ellipsis; } - .qlbt-operation-menu .qlbt-operation-menu-item:hover { - background-color: #efefef; } - .qlbt-operation-menu .qlbt-operation-menu-item .qlbt-operation-menu-icon { - margin-right: 8px; - height: 20px; - width: 20px; - font-size: 0; } - -.qlbt-col-tool { - position: absolute; - display: flex; - align-items: flex-end; - overflow: hidden; - z-index: 99; - height: 16px; } - .qlbt-col-tool .qlbt-col-tool-cell { - position: relative; - background-color: #fff; - border-top: 1px solid #000; - border-right: 1px solid #000; - border-bottom: 1px solid #000; } - .qlbt-col-tool .qlbt-col-tool-cell:first-child { - border-left: 1px solid #000; } - .qlbt-col-tool .qlbt-col-tool-cell-holder { - position: absolute; - right: -1px; - top: 0; - bottom: 0; - z-index: 3; - width: 1px; - background-color: transparent; - cursor: ew-resize; } - .qlbt-col-tool .qlbt-col-tool-cell-holder:hover { - background-color: #0589f3; } - .qlbt-col-tool .qlbt-col-tool-cell-holder::before { - content: ""; - position: absolute; - top: 0; - left: -6px; - display: block; - width: 8px; - height: 100%; } - .qlbt-col-tool .qlbt-col-tool-cell-holder::after { - content: ""; - position: absolute; - top: 0; - right: -6px; - display: block; - width: 8px; - height: 100%; } +.ql-container .qlbt-selection-line.qlbt-selection-line-left::before{position:absolute;left:-2px;top:-2px;content:'';width:5px;height:5px;background-color:#0589f3;border-radius:5px}.ql-container .qlbt-selection-line.qlbt-selection-line-right::before{position:absolute;right:-2px;bottom:-3px;content:'';width:5px;height:5px;background-color:#0589f3;border-radius:5px}.quill-better-table-wrapper{overflow-x:auto}table.quill-better-table{table-layout:fixed;border-collapse:collapse}table.quill-better-table td{border:1px solid #000;padding:2px 5px}.qlbt-operation-menu{background-color:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.15);font-size:14px;z-index:100;overflow:hidden}.qlbt-operation-menu .qlbt-operation-menu-dividing{height:1px;background-color:#efefef}.qlbt-operation-menu .qlbt-operation-menu-subtitle{color:#999;font-size:14px;padding:5px 16px}.qlbt-operation-menu .qlbt-operation-color-picker{display:flex;align-items:center;flex-wrap:wrap;padding:0 16px 10px;background-color:#fff;overflow:hidden}.qlbt-operation-menu .qlbt-operation-color-picker .qlbt-operation-color-picker-item{width:20px;height:20px;border:1px solid #595959;margin-right:5px;margin-bottom:5px;cursor:pointer}.qlbt-operation-menu .qlbt-operation-menu-item{display:flex;align-items:center;padding:10px 16px;background-color:#fff;cursor:pointer;color:#595959;overflow:hidden;text-overflow:ellipsis}.qlbt-operation-menu .qlbt-operation-menu-item:hover{background-color:#efefef}.qlbt-operation-menu .qlbt-operation-menu-item .qlbt-operation-menu-icon{margin-right:8px;height:20px;width:20px;font-size:0}.qlbt-col-tool{position:absolute;display:flex;align-items:flex-end;overflow:hidden;z-index:99;height:16px}.qlbt-col-tool .qlbt-col-tool-cell{position:relative;background-color:#fff;border-top:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000}.qlbt-col-tool .qlbt-col-tool-cell:first-child{border-left:1px solid #000}.qlbt-col-tool .qlbt-col-tool-cell-holder{position:absolute;right:-1px;top:0;bottom:0;z-index:3;width:1px;background-color:transparent;cursor:ew-resize}.qlbt-col-tool .qlbt-col-tool-cell-holder:hover{background-color:#0589f3}.qlbt-col-tool .qlbt-col-tool-cell-holder::before{content:"";position:absolute;top:0;left:-6px;display:block;width:8px;height:100%}.qlbt-col-tool .qlbt-col-tool-cell-holder::after{content:"";position:absolute;top:0;right:-6px;display:block;width:8px;height:100%} diff --git a/dist/quill-better-table.css b/dist/quill-better-table.css index cec18b9..72d9433 100644 --- a/dist/quill-better-table.css +++ b/dist/quill-better-table.css @@ -1,117 +1,2 @@ -.ql-container .qlbt-selection-line.qlbt-selection-line-left::before { - position: absolute; - left: -2px; - top: -2px; - content: ''; - width: 5px; - height: 5px; - background-color: #0589f3; - border-radius: 5px; } - -.ql-container .qlbt-selection-line.qlbt-selection-line-right::before { - position: absolute; - right: -2px; - bottom: -3px; - content: ''; - width: 5px; - height: 5px; - background-color: #0589f3; - border-radius: 5px; } - -.quill-better-table-wrapper { - overflow-x: auto; } - -table.quill-better-table { - table-layout: fixed; - border-collapse: collapse; } - table.quill-better-table td { - border: 1px solid #000; - padding: 2px 5px; } - -.qlbt-operation-menu { - background-color: #fff; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); - font-size: 14px; - z-index: 100; - overflow: hidden; } - .qlbt-operation-menu .qlbt-operation-menu-dividing { - height: 1px; - background-color: #efefef; } - .qlbt-operation-menu .qlbt-operation-menu-subtitle { - color: #999; - font-size: 14px; - padding: 5px 16px; } - .qlbt-operation-menu .qlbt-operation-color-picker { - display: flex; - align-items: center; - flex-wrap: wrap; - padding: 0 16px 10px; - background-color: #fff; - overflow: hidden; } - .qlbt-operation-menu .qlbt-operation-color-picker .qlbt-operation-color-picker-item { - width: 20px; - height: 20px; - border: 1px solid #595959; - margin-right: 5px; - margin-bottom: 5px; - cursor: pointer; } - .qlbt-operation-menu .qlbt-operation-menu-item { - display: flex; - align-items: center; - padding: 10px 16px; - background-color: #fff; - cursor: pointer; - color: #595959; - overflow: hidden; - text-overflow: ellipsis; } - .qlbt-operation-menu .qlbt-operation-menu-item:hover { - background-color: #efefef; } - .qlbt-operation-menu .qlbt-operation-menu-item .qlbt-operation-menu-icon { - margin-right: 8px; - height: 20px; - width: 20px; - font-size: 0; } - -.qlbt-col-tool { - position: absolute; - display: flex; - align-items: flex-end; - overflow: hidden; - z-index: 99; - height: 16px; } - .qlbt-col-tool .qlbt-col-tool-cell { - position: relative; - background-color: #fff; - border-top: 1px solid #000; - border-right: 1px solid #000; - border-bottom: 1px solid #000; } - .qlbt-col-tool .qlbt-col-tool-cell:first-child { - border-left: 1px solid #000; } - .qlbt-col-tool .qlbt-col-tool-cell-holder { - position: absolute; - right: -1px; - top: 0; - bottom: 0; - z-index: 3; - width: 1px; - background-color: transparent; - cursor: ew-resize; } - .qlbt-col-tool .qlbt-col-tool-cell-holder:hover { - background-color: #0589f3; } - .qlbt-col-tool .qlbt-col-tool-cell-holder::before { - content: ""; - position: absolute; - top: 0; - left: -6px; - display: block; - width: 8px; - height: 100%; } - .qlbt-col-tool .qlbt-col-tool-cell-holder::after { - content: ""; - position: absolute; - top: 0; - right: -6px; - display: block; - width: 8px; - height: 100%; } +.ql-container .qlbt-selection-line.qlbt-selection-line-left::before{position:absolute;left:-2px;top:-2px;content:'';width:5px;height:5px;background-color:#0589f3;border-radius:5px}.ql-container .qlbt-selection-line.qlbt-selection-line-right::before{position:absolute;right:-2px;bottom:-3px;content:'';width:5px;height:5px;background-color:#0589f3;border-radius:5px}.quill-better-table-wrapper{overflow-x:auto}table.quill-better-table{table-layout:fixed;border-collapse:collapse}table.quill-better-table td{border:1px solid #000;padding:2px 5px}.qlbt-operation-menu{background-color:#fff;box-shadow:0 2px 8px rgba(0,0,0,0.15);font-size:14px;z-index:100;overflow:hidden}.qlbt-operation-menu .qlbt-operation-menu-dividing{height:1px;background-color:#efefef}.qlbt-operation-menu .qlbt-operation-menu-subtitle{color:#999;font-size:14px;padding:5px 16px}.qlbt-operation-menu .qlbt-operation-color-picker{display:flex;align-items:center;flex-wrap:wrap;padding:0 16px 10px;background-color:#fff;overflow:hidden}.qlbt-operation-menu .qlbt-operation-color-picker .qlbt-operation-color-picker-item{width:20px;height:20px;border:1px solid #595959;margin-right:5px;margin-bottom:5px;cursor:pointer}.qlbt-operation-menu .qlbt-operation-menu-item{display:flex;align-items:center;padding:10px 16px;background-color:#fff;cursor:pointer;color:#595959;overflow:hidden;text-overflow:ellipsis}.qlbt-operation-menu .qlbt-operation-menu-item:hover{background-color:#efefef}.qlbt-operation-menu .qlbt-operation-menu-item .qlbt-operation-menu-icon{margin-right:8px;height:20px;width:20px;font-size:0}.qlbt-col-tool{position:absolute;display:flex;align-items:flex-end;overflow:hidden;z-index:99;height:16px}.qlbt-col-tool .qlbt-col-tool-cell{position:relative;background-color:#fff;border-top:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000}.qlbt-col-tool .qlbt-col-tool-cell:first-child{border-left:1px solid #000}.qlbt-col-tool .qlbt-col-tool-cell-holder{position:absolute;right:-1px;top:0;bottom:0;z-index:3;width:1px;background-color:transparent;cursor:ew-resize}.qlbt-col-tool .qlbt-col-tool-cell-holder:hover{background-color:#0589f3}.qlbt-col-tool .qlbt-col-tool-cell-holder::before{content:"";position:absolute;top:0;left:-6px;display:block;width:8px;height:100%}.qlbt-col-tool .qlbt-col-tool-cell-holder::after{content:"";position:absolute;top:0;right:-6px;display:block;width:8px;height:100%} diff --git a/dist/quill-better-table.js b/dist/quill-better-table.js index 8ecee98..a094c50 100644 --- a/dist/quill-better-table.js +++ b/dist/quill-better-table.js @@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ var hotApplyOnUpdate = true; /******/ // eslint-disable-next-line no-unused-vars -/******/ var hotCurrentHash = "b2ee69a9ed01aab8434c"; +/******/ var hotCurrentHash = "7c1a0f2951cfd8773c10"; /******/ var hotRequestTimeout = 10000; /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; @@ -271,7 +271,6 @@ return /******/ (function(modules) { // webpackBootstrap /******/ var chunkId = 2; /******/ // eslint-disable-next-line no-lone-blocks /******/ { -/******/ /*globals chunkId */ /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if ( @@ -869,6 +868,7 @@ module.exports = " 1 && arguments[1] !== undefined ? arguments[1] : []; - let editorWrapper = arguments.length > 2 ? arguments[2] : undefined; + deleteColumns(compareRect, delIndexes = [], editorWrapper) { const [body] = this.descendants(TableBody); if (body == null || body.children.head == null) return; const tableCells = this.descendants(TableCell); @@ -1808,9 +1806,7 @@ class table_TableContainer extends Container { } } - insertColumn(compareRect, colIndex) { - let isRight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - let editorWrapper = arguments.length > 3 ? arguments[3] : undefined; + insertColumn(compareRect, colIndex, isRight = true, editorWrapper) { const [body] = this.descendants(TableBody); const [tableColGroup] = this.descendants(TableColGroup); const tableCols = this.descendants(TableCol); @@ -2122,10 +2118,10 @@ class table_selection_TableSelection { this.dragging = false; this.selectingHandler = this.mouseDownHandler.bind(this); - this.clearSelectionHandler = this.clearSelection.bind(this); + this.clearSelectionHandler = this.clearSelection.bind(this); this.helpLinesInitial(); this.quill.root.addEventListener('mousedown', this.selectingHandler, false); - this.quill.on('text-change', this.clearSelectionHandler ); + this.quill.on('text-change', this.clearSelectionHandler); } helpLinesInitial() { @@ -2267,7 +2263,7 @@ class table_selection_TableSelection { this[direction] = null; }); this.quill.root.removeEventListener('mousedown', this.selectingHandler, false); - this.quill.off('text-change', this.clearSelectionHandler ); + this.quill.off('text-change', this.clearSelectionHandler); return null; } @@ -2540,12 +2536,11 @@ class table_operation_menu_TableOperationMenu { return null; } - menuInitial(_ref) { - let { - table, - left, - top - } = _ref; + menuInitial({ + table, + left, + top + }) { this.domNode = document.createElement('div'); this.domNode.classList.add('qlbt-operation-menu'); css(this.domNode, { @@ -2618,12 +2613,11 @@ class table_operation_menu_TableOperationMenu { return node; } - menuItemCreator(_ref2) { - let { - text, - iconSrc, - handler - } = _ref2; + menuItemCreator({ + text, + iconSrc, + handler + }) { const node = document.createElement('div'); node.classList.add('qlbt-operation-menu-item'); const iconSpan = document.createElement('span'); @@ -2990,8 +2984,7 @@ class quill_better_table_BetterTable extends Module { }); } - getTable() { - let range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.quill.getSelection(); + getTable(range = this.quill.getSelection()) { if (range == null) return [null, null, null, -1]; const [cellLine, offset] = this.quill.getLine(range.index); diff --git a/dist/quill-better-table.min.js b/dist/quill-better-table.min.js index 8e5b2b7..d6b0db0 100644 --- a/dist/quill-better-table.min.js +++ b/dist/quill-better-table.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("quill")):"function"==typeof define&&define.amd?define(["quill"],t):"object"==typeof exports?exports.quillBetterTable=t(require("quill")):e.quillBetterTable=t(e.Quill)}(window,function(e){return function(e){var t=window.webpackHotUpdatequillBetterTable;window.webpackHotUpdatequillBetterTable=function(e,o){!function(e,t){if(!x[e]||!y[e])return;for(var o in y[e]=!1,t)Object.prototype.hasOwnProperty.call(t,o)&&(m[o]=t[o]);0==--g&&0===w&&A()}(e,o),t&&t(e,o)};var o,n=!0,r="9a5e171e746fb1aa8a0f",l=1e4,i={},s=[],a=[];function c(e){var t=E[e];if(!t)return T;var n=function(n){return t.hot.active?(E[n]?-1===E[n].parents.indexOf(e)&&E[n].parents.push(e):(s=[e],o=n),-1===t.children.indexOf(n)&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),s=[]),T(n)},r=function(e){return{configurable:!0,enumerable:!0,get:function(){return T[e]},set:function(t){T[e]=t}}};for(var l in T)Object.prototype.hasOwnProperty.call(T,l)&&"e"!==l&&"t"!==l&&Object.defineProperty(n,l,r(l));return n.e=function(e){return"ready"===u&&p("prepare"),w++,T.e(e).then(t,function(e){throw t(),e});function t(){w--,"prepare"===u&&(v[e]||q(e),0===w&&0===g&&A())}},n.t=function(e,t){return 1&t&&(e=n(e)),T.t(e,-2&t)},n}function d(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:o!==e,active:!0,accept:function(e,o){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var n=0;n=0&&t._disposeHandlers.splice(o,1)},check:C,apply:S,status:function(e){if(!e)return u;h.push(e)},addStatusHandler:function(e){h.push(e)},removeStatusHandler:function(e){var t=h.indexOf(e);t>=0&&h.splice(t,1)},data:i[e]};return o=void 0,t}var h=[],u="idle";function p(e){u=e;for(var t=0;t0;){var r=n.pop(),l=r.id,i=r.chain;if((a=E[l])&&!a.hot._selfAccepted){if(a.hot._selfDeclined)return{type:"self-declined",chain:i,moduleId:l};if(a.hot._main)return{type:"unaccepted",chain:i,moduleId:l};for(var s=0;s ")),C.type){case"self-declined":t.onDeclined&&t.onDeclined(C),t.ignoreDeclined||(q=new Error("Aborted because of self decline: "+C.moduleId+H));break;case"declined":t.onDeclined&&t.onDeclined(C),t.ignoreDeclined||(q=new Error("Aborted because of declined dependency: "+C.moduleId+" in "+C.parentId+H));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(C),t.ignoreUnaccepted||(q=new Error("Aborted because "+c+" is not accepted"+H));break;case"accepted":t.onAccepted&&t.onAccepted(C),A=!0;break;case"disposed":t.onDisposed&&t.onDisposed(C),S=!0;break;default:throw new Error("Unexception type "+C.type)}if(q)return p("abort"),Promise.reject(q);if(A)for(c in w[c]=m[c],h(g,C.outdatedModules),C.outdatedDependencies)Object.prototype.hasOwnProperty.call(C.outdatedDependencies,c)&&(f[c]||(f[c]=[]),h(f[c],C.outdatedDependencies[c]));S&&(h(g,[C.moduleId]),w[c]=v)}var M,B=[];for(n=0;n0;)if(c=L.pop(),a=E[c]){var z={},k=a.hot._disposeHandlers;for(l=0;l=0&&I.parents.splice(M,1))}}for(c in f)if(Object.prototype.hasOwnProperty.call(f,c)&&(a=E[c]))for(R=f[c],l=0;l=0&&a.children.splice(M,1);for(c in p("apply"),r=b,w)Object.prototype.hasOwnProperty.call(w,c)&&(e[c]=w[c]);var D=null;for(c in f)if(Object.prototype.hasOwnProperty.call(f,c)&&(a=E[c])){R=f[c];var j=[];for(n=0;n'},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t,o){e.exports=o(11)},function(e,t,o){"use strict";o.r(t);var n=o(0),r=o.n(n);function l(e,t){if("object"==typeof t)for(let o in t)e.style[o]=t[o]}function i(e,t){let o=t.getBoundingClientRect();return{x:e.x-o.x-t.scrollLeft,y:e.y-o.y-t.scrollTop,x1:e.x-o.x-t.scrollLeft+e.width,y1:e.y-o.y-t.scrollTop+e.height,width:e.width,height:e.height}}function s(e,t){return e&&Object.keys(e).reduce((o,n)=>t.includes(n)?o:Object.assign({},o,{[n]:e[n]}),{})}function a(e){let t;if(null==(t=e.path||e.composedPath&&e.composedPath())&&e.target){t=[];let o=e.target;for(t.push(o);o&&o.parentNode;)o=o.parentNode,t.push(o)}return t}const c=12,d=12,h=50,u="#35A7ED";class p{constructor(e,t,o){if(!e)return null;this.table=e,this.quill=t,this.options=o,this.domNode=null,this.initColTool()}initColTool(){const e=this.quill.root.parentNode,t=(this.table.getBoundingClientRect(),e.getBoundingClientRect()),o=this.table.parentNode.getBoundingClientRect();this.domNode=document.createElement("div"),this.domNode.classList.add("qlbt-col-tool"),this.updateToolCells(),e.appendChild(this.domNode),l(this.domNode,{width:"".concat(o.width,"px"),height:"".concat(c,"px"),left:"".concat(o.left-t.left+e.scrollLeft,"px"),top:"".concat(o.top-t.top+e.scrollTop-c-5,"px")})}createToolCell(){const e=document.createElement("div");e.classList.add("qlbt-col-tool-cell");const t=document.createElement("div");return t.classList.add("qlbt-col-tool-cell-holder"),l(e,{height:"".concat(d,"px")}),e.appendChild(t),e}updateToolCells(){const e=r.a.find(this.table),t=e.children.tail.children.head.children,o=e.colGroup().children,n=function(e){return e.reduce((e,t)=>{const o=t.formats().colspan;return e+=parseInt(o,10)},0)}(t);let i=Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell"));for(let e=0;e=n?i[e].remove():l(s=i[e],{"min-width":"".concat(r,"px")}):(s=this.createToolCell(),this.domNode.appendChild(s),this.addColCellHolderHandler(s),l(s,{"min-width":"".concat(r,"px")}))}}destroy(){return this.domNode.remove(),null}addColCellHolderHandler(e){const t=r.a.find(this.table),o=e.querySelector(".qlbt-col-tool-cell-holder");let n=!1,i=0,s=0,a=0,d=0,p={},f={},m=null;const b=e=>{e.preventDefault(),n&&(s=e.clientX,a=d+s-i>=h?s-i:h-d,l(m,{left:"".concat(f.left+f.width-1+a,"px")}))},g=r=>{r.preventDefault();const c=Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell")).indexOf(e),h=t.colGroup().children.at(c);n&&(h.format("width",d+a),l(e,{"min-width":"".concat(d+a,"px")}),i=0,s=0,a=0,d=0,n=!1,o.classList.remove("dragging")),document.removeEventListener("mousemove",b,!1),document.removeEventListener("mouseup",g,!1),p={},f={},m.remove(),m=null,t.updateTableWidth();const u=this.quill.getModule("better-table").tableSelection;u&&u.clearSelection()};o.addEventListener("mousedown",t=>{document.addEventListener("mousemove",b,!1),document.addEventListener("mouseup",g,!1),p=this.table.getBoundingClientRect(),f=e.getBoundingClientRect(),l(m=document.createElement("div"),{position:"fixed",top:"".concat(f.top,"px"),left:"".concat(f.left+f.width-1,"px"),zIndex:"100",height:"".concat(p.height+c+4,"px"),width:"1px",backgroundColor:u}),document.body.appendChild(m),n=!0,i=t.clientX,d=f.width,o.classList.add("dragging")},!1)}colToolCells(){return Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell"))}}const f=r.a.import("blots/block");class m extends f{static create(e){"string"==typeof e&&(e={value:e});const t=super.create(e.value);return N.forEach(o=>{e[o]&&t.setAttribute("data-".concat(o),e[o])}),C.forEach(o=>{e[o]&&t.setAttribute("data-".concat(o),e[o])}),t}static formats(e){const t={};return t.value=this.tagName.indexOf(e.tagName)+1,C.concat(N).reduce((t,o)=>(e.hasAttribute("data-".concat(o))&&(t[o]=e.getAttribute("data-".concat(o))||void 0),t),t)}format(e,t){const{row:o,cell:n,rowspan:r,colspan:l}=m.formats(this.domNode);e===m.blotName?t?super.format(e,{value:t,row:o,cell:n,rowspan:r,colspan:l}):o?this.replaceWith(S.blotName,{row:o,cell:n,rowspan:r,colspan:l}):super.format(e,t):super.format(e,t)}optimize(e){const{row:t,rowspan:o,colspan:n}=m.formats(this.domNode);if(!t||this.parent instanceof E||this.wrap(E.blotName,{row:t,colspan:n,rowspan:o}),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove();this.cache={}}}m.blotName="header",m.tagName=["H1","H2","H3","H4","H5","H6"];var b=m;const g=r.a.import("blots/break"),w=r.a.import("blots/block"),v=r.a.import("blots/container"),y=["width"],x={width:100},N=["row","cell"],C=["rowspan","colspan"],q={rowspan:1,colspan:1},A=5;class S extends w{static create(e){const t=super.create(e);return N.forEach(o=>{let n="row"===o?L:z;t.setAttribute("data-".concat(o),e[o]||n())}),C.forEach(o=>{t.setAttribute("data-".concat(o),e[o]||q[o])}),e["cell-bg"]&&t.setAttribute("data-cell-bg",e["cell-bg"]),t}static formats(e){return C.concat(N).concat(["cell-bg"]).reduce((t,o)=>(e.hasAttribute("data-".concat(o))&&(t[o]=e.getAttribute("data-".concat(o))||void 0),t),{})}format(e,t){if(C.concat(N).indexOf(e)>-1)t?this.domNode.setAttribute("data-".concat(e),t):this.domNode.removeAttribute("data-".concat(e));else if("cell-bg"===e)t?this.domNode.setAttribute("data-cell-bg",t):this.domNode.removeAttribute("data-cell-bg");else if("header"===e){if(!t)return;const{row:o,cell:n,rowspan:r,colspan:l}=S.formats(this.domNode);super.format(e,{value:t,row:o,cell:n,rowspan:r,colspan:l})}else super.format(e,t)}optimize(e){const t=this.domNode.getAttribute("data-row"),o=this.domNode.getAttribute("data-rowspan"),n=this.domNode.getAttribute("data-colspan"),r=this.domNode.getAttribute("data-cell-bg");!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName,{row:t,colspan:n,rowspan:o,"cell-bg":r}),super.optimize(e)}tableCell(){return this.parent}}S.blotName="table-cell-line",S.ClassName="qlbt-cell-line",S.tagName="DIV";class E extends v{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats()[this.children.head.statics.blotName],t=this.children.tail.formats()[this.children.tail.statics.blotName],o=this.next.children.head.formats()[this.next.children.head.statics.blotName],n=this.next.children.tail.formats()[this.next.children.tail.statics.blotName];return e.cell===t.cell&&e.cell===o.cell&&e.cell===n.cell}return!1}static create(e){const t=super.create(e);return t.setAttribute("data-row",e.row),C.forEach(o=>{e[o]&&t.setAttribute(o,e[o])}),e["cell-bg"]&&(t.setAttribute("data-cell-bg",e["cell-bg"]),t.style.backgroundColor=e["cell-bg"]),t}static formats(e){const t={};return e.hasAttribute("data-row")&&(t.row=e.getAttribute("data-row")),e.hasAttribute("data-cell-bg")&&(t["cell-bg"]=e.getAttribute("data-cell-bg")),C.reduce((t,o)=>(e.hasAttribute(o)&&(t[o]=e.getAttribute(o)),t),t)}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}formats(){const e={};return this.domNode.hasAttribute("data-row")&&(e.row=this.domNode.getAttribute("data-row")),this.domNode.hasAttribute("data-cell-bg")&&(e["cell-bg"]=this.domNode.getAttribute("data-cell-bg")),C.reduce((e,t)=>(this.domNode.hasAttribute(t)&&(e[t]=this.domNode.getAttribute(t)),e),e)}toggleAttribute(e,t){t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e)}formatChildren(e,t){this.children.forEach(o=>{o.format(e,t)})}format(e,t){C.indexOf(e)>-1?(this.toggleAttribute(e,t),this.formatChildren(e,t)):["row"].indexOf(e)>-1?(this.toggleAttribute("data-".concat(e),t),this.formatChildren(e,t)):"cell-bg"===e?(this.toggleAttribute("data-cell-bg",t),this.formatChildren(e,t),this.domNode.style.backgroundColor=t||"initial"):super.format(e,t)}optimize(e){const t=this.domNode.getAttribute("data-row");!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName,{row:t}),super.optimize(e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}}E.blotName="table",E.tagName="TD";class T extends v{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),o=this.next.children.head.formats(),n=this.next.children.tail.formats();return e.row===t.row&&e.row===o.row&&e.row===n.row}return!1}static create(e){const t=super.create(e);return t.setAttribute("data-row",e.row),t}formats(){return["row"].reduce((e,t)=>(this.domNode.hasAttribute("data-".concat(t))&&(e[t]=this.domNode.getAttribute("data-".concat(t))),e),{})}optimize(e){!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}T.blotName="table-row",T.tagName="TR";class H extends v{}H.blotName="table-body",H.tagName="TBODY";class M extends w{static create(e){let t=super.create(e);return y.forEach(o=>{t.setAttribute("".concat(o),e[o]||x[o])}),t}static formats(e){return y.reduce((t,o)=>(e.hasAttribute("".concat(o))&&(t[o]=e.getAttribute("".concat(o))||void 0),t),{})}format(e,t){y.indexOf(e)>-1?this.domNode.setAttribute("".concat(e),t||x[e]):super.format(e,t)}html(){return this.domNode.outerHTML}}M.blotName="table-col",M.tagName="col";class B extends v{}B.blotName="table-col-group",B.tagName="colgroup";class O extends v{static create(){return super.create()}constructor(e,t){super(e,t),this.updateTableWidth()}updateTableWidth(){setTimeout(()=>{const e=this.colGroup();if(!e)return;const t=e.children.reduce((e,t)=>e+=parseInt(t.formats()[M.blotName].width,10),0);this.domNode.style.width="".concat(t,"px")},0)}cells(e){return this.rows().map(t=>t.children.at(e))}colGroup(){return this.children.head}deleteColumns(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;const[n]=this.descendants(H);if(null==n||null==n.children.head)return;const r=this.descendants(E),l=[],s=[];if(r.forEach(t=>{const n=i(t.domNode.getBoundingClientRect(),o);n.x+A>e.x&&n.x1-Ae.x1-A&&s.push(t)}),l.length===r.length)return this.tableDestroy(),!0;t.forEach(e=>{this.colGroup().children.at(t[0]).remove()}),l.forEach(e=>{e.remove()}),s.forEach(e=>{const o=parseInt(e.formats().colspan,10);parseInt(e.formats().width,10);e.format("colspan",o-t.length)}),this.updateTableWidth()}deleteRow(e,t){const[o]=this.descendants(H);if(null==o||null==o.children.head)return;const n=this.descendants(E),r=this.descendants(T),l=[],s=[],a=[],c=r.filter(o=>{const n=i(o.domNode.getBoundingClientRect(),t);return n.y>e.y-A&&n.y1{const n=i(o.domNode.getBoundingClientRect(),t);n.y>e.y-A&&n.y1e.y1-A&&(s.push(o),Math.abs(n.y-e.y){let r=i(n.domNode.getBoundingClientRect(),t);return r.y>e.y-A&&r.y1{const o=i(e.domNode.getBoundingClientRect(),t),n=e.parent.next,r=n.children.reduce((e,n)=>{const r=i(n.domNode.getBoundingClientRect(),t);return Math.abs(o.x1-r.x){e.remove()}),s.forEach(e=>{const t=parseInt(e.formats().rowspan,10);e.format("rowspan",t-d)}),c.forEach(e=>e.remove())}tableDestroy(){const e=r.a.find(this.scroll.domNode.parentNode),t=e.getModule("better-table");this.remove(),t.hideTableTools(),e.update(r.a.sources.USER)}insertCell(e,t){const o=z(),n=e.formats().row,r=this.scroll.create(E.blotName,Object.assign({},q,{row:n})),l=this.scroll.create(S.blotName,{row:n,cell:o});r.appendChild(l),t?e.insertBefore(r,t):e.appendChild(r)}insertColumn(e,t){let o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;const[r]=this.descendants(H),[l]=this.descendants(B),s=this.descendants(M);let a=[],c=[],d=[];if(null==r||null==r.children.head)return;this.descendants(E).forEach(t=>{const r=i(t.domNode.getBoundingClientRect(),n);o?Math.abs(r.x1-e.x1)A&&e.x1-r.x1<-A&&c.push(t):Math.abs(r.x-e.x)A&&e.x-r.x1<-A&&c.push(t)}),a.forEach(e=>{const t=o?e.next:e,n=z(),r=e.parent,l=r.formats().row,i=e.formats(),s=this.scroll.create(E.blotName,Object.assign({},q,{row:l,rowspan:i.rowspan})),a=this.scroll.create(S.blotName,{row:l,cell:n,rowspan:i.rowspan});s.appendChild(a),t?r.insertBefore(s,t):r.appendChild(s),d.push(s)});const h=this.scroll.create(M.blotName,!0);let u=o?s[t].next:s[t];return u?l.insertBefore(h,u):l.appendChild(h),c.forEach(e=>{const t=e.formats().colspan;e.format("colspan",parseInt(t,10)+1),d.push(e)}),d.sort((e,t)=>{return e.domNode.getBoundingClientRect().y-t.domNode.getBoundingClientRect().y}),this.updateTableWidth(),d}insertRow(e,t,o){const[n]=this.descendants(H);if(null==n||null==n.children.head)return;const r=this.descendants(E),l=L(),s=this.scroll.create(T.blotName,{row:l});let a=[],c=[],d=[];r.forEach(n=>{const r=i(n.domNode.getBoundingClientRect(),o);t?Math.abs(r.y1-e.y1)A&&e.y1-r.y1<-A&&c.push(n):Math.abs(r.y-e.y)A&&e.y-r.y1<-A&&c.push(n)});const h=(e,t)=>{return e.domNode.getBoundingClientRect().x-t.domNode.getBoundingClientRect().x};a.sort(h),a.forEach(e=>{const t=z(),o=e.formats(),n=this.scroll.create(E.blotName,Object.assign({},q,{row:l,colspan:o.colspan})),r=this.scroll.create(S.blotName,{row:l,cell:t,colspan:o.colspan}),i=this.scroll.create(g.blotName);r.appendChild(i),n.appendChild(r),s.appendChild(n),d.push(n)}),c.forEach(e=>{const t=parseInt(e.formats().rowspan,10);e.format("rowspan",t+1),d.push(e)});const u=this.rows().find(n=>{let r=i(n.domNode.getBoundingClientRect(),o);return t?Math.abs(r.y-e.y-e.height)(0!==r?(e&&t.moveChildren(e),t.remove()):(t.format("colspan",n),t.format("rowspan",o),e=t),e),null);let i=l.domNode.getAttribute("data-row"),s=l.children.head.domNode.getAttribute("data-cell");return l.children.forEach(e=>{e.format("cell",s),e.format("row",i),e.format("colspan",n),e.format("rowspan",o)}),l}unmergeCells(e,t){let o={},n=1,r=1;e.forEach(e=>{if(o=e.formats(),n=o.rowspan,(r=o.colspan)>1){let t=e.next,o=e.row();e.format("colspan",1);for(let e=r;e>1;e--)this.insertCell(o,t)}if(n>1){let o=n,l=e.row().next;for(;o>1;){let n=l.children.reduce((o,n)=>{let r=i(e.domNode.getBoundingClientRect(),t),l=i(n.domNode.getBoundingClientRect(),t);return Math.abs(r.x1-l.x)0;e--)this.insertCell(l,n);o-=1,l=l.next}e.format("rowspan",1)}})}rows(){const e=this.children.tail;return null==e?[]:e.children.map(e=>e)}}O.blotName="table-container",O.className="quill-better-table",O.tagName="TABLE";class R extends v{constructor(e,t){super(e,t);const o=r.a.find(e.domNode.parentNode);t.addEventListener("scroll",e=>{const t=o.getModule("better-table");t.columnTool&&(t.columnTool.domNode.scrollLeft=e.target.scrollLeft),t.tableSelection&&t.tableSelection.selectedTds.length>0&&t.tableSelection.repositionHelpLines()},!1)}table(){return this.children.head}}function L(){const e=Math.random().toString(36).slice(2,6);return"row-".concat(e)}function z(){const e=Math.random().toString(36).slice(2,6);return"cell-".concat(e)}R.blotName="table-view",R.className="quill-better-table-wrapper",R.tagName="DIV",R.allowedChildren=[O],O.requiredContainer=R,O.allowedChildren=[H,B],H.requiredContainer=O,H.allowedChildren=[T],T.requiredContainer=H,T.allowedChildren=[E],E.requiredContainer=T,E.allowedChildren=[S,b],S.requiredContainer=E,B.allowedChildren=[M],B.requiredContainer=O,M.requiredContainer=B;const k="#0589f3",I=["left","right","top","bottom"],D=2;class j{constructor(e,t,o){if(!e)return null;this.table=e,this.quill=t,this.options=o,this.boundary={},this.selectedTds=[],this.dragging=!1,this.selectingHandler=this.mouseDownHandler.bind(this),this.clearSelectionHandler =this.clearSelection.bind(this),this.helpLinesInitial(),this.quill.root.addEventListener("mousedown",this.selectingHandler,!1),this.quill.on("text-change",this.clearSelectionHandler )}helpLinesInitial(){let e=this.quill.root.parentNode;I.forEach(t=>{this[t]=document.createElement("div"),this[t].classList.add("qlbt-selection-line"),this[t].classList.add("qlbt-selection-line-"+t),l(this[t],{position:"absolute",display:"none","background-color":k}),e.appendChild(this[t])})}mouseDownHandler(e){if(0!==e.button||!e.target.closest(".quill-better-table"))return;this.quill.root.addEventListener("mousemove",r,!1),this.quill.root.addEventListener("mouseup",function e(o){t.quill.root.removeEventListener("mousemove",r,!1);t.quill.root.removeEventListener("mouseup",e,!1);t.dragging=!1},!1);const t=this,o=e.target.closest("td[data-row]"),n=i(o.getBoundingClientRect(),this.quill.root.parentNode);function r(e){if(0!==e.button||!e.target.closest(".quill-better-table"))return;const r=e.target.closest("td[data-row]"),l=i(r.getBoundingClientRect(),t.quill.root.parentNode);t.boundary=V(n,l),t.correctBoundary(),t.selectedTds=t.computeSelectedTds(),t.repositionHelpLines(),o!==r&&t.quill.blur()}this.dragging=!0,this.boundary=V(n,n),this.correctBoundary(),this.selectedTds=this.computeSelectedTds(),this.repositionHelpLines()}correctBoundary(){r.a.find(this.table).descendants(E).forEach(e=>{let{x:t,y:o,width:n,height:r}=i(e.domNode.getBoundingClientRect(),this.quill.root.parentNode);(t+D>=this.boundary.x&&t+D<=this.boundary.x1||t-D+n>=this.boundary.x&&t-D+n<=this.boundary.x1)&&(o+D>=this.boundary.y&&o+D<=this.boundary.y1||o-D+r>=this.boundary.y&&o-D+r<=this.boundary.y1)&&(this.boundary=V(this.boundary,{x:t,y:o,width:n,height:r}))})}computeSelectedTds(){return r.a.find(this.table).descendants(E).reduce((e,t)=>{let{x:o,y:n,width:r,height:l}=i(t.domNode.getBoundingClientRect(),this.quill.root.parentNode);return o+D>=this.boundary.x&&o-D+r<=this.boundary.x1&&n+D>=this.boundary.y&&n-D+l<=this.boundary.y1&&e.push(t),e},[])}repositionHelpLines(){const e=this.table.parentNode.scrollLeft;l(this.left,{display:"block",left:"".concat(this.boundary.x-e-1,"px"),top:"".concat(this.boundary.y,"px"),height:"".concat(this.boundary.height+1,"px"),width:"1px"}),l(this.right,{display:"block",left:"".concat(this.boundary.x1-e,"px"),top:"".concat(this.boundary.y,"px"),height:"".concat(this.boundary.height+1,"px"),width:"1px"}),l(this.top,{display:"block",left:"".concat(this.boundary.x-1-e,"px"),top:"".concat(this.boundary.y,"px"),width:"".concat(this.boundary.width+1,"px"),height:"1px"}),l(this.bottom,{display:"block",left:"".concat(this.boundary.x-1-e,"px"),top:"".concat(this.boundary.y1+1,"px"),width:"".concat(this.boundary.width+1,"px"),height:"1px"})}refreshHelpLinesPosition(){const e=i(this.selectedTds[0].domNode.getBoundingClientRect(),this.quill.root.parentNode),t=i(this.selectedTds[this.selectedTds.length-1].domNode.getBoundingClientRect(),this.quill.root.parentNode);this.boundary=V(e,t),this.repositionHelpLines()}destroy(){return I.forEach(e=>{this[e].remove(),this[e]=null}),this.quill.root.removeEventListener("mousedown",this.selectingHandler,!1),this.quill.off("text-change",this.clearSelectionHandler ),null}setSelection(e,t){this.boundary=V(i(e,this.quill.root.parentNode),i(t,this.quill.root.parentNode)),this.correctBoundary(),this.selectedTds=this.computeSelectedTds(),this.repositionHelpLines()}clearSelection(){this.boundary={},this.selectedTds=[],I.forEach(e=>{this[e]&&l(this[e],{display:"none"})})}}function V(e,t){let o=Math.min(e.x,t.x,e.x+e.width-1,t.x+t.width-1),n=Math.max(e.x,t.x,e.x+e.width-1,t.x+t.width-1),r=Math.min(e.y,t.y,e.y+e.height-1,t.y+t.height-1),l=Math.max(e.y,t.y,e.y+e.height-1,t.y+t.height-1);return{x:o,x1:n,y:r,y1:l,width:n-o,height:l-r}}var U=o(1),_=o.n(U),P=o(2),W=o.n(P),G=o(3),X=o.n(G),K=o(4),Y=o.n(K),$=o(5),J=o.n($),Q=o(6),F=o.n(Q),Z=o(7),ee=o.n(Z),te=o(8),oe=o.n(te),ne=o(9),re=o.n(ne);const le=150,ie=200,se=["white","red","yellow","blue"],ae="Background Colors",ce={insertColumnRight:{text:"Insert column right",iconSrc:_.a,handler(){const e=r.a.find(this.table);let t=he(this.columnToolCells,this.boundary,(e,t)=>Math.abs(e.x+e.width-t.x1)<=5,this.quill.root.parentNode);const o=e.insertColumn(this.boundary,t,!0,this.quill.root.parentNode);this.tableColumnTool.updateToolCells(),this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(o[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(o[0].domNode.getBoundingClientRect(),o[0].domNode.getBoundingClientRect())}},insertColumnLeft:{text:"Insert column left",iconSrc:W.a,handler(){const e=r.a.find(this.table);let t=he(this.columnToolCells,this.boundary,(e,t)=>Math.abs(e.x-t.x)<=5,this.quill.root.parentNode);const o=e.insertColumn(this.boundary,t,!1,this.quill.root.parentNode);this.tableColumnTool.updateToolCells(),this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(o[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(o[0].domNode.getBoundingClientRect(),o[0].domNode.getBoundingClientRect())}},insertRowUp:{text:"Insert row up",iconSrc:X.a,handler(){const e=r.a.find(this.table).insertRow(this.boundary,!1,this.quill.root.parentNode);this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(e[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(e[0].domNode.getBoundingClientRect(),e[0].domNode.getBoundingClientRect())}},insertRowDown:{text:"Insert row down",iconSrc:Y.a,handler(){const e=r.a.find(this.table).insertRow(this.boundary,!0,this.quill.root.parentNode);this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(e[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(e[0].domNode.getBoundingClientRect(),e[0].domNode.getBoundingClientRect())}},mergeCells:{text:"Merge selected cells",iconSrc:J.a,handler(){const e=r.a.find(this.table),t=e.rows().reduce((e,t)=>{let o=i(t.domNode.getBoundingClientRect(),this.quill.root.parentNode);return o.y>this.boundary.y-5&&o.y+o.height{let o=i(t.getBoundingClientRect(),this.quill.root.parentNode);return o.x>this.boundary.x-5&&o.x+o.width{let s=i(l.getBoundingClientRect(),n);return o(s,t)&&r.push(e.indexOf(l)),r},[])}(this.columnToolCells,this.boundary,(e,t)=>e.x+5>t.x&&e.x+e.width-5-1&&this.domNode.appendChild(r()));function r(){const e=document.createElement("div");return e.classList.add("qlbt-operation-menu-dividing"),e}this.options.color&&!1!==this.options.color&&(this.domNode.appendChild(r()),this.domNode.appendChild(function(e){const t=document.createElement("div");return t.classList.add("qlbt-operation-menu-subtitle"),t.innerText=e,t}(this.colorSubTitle)),this.domNode.appendChild(this.colorsItemCreator(this.cellColors)))}colorsItemCreator(e){const t=this,o=document.createElement("div");return o.classList.add("qlbt-operation-color-picker"),e.forEach(e=>{let n=function(e){const o=document.createElement("div");return o.classList.add("qlbt-operation-color-picker-item"),o.setAttribute("data-color",e),o.style.backgroundColor=e,o.addEventListener("click",function(){const o=t.tableSelection.selectedTds;o&&o.length>0&&o.forEach(t=>{t.format("cell-bg",e)})},!1),o}(e);o.appendChild(n)}),o}menuItemCreator(e){let{text:t,iconSrc:o,handler:n}=e;const r=document.createElement("div");r.classList.add("qlbt-operation-menu-item");const l=document.createElement("span");l.classList.add("qlbt-operation-menu-icon"),l.innerHTML=o;const i=document.createElement("span");return i.classList.add("qlbt-operation-menu-text"),i.innerText=t,r.appendChild(l),r.appendChild(i),r.addEventListener("click",n.bind(this),!1),r}}function he(e,t,o,n){return e.reduce((r,l)=>{let s=i(l.getBoundingClientRect(),n);return o(s,t)&&(r=e.indexOf(l)),r},!1)}const ue=r.a.import("delta");function pe(e,t,o){const n=e.parentNode,r="TABLE"===n.parentNode.tagName?n.parentNode:n.parentNode.parentNode,l=Array.from(r.querySelectorAll("tr")),i=Array.from(n.querySelectorAll("td")),a=l.indexOf(n)+1,c=i.indexOf(e)+1,d=e.getAttribute("colspan")||!1,h=e.getAttribute("rowspan")||!1,u=e.getAttribute("data-cell-bg")||e.style.backgroundColor;return 0===t.length()?t=(new ue).insert("\n",{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}}):(t=t.reduce((e,t)=>{if(t.insert&&"string"==typeof t.insert){const o=[];let n=t.insert,r=0;for(let e=0;e{"\n"===o?e.insert("\n",t.attributes):e.insert(o,s(t.attributes,["table","table-cell-line"]))})}else e.insert(t.insert,t.attributes);return e},new ue)).reduce((e,t)=>(t.insert&&"string"==typeof t.insert&&t.insert.startsWith("\n")?e.insert(t.insert,Object.assign({},Object.assign({},{row:a},t.attributes.table),{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d,"cell-bg":u}},s(t.attributes,["table"]))):t.attributes&&t.attributes.background&&t.attributes.background===function(e){if(/^(rgb|RGB)/.test(e)){for(var t=e.toString().match(/\d+/g),o="#",n=0;n<3;n++)o+=("0"+Number(t[n]).toString(16)).slice(-2);return o}if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){var r=e.replace(/#/,"").split("");if(6===r.length)return e;if(3===r.length){var l="#";for(n=0;n{if(t.insert&&"string"==typeof t.insert){const o=[];let n=t.insert,r=0;for(let e=0;e{"\n"===o?e.insert("\n",{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}}):e.insert(o,t.attributes)})}else e.insert(t.insert,t.attributes);return e},new ue)).reduce((e,t)=>(t.insert&&"string"==typeof t.insert&&t.insert.startsWith("\n")?e.insert(t.insert,Object.assign({},{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}})):e.insert(t.insert,Object.assign({},s(t.attributes,["table","table-cell-line"]))),e),new ue)}function me(e,t,o){let n=new ue;const r=e.querySelector("tr");if(null===r)return n;const l=Array.from(r.querySelectorAll("td")).concat(Array.from(r.querySelectorAll("th"))).reduce((e,t)=>{const o=t.getAttribute("colspan")||1;return e+=parseInt(o,10)},0),i=e.querySelectorAll("col").length;if(i===l)return t;{for(let e=0;e(t.insert(o.insert,o.attributes),o.attributes&&o.attributes["table-col"]&&(e+=o.insert.length)===i&&(t=t.concat(n)),t),new ue)}}const be=r.a.import("core/module"),ge=r.a.import("delta");class we extends be{static register(){r.a.register(M,!0),r.a.register(B,!0),r.a.register(S,!0),r.a.register(E,!0),r.a.register(T,!0),r.a.register(H,!0),r.a.register(O,!0),r.a.register(R,!0),r.a.register(R,!0)}constructor(e,t){super(e,t),this.quill.root.addEventListener("click",o=>{const n=a(o);if(!n||n.length<=0)return;const r=n.filter(e=>e.tagName&&"TABLE"===e.tagName.toUpperCase()&&e.classList.contains("quill-better-table"))[0];if(r){if(this.table===r)return;this.table&&this.hideTableTools(),this.showTableTools(r,e,t)}else this.table&&this.hideTableTools()},!1),this.quill.root.addEventListener("contextmenu",o=>{if(!this.table)return!0;o.preventDefault();const n=a(o);if(!n||n.length<=0)return;const r=n.filter(e=>e.tagName&&"TABLE"===e.tagName.toUpperCase()&&e.classList.contains("quill-better-table"))[0],l=n.filter(e=>e.tagName&&"TR"===e.tagName.toUpperCase()&&e.getAttribute("data-row"))[0],i=n.filter(e=>e.tagName&&"TD"===e.tagName.toUpperCase()&&e.getAttribute("data-row"))[0];let s=this.tableSelection.selectedTds.map(e=>e.domNode).includes(i);(this.tableSelection.selectedTds.length<=0||!s)&&this.tableSelection.setSelection(i.getBoundingClientRect(),i.getBoundingClientRect()),this.tableOperationMenu&&(this.tableOperationMenu=this.tableOperationMenu.destroy()),r&&(this.tableOperationMenu=new de({table:r,row:l,cell:i,left:o.pageX,top:o.pageY},e,t.operationMenu))},!1);e.getModule("keyboard");e.keyboard.addBinding({key:"Backspace"},{},function(e,t){if(0===e.index||this.quill.getLength()<=1)return!0;const[o]=this.quill.getLine(e.index);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(null!=t&&"table-cell-line"===t.statics.blotName&&"table-cell-line"!==o.statics.blotName)return!1}return!0});let o=e.keyboard.bindings.Backspace.pop();e.keyboard.bindings.Backspace.splice(0,1,o),e.clipboard.addMatcher("td",pe),e.clipboard.addMatcher("th",fe),e.clipboard.addMatcher("table",me),e.clipboard.matchers=e.clipboard.matchers.filter(e=>"tr"!==e[0])}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,o]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==S.blotName)return[null,null,null,-1];const n=t.tableCell(),r=n.row();return[r.table(),r,n,o]}insertTable(e,t){const o=this.quill.getSelection(!0);if(null==o)return;let n=this.quill.getLeaf(o.index)[0],l=(new ge).retain(o.index);!function e(t){return!(!t||!t.parent)&&(o=t.parent,o.statics.blotName===E.blotName||e(t.parent));var o}(n)?(l.insert("\n"),l=new Array(t).fill("\n").reduce((e,t)=>(e.insert(t,{"table-col":!0}),e),l),l=new Array(e).fill(0).reduce(e=>{let o=L();return new Array(t).fill("\n").reduce((e,t)=>(e.insert(t,{"table-cell-line":{row:o,cell:z()}}),e),e)},l),this.quill.updateContents(l,r.a.sources.USER),this.quill.setSelection(o.index+t+1,r.a.sources.API)):console.warn("Can not insert table into a table cell.")}showTableTools(e,t,o){this.table=e,this.columnTool=new p(e,t,o),this.tableSelection=new j(e,t,o)}hideTableTools(){this.columnTool&&this.columnTool.destroy(),this.tableSelection&&this.tableSelection.destroy(),this.tableOperationMenu&&this.tableOperationMenu.destroy(),this.columnTool=null,this.tableSelection=null,this.tableOperationMenu=null,this.table=null}}function ve(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table-cell-line"],handler(t,o){const n=e?"prev":"next";if(null!=o.line[n])return!0;const l=o.line.parent,i=l.parent[n];if(null!=i&&"table-row"===i.statics.blotName){let e=i.children.head,t=parseInt(e.formats().colspan,10),o=l,n=parseInt(o.formats().colspan,10);for(;null!=o.prev;)o=o.prev,n+=parseInt(o.formats().colspan,10);for(;null!=e.next&&t0&&this.quill.scroll.deleteAt(e.index,e.length);const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,o.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{});this.quill.insertText(e.index,"\n",n["table-cell-line"],r.a.sources.USER),this.quill.setSelection(e.index+1,r.a.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(e=>{null==n[e]&&(Array.isArray(t.format[e])||"link"!==e&&this.quill.format(e,t.format[e],r.a.sources.USER))})}},"table-cell-line up":ve(!0),"table-cell-line down":ve(!1),"down-to-table":{key:"ArrowDown",collapsed:!0,handler(e,t){const o=t.line.next;if(o&&"table-view"===o.statics.blotName){const e=o.table().rows()[0].children.head.children.head;return this.quill.setSelection(e.offset(this.quill.scroll),0,r.a.sources.USER),!1}return!0}},"up-to-table":{key:"ArrowUp",collapsed:!0,handler(e,t){const o=t.line.prev;if(o&&"table-view"===o.statics.blotName){const e=o.table().rows(),t=e[e.length-1].children.head.children.head;return this.quill.setSelection(t.offset(this.quill.scroll),0,r.a.sources.USER),!1}return!0}}};t.default=we}]).default}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("quill")):"function"==typeof define&&define.amd?define(["quill"],t):"object"==typeof exports?exports.quillBetterTable=t(require("quill")):e.quillBetterTable=t(e.Quill)}(window,(function(e){return function(e){var t=window.webpackHotUpdatequillBetterTable;window.webpackHotUpdatequillBetterTable=function(e,o){!function(e,t){if(!y[e]||!v[e])return;for(var o in v[e]=!1,t)Object.prototype.hasOwnProperty.call(t,o)&&(f[o]=t[o]);0==--b&&0===g&&q()}(e,o),t&&t(e,o)};var o,n=!0,r="ac79f30df8286f6b68e4",l={},i=[],s=[];function a(e){var t=S[e];if(!t)return E;var n=function(n){return t.hot.active?(S[n]?-1===S[n].parents.indexOf(e)&&S[n].parents.push(e):(i=[e],o=n),-1===t.children.indexOf(n)&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),i=[]),E(n)},r=function(e){return{configurable:!0,enumerable:!0,get:function(){return E[e]},set:function(t){E[e]=t}}};for(var l in E)Object.prototype.hasOwnProperty.call(E,l)&&"e"!==l&&"t"!==l&&Object.defineProperty(n,l,r(l));return n.e=function(e){return"ready"===h&&u("prepare"),g++,E.e(e).then(t,(function(e){throw t(),e}));function t(){g--,"prepare"===h&&(w[e]||C(e),0===g&&0===b&&q())}},n.t=function(e,t){return 1&t&&(e=n(e)),E.t(e,-2&t)},n}function c(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:o!==e,active:!0,accept:function(e,o){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var n=0;n=0&&t._disposeHandlers.splice(o,1)},check:N,apply:A,status:function(e){if(!e)return h;d.push(e)},addStatusHandler:function(e){d.push(e)},removeStatusHandler:function(e){var t=d.indexOf(e);t>=0&&d.splice(t,1)},data:l[e]};return o=void 0,t}var d=[],h="idle";function u(e){h=e;for(var t=0;t0;){var r=n.pop(),l=r.id,i=r.chain;if((a=S[l])&&!a.hot._selfAccepted){if(a.hot._selfDeclined)return{type:"self-declined",chain:i,moduleId:l};if(a.hot._main)return{type:"unaccepted",chain:i,moduleId:l};for(var s=0;s ")),C.type){case"self-declined":t.onDeclined&&t.onDeclined(C),t.ignoreDeclined||(q=new Error("Aborted because of self decline: "+C.moduleId+H));break;case"declined":t.onDeclined&&t.onDeclined(C),t.ignoreDeclined||(q=new Error("Aborted because of declined dependency: "+C.moduleId+" in "+C.parentId+H));break;case"unaccepted":t.onUnaccepted&&t.onUnaccepted(C),t.ignoreUnaccepted||(q=new Error("Aborted because "+c+" is not accepted"+H));break;case"accepted":t.onAccepted&&t.onAccepted(C),A=!0;break;case"disposed":t.onDisposed&&t.onDisposed(C),T=!0;break;default:throw new Error("Unexception type "+C.type)}if(q)return u("abort"),Promise.reject(q);if(A)for(c in w[c]=f[c],p(g,C.outdatedModules),C.outdatedDependencies)Object.prototype.hasOwnProperty.call(C.outdatedDependencies,c)&&(b[c]||(b[c]=[]),p(b[c],C.outdatedDependencies[c]));T&&(p(g,[C.moduleId]),w[c]=v)}var M,B=[];for(n=0;n0;)if(c=L.pop(),a=S[c]){var z={},k=a.hot._disposeHandlers;for(s=0;s=0&&I.parents.splice(M,1))}}for(c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&(a=S[c]))for(R=b[c],s=0;s=0&&a.children.splice(M,1);for(c in u("apply"),r=m,w)Object.prototype.hasOwnProperty.call(w,c)&&(e[c]=w[c]);var D=null;for(c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&(a=S[c])){R=b[c];var j=[];for(n=0;n'},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t){e.exports=''},function(e,t,o){e.exports=o(11)},function(e,t,o){"use strict";o.r(t);var n=o(0),r=o.n(n);function l(e,t){if("object"==typeof t)for(let o in t)e.style[o]=t[o]}function i(e,t){let o=t.getBoundingClientRect();return{x:e.x-o.x-t.scrollLeft,y:e.y-o.y-t.scrollTop,x1:e.x-o.x-t.scrollLeft+e.width,y1:e.y-o.y-t.scrollTop+e.height,width:e.width,height:e.height}}function s(e,t){return e&&Object.keys(e).reduce((o,n)=>t.includes(n)?o:Object.assign({},o,{[n]:e[n]}),{})}function a(e){let t;if(t=e.path||e.composedPath&&e.composedPath(),null==t&&e.target){t=[];let o=e.target;for(t.push(o);o&&o.parentNode;)o=o.parentNode,t.push(o)}return t}class c{constructor(e,t,o){if(!e)return null;this.table=e,this.quill=t,this.options=o,this.domNode=null,this.initColTool()}initColTool(){const e=this.quill.root.parentNode,t=(this.table.getBoundingClientRect(),e.getBoundingClientRect()),o=this.table.parentNode.getBoundingClientRect();this.domNode=document.createElement("div"),this.domNode.classList.add("qlbt-col-tool"),this.updateToolCells(),e.appendChild(this.domNode),l(this.domNode,{width:"".concat(o.width,"px"),height:"".concat(12,"px"),left:"".concat(o.left-t.left+e.scrollLeft,"px"),top:"".concat(o.top-t.top+e.scrollTop-12-5,"px")})}createToolCell(){const e=document.createElement("div");e.classList.add("qlbt-col-tool-cell");const t=document.createElement("div");return t.classList.add("qlbt-col-tool-cell-holder"),l(e,{height:"".concat(12,"px")}),e.appendChild(t),e}updateToolCells(){const e=r.a.find(this.table),t=e.children.tail.children.head.children,o=e.colGroup().children,n=function(e){return e.reduce((e,t)=>{const o=t.formats().colspan;return e+=parseInt(o,10)},0)}(t);let i=Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell"));for(let e=0;e=n?i[e].remove():(s=i[e],l(s,{"min-width":"".concat(r,"px")})):(s=this.createToolCell(),this.domNode.appendChild(s),this.addColCellHolderHandler(s),l(s,{"min-width":"".concat(r,"px")}))}}destroy(){return this.domNode.remove(),null}addColCellHolderHandler(e){const t=r.a.find(this.table),o=e.querySelector(".qlbt-col-tool-cell-holder");let n=!1,i=0,s=0,a=0,c=0,d={},h={},u=null;const p=e=>{e.preventDefault(),n&&(s=e.clientX,a=c+s-i>=50?s-i:50-c,l(u,{left:"".concat(h.left+h.width-1+a,"px")}))},f=r=>{r.preventDefault();const m=Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell")).indexOf(e),b=t.colGroup().children.at(m);n&&(b.format("width",c+a),l(e,{"min-width":"".concat(c+a,"px")}),i=0,s=0,a=0,c=0,n=!1,o.classList.remove("dragging")),document.removeEventListener("mousemove",p,!1),document.removeEventListener("mouseup",f,!1),d={},h={},u.remove(),u=null,t.updateTableWidth();const g=this.quill.getModule("better-table").tableSelection;g&&g.clearSelection()};o.addEventListener("mousedown",t=>{document.addEventListener("mousemove",p,!1),document.addEventListener("mouseup",f,!1),d=this.table.getBoundingClientRect(),h=e.getBoundingClientRect(),u=document.createElement("div"),l(u,{position:"fixed",top:"".concat(h.top,"px"),left:"".concat(h.left+h.width-1,"px"),zIndex:"100",height:"".concat(d.height+12+4,"px"),width:"1px",backgroundColor:"#35A7ED"}),document.body.appendChild(u),n=!0,i=t.clientX,c=h.width,o.classList.add("dragging")},!1)}colToolCells(){return Array.from(this.domNode.querySelectorAll(".qlbt-col-tool-cell"))}}const d=r.a.import("blots/block");class h extends d{static create(e){"string"==typeof e&&(e={value:e});const t=super.create(e.value);return w.forEach(o=>{e[o]&&t.setAttribute("data-".concat(o),e[o])}),v.forEach(o=>{e[o]&&t.setAttribute("data-".concat(o),e[o])}),t}static formats(e){const t={};return t.value=this.tagName.indexOf(e.tagName)+1,v.concat(w).reduce((t,o)=>(e.hasAttribute("data-".concat(o))&&(t[o]=e.getAttribute("data-".concat(o))||void 0),t),t)}format(e,t){const{row:o,cell:n,rowspan:r,colspan:l}=h.formats(this.domNode);e===h.blotName?t?super.format(e,{value:t,row:o,cell:n,rowspan:r,colspan:l}):o?this.replaceWith(x.blotName,{row:o,cell:n,rowspan:r,colspan:l}):super.format(e,t):super.format(e,t)}optimize(e){const{row:t,rowspan:o,colspan:n}=h.formats(this.domNode);if(!t||this.parent instanceof N||this.wrap(N.blotName,{row:t,colspan:n,rowspan:o}),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove();this.cache={}}}h.blotName="header",h.tagName=["H1","H2","H3","H4","H5","H6"];var u=h;const p=r.a.import("blots/break"),f=r.a.import("blots/block"),m=r.a.import("blots/container"),b=["width"],g={width:100},w=["row","cell"],v=["rowspan","colspan"],y={rowspan:1,colspan:1};class x extends f{static create(e){const t=super.create(e);return w.forEach(o=>{let n="row"===o?H:M;t.setAttribute("data-".concat(o),e[o]||n())}),v.forEach(o=>{t.setAttribute("data-".concat(o),e[o]||y[o])}),e["cell-bg"]&&t.setAttribute("data-cell-bg",e["cell-bg"]),t}static formats(e){return v.concat(w).concat(["cell-bg"]).reduce((t,o)=>(e.hasAttribute("data-".concat(o))&&(t[o]=e.getAttribute("data-".concat(o))||void 0),t),{})}format(e,t){if(v.concat(w).indexOf(e)>-1)t?this.domNode.setAttribute("data-".concat(e),t):this.domNode.removeAttribute("data-".concat(e));else if("cell-bg"===e)t?this.domNode.setAttribute("data-cell-bg",t):this.domNode.removeAttribute("data-cell-bg");else if("header"===e){if(!t)return;const{row:o,cell:n,rowspan:r,colspan:l}=x.formats(this.domNode);super.format(e,{value:t,row:o,cell:n,rowspan:r,colspan:l})}else super.format(e,t)}optimize(e){const t=this.domNode.getAttribute("data-row"),o=this.domNode.getAttribute("data-rowspan"),n=this.domNode.getAttribute("data-colspan"),r=this.domNode.getAttribute("data-cell-bg");!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName,{row:t,colspan:n,rowspan:o,"cell-bg":r}),super.optimize(e)}tableCell(){return this.parent}}x.blotName="table-cell-line",x.ClassName="qlbt-cell-line",x.tagName="DIV";class N extends m{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats()[this.children.head.statics.blotName],t=this.children.tail.formats()[this.children.tail.statics.blotName],o=this.next.children.head.formats()[this.next.children.head.statics.blotName],n=this.next.children.tail.formats()[this.next.children.tail.statics.blotName];return e.cell===t.cell&&e.cell===o.cell&&e.cell===n.cell}return!1}static create(e){const t=super.create(e);return t.setAttribute("data-row",e.row),v.forEach(o=>{e[o]&&t.setAttribute(o,e[o])}),e["cell-bg"]&&(t.setAttribute("data-cell-bg",e["cell-bg"]),t.style.backgroundColor=e["cell-bg"]),t}static formats(e){const t={};return e.hasAttribute("data-row")&&(t.row=e.getAttribute("data-row")),e.hasAttribute("data-cell-bg")&&(t["cell-bg"]=e.getAttribute("data-cell-bg")),v.reduce((t,o)=>(e.hasAttribute(o)&&(t[o]=e.getAttribute(o)),t),t)}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}formats(){const e={};return this.domNode.hasAttribute("data-row")&&(e.row=this.domNode.getAttribute("data-row")),this.domNode.hasAttribute("data-cell-bg")&&(e["cell-bg"]=this.domNode.getAttribute("data-cell-bg")),v.reduce((e,t)=>(this.domNode.hasAttribute(t)&&(e[t]=this.domNode.getAttribute(t)),e),e)}toggleAttribute(e,t){t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e)}formatChildren(e,t){this.children.forEach(o=>{o.format(e,t)})}format(e,t){v.indexOf(e)>-1?(this.toggleAttribute(e,t),this.formatChildren(e,t)):["row"].indexOf(e)>-1?(this.toggleAttribute("data-".concat(e),t),this.formatChildren(e,t)):"cell-bg"===e?(this.toggleAttribute("data-cell-bg",t),this.formatChildren(e,t),this.domNode.style.backgroundColor=t||"initial"):super.format(e,t)}optimize(e){const t=this.domNode.getAttribute("data-row");!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName,{row:t}),super.optimize(e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}}N.blotName="table",N.tagName="TD";class C extends m{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),o=this.next.children.head.formats(),n=this.next.children.tail.formats();return e.row===t.row&&e.row===o.row&&e.row===n.row}return!1}static create(e){const t=super.create(e);return t.setAttribute("data-row",e.row),t}formats(){return["row"].reduce((e,t)=>(this.domNode.hasAttribute("data-".concat(t))&&(e[t]=this.domNode.getAttribute("data-".concat(t))),e),{})}optimize(e){!this.statics.requiredContainer||this.parent instanceof this.statics.requiredContainer||this.wrap(this.statics.requiredContainer.blotName),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}C.blotName="table-row",C.tagName="TR";class q extends m{}q.blotName="table-body",q.tagName="TBODY";class A extends f{static create(e){let t=super.create(e);return b.forEach(o=>{t.setAttribute("".concat(o),e[o]||g[o])}),t}static formats(e){return b.reduce((t,o)=>(e.hasAttribute("".concat(o))&&(t[o]=e.getAttribute("".concat(o))||void 0),t),{})}format(e,t){b.indexOf(e)>-1?this.domNode.setAttribute("".concat(e),t||g[e]):super.format(e,t)}html(){return this.domNode.outerHTML}}A.blotName="table-col",A.tagName="col";class S extends m{}S.blotName="table-col-group",S.tagName="colgroup";class E extends m{static create(){return super.create()}constructor(e,t){super(e,t),this.updateTableWidth()}updateTableWidth(){setTimeout(()=>{const e=this.colGroup();if(!e)return;const t=e.children.reduce((e,t)=>e+=parseInt(t.formats()[A.blotName].width,10),0);this.domNode.style.width="".concat(t,"px")},0)}cells(e){return this.rows().map(t=>t.children.at(e))}colGroup(){return this.children.head}deleteColumns(e,t=[],o){const[n]=this.descendants(q);if(null==n||null==n.children.head)return;const r=this.descendants(N),l=[],s=[];if(r.forEach(t=>{const n=i(t.domNode.getBoundingClientRect(),o);n.x+5>e.x&&n.x1-5e.x1-5&&s.push(t)}),l.length===r.length)return this.tableDestroy(),!0;t.forEach(e=>{this.colGroup().children.at(t[0]).remove()}),l.forEach(e=>{e.remove()}),s.forEach(e=>{const o=parseInt(e.formats().colspan,10);parseInt(e.formats().width,10);e.format("colspan",o-t.length)}),this.updateTableWidth()}deleteRow(e,t){const[o]=this.descendants(q);if(null==o||null==o.children.head)return;const n=this.descendants(N),r=this.descendants(C),l=[],s=[],a=[],c=r.filter(o=>{const n=i(o.domNode.getBoundingClientRect(),t);return n.y>e.y-5&&n.y1{const n=i(o.domNode.getBoundingClientRect(),t);n.y>e.y-5&&n.y1e.y1-5&&(s.push(o),Math.abs(n.y-e.y)<5&&a.push(o))}),l.length===n.length)return void this.tableDestroy();const d=this.rows().reduce((o,n)=>{let r=i(n.domNode.getBoundingClientRect(),t);return r.y>e.y-5&&r.y1{const o=i(e.domNode.getBoundingClientRect(),t),n=e.parent.next,r=n.children.reduce((e,n)=>{const r=i(n.domNode.getBoundingClientRect(),t);return Math.abs(o.x1-r.x)<5&&(e=n),e},null);n.insertBefore(e,r),e.format("row",n.formats().row)}),l.forEach(e=>{e.remove()}),s.forEach(e=>{const t=parseInt(e.formats().rowspan,10);e.format("rowspan",t-d)}),c.forEach(e=>e.remove())}tableDestroy(){const e=r.a.find(this.scroll.domNode.parentNode),t=e.getModule("better-table");this.remove(),t.hideTableTools(),e.update(r.a.sources.USER)}insertCell(e,t){const o=M(),n=e.formats().row,r=this.scroll.create(N.blotName,Object.assign({},y,{row:n})),l=this.scroll.create(x.blotName,{row:n,cell:o});r.appendChild(l),t?e.insertBefore(r,t):e.appendChild(r)}insertColumn(e,t,o=!0,n){const[r]=this.descendants(q),[l]=this.descendants(S),s=this.descendants(A);let a=[],c=[],d=[];if(null==r||null==r.children.head)return;this.descendants(N).forEach(t=>{const r=i(t.domNode.getBoundingClientRect(),n);o?Math.abs(r.x1-e.x1)<5?a.push(t):e.x1-r.x>5&&e.x1-r.x1<-5&&c.push(t):Math.abs(r.x-e.x)<5?a.push(t):e.x-r.x>5&&e.x-r.x1<-5&&c.push(t)}),a.forEach(e=>{const t=o?e.next:e,n=M(),r=e.parent,l=r.formats().row,i=e.formats(),s=this.scroll.create(N.blotName,Object.assign({},y,{row:l,rowspan:i.rowspan})),a=this.scroll.create(x.blotName,{row:l,cell:n,rowspan:i.rowspan});s.appendChild(a),t?r.insertBefore(s,t):r.appendChild(s),d.push(s)});const h=this.scroll.create(A.blotName,!0);let u=o?s[t].next:s[t];return u?l.insertBefore(h,u):l.appendChild(h),c.forEach(e=>{const t=e.formats().colspan;e.format("colspan",parseInt(t,10)+1),d.push(e)}),d.sort((e,t)=>e.domNode.getBoundingClientRect().y-t.domNode.getBoundingClientRect().y),this.updateTableWidth(),d}insertRow(e,t,o){const[n]=this.descendants(q);if(null==n||null==n.children.head)return;const r=this.descendants(N),l=H(),s=this.scroll.create(C.blotName,{row:l});let a=[],c=[],d=[];r.forEach(n=>{const r=i(n.domNode.getBoundingClientRect(),o);t?Math.abs(r.y1-e.y1)<5?a.push(n):e.y1-r.y>5&&e.y1-r.y1<-5&&c.push(n):Math.abs(r.y-e.y)<5?a.push(n):e.y-r.y>5&&e.y-r.y1<-5&&c.push(n)});const h=(e,t)=>e.domNode.getBoundingClientRect().x-t.domNode.getBoundingClientRect().x;a.sort(h),a.forEach(e=>{const t=M(),o=e.formats(),n=this.scroll.create(N.blotName,Object.assign({},y,{row:l,colspan:o.colspan})),r=this.scroll.create(x.blotName,{row:l,cell:t,colspan:o.colspan}),i=this.scroll.create(p.blotName);r.appendChild(i),n.appendChild(r),s.appendChild(n),d.push(n)}),c.forEach(e=>{const t=parseInt(e.formats().rowspan,10);e.format("rowspan",t+1),d.push(e)});const u=this.rows().find(n=>{let r=i(n.domNode.getBoundingClientRect(),o);return t?Math.abs(r.y-e.y-e.height)<5:Math.abs(r.y-e.y)<5});return n.insertBefore(s,u),d.sort(h),d}mergeCells(e,t,o,n,r){const l=t.reduce((e,t,r)=>(0!==r?(e&&t.moveChildren(e),t.remove()):(t.format("colspan",n),t.format("rowspan",o),e=t),e),null);let i=l.domNode.getAttribute("data-row"),s=l.children.head.domNode.getAttribute("data-cell");return l.children.forEach(e=>{e.format("cell",s),e.format("row",i),e.format("colspan",n),e.format("rowspan",o)}),l}unmergeCells(e,t){let o={},n=1,r=1;e.forEach(e=>{if(o=e.formats(),n=o.rowspan,r=o.colspan,r>1){let t=e.next,o=e.row();e.format("colspan",1);for(let e=r;e>1;e--)this.insertCell(o,t)}if(n>1){let o=n,l=e.row().next;for(;o>1;){let n=l.children.reduce((o,n)=>{let r=i(e.domNode.getBoundingClientRect(),t),l=i(n.domNode.getBoundingClientRect(),t);return Math.abs(r.x1-l.x)<5&&(o=n),o},null);for(let e=r;e>0;e--)this.insertCell(l,n);o-=1,l=l.next}e.format("rowspan",1)}})}rows(){const e=this.children.tail;return null==e?[]:e.children.map(e=>e)}}E.blotName="table-container",E.className="quill-better-table",E.tagName="TABLE";class T extends m{constructor(e,t){super(e,t);const o=r.a.find(e.domNode.parentNode);t.addEventListener("scroll",e=>{const t=o.getModule("better-table");t.columnTool&&(t.columnTool.domNode.scrollLeft=e.target.scrollLeft),t.tableSelection&&t.tableSelection.selectedTds.length>0&&t.tableSelection.repositionHelpLines()},!1)}table(){return this.children.head}}function H(){const e=Math.random().toString(36).slice(2,6);return"row-".concat(e)}function M(){const e=Math.random().toString(36).slice(2,6);return"cell-".concat(e)}T.blotName="table-view",T.className="quill-better-table-wrapper",T.tagName="DIV",T.allowedChildren=[E],E.requiredContainer=T,E.allowedChildren=[q,S],q.requiredContainer=E,q.allowedChildren=[C],C.requiredContainer=q,C.allowedChildren=[N],N.requiredContainer=C,N.allowedChildren=[x,u],x.requiredContainer=N,S.allowedChildren=[A],S.requiredContainer=E,A.requiredContainer=S;const B=["left","right","top","bottom"];class O{constructor(e,t,o){if(!e)return null;this.table=e,this.quill=t,this.options=o,this.boundary={},this.selectedTds=[],this.dragging=!1,this.selectingHandler=this.mouseDownHandler.bind(this),this.clearSelectionHandler=this.clearSelection.bind(this),this.helpLinesInitial(),this.quill.root.addEventListener("mousedown",this.selectingHandler,!1),this.quill.on("text-change",this.clearSelectionHandler)}helpLinesInitial(){let e=this.quill.root.parentNode;B.forEach(t=>{this[t]=document.createElement("div"),this[t].classList.add("qlbt-selection-line"),this[t].classList.add("qlbt-selection-line-"+t),l(this[t],{position:"absolute",display:"none","background-color":"#0589f3"}),e.appendChild(this[t])})}mouseDownHandler(e){if(0!==e.button||!e.target.closest(".quill-better-table"))return;this.quill.root.addEventListener("mousemove",r,!1),this.quill.root.addEventListener("mouseup",(function e(o){t.quill.root.removeEventListener("mousemove",r,!1),t.quill.root.removeEventListener("mouseup",e,!1),t.dragging=!1}),!1);const t=this,o=e.target.closest("td[data-row]"),n=i(o.getBoundingClientRect(),this.quill.root.parentNode);function r(e){if(0!==e.button||!e.target.closest(".quill-better-table"))return;const r=e.target.closest("td[data-row]"),l=i(r.getBoundingClientRect(),t.quill.root.parentNode);t.boundary=R(n,l),t.correctBoundary(),t.selectedTds=t.computeSelectedTds(),t.repositionHelpLines(),o!==r&&t.quill.blur()}this.dragging=!0,this.boundary=R(n,n),this.correctBoundary(),this.selectedTds=this.computeSelectedTds(),this.repositionHelpLines()}correctBoundary(){r.a.find(this.table).descendants(N).forEach(e=>{let{x:t,y:o,width:n,height:r}=i(e.domNode.getBoundingClientRect(),this.quill.root.parentNode);(t+2>=this.boundary.x&&t+2<=this.boundary.x1||t-2+n>=this.boundary.x&&t-2+n<=this.boundary.x1)&&(o+2>=this.boundary.y&&o+2<=this.boundary.y1||o-2+r>=this.boundary.y&&o-2+r<=this.boundary.y1)&&(this.boundary=R(this.boundary,{x:t,y:o,width:n,height:r}))})}computeSelectedTds(){return r.a.find(this.table).descendants(N).reduce((e,t)=>{let{x:o,y:n,width:r,height:l}=i(t.domNode.getBoundingClientRect(),this.quill.root.parentNode);return o+2>=this.boundary.x&&o-2+r<=this.boundary.x1&&n+2>=this.boundary.y&&n-2+l<=this.boundary.y1&&e.push(t),e},[])}repositionHelpLines(){const e=this.table.parentNode.scrollLeft;l(this.left,{display:"block",left:"".concat(this.boundary.x-e-1,"px"),top:"".concat(this.boundary.y,"px"),height:"".concat(this.boundary.height+1,"px"),width:"1px"}),l(this.right,{display:"block",left:"".concat(this.boundary.x1-e,"px"),top:"".concat(this.boundary.y,"px"),height:"".concat(this.boundary.height+1,"px"),width:"1px"}),l(this.top,{display:"block",left:"".concat(this.boundary.x-1-e,"px"),top:"".concat(this.boundary.y,"px"),width:"".concat(this.boundary.width+1,"px"),height:"1px"}),l(this.bottom,{display:"block",left:"".concat(this.boundary.x-1-e,"px"),top:"".concat(this.boundary.y1+1,"px"),width:"".concat(this.boundary.width+1,"px"),height:"1px"})}refreshHelpLinesPosition(){const e=i(this.selectedTds[0].domNode.getBoundingClientRect(),this.quill.root.parentNode),t=i(this.selectedTds[this.selectedTds.length-1].domNode.getBoundingClientRect(),this.quill.root.parentNode);this.boundary=R(e,t),this.repositionHelpLines()}destroy(){return B.forEach(e=>{this[e].remove(),this[e]=null}),this.quill.root.removeEventListener("mousedown",this.selectingHandler,!1),this.quill.off("text-change",this.clearSelectionHandler),null}setSelection(e,t){this.boundary=R(i(e,this.quill.root.parentNode),i(t,this.quill.root.parentNode)),this.correctBoundary(),this.selectedTds=this.computeSelectedTds(),this.repositionHelpLines()}clearSelection(){this.boundary={},this.selectedTds=[],B.forEach(e=>{this[e]&&l(this[e],{display:"none"})})}}function R(e,t){let o=Math.min(e.x,t.x,e.x+e.width-1,t.x+t.width-1),n=Math.max(e.x,t.x,e.x+e.width-1,t.x+t.width-1),r=Math.min(e.y,t.y,e.y+e.height-1,t.y+t.height-1),l=Math.max(e.y,t.y,e.y+e.height-1,t.y+t.height-1);return{x:o,x1:n,y:r,y1:l,width:n-o,height:l-r}}var L=o(1),z=o.n(L),k=o(2),I=o.n(k),D=o(3),j=o.n(D),V=o(4),U=o.n(V),_=o(5),P=o.n(_),W=o(6),G=o.n(W),X=o(7),K=o.n(X),Y=o(8),$=o.n(Y),J=o(9),Q=o.n(J);const F=["white","red","yellow","blue"],Z={insertColumnRight:{text:"Insert column right",iconSrc:z.a,handler(){const e=r.a.find(this.table);let t=te(this.columnToolCells,this.boundary,(e,t)=>Math.abs(e.x+e.width-t.x1)<=5,this.quill.root.parentNode);const o=e.insertColumn(this.boundary,t,!0,this.quill.root.parentNode);this.tableColumnTool.updateToolCells(),this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(o[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(o[0].domNode.getBoundingClientRect(),o[0].domNode.getBoundingClientRect())}},insertColumnLeft:{text:"Insert column left",iconSrc:I.a,handler(){const e=r.a.find(this.table);let t=te(this.columnToolCells,this.boundary,(e,t)=>Math.abs(e.x-t.x)<=5,this.quill.root.parentNode);const o=e.insertColumn(this.boundary,t,!1,this.quill.root.parentNode);this.tableColumnTool.updateToolCells(),this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(o[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(o[0].domNode.getBoundingClientRect(),o[0].domNode.getBoundingClientRect())}},insertRowUp:{text:"Insert row up",iconSrc:j.a,handler(){const e=r.a.find(this.table).insertRow(this.boundary,!1,this.quill.root.parentNode);this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(e[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(e[0].domNode.getBoundingClientRect(),e[0].domNode.getBoundingClientRect())}},insertRowDown:{text:"Insert row down",iconSrc:U.a,handler(){const e=r.a.find(this.table).insertRow(this.boundary,!0,this.quill.root.parentNode);this.quill.update(r.a.sources.USER),this.quill.setSelection(this.quill.getIndex(e[0]),0,r.a.sources.SILENT),this.tableSelection.setSelection(e[0].domNode.getBoundingClientRect(),e[0].domNode.getBoundingClientRect())}},mergeCells:{text:"Merge selected cells",iconSrc:P.a,handler(){const e=r.a.find(this.table),t=e.rows().reduce((e,t)=>{let o=i(t.domNode.getBoundingClientRect(),this.quill.root.parentNode);return o.y>this.boundary.y-5&&o.y+o.height{let o=i(t.getBoundingClientRect(),this.quill.root.parentNode);return o.x>this.boundary.x-5&&o.x+o.width{let s=i(l.getBoundingClientRect(),n);return o(s,t)&&r.push(e.indexOf(l)),r},[])}(this.columnToolCells,this.boundary,(e,t)=>e.x+5>t.x&&e.x+e.width-5-1&&this.domNode.appendChild(n()));function n(){const e=document.createElement("div");return e.classList.add("qlbt-operation-menu-dividing"),e}this.options.color&&!1!==this.options.color&&(this.domNode.appendChild(n()),this.domNode.appendChild(function(e){const t=document.createElement("div");return t.classList.add("qlbt-operation-menu-subtitle"),t.innerText=e,t}(this.colorSubTitle)),this.domNode.appendChild(this.colorsItemCreator(this.cellColors)))}colorsItemCreator(e){const t=this,o=document.createElement("div");return o.classList.add("qlbt-operation-color-picker"),e.forEach(e=>{let n=function(e){const o=document.createElement("div");return o.classList.add("qlbt-operation-color-picker-item"),o.setAttribute("data-color",e),o.style.backgroundColor=e,o.addEventListener("click",(function(){const o=t.tableSelection.selectedTds;o&&o.length>0&&o.forEach(t=>{t.format("cell-bg",e)})}),!1),o}(e);o.appendChild(n)}),o}menuItemCreator({text:e,iconSrc:t,handler:o}){const n=document.createElement("div");n.classList.add("qlbt-operation-menu-item");const r=document.createElement("span");r.classList.add("qlbt-operation-menu-icon"),r.innerHTML=t;const l=document.createElement("span");return l.classList.add("qlbt-operation-menu-text"),l.innerText=e,n.appendChild(r),n.appendChild(l),n.addEventListener("click",o.bind(this),!1),n}}function te(e,t,o,n){return e.reduce((r,l)=>{let s=i(l.getBoundingClientRect(),n);return o(s,t)&&(r=e.indexOf(l)),r},!1)}const oe=r.a.import("delta");function ne(e,t,o){const n=e.parentNode,r="TABLE"===n.parentNode.tagName?n.parentNode:n.parentNode.parentNode,l=Array.from(r.querySelectorAll("tr")),i=Array.from(n.querySelectorAll("td")),a=l.indexOf(n)+1,c=i.indexOf(e)+1,d=e.getAttribute("colspan")||!1,h=e.getAttribute("rowspan")||!1,u=e.getAttribute("data-cell-bg")||e.style.backgroundColor;return 0===t.length()?t=(new oe).insert("\n",{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}}):(t=t.reduce((e,t)=>{if(t.insert&&"string"==typeof t.insert){const o=[];let n=t.insert,r=0;for(let e=0;e{"\n"===o?e.insert("\n",t.attributes):e.insert(o,s(t.attributes,["table","table-cell-line"]))})}else e.insert(t.insert,t.attributes);return e},new oe)).reduce((e,t)=>(t.insert&&"string"==typeof t.insert&&t.insert.startsWith("\n")?e.insert(t.insert,Object.assign({},Object.assign({},{row:a},t.attributes.table),{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d,"cell-bg":u}},s(t.attributes,["table"]))):t.attributes&&t.attributes.background&&t.attributes.background===function(e){if(/^(rgb|RGB)/.test(e)){for(var t=e.toString().match(/\d+/g),o="#",n=0;n<3;n++)o+=("0"+Number(t[n]).toString(16)).slice(-2);return o}if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){var r=e.replace(/#/,"").split("");if(6===r.length)return e;if(3===r.length){var l="#";for(n=0;n{if(t.insert&&"string"==typeof t.insert){const o=[];let n=t.insert,r=0;for(let e=0;e{"\n"===o?e.insert("\n",{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}}):e.insert(o,t.attributes)})}else e.insert(t.insert,t.attributes);return e},new oe)).reduce((e,t)=>(t.insert&&"string"==typeof t.insert&&t.insert.startsWith("\n")?e.insert(t.insert,Object.assign({},{"table-cell-line":{row:a,cell:c,rowspan:h,colspan:d}})):e.insert(t.insert,Object.assign({},s(t.attributes,["table","table-cell-line"]))),e),new oe)}function le(e,t,o){let n=new oe;const r=e.querySelector("tr");if(null===r)return n;const l=Array.from(r.querySelectorAll("td")).concat(Array.from(r.querySelectorAll("th"))).reduce((e,t)=>{const o=t.getAttribute("colspan")||1;return e+=parseInt(o,10)},0),i=e.querySelectorAll("col").length;if(i===l)return t;{for(let e=0;e(t.insert(o.insert,o.attributes),o.attributes&&o.attributes["table-col"]&&(e+=o.insert.length,e===i&&(t=t.concat(n))),t),new oe)}}const ie=r.a.import("core/module"),se=r.a.import("delta");class ae extends ie{static register(){r.a.register(A,!0),r.a.register(S,!0),r.a.register(x,!0),r.a.register(N,!0),r.a.register(C,!0),r.a.register(q,!0),r.a.register(E,!0),r.a.register(T,!0),r.a.register(T,!0)}constructor(e,t){super(e,t),this.quill.root.addEventListener("click",o=>{const n=a(o);if(!n||n.length<=0)return;const r=n.filter(e=>e.tagName&&"TABLE"===e.tagName.toUpperCase()&&e.classList.contains("quill-better-table"))[0];if(r){if(this.table===r)return;this.table&&this.hideTableTools(),this.showTableTools(r,e,t)}else this.table&&this.hideTableTools()},!1),this.quill.root.addEventListener("contextmenu",o=>{if(!this.table)return!0;o.preventDefault();const n=a(o);if(!n||n.length<=0)return;const r=n.filter(e=>e.tagName&&"TABLE"===e.tagName.toUpperCase()&&e.classList.contains("quill-better-table"))[0],l=n.filter(e=>e.tagName&&"TR"===e.tagName.toUpperCase()&&e.getAttribute("data-row"))[0],i=n.filter(e=>e.tagName&&"TD"===e.tagName.toUpperCase()&&e.getAttribute("data-row"))[0];let s=this.tableSelection.selectedTds.map(e=>e.domNode).includes(i);(this.tableSelection.selectedTds.length<=0||!s)&&this.tableSelection.setSelection(i.getBoundingClientRect(),i.getBoundingClientRect()),this.tableOperationMenu&&(this.tableOperationMenu=this.tableOperationMenu.destroy()),r&&(this.tableOperationMenu=new ee({table:r,row:l,cell:i,left:o.pageX,top:o.pageY},e,t.operationMenu))},!1);e.getModule("keyboard");e.keyboard.addBinding({key:"Backspace"},{},(function(e,t){if(0===e.index||this.quill.getLength()<=1)return!0;const[o]=this.quill.getLine(e.index);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(null!=t&&"table-cell-line"===t.statics.blotName&&"table-cell-line"!==o.statics.blotName)return!1}return!0}));let o=e.keyboard.bindings.Backspace.pop();e.keyboard.bindings.Backspace.splice(0,1,o),e.clipboard.addMatcher("td",ne),e.clipboard.addMatcher("th",re),e.clipboard.addMatcher("table",le),e.clipboard.matchers=e.clipboard.matchers.filter(e=>"tr"!==e[0])}getTable(e=this.quill.getSelection()){if(null==e)return[null,null,null,-1];const[t,o]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==x.blotName)return[null,null,null,-1];const n=t.tableCell(),r=n.row();return[r.table(),r,n,o]}insertTable(e,t){const o=this.quill.getSelection(!0);if(null==o)return;let n=this.quill.getLeaf(o.index)[0],l=(new se).retain(o.index);!function e(t){return!(!t||!t.parent)&&(o=t.parent,o.statics.blotName===N.blotName||e(t.parent));var o}(n)?(l.insert("\n"),l=new Array(t).fill("\n").reduce((e,t)=>(e.insert(t,{"table-col":!0}),e),l),l=new Array(e).fill(0).reduce(e=>{let o=H();return new Array(t).fill("\n").reduce((e,t)=>(e.insert(t,{"table-cell-line":{row:o,cell:M()}}),e),e)},l),this.quill.updateContents(l,r.a.sources.USER),this.quill.setSelection(o.index+t+1,r.a.sources.API)):console.warn("Can not insert table into a table cell.")}showTableTools(e,t,o){this.table=e,this.columnTool=new c(e,t,o),this.tableSelection=new O(e,t,o)}hideTableTools(){this.columnTool&&this.columnTool.destroy(),this.tableSelection&&this.tableSelection.destroy(),this.tableOperationMenu&&this.tableOperationMenu.destroy(),this.columnTool=null,this.tableSelection=null,this.tableOperationMenu=null,this.table=null}}function ce(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table-cell-line"],handler(t,o){const n=e?"prev":"next";if(null!=o.line[n])return!0;const l=o.line.parent,i=l.parent[n];if(null!=i&&"table-row"===i.statics.blotName){let e=i.children.head,t=parseInt(e.formats().colspan,10),o=l,n=parseInt(o.formats().colspan,10);for(;null!=o.prev;)o=o.prev,n+=parseInt(o.formats().colspan,10);for(;null!=e.next&&t0&&this.quill.scroll.deleteAt(e.index,e.length);const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,o.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{});this.quill.insertText(e.index,"\n",n["table-cell-line"],r.a.sources.USER),this.quill.setSelection(e.index+1,r.a.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(e=>{null==n[e]&&(Array.isArray(t.format[e])||"link"!==e&&this.quill.format(e,t.format[e],r.a.sources.USER))})}},"table-cell-line up":ce(!0),"table-cell-line down":ce(!1),"down-to-table":{key:"ArrowDown",collapsed:!0,handler(e,t){const o=t.line.next;if(o&&"table-view"===o.statics.blotName){const e=o.table().rows()[0].children.head.children.head;return this.quill.setSelection(e.offset(this.quill.scroll),0,r.a.sources.USER),!1}return!0}},"up-to-table":{key:"ArrowUp",collapsed:!0,handler(e,t){const o=t.line.prev;if(o&&"table-view"===o.statics.blotName){const e=o.table().rows(),t=e[e.length-1].children.head.children.head;return this.quill.setSelection(t.offset(this.quill.scroll),0,r.a.sources.USER),!1}return!0}}};t.default=ae}]).default})); \ No newline at end of file