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 * @extends TextBaseController 427 * @interface TextEditControllerEx 428 * @syscap SystemCapability.ArkUI.ArkUI.Full 429 * @crossplatform 430 * @atomicservice 431 * @since 12 432 */ 433declare interface TextEditControllerEx extends TextBaseController{ 434 /** 435 * Judge whether is in editing state 436 * 437 * @returns { boolean } - true means that the component is in editing state, false means is non in editing status 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @crossplatform 440 * @atomicservice 441 * @since 12 442 */ 443 isEditing(): boolean; 444 445 /** 446 * Stop editing state. 447 * 448 * @syscap SystemCapability.ArkUI.ArkUI.Full 449 * @crossplatform 450 * @atomicservice 451 * @since 12 452 */ 453 stopEditing(): void; 454 455 /** 456 * Set caret offset. 457 * 458 * @param { number } offset - caret offset. 459 * @returns { boolean } - Return true if the caret offset was successfully set, false otherwise. 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @crossplatform 462 * @atomicservice 463 * @since 12 464 */ 465 setCaretOffset(offset: number): boolean; 466 467 /** 468 * Get caret offset from controller. 469 * 470 * @returns { number } 471 * @syscap SystemCapability.ArkUI.ArkUI.Full 472 * @crossplatform 473 * @atomicservice 474 * @since 12 475 */ 476 getCaretOffset(): number; 477 478 /** 479 * Get PreviewText. 480 * 481 * @returns { PreviewText } - Return the PreviewText. 482 * @syscap SystemCapability.ArkUI.ArkUI.Full 483 * @crossplatform 484 * @atomicservice 485 * @since 12 486 */ 487 getPreviewText?(): PreviewText; 488} 489 490/** 491 * The previewText. 492 * @interface PreviewText 493 * @syscap SystemCapability.ArkUI.ArkUI.Full 494 * @crossplatform 495 * @atomicservice 496 * @since 12 497 */ 498declare interface PreviewText { 499 /** 500 * Start offset of the previewText 501 * 502 * @type { number } 503 * @syscap SystemCapability.ArkUI.ArkUI.Full 504 * @crossplatform 505 * @atomicservice 506 * @since 12 507 */ 508 offset: number; 509 510 /** 511 * Value of the previewText. 512 * 513 * @type { string } 514 * @syscap SystemCapability.ArkUI.ArkUI.Full 515 * @crossplatform 516 * @atomicservice 517 * @since 12 518 */ 519 value: string; 520} 521 522/** 523 * Define the StyledString controller. 524 * 525 * @interface StyledStringController 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @crossplatform 528 * @atomicservice 529 * @since 12 530 */ 531declare interface StyledStringController { 532 /** 533 * Set the StyledString of the component. 534 * 535 * @param { StyledString } styledString - StyledString. 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @atomicservice 539 * @since 12 540 */ 541 setStyledString(styledString: StyledString): void; 542 543 /** 544 * Get the StyledString of the component. 545 * 546 * @returns { MutableStyledString } 547 * @syscap SystemCapability.ArkUI.ArkUI.Full 548 * @crossplatform 549 * @atomicservice 550 * @since 12 551 */ 552 getStyledString(): MutableStyledString; 553} 554 555/** 556 * Define the StyledString changed listener. 557 * 558 * @interface StyledStringChangedListener 559 * @syscap SystemCapability.ArkUI.ArkUI.Full 560 * @crossplatform 561 * @atomicservice 562 * @since 12 563 */ 564declare interface StyledStringChangedListener { 565 /** 566 * Called before text changed. 567 * 568 * @type { ?Callback<StyledStringChangeValue, boolean> } 569 * @syscap SystemCapability.ArkUI.ArkUI.Full 570 * @crossplatform 571 * @atomicservice 572 * @since 12 573 */ 574 onWillChange?: Callback<StyledStringChangeValue, boolean>; 575 576 /** 577 * Called after text changed. 578 * 579 * @type { ?OnDidChangeCallback } 580 * @syscap SystemCapability.ArkUI.ArkUI.Full 581 * @crossplatform 582 * @atomicservice 583 * @since 12 584 */ 585 onDidChange?: OnDidChangeCallback; 586} 587 588/** 589 * Define the StyledString changed value. 590 * 591 * @interface StyledStringChangeValue 592 * @syscap SystemCapability.ArkUI.ArkUI.Full 593 * @crossplatform 594 * @atomicservice 595 * @since 12 596 */ 597interface StyledStringChangeValue { 598 /** 599 * Range of the content to be replaced. 600 * 601 * @type { TextRange } 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @atomicservice 605 * @since 12 606 */ 607 range: TextRange; 608 609 /** 610 * StyledString to replace. 611 * 612 * @type { StyledString } 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @atomicservice 616 * @since 12 617 */ 618 replacementString: StyledString; 619 620 /** 621 * Preview StyledString 622 * 623 * @type { ?StyledString } 624 * @syscap SystemCapability.ArkUI.ArkUI.Full 625 * @crossplatform 626 * @atomicservice 627 * @since 12 628 */ 629 previewText?: StyledString; 630} 631 632/** 633 * Define the LayoutManager for querying layout information. 634 * 635 * @interface LayoutManager 636 * @syscap SystemCapability.ArkUI.ArkUI.Full 637 * @crossplatform 638 * @atomicservice 639 * @since 12 640 */ 641declare interface LayoutManager { 642 /** 643 * Get the line count. 644 * 645 * @returns { number } The line count value returned to the caller. 646 * @syscap SystemCapability.ArkUI.ArkUI.Full 647 * @crossplatform 648 * @atomicservice 649 * @since 12 650 */ 651 getLineCount(): number; 652 653 /** 654 * Get the glyph position at coordinate. 655 * 656 * @param { number } x - the positionX of typography. 657 * @param { number } y - the positionY of typography. 658 * @returns { PositionWithAffinity } TextBlob object. 659 * @syscap SystemCapability.ArkUI.ArkUI.Full 660 * @crossplatform 661 * @atomicservice 662 * @since 12 663 */ 664 getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity; 665 666 /** 667 * Get LineMetrics. 668 * 669 * @param { number } lineNumber - the number of line. 670 * @returns { LineMetrics } The line Metrics. 671 * @syscap SystemCapability.ArkUI.ArkUI.Full 672 * @crossplatform 673 * @atomicservice 674 * @since 12 675 */ 676 getLineMetrics(lineNumber: number): LineMetrics; 677 678 /** 679 * Get the rects for range. 680 * @param { TextRange } range - The range to set. 681 * @param { RectWidthStyle } widthStyle - Width style to set. 682 * @param { RectHeightStyle } heightStyle - Height style to set. 683 * @returns { Array<TextBox> } The rects for range. 684 * @syscap SystemCapability.ArkUI.ArkUI.Full 685 * @crossplatform 686 * @atomicservice 687 * @since 14 688 */ 689 getRectsForRange(range: TextRange, widthStyle: RectWidthStyle, heightStyle: RectHeightStyle): Array<TextBox>; 690} 691 692/** 693 * Position and affinity. 694 * 695 * @typedef PositionWithAffinity 696 * @syscap SystemCapability.ArkUI.ArkUI.Full 697 * @crossplatform 698 * @atomicservice 699 * @since 12 700 */ 701interface PositionWithAffinity { 702 /** 703 * Position of text. 704 * 705 * @type { number } 706 * @syscap SystemCapability.ArkUI.ArkUI.Full 707 * @crossplatform 708 * @atomicservice 709 * @since 12 710 */ 711 position: number; 712 713 /** 714 * Affinity of text. 715 * 716 * @type { Affinity } 717 * @syscap SystemCapability.ArkUI.ArkUI.Full 718 * @crossplatform 719 * @atomicservice 720 * @since 12 721 */ 722 affinity: Affinity; 723} 724 725/** 726 * Define the Affinity type. 727 * 728 * @typedef { import('../api/@ohos.graphics.text').default.Affinity } Affinity 729 * @syscap SystemCapability.ArkUI.ArkUI.Full 730 * @crossplatform 731 * @atomicservice 732 * @since 12 733 */ 734declare type Affinity = import('../api/@ohos.graphics.text').default.Affinity; 735 736/** 737 * Define the LineMetrics type. 738 * 739 * @typedef { import('../api/@ohos.graphics.text').default.LineMetrics } LineMetrics 740 * @syscap SystemCapability.ArkUI.ArkUI.Full 741 * @crossplatform 742 * @atomicservice 743 * @since 12 744 */ 745declare type LineMetrics = import('../api/@ohos.graphics.text').default.LineMetrics; 746 747/** 748 * Define the RectWidthStyle type. 749 * 750 * @typedef { import('../api/@ohos.graphics.text').default.RectWidthStyle } RectWidthStyle 751 * @syscap SystemCapability.ArkUI.ArkUI.Full 752 * @crossplatform 753 * @atomicservice 754 * @since 14 755 */ 756declare type RectWidthStyle = import('../api/@ohos.graphics.text').default.RectWidthStyle; 757 758/** 759 * Define the RectHeightStyle type. 760 * 761 * @typedef { import('../api/@ohos.graphics.text').default.RectHeightStyle } RectHeightStyle 762 * @syscap SystemCapability.ArkUI.ArkUI.Full 763 * @crossplatform 764 * @atomicservice 765 * @since 14 766 */ 767declare type RectHeightStyle = import('../api/@ohos.graphics.text').default.RectHeightStyle; 768 769/** 770 * Define the TextBox type. 771 * 772 * @typedef { import('../api/@ohos.graphics.text').default.TextBox } TextBox 773 * @syscap SystemCapability.ArkUI.ArkUI.Full 774 * @crossplatform 775 * @atomicservice 776 * @since 14 777 */ 778declare type TextBox = import('../api/@ohos.graphics.text').default.TextBox; 779 780 781/** 782 * Defines the cursor style 783 * 784 * @interface CaretStyle 785 * @syscap SystemCapability.ArkUI.ArkUI.Full 786 * @crossplatform 787 * @since 10 788 */ 789/** 790 * Defines the cursor style 791 * 792 * @interface CaretStyle 793 * @syscap SystemCapability.ArkUI.ArkUI.Full 794 * @crossplatform 795 * @atomicservice 796 * @since 11 797 */ 798interface CaretStyle { 799 /** 800 * Set the cursor width 801 * 802 * @type { ?Length } 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @crossplatform 805 * @since 10 806 */ 807 /** 808 * Set the cursor width 809 * 810 * @type { ?Length } 811 * @syscap SystemCapability.ArkUI.ArkUI.Full 812 * @crossplatform 813 * @atomicservice 814 * @since 11 815 */ 816 width?: Length, 817 818 /** 819 * Set the cursor color 820 * 821 * @type { ?ResourceColor } 822 * @syscap SystemCapability.ArkUI.ArkUI.Full 823 * @crossplatform 824 * @since 10 825 */ 826 /** 827 * Set the cursor color 828 * 829 * @type { ?ResourceColor } 830 * @syscap SystemCapability.ArkUI.ArkUI.Full 831 * @crossplatform 832 * @atomicservice 833 * @since 11 834 */ 835 color?: ResourceColor, 836} 837 838/** 839 * Defines the TextMenuItemId. 840 * 841 * @syscap SystemCapability.ArkUI.ArkUI.Full 842 * @crossplatform 843 * @atomicservice 844 * @since 12 845 */ 846declare class TextMenuItemId { 847 /** 848 * Init a TextMenuItemId with id. 849 * 850 * @param { ResourceStr } id - The id of the TextMenuItemId. 851 * @returns { TextMenuItemId } - Returns the TextMenuItemId object. 852 * @static 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @crossplatform 855 * @atomicservice 856 * @since 12 857 */ 858 static of(id: ResourceStr): TextMenuItemId; 859 860 /** 861 * Judge if two TextMenuItemId are equal. 862 * 863 * @param { TextMenuItemId } id - id TextMenuItemId. 864 * @returns { boolean } 865 * @syscap SystemCapability.ArkUI.ArkUI.Full 866 * @crossplatform 867 * @atomicservice 868 * @since 12 869 */ 870 equals(id: TextMenuItemId): boolean; 871 872 /** 873 * Indicates the TextMenuItemId to copy and delete the currently selected text. 874 * 875 * @type { TextMenuItemId } 876 * @readonly 877 * @static 878 * @syscap SystemCapability.ArkUI.ArkUI.Full 879 * @atomicservice 880 * @since 12 881 */ 882 static readonly CUT: TextMenuItemId; 883 884 /** 885 * Indicates the TextMenuItemId to copy the currently selected text to the clipboard. 886 * 887 * @type { TextMenuItemId } 888 * @readonly 889 * @static 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @atomicservice 892 * @since 12 893 */ 894 static readonly COPY: TextMenuItemId; 895 896 /** 897 * Indicates the TextMenuItemId to copy the current contents of the clipboard into the text view. 898 * 899 * @type { TextMenuItemId } 900 * @readonly 901 * @static 902 * @syscap SystemCapability.ArkUI.ArkUI.Full 903 * @atomicservice 904 * @since 12 905 */ 906 static readonly PASTE: TextMenuItemId; 907 908 /** 909 * Indicates the TextMenuItemId to select all text in a text view. 910 * 911 * @type { TextMenuItemId } 912 * @readonly 913 * @static 914 * @syscap SystemCapability.ArkUI.ArkUI.Full 915 * @atomicservice 916 * @since 12 917 */ 918 static readonly SELECT_ALL: TextMenuItemId; 919 920 /** 921 * Indicates the TextMenuItemId for collaboration service menu items. 922 * 923 * @type { TextMenuItemId } 924 * @readonly 925 * @static 926 * @syscap SystemCapability.ArkUI.ArkUI.Full 927 * @atomicservice 928 * @since 12 929 */ 930 static readonly COLLABORATION_SERVICE: TextMenuItemId; 931 932 /** 933 * Indicates the TextMenuItemId to recognize the text in the picture and input it into the text view. 934 * 935 * @type { TextMenuItemId } 936 * @readonly 937 * @static 938 * @syscap SystemCapability.ArkUI.ArkUI.Full 939 * @atomicservice 940 * @since 12 941 */ 942 static readonly CAMERA_INPUT: TextMenuItemId; 943 944 /** 945 * Indicates the TextMenuItemId to help with text creation by invoking large models. 946 * 947 * @type { TextMenuItemId } 948 * @readonly 949 * @static 950 * @syscap SystemCapability.ArkUI.ArkUI.Full 951 * @atomicservice 952 * @since 13 953 */ 954 static readonly AI_WRITER: TextMenuItemId; 955} 956 957/** 958 * TextMenuItem 959 * 960 * @interface TextMenuItem 961 * @syscap SystemCapability.ArkUI.ArkUI.Full 962 * @crossplatform 963 * @atomicservice 964 * @since 12 965 */ 966declare interface TextMenuItem { 967 /** 968 * Customize what the menu displays. 969 * 970 * @type { ResourceStr } 971 * @syscap SystemCapability.ArkUI.ArkUI.Full 972 * @crossplatform 973 * @atomicservice 974 * @since 12 975 */ 976 content: ResourceStr; 977 /** 978 * Customize the icon before the menu displays content. 979 * 980 * @type { ?ResourceStr } 981 * @syscap SystemCapability.ArkUI.ArkUI.Full 982 * @crossplatform 983 * @atomicservice 984 * @since 12 985 */ 986 icon?: ResourceStr; 987 /** 988 * Distinguish clicked menu content by Id. 989 * 990 * @type { TextMenuItemId } 991 * @syscap SystemCapability.ArkUI.ArkUI.Full 992 * @crossplatform 993 * @atomicservice 994 * @since 12 995 */ 996 id: TextMenuItemId; 997} 998 999/** 1000 * EditMenuOptions 1001 * 1002 * @interface EditMenuOptions 1003 * @syscap SystemCapability.ArkUI.ArkUI.Full 1004 * @crossplatform 1005 * @atomicservice 1006 * @since 12 1007 */ 1008declare interface EditMenuOptions { 1009 /** 1010 * Passes the default menu, invokes before every display to generate a menu for triggering click events. 1011 * 1012 * @param { Array<TextMenuItem> } menuItems - current default menu array. 1013 * @returns { Array<TextMenuItem> } - Return the menu after operations. 1014 * @syscap SystemCapability.ArkUI.ArkUI.Full 1015 * @crossplatform 1016 * @atomicservice 1017 * @since 12 1018 */ 1019 onCreateMenu(menuItems: Array<TextMenuItem>): Array<TextMenuItem>; 1020 /** 1021 * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior. 1022 * 1023 * @param { TextMenuItem } menuItem - current default menu. 1024 * @param { TextRange } range - current selected range. 1025 * @returns { boolean } - Return True, the event is consumed, false otherwise. 1026 * @syscap SystemCapability.ArkUI.ArkUI.Full 1027 * @crossplatform 1028 * @atomicservice 1029 * @since 12 1030 */ 1031 onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean; 1032} 1033 1034/** 1035 * Defines the font decoration result. 1036 * 1037 * @interface DecorationStyleResult 1038 * @syscap SystemCapability.ArkUI.ArkUI.Full 1039 * @crossplatform 1040 * @atomicservice 1041 * @since 12 1042 */ 1043interface DecorationStyleResult { 1044 /** 1045 * Font decoration type. 1046 * 1047 * @type { TextDecorationType } 1048 * @syscap SystemCapability.ArkUI.ArkUI.Full 1049 * @crossplatform 1050 * @atomicservice 1051 * @since 12 1052 */ 1053 type: TextDecorationType; 1054 1055 /** 1056 * Font decoration color. 1057 * 1058 * @type { ResourceColor } 1059 * @syscap SystemCapability.ArkUI.ArkUI.Full 1060 * @crossplatform 1061 * @atomicservice 1062 * @since 12 1063 */ 1064 color: ResourceColor; 1065 1066 /** 1067 * The style value of the decoration property object. 1068 * 1069 * @type { ?TextDecorationStyle } 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @atomicservice 1073 * @since 12 1074 */ 1075 style?: TextDecorationStyle; 1076} 1077 1078/** 1079 * Defines the options of font. 1080 * 1081 * @interface FontSettingOptions 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @crossplatform 1084 * @form 1085 * @atomicservice 1086 * @since 12 1087 */ 1088declare interface FontSettingOptions { 1089 /** 1090 * Define weather VariableFontWeight is supported. 1091 * 1092 * @type { ?boolean } 1093 * @syscap SystemCapability.ArkUI.ArkUI.Full 1094 * @crossplatform 1095 * @form 1096 * @atomicservice 1097 * @since 12 1098 */ 1099 enableVariableFontWeight?: boolean; 1100 }