mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 02:30:29 +03:00
Editor Commands (#1450)
* add commands hook * add commands in editor * add command auto complete menu * add commands in room input * remove old reply code from room input * fix video component css * do not auto focus input on android or ios * fix crash on enable block after selection * fix circular deps in editor * fix autocomplete return focus move editor cursor * remove unwanted keydown from room input * fix emoji alignment in editor * test ipad user agent * refactor isAndroidOrIOS to mobileOrTablet * update slate & slate-react * downgrade slate-react to 0.98.4 0.99.0 has breaking changes with ReactEditor.focus * add sql to readable ext mimetype * fix empty editor formatting gets saved as draft * add option to use enter for newline * remove empty msg draft from atom family * prevent msg ctx menu from open on text selection
This commit is contained in:
parent
4d0b6b93bc
commit
613e6d6503
34 changed files with 620 additions and 131 deletions
|
|
@ -19,6 +19,7 @@ export function AutocompleteMenu({ headerContent, requestClose, children }: Auto
|
|||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
onDeactivate: () => requestClose(),
|
||||
returnFocusOnDeactivate: false,
|
||||
clickOutsideDeactivates: true,
|
||||
allowOutsideClick: true,
|
||||
isKeyForward: (evt: KeyboardEvent) => isHotkey('arrowdown', evt),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
useAsyncSearch,
|
||||
} from '../../../hooks/useAsyncSearch';
|
||||
import { onTabPress } from '../../../utils/keyboard';
|
||||
import { createEmoticonElement, moveCursor, replaceWithElement } from '../common';
|
||||
import { createEmoticonElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { useRecentEmoji } from '../../../hooks/useRecentEmoji';
|
||||
import { useRelevantImagePacks } from '../../../hooks/useImagePacks';
|
||||
import { IEmoji, emojis } from '../../../plugins/emoji';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Editor } from 'slate';
|
|||
import { Avatar, AvatarFallback, AvatarImage, Icon, Icons, MenuItem, Text, color } from 'folds';
|
||||
import { MatrixClient } from 'matrix-js-sdk';
|
||||
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../common';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { getRoomAvatarUrl, joinRuleToIconSrc } from '../../../utils/room';
|
||||
import { roomIdByActivity } from '../../../../util/sort';
|
||||
import initMatrix from '../../../../client/initMatrix';
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
useAsyncSearch,
|
||||
} from '../../../hooks/useAsyncSearch';
|
||||
import { onTabPress } from '../../../utils/keyboard';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../common';
|
||||
import { createMentionElement, moveCursor, replaceWithElement } from '../utils';
|
||||
import { useKeyDown } from '../../../hooks/useKeyDown';
|
||||
import { getMxIdLocalPart, getMxIdServer, validMxId } from '../../../utils/matrix';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ export enum AutocompletePrefix {
|
|||
RoomMention = '#',
|
||||
UserMention = '@',
|
||||
Emoticon = ':',
|
||||
Command = '/',
|
||||
}
|
||||
export const AUTOCOMPLETE_PREFIXES: readonly AutocompletePrefix[] = [
|
||||
AutocompletePrefix.RoomMention,
|
||||
AutocompletePrefix.UserMention,
|
||||
AutocompletePrefix.Emoticon,
|
||||
AutocompletePrefix.Command,
|
||||
];
|
||||
|
||||
export type AutocompleteQuery<TPrefix extends string> = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue