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