mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Show fewer toolbar icons in mobile composer (#14621)
This commit is contained in:
parent
70634198a4
commit
7a4a1744a2
@ -64,7 +64,7 @@ let _createCallbacks = [];
|
||||
|
||||
class Toolbar {
|
||||
constructor(opts) {
|
||||
const { siteSettings } = opts;
|
||||
const { site, siteSettings } = opts;
|
||||
this.shortcuts = {};
|
||||
this.context = null;
|
||||
|
||||
@ -129,29 +129,31 @@ class Toolbar {
|
||||
action: (...args) => this.context.send("formatCode", args),
|
||||
});
|
||||
|
||||
this.addButton({
|
||||
id: "bullet",
|
||||
group: "extras",
|
||||
icon: "list-ul",
|
||||
shortcut: "Shift+8",
|
||||
title: "composer.ulist_title",
|
||||
preventFocus: true,
|
||||
perform: (e) => e.applyList("* ", "list_item"),
|
||||
});
|
||||
if (!site.mobileView) {
|
||||
this.addButton({
|
||||
id: "bullet",
|
||||
group: "extras",
|
||||
icon: "list-ul",
|
||||
shortcut: "Shift+8",
|
||||
title: "composer.ulist_title",
|
||||
preventFocus: true,
|
||||
perform: (e) => e.applyList("* ", "list_item"),
|
||||
});
|
||||
|
||||
this.addButton({
|
||||
id: "list",
|
||||
group: "extras",
|
||||
icon: "list-ol",
|
||||
shortcut: "Shift+7",
|
||||
title: "composer.olist_title",
|
||||
preventFocus: true,
|
||||
perform: (e) =>
|
||||
e.applyList(
|
||||
(i) => (!i ? "1. " : `${parseInt(i, 10) + 1}. `),
|
||||
"list_item"
|
||||
),
|
||||
});
|
||||
this.addButton({
|
||||
id: "list",
|
||||
group: "extras",
|
||||
icon: "list-ol",
|
||||
shortcut: "Shift+7",
|
||||
title: "composer.olist_title",
|
||||
preventFocus: true,
|
||||
perform: (e) =>
|
||||
e.applyList(
|
||||
(i) => (!i ? "1. " : `${parseInt(i, 10) + 1}. `),
|
||||
"list_item"
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
if (siteSettings.support_mixed_text_direction) {
|
||||
this.addButton({
|
||||
|
@ -318,6 +318,28 @@ export default Controller.extend({
|
||||
})
|
||||
);
|
||||
|
||||
if (this.site.mobileView) {
|
||||
options.push(
|
||||
this._setupPopupMenuOption(() => {
|
||||
return {
|
||||
action: "applyUnorderedList",
|
||||
icon: "list-ul",
|
||||
label: "composer.ulist_title",
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
options.push(
|
||||
this._setupPopupMenuOption(() => {
|
||||
return {
|
||||
action: "applyOrderedList",
|
||||
icon: "list-ol",
|
||||
label: "composer.olist_title",
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
options.push(
|
||||
this._setupPopupMenuOption(() => {
|
||||
return {
|
||||
@ -679,6 +701,17 @@ export default Controller.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
applyUnorderedList() {
|
||||
this.toolbarEvent.applyList("* ", "list_item");
|
||||
},
|
||||
|
||||
applyOrderedList() {
|
||||
this.toolbarEvent.applyList(
|
||||
(i) => (!i ? "1. " : `${parseInt(i, 10) + 1}. `),
|
||||
"list_item"
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
disableSubmit: or("model.loading", "isUploading", "isProcessingUpload"),
|
||||
|
@ -230,6 +230,9 @@
|
||||
display: inline-block;
|
||||
border-left: 1px solid var(--primary-low-mid);
|
||||
margin: 0 0.25em;
|
||||
.mobile-view & {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.btn:focus {
|
||||
|
Loading…
Reference in New Issue
Block a user