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

Commit

Permalink
try to tidy up types
Browse files Browse the repository at this point in the history
  • Loading branch information
Alun Turner committed Jun 7, 2023
1 parent 4731b38 commit 0689eeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

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

import { useSettingValue } from "../../../../../hooks/useSettings";
Expand Down Expand Up @@ -246,7 +246,7 @@ function handleInputEvent(event: InputEvent, send: Send, isCtrlEnterToSend: bool
* @returns - boolean to show if the event was handled or not
*/
export function handleClipboardEvent(
clipboardEvent: ClipboardEvent,
clipboardEvent: ClipboardEvent | ReactClipboardEvent,
roomContext: IRoomState,
mxClient: MatrixClient,
eventRelation?: IEventRelation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

Expand Down Expand Up @@ -68,8 +68,8 @@ export function usePlainTextListeners(
ref: RefObject<HTMLDivElement>;
autocompleteRef: React.RefObject<Autocomplete>;
content?: string;
onInput(event: SyntheticEvent<HTMLDivElement, InputEvent | ClipboardEvent>): void;
onPaste(event: SyntheticEvent<HTMLDivElement, InputEvent | ClipboardEvent>): void;
onInput(event: SyntheticEvent<HTMLDivElement, InputEvent> | ClipboardEvent): void;
onPaste(event: ClipboardEvent): void;
onKeyDown(event: KeyboardEvent<HTMLDivElement>): void;
setContent(text?: string): void;
handleMention: (link: string, text: string, attributes: Attributes) => void;
Expand Down Expand Up @@ -113,7 +113,7 @@ export function usePlainTextListeners(

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

const onPaste = useCallback(
(event: SyntheticEvent<HTMLDivElement, ClipboardEvent>) => {
(event: ClipboardEvent) => {
const handled = handleClipboardEvent(event, roomContext, mxClient, eventRelation);
if (handled) {
event.preventDefault(); // we only handle image pasting manually
Expand Down

0 comments on commit 0689eeb

Please sign in to comment.