1/* 2 * Copyright (c) 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/// <reference path='./import.ts' /> 17 18class RichEditorCopyOptionsModifier extends ModifierWithKey<CopyOptions> { 19 constructor(value: CopyOptions) { 20 super(value); 21 } 22 static identity: Symbol = Symbol('richEditorCopyOptions'); 23 applyPeer(node: KNode, reset: boolean): void { 24 if (reset) { 25 getUINativeModule().richEditor.resetCopyOptions(node); 26 } else { 27 getUINativeModule().richEditor.setCopyOptions(node, this.value!); 28 } 29 } 30 checkObjectDiff(): boolean { 31 return this.stageValue !== this.value; 32 } 33} 34 35class ArkRichEditorComponent extends ArkComponent implements CommonMethod<RichEditorAttribute> { 36 constructor(nativePtr: KNode) { 37 super(nativePtr); 38 } 39 enableDataDetector(enable: boolean): RichEditorAttribute { 40 throw new Error('Method not implemented.'); 41 } 42 43 dataDetectorConfig(config: any): RichEditorAttribute { 44 throw new Error('Method not implemented.'); 45 } 46 47 copyOptions(value: CopyOptions): RichEditorAttribute { 48 modifierWithKey(this._modifiersWithKeys, RichEditorCopyOptionsModifier.identity, RichEditorCopyOptionsModifier, value); 49 return this; 50 } 51 onPaste(callback: (event?: PasteEvent) => void): RichEditorAttribute { 52 throw new Error('Method not implemented.'); 53 } 54 onReady(callback: () => void): RichEditorAttribute { 55 throw new Error('Method not implemented.'); 56 } 57 onSelect(callback: (value: RichEditorSelection) => void): RichEditorAttribute { 58 throw new Error('Method not implemented.'); 59 } 60 aboutToIMEInput(callback: (value: RichEditorInsertValue) => boolean): RichEditorAttribute { 61 throw new Error('Method not implemented.'); 62 } 63 onIMEInputComplete(callback: (value: RichEditorTextSpanResult) => void): RichEditorAttribute { 64 throw new Error('Method not implemented.'); 65 } 66 aboutToDelete(callback: (value: RichEditorDeleteValue) => boolean): RichEditorAttribute { 67 throw new Error('Method not implemented.'); 68 } 69 onDeleteComplete(callback: () => void): RichEditorAttribute { 70 throw new Error('Method not implemented.'); 71 } 72 bindSelectionMenu(spanType: RichEditorSpanType, content: CustomBuilder, responseType: ResponseType, options?: SelectionMenuOptions): RichEditorAttribute { 73 throw new Error('Method not implemented.'); 74 } 75 customKeyboard(value: CustomBuilder): RichEditorAttribute { 76 throw new Error('Method not implemented.'); 77 } 78} 79 80// @ts-ignore 81globalThis.RichEditor.attributeModifier = function (modifier) { 82 const elmtId = ViewStackProcessor.GetElmtIdToAccountFor(); 83 let nativeNode = getUINativeModule().getFrameNodeById(elmtId); 84 85 let component = this.createOrGetNode(elmtId, () => { 86 return new ArkRichEditorComponent(nativeNode); 87 }); 88 applyUIAttributes(modifier, nativeNode, component); 89 component.applyModifierPatch(); 90}; 91