quill-table-up 2.1.8 → 2.1.9
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 +73 -39
- package/dist/index.css +1 -1
- package/dist/index.d.ts +10 -3
- 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/editor-page.ts +6 -0
- package/src/__tests__/e2e/table-menu.test.ts +13 -0
- package/src/__tests__/e2e/table-selection.test.ts +109 -0
- package/src/__tests__/unit/table-clipboard.test.ts +85 -0
- package/src/__tests__/unit/table-hack.test.ts +167 -5
- package/src/__tests__/unit/table-redo-undo.test.ts +310 -1
- package/src/formats/overrides/block.ts +1 -1
- package/src/formats/table-col-format.ts +10 -1
- package/src/formats/table-colgroup-format.ts +4 -1
- package/src/formats/table-main-format.ts +37 -9
- package/src/modules/table-clipboard.ts +35 -28
- package/src/modules/table-menu/constants.ts +38 -27
- package/src/modules/table-menu/index.ts +1 -0
- package/src/modules/table-menu/table-menu-common.ts +22 -2
- package/src/modules/table-menu/table-menu-select.ts +1 -1
- package/src/modules/table-selection.ts +19 -0
- package/src/style/table-resize-scale.less +2 -2
- package/src/svg/auto-full.svg +1 -0
- package/src/table-up.ts +25 -5
- package/src/utils/constants.ts +1 -1
- package/src/utils/is.ts +1 -0
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install quill-table-up
|
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
import Quill from 'quill';
|
|
28
|
-
import TableUp, { TableAlign, TableMenuContextmenu, TableResizeBox, TableResizeScale, TableSelection, TableVirtualScrollbar } from 'quill-table-up';
|
|
28
|
+
import TableUp, { defaultCustomSelect, TableAlign, TableMenuContextmenu, TableResizeBox, TableResizeScale, TableSelection, TableVirtualScrollbar } from 'quill-table-up';
|
|
29
29
|
import 'quill/dist/quill.snow.css';
|
|
30
30
|
import 'quill-table-up/index.css';
|
|
31
31
|
// If using the default customSelect option. You need to import this css
|
|
@@ -113,6 +113,7 @@ const defaultTexts = {
|
|
|
113
113
|
DeleteTable: 'Delete table',
|
|
114
114
|
BackgroundColor: 'Set background color',
|
|
115
115
|
BorderColor: 'Set border color',
|
|
116
|
+
SwitchWidth: 'Switch table width'
|
|
116
117
|
};
|
|
117
118
|
```
|
|
118
119
|
|
|
@@ -158,79 +159,91 @@ interface ToolOptionBreak {
|
|
|
158
159
|
}
|
|
159
160
|
type Tool = ToolOption | ToolOptionBreak;
|
|
160
161
|
|
|
161
|
-
const
|
|
162
|
-
{
|
|
162
|
+
const tableMenuTools: Record<string, Tool> = {
|
|
163
|
+
Break: {
|
|
164
|
+
name: 'break',
|
|
165
|
+
},
|
|
166
|
+
SwitchWidth: {
|
|
167
|
+
name: 'SwitchWidth',
|
|
168
|
+
icon: AutoFull,
|
|
169
|
+
tip: 'Switch table width',
|
|
170
|
+
handle: (tableModule) => {},
|
|
171
|
+
},
|
|
172
|
+
CopyCell: {
|
|
173
|
+
name: 'CopyCell',
|
|
174
|
+
tip: 'Copy cell',
|
|
175
|
+
icon: Copy,
|
|
176
|
+
handle: (tableModule, selectedTds) => {},
|
|
177
|
+
},
|
|
178
|
+
CutCell: {
|
|
179
|
+
name: 'CutCell',
|
|
180
|
+
tip: 'Cut cell',
|
|
181
|
+
icon: Cut,
|
|
182
|
+
handle: (tableModule, selectedTds) => {},
|
|
183
|
+
},
|
|
184
|
+
InsertTop: {
|
|
163
185
|
name: 'InsertTop',
|
|
164
186
|
icon: InsertTop,
|
|
165
|
-
tip: 'Insert
|
|
166
|
-
handle: (tableModule) => {},
|
|
187
|
+
tip: 'Insert row above',
|
|
188
|
+
handle: (tableModule, selectedTds) => {},
|
|
167
189
|
},
|
|
168
|
-
{
|
|
190
|
+
InsertRight: {
|
|
169
191
|
name: 'InsertRight',
|
|
170
192
|
icon: InsertRight,
|
|
171
|
-
tip: 'Insert
|
|
172
|
-
handle: (tableModule) => {},
|
|
193
|
+
tip: 'Insert column right',
|
|
194
|
+
handle: (tableModule, selectedTds) => {},
|
|
173
195
|
},
|
|
174
|
-
{
|
|
196
|
+
InsertBottom: {
|
|
175
197
|
name: 'InsertBottom',
|
|
176
198
|
icon: InsertBottom,
|
|
177
|
-
tip: 'Insert
|
|
178
|
-
handle: (tableModule) => {},
|
|
199
|
+
tip: 'Insert row below',
|
|
200
|
+
handle: (tableModule, selectedTds) => {},
|
|
179
201
|
},
|
|
180
|
-
{
|
|
202
|
+
InsertLeft: {
|
|
181
203
|
name: 'InsertLeft',
|
|
182
204
|
icon: InsertLeft,
|
|
183
|
-
tip: 'Insert
|
|
184
|
-
handle: (tableModule) => {},
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: 'break',
|
|
205
|
+
tip: 'Insert column Left',
|
|
206
|
+
handle: (tableModule, selectedTds) => {},
|
|
188
207
|
},
|
|
189
|
-
{
|
|
208
|
+
MergeCell: {
|
|
190
209
|
name: 'MergeCell',
|
|
191
210
|
icon: MergeCell,
|
|
192
211
|
tip: 'Merge Cell',
|
|
193
|
-
handle: (tableModule) => {},
|
|
212
|
+
handle: (tableModule, selectedTds) => {},
|
|
194
213
|
},
|
|
195
|
-
{
|
|
214
|
+
SplitCell: {
|
|
196
215
|
name: 'SplitCell',
|
|
197
216
|
icon: SplitCell,
|
|
198
217
|
tip: 'Split Cell',
|
|
199
|
-
handle: (tableModule) => {},
|
|
218
|
+
handle: (tableModule, selectedTds) => {},
|
|
200
219
|
},
|
|
201
|
-
{
|
|
202
|
-
name: 'break',
|
|
203
|
-
},
|
|
204
|
-
{
|
|
220
|
+
DeleteRow: {
|
|
205
221
|
name: 'DeleteRow',
|
|
206
222
|
icon: RemoveRow,
|
|
207
223
|
tip: 'Delete Row',
|
|
208
|
-
handle: (tableModule) => {},
|
|
224
|
+
handle: (tableModule, selectedTds) => {},
|
|
209
225
|
},
|
|
210
|
-
{
|
|
226
|
+
DeleteColumn: {
|
|
211
227
|
name: 'DeleteColumn',
|
|
212
228
|
icon: RemoveColumn,
|
|
213
229
|
tip: 'Delete Column',
|
|
214
|
-
handle: (tableModule) => {},
|
|
230
|
+
handle: (tableModule, selectedTds) => {},
|
|
215
231
|
},
|
|
216
|
-
{
|
|
232
|
+
DeleteTable: {
|
|
217
233
|
name: 'DeleteTable',
|
|
218
234
|
icon: RemoveTable,
|
|
219
235
|
tip: 'Delete table',
|
|
220
|
-
handle: (tableModule) => {},
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: 'break',
|
|
236
|
+
handle: (tableModule, selectedTds) => {},
|
|
224
237
|
},
|
|
225
|
-
{
|
|
238
|
+
BackgroundColor: {
|
|
226
239
|
name: 'BackgroundColor',
|
|
227
|
-
icon:
|
|
240
|
+
icon: Background,
|
|
228
241
|
isColorChoose: true,
|
|
229
242
|
tip: 'Set background color',
|
|
230
243
|
key: 'background-color',
|
|
231
244
|
handle: (tableModule, selectedTds, color) => {},
|
|
232
245
|
},
|
|
233
|
-
{
|
|
246
|
+
BorderColor: {
|
|
234
247
|
name: 'BorderColor',
|
|
235
248
|
icon: Border,
|
|
236
249
|
isColorChoose: true,
|
|
@@ -238,6 +251,27 @@ const defaultTools = [
|
|
|
238
251
|
key: 'border-color',
|
|
239
252
|
handle: (tableModule, selectedTds, color) => {},
|
|
240
253
|
},
|
|
254
|
+
};
|
|
255
|
+
const defaultTools = [
|
|
256
|
+
tableMenuTools.InsertTop,
|
|
257
|
+
tableMenuTools.InsertRight,
|
|
258
|
+
tableMenuTools.InsertBottom,
|
|
259
|
+
tableMenuTools.InsertLeft,
|
|
260
|
+
tableMenuTools.Break,
|
|
261
|
+
tableMenuTools.MergeCell,
|
|
262
|
+
tableMenuTools.SplitCell,
|
|
263
|
+
tableMenuTools.Break,
|
|
264
|
+
tableMenuTools.DeleteRow,
|
|
265
|
+
tableMenuTools.DeleteColumn,
|
|
266
|
+
tableMenuTools.DeleteTable,
|
|
267
|
+
tableMenuTools.Break,
|
|
268
|
+
tableMenuTools.BackgroundColor,
|
|
269
|
+
tableMenuTools.BorderColor,
|
|
270
|
+
tableMenuTools.Break,
|
|
271
|
+
tableMenuTools.CopyCell,
|
|
272
|
+
tableMenuTools.CutCell,
|
|
273
|
+
tableMenuTools.Break,
|
|
274
|
+
tableMenuTools.SwitchWidth,
|
|
241
275
|
];
|
|
242
276
|
```
|
|
243
277
|
|
|
@@ -245,11 +279,11 @@ const defaultTools = [
|
|
|
245
279
|
|
|
246
280
|
## Overrides
|
|
247
281
|
|
|
248
|
-
|
|
282
|
+
If you need to rewrite extends from quill `Block` or `Scroll` blot. you need to use `Quill.import()` after `TableUp` registed. beacuse module internal rewrite some functions, but those change only effect formats about table.
|
|
249
283
|
|
|
250
|
-
`Header
|
|
284
|
+
`Header`, `List'`, `Blockquote` and `CodeBlock` have been overrides. If you need to rewrite them, you need to rewrite them before `TableUp` registed.
|
|
251
285
|
|
|
252
|
-
|
|
286
|
+
Please read [source code](https://github.com/zzxming/quill-table-up/tree/master/src/formats/overrides) to know those change.
|
|
253
287
|
|
|
254
288
|
```ts
|
|
255
289
|
import { BlockOverride, ScrollOverride, } from 'quill-table-up';
|
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 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.is-hidden,.table-up-resize-line__row.is-hidden{display:none}.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.is-hidden,.table-up-resize-line__row.is-hidden{display:none}.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:nwse-resize;pointer-events:all}.table-up-scale.is-align-right .table-up-scale__block{cursor:nesw-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
|
@@ -112,6 +112,7 @@ declare class TableColFormat extends BlockEmbed {
|
|
|
112
112
|
get tableId(): string;
|
|
113
113
|
get colId(): string;
|
|
114
114
|
get full(): boolean;
|
|
115
|
+
set full(value: boolean);
|
|
115
116
|
get align(): string;
|
|
116
117
|
set align(value: string);
|
|
117
118
|
checkMerge(): boolean;
|
|
@@ -163,11 +164,13 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
163
164
|
static className: string;
|
|
164
165
|
static create(value: TableValue): HTMLElement;
|
|
165
166
|
constructor(scroll: any, domNode: HTMLElement, _value: any);
|
|
166
|
-
colWidthFillTable(): number |
|
|
167
|
+
colWidthFillTable(): number | undefined;
|
|
167
168
|
get tableId(): string;
|
|
168
169
|
get full(): boolean;
|
|
170
|
+
set full(value: boolean);
|
|
169
171
|
get align(): string;
|
|
170
172
|
set align(value: string);
|
|
173
|
+
setFull(): void;
|
|
171
174
|
cancelFull(): void;
|
|
172
175
|
updateAlign(): void;
|
|
173
176
|
getRows(): TableRowFormat[];
|
|
@@ -206,7 +209,7 @@ declare const blotName: {
|
|
|
206
209
|
declare const tableUpSize: {
|
|
207
210
|
colMinWidthPre: number;
|
|
208
211
|
colMinWidthPx: number;
|
|
209
|
-
colDefaultWidth:
|
|
212
|
+
colDefaultWidth: number;
|
|
210
213
|
rowMinHeightPx: number;
|
|
211
214
|
};
|
|
212
215
|
declare const tableUpEvent: {
|
|
@@ -268,12 +271,15 @@ declare class TableClipboard extends Clipboard {
|
|
|
268
271
|
matchCol(node: Node): any;
|
|
269
272
|
matchTr(node: Node, delta: Delta): Delta;
|
|
270
273
|
matchTd(node: Node, delta: Delta): any;
|
|
274
|
+
matchTdAttributor(node: Node, delta: Delta): any;
|
|
271
275
|
convert({ html, text }: {
|
|
272
276
|
html?: string;
|
|
273
277
|
text?: string;
|
|
274
278
|
}, formats?: Record<string, unknown>): Delta;
|
|
275
279
|
}
|
|
276
280
|
|
|
281
|
+
declare const tableMenuTools: Record<string, Tool>;
|
|
282
|
+
|
|
277
283
|
type TableMenuOptionsInput$1 = Partial<Omit<TableMenuOptions, 'texts'>>;
|
|
278
284
|
interface MenuTooltipInstance extends TooltipInstance {
|
|
279
285
|
isColorPick?: boolean;
|
|
@@ -706,6 +712,7 @@ declare class TableSelection {
|
|
|
706
712
|
y: number;
|
|
707
713
|
};
|
|
708
714
|
setSelectionTable(table: HTMLTableElement | undefined): void;
|
|
715
|
+
removeCell: (e: KeyboardEvent) => void;
|
|
709
716
|
showDisplay(): void;
|
|
710
717
|
show(): void;
|
|
711
718
|
hideDisplay(): void;
|
|
@@ -1015,4 +1022,4 @@ declare class TableUp {
|
|
|
1015
1022
|
splitCell(selectedTds: TableCellInnerFormat[]): void;
|
|
1016
1023
|
}
|
|
1017
1024
|
|
|
1018
|
-
export { BlockOverride, type ClipboardOptions, type Constructor, ContainerFormat, type InternalModule, type InternalTableMenuModule, type InternalTableSelectionModule, type Matcher, type MenuTooltipInstance, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SelectionData, type Selector, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableClipboard, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, type TableMenuTexts, 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 };
|
|
1025
|
+
export { BlockOverride, type ClipboardOptions, type Constructor, ContainerFormat, type InternalModule, type InternalTableMenuModule, type InternalTableSelectionModule, type Matcher, type MenuTooltipInstance, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SelectionData, type Selector, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableClipboard, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, type TableMenuTexts, 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, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|