feat: add table row and col size option #214
This commit is contained in:
@@ -35,11 +35,8 @@ import { Position } from '../position/Position'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
import { WorkerManager } from '../worker/WorkerManager'
|
||||
|
||||
|
||||
export class CommandAdapt {
|
||||
|
||||
private readonly defaultWidth: number = 40
|
||||
|
||||
private draw: Draw
|
||||
private range: RangeManager
|
||||
private position: Position
|
||||
@@ -533,7 +530,7 @@ export class CommandAdapt {
|
||||
for (let r = 0; r < row; r++) {
|
||||
const tdList: ITd[] = []
|
||||
const tr: ITr = {
|
||||
height: 40,
|
||||
height: this.options.defaultTrMinHeight,
|
||||
tdList
|
||||
}
|
||||
for (let c = 0; c < col; c++) {
|
||||
@@ -726,7 +723,7 @@ export class CommandAdapt {
|
||||
// 重新计算宽度
|
||||
const colgroup = element.colgroup!
|
||||
colgroup.splice(curTdIndex, 0, {
|
||||
width: this.defaultWidth
|
||||
width: this.options.defaultColMinWidth
|
||||
})
|
||||
const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0)
|
||||
const width = this.draw.getOriginalInnerWidth()
|
||||
@@ -783,7 +780,7 @@ export class CommandAdapt {
|
||||
// 重新计算宽度
|
||||
const colgroup = element.colgroup!
|
||||
colgroup.splice(curTdIndex, 0, {
|
||||
width: this.defaultWidth
|
||||
width: this.options.defaultColMinWidth
|
||||
})
|
||||
const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0)
|
||||
const width = this.draw.getOriginalInnerWidth()
|
||||
|
||||
@@ -125,6 +125,7 @@ export default class Editor {
|
||||
pageMode: PageMode.PAGING,
|
||||
tdPadding: 5,
|
||||
defaultTrMinHeight: 40,
|
||||
defaultColMinWidth: 40,
|
||||
defaultHyperlinkColor: '#0000FF',
|
||||
paperDirection: PaperDirection.VERTICAL,
|
||||
inactiveAlpha: 0.6,
|
||||
|
||||
@@ -48,6 +48,7 @@ export interface IEditorOption {
|
||||
pageMode?: PageMode;
|
||||
tdPadding?: number;
|
||||
defaultTrMinHeight?: number;
|
||||
defaultColMinWidth?: number;
|
||||
defaultHyperlinkColor?: string;
|
||||
paperDirection?: PaperDirection;
|
||||
inactiveAlpha?: number;
|
||||
|
||||
Reference in New Issue
Block a user