mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
zcommand: Add /fluid-width and /fixed-width slash commands.
This commit is contained in:
@@ -90,6 +90,50 @@ exports.enter_night_mode = function () {
|
||||
});
|
||||
};
|
||||
|
||||
exports.enter_fluid_mode = function () {
|
||||
exports.send({
|
||||
command: "/fluid-width",
|
||||
on_success: function (data) {
|
||||
scroll_bar.set_layout_width();
|
||||
feedback_widget.show({
|
||||
populate: function (container) {
|
||||
const rendered_msg = marked(data.msg).trim();
|
||||
container.html(rendered_msg);
|
||||
},
|
||||
on_undo: function () {
|
||||
exports.send({
|
||||
command: "/fixed-width",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Fluid width mode"),
|
||||
undo_button_text: i18n.t("Fixed width"),
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
exports.enter_fixed_mode = function () {
|
||||
exports.send({
|
||||
command: "/fixed-width",
|
||||
on_success: function (data) {
|
||||
scroll_bar.set_layout_width();
|
||||
feedback_widget.show({
|
||||
populate: function (container) {
|
||||
const rendered_msg = marked(data.msg).trim();
|
||||
container.html(rendered_msg);
|
||||
},
|
||||
on_undo: function () {
|
||||
exports.send({
|
||||
command: "/fluid-width",
|
||||
});
|
||||
},
|
||||
title_text: i18n.t("Fixed width mode"),
|
||||
undo_button_text: i18n.t("Fluid width"),
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
exports.process = function (message_content) {
|
||||
|
||||
const content = message_content.trim();
|
||||
@@ -122,6 +166,16 @@ exports.process = function (message_content) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (content === '/fluid-width') {
|
||||
exports.enter_fluid_mode();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (content === '/fixed-width') {
|
||||
exports.enter_fixed_mode();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (content === '/settings') {
|
||||
hashchange.go_to_location('settings/your-account');
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user