!48512 新增text model ng create string类型方法

Merge pull request !48512 from gzwhdd/localgzw_revert1111
This commit is contained in:
openharmony_ci 2024-11-14 07:55:38 +00:00 committed by Gitee
commit 06469bfb07
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "core/components_ng/pattern/text/text_model_ng.h"
#include "base/geometry/dimension.h"
#include "base/utils/utf_helper.h"
#include "core/components/common/properties/alignment.h"
#include "core/components/common/properties/text_style.h"
#include "core/components_ng/base/frame_node.h"
@ -58,6 +59,11 @@ void TextModelNG::Create(const std::u16string& content)
textPattern->ClearSelectionMenu();
}
void TextModelNG::Create(const std::string& content)
{
Create(UtfUtils::Str8ToStr16(content));
}
void TextModelNG::Create(const RefPtr<SpanStringBase>& spanBase)
{
TextModelNG::Create(u"");

View File

@ -29,6 +29,7 @@ namespace OHOS::Ace::NG {
class ACE_EXPORT TextModelNG : public TextModel {
public:
void Create(const std::u16string& content) override;
void Create(const std::string& content) override;
void Create(const RefPtr<SpanStringBase>& spanString) override;
void SetFont(const Font& value) override;
void SetFontSize(const Dimension& value) override;