mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
UX: adds chat send shortcut user preference (#30473)
Users can now decide if they want to send a message on: - <kbd>enter</kbd> - <kbd>meta + enter</kbd> If you choose <kbd>meta + enter</kbd>, <kbd>enter</kbd> will add a linebreak. <img width="192" alt="Screenshot 2025-01-21 at 12 57 48" src="https://github.com/user-attachments/assets/abfd6f8b-83b3-4e6f-be67-8f63d536ca8a" />
This commit is contained in:
@ -39,6 +39,10 @@ module Chat
|
||||
@chat_separate_sidebar_mode ||= { default: 0, never: 1, always: 2, fullscreen: 3 }
|
||||
end
|
||||
|
||||
def base.chat_send_shortcut
|
||||
@chat_send_shortcut ||= { enter: 0, meta_enter: 1 }
|
||||
end
|
||||
|
||||
# Avoid attempting to override when autoloading
|
||||
if !base.method_defined?(:chat_separate_sidebar_mode_default?)
|
||||
base.enum :chat_separate_sidebar_mode,
|
||||
@ -46,6 +50,10 @@ module Chat
|
||||
prefix: "chat_separate_sidebar_mode"
|
||||
end
|
||||
|
||||
if !base.method_defined?(:chat_send_shortcut_default?)
|
||||
base.enum :chat_send_shortcut, base.chat_send_shortcut, prefix: "chat_send_shortcut"
|
||||
end
|
||||
|
||||
if !base.method_defined?(:show_thread_title_prompts?)
|
||||
base.attribute :show_thread_title_prompts, :boolean, default: true
|
||||
end
|
||||
|
Reference in New Issue
Block a user