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 * @file 18 * @kit ArkUI 19 */ 20 21/** 22 * Defines the text data detector type. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 11 27 */ 28/** 29 * Defines the text data detector type. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 12 35 */ 36declare enum TextDataDetectorType { 37 /** 38 * Detector type phone number. 39 * 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @since 11 42 */ 43 /** 44 * Detector type phone number. 45 * 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @atomicservice 48 * @since 12 49 */ 50 PHONE_NUMBER = 0, 51 52 /** 53 * Detector type URL. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @since 11 57 */ 58 /** 59 * Detector type URL. 60 * 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @atomicservice 63 * @since 12 64 */ 65 URL = 1, 66 67 /** 68 * Detector type email. 69 * 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @since 11 72 */ 73 /** 74 * Detector type email. 75 * 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @atomicservice 78 * @since 12 79 */ 80 EMAIL = 2, 81 82 /** 83 * Detector type address. 84 * 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @since 11 87 */ 88 /** 89 * Detector type address. 90 * 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @atomicservice 93 * @since 12 94 */ 95 ADDRESS = 3, 96 97 /** 98 * Detector type datetime. 99 * 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @atomicservice 102 * @since 12 103 */ 104 DATE_TIME = 4, 105} 106 107/** 108 * Text data detector config. 109 * 110 * @interface TextDataDetectorConfig 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @since 11 113 */ 114/** 115 * Text data detector config. 116 * 117 * @interface TextDataDetectorConfig 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @atomicservice 120 * @since 12 121 */ 122declare interface TextDataDetectorConfig { 123 /** 124 * Text data detector types. 125 * 126 * @type { TextDataDetectorType[] } 127 * @syscap SystemCapability.ArkUI.ArkUI.Full 128 * @since 11 129 */ 130 /** 131 * Text data detector types. 132 * 133 * @type { TextDataDetectorType[] } 134 * @syscap SystemCapability.ArkUI.ArkUI.Full 135 * @atomicservice 136 * @since 12 137 */ 138 types: TextDataDetectorType[] 139 140 /** 141 * Text data detect result callback. 142 * 143 * @type { ?function } 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @since 11 146 */ 147 /** 148 * Text data detect result callback. 149 * 150 * @type { ?function } 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @atomicservice 153 * @since 12 154 */ 155 onDetectResultUpdate?: (result: string) => void 156 157 /** 158 * The color of AI entity. 159 * 160 * @type { ?ResourceColor } 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @atomicservice 163 * @since 12 164 */ 165 color?: ResourceColor, 166 167 /** 168 * The decoration of AI entity. 169 * 170 * @type { ?DecorationStyleInterface } 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @atomicservice 173 * @since 12 174 */ 175 decoration?: DecorationStyleInterface 176} 177 178/** 179 * Defines range of text type component. 180 * 181 * @interface TextRange 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @crossplatform 184 * @atomicservice 185 * @since 12 186 */ 187declare interface TextRange { 188 /** 189 * Start offset. 190 * 191 * @type { ?number } 192 * @default 0 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @crossplatform 195 * @atomicservice 196 * @since 12 197 */ 198 start?: number; 199 200 /** 201 * End offset. 202 * 203 * @type { ?number } 204 * @default text length 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @crossplatform 207 * @atomicservice 208 * @since 12 209 */ 210 end?: number; 211} 212 213/** 214 * Defines the inserted text value info. 215 * 216 * @interface InsertValue 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @crossplatform 219 * @atomicservice 220 * @since 12 221 */ 222declare interface InsertValue { 223 /** 224 * The location info where the value will be inserted. 225 * 226 * @type { number } 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @atomicservice 230 * @since 12 231 */ 232 insertOffset: number; 233 234 /** 235 * The inserted value. 236 * 237 * @type { string } 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @crossplatform 240 * @atomicservice 241 * @since 12 242 */ 243 insertValue: string; 244} 245 246/** 247 * Defines delete text direction. 248 * 249 * @enum { number } 250 * @syscap SystemCapability.ArkUI.ArkUI.Full 251 * @crossplatform 252 * @atomicservice 253 * @since 12 254 */ 255declare enum TextDeleteDirection { 256 /** 257 * Delete backward. 258 * 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @atomicservice 262 * @since 12 263 */ 264 BACKWARD = 0, 265 266 /** 267 * Delete forward. 268 * 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @crossplatform 271 * @atomicservice 272 * @since 12 273 */ 274 FORWARD = 1, 275} 276 277/** 278 * Defines menu type. 279 * 280 * @enum { number } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @crossplatform 283 * @atomicservice 284 * @since 13 285 */ 286declare enum MenuType { 287 /** 288 * Selection menu. 289 * 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @crossplatform 292 * @atomicservice 293 * @since 13 294 */ 295 SELECTION_MENU = 0, 296 297 /** 298 * Preview menu, only for image. 299 * 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @atomicservice 303 * @since 13 304 */ 305 PREVIEW_MENU = 1, 306} 307 308/** 309 * Provides an interface for deleting value from text. 310 * 311 * @interface DeleteValue 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @atomicservice 315 * @since 12 316 */ 317declare interface DeleteValue { 318 /** 319 * The location info where the value will be deleted. 320 * 321 * @type { number } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @crossplatform 324 * @atomicservice 325 * @since 12 326 */ 327 deleteOffset: number; 328 329 /** 330 * The deleted direction. 331 * 332 * @type { TextDeleteDirection } 333 * @syscap SystemCapability.ArkUI.ArkUI.Full 334 * @crossplatform 335 * @atomicservice 336 * @since 12 337 */ 338 direction: TextDeleteDirection; 339 340 /** 341 * The deleted value. 342 * 343 * @type { string } 344 * @syscap SystemCapability.ArkUI.ArkUI.Full 345 * @crossplatform 346 * @atomicservice 347 * @since 12 348 */ 349 deleteValue: string; 350} 351 352/** 353 * Callback after content changed. 354 * 355 * @typedef { function } OnDidChangeCallback 356 * @param { TextRange } rangeBefore - Range of content that had been replaced. 357 * @param { TextRange } rangeAfter - Range of content that newly added. 358 * @syscap SystemCapability.ArkUI.ArkUI.Full 359 * @crossplatform 360 * @atomicservice 361 * @since 12 362 */ 363declare type OnDidChangeCallback = (rangeBefore: TextRange, rangeAfter: TextRange) => void; 364 365/** 366 * Callback when input sometimes has info of previewText. 367 * 368 * @typedef { function } EditableTextOnChangeCallback 369 * @param { string } value - Value of body text, without previewText value. 370 * @param { PreviewText } [previewText] - info of previewText, contains previewText value and start index. 371 * @syscap SystemCapability.ArkUI.ArkUI.Full 372 * @crossplatform 373 * @atomicservice 374 * @since 12 375 */ 376declare type EditableTextOnChangeCallback = (value: string, previewText?: PreviewText) => void; 377 378/** 379 * Define the text selection controller. 380 * 381 * @interface TextBaseController 382 * @syscap SystemCapability.ArkUI.ArkUI.Full 383 * @crossplatform 384 * @atomicservice 385 * @since 12 386 */ 387declare interface TextBaseController { 388 /** 389 * Set selection to select a range of content. 390 * 391 * @param { number } selectionStart - The start position of the selected text. 392 * @param { number } selectionEnd - The end position of the selected text. 393 * @param { SelectionOptions } [options] - Indicates the options of selection. 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @crossplatform 396 * @atomicservice 397 * @since 12 398 */ 399 setSelection(selectionStart: number, selectionEnd: number, options?: SelectionOptions): void; 400 401 /** 402 * Close the select menu when menu is on. 403 * 404 * @syscap SystemCapability.ArkUI.ArkUI.Full 405 * @crossplatform 406 * @atomicservice 407 * @since 12 408 */ 409 closeSelectionMenu(): void; 410 411 /** 412 * Get LayoutManager. 413 * 414 * @returns { LayoutManager } - Return the LayoutManager. 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @crossplatform 417 * @atomicservice 418 * @since 12 419 */ 420 getLayoutManager(): LayoutManager; 421} 422 423/** 424 * Define the text extended editing controller. 425 * 426 * @interface TextEditControllerEx 427 * @syscap SystemCapability.ArkUI.ArkUI.Full 428 * @crossplatform 429 * @atomicservice 430 * @since 12 431 */ 432declare interface TextEditControllerEx extends TextBaseController{ 433 /** 434 * Judge whether is in editing state 435 * 436 * @returns { boolean } - true means that the component is in editing state, false means is non in editing status 437 * @syscap SystemCapability.ArkUI.ArkUI.Full 438 * @crossplatform 439 * @atomicservice 440 * @since 12 441 */ 442 isEditing(): boolean; 443 444 /** 445 * Stop editing state. 446 * 447 * @syscap SystemCapability.ArkUI.ArkUI.Full 448 * @crossplatform 449 * @atomicservice 450 * @since 12 451 */ 452 stopEditing(): void; 453 454 /** 455 * Set caret offset. 456 * 457 * @param { number } offset - caret offset. 458 * @returns { boolean } - Return true if the caret offset was successfully set, false otherwise. 459 * @syscap SystemCapability.ArkUI.ArkUI.Full 460 * @crossplatform 461 * @atomicservice 462 * @since 12 463 */ 464 setCaretOffset(offset: number): boolean; 465 466 /** 467 * Get caret offset from controller. 468 * 469 * @returns { number } 470 * @syscap SystemCapability.ArkUI.ArkUI.Full 471 * @crossplatform 472 * @atomicservice 473 * @since 12 474 */ 475 getCaretOffset(): number; 476 477 /** 478 * Get PreviewText. 479 * 480 * @returns { PreviewText } - Return the PreviewText. 481 * @syscap SystemCapability.ArkUI.ArkUI.Full 482 * @crossplatform 483 * @atomicservice 484 * @since 12 485 */ 486 getPreviewText?(): PreviewText; 487} 488 489/** 490 * The previewText. 491 * @interface PreviewText 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @atomicservice 495 * @since 12 496 */ 497declare interface PreviewText { 498 /** 499 * Start offset of the previewText 500 * 501 * @type { number } 502 * @syscap SystemCapability.ArkUI.ArkUI.Full 503 * @crossplatform 504 * @atomicservice 505 * @since 12 506 */ 507 offset: number; 508 509 /** 510 * Value of the previewText. 511 * 512 * @type { string } 513 * @syscap SystemCapability.ArkUI.ArkUI.Full 514 * @crossplatform 515 * @atomicservice 516 * @since 12 517 */ 518 value: string; 519} 520 521/** 522 * Define the StyledString controller. 523 * 524 * @interface StyledStringController 525 * @syscap SystemCapability.ArkUI.ArkUI.Full 526 * @crossplatform 527 * @atomicservice 528 * @since 12 529 */ 530declare interface StyledStringController { 531 /** 532 * Set the StyledString of the component. 533 * 534 * @param { StyledString } styledString - StyledString. 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @atomicservice 538 * @since 12 539 */ 540 setStyledString(styledString: StyledString): void; 541 542 /** 543 * Get the StyledString of the component. 544 * 545 * @returns { MutableStyledString } 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @atomicservice 549 * @since 12 550 */ 551 getStyledString(): MutableStyledString; 552} 553 554/** 555 * Define the StyledString changed listener. 556 * 557 * @interface StyledStringChangedListener 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @crossplatform 560 * @atomicservice 561 * @since 12 562 */ 563declare interface StyledStringChangedListener { 564 /** 565 * Called before text changed. 566 * 567 * @type { ?Callback<StyledStringChangeValue, boolean> } 568 * @syscap SystemCapability.ArkUI.ArkUI.Full 569 * @crossplatform 570 * @atomicservice 571 * @since 12 572 */ 573 onWillChange?: Callback<StyledStringChangeValue, boolean>; 574 575 /** 576 * Called after text changed. 577 * 578 * @type { ?OnDidChangeCallback } 579 * @syscap SystemCapability.ArkUI.ArkUI.Full 580 * @crossplatform 581 * @atomicservice 582 * @since 12 583 */ 584 onDidChange?: OnDidChangeCallback; 585} 586 587/** 588 * Define the StyledString changed value. 589 * 590 * @interface StyledStringChangeValue 591 * @syscap SystemCapability.ArkUI.ArkUI.Full 592 * @crossplatform 593 * @atomicservice 594 * @since 12 595 */ 596interface StyledStringChangeValue { 597 /** 598 * Range of the content to be replaced. 599 * 600 * @type { TextRange } 601 * @syscap SystemCapability.ArkUI.ArkUI.Full 602 * @crossplatform 603 * @atomicservice 604 * @since 12 605 */ 606 range: TextRange; 607 608 /** 609 * StyledString to replace. 610 * 611 * @type { StyledString } 612 * @syscap SystemCapability.ArkUI.ArkUI.Full 613 * @crossplatform 614 * @atomicservice 615 * @since 12 616 */ 617 replacementString: StyledString; 618 619 /** 620 * Preview StyledString 621 * 622 * @type { ?StyledString } 623 * @syscap SystemCapability.ArkUI.ArkUI.Full 624 * @crossplatform 625 * @atomicservice 626 * @since 12 627 */ 628 previewText?: StyledString; 629} 630 631/** 632 * Define the LayoutManager for querying layout information. 633 * 634 * @interface LayoutManager 635 * @syscap SystemCapability.ArkUI.ArkUI.Full 636 * @crossplatform 637 * @atomicservice 638 * @since 12 639 */ 640declare interface LayoutManager { 641 /** 642 * Get the line count. 643 * 644 * @returns { number } The line count value returned to the caller. 645 * @syscap SystemCapability.ArkUI.ArkUI.Full 646 * @crossplatform 647 * @atomicservice 648 * @since 12 649 */ 650 getLineCount(): number; 651 652 /** 653 * Get the glyph position at coordinate. 654 * 655 * @param { number } x - the positionX of typography. 656 * @param { number } y - the positionY of typography. 657 * @returns { PositionWithAffinity } TextBlob object. 658 * @syscap SystemCapability.ArkUI.ArkUI.Full 659 * @crossplatform 660 * @atomicservice 661 * @since 12 662 */ 663 getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity; 664 665 /** 666 * Get LineMetrics. 667 * 668 * @param { number } lineNumber - the number of line. 669 * @returns { LineMetrics } The line Metrics. 670 * @syscap SystemCapability.ArkUI.ArkUI.Full 671 * @crossplatform 672 * @atomicservice 673 * @since 12 674 */ 675 getLineMetrics(lineNumber: number): LineMetrics; 676} 677 678/** 679 * Position and affinity. 680 * 681 * @typedef PositionWithAffinity 682 * @syscap SystemCapability.ArkUI.ArkUI.Full 683 * @crossplatform 684 * @atomicservice 685 * @since 12 686 */ 687interface PositionWithAffinity { 688 /** 689 * Position of text. 690 * 691 * @type { number } 692 * @syscap SystemCapability.ArkUI.ArkUI.Full 693 * @crossplatform 694 * @atomicservice 695 * @since 12 696 */ 697 position: number; 698 699 /** 700 * Affinity of text. 701 * 702 * @type { Affinity } 703 * @syscap SystemCapability.ArkUI.ArkUI.Full 704 * @crossplatform 705 * @atomicservice 706 * @since 12 707 */ 708 affinity: Affinity; 709} 710 711/** 712 * Define the Affinity type. 713 * 714 * @typedef { import('../api/@ohos.graphics.text').default.Affinity } Affinity 715 * @syscap SystemCapability.ArkUI.ArkUI.Full 716 * @crossplatform 717 * @atomicservice 718 * @since 12 719 */ 720declare type Affinity = import('../api/@ohos.graphics.text').default.Affinity; 721 722/** 723 * Define the LineMetrics type. 724 * 725 * @typedef { import('../api/@ohos.graphics.text').default.LineMetrics } LineMetrics 726 * @syscap SystemCapability.ArkUI.ArkUI.Full 727 * @crossplatform 728 * @atomicservice 729 * @since 12 730 */ 731declare type LineMetrics = import('../api/@ohos.graphics.text').default.LineMetrics; 732 733/** 734 * Defines the cursor style 735 * 736 * @interface CaretStyle 737 * @syscap SystemCapability.ArkUI.ArkUI.Full 738 * @crossplatform 739 * @since 10 740 */ 741/** 742 * Defines the cursor style 743 * 744 * @interface CaretStyle 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 11 749 */ 750interface CaretStyle { 751 /** 752 * Set the cursor width 753 * 754 * @type { ?Length } 755 * @syscap SystemCapability.ArkUI.ArkUI.Full 756 * @crossplatform 757 * @since 10 758 */ 759 /** 760 * Set the cursor width 761 * 762 * @type { ?Length } 763 * @syscap SystemCapability.ArkUI.ArkUI.Full 764 * @crossplatform 765 * @atomicservice 766 * @since 11 767 */ 768 width?: Length, 769 770 /** 771 * Set the cursor color 772 * 773 * @type { ?ResourceColor } 774 * @syscap SystemCapability.ArkUI.ArkUI.Full 775 * @crossplatform 776 * @since 10 777 */ 778 /** 779 * Set the cursor color 780 * 781 * @type { ?ResourceColor } 782 * @syscap SystemCapability.ArkUI.ArkUI.Full 783 * @crossplatform 784 * @atomicservice 785 * @since 11 786 */ 787 color?: ResourceColor, 788} 789 790/** 791 * Defines the TextMenuItemId. 792 * 793 * @syscap SystemCapability.ArkUI.ArkUI.Full 794 * @crossplatform 795 * @atomicservice 796 * @since 12 797 */ 798declare class TextMenuItemId { 799 /** 800 * Init a TextMenuItemId with id. 801 * 802 * @param { ResourceStr } id - The id of the TextMenuItemId. 803 * @returns { TextMenuItemId } - Returns the TextMenuItemId object. 804 * @static 805 * @syscap SystemCapability.ArkUI.ArkUI.Full 806 * @crossplatform 807 * @atomicservice 808 * @since 12 809 */ 810 static of(id: ResourceStr): TextMenuItemId; 811 812 /** 813 * Judge if two TextMenuItemId are equal. 814 * 815 * @param { TextMenuItemId } id - id TextMenuItemId. 816 * @returns { boolean } 817 * @syscap SystemCapability.ArkUI.ArkUI.Full 818 * @crossplatform 819 * @atomicservice 820 * @since 12 821 */ 822 equals(id: TextMenuItemId): boolean; 823 824 /** 825 * Indicates the TextMenuItemId to copy and delete the currently selected text. 826 * 827 * @type { TextMenuItemId } 828 * @readonly 829 * @static 830 * @syscap SystemCapability.ArkUI.ArkUI.Full 831 * @atomicservice 832 * @since 12 833 */ 834 static readonly CUT: TextMenuItemId; 835 836 /** 837 * Indicates the TextMenuItemId to copy the currently selected text to the clipboard. 838 * 839 * @type { TextMenuItemId } 840 * @readonly 841 * @static 842 * @syscap SystemCapability.ArkUI.ArkUI.Full 843 * @atomicservice 844 * @since 12 845 */ 846 static readonly COPY: TextMenuItemId; 847 848 /** 849 * Indicates the TextMenuItemId to copy the current contents of the clipboard into the text view. 850 * 851 * @type { TextMenuItemId } 852 * @readonly 853 * @static 854 * @syscap SystemCapability.ArkUI.ArkUI.Full 855 * @atomicservice 856 * @since 12 857 */ 858 static readonly PASTE: TextMenuItemId; 859 860 /** 861 * Indicates the TextMenuItemId to select all text in a text view. 862 * 863 * @type { TextMenuItemId } 864 * @readonly 865 * @static 866 * @syscap SystemCapability.ArkUI.ArkUI.Full 867 * @atomicservice 868 * @since 12 869 */ 870 static readonly SELECT_ALL: TextMenuItemId; 871 872 /** 873 * Indicates the TextMenuItemId for collaboration service menu items. 874 * 875 * @type { TextMenuItemId } 876 * @readonly 877 * @static 878 * @syscap SystemCapability.ArkUI.ArkUI.Full 879 * @atomicservice 880 * @since 12 881 */ 882 static readonly COLLABORATION_SERVICE: TextMenuItemId; 883 884 /** 885 * Indicates the TextMenuItemId to recognize the text in the picture and input it into the text view. 886 * 887 * @type { TextMenuItemId } 888 * @readonly 889 * @static 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @atomicservice 892 * @since 12 893 */ 894 static readonly CAMERA_INPUT: TextMenuItemId; 895 896 /** 897 * Indicates the TextMenuItemId to help with text creation by invoking large models. 898 * 899 * @type { TextMenuItemId } 900 * @readonly 901 * @static 902 * @syscap SystemCapability.ArkUI.ArkUI.Full 903 * @atomicservice 904 * @since 13 905 */ 906 static readonly AI_WRITER: TextMenuItemId; 907} 908 909/** 910 * TextMenuItem 911 * 912 * @interface TextMenuItem 913 * @syscap SystemCapability.ArkUI.ArkUI.Full 914 * @crossplatform 915 * @atomicservice 916 * @since 12 917 */ 918declare interface TextMenuItem { 919 /** 920 * Customize what the menu displays. 921 * 922 * @type { ResourceStr } 923 * @syscap SystemCapability.ArkUI.ArkUI.Full 924 * @crossplatform 925 * @atomicservice 926 * @since 12 927 */ 928 content: ResourceStr; 929 /** 930 * Customize the icon before the menu displays content. 931 * 932 * @type { ?ResourceStr } 933 * @syscap SystemCapability.ArkUI.ArkUI.Full 934 * @crossplatform 935 * @atomicservice 936 * @since 12 937 */ 938 icon?: ResourceStr; 939 /** 940 * Distinguish clicked menu content by Id. 941 * 942 * @type { TextMenuItemId } 943 * @syscap SystemCapability.ArkUI.ArkUI.Full 944 * @crossplatform 945 * @atomicservice 946 * @since 12 947 */ 948 id: TextMenuItemId; 949} 950 951/** 952 * EditMenuOptions 953 * 954 * @interface EditMenuOptions 955 * @syscap SystemCapability.ArkUI.ArkUI.Full 956 * @crossplatform 957 * @atomicservice 958 * @since 12 959 */ 960declare interface EditMenuOptions { 961 /** 962 * Passes the default menu, invokes before every display to generate a menu for triggering click events. 963 * 964 * @param { Array<TextMenuItem> } menuItems - current default menu array. 965 * @returns { Array<TextMenuItem> } - Return the menu after operations. 966 * @syscap SystemCapability.ArkUI.ArkUI.Full 967 * @crossplatform 968 * @atomicservice 969 * @since 12 970 */ 971 onCreateMenu(menuItems: Array<TextMenuItem>): Array<TextMenuItem>; 972 /** 973 * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior. 974 * 975 * @param { TextMenuItem } menuItem - current default menu. 976 * @param { TextRange } range - current selected range. 977 * @returns { boolean } - Return True, the event is consumed, false otherwise. 978 * @syscap SystemCapability.ArkUI.ArkUI.Full 979 * @crossplatform 980 * @atomicservice 981 * @since 12 982 */ 983 onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean; 984} 985 986/** 987 * Defines the font decoration result. 988 * 989 * @interface DecorationStyleResult 990 * @syscap SystemCapability.ArkUI.ArkUI.Full 991 * @crossplatform 992 * @atomicservice 993 * @since 12 994 */ 995interface DecorationStyleResult { 996 /** 997 * Font decoration type. 998 * 999 * @type { TextDecorationType } 1000 * @syscap SystemCapability.ArkUI.ArkUI.Full 1001 * @crossplatform 1002 * @atomicservice 1003 * @since 12 1004 */ 1005 type: TextDecorationType; 1006 1007 /** 1008 * Font decoration color. 1009 * 1010 * @type { ResourceColor } 1011 * @syscap SystemCapability.ArkUI.ArkUI.Full 1012 * @crossplatform 1013 * @atomicservice 1014 * @since 12 1015 */ 1016 color: ResourceColor; 1017 1018 /** 1019 * The style value of the decoration property object. 1020 * 1021 * @type { ?TextDecorationStyle } 1022 * @syscap SystemCapability.ArkUI.ArkUI.Full 1023 * @crossplatform 1024 * @atomicservice 1025 * @since 12 1026 */ 1027 style?: TextDecorationStyle; 1028} 1029 1030/** 1031 * Defines the options of font. 1032 * 1033 * @interface FontSettingOptions 1034 * @syscap SystemCapability.ArkUI.ArkUI.Full 1035 * @crossplatform 1036 * @form 1037 * @atomicservice 1038 * @since 12 1039 */ 1040declare interface FontSettingOptions { 1041 /** 1042 * Define weather VariableFontWeight is supported. 1043 * 1044 * @type { ?boolean } 1045 * @syscap SystemCapability.ArkUI.ArkUI.Full 1046 * @crossplatform 1047 * @form 1048 * @atomicservice 1049 * @since 12 1050 */ 1051 enableVariableFontWeight?: boolean; 1052 }