feat:rich text editor by canvas

This commit is contained in:
黄云飞
2021-11-12 22:22:05 +08:00
commit 2739d4069f
36 changed files with 1251 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
export interface IDrawOption {
curIndex?: number;
isSetCursor?: boolean
isSubmitHistory?: boolean;
}
+10
View File
@@ -0,0 +1,10 @@
export interface IEditorOption {
defaultType?: string;
defaultFont?: string;
defaultSize?: number;
rangeColor?: string;
rangeAlpha?: number;
marginIndicatorSize?: number;
marginIndicatorColor?: string,
margins?: [top: number, right: number, bootom: number, left: number]
}
+28
View File
@@ -0,0 +1,28 @@
export interface IElement {
type?: 'TEXT' | 'IMAGE';
value: string;
font?: string;
size?: number;
width?: number;
height?: number;
bold?: boolean;
color?: string;
italic?: boolean;
underline?: boolean;
strikeout?: boolean;
}
export interface IElementPosition {
index: number;
value: string,
rowNo: number;
lineHeight: number;
metrics: TextMetrics;
isLastLetter: boolean,
coordinate: {
leftTop: number[];
leftBottom: number[];
rightTop: number[];
rightBottom: number[];
}
}
+4
View File
@@ -0,0 +1,4 @@
export interface IRange {
startIndex: number;
endIndex: number
}
+12
View File
@@ -0,0 +1,12 @@
import { IElement } from "./Element";
export type IRowElement = IElement & {
metrics: TextMetrics
}
export interface IRow {
width: number;
height: number;
ascent: number;
elementList: IRowElement[];
}