mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
fix(editor): pad the composer text below as well as above
This commit is contained in:
5 files changed
+7
-27
No files matched your search
@@ -65,7 +65,7 @@ export const EditorTextarea = style([
|
||||
{
|
||||
flexGrow: 1,
|
||||
height: 'auto',
|
||||
padding: `${toRem(13)} 0 0`,
|
||||
padding: `${toRem(13)} 0`,
|
||||
position: 'relative',
|
||||
whiteSpace: 'pre-wrap',
|
||||
wordWrap: 'break-word',
|
||||
@@ -104,10 +104,6 @@ export const EditorTextarea = style([
|
||||
},
|
||||
]);
|
||||
|
||||
export const EditorTextareaInline = style({
|
||||
paddingBottom: toRem(13),
|
||||
});
|
||||
|
||||
export const EditorResponsiveAfterMultiline = style([
|
||||
EditorOptions,
|
||||
{
|
||||
|
||||
@@ -79,14 +79,12 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
ref
|
||||
) => {
|
||||
const [shortcutOverrides] = useSetting(settingsAtom, 'shortcutOverrides');
|
||||
const [alwaysInlineEditor] = useSetting(settingsAtom, 'alwaysInlineEditor');
|
||||
const rootRef = useRef<HTMLDivElement | null>(null);
|
||||
const focusScrollTimerRef = useRef<number>();
|
||||
|
||||
// Buttons stay inline however tall the composer grows; only the audio
|
||||
// recorder stacks, because its controls need a row of their own.
|
||||
const layoutIsMultiline = !alwaysInlineEditor && forceMultilineLayout;
|
||||
const showResponsiveAfterInFooter = Boolean(responsiveAfter) && layoutIsMultiline;
|
||||
const showResponsiveAfterInFooter = Boolean(responsiveAfter) && forceMultilineLayout;
|
||||
|
||||
useEffect(() => () => window.clearTimeout(focusScrollTimerRef.current), []);
|
||||
const handleKeyDown: KeyboardEventHandler = useCallback(
|
||||
@@ -135,13 +133,13 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
<div ref={setRootRef} className={`${css.Editor} ${className ?? ''}`}>
|
||||
{top}
|
||||
<Box
|
||||
className={`${css.EditorRow} ${layoutIsMultiline ? css.EditorRowMultiline : ''} ${showResponsiveAfterInFooter ? css.EditorRowMultilineWithResponsiveAfter : ''}`}
|
||||
className={`${css.EditorRow} ${forceMultilineLayout ? css.EditorRowMultiline : ''} ${showResponsiveAfterInFooter ? css.EditorRowMultilineWithResponsiveAfter : ''}`}
|
||||
alignItems="Start"
|
||||
style={{ display: after ? 'grid' : 'flex' }}
|
||||
>
|
||||
{before && (
|
||||
<Box
|
||||
className={`${css.EditorOptions} ${layoutIsMultiline ? css.EditorOptionsMultiline : ''}`}
|
||||
className={`${css.EditorOptions} ${forceMultilineLayout ? css.EditorOptionsMultiline : ''}`}
|
||||
alignItems="Center"
|
||||
gap="100"
|
||||
shrink="No"
|
||||
@@ -150,7 +148,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
</Box>
|
||||
)}
|
||||
<Scroll
|
||||
className={`${css.EditorTextareaScroll} ${layoutIsMultiline ? css.EditorTextareaScrollMultiline : ''}`}
|
||||
className={`${css.EditorTextareaScroll} ${forceMultilineLayout ? css.EditorTextareaScrollMultiline : ''}`}
|
||||
variant={variant}
|
||||
style={{ maxHeight: showResponsiveAfterInFooter ? undefined : maxHeight }}
|
||||
size="300"
|
||||
@@ -160,7 +158,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
<ProseMirrorEditable
|
||||
controller={editor}
|
||||
editableName={editableName}
|
||||
editorClassName={`${css.EditorTextarea} ${alwaysInlineEditor ? css.EditorTextareaInline : ''}`}
|
||||
editorClassName={css.EditorTextarea}
|
||||
placeholder={placeholder}
|
||||
enterKeyHint={enterKeyHint}
|
||||
onDocumentChange={handleDocumentChange}
|
||||
@@ -189,7 +187,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
|
||||
</Scroll>
|
||||
{(after || (responsiveAfter && !showResponsiveAfterInFooter)) && (
|
||||
<Box
|
||||
className={`${css.EditorOptions} ${layoutIsMultiline ? `${css.EditorOptionsMultiline} ${css.EditorOptionsAfterMultiline}` : ''}`}
|
||||
className={`${css.EditorOptions} ${forceMultilineLayout ? `${css.EditorOptionsMultiline} ${css.EditorOptionsAfterMultiline}` : ''}`}
|
||||
alignItems="Center"
|
||||
gap="100"
|
||||
shrink="No"
|
||||
|
||||
@@ -445,10 +445,6 @@ function EditorButtonOrderRow({
|
||||
function Editor() {
|
||||
const [enterForNewline, setEnterForNewline] = useSetting(settingsAtom, 'enterForNewline');
|
||||
const [editorToolbar, setEditorToolbar] = useSetting(settingsAtom, 'editorToolbar');
|
||||
const [alwaysInlineEditor, setAlwaysInlineEditor] = useSetting(
|
||||
settingsAtom,
|
||||
'alwaysInlineEditor'
|
||||
);
|
||||
const [editorOldAddFile, setEditorOldAddFile] = useSetting(settingsAtom, 'editorOldAddFile');
|
||||
const [editorMicButton, setEditorMicButton] = useSetting(settingsAtom, 'editorMicButton');
|
||||
const [editorEmojiButton, setEditorEmojiButton] = useSetting(settingsAtom, 'editorEmojiButton');
|
||||
@@ -539,13 +535,6 @@ function Editor() {
|
||||
value={editorStickerButton}
|
||||
onChange={setEditorStickerButton}
|
||||
/>
|
||||
<SettingToggle
|
||||
title="Always Inline Editor"
|
||||
focusId="always-inline-editor"
|
||||
description="Always keep the last line of the text editor inline with UI buttons."
|
||||
value={alwaysInlineEditor}
|
||||
onChange={setAlwaysInlineEditor}
|
||||
/>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Composer Button Order"
|
||||
|
||||
@@ -75,7 +75,6 @@ export const settingsLinkFocusIdsBySection: Record<SettingsSectionId, readonly s
|
||||
'always-play-call-sound',
|
||||
'custom-call-ringtone',
|
||||
'custom-call-ringback',
|
||||
'always-inline-editor',
|
||||
'composer-button-order',
|
||||
'show-emoji-button',
|
||||
'show-gif-button',
|
||||
|
||||
@@ -132,7 +132,6 @@ export interface Settings {
|
||||
editorStickerButton: boolean;
|
||||
editorButtonOrder: EditorButtonId[];
|
||||
composerToolbarOpen: boolean;
|
||||
alwaysInlineEditor: boolean;
|
||||
messageLayout: MessageLayout;
|
||||
messageSpacing: MessageSpacing;
|
||||
hideMembershipEvents: boolean;
|
||||
@@ -319,7 +318,6 @@ export const defaultSettings: Settings = {
|
||||
editorStickerButton: false,
|
||||
editorButtonOrder: [...EDITOR_BUTTON_ORDER_DEFAULT],
|
||||
composerToolbarOpen: false,
|
||||
alwaysInlineEditor: false,
|
||||
messageLayout: 0,
|
||||
messageSpacing: '400',
|
||||
hideMembershipEvents: false,
|
||||
|
||||
Reference in new issue
Block a user