Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0689eeb

Browse files
author
Alun Turner
committed
try to tidy up types
1 parent 4731b38 commit 0689eeb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/components/views/rooms/wysiwyg_composer/hooks/useInputEventProcessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import { Wysiwyg, WysiwygEvent } from "@matrix-org/matrix-wysiwyg";
18-
import { useCallback } from "react";
18+
import { useCallback, ClipboardEvent as ReactClipboardEvent } from "react";
1919
import { IEventRelation, MatrixClient } from "matrix-js-sdk/src/matrix";
2020

2121
import { useSettingValue } from "../../../../../hooks/useSettings";
@@ -246,7 +246,7 @@ function handleInputEvent(event: InputEvent, send: Send, isCtrlEnterToSend: bool
246246
* @returns - boolean to show if the event was handled or not
247247
*/
248248
export function handleClipboardEvent(
249-
clipboardEvent: ClipboardEvent,
249+
clipboardEvent: ClipboardEvent | ReactClipboardEvent,
250250
roomContext: IRoomState,
251251
mxClient: MatrixClient,
252252
eventRelation?: IEventRelation,

src/components/views/rooms/wysiwyg_composer/hooks/usePlainTextListeners.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { KeyboardEvent, RefObject, SyntheticEvent, useCallback, useRef, useState } from "react";
17+
import { KeyboardEvent, RefObject, SyntheticEvent, ClipboardEvent, useCallback, useRef, useState } from "react";
1818
import { Attributes, MappedSuggestion } from "@matrix-org/matrix-wysiwyg";
1919
import { IEventRelation } from "matrix-js-sdk/src/matrix";
2020

@@ -68,8 +68,8 @@ export function usePlainTextListeners(
6868
ref: RefObject<HTMLDivElement>;
6969
autocompleteRef: React.RefObject<Autocomplete>;
7070
content?: string;
71-
onInput(event: SyntheticEvent<HTMLDivElement, InputEvent | ClipboardEvent>): void;
72-
onPaste(event: SyntheticEvent<HTMLDivElement, InputEvent | ClipboardEvent>): void;
71+
onInput(event: SyntheticEvent<HTMLDivElement, InputEvent> | ClipboardEvent): void;
72+
onPaste(event: ClipboardEvent): void;
7373
onKeyDown(event: KeyboardEvent<HTMLDivElement>): void;
7474
setContent(text?: string): void;
7575
handleMention: (link: string, text: string, attributes: Attributes) => void;
@@ -113,7 +113,7 @@ export function usePlainTextListeners(
113113

114114
const enterShouldSend = !useSettingValue<boolean>("MessageComposerInput.ctrlEnterToSend");
115115
const onInput = useCallback(
116-
(event: SyntheticEvent<HTMLDivElement, InputEvent | ClipboardEvent>) => {
116+
(event: SyntheticEvent<HTMLDivElement, InputEvent> | ClipboardEvent) => {
117117
console.log("<<< handling ", event);
118118
if (isDivElement(event.target)) {
119119
console.log("<<< setting ", event.target.innerHTML);
@@ -127,7 +127,7 @@ export function usePlainTextListeners(
127127
);
128128

129129
const onPaste = useCallback(
130-
(event: SyntheticEvent<HTMLDivElement, ClipboardEvent>) => {
130+
(event: ClipboardEvent) => {
131131
const handled = handleClipboardEvent(event, roomContext, mxClient, eventRelation);
132132
if (handled) {
133133
event.preventDefault(); // we only handle image pasting manually

0 commit comments

Comments
 (0)