1## cl.arkui.1 RichEditor菜单弹出时滚动组件后菜单显隐规格变更
2
3**访问级别**
4
5公开接口
6
7**变更原因**
8
9RichEditor菜单弹出后,滚动停止时菜单是否显示的UX默认行为改变
10
11**变更影响**
12
13变更前:RichEditor菜单弹出后,滚动组件时菜单隐藏,停止滚动时菜单不自动重新显示。
14
15变更后:RichEditor菜单弹出后,滚动组件时菜单隐藏,停止滚动时会自动重新显示。
16| 变更前 | 变更后 |
17|---------|---------|
18| ![alt text](menu_disappear_onScrollEnd.gif)| ![alt text](menu_appear_onScrollEnd.gif)|
19**起始API Level**
20
21该特性变更起始支持版本为 API 12。
22
23**变更发生版本**
24
25从OpenHarmony SDK 5.0.0.24开始。
26
27**适配指导**
28
29UX默认行为变更,无需适配。不影响功能逻辑,请关注当前富文本菜单在停止滚动时的UX表现。
30
31## cl.arkui.2 bindMenu、bindContextMenu菜单允许自定义圆角
32
33**访问级别**
34
35公开接口
36
37**变更原因**
38
39功能增强
40
41**变更影响**
42
43该变更为兼容性变更。
44
45**API Level**
46
4712
48
49**变更发生版本**
50
51从OpenHarmony SDK 5.0.0.24 版本开始。
52
53**变更的接口/组件**
54
55bindMenu、bindContextMenu
56
57**适配指导**
58
59该变更为兼容性变更,无需适配。如需使用该功能,请查阅[菜单控制](../../../application-dev/reference/apis-arkui/arkui-ts/ts-universal-attributes-menu.md)文档。
60
61## cl.arkui.3 在UI上下文不明确的地方,promptAction.showToast使用方式规格变更
62
63**访问级别**
64
65公开接口
66
67**变更原因**
68
69本模块功能依赖UI的执行上下文,不可在UI上下文不明确的地方使用,若在非UI页面中或者一些异步回调中调用此接口,可能无法跟踪到当前UI的上下文,导致toast位置计算错误。
70
71**变更影响**
72
73变更前:在UI上下文不明确的地方,可以直接弹出toast,但是位置可能错误。
74
75变更后:在UI上下文不明确的地方,需要用户指定相应的UIContext来获取promptAction对象,来弹出toast。
76
77**起始API Level**
78
79该特性变更起始支持版本为 API 9。
80
81**变更发生版本**
82
83从OpenHarmony SDK 5.0.0.24开始。
84
85**适配指导**
86
87在http、延时或者子窗口中弹toast,可能不会显示toast,并且日志中能看到窗口返回11的错误码,此时就需要用户自行指定上下文,代码如下
88```ts
89import promptAction from '@ohos.promptAction';
90import http from '@ohos.net.http';
91
92@Entry
93@Component
94struct Index {
95  @State message: string = '点这里会弹个toast';
96
97  build() {
98    Row() {
99      Button() {
100        Text(this.message)
101          .fontSize(20)
102          .fontWeight(FontWeight.Bold)
103      }
104      .width('100%')
105      .onClick(()=>{
106        let httpRequest = http.createHttp()
107        let uiContext = this.getUIContext()
108        httpRequest.request('https://xxx.com', { method: http.RequestMethod.GET }).then((res: http.HttpResponse) => {
109          let promptAction1 = uiContext.getPromptAction()
110          promptAction1.showToast({
111            message:"ok,我是toast",
112            duration:1000,
113            showMode: promptAction.ToastShowMode.TOP_MOST
114          })
115        }).catch((err: Error)=>{
116          let promptAction1 = uiContext.getPromptAction()
117          promptAction1.showToast({
118            message:"error,我是toast",
119            duration:1000,
120            showMode: promptAction.ToastShowMode.TOP_MOST
121          })
122          httpRequest.destroy()
123        })
124      })
125    }
126    .height('100%')
127  }
128}
129```
130
131## cl.arkui.4 backgroundImagePosition传入参数默认单位规格变更
132
133**访问级别**
134
135公开接口
136
137**变更原因**
138
139接口默认单位值与文档描述不符。
140
141**变更影响**
142
143变更前:position类型传入的数字值,默认单位当作px。
144
145变更后:position类型传入的数字值,默认单位当作vp。
146
147**起始API Level**
148
149该特性版本为API 7,变更版本为API 12。
150
151**变更发生版本**
152
153从OpenHarmony SDK 5.0.0.24开始。
154
155**适配指导**
156
157默认行为变更,无需适配,但应注意变更后的默认效果是否符合开发者预期,如需设置px单位的值,可拼接成数字加px的字符串,或者px2vp后设置。
158
159## cl.arkui.5 RicEditor组件RichEditorTextStyle通用属性默认值变更
160
161**访问级别**
162
163公开接口
164
165**变更原因**
166
167UX规格增强
168
169**变更影响**
170
171该变更为非兼容性变更。
172
1731. 修改RichEditorTextStyle通用属性中设置字体大小为0时的字体显示大小
174
175变更前,设置字体大小为0时內容不显示;
176
177变更后,设置字体大小为0时,显示为默认字体大小16fp。
178
1792. 修改RichEditorTextStyle通用属性中默认字体颜色
180
181变更前,默认字体颜色是Color.Black182
183变更后,默认字体颜色是是系统资源中的`font_primary`。
184
1853. 修改RichEditorTextStyle通用属性中默认字体颜色
186
187变更前,默认装饰线颜色是Color.Black188
189变更后,默认装饰线颜色为跟随字体颜色。
190
191**起始API Level**
192
19310
194
195**变更发生版本**
196
197从OpenHarmony SDK 5.0.0.24开始。
198
199**适配指导**
200
201默认行为变更,无需适配,但应注意变更后的默认效果是否符合开发者预期,如不符合则自定义修改效果控制变量以达到预期。
202
203
204## cl.arkui.6 @Builder函数中使用自定义组件关于父子关系的变更
205
206**访问级别**
207
208公开接口
209
210**变更原因**
211
212在子组件中传入Builder函数时,子组件的this会指向Builder函数所在的父组件,在某种场景下会导致运行报错,所以进行变更。
213
214**变更影响**
215
216示例如下1:
217
218```ts
219@Entry
220@Component
221struct Index {
222  @Builder thirdBuilder() {
223    Third()
224  }
225  build() {
226    Column() {
227      Second({secondBuilder: this.thirdBuilder.bind(this)})
228    }
229  }
230}
231
232@Component
233struct Second {
234  @Provide message: string = 'Hello';
235  @BuilderParam secondBuilder: ()=>void;
236  build() {
237    Column() {
238      this.secondBuilder()
239    }
240  }
241}
242
243@Component
244struct Third {
245  @Consume message: string;
246  build() {
247    Column() {
248      Text(this.message).fontSize(30)
249    }
250  }
251}
252```
253
254变更前:
255
256执行以上代码会报运行时错误
257
258![ScreenShot](ScreenShot_20240429152341.png)
259
260变更后:
261
262无报错
263
264**涉及场景示例**
265
266弹窗嵌套
267
268```ts
269@Builder
270function customDialogBuilderFunc(){}
271
272@CustomDialog
273struct CustomDialogExampleTwo {
274  @BuilderParam grandsonBuilderFunc: ()=>void;
275  grandsonFunc: ()=>void = ()=>{};
276  controllerTwo?: CustomDialogController;
277  @State message: string = "I'm the second dialog box.";
278  @State showIf: boolean = false;
279  build() {
280    Column() {
281      this.grandsonBuilderFunc()
282      Button("show/hide Text")
283        .onClick(()=>{
284          this.grandsonFunc()
285        })
286      Button ('Close Second Dialog Box')
287        .onClick(() => {
288          if (this.controllerTwo != undefined) {
289            this.controllerTwo.close()
290          }
291        })
292        .margin(20)
293    }
294  }
295}
296
297@CustomDialog
298struct CustomDialogExample {
299  @BuilderParam childBuilderFunc: ()=>void = customDialogBuilderFunc;
300  childFunc: null | (()=>void) = null;
301  dialogControllerTwo: CustomDialogController | null = new CustomDialogController({
302    builder: CustomDialogExampleTwo({grandsonBuilderFunc: this.childBuilderFunc, grandsonFunc: this.childFunc!}),
303    alignment: DialogAlignment.Bottom,
304    offset: { dx: 0, dy: -25 } })
305  controller?: CustomDialogController;
306
307  build() {
308    Column() {
309      Button ('Open Second Dialog Box and close this box')
310        .onClick(() => {
311          this.controller!.close();
312          this.dialogControllerTwo!.open();
313        })
314        .margin(20)
315    }.borderRadius(10)
316  }
317}
318
319@Entry
320@Component
321struct CustomDialogUser {
322  @State inputValue: string = 'Click Me';
323  @State styleFlag: boolean = false;
324  @Builder parentBuilderFunc() {
325    if (this.styleFlag) {
326      Text(this.inputValue).fontSize(35)
327    }
328  }
329  parentFunc() {
330    this.styleFlag = !this.styleFlag;
331  }
332  dialogController: CustomDialogController | null = new CustomDialogController({
333    builder: CustomDialogExample({childBuilderFunc: this.parentBuilderFunc.bind(this), childFunc: this.parentFunc.bind(this),}),
334    cancel: this.exitApp,
335    autoCancel: true,
336    alignment: DialogAlignment.Bottom,
337    offset: { dx: 0, dy: -20 },
338    gridCount: 4,
339    customStyle: false
340  })
341
342
343  aboutToDisappear() {
344    this.dialogController = null;
345  }
346
347  onCancel() {
348    console.info('Callback when the first button is clicked');
349  }
350
351  onAccept() {
352    console.info('Callback when the second button is clicked');
353  }
354
355  exitApp() {
356    console.info('Click the callback in the blank area');
357  }
358  build() {
359    Column() {
360      Button(this.inputValue)
361        .onClick(() => {
362          if (this.dialogController != null) {
363            this.dialogController.open()
364          }
365        }).backgroundColor(0x317aff)
366    }.width('100%').margin({ top: 5 })
367  }
368}
369```
370
371组件冻结
372
373```ts
374@Entry
375@Component
376struct Index {
377  @Builder
378  parentComponent() {
379    Third()
380  }
381  build() {
382    Column() {
383      Second({childBuilderParam: this.parentComponent.bind(this)})
384    }.width('100%').margin({ top: 5 })
385  }
386}
387
388@Component({freezeWhenInactive: true})
389struct Second {
390  @BuilderParam childBuilderParam: ()=>void;
391  build() {
392    Column() {
393      this.childBuilderParam();
394    }.width('100%').margin({ top: 5 })
395  }
396}
397
398@Component
399struct Third {
400  @State message: string = '111';
401  build() {
402    Column() {
403      Text(this.message)
404    }.width('100%').margin({ top: 5 })
405  }
406}
407```
408
409**起始API Level**
410
4119
412
413**变更发生版本**
414
415从OpenHarmony SDK 5.0.0.24 版本开始。
416
417**变更的接口/组件**
418
419@Builder
420
421**适配指导**
422
423该变更为兼容性变更,无需适配。
424
425## cl.arkui.7 Menu组件radius接口边界值处理规则变更
426
427**访问级别**
428
429公开接口
430
431**变更原因**
432
433UX规格增强
434
435**变更影响**
436
437该变更为非兼容性变更。
438
439变更前:当水平方向两个圆角半径之和的最大值大于等于菜单宽度时,菜单四个圆角均采用菜单默认圆角半径值;
440
441变更后:当水平方向两个圆角半径之和的最大值大于菜单宽度,或垂直方向两个圆角半径之和的最大值大于菜单高度时,菜单四个圆角均采用菜单默认圆角半径值。
442
443**API Level**
444
44512
446
447**变更发生版本**
448
449从OpenHarmony SDK 5.0.0.24 版本开始。
450
451**变更的接口/组件**
452
453Menu组件中的radius接口
454
455**适配指导**
456
457若预期是使用菜单默认圆角,则无需给Menu组件设置radius属性;
458若预期使用自定义圆角,可通过radius接口设置为自定义值,且自定义值不超出边界值。
459
460## cl.arkui.8 RichEditor的onWillChange、onDidChange接口规格变更
461
462**访问级别**
463
464公开接口
465
466**变更原因**
467
468接口能力增强
469
470**变更影响**
471
472该变更为非兼容性变更。
473
474变更前:
475
476OnWillChange回调函数的参数RichEditorChangeValue,是被替换的Span与新Span的信息。
477OnDidChange回调函数的返回值是新Span的信息。
478
479变更后:
480
481OnWillChange回调函数的参数RichEditorChangeValue,是被替换内容的索引范围与新Span的信息。
482OnDidChange回调函数的返回值,是被替换内容的索引范围与新内容的索引范围。
483
484
485**API Level**
486
48712
488
489**变更发生版本**
490
491从OpenHarmony SDK 5.0.0.24 版本开始。
492
493**变更的接口/组件**
494
495RichEditor的OnWillChange、OnDidChange接口。
496
497**适配指导**
498
499增强后的接口使用见[接口文档](../../../application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-richeditor.md#示例17)
500