mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2025-02-21 12:51:58 +00:00
!14599 修复ts接口省略模式不生效问题
Merge pull request !14599 from changleipeng/weekly_20240725
This commit is contained in:
commit
73e2456ec1
@ -329,6 +329,27 @@ bool GetTextStyleFromJS(napi_env env, napi_value argValue, TextStyle& textStyle)
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetParagraphStyleEllipsis(napi_env env, napi_value argValue, TypographyStyle& pographyStyle)
|
||||
{
|
||||
napi_value tempValue = nullptr;
|
||||
if (napi_get_named_property(env, argValue, "ellipsis", &tempValue) != napi_ok) {
|
||||
return;
|
||||
}
|
||||
std::string text = "";
|
||||
if (tempValue != nullptr && ConvertFromJsValue(env, tempValue, text)) {
|
||||
pographyStyle.ellipsis = Str8ToStr16(text);
|
||||
}
|
||||
|
||||
if (napi_get_named_property(env, argValue, "ellipsisMode", &tempValue) != napi_ok) {
|
||||
return;
|
||||
}
|
||||
uint32_t ellipsisModal = 0;
|
||||
if (tempValue != nullptr && napi_get_value_uint32(env, tempValue, &ellipsisModal) == napi_ok) {
|
||||
pographyStyle.ellipsisModal = EllipsisModal(ellipsisModal);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool GetParagraphStyleFromJS(napi_env env, napi_value argValue, TypographyStyle& pographyStyle)
|
||||
{
|
||||
if (argValue == nullptr) {
|
||||
@ -376,8 +397,12 @@ bool GetParagraphStyleFromJS(napi_env env, napi_value argValue, TypographyStyle&
|
||||
SetStrutStyleFromJS(env, strutStyleValue, pographyStyle);
|
||||
}
|
||||
|
||||
pographyStyle.ellipsis = textStyle.ellipsis;
|
||||
pographyStyle.ellipsisModal = textStyle.ellipsisModal;
|
||||
if (!textStyle.ellipsis.empty()) {
|
||||
pographyStyle.ellipsis = textStyle.ellipsis;
|
||||
pographyStyle.ellipsisModal = textStyle.ellipsisModal;
|
||||
} else {
|
||||
SetParagraphStyleEllipsis(env, argValue, pographyStyle);
|
||||
}
|
||||
|
||||
SetEnumValueFromJS(env, argValue, "textHeightBehavior", pographyStyle.textHeightBehavior);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user