@hailin-zheng/editor-core 1.0.6 → 1.0.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/package.json +2 -2
- package/{lib/doc-ruler.js → src/med_editor/doc-ruler.ts} +101 -74
- package/src/med_editor/framework/common-util.ts +200 -0
- package/{lib/framework/document-change.js → src/med_editor/framework/document-change.ts} +308 -259
- package/{lib/framework/document-combine.js → src/med_editor/framework/document-combine.ts} +15 -11
- package/{lib/framework/document-comment.js → src/med_editor/framework/document-comment.ts} +52 -37
- package/{lib/framework/document-context.js → src/med_editor/framework/document-context.ts} +181 -101
- package/{lib/framework/document-eval-func.js → src/med_editor/framework/document-eval-func.ts} +16 -11
- package/{lib/framework/document-event.js → src/med_editor/framework/document-event.ts} +244 -216
- package/{lib/framework/document-history.js → src/med_editor/framework/document-history.ts} +25 -14
- package/{lib/framework/document-images-loader.js → src/med_editor/framework/document-images-loader.ts} +25 -17
- package/{lib/framework/document-input-cursor.js → src/med_editor/framework/document-input-cursor.ts} +76 -71
- package/{lib/framework/document-paint.js → src/med_editor/framework/document-paint.ts} +35 -28
- package/{lib/framework/document-print-offscreen.js → src/med_editor/framework/document-print-offscreen.ts} +25 -19
- package/{lib/framework/document-print.js → src/med_editor/framework/document-print.ts} +57 -41
- package/src/med_editor/framework/document-segmenter.ts +211 -0
- package/{lib/framework/document-selection.js → src/med_editor/framework/document-selection.ts} +116 -85
- package/{lib/framework/document-template.js → src/med_editor/framework/document-template.ts} +3 -3
- package/src/med_editor/framework/document-textline-mode.ts +34 -0
- package/{lib/framework/element-define.js → src/med_editor/framework/element-define.ts} +301 -206
- package/src/med_editor/framework/element-event-define.ts +141 -0
- package/{lib/framework/element-measure.js → src/med_editor/framework/element-measure.ts} +143 -121
- package/{lib/framework/element-paint.js → src/med_editor/framework/element-paint.ts} +44 -38
- package/{lib/framework/element-props.js → src/med_editor/framework/element-props.ts} +331 -202
- package/{lib/framework/element-reader.js → src/med_editor/framework/element-reader.ts} +39 -31
- package/{lib/framework/element-render-cut.js → src/med_editor/framework/element-render-cut.ts} +113 -106
- package/{lib/framework/element-serialize.js → src/med_editor/framework/element-serialize.ts} +37 -24
- package/{lib/framework/element-util.js → src/med_editor/framework/element-util.ts} +317 -216
- package/{lib/framework/impl/checkbox/checkbox-impl.js → src/med_editor/framework/impl/checkbox/checkbox-impl.ts} +27 -20
- package/{lib/framework/impl/comments/comment-content-impl.js → src/med_editor/framework/impl/comments/comment-content-impl.ts} +45 -31
- package/{lib/framework/impl/comments/comment-element-impl.js → src/med_editor/framework/impl/comments/comment-element-impl.ts} +23 -20
- package/{lib/framework/impl/comments/comments-container-impl.js → src/med_editor/framework/impl/comments/comments-container-impl.ts} +22 -16
- package/{lib/framework/impl/comments/comments-util.js → src/med_editor/framework/impl/comments/comments-util.ts} +34 -17
- package/{lib/framework/impl/comments/validate-msg-impl.js → src/med_editor/framework/impl/comments/validate-msg-impl.ts} +28 -17
- package/{lib/framework/impl/data-element/data-decorate-impl.js → src/med_editor/framework/impl/data-element/data-decorate-impl.ts} +26 -22
- package/{lib/framework/impl/data-element/data-element-barcode.js → src/med_editor/framework/impl/data-element/data-element-barcode.ts} +41 -29
- package/{lib/framework/impl/data-element/data-element-base-impl.js → src/med_editor/framework/impl/data-element/data-element-base-impl.ts} +73 -44
- package/{lib/framework/impl/data-element/data-element-check-impl.js → src/med_editor/framework/impl/data-element/data-element-check-impl.ts} +48 -35
- package/{lib/framework/impl/data-element/data-element-date-impl.js → src/med_editor/framework/impl/data-element/data-element-date-impl.ts} +41 -24
- package/{lib/framework/impl/data-element/data-element-group-impl.js → src/med_editor/framework/impl/data-element/data-element-group-impl.ts} +52 -32
- package/{lib/framework/impl/data-element/data-element-image-impl.js → src/med_editor/framework/impl/data-element/data-element-image-impl.ts} +38 -28
- package/{lib/framework/impl/data-element/data-element-list-impl.js → src/med_editor/framework/impl/data-element/data-element-list-impl.ts} +42 -31
- package/{lib/framework/impl/data-element/data-element-text-impl.js → src/med_editor/framework/impl/data-element/data-element-text-impl.ts} +36 -22
- package/{lib/framework/impl/decorate/fill-null-space-imple.js → src/med_editor/framework/impl/decorate/fill-null-space-imple.ts} +15 -10
- package/{lib/framework/impl/document/doc-body-impl.js → src/med_editor/framework/impl/document/doc-body-impl.ts} +32 -16
- package/{lib/framework/impl/document/doc-body-part-impl.js → src/med_editor/framework/impl/document/doc-body-part-impl.ts} +27 -17
- package/src/med_editor/framework/impl/document/doc-container-impl.ts +24 -0
- package/{lib/framework/impl/document/doc-footer-impl.js → src/med_editor/framework/impl/document/doc-footer-impl.ts} +30 -19
- package/{lib/framework/impl/document/doc-header-impl.js → src/med_editor/framework/impl/document/doc-header-impl.ts} +34 -17
- package/{lib/framework/impl/document/doc-impl.js → src/med_editor/framework/impl/document/doc-impl.ts} +62 -45
- package/{lib/framework/impl/media-formula/menstrual-history.js → src/med_editor/framework/impl/media-formula/menstrual-history.ts} +58 -36
- package/{lib/framework/impl/paragraph/p-impl.js → src/med_editor/framework/impl/paragraph/p-impl.ts} +64 -30
- package/{lib/framework/impl/picture/image-impl.js → src/med_editor/framework/impl/picture/image-impl.ts} +37 -25
- package/{lib/framework/impl/radio/radio-impl.js → src/med_editor/framework/impl/radio/radio-impl.ts} +28 -21
- package/{lib/framework/impl/symbol/br-symbol-impl.js → src/med_editor/framework/impl/symbol/br-symbol-impl.ts} +21 -15
- package/{lib/framework/impl/symbol/p-symbol-impl.js → src/med_editor/framework/impl/symbol/p-symbol-impl.ts} +15 -12
- package/{lib/framework/impl/table/table-cell-impl.js → src/med_editor/framework/impl/table/table-cell-impl.ts} +41 -30
- package/{lib/framework/impl/table/table-impl.js → src/med_editor/framework/impl/table/table-impl.ts} +122 -84
- package/{lib/framework/impl/table/table-row-impl.js → src/med_editor/framework/impl/table/table-row-impl.ts} +26 -18
- package/{lib/framework/impl/table/table-split-cell-patch.js → src/med_editor/framework/impl/table/table-split-cell-patch.ts} +31 -22
- package/{lib/framework/impl/table/table-split-cell.js → src/med_editor/framework/impl/table/table-split-cell.ts} +105 -94
- package/{lib/framework/impl/table/table-util.js → src/med_editor/framework/impl/table/table-util.ts} +197 -159
- package/{lib/framework/impl/text/text-impl.js → src/med_editor/framework/impl/text/text-impl.ts} +49 -35
- package/{lib/framework/impl/text/track-run-impl.js → src/med_editor/framework/impl/text/track-run-impl.ts} +53 -30
- package/{lib/framework/notify.js → src/med_editor/framework/notify.ts} +50 -36
- package/{lib/framework/range-util.js → src/med_editor/framework/range-util.ts} +80 -71
- package/{lib/framework/render-context.js → src/med_editor/framework/render-context.ts} +111 -64
- package/{lib/framework/render-define.js → src/med_editor/framework/render-define.ts} +90 -61
- package/{lib/framework/selection-overlays.js → src/med_editor/framework/selection-overlays.ts} +25 -16
- package/{lib/texteditor.js → src/med_editor/texteditor.ts} +288 -191
- package/src/med_editor/util/subject.ts +118 -0
- package/{lib/util/table-bind.js → src/med_editor/util/table-bind.ts} +2 -2
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +315 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/211/271/346/263/250.json +122 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/226/207/346/241/243/351/252/214/350/257/201.json +3599 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/351/225/277/346/226/207/346/234/254.json +24586 -0
- package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +2874 -0
- package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +341 -0
- package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +2201 -0
- package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +1069 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/206/205/351/225/234/344/270/213/346/262/273/347/226/227/350/256/260/345/275/225.json +125 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225/346/250/241/346/235/277.json +86 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/227/245/345/270/270/347/227/205/347/250/213/350/256/260/345/275/225.json +115 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/237/245/346/210/277/350/256/260/345/275/2251.json +108 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//351/246/226/346/254/241/344/270/212/347/272/247/345/214/273/345/270/210/346/237/245/346/210/277/350/256/260/345/275/225.json +272 -0
- package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +1070 -0
- package/lib/doc-ruler.d.ts +0 -51
- package/lib/doc-ruler.js.map +0 -1
- package/lib/framework/common-util.d.ts +0 -63
- package/lib/framework/common-util.js +0 -178
- package/lib/framework/common-util.js.map +0 -1
- package/lib/framework/document-change.d.ts +0 -265
- package/lib/framework/document-change.js.map +0 -1
- package/lib/framework/document-combine.d.ts +0 -24
- package/lib/framework/document-combine.js.map +0 -1
- package/lib/framework/document-comment.d.ts +0 -46
- package/lib/framework/document-comment.js.map +0 -1
- package/lib/framework/document-context.d.ts +0 -149
- package/lib/framework/document-context.js.map +0 -1
- package/lib/framework/document-eval-func.d.ts +0 -18
- package/lib/framework/document-eval-func.js.map +0 -1
- package/lib/framework/document-event.d.ts +0 -213
- package/lib/framework/document-event.js.map +0 -1
- package/lib/framework/document-history.d.ts +0 -26
- package/lib/framework/document-history.js.map +0 -1
- package/lib/framework/document-images-loader.d.ts +0 -16
- package/lib/framework/document-images-loader.js.map +0 -1
- package/lib/framework/document-input-cursor.d.ts +0 -78
- package/lib/framework/document-input-cursor.js.map +0 -1
- package/lib/framework/document-paint.d.ts +0 -34
- package/lib/framework/document-paint.js.map +0 -1
- package/lib/framework/document-print-offscreen.d.ts +0 -38
- package/lib/framework/document-print-offscreen.js.map +0 -1
- package/lib/framework/document-print.d.ts +0 -60
- package/lib/framework/document-print.js.map +0 -1
- package/lib/framework/document-segmenter.d.ts +0 -2
- package/lib/framework/document-segmenter.js +0 -106
- package/lib/framework/document-segmenter.js.map +0 -1
- package/lib/framework/document-selection.d.ts +0 -89
- package/lib/framework/document-selection.js.map +0 -1
- package/lib/framework/document-template.d.ts +0 -4
- package/lib/framework/document-template.js.map +0 -1
- package/lib/framework/document-textline-mode.d.ts +0 -7
- package/lib/framework/document-textline-mode.js +0 -30
- package/lib/framework/document-textline-mode.js.map +0 -1
- package/lib/framework/element-define.d.ts +0 -319
- package/lib/framework/element-define.js.map +0 -1
- package/lib/framework/element-event-define.d.ts +0 -99
- package/lib/framework/element-event-define.js +0 -108
- package/lib/framework/element-event-define.js.map +0 -1
- package/lib/framework/element-measure.d.ts +0 -97
- package/lib/framework/element-measure.js.map +0 -1
- package/lib/framework/element-paint.d.ts +0 -42
- package/lib/framework/element-paint.js.map +0 -1
- package/lib/framework/element-props.d.ts +0 -301
- package/lib/framework/element-props.js.map +0 -1
- package/lib/framework/element-reader.d.ts +0 -19
- package/lib/framework/element-reader.js.map +0 -1
- package/lib/framework/element-render-cut.d.ts +0 -55
- package/lib/framework/element-render-cut.js.map +0 -1
- package/lib/framework/element-serialize.d.ts +0 -30
- package/lib/framework/element-serialize.js.map +0 -1
- package/lib/framework/element-util.d.ts +0 -369
- package/lib/framework/element-util.js.map +0 -1
- package/lib/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
- package/lib/framework/impl/checkbox/checkbox-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-content-impl.d.ts +0 -40
- package/lib/framework/impl/comments/comment-content-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-element-impl.d.ts +0 -21
- package/lib/framework/impl/comments/comment-element-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-container-impl.d.ts +0 -22
- package/lib/framework/impl/comments/comments-container-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-util.d.ts +0 -12
- package/lib/framework/impl/comments/comments-util.js.map +0 -1
- package/lib/framework/impl/comments/validate-msg-impl.d.ts +0 -21
- package/lib/framework/impl/comments/validate-msg-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-decorate-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-barcode.d.ts +0 -31
- package/lib/framework/impl/data-element/data-element-barcode.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
- package/lib/framework/impl/data-element/data-element-base-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
- package/lib/framework/impl/data-element/data-element-check-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-date-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-group-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-element-image-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
- package/lib/framework/impl/data-element/data-element-list-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-text-impl.js.map +0 -1
- package/lib/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
- package/lib/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
- package/lib/framework/impl/document/doc-body-impl.d.ts +0 -27
- package/lib/framework/impl/document/doc-body-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-body-part-impl.d.ts +0 -30
- package/lib/framework/impl/document/doc-body-part-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-container-impl.d.ts +0 -16
- package/lib/framework/impl/document/doc-container-impl.js +0 -21
- package/lib/framework/impl/document/doc-container-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-footer-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-footer-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-header-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-header-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-impl.d.ts +0 -61
- package/lib/framework/impl/document/doc-impl.js.map +0 -1
- package/lib/framework/impl/media-formula/menstrual-history.d.ts +0 -35
- package/lib/framework/impl/media-formula/menstrual-history.js.map +0 -1
- package/lib/framework/impl/paragraph/p-impl.d.ts +0 -45
- package/lib/framework/impl/paragraph/p-impl.js.map +0 -1
- package/lib/framework/impl/picture/image-impl.d.ts +0 -31
- package/lib/framework/impl/picture/image-impl.js.map +0 -1
- package/lib/framework/impl/radio/radio-impl.d.ts +0 -22
- package/lib/framework/impl/radio/radio-impl.js.map +0 -1
- package/lib/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
- package/lib/framework/impl/symbol/br-symbol-impl.js.map +0 -1
- package/lib/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
- package/lib/framework/impl/symbol/p-symbol-impl.js.map +0 -1
- package/lib/framework/impl/table/table-cell-impl.d.ts +0 -37
- package/lib/framework/impl/table/table-cell-impl.js.map +0 -1
- package/lib/framework/impl/table/table-impl.d.ts +0 -55
- package/lib/framework/impl/table/table-impl.js.map +0 -1
- package/lib/framework/impl/table/table-row-impl.d.ts +0 -26
- package/lib/framework/impl/table/table-row-impl.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell-patch.d.ts +0 -20
- package/lib/framework/impl/table/table-split-cell-patch.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell.d.ts +0 -90
- package/lib/framework/impl/table/table-split-cell.js.map +0 -1
- package/lib/framework/impl/table/table-util.d.ts +0 -150
- package/lib/framework/impl/table/table-util.js.map +0 -1
- package/lib/framework/impl/text/text-impl.d.ts +0 -32
- package/lib/framework/impl/text/text-impl.js.map +0 -1
- package/lib/framework/impl/text/track-run-impl.d.ts +0 -27
- package/lib/framework/impl/text/track-run-impl.js.map +0 -1
- package/lib/framework/notify.d.ts +0 -13
- package/lib/framework/notify.js.map +0 -1
- package/lib/framework/range-util.d.ts +0 -40
- package/lib/framework/range-util.js.map +0 -1
- package/lib/framework/render-context.d.ts +0 -91
- package/lib/framework/render-context.js.map +0 -1
- package/lib/framework/render-define.d.ts +0 -109
- package/lib/framework/render-define.js.map +0 -1
- package/lib/framework/selection-overlays.d.ts +0 -30
- package/lib/framework/selection-overlays.js.map +0 -1
- package/lib/texteditor.d.ts +0 -318
- package/lib/texteditor.js.map +0 -1
- package/lib/util/subject.d.ts +0 -34
- package/lib/util/subject.js +0 -88
- package/lib/util/subject.js.map +0 -1
- package/lib/util/table-bind.d.ts +0 -5
- package/lib/util/table-bind.js.map +0 -1
@@ -1,15 +1,20 @@
|
|
1
|
-
import {
|
1
|
+
import { read } from "fs";
|
2
|
+
import { Subject } from "rxjs";
|
3
|
+
import { debounceTime, filter } from 'rxjs/operators'
|
4
|
+
import { EditorContext } from "./document-context";
|
5
|
+
import { ElementReader } from "./element-reader";
|
2
6
|
import { ElementSerialize } from "./element-serialize";
|
7
|
+
|
8
|
+
export interface DocumentHistoryItem {
|
9
|
+
content: any,
|
10
|
+
time: Date
|
11
|
+
}
|
3
12
|
/**
|
4
|
-
* 支持文档重做和撤销的类
|
13
|
+
* 支持文档重做和撤销的类
|
5
14
|
*/
|
6
15
|
export class DocumentHistory {
|
7
|
-
|
8
|
-
reader
|
9
|
-
task = Promise.resolve();
|
10
|
-
constructor(docCtx, reader, onDocChangedEvent) {
|
11
|
-
this.docCtx = docCtx;
|
12
|
-
this.reader = reader;
|
16
|
+
task: Promise<void> = Promise.resolve();
|
17
|
+
constructor(public docCtx: EditorContext, public reader: ElementReader, onDocChangedEvent: Subject<void>) {
|
13
18
|
onDocChangedEvent.pipe(filter(() => this.docCtx.viewOptions.enableUndo), debounceTime(1500)).subscribe(() => {
|
14
19
|
this.task.then(() => {
|
15
20
|
if (!this.docCtx.viewOptions.enableUndo || !this.docCtx.isDirty) {
|
@@ -19,10 +24,10 @@ export class DocumentHistory {
|
|
19
24
|
});
|
20
25
|
});
|
21
26
|
}
|
22
|
-
_undoStack = [];
|
23
|
-
_index = -1;
|
24
|
-
maxLength = 50;
|
25
|
-
generateHistoryItem() {
|
27
|
+
private _undoStack: DocumentHistoryItem[] = [];
|
28
|
+
private _index: number = -1;
|
29
|
+
maxLength: number = 50;
|
30
|
+
generateHistoryItem(): void {
|
26
31
|
console.log('生成历史记录');
|
27
32
|
if (this.maxLength === this._undoStack.length) {
|
28
33
|
this._undoStack.shift();
|
@@ -35,31 +40,37 @@ export class DocumentHistory {
|
|
35
40
|
});
|
36
41
|
this._index++;
|
37
42
|
}
|
43
|
+
|
38
44
|
get index() {
|
39
45
|
return this._index;
|
40
46
|
}
|
47
|
+
|
41
48
|
get canUndo() {
|
42
49
|
return this._index > 0;
|
43
50
|
}
|
51
|
+
|
44
52
|
get canRedo() {
|
45
53
|
return this._index < this._undoStack.length - 1;
|
46
54
|
}
|
55
|
+
|
47
56
|
undo() {
|
48
57
|
if (this.canUndo) {
|
49
58
|
this._index--;
|
50
59
|
this.reader.read(this._undoStack[this._index].content);
|
51
60
|
}
|
52
61
|
}
|
62
|
+
|
53
63
|
redo() {
|
54
64
|
if (this.canRedo) {
|
55
65
|
this._index++;
|
56
66
|
this.reader.read(this._undoStack[this._index].content);
|
57
67
|
}
|
58
68
|
}
|
69
|
+
|
59
70
|
clear() {
|
60
71
|
this._undoStack = [];
|
61
72
|
this._index = -1;
|
62
73
|
this.generateHistoryItem();
|
63
74
|
}
|
64
|
-
|
65
|
-
|
75
|
+
|
76
|
+
}
|
@@ -1,9 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { IImageLoader, ImageSourceItem } from "./document-context";
|
2
|
+
import { ImgLoadStatus } from "./element-define";
|
3
|
+
|
4
|
+
export class DocumentImagesLoader implements IImageLoader {
|
5
|
+
images: Array<ImageSourceItem> = [];
|
6
|
+
|
7
|
+
clear(): void {
|
4
8
|
this.images.length = 0;
|
5
9
|
}
|
6
|
-
|
10
|
+
|
11
|
+
loadImage(src: string, onCallback: (status: ImgLoadStatus) => void): void {
|
7
12
|
if (!src) {
|
8
13
|
return;
|
9
14
|
}
|
@@ -12,55 +17,58 @@ export class DocumentImagesLoader {
|
|
12
17
|
if (matchItem) {
|
13
18
|
if (matchItem.loadStatus === 'no') {
|
14
19
|
matchItem.cbs.push(onCallback);
|
15
|
-
}
|
16
|
-
else {
|
20
|
+
} else {
|
17
21
|
onCallback(matchItem.loadStatus);
|
18
22
|
}
|
19
23
|
return;
|
20
24
|
}
|
21
25
|
const ele = new Image();
|
22
26
|
ele.src = src;
|
23
|
-
const task = new Promise((r, i) => {
|
27
|
+
const task = new Promise<void>((r, i) => {
|
24
28
|
ele.onload = (e) => { this.invokeImgLoad(src, 'completed'); r(); };
|
25
29
|
ele.onerror = (e) => { this.invokeImgLoad(src, 'error'); r(); };
|
26
30
|
});
|
27
|
-
const imgItem = {
|
31
|
+
const imgItem: ImageSourceItem = {
|
28
32
|
ele,
|
29
33
|
src,
|
30
34
|
cbs: [onCallback],
|
31
35
|
loadStatus: 'no',
|
32
36
|
task
|
33
37
|
};
|
34
|
-
this.images.push(imgItem)
|
38
|
+
this.images.push(imgItem)
|
35
39
|
// if (this.viewOptions.resourceMode === 'immediate') {
|
36
40
|
// ele.onload = (e) => { this.invokeImgLoad(src, 'completed'); };
|
37
41
|
// ele.onerror = (e) => { this.invokeImgLoad(src, 'error'); };
|
38
42
|
// }
|
39
43
|
}
|
40
|
-
|
44
|
+
|
45
|
+
invokeImgLoad(src: string, status: ImgLoadStatus): void {
|
41
46
|
const img = this.images.find(item => item.src === src);
|
42
47
|
if (img) {
|
43
48
|
img.loadStatus = status;
|
44
49
|
img.cbs.forEach(cb => cb(status));
|
45
50
|
}
|
46
51
|
}
|
47
|
-
|
52
|
+
|
53
|
+
getLoadTasks(): Array<Promise<void>> {
|
48
54
|
return this.images.map(item => item.task);
|
49
55
|
}
|
50
|
-
|
56
|
+
|
57
|
+
|
58
|
+
getImage(src: string): HTMLImageElement | undefined {
|
51
59
|
const img = this.images.find(item => item.src === src);
|
52
60
|
return img?.ele;
|
53
61
|
}
|
62
|
+
|
54
63
|
/**
|
55
64
|
* 判断图片是否都已经加载完毕
|
56
65
|
* 用于打印时判断,如果当前图片没有加载完毕就打印,图片是打印不出来
|
57
|
-
* @returns
|
66
|
+
* @returns
|
58
67
|
*/
|
59
|
-
imagesLoadCompleted() {
|
68
|
+
imagesLoadCompleted(): boolean {
|
60
69
|
if (this.images.length === 0) {
|
61
70
|
return true;
|
62
71
|
}
|
63
|
-
return this.images.every(item => ['completed', 'error'].includes(item.loadStatus))
|
72
|
+
return this.images.every(item => ['completed', 'error'].includes(item.loadStatus))
|
64
73
|
}
|
65
|
-
}
|
66
|
-
//# sourceMappingURL=document-images-loader.js.map
|
74
|
+
}
|
package/{lib/framework/document-input-cursor.js → src/med_editor/framework/document-input-cursor.ts}
RENAMED
@@ -1,70 +1,77 @@
|
|
1
1
|
import { fromEvent, Subject } from "rxjs";
|
2
|
+
import { LeafElement } from "./element-define";
|
2
3
|
import { KeyboradElementEvent } from "./element-event-define";
|
3
4
|
import { DocumentEvent } from "./document-event";
|
5
|
+
import { EditorContext } from "./document-context";
|
6
|
+
|
7
|
+
export interface ICompositionStartInfo {
|
8
|
+
element: LeafElement, offset: number
|
9
|
+
}
|
10
|
+
export interface InputData {
|
11
|
+
composition?: boolean;
|
12
|
+
//开启输入法后的光标的起点位置
|
13
|
+
compositionStartInfo?: ICompositionStartInfo;
|
14
|
+
//输入法之前输入的内容
|
15
|
+
prevInputData?: string;
|
16
|
+
data: string
|
17
|
+
}
|
18
|
+
|
4
19
|
/**
|
5
20
|
* 输入处理
|
6
21
|
*/
|
7
22
|
export class DocumentInput {
|
8
|
-
editInput;
|
9
|
-
editCursor;
|
10
|
-
cursorWrapper;
|
11
|
-
docCtx;
|
12
23
|
/**
|
13
24
|
* 光标是否可见
|
14
25
|
*/
|
15
|
-
_cursorVisibility = false;
|
26
|
+
private _cursorVisibility = false;
|
16
27
|
/**
|
17
28
|
* 光标闪烁状态
|
18
29
|
*/
|
19
|
-
_cursorBlinksState = false;
|
20
|
-
cursorBlinksIntervalID;
|
30
|
+
private _cursorBlinksState = false;
|
31
|
+
private cursorBlinksIntervalID: any;
|
21
32
|
//是否是开启输入法了
|
22
|
-
compositionStart = false;
|
33
|
+
private compositionStart = false;
|
23
34
|
//开启输入法后输入的文字
|
24
|
-
compositionPrevData;
|
35
|
+
private compositionPrevData!: string;
|
25
36
|
//开启输入法后的的元素
|
26
|
-
compositionStartInfo;
|
37
|
+
private compositionStartInfo!: ICompositionStartInfo | null;
|
27
38
|
//输入内容事件
|
28
|
-
onInputEvent = new Subject();
|
39
|
+
onInputEvent: Subject<InputData> = new Subject();
|
29
40
|
//backspace 键盘事件
|
30
|
-
onBackspaceEvent = new Subject();
|
41
|
+
onBackspaceEvent: Subject<KeyboardEvent> = new Subject();
|
31
42
|
//delete 键盘事件
|
32
|
-
onDeleteEvent = new Subject();
|
43
|
+
onDeleteEvent: Subject<KeyboardEvent> = new Subject();
|
33
44
|
//enter 键盘事件
|
34
|
-
onEnterEvent = new Subject();
|
45
|
+
onEnterEvent: Subject<void> = new Subject();
|
35
46
|
//左键
|
36
|
-
onLeftEvent = new Subject();
|
47
|
+
onLeftEvent: Subject<void> = new Subject();
|
37
48
|
//右键
|
38
|
-
onRightEvent = new Subject();
|
49
|
+
onRightEvent: Subject<void> = new Subject();
|
39
50
|
//复制
|
40
|
-
onCopyEvent = new Subject();
|
51
|
+
onCopyEvent: Subject<ClipboardEvent> = new Subject();
|
41
52
|
//剪切
|
42
|
-
onCutEvent = new Subject();
|
53
|
+
onCutEvent: Subject<ClipboardEvent> = new Subject();
|
43
54
|
//粘贴
|
44
|
-
onPasteEvent = new Subject();
|
55
|
+
onPasteEvent: Subject<ClipboardEvent> = new Subject();
|
45
56
|
//插入换行符
|
46
|
-
onInsertBr = new Subject();
|
57
|
+
onInsertBr: Subject<void> = new Subject();
|
47
58
|
//ctrl+A 全选事件
|
48
|
-
onSelectAllEvent = new Subject();
|
59
|
+
onSelectAllEvent: Subject<void> = new Subject();
|
49
60
|
//home 事件
|
50
|
-
onHomeEvent = new Subject();
|
61
|
+
onHomeEvent: Subject<void> = new Subject();
|
51
62
|
//end 事件
|
52
|
-
onEndEvent = new Subject();
|
53
|
-
onUpEvent = new Subject();
|
54
|
-
onDownEvent = new Subject();
|
55
|
-
constructor(editInput, editCursor, cursorWrapper, docCtx) {
|
56
|
-
this.editInput = editInput;
|
57
|
-
this.editCursor = editCursor;
|
58
|
-
this.cursorWrapper = cursorWrapper;
|
59
|
-
this.docCtx = docCtx;
|
63
|
+
onEndEvent: Subject<void> = new Subject();
|
64
|
+
onUpEvent: Subject<void> = new Subject();
|
65
|
+
onDownEvent: Subject<void> = new Subject();
|
66
|
+
constructor(private editInput: HTMLInputElement, private editCursor: HTMLSpanElement, private cursorWrapper: HTMLDivElement, private docCtx: EditorContext) {
|
60
67
|
this.startCursorBlinks();
|
61
68
|
fromEvent(this.editInput, 'blur').subscribe(() => {
|
62
69
|
this._cursorVisibility = false;
|
63
70
|
//console.log('输入框 blur');
|
64
|
-
})
|
71
|
+
})
|
65
72
|
fromEvent(this.editInput, 'focus').subscribe(() => {
|
66
73
|
//console.log('输入框 focus');
|
67
|
-
})
|
74
|
+
})
|
68
75
|
fromEvent(this.editInput, 'input').subscribe(() => {
|
69
76
|
if (this.compositionStart) {
|
70
77
|
return;
|
@@ -77,37 +84,37 @@ export class DocumentInput {
|
|
77
84
|
const { startControl, startOffset } = this.docCtx.selectionState;
|
78
85
|
this.onInputEvent.next({
|
79
86
|
data: this.editInput.value, prevInputData: '', compositionStartInfo: {
|
80
|
-
element: startControl,
|
87
|
+
element: startControl as LeafElement,
|
81
88
|
offset: startOffset
|
82
89
|
}
|
83
90
|
});
|
84
91
|
this.editInput.value = '';
|
85
92
|
}
|
86
|
-
})
|
87
|
-
fromEvent(this.editInput, 'compositionstart').subscribe((evt) => {
|
93
|
+
})
|
94
|
+
fromEvent<CompositionEvent>(this.editInput, 'compositionstart').subscribe((evt) => {
|
88
95
|
this.compositionStart = true;
|
89
96
|
this.compositionPrevData = '';
|
90
97
|
const { startControl, startOffset } = this.docCtx.selectionState;
|
91
98
|
//console.log('输入法开始');
|
92
99
|
this.compositionStartInfo = {
|
93
|
-
element: startControl,
|
100
|
+
element: startControl as LeafElement,
|
94
101
|
offset: startOffset
|
95
102
|
};
|
96
103
|
});
|
97
|
-
fromEvent(this.editInput, 'compositionupdate').subscribe((evt) => {
|
104
|
+
fromEvent<CompositionEvent>(this.editInput, 'compositionupdate').subscribe((evt) => {
|
98
105
|
if (evt.data === this.compositionPrevData) {
|
99
106
|
return;
|
100
107
|
}
|
101
108
|
//console.log('输入了:' + evt.data);
|
102
109
|
this.onInputEvent.next({
|
103
110
|
data: evt.data,
|
104
|
-
compositionStartInfo: this.compositionStartInfo,
|
111
|
+
compositionStartInfo: this.compositionStartInfo as ICompositionStartInfo,
|
105
112
|
composition: true,
|
106
113
|
prevInputData: this.compositionPrevData
|
107
114
|
});
|
108
115
|
this.compositionPrevData = evt.data;
|
109
116
|
});
|
110
|
-
fromEvent(this.editInput, 'compositionend').subscribe((evt) => {
|
117
|
+
fromEvent<CompositionEvent>(this.editInput, 'compositionend').subscribe((evt) => {
|
111
118
|
//console.log('compositionend')
|
112
119
|
this.compositionStart = false;
|
113
120
|
this.editInput.value = "";
|
@@ -126,61 +133,55 @@ export class DocumentInput {
|
|
126
133
|
this.compositionStartInfo = null;
|
127
134
|
//this.compositionRecordContent = '';
|
128
135
|
});
|
129
|
-
fromEvent(this.editInput, 'keydown').subscribe((evt) => {
|
136
|
+
fromEvent<KeyboardEvent>(this.editInput, 'keydown').subscribe((evt) => {
|
130
137
|
const keyEvent = new KeyboradElementEvent(this.docCtx);
|
131
138
|
keyEvent.sourceEvent = evt;
|
132
|
-
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'Capture', this.docCtx)) {
|
139
|
+
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl as LeafElement, keyEvent, 'Capture', this.docCtx)) {
|
133
140
|
return;
|
134
141
|
}
|
135
142
|
if (evt.keyCode === 8) {
|
136
143
|
this.onBackspaceEvent.next(evt);
|
137
|
-
}
|
138
|
-
else if (evt.keyCode === 13 && !evt.shiftKey) {
|
144
|
+
} else if (evt.keyCode === 13 && !evt.shiftKey) {
|
139
145
|
this.onEnterEvent.next();
|
140
|
-
}
|
141
|
-
else if (evt.keyCode === 37) {
|
146
|
+
} else if (evt.keyCode === 37) {
|
142
147
|
this.onLeftEvent.next();
|
143
|
-
}
|
144
|
-
else if (evt.keyCode === 39) {
|
148
|
+
} else if (evt.keyCode === 39) {
|
145
149
|
this.onRightEvent.next();
|
146
|
-
}
|
147
|
-
else if (evt.keyCode === 38) {
|
150
|
+
} else if (evt.keyCode === 38) {
|
148
151
|
this.onUpEvent.next();
|
149
|
-
}
|
150
|
-
else if (evt.keyCode === 40) {
|
152
|
+
} else if (evt.keyCode === 40) {
|
151
153
|
this.onDownEvent.next();
|
152
154
|
}
|
153
155
|
else if (evt.keyCode === 9) {
|
154
156
|
evt.preventDefault();
|
155
|
-
}
|
156
|
-
else if (evt.keyCode === 13 && evt.shiftKey) {
|
157
|
+
} else if (evt.keyCode === 13 && evt.shiftKey) {
|
157
158
|
evt.preventDefault();
|
158
159
|
this.onInsertBr.next();
|
159
|
-
}
|
160
|
-
else if (evt.keyCode === 46) {
|
160
|
+
} else if (evt.keyCode === 46) {
|
161
161
|
this.onDeleteEvent.next(evt);
|
162
|
-
}
|
163
|
-
else if (evt.ctrlKey && evt.keyCode === 65) {
|
162
|
+
} else if (evt.ctrlKey && evt.keyCode === 65) {
|
164
163
|
evt.preventDefault();
|
165
164
|
this.onSelectAllEvent.next();
|
166
|
-
}
|
167
|
-
else if (evt.keyCode === 36) {
|
165
|
+
} else if (evt.keyCode === 36) {
|
168
166
|
this.onHomeEvent.next();
|
169
167
|
}
|
170
168
|
else if (evt.keyCode === 35) {
|
171
169
|
this.onEndEvent.next();
|
172
170
|
}
|
173
171
|
});
|
174
|
-
fromEvent(this.editInput, "copy").subscribe(evt => {
|
172
|
+
fromEvent<ClipboardEvent>(this.editInput, "copy").subscribe(evt => {
|
175
173
|
this.onCopyEvent.next(evt);
|
176
174
|
});
|
177
|
-
fromEvent(this.editInput, "paste").subscribe(evt => {
|
175
|
+
fromEvent<ClipboardEvent>(this.editInput, "paste").subscribe(evt => {
|
178
176
|
this.onPasteEvent.next(evt);
|
179
177
|
});
|
180
|
-
fromEvent(this.editInput, "cut").subscribe(evt => {
|
178
|
+
fromEvent<ClipboardEvent>(this.editInput, "cut").subscribe(evt => {
|
181
179
|
this.onCutEvent.next(evt);
|
182
180
|
});
|
183
181
|
}
|
182
|
+
|
183
|
+
|
184
|
+
|
184
185
|
/**
|
185
186
|
* 设置光标闪烁
|
186
187
|
*/
|
@@ -189,9 +190,11 @@ export class DocumentInput {
|
|
189
190
|
// //this.setCursorBlinks();
|
190
191
|
// }, 500);
|
191
192
|
}
|
192
|
-
|
193
|
+
|
194
|
+
destroy(): void {
|
193
195
|
clearInterval(this.cursorBlinksIntervalID);
|
194
196
|
}
|
197
|
+
|
195
198
|
/**
|
196
199
|
* 设置光标闪烁
|
197
200
|
*/
|
@@ -199,41 +202,43 @@ export class DocumentInput {
|
|
199
202
|
this.editCursor.style.background = this._cursorBlinksState ? 'transparent' : 'black';
|
200
203
|
this._cursorBlinksState = !this._cursorBlinksState;
|
201
204
|
}
|
205
|
+
|
202
206
|
/**
|
203
207
|
* 设置光标位置
|
204
208
|
* @param position
|
205
209
|
*/
|
206
|
-
setCursorPosition(position) {
|
210
|
+
setCursorPosition(position: { x: number; y: number; height: number; }) {
|
207
211
|
this.cursorWrapper.style.left = position.x + 'px';
|
208
212
|
this.cursorWrapper.style.top = position.y + 'px';
|
209
213
|
this.cursorWrapper.style.height = position.height + 'px';
|
210
214
|
this.setCursorVisibility(true);
|
211
215
|
//this.setCursorInputStatus();
|
212
216
|
}
|
217
|
+
|
213
218
|
/**
|
214
219
|
* 设置虚拟光标的可见性
|
215
220
|
* @param visibility
|
216
221
|
*/
|
217
|
-
setCursorVisibility(visibility) {
|
222
|
+
setCursorVisibility(visibility: boolean) {
|
218
223
|
this.cursorWrapper.style.display = visibility ? 'block' : 'none';
|
219
224
|
if (visibility) {
|
220
225
|
this.setInputFocus(true);
|
221
226
|
}
|
222
227
|
}
|
228
|
+
|
223
229
|
/**
|
224
230
|
* 设置输入状态
|
225
|
-
* @param focus
|
231
|
+
* @param focus
|
226
232
|
*/
|
227
|
-
setInputFocus(focus) {
|
233
|
+
setInputFocus(focus: boolean): void {
|
228
234
|
if (focus) {
|
229
235
|
this.editInput.readOnly = false;
|
230
236
|
this.editInput.focus();
|
231
|
-
|
232
|
-
else {
|
237
|
+
|
238
|
+
} else {
|
233
239
|
//this.editInput.blur();
|
234
240
|
this.editInput.readOnly = true;
|
235
241
|
this.docCtx.selectionState.cursorPos = null;
|
236
242
|
}
|
237
243
|
}
|
238
|
-
}
|
239
|
-
//# sourceMappingURL=document-input-cursor.js.map
|
244
|
+
}
|
@@ -1,32 +1,32 @@
|
|
1
1
|
import { ElementMeasure } from "./element-measure";
|
2
2
|
import { ElementPaint } from "./element-paint";
|
3
3
|
import { ElementRenderCut } from "./element-render-cut";
|
4
|
+
import { DocumentRenderObject } from "./impl/document/doc-impl";
|
5
|
+
import { RenderContenxtType } from "./render-context";
|
6
|
+
import { Element, SelectionContentRange, ViewOptions } from "./element-define";
|
4
7
|
import { DocumentContainerRender } from "./impl/document/doc-container-impl";
|
5
8
|
import { ElementUtil } from "./element-util";
|
6
9
|
import { DocumentSelection } from "./document-selection";
|
10
|
+
import { CommsContainerRenderObject } from "./impl/comments/comments-container-impl";
|
7
11
|
import { RangeUtil } from "./range-util";
|
8
12
|
import { SelectionOverlays } from "./selection-overlays";
|
13
|
+
import { EditorContext } from "./document-context";
|
14
|
+
import { CommContentElement, CommentRangeStatus } from "./impl/comments/comment-content-impl";
|
15
|
+
|
9
16
|
export class DocumentPaint {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
docPages;
|
18
|
-
docContainer;
|
19
|
-
commsContainer;
|
20
|
-
constructor(viewOptions, renderContext, docCtx, selectedSets) {
|
21
|
-
this.viewOptions = viewOptions;
|
22
|
-
this.renderContext = renderContext;
|
23
|
-
this.docCtx = docCtx;
|
24
|
-
this.selectedSets = selectedSets;
|
17
|
+
elementMeasure: ElementMeasure;
|
18
|
+
elementRenderCut: ElementRenderCut;
|
19
|
+
elementPaint: ElementPaint;
|
20
|
+
docPages!: Array<DocumentRenderObject>;
|
21
|
+
docContainer!: DocumentContainerRender;
|
22
|
+
commsContainer!: CommsContainerRenderObject;
|
23
|
+
constructor(private viewOptions: ViewOptions, private renderContext: RenderContenxtType, private docCtx: EditorContext, private selectedSets: Map<Element, SelectionContentRange>) {
|
25
24
|
this.elementMeasure = new ElementMeasure(this.viewOptions, this.renderContext);
|
26
25
|
this.elementRenderCut = new ElementRenderCut(this.viewOptions, this.renderContext);
|
27
26
|
this.elementPaint = new ElementPaint(this.viewOptions, this.renderContext);
|
28
27
|
}
|
29
|
-
|
28
|
+
|
29
|
+
rePages(): void {
|
30
30
|
// const destroyItems = [this.docContainer, this.commsContainer];
|
31
31
|
// destroyItems.forEach(item => item?.destroy())
|
32
32
|
//Promise.resolve().then(() => { destroyItems.forEach(item => item?.destroy()) });
|
@@ -38,9 +38,9 @@ export class DocumentPaint {
|
|
38
38
|
this.docContainer.rect.width = this.viewOptions.docPageSettings.width;
|
39
39
|
// console.time('排版计时');
|
40
40
|
const documentRender = this.elementMeasure.measureDocument(this.docCtx.document);
|
41
|
-
this.commsContainer = documentRender.getChild(3);
|
41
|
+
this.commsContainer = documentRender.getChild(3) as CommsContainerRenderObject;
|
42
42
|
if (this.commsContainer) {
|
43
|
-
this.commsContainer = this.commsContainer.clone();
|
43
|
+
this.commsContainer = this.commsContainer.clone() as CommsContainerRenderObject;
|
44
44
|
}
|
45
45
|
//console.timeEnd('排版计时');
|
46
46
|
//console.time('断页计时');
|
@@ -50,11 +50,14 @@ export class DocumentPaint {
|
|
50
50
|
ElementUtil.remeasure(this.docContainer);
|
51
51
|
this.setCommRangeMark();
|
52
52
|
this.docPages = docPages;
|
53
|
+
|
54
|
+
|
53
55
|
}
|
56
|
+
|
54
57
|
/**
|
55
58
|
* 获取设置文档容器的总高度
|
56
59
|
*/
|
57
|
-
getDocumentContainerHeight() {
|
60
|
+
getDocumentContainerHeight(): number {
|
58
61
|
if (this.docPages.length > 0) {
|
59
62
|
const lastPage = this.docPages[this.docPages.length - 1];
|
60
63
|
const lastPageY = lastPage.rect.y + lastPage.rect.height + this.viewOptions.docSpace;
|
@@ -64,29 +67,34 @@ export class DocumentPaint {
|
|
64
67
|
return 0;
|
65
68
|
}
|
66
69
|
}
|
67
|
-
|
70
|
+
|
71
|
+
refreshView(rePaint = false): void {
|
68
72
|
//console.time('计时');
|
69
73
|
this.elementPaint.drawPages(this.docContainer, this.selectedSets, this.commsContainer, rePaint);
|
70
74
|
//console.timeEnd('计时');
|
75
|
+
|
71
76
|
}
|
72
|
-
|
77
|
+
|
78
|
+
getDocPages(): Array<DocumentRenderObject> {
|
73
79
|
return this.docPages;
|
74
80
|
}
|
75
|
-
|
81
|
+
|
82
|
+
getDocContainer(): DocumentContainerRender {
|
76
83
|
return this.docContainer;
|
77
84
|
}
|
85
|
+
|
78
86
|
/***
|
79
87
|
* 设置审阅区间样式痕迹
|
80
88
|
*/
|
81
|
-
setCommRangeMark() {
|
89
|
+
setCommRangeMark(): void {
|
82
90
|
if (!this.viewOptions.showReviewWindow) {
|
83
91
|
return;
|
84
92
|
}
|
85
93
|
const cce = this.docCtx.document.commentsContainerElement;
|
86
|
-
const set = new Map();
|
87
|
-
const commentRangeStatus = [];
|
94
|
+
const set = new Map<Element, SelectionContentRange>();
|
95
|
+
const commentRangeStatus: Array<CommentRangeStatus> = [];
|
88
96
|
for (let i = 0; i < cce.length; i++) {
|
89
|
-
const commContent = cce.getChild(i);
|
97
|
+
const commContent = cce.getChild(i) as CommContentElement;
|
90
98
|
const { startMark, endMark, props: { id }, focus } = commContent;
|
91
99
|
const ancestorCommonControl = DocumentSelection.getAncestorCommonControl(startMark, endMark);
|
92
100
|
const commonRange = RangeUtil.getSelctionRange(startMark, 0, endMark, 1, ancestorCommonControl);
|
@@ -94,10 +102,9 @@ export class DocumentPaint {
|
|
94
102
|
commentRangeStatus.push({
|
95
103
|
commContent,
|
96
104
|
range: commonRange
|
97
|
-
})
|
105
|
+
})
|
98
106
|
}
|
99
107
|
this.commsContainer.selectedSet = set;
|
100
108
|
this.commsContainer.commentRangeStatus = commentRangeStatus;
|
101
109
|
}
|
102
110
|
}
|
103
|
-
//# sourceMappingURL=document-paint.js.map
|