forked from element-hq/element-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3055c7
commit 88f147f
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"src/components/views/auth/AuthFooter.tsx": "src/components/views/auth/VectorAuthFooter.tsx", | ||
"src/components/views/auth/AuthHeaderLogo.tsx": "src/components/views/auth/VectorAuthHeaderLogo.tsx", | ||
"src/components/views/auth/AuthPage.tsx": "src/components/views/auth/VectorAuthPage.tsx" | ||
"src/components/views/auth/AuthPage.tsx": "src/components/views/auth/VectorAuthPage.tsx", | ||
"src/components/views/rooms/Autocomplete.tsx": "src/components/views/rooms/Autocomplete.tsx", | ||
"src/editor/commands.tsx": "src/editor/commands.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
|
||
export const generateCompletionDomId = (n: number): string => `mx_Autocomplete_Completion_${n}`; | ||
|
||
export default class Autocomplete extends React.PureComponent { | ||
public constructor(props: {} | Readonly<{}>) { | ||
super(props); | ||
|
||
this.state = { | ||
// list of completionResults, each containing completions | ||
completions: [], | ||
|
||
// array of completions, so we can look up current selection by offset quickly | ||
completionList: [], | ||
|
||
// how far down the completion list we are (THIS IS 1-INDEXED!) | ||
selectionOffset: 1, | ||
|
||
// whether we should show completions if they're available | ||
shouldShowCompletions: true, | ||
|
||
hide: false, | ||
|
||
forceComplete: false, | ||
}; | ||
} | ||
|
||
public render(): React.ReactNode { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { IContent, MatrixClient } from "matrix-js-sdk/src/matrix"; | ||
import { Command, getCommand } from "matrix-react-sdk/src/SlashCommands"; | ||
import EditorModel from "matrix-react-sdk/src/editor/model"; | ||
import { Type } from "matrix-react-sdk/src/editor/parts"; | ||
|
||
export function isSlashCommand(model: EditorModel): boolean { | ||
return false; | ||
} | ||
|
||
export function getSlashCommand(model: EditorModel): [Command | undefined, string | undefined, string] { | ||
const commandText = model.parts.reduce((text, part) => { | ||
// use mxid to textify user pills in a command and room alias/id for room pills | ||
if (part.type === Type.UserPill || part.type === Type.RoomPill) { | ||
return text + part.resourceId; | ||
} | ||
return text + part.text; | ||
}, ""); | ||
const { cmd, args } = getCommand(commandText); | ||
return [cmd, args, commandText]; | ||
} | ||
|
||
export async function runSlashCommand( | ||
matrixClient: MatrixClient, | ||
cmd: Command, | ||
args: string | undefined, | ||
roomId: string, | ||
threadId: string | null, | ||
): Promise<[content: IContent | null, success: boolean]> { | ||
return [null, false]; | ||
} | ||
|
||
export async function shouldSendAnyway(commandText: string): Promise<boolean> { | ||
return true; | ||
} |