Files
zulip/web/templates/message_edit_form.hbs
Trident Pancake 6fb16f3598 message_edit: Disable save btn after edit time limit
Fixes #25413.

The old code was disabling the save button wrong by using
`.addClass("disabled")` instead of `prop()`.

Added tooltip for the disabled save button as per issue #25413 and changed
"Times up!" color to red.

The textbox readonly logic was changed to no longer becoming readonly. Reason
being there are edge cases involving the compose buttons such that simply
marking the textbox as readonly is not sufficient.

E.g. using the compose buttons after readonly still modifies the content.

One solution might be to just hide the compose buttons visually. However, there
are edge cases for that too. If preview mode was previously active, then
perhaps that state needs to be reverted. If any modal is open, such as the emoji
picker, then that needs to be closed. Solving these edge cases doesn't
improve the user experience. Keeping the textbox editable allows an easier way
for user to copy the text and don't have weird cases.
2023-05-16 15:59:29 -07:00

46 lines
2.3 KiB
Handlebars

{{! Client-side Handlebars template for rendering the message edit form. }}
<form id="edit_form_{{message_id}}" class="new-style">
<div class="edit_form_banners"></div>
<div class="edit-controls">
{{> copy_message_button message_id=this.message_id}}
<textarea class="message_edit_content" maxlength="{{ max_message_length }}">{{content}}</textarea>
<div class="scrolling_list preview_message_area" id="preview_message_area_{{message_id}}" style="display:none;">
<div class="markdown_preview_spinner"></div>
<div class="preview_content rendered_markdown"></div>
</div>
</div>
<div class="action-buttons">
<div class="message_edit_spinner"></div>
<div class="controls edit-controls">
{{#if is_editable}}
<div class="btn-wrapper inline-block message_edit_save_container"
data-tippy-content="{{t 'You can no longer save changes to this message.' }}">
<button type="button" class="button small rounded sea-green message_edit_save">
<img class="loader" alt="" src="" />
<span>{{t "Save" }}</span>
</button>
</div>
<div class="btn-wrapper inline-block">
<button type="button" class="button small rounded message_edit_cancel">{{t "Cancel" }}</button>
</div>
<div class="message-edit-feature-group">
{{> compose_control_buttons }}
</div>
{{else}}
<button type="button" class="button small rounded message_edit_close">{{t "Close" }}</button>
{{/if}}
{{#if is_editable}}
<div class="message-edit-timer">
<span class="message_edit_countdown_timer"></span>
<span>
<i id="message_edit_tooltip" class="tippy-zulip-tooltip message_edit_tooltip fa fa-question-circle" aria-hidden="true"
data-tippy-content="{{t 'This organization is configured to restrict editing of message content to {minutes_to_edit} minutes after it is sent.' }}">
</i>
</span>
</div>
{{/if}}
</div>
</div>
</form>