feat:add eslint and fix
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { IElement } from "../.."
|
||||
import { EditorMode } from "../../dataset/enum/Editor"
|
||||
import { RowFlex } from "../../dataset/enum/Row"
|
||||
import { IDrawImagePayload } from "../../interface/Draw"
|
||||
import { IWatermark } from "../../interface/Watermark"
|
||||
import { CommandAdapt } from "./CommandAdapt"
|
||||
import { IElement } from '../..'
|
||||
import { EditorMode } from '../../dataset/enum/Editor'
|
||||
import { RowFlex } from '../../dataset/enum/Row'
|
||||
import { IDrawImagePayload } from '../../interface/Draw'
|
||||
import { IWatermark } from '../../interface/Watermark'
|
||||
import { CommandAdapt } from './CommandAdapt'
|
||||
|
||||
|
||||
export class Command {
|
||||
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
import { WRAP, ZERO } from "../../dataset/constant/Common"
|
||||
import { EDITOR_ELEMENT_STYLE_ATTR } from "../../dataset/constant/Element"
|
||||
import { defaultWatermarkOption } from "../../dataset/constant/Watermark"
|
||||
import { EditorContext, EditorMode } from "../../dataset/enum/Editor"
|
||||
import { ElementType } from "../../dataset/enum/Element"
|
||||
import { ElementStyleKey } from "../../dataset/enum/ElementStyle"
|
||||
import { RowFlex } from "../../dataset/enum/Row"
|
||||
import { IDrawImagePayload } from "../../interface/Draw"
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { IElement, IElementStyle } from "../../interface/Element"
|
||||
import { IColgroup } from "../../interface/table/Colgroup"
|
||||
import { ITd } from "../../interface/table/Td"
|
||||
import { ITr } from "../../interface/table/Tr"
|
||||
import { IWatermark } from "../../interface/Watermark"
|
||||
import { getUUID } from "../../utils"
|
||||
import { formatElementList } from "../../utils/element"
|
||||
import { printImageBase64 } from "../../utils/print"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { TableTool } from "../draw/particle/table/TableTool"
|
||||
import { CanvasEvent } from "../event/CanvasEvent"
|
||||
import { HistoryManager } from "../history/HistoryManager"
|
||||
import { Position } from "../position/Position"
|
||||
import { RangeManager } from "../range/RangeManager"
|
||||
import { WRAP, ZERO } from '../../dataset/constant/Common'
|
||||
import { EDITOR_ELEMENT_STYLE_ATTR } from '../../dataset/constant/Element'
|
||||
import { defaultWatermarkOption } from '../../dataset/constant/Watermark'
|
||||
import { EditorContext, EditorMode } from '../../dataset/enum/Editor'
|
||||
import { ElementType } from '../../dataset/enum/Element'
|
||||
import { ElementStyleKey } from '../../dataset/enum/ElementStyle'
|
||||
import { RowFlex } from '../../dataset/enum/Row'
|
||||
import { IDrawImagePayload } from '../../interface/Draw'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { IElement, IElementStyle } from '../../interface/Element'
|
||||
import { IColgroup } from '../../interface/table/Colgroup'
|
||||
import { ITd } from '../../interface/table/Td'
|
||||
import { ITr } from '../../interface/table/Tr'
|
||||
import { IWatermark } from '../../interface/Watermark'
|
||||
import { getUUID } from '../../utils'
|
||||
import { formatElementList } from '../../utils/element'
|
||||
import { printImageBase64 } from '../../utils/print'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { TableTool } from '../draw/particle/table/TableTool'
|
||||
import { CanvasEvent } from '../event/CanvasEvent'
|
||||
import { HistoryManager } from '../history/HistoryManager'
|
||||
import { Position } from '../position/Position'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
|
||||
|
||||
export class CommandAdapt {
|
||||
|
||||
@@ -822,7 +823,7 @@ export class CommandAdapt {
|
||||
const startRowIndex = startTd.rowIndex!
|
||||
const endRowIndex = endTd.rowIndex! + (endTd.rowspan - 1)
|
||||
// 选区行列
|
||||
let rowCol: ITd[][] = []
|
||||
const rowCol: ITd[][] = []
|
||||
for (let t = 0; t < curTrList.length; t++) {
|
||||
const tr = curTrList[t]
|
||||
const tdList: ITd[] = []
|
||||
@@ -865,7 +866,7 @@ export class CommandAdapt {
|
||||
}
|
||||
}
|
||||
// 合并单元格
|
||||
let mergeTdIdList: string[] = []
|
||||
const mergeTdIdList: string[] = []
|
||||
const anchorTd = rowCol[0][0]
|
||||
for (let t = 0; t < rowCol.length; t++) {
|
||||
const tr = rowCol[t]
|
||||
@@ -1234,7 +1235,7 @@ export class CommandAdapt {
|
||||
formatElementList(payload, false)
|
||||
const elementList = this.draw.getElementList()
|
||||
const isCollapsed = startIndex === endIndex
|
||||
let start = startIndex + 1
|
||||
const start = startIndex + 1
|
||||
if (!isCollapsed) {
|
||||
elementList.splice(start, endIndex - startIndex)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { EDITOR_COMPONENT } from "../../dataset/constant/Editor"
|
||||
import { EditorComponent } from "../../dataset/enum/Editor"
|
||||
import { IContextMenuContext, IRegisterContextMenu } from "../../interface/contextmenu/ContextMenu"
|
||||
import { findParent } from "../../utils"
|
||||
import { Command } from "../command/Command"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { Position } from "../position/Position"
|
||||
import { RangeManager } from "../range/RangeManager"
|
||||
import { EDITOR_COMPONENT } from '../../dataset/constant/Editor'
|
||||
import { EditorComponent } from '../../dataset/enum/Editor'
|
||||
import { IContextMenuContext, IRegisterContextMenu } from '../../interface/contextmenu/ContextMenu'
|
||||
import { findParent } from '../../utils'
|
||||
import { Command } from '../command/Command'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { Position } from '../position/Position'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
|
||||
interface IRenderPayload {
|
||||
contextMenuList: IRegisterContextMenu[];
|
||||
@@ -42,7 +42,7 @@ export class ContextMenu {
|
||||
|
||||
private _proxyContextMenuEvent(evt: MouseEvent) {
|
||||
const context = this._getContext()
|
||||
let renderList: IRegisterContextMenu[] = []
|
||||
const renderList: IRegisterContextMenu[] = []
|
||||
let isRegisterContextMenu = false
|
||||
for (let c = 0; c < this.contextMenuList.length; c++) {
|
||||
const menu = this.contextMenuList[c]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IRegisterContextMenu } from "../../../interface/contextmenu/ContextMenu"
|
||||
import { Command } from "../../command/Command"
|
||||
import { IRegisterContextMenu } from '../../../interface/contextmenu/ContextMenu'
|
||||
import { Command } from '../../command/Command'
|
||||
|
||||
export const globalMenus: IRegisterContextMenu[] = [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IRegisterContextMenu } from "../../../interface/contextmenu/ContextMenu"
|
||||
import { Command } from "../../command/Command"
|
||||
import { IRegisterContextMenu } from '../../../interface/contextmenu/ContextMenu'
|
||||
import { Command } from '../../command/Command'
|
||||
|
||||
export const tableMenus: IRegisterContextMenu[] = [
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { CURSOR_AGENT_HEIGHT } from "../../dataset/constant/Cursor"
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { CanvasEvent } from "../event/CanvasEvent"
|
||||
import { Position } from "../position/Position"
|
||||
import { CursorAgent } from "./CursorAgent"
|
||||
import { CURSOR_AGENT_HEIGHT } from '../../dataset/constant/Cursor'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { CanvasEvent } from '../event/CanvasEvent'
|
||||
import { Position } from '../position/Position'
|
||||
import { CursorAgent } from './CursorAgent'
|
||||
|
||||
export class Cursor {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { debounce } from "../../utils"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { CanvasEvent } from "../event/CanvasEvent"
|
||||
import { debounce } from '../../utils'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { CanvasEvent } from '../event/CanvasEvent'
|
||||
|
||||
export class CursorAgent {
|
||||
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
import { ZERO } from "../../dataset/constant/Common"
|
||||
import { RowFlex } from "../../dataset/enum/Row"
|
||||
import { IDrawOption, IDrawRowPayload, IDrawRowResult } from "../../interface/Draw"
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { IElement, IElementMetrics, IElementPosition, IElementFillRect, IElementStyle } from "../../interface/Element"
|
||||
import { IRow, IRowElement } from "../../interface/Row"
|
||||
import { deepClone, getUUID } from "../../utils"
|
||||
import { Cursor } from "../cursor/Cursor"
|
||||
import { CanvasEvent } from "../event/CanvasEvent"
|
||||
import { GlobalEvent } from "../event/GlobalEvent"
|
||||
import { HistoryManager } from "../history/HistoryManager"
|
||||
import { Listener } from "../listener/Listener"
|
||||
import { Position } from "../position/Position"
|
||||
import { RangeManager } from "../range/RangeManager"
|
||||
import { Background } from "./frame/Background"
|
||||
import { Highlight } from "./richtext/Highlight"
|
||||
import { Margin } from "./frame/Margin"
|
||||
import { Search } from "./interactive/Search"
|
||||
import { Strikeout } from "./richtext/Strikeout"
|
||||
import { Underline } from "./richtext/Underline"
|
||||
import { ElementType } from "../../dataset/enum/Element"
|
||||
import { ImageParticle } from "./particle/ImageParticle"
|
||||
import { TextParticle } from "./particle/TextParticle"
|
||||
import { PageNumber } from "./frame/PageNumber"
|
||||
import { GlobalObserver } from "../observer/GlobalObserver"
|
||||
import { TableParticle } from "./particle/table/TableParticle"
|
||||
import { TableTool } from "./particle/table/TableTool"
|
||||
import { HyperlinkParticle } from "./particle/HyperlinkParticle"
|
||||
import { Header } from "./frame/Header"
|
||||
import { SuperscriptParticle } from "./particle/Superscript"
|
||||
import { SubscriptParticle } from "./particle/Subscript"
|
||||
import { SeparatorParticle } from "./particle/Separator"
|
||||
import { PageBreakParticle } from "./particle/PageBreak"
|
||||
import { Watermark } from "./frame/Watermark"
|
||||
import { EditorMode } from "../../dataset/enum/Editor"
|
||||
import { ZERO } from '../../dataset/constant/Common'
|
||||
import { RowFlex } from '../../dataset/enum/Row'
|
||||
import { IDrawOption, IDrawRowPayload, IDrawRowResult } from '../../interface/Draw'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { IElement, IElementMetrics, IElementPosition, IElementFillRect, IElementStyle } from '../../interface/Element'
|
||||
import { IRow, IRowElement } from '../../interface/Row'
|
||||
import { deepClone, getUUID } from '../../utils'
|
||||
import { Cursor } from '../cursor/Cursor'
|
||||
import { CanvasEvent } from '../event/CanvasEvent'
|
||||
import { GlobalEvent } from '../event/GlobalEvent'
|
||||
import { HistoryManager } from '../history/HistoryManager'
|
||||
import { Listener } from '../listener/Listener'
|
||||
import { Position } from '../position/Position'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
import { Background } from './frame/Background'
|
||||
import { Highlight } from './richtext/Highlight'
|
||||
import { Margin } from './frame/Margin'
|
||||
import { Search } from './interactive/Search'
|
||||
import { Strikeout } from './richtext/Strikeout'
|
||||
import { Underline } from './richtext/Underline'
|
||||
import { ElementType } from '../../dataset/enum/Element'
|
||||
import { ImageParticle } from './particle/ImageParticle'
|
||||
import { TextParticle } from './particle/TextParticle'
|
||||
import { PageNumber } from './frame/PageNumber'
|
||||
import { GlobalObserver } from '../observer/GlobalObserver'
|
||||
import { TableParticle } from './particle/table/TableParticle'
|
||||
import { TableTool } from './particle/table/TableTool'
|
||||
import { HyperlinkParticle } from './particle/HyperlinkParticle'
|
||||
import { Header } from './frame/Header'
|
||||
import { SuperscriptParticle } from './particle/Superscript'
|
||||
import { SubscriptParticle } from './particle/Subscript'
|
||||
import { SeparatorParticle } from './particle/Separator'
|
||||
import { PageBreakParticle } from './particle/PageBreak'
|
||||
import { Watermark } from './frame/Watermark'
|
||||
import { EditorMode } from '../../dataset/enum/Editor'
|
||||
|
||||
export class Draw {
|
||||
|
||||
@@ -383,7 +383,7 @@ export class Draw {
|
||||
this.ctxList.push(ctx)
|
||||
}
|
||||
|
||||
private _getFont(el: IElement, scale: number = 1): string {
|
||||
private _getFont(el: IElement, scale = 1): string {
|
||||
const { defaultSize, defaultFont } = this.options
|
||||
const font = el.font || defaultFont
|
||||
const size = el.actualSize || el.size || defaultSize
|
||||
@@ -410,7 +410,7 @@ export class Draw {
|
||||
const curRow: IRow = rowList[rowList.length - 1]
|
||||
const element = elementList[i]
|
||||
const rowMargin = defaultBasicRowMarginHeight * (element.rowMargin || defaultRowMargin)
|
||||
let metrics: IElementMetrics = {
|
||||
const metrics: IElementMetrics = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
boundingBoxAscent: 0,
|
||||
@@ -612,8 +612,8 @@ export class Draw {
|
||||
}
|
||||
}
|
||||
// 当前td所在位置
|
||||
let tablePreX = x
|
||||
let tablePreY = y
|
||||
const tablePreX = x
|
||||
const tablePreY = y
|
||||
// 选区绘制记录
|
||||
const rangeRecord: IElementFillRect = {
|
||||
x: 0,
|
||||
@@ -794,12 +794,12 @@ export class Draw {
|
||||
}
|
||||
|
||||
public render(payload?: IDrawOption) {
|
||||
let {
|
||||
curIndex,
|
||||
const {
|
||||
isSubmitHistory = true,
|
||||
isSetCursor = true,
|
||||
isComputeRowList = true
|
||||
} = payload || {}
|
||||
let { curIndex } = payload || {}
|
||||
const height = this.getHeight()
|
||||
const innerWidth = this.getInnerWidth()
|
||||
// 计算行信息
|
||||
@@ -818,7 +818,7 @@ export class Draw {
|
||||
const marginHeight = margins[0] + margins[2]
|
||||
let pageHeight = marginHeight
|
||||
let pageNo = 0
|
||||
let pageRowList: IRow[][] = [[]]
|
||||
const pageRowList: IRow[][] = [[]]
|
||||
for (let i = 0; i < this.rowList.length; i++) {
|
||||
const row = this.rowList[i]
|
||||
if (row.height + pageHeight > height || this.rowList[i - 1]?.isPageBreak) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Background {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DeepRequired } from "../../../interface/Common"
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { DeepRequired } from '../../../interface/Common'
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Header {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Margin {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class PageNumber {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IEditorOption } from "../../.."
|
||||
import { DeepRequired } from "../../../interface/Common"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../..'
|
||||
import { DeepRequired } from '../../../interface/Common'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Watermark {
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ZERO } from "../../../dataset/constant/Common"
|
||||
import { TEXTLIKE_ELEMENT_TYPE } from "../../../dataset/constant/Element"
|
||||
import { EditorContext } from "../../../dataset/enum/Editor"
|
||||
import { ElementType } from "../../../dataset/enum/Element"
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { IElement, IElementPosition } from "../../../interface/Element"
|
||||
import { ISearchResult, ISearchResultRestArgs } from "../../../interface/Search"
|
||||
import { getUUID } from "../../../utils"
|
||||
import { Position } from "../../position/Position"
|
||||
import { Draw } from "../Draw"
|
||||
import { ZERO } from '../../../dataset/constant/Common'
|
||||
import { TEXTLIKE_ELEMENT_TYPE } from '../../../dataset/constant/Element'
|
||||
import { EditorContext } from '../../../dataset/enum/Editor'
|
||||
import { ElementType } from '../../../dataset/enum/Element'
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { IElement, IElementPosition } from '../../../interface/Element'
|
||||
import { ISearchResult, ISearchResultRestArgs } from '../../../interface/Search'
|
||||
import { getUUID } from '../../../utils'
|
||||
import { Position } from '../../position/Position'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Search {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class Search {
|
||||
}
|
||||
|
||||
public compute(payload: string) {
|
||||
let searchMatchList: ISearchResult[] = []
|
||||
const searchMatchList: ISearchResult[] = []
|
||||
// 分组
|
||||
const elementListGroup: { type: EditorContext, elementList: IElement[], index: number }[] = []
|
||||
const originalElementList = this.draw.getOriginalElementList()
|
||||
@@ -129,7 +129,7 @@ export class Search {
|
||||
let position: IElementPosition | null = null
|
||||
if (searchMatch.type === EditorContext.TABLE) {
|
||||
const { tableIndex, trIndex, tdIndex, index } = searchMatch
|
||||
position = elementList[tableIndex!]?.trList![trIndex!].tdList[tdIndex!]!?.positionList![index]
|
||||
position = elementList[tableIndex!]?.trList![trIndex!].tdList[tdIndex!]?.positionList![index]
|
||||
} else {
|
||||
position = positionList[searchMatch.index]
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IElement } from "../../.."
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { IElementPosition } from "../../../interface/Element"
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { Draw } from "../Draw"
|
||||
import { IElement } from '../../..'
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { IElementPosition } from '../../../interface/Element'
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class HyperlinkParticle {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IImageParticleCreateResult } from "../../../interface/Draw"
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { IElement, IElementPosition } from "../../../interface/Element"
|
||||
import { Draw } from "../Draw"
|
||||
import { IImageParticleCreateResult } from '../../../interface/Draw'
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { IElement, IElementPosition } from '../../../interface/Element'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class ImageParticle {
|
||||
|
||||
@@ -93,7 +93,7 @@ export class ImageParticle {
|
||||
document.body.style.cursor = cursor
|
||||
this.canvas.style.cursor = cursor
|
||||
// 拖拽图片镜像
|
||||
this.resizerImage.src = this.curElement?.value!
|
||||
this.resizerImage.src = this.curElement?.value || ''
|
||||
this.resizerImageContainer.style.display = 'block'
|
||||
const { coordinate: { leftTop: [left, top] } } = this.curPosition
|
||||
const prePageHeight = this.draw.getPageNo() * (height + pageGap)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class PageBreakParticle {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
export class SeparatorParticle {
|
||||
|
||||
public render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
|
||||
export class SubscriptParticle {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
|
||||
export class SuperscriptParticle {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IElement } from "../../.."
|
||||
import { IRowElement } from "../../../interface/Row"
|
||||
import { Draw } from "../Draw"
|
||||
import { IElement } from '../../..'
|
||||
import { IRowElement } from '../../../interface/Row'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class TextParticle {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ElementType, IElement } from "../../../.."
|
||||
import { IEditorOption } from "../../../../interface/Editor"
|
||||
import { RangeManager } from "../../../range/RangeManager"
|
||||
import { Draw } from "../../Draw"
|
||||
import { ElementType, IElement } from '../../../..'
|
||||
import { IEditorOption } from '../../../../interface/Editor'
|
||||
import { RangeManager } from '../../../range/RangeManager'
|
||||
import { Draw } from '../../Draw'
|
||||
|
||||
export class TableParticle {
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { IElement } from "../../../.."
|
||||
import { TableOrder } from "../../../../dataset/enum/table/TableTool"
|
||||
import { IEditorOption } from "../../../../interface/Editor"
|
||||
import { IElementPosition } from "../../../../interface/Element"
|
||||
import { Position } from "../../../position/Position"
|
||||
import { Draw } from "../../Draw"
|
||||
import { IElement } from '../../../..'
|
||||
import { TableOrder } from '../../../../dataset/enum/table/TableTool'
|
||||
import { IEditorOption } from '../../../../interface/Editor'
|
||||
import { IElementPosition } from '../../../../interface/Element'
|
||||
import { Position } from '../../../position/Position'
|
||||
import { Draw } from '../../Draw'
|
||||
|
||||
interface IAnchorMouseDown {
|
||||
evt: MouseEvent;
|
||||
@@ -188,7 +188,7 @@ export class TableTool {
|
||||
const innerWidth = this.draw.getInnerWidth()
|
||||
const curColWidth = colgroup[index].width
|
||||
// 最小移动距离计算
|
||||
let moveColWidth = curColWidth + dx
|
||||
const moveColWidth = curColWidth + dx
|
||||
if (moveColWidth < this.minTdWidth) {
|
||||
dx = this.minTdWidth - curColWidth
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Highlight {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Strikeout {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IEditorOption } from "../../../interface/Editor"
|
||||
import { Draw } from "../Draw"
|
||||
import { IEditorOption } from '../../../interface/Editor'
|
||||
import { Draw } from '../Draw'
|
||||
|
||||
export class Underline {
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import { version } from "../../../../package.json"
|
||||
import { ElementType } from "../.."
|
||||
import { ZERO } from "../../dataset/constant/Common"
|
||||
import { EDITOR_ELEMENT_COPY_ATTR } from "../../dataset/constant/Element"
|
||||
import { ElementStyleKey } from "../../dataset/enum/ElementStyle"
|
||||
import { MouseEventButton } from "../../dataset/enum/Event"
|
||||
import { KeyMap } from "../../dataset/enum/Keymap"
|
||||
import { IEditorResult } from "../../interface/Editor"
|
||||
import { IElement } from "../../interface/Element"
|
||||
import { ICurrentPosition } from "../../interface/Position"
|
||||
import { writeTextByElementList } from "../../utils/clipboard"
|
||||
import { zipElementList } from "../../utils/element"
|
||||
import { Cursor } from "../cursor/Cursor"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { HyperlinkParticle } from "../draw/particle/HyperlinkParticle"
|
||||
import { ImageParticle } from "../draw/particle/ImageParticle"
|
||||
import { TableTool } from "../draw/particle/table/TableTool"
|
||||
import { HistoryManager } from "../history/HistoryManager"
|
||||
import { Listener } from "../listener/Listener"
|
||||
import { Position } from "../position/Position"
|
||||
import { RangeManager } from "../range/RangeManager"
|
||||
import { LETTER_REG, NUMBER_LIKE_REG } from "../../dataset/constant/Regular"
|
||||
import { version } from '../../../../package.json'
|
||||
import { ElementType } from '../..'
|
||||
import { ZERO } from '../../dataset/constant/Common'
|
||||
import { EDITOR_ELEMENT_COPY_ATTR } from '../../dataset/constant/Element'
|
||||
import { ElementStyleKey } from '../../dataset/enum/ElementStyle'
|
||||
import { MouseEventButton } from '../../dataset/enum/Event'
|
||||
import { KeyMap } from '../../dataset/enum/Keymap'
|
||||
import { IEditorResult } from '../../interface/Editor'
|
||||
import { IElement } from '../../interface/Element'
|
||||
import { ICurrentPosition } from '../../interface/Position'
|
||||
import { writeTextByElementList } from '../../utils/clipboard'
|
||||
import { zipElementList } from '../../utils/element'
|
||||
import { Cursor } from '../cursor/Cursor'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { HyperlinkParticle } from '../draw/particle/HyperlinkParticle'
|
||||
import { ImageParticle } from '../draw/particle/ImageParticle'
|
||||
import { TableTool } from '../draw/particle/table/TableTool'
|
||||
import { HistoryManager } from '../history/HistoryManager'
|
||||
import { Listener } from '../listener/Listener'
|
||||
import { Position } from '../position/Position'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
import { LETTER_REG, NUMBER_LIKE_REG } from '../../dataset/constant/Regular'
|
||||
|
||||
export class CanvasEvent {
|
||||
|
||||
@@ -119,7 +119,7 @@ export class CanvasEvent {
|
||||
tdIndex: startTdIndex,
|
||||
trIndex: startTrIndex
|
||||
} = this.mouseDownStartPosition
|
||||
let endIndex = isTable ? tdValueIndex! : index
|
||||
const endIndex = isTable ? tdValueIndex! : index
|
||||
// 判断是否是表格跨行/列
|
||||
if (isTable && startIsTable && (tdIndex !== startTdIndex || trIndex !== startTrIndex)) {
|
||||
this.range.setRange(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { EDITOR_COMPONENT } from "../../dataset/constant/Editor"
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { findParent } from "../../utils"
|
||||
import { Cursor } from "../cursor/Cursor"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { HyperlinkParticle } from "../draw/particle/HyperlinkParticle"
|
||||
import { ImageParticle } from "../draw/particle/ImageParticle"
|
||||
import { TableTool } from "../draw/particle/table/TableTool"
|
||||
import { RangeManager } from "../range/RangeManager"
|
||||
import { CanvasEvent } from "./CanvasEvent"
|
||||
import { EDITOR_COMPONENT } from '../../dataset/constant/Editor'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { findParent } from '../../utils'
|
||||
import { Cursor } from '../cursor/Cursor'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { HyperlinkParticle } from '../draw/particle/HyperlinkParticle'
|
||||
import { ImageParticle } from '../draw/particle/ImageParticle'
|
||||
import { TableTool } from '../draw/particle/table/TableTool'
|
||||
import { RangeManager } from '../range/RangeManager'
|
||||
import { CanvasEvent } from './CanvasEvent'
|
||||
|
||||
export class GlobalEvent {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
IRangeStyleChange,
|
||||
ISaved,
|
||||
IVisiblePageNoListChange
|
||||
} from "../../interface/Listener"
|
||||
} from '../../interface/Listener'
|
||||
|
||||
export class Listener {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { debounce } from "../../utils"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { debounce } from '../../utils'
|
||||
import { Draw } from '../draw/Draw'
|
||||
|
||||
export class GlobalObserver {
|
||||
|
||||
@@ -30,9 +30,9 @@ export class GlobalObserver {
|
||||
const bottom = top + window.innerHeight
|
||||
const pageList = this.draw.getPageList()
|
||||
// 计算显示页
|
||||
let visiblePageNoList: number[] = []
|
||||
let intersectionPageNo: number = 0
|
||||
let intersectionMaxHeight: number = 0
|
||||
const visiblePageNoList: number[] = []
|
||||
let intersectionPageNo = 0
|
||||
let intersectionMaxHeight = 0
|
||||
for (let i = 0; i < pageList.length; i++) {
|
||||
const curTop = i * this.pageHeight
|
||||
const curBottom = (i + 1) * this.pageHeight
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ElementType } from "../.."
|
||||
import { ZERO } from "../../dataset/constant/Common"
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { IElementPosition } from "../../interface/Element"
|
||||
import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from "../../interface/Position"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { ElementType } from '../..'
|
||||
import { ZERO } from '../../dataset/constant/Common'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { IElementPosition } from '../../interface/Element'
|
||||
import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from '../../interface/Position'
|
||||
import { Draw } from '../draw/Draw'
|
||||
|
||||
export class Position {
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { ElementType } from "../.."
|
||||
import { IEditorOption } from "../../interface/Editor"
|
||||
import { IElement } from "../../interface/Element"
|
||||
import { IRange } from "../../interface/Range"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { HistoryManager } from "../history/HistoryManager"
|
||||
import { Listener } from "../listener/Listener"
|
||||
import { ElementType } from '../..'
|
||||
import { IEditorOption } from '../../interface/Editor'
|
||||
import { IElement } from '../../interface/Element'
|
||||
import { IRange } from '../../interface/Range'
|
||||
import { Draw } from '../draw/Draw'
|
||||
import { HistoryManager } from '../history/HistoryManager'
|
||||
import { Listener } from '../listener/Listener'
|
||||
|
||||
export class RangeManager {
|
||||
|
||||
@@ -70,10 +70,10 @@ export class RangeManager {
|
||||
const type = curElement.type || ElementType.TEXT
|
||||
// 富文本
|
||||
const font = curElement.font || this.options.defaultFont
|
||||
let bold = !~curElementList.findIndex(el => !el.bold)
|
||||
let italic = !~curElementList.findIndex(el => !el.italic)
|
||||
let underline = !~curElementList.findIndex(el => !el.underline)
|
||||
let strikeout = !~curElementList.findIndex(el => !el.strikeout)
|
||||
const bold = !~curElementList.findIndex(el => !el.bold)
|
||||
const italic = !~curElementList.findIndex(el => !el.italic)
|
||||
const underline = !~curElementList.findIndex(el => !el.underline)
|
||||
const strikeout = !~curElementList.findIndex(el => !el.strikeout)
|
||||
const color = curElement.color || null
|
||||
const highlight = curElement.highlight || null
|
||||
const rowFlex = curElement.rowFlex || null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IRegisterContextMenu } from "../../interface/contextmenu/ContextMenu"
|
||||
import { ContextMenu } from "../contextmenu/ContextMenu"
|
||||
import { IRegisterContextMenu } from '../../interface/contextmenu/ContextMenu'
|
||||
import { ContextMenu } from '../contextmenu/ContextMenu'
|
||||
|
||||
interface IRegisterPayload {
|
||||
contextMenu: ContextMenu
|
||||
|
||||
Reference in New Issue
Block a user