@@ -191,7 +191,8 @@ class AnnotationEditor {
191191 this . _initialOptions . isCentered = parameters . isCentered ;
192192 this . _structTreeParentId = null ;
193193 this . annotationElementId = parameters . annotationElementId || null ;
194- this . creationDate = new Date ( ) ;
194+ this . creationDate = parameters . creationDate || new Date ( ) ;
195+ this . modificationDate = parameters . modificationDate || null ;
195196
196197 const {
197198 rotation,
@@ -1200,11 +1201,14 @@ class AnnotationEditor {
12001201 }
12011202
12021203 get comment ( ) {
1203- const comment = this . #comment;
1204+ const {
1205+ data : { richText, text, date, deleted } ,
1206+ } = this . #comment;
12041207 return {
1205- text : comment . data . text ,
1206- date : comment . data . date ,
1207- deleted : comment . isDeleted ( ) ,
1208+ text,
1209+ richText,
1210+ date,
1211+ deleted,
12081212 color : this . commentColor ,
12091213 } ;
12101214 }
@@ -1216,11 +1220,11 @@ class AnnotationEditor {
12161220 this . #comment. data = text ;
12171221 }
12181222
1219- setCommentData ( text ) {
1223+ setCommentData ( { comment , richText } ) {
12201224 if ( ! this . #comment) {
12211225 this . #comment = new Comment ( this ) ;
12221226 }
1223- this . #comment. setInitialText ( text ) ;
1227+ this . #comment. setInitialText ( comment , richText ) ;
12241228 }
12251229
12261230 get hasEditedComment ( ) {
@@ -1611,13 +1615,22 @@ class AnnotationEditor {
16111615 }
16121616
16131617 getData ( ) {
1618+ const {
1619+ comment : { text : str , date, deleted, richText } ,
1620+ uid : id ,
1621+ pageIndex,
1622+ creationDate,
1623+ modificationDate,
1624+ } = this ;
16141625 return {
1615- id : this . uid ,
1616- pageIndex : this . pageIndex ,
1626+ id,
1627+ pageIndex,
16171628 rect : this . getPDFRect ( ) ,
1618- contentsObj : { str : this . comment . text } ,
1619- creationDate : this . creationDate ,
1620- popupRef : ! this . #comment. isDeleted ( ) ,
1629+ richText,
1630+ contentsObj : { str } ,
1631+ creationDate,
1632+ modificationDate : date || modificationDate ,
1633+ popupRef : ! deleted ,
16211634 } ;
16221635 }
16231636
@@ -1774,6 +1787,8 @@ class AnnotationEditor {
17741787 id : parent . getNextId ( ) ,
17751788 uiManager,
17761789 annotationElementId : data . annotationElementId ,
1790+ creationDate : data . creationDate ,
1791+ modificationDate : data . modificationDate ,
17771792 } ) ;
17781793 editor . rotation = data . rotation ;
17791794 editor . #accessibilityData = data . accessibilityData ;
0 commit comments