1## cl.arkui.1 Specification Change for RichEditor Menu Visibility When Scrolling After Popup 2 3**Access Level** 4 5Public API 6 7**Reason for Change** 8 9The default UX behavior regarding whether the **RichEditor** menu should be displayed after the popup and when scrolling stops has changed. 10 11**Change Impact** 12 13Before change: After the **RichEditor** menu is popped up, the menu is hidden when scrolling the component and does not automatically reappear after scrolling stops. 14 15After change: After the **RichEditor** menu is popped up, the menu is hidden when scrolling the component but will automatically reappear after scrolling stops. 16 17**Start API Level** 18 19API level 12 20 21**Change Since** 22 23OpenHarmony SDK version 5.0.0.24 24 25**Adaptation Guide** 26 27The default UX behavior has changed. No adaptation is needed. It does not affect the functional logic. Pay attention to the current rich text menu's UX performance when scrolling stops. 28 29## cl.arkui.2 Corner Customization for bindMenu and bindContextMenu Menus 30 31**Access Level** 32 33Public API 34 35**Reason for Change** 36 37Enhancement of functionality 38 39**Change Impact** 40 41This change is a compatible change. 42 43**API Level** 44 4512 46 47**Change Since** 48 49OpenHarmony SDK version 5.0.0.24 50 51**Key API/Component Changes** 52 53bindMenu, bindContextMenu 54 55**Adaptation Guide** 56 57This change is a compatible change, and no adaptation is needed. For details about how to use this feature, see [Menu Control](../../../application-dev/reference/apis-arkui/arkui-ts/ts-universal-attributes-menu.md). 58 59## cl.arkui.3 Specification Change in the Use of promptAction.showToast in Unclear UI Contexts 60 61**Access Level** 62 63Public API 64 65**Reason for Change** 66 67The functionality of this module relies on the UI execution context and should not be used in places where the UI context is unclear. If this interface is called within non-UI pages or some asynchronous callbacks, it may fail to track the current UI context, leading to incorrect calculation of the toast position. 68 69**Change Impact** 70 71Before change: In places with an unclear UI context, toasts could be displayed directly, but the position might be incorrect. 72 73After change: In places with an unclear UI context, users are required to specify the corresponding UIContext to obtain the promptAction object for displaying toasts. 74 75**Start API Level** 76 77API level 9 78 79**Change Since** 80 81OpenHarmony SDK version 5.0.0.24 82 83**Adaptation Guide** 84 85When attempting to display a toast within http requests, delays, or sub-windows, the toast may not appear, and the log may show an error code 11 returned by the window. In such cases, users need to specify the context manually, as in the following code example: 86 87```ts 88import promptAction from '@ohos.promptAction'; 89import http from '@ohos.net.http'; 90 91@Entry 92@Component 93struct Index { 94 @State message: string = 'Show toast'; 95 96 build() { 97 Row() { 98 Button() { 99 Text(this.message) 100 .fontSize(20) 101 .fontWeight(FontWeight.Bold) 102 } 103 .width('100%') 104 .onClick(()=>{ 105 let httpRequest = http.createHttp() 106 let uiContext = this.getUIContext() 107 httpRequest.request('https://xxx.com', { method: http.RequestMethod.GET }).then((res: http.HttpResponse) => { 108 let promptAction1 = uiContext.getPromptAction() 109 promptAction1.showToast({ 110 message:"Toast for success", 111 duration:1000, 112 showMode: promptAction.ToastShowMode.TOP_MOST 113 }) 114 }).catch((err: Error)=>{ 115 let promptAction1 = uiContext.getPromptAction() 116 promptAction1.showToast({ 117 message:"Toast for error", 118 duration:1000, 119 showMode: promptAction.ToastShowMode.TOP_MOST 120 }) 121 httpRequest.destroy() 122 }) 123 }) 124 } 125 .height('100%') 126 } 127} 128``` 129 130## cl.arkui.4 Default Unit Specification Change for backgroundImagePosition Parameter 131 132**Access Level** 133 134Public API 135 136**Reason for Change** 137 138The default unit value of the interface does not match the documentation description. 139 140**Change Impact** 141 142Before change: Numeric values entered for the position type were defaulted to px units. 143 144After change: Numeric values entered for the position type are defaulted to vp units. 145 146**Start API Level** 147 148The feature was at API level 7, and the change was made in API level 12. 149 150**Change Since** 151 152OpenHarmony SDK version 5.0.0.24 153 154**Adaptation Guide** 155 156The default behavior has changed, and no adaptation is required. However, you need to ensure that the new default effect meets expectations. If px units are needed, values can be concatenated as a string with "px" appended, or converted from px to vp before setting. 157 158## cl.arkui.5 Default Value Change for RicEditor Component's RichEditorTextStyle Universal Attribute 159 160**Access Level** 161 162Public API 163 164**Reason for Change** 165 166Enhancement of UX specifications. 167 168**Change Impact** 169 170This change is non-compatible. 171 1721. Modification of the font display size set in the **RichEditorTextStyle** universal attribute when the font size is 0. 173 174 - Before change: Content was not displayed when the font size was set to 0. 175 - After change: When the font size is set to 0, it displays with the default font size of 16fp. 176 1772. Modification of the default font color set in the **RichEditorTextStyle** universal attribute. 178 179 - Before change: The default font color was **Color.Black**. 180 - After change: The default font color is **font_primary** from system resources. 181 1823. Modification of the default text decoration color set in the **RichEditorTextStyle** universal attribute. 183 184 - Before change: The default decoration line color was **Color.Black**. 185 - After change: The default decoration line color follows the font color. 186 187**Start API Level** 188 18910 190 191**Change Since** 192 193OpenHarmony SDK version 5.0.0.24 194 195**Adaptation Guide** 196 197The default behavior has changed, and no adaptation is required. However, developers should ensure that the new default effects meet their expectations. If the new defaults do not meet the requirements, custom modifications to the effect control variables should be made to achieve the desired outcome. 198 199 200## cl.arkui.6 Change in Parent-Child Relationship When Using Custom Components in @Builder Function 201 202**Access Level** 203 204Public API 205 206**Reason for Change** 207 208When a Builder function is passed into a child component, the `this` within the child component refers to the parent component where the Builder function is defined. This can lead to runtime errors in certain scenarios, hence the change is necessary. 209 210**Change Impact** 211 212Example 1: 213 214```ts 215@Entry 216@Component 217struct Index { 218 @Builder thirdBuilder() { 219 Third() 220 } 221 build() { 222 Column() { 223 Second({secondBuilder: this.thirdBuilder.bind(this)}) 224 } 225 } 226} 227 228@Component 229struct Second { 230 @Provide message: string = 'Hello'; 231 @BuilderParam secondBuilder: ()=>void; 232 build() { 233 Column() { 234 this.secondBuilder() 235 } 236 } 237} 238 239@Component 240struct Third { 241 @Consume message: string; 242 build() { 243 Column() { 244 Text(this.message).fontSize(30) 245 } 246 } 247} 248``` 249 250Before the change: 251 252Executing the aforementioned code would result in a runtime error. 253 254 255 256After the change: 257 258No errors occur. 259 260**Scenario Examples Involved** 261 262Example of dialog nesting: 263 264```ts 265@Builder 266function customDialogBuilderFunc(){} 267 268@CustomDialog 269struct CustomDialogExampleTwo { 270 @BuilderParam grandsonBuilderFunc: ()=>void; 271 grandsonFunc: ()=>void = ()=>{}; 272 controllerTwo?: CustomDialogController; 273 @State message: string = "I'm the second dialog box."; 274 @State showIf: boolean = false; 275 build() { 276 Column() { 277 this.grandsonBuilderFunc() 278 Button("show/hide Text") 279 .onClick(()=>{ 280 this.grandsonFunc() 281 }) 282 Button ('Close Second Dialog Box') 283 .onClick(() => { 284 if (this.controllerTwo != undefined) { 285 this.controllerTwo.close() 286 } 287 }) 288 .margin(20) 289 } 290 } 291} 292 293@CustomDialog 294struct CustomDialogExample { 295 @BuilderParam childBuilderFunc: ()=>void = customDialogBuilderFunc; 296 childFunc: null | (()=>void) = null; 297 dialogControllerTwo: CustomDialogController | null = new CustomDialogController({ 298 builder: CustomDialogExampleTwo({grandsonBuilderFunc: this.childBuilderFunc, grandsonFunc: this.childFunc!}), 299 alignment: DialogAlignment.Bottom, 300 offset: { dx: 0, dy: -25 } }) 301 controller?: CustomDialogController; 302 303 build() { 304 Column() { 305 Button ('Open Second Dialog Box and close this box') 306 .onClick(() => { 307 this.controller!.close(); 308 this.dialogControllerTwo!.open(); 309 }) 310 .margin(20) 311 }.borderRadius(10) 312 } 313} 314 315@Entry 316@Component 317struct CustomDialogUser { 318 @State inputValue: string = 'Click Me'; 319 @State styleFlag: boolean = false; 320 @Builder parentBuilderFunc() { 321 if (this.styleFlag) { 322 Text(this.inputValue).fontSize(35) 323 } 324 } 325 parentFunc() { 326 this.styleFlag = !this.styleFlag; 327 } 328 dialogController: CustomDialogController | null = new CustomDialogController({ 329 builder: CustomDialogExample({childBuilderFunc: this.parentBuilderFunc.bind(this), childFunc: this.parentFunc.bind(this),}), 330 cancel: this.exitApp, 331 autoCancel: true, 332 alignment: DialogAlignment.Bottom, 333 offset: { dx: 0, dy: -20 }, 334 gridCount: 4, 335 customStyle: false 336 }) 337 338 339 aboutToDisappear() { 340 this.dialogController = null; 341 } 342 343 onCancel() { 344 console.info('Callback when the first button is clicked'); 345 } 346 347 onAccept() { 348 console.info('Callback when the second button is clicked'); 349 } 350 351 exitApp() { 352 console.info('Click the callback in the blank area'); 353 } 354 build() { 355 Column() { 356 Button(this.inputValue) 357 .onClick(() => { 358 if (this.dialogController != null) { 359 this.dialogController.open() 360 } 361 }).backgroundColor(0x317aff) 362 }.width('100%').margin({ top: 5 }) 363 } 364} 365``` 366 367Example of component freezing: 368 369```ts 370@Entry 371@Component 372struct Index { 373 @Builder 374 parentComponent() { 375 Third() 376 } 377 build() { 378 Column() { 379 Second({childBuilderParam: this.parentComponent.bind(this)}) 380 }.width('100%').margin({ top: 5 }) 381 } 382} 383 384@Component({freezeWhenInactive: true}) 385struct Second { 386 @BuilderParam childBuilderParam: ()=>void; 387 build() { 388 Column() { 389 this.childBuilderParam(); 390 }.width('100%').margin({ top: 5 }) 391 } 392} 393 394@Component 395struct Third { 396 @State message: string = '111'; 397 build() { 398 Column() { 399 Text(this.message) 400 }.width('100%').margin({ top: 5 }) 401 } 402} 403``` 404 405**Start API Level** 406 4079 408 409**Change Since** 410 411OpenHarmony SDK version 5.0.0.24 412 413**Key API/Component Changes** 414 415@Builder 416 417**Adaptation Guide** 418 419This change is a compatibility improvement. No adaptation is required. 420 421## cl.arkui.7 Change in the Rule for Handling Boundary Values of the Menu Component's radius API 422 423**Access Level** 424 425Public API 426 427**Reason for Change** 428 429Enhancement of UX specifications. 430 431**Change Impact** 432 433This change is non-compatible. 434 435Before the change: When the sum of the two maximum corner radii in the horizontal direction is greater than or equal to the menu's width, all four corners of the menu use the menu's default corner radius value. 436 437After the change: When the sum of the two maximum corner radii in the horizontal direction is greater than the menu's width, or when the sum of the two maximum corner radii in the vertical direction is greater than the menu's height, all four corners of the menu use the menu's default corner radius value. 438 439**API Level** 440 44112 442 443**Change Since** 444 445OpenHarmony SDK version 5.0.0.24 446 447**Key API/Component Changes** 448 449The radius interface within the Menu component. 450 451**Adaptation Guide** 452 453If the expectation is to use the menu's default corner radius, there is no need to set the radius property for the **Menu** component. 454 455If a custom corner radius is expected, it can be set through the radius interface with a custom value that does not exceed the boundary values. 456 457## cl.arkui.8 Specification Change for RichEditor's onWillChange and onDidChange Interfaces 458 459**Access Level** 460 461Public API 462 463**Reason for Change** 464 465Enhancement of interface capabilities. 466 467**Change Impact** 468 469This change is non-compatible. 470 471Before the change: 472 473The parameter of the **OnWillChange** callback function, **RichEditorChangeValue**, was information about the replaced span and the new span. 474The return value of the **OnDidChange** callback function was information about the new span. 475 476After the change: 477 478The parameter of the **OnWillChange** callback function, **RichEditorChangeValue**, is the index range of the replaced content and information about the new span. 479The return value of the **OnDidChange** callback function is the index range of the replaced content and the index range of the new content. 480 481**API Level** 482 48312 484 485**Change Since** 486 487OpenHarmony SDK version 5.0.0.24 488 489**Key API/Component Changes** 490 491The OnWillChange and OnDidChange interfaces of RichEditor. 492 493**Adaptation Guide** 494 495See [RichEditor](../../../application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-richeditor.md#example17) for the usage of the enhanced APIs. 496<!--no_check--> 497 498