quill-table-up 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +61 -48
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/e2e/table-selection.test.ts +38 -0
- package/src/__tests__/unit/table-cell-merge.test.ts +295 -0
- package/src/__tests__/unit/table-clipboard.test.ts +496 -170
- package/src/__tests__/unit/table-insert.test.ts +782 -0
- package/src/__tests__/unit/table-redo-undo.test.ts +29 -55
- package/src/__tests__/unit/table-remove.test.ts +342 -0
- package/src/__tests__/unit/utils.ts +8 -3
- package/src/formats/overrides/block.ts +4 -1
- package/src/formats/table-cell-format.ts +60 -2
- package/src/formats/table-cell-inner-format.ts +12 -5
- package/src/index.ts +1 -0
- package/src/modules/table-paste-parser.ts +15 -4
- package/src/modules/table-selection.ts +50 -2
- package/src/style/index.less +8 -0
- package/src/table-up.ts +21 -44
- package/src/utils/blot-helper.ts +90 -0
- package/src/utils/constants.ts +4 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/position.ts +30 -0
- package/src/utils/scroll-event-handle.ts +15 -0
- package/src/utils/transformer.ts +19 -0
- package/src/utils/types.ts +8 -3
- package/src/utils/utils.ts +0 -137
- package/src/__tests__/unit/table-insert-blot.test.ts +0 -357
- package/src/__tests__/unit/table-insert-remove-merge.test.ts +0 -1165
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ Enhancement of quill table module
|
|
|
21
21
|
npm install quill-table-up
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
> the registe module name is used internal. so if you want to change it, place use the function [`updateTableConstants`](https://github.com/zzxming/quill-table-up?tab=readme-ov-file#change-internal-constants-variable)
|
|
25
|
+
|
|
24
26
|
```js
|
|
25
27
|
import Quill from 'quill';
|
|
26
28
|
import TableUp, { TableAlign, TableMenuContextmenu, TableResizeBox, TableResizeScale, TableSelection, TableVirtualScrollbar } from 'quill-table-up';
|
|
@@ -261,11 +263,20 @@ class ScrollBlot extends ScrollOverride {
|
|
|
261
263
|
|
|
262
264
|
### Change internal constants variable
|
|
263
265
|
|
|
264
|
-
|
|
266
|
+
If it's not necessary, you should import constants variable from `quill-table-up` directly but not edit it.
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
import { blotName, tableUpEvent, tableUpInternal, tableUpSize, } from 'quill-table-up';
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
<hr>
|
|
273
|
+
|
|
274
|
+
You can change internal constants variable by importing `updateTableConstants` from `quill-table-up` and call it before `TableUp` registed.
|
|
265
275
|
|
|
266
276
|
It helps to migrate from other table modules with the same data structure.
|
|
267
277
|
|
|
268
|
-
[
|
|
278
|
+
- [full variable demo](https://github.com/zzxming/quill-table-up/blob/master/docs/update-constants.js)
|
|
279
|
+
- [change blot name that in delta demo](https://github.com/zzxming/quill-table-up/blob/master/docs/update-formats-value.js)
|
|
269
280
|
|
|
270
281
|
If you change the `TableWrapperFormat` blot name, you also need to add new css style to make toolbar icon have correct style.
|
|
271
282
|
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up{width:28px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label{padding:2px 4px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label svg{position:static;margin-top:0}.ql-toolbar .ql-picker.ql-expanded .ql-picker-options{z-index:1}.ql-editor .ql-table{display:table;border-collapse:collapse;table-layout:fixed;width:auto}.ql-editor .ql-table[data-full]{width:100%}.ql-editor .ql-table-wrapper{width:100%;overflow:auto;scrollbar-width:none}.ql-editor .ql-table-cell{padding:8px 12px;border-color:transparent;font-size:14px;outline:0;overflow:auto}.ql-editor .ql-table-cell-inner{display:inline-block;min-width:100%;word-break:break-word;outline:0}.ql-editor .ql-table col{border-collapse:separate;text-indent:initial;display:table-column;table-layout:fixed}.ql-editor .ql-table td{border:1px solid #a1a1aa}.table-up-toolbox{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}.table-up-toolbox *{pointer-events:all}.table-up-tooltip{position:absolute;z-index:20;padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;color:#fff;white-space:nowrap;background-color:#303133;transition:opacity .15s linear}.table-up-tooltip.transparent{opacity:0}.table-up-tooltip.hidden{display:none}.table-up-button{--table-btn-color:#606266;--table-btn-bg-hover:#f3f4f6;--table-btn-color-border:#dcdfe6;--table-btn-border:0.0625rem solid var(--table-btn-color-border);--table-btn-confirm-color-border:#409eff;--table-btn-confirm-bg:#409eff;--table-btn-confirm-hover:#79bbff;--table-btn-confirm-outline-focus-visible:0.125rem solid #a0cfff;box-sizing:border-box;display:inline-flex;height:2rem;line-height:1;margin:0;padding:.5rem 1rem;border-radius:.25rem;border:var(--table-btn-border);color:var(--table-btn-color);background-color:transparent;font-size:.875rem;cursor:pointer}.table-up-button+.table-up-button{margin-left:.375rem}.table-up-button:hover{background-color:var(--table-btn-bg-hover)}.table-up-button.confirm{border-color:var(--table-btn-confirm-color-border);background-color:var(--table-btn-confirm-bg);color:#fff}.table-up-button.confirm:hover{border-color:var(--table-btn-confirm-hover);background-color:var(--table-btn-confirm-hover)}.table-up-button.confirm:focus-visible{outline:var(--table-btn-confirm-outline-focus-visible);outline-offset:.0625rem}.table-up-dialog{--dialog-bg:rgba(0, 0, 0, 0.5);--dialog-color-border:#ebeef5;--dialog-color-boxshadow:rgba(0, 0, 0, 0.12);--dialog-border:0.0625rem solid var(--dialog-color-border);--dialog-boxshadow:0 0 0.75rem var(--dialog-color-boxshadow);position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--dialog-bg);overflow:auto}.table-up-dialog__overlay{position:fixed;top:0;right:0;bottom:0;left:0;padding:1rem;overflow:auto;text-align:center}.table-up-dialog__overlay::after{content:'';display:inline-block;height:100%;width:0;vertical-align:middle}.table-up-dialog__content{display:inline-block;max-width:50vw;width:100%;vertical-align:middle;background-color:#fff;border-radius:.25rem;border:var(--dialog-border);font-size:1.125rem;box-shadow:var(--dialog-boxshadow);text-align:left;overflow:hidden;box-sizing:border-box}.table-up-color-picker{--color-picker-bg-color:#ffffff;box-sizing:border-box;display:inline-flex;flex-direction:column;width:16.75rem;padding:.5rem;border-radius:.375rem;background:var(--color-picker-bg-color);box-shadow:0 0 .375rem #b2b5b8}.table-up-color-picker__content{box-sizing:border-box;width:100%;height:11.75rem;padding-top:.5rem}.table-up-color-picker__selector{width:14.375rem;height:9.375rem;position:absolute}.table-up-color-picker__background{width:100%;height:100%;background:linear-gradient(to top,#000 0,rgba(0,0,0,0) 100%),linear-gradient(to right,#fff 0,rgba(255,255,255,0) 100%)}.table-up-color-picker__background-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;top:0;left:14.375rem;border-radius:100%;width:.625rem;height:.625rem;transform:translate(-.3125rem,-.3125rem)}.table-up-color-picker__hue{width:.75rem;height:9.375rem;margin-left:15rem;position:absolute;background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.table-up-color-picker__hue-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;left:0;width:1rem;height:.625rem;transform:translate(-.125rem,-.3125rem)}.table-up-color-picker__alpha{width:14.375rem;height:.75rem;position:absolute;margin-top:10rem;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(135deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(135deg,transparent 75%,#ccc 75%);background-size:.75rem .75rem;background-position:0 0,.375rem 0,.375rem -.375rem,0 .375rem}.table-up-color-picker__alpha-bg{position:relative;height:100%;background:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 100%)}.table-up-color-picker__alpha-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;top:0;width:.625rem;height:1rem;transform:translate(-.3125rem,-.125rem)}.table-up-color-picker__action{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;width:100%;padding-top:.5rem;border-top:.0625rem solid #e9ecef}.table-up-color-picker__action-item{flex:1;display:inline-flex;align-items:center;font-size:.75rem}.table-up-color-picker__input{box-sizing:border-box;width:100%;height:1.375rem;margin-left:.125rem;padding:.125rem 0 .125rem .25rem;background-color:#fff;border:.0625rem solid #ced4da;border-radius:.25rem;outline:0;color:#405057}.table-up-tooltip .table-up-color-picker{--color-picker-bg-color:transparent;box-shadow:none;width:15.75rem;padding:.5rem 0}.ql-container .table-up-selection{--select-color:#0589f340;display:none;position:absolute;overflow:hidden;pointer-events:none}.ql-container .table-up-selection__line{position:absolute;background-color:var(--select-color);pointer-events:none}.table-up-resize-line__col,.table-up-resize-line__row{position:absolute;z-index:0}.table-up-resize-line__col::after,.table-up-resize-line__col::before,.table-up-resize-line__row::after,.table-up-resize-line__row::before{content:'';display:block;position:absolute;top:0;z-index:1}.table-up-resize-line__row{height:.0625rem;cursor:ns-resize}.table-up-resize-line__row::after,.table-up-resize-line__row::before{width:100%;height:.5rem}.table-up-resize-line__row::before{transform:translateY(-.5rem)}.table-up-resize-line__col{width:.0625rem;cursor:ew-resize}.table-up-resize-line__col::after,.table-up-resize-line__col::before{height:100%;width:.5rem}.table-up-resize-line__col::before{transform:translateX(-.5rem)}.table-up-resize-box{position:absolute;z-index:0}.table-up-resize-box.is-hidden{display:none}.table-up-resize-box.is-align-right .table-up-resize-box__col-separator{left:-.125rem}.table-up-resize-box.is-align-right .table-up-resize-box__corner{border-left-width:.0625rem;border-right-width:.0625rem;border-top-left-radius:0;border-top-right-radius:50%}.table-up-resize-box__col,.table-up-resize-box__row{position:absolute;top:0;left:0;overflow:hidden}.table-up-resize-box__col-wrapper,.table-up-resize-box__row-wrapper{display:flex}.table-up-resize-box__col-header,.table-up-resize-box__row-header{position:relative;flex-shrink:0;background-color:#f3f4f5;border:.0625rem solid #ccc}.table-up-resize-box__col-wrapper{height:100%}.table-up-resize-box__col-header{height:100%;cursor:pointer;border-right-color:transparent}.table-up-resize-box__col-header:last-child{border-right-color:#ccc}.table-up-resize-box__col-separator{position:absolute;top:0;bottom:0;right:-.125rem;width:.125rem;cursor:ew-resize;z-index:0}.table-up-resize-box__col-separator::after{right:-.375rem}.table-up-resize-box__col-separator::before{left:-.375rem}.table-up-resize-box__col-separator::after,.table-up-resize-box__col-separator::before{content:'';position:absolute;top:0;display:block;width:.5rem;height:100%;z-index:1}.table-up-resize-box__row-wrapper{flex-direction:column;width:100%}.table-up-resize-box__row-header{width:100%;cursor:pointer;border-bottom-color:transparent}.table-up-resize-box__row-header:last-child{border-bottom-color:#ccc}.table-up-resize-box__row-separator{position:absolute;left:0;right:0;bottom:-.125rem;height:.125rem;cursor:ns-resize;z-index:0}.table-up-resize-box__row-separator::after{bottom:-.375rem}.table-up-resize-box__row-separator::before{top:-.375rem}.table-up-resize-box__row-separator::after,.table-up-resize-box__row-separator::before{content:'';position:absolute;left:0;display:block;width:100%;height:.5rem;z-index:1}.table-up-resize-box__corner{position:absolute;top:0;left:0;background-color:#f3f4f5;border:.0625rem solid #ccc;border-right-width:0;border-bottom-width:0;border-top-left-radius:50%;cursor:pointer}.table-up-drag-line{position:fixed;z-index:0;background-color:#409eff}.table-up-drag-line.is-col{width:.125rem;cursor:ew-resize}.table-up-drag-line.is-row{height:.125rem;cursor:ns-resize}.table-up-scale{position:absolute;top:0;left:0;overflow:hidden;pointer-events:none}.table-up-scale__block{position:absolute;top:0;left:0;transform:translate(-100%,-100%);width:.75rem;height:.75rem;background-color:#f1f5f9;border:.0625rem solid grey;cursor:nw-resize;pointer-events:all}.table-up-scale.is-align-right .table-up-scale__block{cursor:ne-resize}.table-up-scale.is-hidden{display:none}.table-up-scrollbar{position:absolute;z-index:1;transition:opacity .15s linear}.table-up-scrollbar__container{position:relative}.table-up-scrollbar.is-transparent{opacity:0}.table-up-scrollbar.is-vertical{top:.125rem;bottom:.125rem;left:-.5rem;width:.375rem}.table-up-scrollbar.is-vertical .table-up-scrollbar__thumb{width:100%}.table-up-scrollbar.is-horizontal{bottom:.125rem;left:.125rem;right:.125rem;height:.375rem}.table-up-scrollbar.is-horizontal .table-up-scrollbar__thumb{height:100%}.table-up-scrollbar__thumb{border-radius:.3125rem;background-color:#d2d2d2;cursor:pointer}.table-up-scrollbar__thumb:hover{background-color:#a1a1aa}.table-up-scrollbar--origin.ql-container .ql-table-wrapper{scrollbar-width:inherit}.table-up-align,.table-up-menu{position:absolute;z-index:1;display:none;align-items:center;padding:.25rem;border-radius:.375rem;box-shadow:0 0 .5rem rgba(0,0,0,.5);background-color:#fff;font-size:.875rem}.table-up-align__item,.table-up-menu__item{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.25rem;cursor:pointer}.table-up-align__item:hover,.table-up-menu__item:hover{background-color:#eee}.table-up-align__item.is-break,.table-up-menu__item.is-break{align-self:stretch;width:.0625rem;padding:0;margin:.125rem .25rem;background-color:#a3a3a3;cursor:default}.table-up-align .icon,.table-up-menu .icon{display:flex;flex-shrink:0;font-size:1.25rem}.table-up-align span,.table-up-menu span{text-wrap:nowrap}.table-up-menu.is-contextmenu{flex-direction:column;padding:.25rem .5rem;max-height:21.875rem;overflow-y:auto;overflow-x:hidden}.table-up-menu.is-contextmenu .table-up-menu__item{display:flex;justify-content:flex-start;width:100%;gap:.25rem;cursor:pointer}.table-up-menu.is-contextmenu .is-break{width:100%;height:.0625rem;flex-shrink:0;margin:.25rem 0;background-color:#a3a3a3}.table-up-align--active{display:flex}.table-up-align .icon{width:1.25rem;height:1.25rem}.table-up-color-map{display:flex;flex-direction:column}.table-up-color-map--used{display:flex;align-items:center;justify-content:center;flex-direction:row-reverse;margin-top:.25rem;padding-top:.25rem;border-top:.0625rem solid #ccc}.table-up-color-map__content{display:flex;flex-direction:column}.table-up-color-map__content-row{display:flex;align-items:center;justify-content:center;gap:.25rem}.table-up-color-map__item{width:.875rem;height:.875rem;margin:.125rem;border:.0625rem solid #a3a3a3;cursor:pointer}.table-up-color-map__btn{display:flex;align-items:center;justify-content:center;flex:1;height:1.25rem;padding:0 .375rem;color:#303133;background-color:#fff;cursor:pointer}.table-up-color-map__btn:hover{background-color:#edeeef}
|
|
1
|
+
.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up{width:28px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label{padding:2px 4px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label svg{position:static;margin-top:0}.ql-toolbar .ql-picker.ql-expanded .ql-picker-options{z-index:1}.ql-editor .ql-table{display:table;border-collapse:collapse;table-layout:fixed;width:auto}.ql-editor .ql-table[data-full]{width:100%}.ql-editor .ql-table-wrapper{width:100%;overflow:auto;scrollbar-width:none}.ql-editor .ql-table-cell{padding:8px 12px;border-color:transparent;font-size:14px;outline:0;overflow:auto}.ql-editor .ql-table-cell-inner{display:inline-block;min-width:100%;word-break:break-word;outline:0}.ql-editor .ql-table col{border-collapse:separate;text-indent:initial;display:table-column;table-layout:fixed}.ql-editor .ql-table tr+tr td{border-top:none}.ql-editor .ql-table td{border:1px solid #a1a1aa}.ql-editor .ql-table td+td{border-left:none}.table-up-toolbox{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}.table-up-toolbox *{pointer-events:all}.table-up-tooltip{position:absolute;z-index:20;padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;color:#fff;white-space:nowrap;background-color:#303133;transition:opacity .15s linear}.table-up-tooltip.transparent{opacity:0}.table-up-tooltip.hidden{display:none}.table-up-button{--table-btn-color:#606266;--table-btn-bg-hover:#f3f4f6;--table-btn-color-border:#dcdfe6;--table-btn-border:0.0625rem solid var(--table-btn-color-border);--table-btn-confirm-color-border:#409eff;--table-btn-confirm-bg:#409eff;--table-btn-confirm-hover:#79bbff;--table-btn-confirm-outline-focus-visible:0.125rem solid #a0cfff;box-sizing:border-box;display:inline-flex;height:2rem;line-height:1;margin:0;padding:.5rem 1rem;border-radius:.25rem;border:var(--table-btn-border);color:var(--table-btn-color);background-color:transparent;font-size:.875rem;cursor:pointer}.table-up-button+.table-up-button{margin-left:.375rem}.table-up-button:hover{background-color:var(--table-btn-bg-hover)}.table-up-button.confirm{border-color:var(--table-btn-confirm-color-border);background-color:var(--table-btn-confirm-bg);color:#fff}.table-up-button.confirm:hover{border-color:var(--table-btn-confirm-hover);background-color:var(--table-btn-confirm-hover)}.table-up-button.confirm:focus-visible{outline:var(--table-btn-confirm-outline-focus-visible);outline-offset:.0625rem}.table-up-dialog{--dialog-bg:rgba(0, 0, 0, 0.5);--dialog-color-border:#ebeef5;--dialog-color-boxshadow:rgba(0, 0, 0, 0.12);--dialog-border:0.0625rem solid var(--dialog-color-border);--dialog-boxshadow:0 0 0.75rem var(--dialog-color-boxshadow);position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--dialog-bg);overflow:auto}.table-up-dialog__overlay{position:fixed;top:0;right:0;bottom:0;left:0;padding:1rem;overflow:auto;text-align:center}.table-up-dialog__overlay::after{content:'';display:inline-block;height:100%;width:0;vertical-align:middle}.table-up-dialog__content{display:inline-block;max-width:50vw;width:100%;vertical-align:middle;background-color:#fff;border-radius:.25rem;border:var(--dialog-border);font-size:1.125rem;box-shadow:var(--dialog-boxshadow);text-align:left;overflow:hidden;box-sizing:border-box}.table-up-color-picker{--color-picker-bg-color:#ffffff;box-sizing:border-box;display:inline-flex;flex-direction:column;width:16.75rem;padding:.5rem;border-radius:.375rem;background:var(--color-picker-bg-color);box-shadow:0 0 .375rem #b2b5b8}.table-up-color-picker__content{box-sizing:border-box;width:100%;height:11.75rem;padding-top:.5rem}.table-up-color-picker__selector{width:14.375rem;height:9.375rem;position:absolute}.table-up-color-picker__background{width:100%;height:100%;background:linear-gradient(to top,#000 0,rgba(0,0,0,0) 100%),linear-gradient(to right,#fff 0,rgba(255,255,255,0) 100%)}.table-up-color-picker__background-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;top:0;left:14.375rem;border-radius:100%;width:.625rem;height:.625rem;transform:translate(-.3125rem,-.3125rem)}.table-up-color-picker__hue{width:.75rem;height:9.375rem;margin-left:15rem;position:absolute;background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.table-up-color-picker__hue-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;left:0;width:1rem;height:.625rem;transform:translate(-.125rem,-.3125rem)}.table-up-color-picker__alpha{width:14.375rem;height:.75rem;position:absolute;margin-top:10rem;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(135deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(135deg,transparent 75%,#ccc 75%);background-size:.75rem .75rem;background-position:0 0,.375rem 0,.375rem -.375rem,0 .375rem}.table-up-color-picker__alpha-bg{position:relative;height:100%;background:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 100%)}.table-up-color-picker__alpha-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;top:0;width:.625rem;height:1rem;transform:translate(-.3125rem,-.125rem)}.table-up-color-picker__action{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;width:100%;padding-top:.5rem;border-top:.0625rem solid #e9ecef}.table-up-color-picker__action-item{flex:1;display:inline-flex;align-items:center;font-size:.75rem}.table-up-color-picker__input{box-sizing:border-box;width:100%;height:1.375rem;margin-left:.125rem;padding:.125rem 0 .125rem .25rem;background-color:#fff;border:.0625rem solid #ced4da;border-radius:.25rem;outline:0;color:#405057}.table-up-tooltip .table-up-color-picker{--color-picker-bg-color:transparent;box-shadow:none;width:15.75rem;padding:.5rem 0}.ql-container .table-up-selection{--select-color:#0589f340;display:none;position:absolute;overflow:hidden;pointer-events:none}.ql-container .table-up-selection__line{position:absolute;background-color:var(--select-color);pointer-events:none}.table-up-resize-line__col,.table-up-resize-line__row{position:absolute;z-index:0}.table-up-resize-line__col::after,.table-up-resize-line__col::before,.table-up-resize-line__row::after,.table-up-resize-line__row::before{content:'';display:block;position:absolute;top:0;z-index:1}.table-up-resize-line__row{height:.0625rem;cursor:ns-resize}.table-up-resize-line__row::after,.table-up-resize-line__row::before{width:100%;height:.5rem}.table-up-resize-line__row::before{transform:translateY(-.5rem)}.table-up-resize-line__col{width:.0625rem;cursor:ew-resize}.table-up-resize-line__col::after,.table-up-resize-line__col::before{height:100%;width:.5rem}.table-up-resize-line__col::before{transform:translateX(-.5rem)}.table-up-resize-box{position:absolute;z-index:0}.table-up-resize-box.is-hidden{display:none}.table-up-resize-box.is-align-right .table-up-resize-box__col-separator{left:-.125rem}.table-up-resize-box.is-align-right .table-up-resize-box__corner{border-left-width:.0625rem;border-right-width:.0625rem;border-top-left-radius:0;border-top-right-radius:50%}.table-up-resize-box__col,.table-up-resize-box__row{position:absolute;top:0;left:0;overflow:hidden}.table-up-resize-box__col-wrapper,.table-up-resize-box__row-wrapper{display:flex}.table-up-resize-box__col-header,.table-up-resize-box__row-header{position:relative;flex-shrink:0;background-color:#f3f4f5;border:.0625rem solid #ccc}.table-up-resize-box__col-wrapper{height:100%}.table-up-resize-box__col-header{height:100%;cursor:pointer;border-right-color:transparent}.table-up-resize-box__col-header:last-child{border-right-color:#ccc}.table-up-resize-box__col-separator{position:absolute;top:0;bottom:0;right:-.125rem;width:.125rem;cursor:ew-resize;z-index:0}.table-up-resize-box__col-separator::after{right:-.375rem}.table-up-resize-box__col-separator::before{left:-.375rem}.table-up-resize-box__col-separator::after,.table-up-resize-box__col-separator::before{content:'';position:absolute;top:0;display:block;width:.5rem;height:100%;z-index:1}.table-up-resize-box__row-wrapper{flex-direction:column;width:100%}.table-up-resize-box__row-header{width:100%;cursor:pointer;border-bottom-color:transparent}.table-up-resize-box__row-header:last-child{border-bottom-color:#ccc}.table-up-resize-box__row-separator{position:absolute;left:0;right:0;bottom:-.125rem;height:.125rem;cursor:ns-resize;z-index:0}.table-up-resize-box__row-separator::after{bottom:-.375rem}.table-up-resize-box__row-separator::before{top:-.375rem}.table-up-resize-box__row-separator::after,.table-up-resize-box__row-separator::before{content:'';position:absolute;left:0;display:block;width:100%;height:.5rem;z-index:1}.table-up-resize-box__corner{position:absolute;top:0;left:0;background-color:#f3f4f5;border:.0625rem solid #ccc;border-right-width:0;border-bottom-width:0;border-top-left-radius:50%;cursor:pointer}.table-up-drag-line{position:fixed;z-index:0;background-color:#409eff}.table-up-drag-line.is-col{width:.125rem;cursor:ew-resize}.table-up-drag-line.is-row{height:.125rem;cursor:ns-resize}.table-up-scale{position:absolute;top:0;left:0;overflow:hidden;pointer-events:none}.table-up-scale__block{position:absolute;top:0;left:0;transform:translate(-100%,-100%);width:.75rem;height:.75rem;background-color:#f1f5f9;border:.0625rem solid grey;cursor:nw-resize;pointer-events:all}.table-up-scale.is-align-right .table-up-scale__block{cursor:ne-resize}.table-up-scale.is-hidden{display:none}.table-up-scrollbar{position:absolute;z-index:1;transition:opacity .15s linear}.table-up-scrollbar__container{position:relative}.table-up-scrollbar.is-transparent{opacity:0}.table-up-scrollbar.is-vertical{top:.125rem;bottom:.125rem;left:-.5rem;width:.375rem}.table-up-scrollbar.is-vertical .table-up-scrollbar__thumb{width:100%}.table-up-scrollbar.is-horizontal{bottom:.125rem;left:.125rem;right:.125rem;height:.375rem}.table-up-scrollbar.is-horizontal .table-up-scrollbar__thumb{height:100%}.table-up-scrollbar__thumb{border-radius:.3125rem;background-color:#d2d2d2;cursor:pointer}.table-up-scrollbar__thumb:hover{background-color:#a1a1aa}.table-up-scrollbar--origin.ql-container .ql-table-wrapper{scrollbar-width:inherit}.table-up-align,.table-up-menu{position:absolute;z-index:1;display:none;align-items:center;padding:.25rem;border-radius:.375rem;box-shadow:0 0 .5rem rgba(0,0,0,.5);background-color:#fff;font-size:.875rem}.table-up-align__item,.table-up-menu__item{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.25rem;cursor:pointer}.table-up-align__item:hover,.table-up-menu__item:hover{background-color:#eee}.table-up-align__item.is-break,.table-up-menu__item.is-break{align-self:stretch;width:.0625rem;padding:0;margin:.125rem .25rem;background-color:#a3a3a3;cursor:default}.table-up-align .icon,.table-up-menu .icon{display:flex;flex-shrink:0;font-size:1.25rem}.table-up-align span,.table-up-menu span{text-wrap:nowrap}.table-up-menu.is-contextmenu{flex-direction:column;padding:.25rem .5rem;max-height:21.875rem;overflow-y:auto;overflow-x:hidden}.table-up-menu.is-contextmenu .table-up-menu__item{display:flex;justify-content:flex-start;width:100%;gap:.25rem;cursor:pointer}.table-up-menu.is-contextmenu .is-break{width:100%;height:.0625rem;flex-shrink:0;margin:.25rem 0;background-color:#a3a3a3}.table-up-align--active{display:flex}.table-up-align .icon{width:1.25rem;height:1.25rem}.table-up-color-map{display:flex;flex-direction:column}.table-up-color-map--used{display:flex;align-items:center;justify-content:center;flex-direction:row-reverse;margin-top:.25rem;padding-top:.25rem;border-top:.0625rem solid #ccc}.table-up-color-map__content{display:flex;flex-direction:column}.table-up-color-map__content-row{display:flex;align-items:center;justify-content:center;gap:.25rem}.table-up-color-map__item{width:.875rem;height:.875rem;margin:.125rem;border:.0625rem solid #a3a3a3;cursor:pointer}.table-up-color-map__btn{display:flex;align-items:center;justify-content:center;flex:1;height:1.25rem;padding:0 .375rem;color:#303133;background-color:#fff;cursor:pointer}.table-up-color-map__btn:hover{background-color:#edeeef}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,12 +5,6 @@ import Picker from 'quill/ui/picker';
|
|
|
5
5
|
import TypeBlock, { BlockEmbed as BlockEmbed$1 } from 'quill/blots/block';
|
|
6
6
|
import { Delta } from 'quill/core';
|
|
7
7
|
|
|
8
|
-
interface ColorPickerOptions {
|
|
9
|
-
color: string;
|
|
10
|
-
onChange: (color: string) => void;
|
|
11
|
-
}
|
|
12
|
-
declare const createColorPicker: (options?: Partial<ColorPickerOptions>) => HTMLDivElement;
|
|
13
|
-
|
|
14
8
|
declare const Container: typeof Parchment.ContainerBlot;
|
|
15
9
|
declare class ContainerFormat extends Container {
|
|
16
10
|
static tagName: string;
|
|
@@ -41,11 +35,13 @@ declare class TableCellFormat extends ContainerFormat {
|
|
|
41
35
|
static create(value: TableCellValue): HTMLElement;
|
|
42
36
|
static formats(domNode: HTMLElement): Record<string, any>;
|
|
43
37
|
setFormatValue(name: string, value?: any): void;
|
|
38
|
+
setStyleBoder(name: string, value?: any): void;
|
|
44
39
|
get tableId(): string;
|
|
45
40
|
get rowId(): string;
|
|
46
41
|
get colId(): string;
|
|
47
42
|
get rowspan(): number;
|
|
48
43
|
get colspan(): number;
|
|
44
|
+
getColumnIndex(): number;
|
|
49
45
|
getCellInner(): TableCellInnerFormat;
|
|
50
46
|
checkMerge(): boolean;
|
|
51
47
|
optimize(context: Record<string, any>): void;
|
|
@@ -59,6 +55,7 @@ declare class TableCellInnerFormat extends ContainerFormat {
|
|
|
59
55
|
static defaultChild: Parchment.BlotConstructor;
|
|
60
56
|
parent: TableCellFormat;
|
|
61
57
|
static allowStyle: Set<string>;
|
|
58
|
+
static writable: boolean;
|
|
62
59
|
static isAllowStyle(str: string): boolean;
|
|
63
60
|
static create(value: TableCellValue): HTMLElement;
|
|
64
61
|
static formats(domNode: HTMLElement): Record<string, any>;
|
|
@@ -189,6 +186,30 @@ declare class TableWrapperFormat extends ContainerFormat {
|
|
|
189
186
|
insertLineAround: () => void;
|
|
190
187
|
}
|
|
191
188
|
|
|
189
|
+
declare const blotName: {
|
|
190
|
+
readonly container: "table-up-container";
|
|
191
|
+
readonly tableWrapper: "table-up";
|
|
192
|
+
readonly tableMain: "table-up-main";
|
|
193
|
+
readonly tableColgroup: "table-up-colgroup";
|
|
194
|
+
readonly tableCol: "table-up-col";
|
|
195
|
+
readonly tableBody: "table-up-body";
|
|
196
|
+
readonly tableRow: "table-up-row";
|
|
197
|
+
readonly tableCell: "table-up-cell";
|
|
198
|
+
readonly tableCellInner: "table-up-cell-inner";
|
|
199
|
+
};
|
|
200
|
+
declare const tableUpSize: {
|
|
201
|
+
colMinWidthPre: number;
|
|
202
|
+
colMinWidthPx: number;
|
|
203
|
+
colDefaultWidth: string;
|
|
204
|
+
rowMinHeightPx: number;
|
|
205
|
+
};
|
|
206
|
+
declare const tableUpEvent: {
|
|
207
|
+
AFTER_TABLE_RESIZE: string;
|
|
208
|
+
};
|
|
209
|
+
declare const tableUpInternal: {
|
|
210
|
+
moduleName: string;
|
|
211
|
+
};
|
|
212
|
+
|
|
192
213
|
type QuillThemePicker = (Picker & {
|
|
193
214
|
options: HTMLElement;
|
|
194
215
|
});
|
|
@@ -310,11 +331,39 @@ interface InternalTableSelectionModule extends InternalModule {
|
|
|
310
331
|
}) => TableCellInnerFormat[];
|
|
311
332
|
updateWithSelectedTds: () => void;
|
|
312
333
|
}
|
|
334
|
+
type Writable<T> = {
|
|
335
|
+
-readonly [P in keyof T]: T[P];
|
|
336
|
+
};
|
|
313
337
|
interface TableConstantsData {
|
|
314
|
-
blotName: Record<
|
|
315
|
-
tableUpSize:
|
|
316
|
-
tableUpEvent:
|
|
338
|
+
blotName: Partial<Record<keyof Writable<typeof blotName>, string>>;
|
|
339
|
+
tableUpSize: Partial<typeof tableUpSize>;
|
|
340
|
+
tableUpEvent: Partial<typeof tableUpEvent>;
|
|
341
|
+
tableUpInternal: Partial<typeof tableUpInternal>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
interface ParentBlotReturnMap {
|
|
345
|
+
[blotName.tableWrapper]: TableWrapperFormat;
|
|
346
|
+
[blotName.tableMain]: TableMainFormat;
|
|
347
|
+
[blotName.tableCol]: TableColFormat;
|
|
348
|
+
[blotName.tableColgroup]: TableColgroupFormat;
|
|
349
|
+
[blotName.tableBody]: TableBodyFormat;
|
|
350
|
+
[blotName.tableRow]: TableRowFormat;
|
|
351
|
+
[blotName.tableCell]: TableCellFormat;
|
|
352
|
+
[blotName.tableCellInner]: TableCellInnerFormat;
|
|
353
|
+
}
|
|
354
|
+
type ParentBlotReturn = {
|
|
355
|
+
[key: string]: Parchment.Parent;
|
|
356
|
+
} & ParentBlotReturnMap;
|
|
357
|
+
declare function findParentBlot<T extends Parchment.Parent, U extends string = string>(blot: Parchment.Blot, targetBlotName: U): U extends keyof ParentBlotReturn ? ParentBlotReturn[U] : T;
|
|
358
|
+
declare function findParentBlots<T extends (keyof ParentBlotReturnMap | string)[]>(blot: Parchment.Blot, targetBlotNames: T): {
|
|
359
|
+
[K in keyof T]: ParentBlotReturn[T[K]];
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
interface ColorPickerOptions {
|
|
363
|
+
color: string;
|
|
364
|
+
onChange: (color: string) => void;
|
|
317
365
|
}
|
|
366
|
+
declare const createColorPicker: (options?: Partial<ColorPickerOptions>) => HTMLDivElement;
|
|
318
367
|
|
|
319
368
|
interface TableSelectOptions {
|
|
320
369
|
row: number;
|
|
@@ -344,45 +393,7 @@ interface TooltipInstance {
|
|
|
344
393
|
}
|
|
345
394
|
declare const createTooltip: (target: HTMLElement, options?: ToolTipOptions) => TooltipInstance | null;
|
|
346
395
|
|
|
347
|
-
declare const blotName: {
|
|
348
|
-
readonly container: "table-up-container";
|
|
349
|
-
readonly tableWrapper: "table-up";
|
|
350
|
-
readonly tableMain: "table-up-main";
|
|
351
|
-
readonly tableColgroup: "table-up-colgroup";
|
|
352
|
-
readonly tableCol: "table-up-col";
|
|
353
|
-
readonly tableBody: "table-up-body";
|
|
354
|
-
readonly tableRow: "table-up-row";
|
|
355
|
-
readonly tableCell: "table-up-cell";
|
|
356
|
-
readonly tableCellInner: "table-up-cell-inner";
|
|
357
|
-
};
|
|
358
|
-
declare const tableUpSize: {
|
|
359
|
-
colMinWidthPre: number;
|
|
360
|
-
colMinWidthPx: number;
|
|
361
|
-
colDefaultWidth: string;
|
|
362
|
-
rowMinHeightPx: number;
|
|
363
|
-
};
|
|
364
|
-
declare const tableUpEvent: {
|
|
365
|
-
AFTER_TABLE_RESIZE: string;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
396
|
declare const randomId: () => string;
|
|
369
|
-
interface ParentBlotReturnMap {
|
|
370
|
-
[blotName.tableWrapper]: TableWrapperFormat;
|
|
371
|
-
[blotName.tableMain]: TableMainFormat;
|
|
372
|
-
[blotName.tableCol]: TableColFormat;
|
|
373
|
-
[blotName.tableColgroup]: TableColgroupFormat;
|
|
374
|
-
[blotName.tableBody]: TableBodyFormat;
|
|
375
|
-
[blotName.tableRow]: TableRowFormat;
|
|
376
|
-
[blotName.tableCell]: TableCellFormat;
|
|
377
|
-
[blotName.tableCellInner]: TableCellInnerFormat;
|
|
378
|
-
}
|
|
379
|
-
type ParentBlotReturn = {
|
|
380
|
-
[key: string]: Parchment.Parent;
|
|
381
|
-
} & ParentBlotReturnMap;
|
|
382
|
-
declare function findParentBlot<T extends Parchment.Parent, U extends string = string>(blot: Parchment.Blot, targetBlotName: U): U extends keyof ParentBlotReturn ? ParentBlotReturn[U] : T;
|
|
383
|
-
declare function findParentBlots<T extends (keyof ParentBlotReturnMap | string)[]>(blot: Parchment.Blot, targetBlotNames: T): {
|
|
384
|
-
[K in keyof T]: ParentBlotReturn[T[K]];
|
|
385
|
-
};
|
|
386
397
|
|
|
387
398
|
declare function updateTableConstants(data: Partial<TableConstantsData>): void;
|
|
388
399
|
declare function defaultCustomSelect(tableModule: TableUp, picker: QuillThemePicker): HTMLDivElement;
|
|
@@ -450,6 +461,7 @@ declare class TableUp {
|
|
|
450
461
|
BackgroundColor: string;
|
|
451
462
|
BorderColor: string;
|
|
452
463
|
} & Partial<TableTextOptions>;
|
|
464
|
+
quillHack(): void;
|
|
453
465
|
showTableTools(table: HTMLElement): void;
|
|
454
466
|
hideTableTools(): void;
|
|
455
467
|
buildCustomSelect(customSelect: ((module: TableUp, picker: QuillThemePicker) => HTMLElement | Promise<HTMLElement>) | undefined, picker: QuillThemePicker): Promise<void>;
|
|
@@ -903,6 +915,7 @@ declare class TableSelection {
|
|
|
903
915
|
};
|
|
904
916
|
lastSelection: SelectionData;
|
|
905
917
|
constructor(tableModule: TableUp, quill: Quill, options?: Partial<TableSelectionOptions>);
|
|
918
|
+
quillHack(): void;
|
|
906
919
|
getFirstTextNode(dom: HTMLElement | Node): Node;
|
|
907
920
|
getLastTextNode(dom: HTMLElement | Node): Node;
|
|
908
921
|
getNodeTailOffset(node: Node): number;
|
|
@@ -945,4 +958,4 @@ declare class TableSelection {
|
|
|
945
958
|
destroy(): void;
|
|
946
959
|
}
|
|
947
960
|
|
|
948
|
-
export { BlockOverride, type Constructor, ContainerFormat, type InternalModule, type InternalTableSelectionModule, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, type TableMenuTexts, TablePasteParser, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, type TableResizeScaleOptions, TableRowFormat, type TableRowValue, TableSelection, type TableSelectionOptions, type TableTextOptions, TableUp, type TableUpOptions, type TableValue, TableVirtualScrollbar, TableWrapperFormat, type Tool, type ToolOption, type ToolOptionBreak, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, isTableAlignRight, randomId, type sizeChangeValue, tableUpEvent, tableUpSize, updateTableConstants };
|
|
961
|
+
export { BlockOverride, type Constructor, ContainerFormat, type InternalModule, type InternalTableSelectionModule, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SelectionData, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, type TableMenuTexts, TablePasteParser, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, type TableResizeScaleOptions, TableRowFormat, type TableRowValue, TableSelection, type TableSelectionOptions, type TableTextOptions, TableUp, type TableUpOptions, type TableValue, TableVirtualScrollbar, TableWrapperFormat, type Tool, type ToolOption, type ToolOptionBreak, type Writable, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, isTableAlignRight, randomId, type sizeChangeValue, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|