From 3b1c36e017ec51c1ed45154edfb1e5d2a075b3e4 Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Sat, 14 Sep 2024 17:18:18 +0800 Subject: [PATCH] fix(TextBox): can not render markup text after Creating TextBox with contentHasMarkup. fixed #248 --- lib/document/TextBox.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/document/TextBox.js b/lib/document/TextBox.js index 19e68e55..c05d97d0 100644 --- a/lib/document/TextBox.js +++ b/lib/document/TextBox.js @@ -98,6 +98,7 @@ function TextBox( options ) { this.initChildren() ; + this.contentHasMarkup = options.contentHasMarkup ; if ( this.setContent === TextBox.prototype.setContent ) { this.setContent( options.content , options.contentHasMarkup , true ) ; } @@ -401,7 +402,6 @@ TextBox.prototype.getContent = function() { return this.textBuffer.getText() ; } TextBox.prototype.setContent = function( content , hasMarkup , dontDraw ) { - var contentSize ; if ( typeof content !== 'string' ) { if ( content === null || content === undefined ) { content = '' ; } @@ -409,9 +409,11 @@ TextBox.prototype.setContent = function( content , hasMarkup , dontDraw ) { } this.content = content ; - this.contentHasMarkup = hasMarkup ; + if (hasMarkup === undefined) { + hasMarkup = this.contentHasMarkup ; + } - this.textBuffer.setText( this.content , this.contentHasMarkup , this.textAttr ) ; + this.textBuffer.setText( content , hasMarkup , this.textAttr ) ; if ( this.stateMachine ) { this.textBuffer.runStateMachine() ;