mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
click_handlers: Use stream desc. on edit instead of rendered desc.
On clicking the edit button for a stream description, the stream's unrendered description should be made editable as text instead of the stream's rendered description (which would be displayed as HTML instead of text). This completes the effort to use backend-rendered stream descriptions here. Fixes #11272.
This commit is contained in:
committed by
Tim Abbott
parent
683ec852fd
commit
77f24e2b56
@@ -611,8 +611,14 @@ exports.initialize = function () {
|
||||
|
||||
(function () {
|
||||
var map = {
|
||||
".stream-description-editable": stream_edit.change_stream_description,
|
||||
".stream-name-editable": stream_edit.change_stream_name,
|
||||
".stream-description-editable": {
|
||||
on_start: stream_edit.set_raw_description,
|
||||
on_save: stream_edit.change_stream_description,
|
||||
},
|
||||
".stream-name-editable": {
|
||||
on_start: null,
|
||||
on_save: stream_edit.change_stream_name,
|
||||
},
|
||||
};
|
||||
|
||||
$(document).on("keydown", ".editable-section", function (e) {
|
||||
@@ -658,6 +664,10 @@ exports.initialize = function () {
|
||||
edit_area.attr("data-prev-text", edit_area.text().trim())
|
||||
.attr("contenteditable", true);
|
||||
|
||||
if (map[selector].on_start) {
|
||||
map[selector].on_start(this, edit_area);
|
||||
}
|
||||
|
||||
ui_util.place_caret_at_end(edit_area[0]);
|
||||
|
||||
$(this).html("×");
|
||||
@@ -666,8 +676,8 @@ exports.initialize = function () {
|
||||
|
||||
$("body").on("click", "[data-finish-editing]", function (e) {
|
||||
var selector = $(this).attr("data-finish-editing");
|
||||
if (map[selector]) {
|
||||
map[selector](e);
|
||||
if (map[selector].on_save) {
|
||||
map[selector].on_save(e);
|
||||
$(this).hide();
|
||||
$(this).parent().find(selector).attr("contenteditable", false);
|
||||
$("[data-make-editable='" + selector + "']").html("");
|
||||
|
||||
Reference in New Issue
Block a user