1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Provides an interface for writing texts. 18 * 19 * @interface TextInterface 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 7 22 */ 23/** 24 * Provides an interface for writing texts. 25 * 26 * @interface TextInterface 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 9 29 * @form 30 */ 31/** 32 * Provides an interface for writing texts. 33 * 34 * @interface TextInterface 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @crossplatform 37 * @since 10 38 * @form 39 */ 40/** 41 * Provides an interface for writing texts. 42 * 43 * @interface TextInterface 44 * @syscap SystemCapability.ArkUI.ArkUI.Full 45 * @crossplatform 46 * @atomicservice 47 * @since 11 48 * @form 49 */ 50interface TextInterface { 51 /** 52 * Called when writing text. 53 * 54 * @param { string | Resource } content 55 * @returns { TextAttribute } 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @since 7 58 */ 59 /** 60 * Called when writing text. 61 * 62 * @param { string | Resource } content 63 * @returns { TextAttribute } 64 * @syscap SystemCapability.ArkUI.ArkUI.Full 65 * @since 9 66 * @form 67 */ 68 /** 69 * Called when writing text. 70 * 71 * @param { string | Resource } content 72 * @returns { TextAttribute } 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @since 10 76 * @form 77 */ 78 /** 79 * Called when writing text. 80 * 81 * @param { string | Resource } content 82 * @param { TextOptions } value 83 * @returns { TextAttribute } 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @crossplatform 86 * @atomicservice 87 * @since 11 88 * @form 89 */ 90 (content?: string | Resource, value?: TextOptions): TextAttribute; 91} 92 93/** 94 * @extends CommonMethod<TextAttribute> 95 * @syscap SystemCapability.ArkUI.ArkUI.Full 96 * @since 7 97 */ 98/** 99 * @extends CommonMethod<TextAttribute> 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @since 9 102 * @form 103 */ 104/** 105 * @extends CommonMethod<TextAttribute> 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @crossplatform 108 * @since 10 109 * @form 110 */ 111/** 112 * @extends CommonMethod<TextAttribute> 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @crossplatform 115 * @atomicservice 116 * @since 11 117 * @form 118 */ 119declare class TextAttribute extends CommonMethod<TextAttribute> { 120 /** 121 * Called when the font is set. 122 * 123 * @param { Font } value - the text font size and weight and family and style. 124 * @returns { TextAttribute } The attribute of the text. 125 * @syscap SystemCapability.ArkUI.ArkUI.Full 126 * @since 10 127 */ 128 /** 129 * Called when the font is set. 130 * 131 * @param { Font } value - the text font size and weight and family and style. 132 * @returns { TextAttribute } The attribute of the text. 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @crossplatform 135 * @atomicservice 136 * @since 11 137 */ 138 font(value: Font): TextAttribute; 139 140 /** 141 * Called when the font color is set. 142 * 143 * @param { ResourceColor } value 144 * @returns { TextAttribute } 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @since 7 147 */ 148 /** 149 * Called when the font color is set. 150 * 151 * @param { ResourceColor } value 152 * @returns { TextAttribute } 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @since 9 155 * @form 156 */ 157 /** 158 * Called when the font color is set. 159 * 160 * @param { ResourceColor } value 161 * @returns { TextAttribute } 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @crossplatform 164 * @since 10 165 * @form 166 */ 167 /** 168 * Called when the font color is set. 169 * 170 * @param { ResourceColor } value 171 * @returns { TextAttribute } 172 * @syscap SystemCapability.ArkUI.ArkUI.Full 173 * @crossplatform 174 * @atomicservice 175 * @since 11 176 * @form 177 */ 178 fontColor(value: ResourceColor): TextAttribute; 179 180 /** 181 * Called when the font size is set. 182 * 183 * @param { number | string | Resource } value 184 * @returns { TextAttribute } 185 * @syscap SystemCapability.ArkUI.ArkUI.Full 186 * @since 7 187 */ 188 /** 189 * Called when the font size is set. 190 * 191 * @param { number | string | Resource } value 192 * @returns { TextAttribute } 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @since 9 195 * @form 196 */ 197 /** 198 * Called when the font size is set. 199 * 200 * @param { number | string | Resource } value 201 * @returns { TextAttribute } 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @crossplatform 204 * @since 10 205 * @form 206 */ 207 /** 208 * Called when the font size is set. 209 * 210 * @param { number | string | Resource } value 211 * @returns { TextAttribute } 212 * @syscap SystemCapability.ArkUI.ArkUI.Full 213 * @crossplatform 214 * @atomicservice 215 * @since 11 216 * @form 217 */ 218 fontSize(value: number | string | Resource): TextAttribute; 219 220 /** 221 * Called when the minimum font size of the font is set. 222 * 223 * @param { number | string | Resource } value 224 * @returns { TextAttribute } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @since 7 227 */ 228 /** 229 * Called when the minimum font size of the font is set. 230 * 231 * @param { number | string | Resource } value 232 * @returns { TextAttribute } 233 * @syscap SystemCapability.ArkUI.ArkUI.Full 234 * @since 9 235 * @form 236 */ 237 /** 238 * Called when the minimum font size of the font is set. 239 * 240 * @param { number | string | Resource } value 241 * @returns { TextAttribute } 242 * @syscap SystemCapability.ArkUI.ArkUI.Full 243 * @crossplatform 244 * @since 10 245 * @form 246 */ 247 /** 248 * Called when the minimum font size of the font is set. 249 * 250 * @param { number | string | Resource } value 251 * @returns { TextAttribute } 252 * @syscap SystemCapability.ArkUI.ArkUI.Full 253 * @crossplatform 254 * @atomicservice 255 * @since 11 256 * @form 257 */ 258 minFontSize(value: number | string | Resource): TextAttribute; 259 260 /** 261 * Called when the maximum font size of the font is set. 262 * 263 * @param { number | string | Resource } value 264 * @returns { TextAttribute } 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 7 267 */ 268 /** 269 * Called when the maximum font size of the font is set. 270 * 271 * @param { number | string | Resource } value 272 * @returns { TextAttribute } 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @since 9 275 * @form 276 */ 277 /** 278 * Called when the maximum font size of the font is set. 279 * 280 * @param { number | string | Resource } value 281 * @returns { TextAttribute } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @since 10 285 * @form 286 */ 287 /** 288 * Called when the maximum font size of the font is set. 289 * 290 * @param { number | string | Resource } value 291 * @returns { TextAttribute } 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @crossplatform 294 * @atomicservice 295 * @since 11 296 * @form 297 */ 298 maxFontSize(value: number | string | Resource): TextAttribute; 299 300 /** 301 * Called when the font style of a font is set. 302 * 303 * @param { FontStyle } value 304 * @returns { TextAttribute } 305 * @syscap SystemCapability.ArkUI.ArkUI.Full 306 * @since 7 307 */ 308 /** 309 * Called when the font style of a font is set. 310 * 311 * @param { FontStyle } value 312 * @returns { TextAttribute } 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @since 9 315 * @form 316 */ 317 /** 318 * Called when the font style of a font is set. 319 * 320 * @param { FontStyle } value 321 * @returns { TextAttribute } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @crossplatform 324 * @since 10 325 * @form 326 */ 327 /** 328 * Called when the font style of a font is set. 329 * 330 * @param { FontStyle } value 331 * @returns { TextAttribute } 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @crossplatform 334 * @atomicservice 335 * @since 11 336 * @form 337 */ 338 fontStyle(value: FontStyle): TextAttribute; 339 340 /** 341 * Called when the font weight is set. 342 * 343 * @param { number | FontWeight | string } value 344 * @returns { TextAttribute } 345 * @syscap SystemCapability.ArkUI.ArkUI.Full 346 * @since 7 347 */ 348 /** 349 * Called when the font weight is set. 350 * 351 * @param { number | FontWeight | string } value 352 * @returns { TextAttribute } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @since 9 355 * @form 356 */ 357 /** 358 * Called when the font weight is set. 359 * 360 * @param { number | FontWeight | string } value 361 * @returns { TextAttribute } 362 * @syscap SystemCapability.ArkUI.ArkUI.Full 363 * @crossplatform 364 * @since 10 365 * @form 366 */ 367 /** 368 * Called when the font weight is set. 369 * 370 * @param { number | FontWeight | string } value 371 * @returns { TextAttribute } 372 * @syscap SystemCapability.ArkUI.ArkUI.Full 373 * @crossplatform 374 * @atomicservice 375 * @since 11 376 * @form 377 */ 378 fontWeight(value: number | FontWeight | string): TextAttribute; 379 380 /** 381 * Called when the horizontal center mode of the font is set. 382 * 383 * @param { TextAlign } value 384 * @returns { TextAttribute } 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @since 7 387 */ 388 /** 389 * Called when the horizontal center mode of the font is set. 390 * 391 * @param { TextAlign } value 392 * @returns { TextAttribute } 393 * @syscap SystemCapability.ArkUI.ArkUI.Full 394 * @since 9 395 * @form 396 */ 397 /** 398 * Called when the horizontal center mode of the font is set. 399 * 400 * @param { TextAlign } value 401 * @returns { TextAttribute } 402 * @syscap SystemCapability.ArkUI.ArkUI.Full 403 * @crossplatform 404 * @since 10 405 * @form 406 */ 407 /** 408 * Called when the horizontal center mode of the font is set. 409 * 410 * @param { TextAlign } value 411 * @returns { TextAttribute } 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @crossplatform 414 * @atomicservice 415 * @since 11 416 * @form 417 */ 418 textAlign(value: TextAlign): TextAttribute; 419 420 /** 421 * Called when the vertical center mode of the font is set. 422 * 423 * @param { number | string | Resource } value 424 * @returns { TextAttribute } 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @since 7 427 */ 428 /** 429 * Called when the vertical center mode of the font is set. 430 * 431 * @param { number | string | Resource } value 432 * @returns { TextAttribute } 433 * @syscap SystemCapability.ArkUI.ArkUI.Full 434 * @since 9 435 * @form 436 */ 437 /** 438 * Called when the vertical center mode of the font is set. 439 * 440 * @param { number | string | Resource } value 441 * @returns { TextAttribute } 442 * @syscap SystemCapability.ArkUI.ArkUI.Full 443 * @crossplatform 444 * @since 10 445 * @form 446 */ 447 /** 448 * Called when the vertical center mode of the font is set. 449 * 450 * @param { number | string | Resource } value 451 * @returns { TextAttribute } 452 * @syscap SystemCapability.ArkUI.ArkUI.Full 453 * @crossplatform 454 * @atomicservice 455 * @since 11 456 * @form 457 */ 458 lineHeight(value: number | string | Resource): TextAttribute; 459 460 /** 461 * Called when the overflow mode of the font is set. 462 * 463 * @param { object } value 464 * @returns { TextAttribute } 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @since 7 467 */ 468 /** 469 * Called when the overflow mode of the font is set. 470 * 471 * @param { object } value 472 * @returns { TextAttribute } 473 * @syscap SystemCapability.ArkUI.ArkUI.Full 474 * @since 9 475 * @form 476 */ 477 /** 478 * Called when the overflow mode of the font is set. 479 * 480 * @param { object } value 481 * @returns { TextAttribute } 482 * @syscap SystemCapability.ArkUI.ArkUI.Full 483 * @crossplatform 484 * @since 10 485 * @form 486 */ 487 /** 488 * Called when the overflow mode of the font is set. 489 * 490 * @param { object } value 491 * @returns { TextAttribute } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @atomicservice 495 * @since 11 496 * @form 497 */ 498 textOverflow(value: { overflow: TextOverflow }): TextAttribute; 499 500 /** 501 * Called when the font list of text is set. 502 * 503 * @param { string | Resource } value 504 * @returns { TextAttribute } 505 * @syscap SystemCapability.ArkUI.ArkUI.Full 506 * @since 7 507 */ 508 /** 509 * Called when the font list of text is set. 510 * 511 * @param { string | Resource } value 512 * @returns { TextAttribute } 513 * @syscap SystemCapability.ArkUI.ArkUI.Full 514 * @since 9 515 * @form 516 */ 517 /** 518 * Called when the font list of text is set. 519 * 520 * @param { string | Resource } value 521 * @returns { TextAttribute } 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @since 10 525 * @form 526 */ 527 /** 528 * Called when the font list of text is set. 529 * 530 * @param { string | Resource } value 531 * @returns { TextAttribute } 532 * @syscap SystemCapability.ArkUI.ArkUI.Full 533 * @crossplatform 534 * @atomicservice 535 * @since 11 536 * @form 537 */ 538 fontFamily(value: string | Resource): TextAttribute; 539 540 /** 541 * Called when the maximum number of lines of text is set. 542 * 543 * @param { number } value 544 * @returns { TextAttribute } 545 * @syscap SystemCapability.ArkUI.ArkUI.Full 546 * @since 7 547 */ 548 /** 549 * Called when the maximum number of lines of text is set. 550 * 551 * @param { number } value 552 * @returns { TextAttribute } 553 * @syscap SystemCapability.ArkUI.ArkUI.Full 554 * @since 9 555 * @form 556 */ 557 /** 558 * Called when the maximum number of lines of text is set. 559 * 560 * @param { number } value 561 * @returns { TextAttribute } 562 * @syscap SystemCapability.ArkUI.ArkUI.Full 563 * @crossplatform 564 * @since 10 565 * @form 566 */ 567 /** 568 * Called when the maximum number of lines of text is set. 569 * 570 * @param { number } value 571 * @returns { TextAttribute } 572 * @syscap SystemCapability.ArkUI.ArkUI.Full 573 * @crossplatform 574 * @atomicservice 575 * @since 11 576 * @form 577 */ 578 maxLines(value: number): TextAttribute; 579 580 /** 581 * Called when the text decoration of the text is set. 582 * 583 * @param { object } value 584 * @returns { TextAttribute } 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @since 7 587 */ 588 /** 589 * Called when the text decoration of the text is set. 590 * 591 * @param { object } value 592 * @returns { TextAttribute } 593 * @syscap SystemCapability.ArkUI.ArkUI.Full 594 * @since 9 595 * @form 596 */ 597 /** 598 * Called when the text decoration of the text is set. 599 * 600 * @param { object } value 601 * @returns { TextAttribute } 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @since 10 605 * @form 606 */ 607 /** 608 * Called when the text decoration of the text is set. 609 * 610 * @param { object } value 611 * @returns { TextAttribute } 612 * @syscap SystemCapability.ArkUI.ArkUI.Full 613 * @crossplatform 614 * @atomicservice 615 * @since 11 616 * @form 617 */ 618 decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute; 619 620 /** 621 * Called when the distance between text fonts is set. 622 * 623 * @param { number | string } value 624 * @returns { TextAttribute } 625 * @syscap SystemCapability.ArkUI.ArkUI.Full 626 * @since 7 627 */ 628 /** 629 * Called when the distance between text fonts is set. 630 * 631 * @param { number | string } value 632 * @returns { TextAttribute } 633 * @syscap SystemCapability.ArkUI.ArkUI.Full 634 * @since 9 635 * @form 636 */ 637 /** 638 * Called when the distance between text fonts is set. 639 * 640 * @param { number | string } value 641 * @returns { TextAttribute } 642 * @syscap SystemCapability.ArkUI.ArkUI.Full 643 * @crossplatform 644 * @since 10 645 * @form 646 */ 647 /** 648 * Called when the distance between text fonts is set. 649 * 650 * @param { number | string } value 651 * @returns { TextAttribute } 652 * @syscap SystemCapability.ArkUI.ArkUI.Full 653 * @crossplatform 654 * @atomicservice 655 * @since 11 656 * @form 657 */ 658 letterSpacing(value: number | string): TextAttribute; 659 660 /** 661 * Called when the type of letter in the text font is set. 662 * 663 * @param { TextCase } value 664 * @returns { TextAttribute } 665 * @syscap SystemCapability.ArkUI.ArkUI.Full 666 * @since 7 667 */ 668 /** 669 * Called when the type of letter in the text font is set. 670 * 671 * @param { TextCase } value 672 * @returns { TextAttribute } 673 * @syscap SystemCapability.ArkUI.ArkUI.Full 674 * @since 9 675 * @form 676 */ 677 /** 678 * Called when the type of letter in the text font is set. 679 * 680 * @param { TextCase } value 681 * @returns { TextAttribute } 682 * @syscap SystemCapability.ArkUI.ArkUI.Full 683 * @crossplatform 684 * @since 10 685 * @form 686 */ 687 /** 688 * Called when the type of letter in the text font is set. 689 * 690 * @param { TextCase } value 691 * @returns { TextAttribute } 692 * @syscap SystemCapability.ArkUI.ArkUI.Full 693 * @crossplatform 694 * @atomicservice 695 * @since 11 696 * @form 697 */ 698 textCase(value: TextCase): TextAttribute; 699 700 /** 701 * Called when the baseline offset is set. 702 * 703 * @param { number | string } value 704 * @returns { TextAttribute } 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @since 7 707 */ 708 /** 709 * Called when the baseline offset is set. 710 * 711 * @param { number | string } value 712 * @returns { TextAttribute } 713 * @syscap SystemCapability.ArkUI.ArkUI.Full 714 * @since 9 715 * @form 716 */ 717 /** 718 * Called when the baseline offset is set. 719 * 720 * @param { number | string } value 721 * @returns { TextAttribute } 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @since 10 725 * @form 726 */ 727 /** 728 * Called when the baseline offset is set. 729 * 730 * @param { number | string } value 731 * @returns { TextAttribute } 732 * @syscap SystemCapability.ArkUI.ArkUI.Full 733 * @crossplatform 734 * @atomicservice 735 * @since 11 736 * @form 737 */ 738 baselineOffset(value: number | string): TextAttribute; 739 740 /** 741 * Allow replication. 742 * 743 * @param { CopyOptions } value 744 * @returns { TextAttribute } 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @since 9 747 * @form 748 */ 749 /** 750 * Allow replication. 751 * 752 * @param { CopyOptions } value 753 * @returns { TextAttribute } 754 * @syscap SystemCapability.ArkUI.ArkUI.Full 755 * @crossplatform 756 * @since 10 757 * @form 758 */ 759 /** 760 * Allow replication. 761 * 762 * @param { CopyOptions } value 763 * @returns { TextAttribute } 764 * @syscap SystemCapability.ArkUI.ArkUI.Full 765 * @crossplatform 766 * @atomicservice 767 * @since 11 768 * @form 769 */ 770 copyOption(value: CopyOptions): TextAttribute; 771 772 /** 773 * Enable the selectable area can be dragged. 774 * 775 * @param { boolean } value 776 * @returns { TextAttribute } 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @since 9 779 */ 780 /** 781 * Enable the selectable area can be dragged. 782 * 783 * @param { boolean } value 784 * @returns { TextAttribute } 785 * @syscap SystemCapability.ArkUI.ArkUI.Full 786 * @atomicservice 787 * @since 11 788 */ 789 draggable(value: boolean): TextAttribute; 790 791 /** 792 * Called when the text shadow is set. 793 * 794 * @param { ShadowOptions } value - The shadow options. 795 * @returns { TextAttribute } 796 * @syscap SystemCapability.ArkUI.ArkUI.Full 797 * @crossplatform 798 * @since 10 799 * @form 800 */ 801 /** 802 * Called when the text shadow is set. 803 * 804 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 805 * @returns { TextAttribute } 806 * @syscap SystemCapability.ArkUI.ArkUI.Full 807 * @crossplatform 808 * @atomicservice 809 * @since 11 810 * @form 811 */ 812 textShadow(value: ShadowOptions | Array<ShadowOptions>): TextAttribute; 813 814 /** 815 * Called when the height adaptive policy is set. 816 * 817 * @param { TextHeightAdaptivePolicy } value - The height adaptive policy. 818 * @returns { TextAttribute } 819 * @syscap SystemCapability.ArkUI.ArkUI.Full 820 * @crossplatform 821 * @since 10 822 */ 823 /** 824 * Called when the height adaptive policy is set. 825 * 826 * @param { TextHeightAdaptivePolicy } value - The height adaptive policy. 827 * @returns { TextAttribute } 828 * @syscap SystemCapability.ArkUI.ArkUI.Full 829 * @crossplatform 830 * @atomicservice 831 * @since 11 832 */ 833 heightAdaptivePolicy(value: TextHeightAdaptivePolicy): TextAttribute; 834 835 /** 836 * Specify the indentation of the first line in a text-block. 837 * 838 * @param { Length } value - The length of text indent. 839 * @returns { TextAttribute } The attribute of the text. 840 * @syscap SystemCapability.ArkUI.ArkUI.Full 841 * @crossplatform 842 * @since 10 843 */ 844 /** 845 * Specify the indentation of the first line in a text-block. 846 * 847 * @param { Length } value - The length of text indent. 848 * @returns { TextAttribute } The attribute of the text. 849 * @syscap SystemCapability.ArkUI.ArkUI.Full 850 * @crossplatform 851 * @atomicservice 852 * @since 11 853 */ 854 textIndent(value: Length): TextAttribute; 855 856 /** 857 * Set the word break type. 858 * 859 * @param { WordBreak } value - The word break type. 860 * @returns { TextAttribute } The attribute of the text. 861 * @syscap SystemCapability.ArkUI.ArkUI.Full 862 * @crossplatform 863 * @atomicservice 864 * @since 11 865 */ 866 wordBreak(value: WordBreak): TextAttribute; 867 868 /** 869 * Called when using the Clipboard menu 870 * 871 * @param { function } callback - callback of the listened event. 872 * @returns { TextAttribute } The attribute of the text. 873 * @syscap SystemCapability.ArkUI.ArkUI.Full 874 * @crossplatform 875 * @atomicservice 876 * @since 11 877 */ 878 onCopy(callback: (value: string) => void): TextAttribute; 879 880 /** 881 * Text selection is achieved by specifying the start and end positions of the text. 882 * 883 * @param { number } selectionStart - The start position of the selected text. 884 * @param { number } selectionEnd - The end position of the selected text. 885 * @returns { TextAttribute } The attribute of the text. 886 * @syscap SystemCapability.ArkUI.ArkUI.Full 887 * @crossplatform 888 * @atomicservice 889 * @since 11 890 */ 891 selection(selectionStart: number, selectionEnd: number): TextAttribute; 892 893 /** 894 * Set the ellipsis mode. 895 * 896 * @param { EllipsisMode } value - The ellipsis mode. 897 * @returns { TextAttribute } The attribute of the text. 898 * @syscap SystemCapability.ArkUI.ArkUI.Full 899 * @crossplatform 900 * @since 11 901 */ 902 ellipsisMode(value: EllipsisMode): TextAttribute; 903 904 /** 905 * Enable data detector. 906 * 907 * @param { boolean } enable - Enable data detector. 908 * @returns { TextAttribute } The attribute of the text. 909 * @syscap SystemCapability.ArkUI.ArkUI.Full 910 * @since 11 911 */ 912 enableDataDetector(enable: boolean): TextAttribute; 913 914 /** 915 * Data detector with config. 916 * 917 * @param { TextDataDetectorConfig } config - The config of text data detector. 918 * @returns { TextAttribute } The attribute of the text. 919 * @syscap SystemCapability.ArkUI.ArkUI.Full 920 * @since 11 921 */ 922 dataDetectorConfig(config: TextDataDetectorConfig): TextAttribute; 923 924 /** 925 * Bind to the selection menu. 926 * 927 * @param { TextSpanType } spanType - Indicates the type of selection menu. 928 * @param { CustomBuilder } content - Indicates the content of selection menu. 929 * @param { TextResponseType } responseType - Indicates response type of selection menu. 930 * @param { SelectionMenuOptions } [options] - Indicates the options of selection menu. 931 * @returns { TextAttribute } 932 * @syscap SystemCapability.ArkUI.ArkUI.Full 933 * @crossplatform 934 * @since 11 935 */ 936 bindSelectionMenu(spanType: TextSpanType, content: CustomBuilder, responseType: TextResponseType, 937 options?: SelectionMenuOptions): TextAttribute; 938 939 /** 940 * Called when the text selection changes. 941 * 942 * @param { function } callback - callback of the listened event. 943 * @returns { TextAttribute } returns the instance of the TextAttribute. 944 * @syscap SystemCapability.ArkUI.ArkUI.Full 945 * @crossplatform 946 * @since 11 947 */ 948 onTextSelectionChange(callback: (selectionStart: number, selectionEnd: number) => void): TextAttribute; 949} 950 951/** 952 * Defines Text Component instance. 953 * 954 * @syscap SystemCapability.ArkUI.ArkUI.Full 955 * @since 7 956 */ 957/** 958 * Defines Text Component instance. 959 * 960 * @syscap SystemCapability.ArkUI.ArkUI.Full 961 * @since 9 962 * @form 963 */ 964/** 965 * Defines Text Component instance. 966 * 967 * @syscap SystemCapability.ArkUI.ArkUI.Full 968 * @crossplatform 969 * @since 10 970 * @form 971 */ 972/** 973 * Defines Text Component instance. 974 * 975 * @syscap SystemCapability.ArkUI.ArkUI.Full 976 * @crossplatform 977 * @atomicservice 978 * @since 11 979 * @form 980 */ 981declare const TextInstance: TextAttribute; 982 983/** 984 * Defines Text Component. 985 * 986 * @syscap SystemCapability.ArkUI.ArkUI.Full 987 * @since 7 988 */ 989/** 990 * Defines Text Component. 991 * 992 * @syscap SystemCapability.ArkUI.ArkUI.Full 993 * @since 9 994 * @form 995 */ 996/** 997 * Defines Text Component. 998 * 999 * @syscap SystemCapability.ArkUI.ArkUI.Full 1000 * @crossplatform 1001 * @since 10 1002 * @form 1003 */ 1004/** 1005 * Defines Text Component. 1006 * 1007 * @syscap SystemCapability.ArkUI.ArkUI.Full 1008 * @crossplatform 1009 * @atomicservice 1010 * @since 11 1011 * @form 1012 */ 1013declare const Text: TextInterface; 1014 1015/** 1016 * Defines span type. 1017 * 1018 * @enum { number } 1019 * @syscap SystemCapability.ArkUI.ArkUI.Full 1020 * @crossplatform 1021 * @since 11 1022 */ 1023declare enum TextSpanType { 1024 /** 1025 * Only contains text. 1026 * 1027 * @syscap SystemCapability.ArkUI.ArkUI.Full 1028 * @crossplatform 1029 * @since 11 1030 */ 1031 TEXT = 0, 1032 1033 /** 1034 * Only contains image. 1035 * 1036 * @syscap SystemCapability.ArkUI.ArkUI.Full 1037 * @crossplatform 1038 * @since 11 1039 */ 1040 IMAGE = 1, 1041 1042 /** 1043 * Contains both text and image. 1044 * 1045 * @syscap SystemCapability.ArkUI.ArkUI.Full 1046 * @crossplatform 1047 * @since 11 1048 */ 1049 MIXED = 2, 1050} 1051 1052/** 1053 * ResponseType for contextMenu 1054 * 1055 * @enum { number } 1056 * @syscap SystemCapability.ArkUI.ArkUI.Full 1057 * @crossplatform 1058 * @since 11 1059 */ 1060declare enum TextResponseType { 1061 /** 1062 * Right click. 1063 * 1064 * @syscap SystemCapability.ArkUI.ArkUI.Full 1065 * @crossplatform 1066 * @since 11 1067 */ 1068 RIGHT_CLICK = 0, 1069 1070 /** 1071 * Long press. 1072 * 1073 * @syscap SystemCapability.ArkUI.ArkUI.Full 1074 * @crossplatform 1075 * @since 11 1076 */ 1077 LONG_PRESS = 1, 1078 1079 /** 1080 * Selected by mouse. 1081 * 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @crossplatform 1084 * @since 11 1085 */ 1086 SELECT = 2, 1087} 1088 1089/** 1090 * Defines the options of Text. 1091 * 1092 * @interface TextOptions 1093 * @syscap SystemCapability.ArkUI.ArkUI.Full 1094 * @crossplatform 1095 * @since 11 1096 */ 1097declare interface TextOptions { 1098 /** 1099 * Text controller. 1100 * 1101 * @type { TextController } 1102 * @syscap SystemCapability.ArkUI.ArkUI.Full 1103 * @crossplatform 1104 * @since 11 1105 */ 1106 controller: TextController; 1107} 1108 1109/** 1110 * Defines the controller of Text. 1111 * 1112 * @syscap SystemCapability.ArkUI.ArkUI.Full 1113 * @crossplatform 1114 * @since 11 1115 */ 1116declare class TextController { 1117 /** 1118 * Close the select menu when menu is on. 1119 * 1120 * @syscap SystemCapability.ArkUI.ArkUI.Full 1121 * @crossplatform 1122 * @since 11 1123 */ 1124 closeSelectionMenu(): void; 1125} 1126