disable preview formattingBar disabled (#28727)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Arya Khochare
2024-11-21 16:27:45 +05:30
коммит произвёл GitHub
родитель 45860309b1
Коммит 12f8ff0e8b
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@@ -168,6 +168,7 @@ const AdvancedTextEditor = ({
const readOnlyChannel = !canPost;
const hasDraftMessage = Boolean(draft.message);
const showFormattingBar = !isFormattingBarHidden && !readOnlyChannel;
const enableSharedChannelsDMs = useSelector((state: GlobalState) => getFeatureFlagValue(state, 'EnableSharedChannelsDMs') === 'true');
const isDMOrGMRemote = isChannelShared && (channelType === Constants.DM_CHANNEL || channelType === Constants.GM_CHANNEL);
const isDisabled = Boolean(readOnlyChannel || (!enableSharedChannelsDMs && isDMOrGMRemote));
@@ -282,6 +283,7 @@ const AdvancedTextEditor = ({
isValidPersistentNotifications,
location,
textboxRef,
showFormattingBar,
focusTextbox,
applyMarkdown,
handleDraftChange,
@@ -515,8 +517,6 @@ const AdvancedTextEditor = ({
break;
}
const showFormattingBar = !isFormattingBarHidden && !isDisabled;
const wasNotifiedOfLogIn = LocalStorageStore.getWasNotifiedOfLogIn();
let loginSuccessfulLabel;

Просмотреть файл

@@ -38,6 +38,7 @@ const useKeyHandler = (
isValidPersistentNotifications: boolean,
location: string,
textboxRef: React.RefObject<TextboxClass>,
showFormattingBar: boolean,
focusTextbox: (forceFocus?: boolean) => void,
applyMarkdown: (params: ApplyMarkdownOptions) => void,
handleDraftChange: (draft: PostDraft, options?: {instant?: boolean; show?: boolean}) => void,
@@ -257,7 +258,7 @@ const useKeyHandler = (
e.stopPropagation();
e.preventDefault();
toggleAdvanceTextEditor();
} else if (Keyboard.isKeyPressed(e, KeyCodes.P) && draft.message.length && !UserAgent.isMac()) {
} else if (Keyboard.isKeyPressed(e, KeyCodes.P) && draft.message.length && !UserAgent.isMac() && showFormattingBar) {
e.stopPropagation();
e.preventDefault();
toggleShowPreview();