FIX: Only labels for bold & italic in composer when language doesn't match icon
This commit is contained in:
parent
30d5caa9e9
commit
aff3d36f35
|
@ -63,22 +63,26 @@ class Toolbar {
|
||||||
{ group: "extras", buttons: [] },
|
{ group: "extras", buttons: [] },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const boldLabel = getButtonLabel("composer.bold_label", "B");
|
||||||
|
const boldIcon = boldLabel ? null : "bold";
|
||||||
this.addButton({
|
this.addButton({
|
||||||
id: "bold",
|
id: "bold",
|
||||||
group: "fontStyles",
|
group: "fontStyles",
|
||||||
icon: "bold",
|
icon: boldIcon,
|
||||||
label: getButtonLabel("composer.bold_label", "B"),
|
label: boldLabel,
|
||||||
shortcut: "B",
|
shortcut: "B",
|
||||||
preventFocus: true,
|
preventFocus: true,
|
||||||
trimLeading: true,
|
trimLeading: true,
|
||||||
perform: (e) => e.applySurround("**", "**", "bold_text"),
|
perform: (e) => e.applySurround("**", "**", "bold_text"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const italicLabel = getButtonLabel("composer.italic_label", "I");
|
||||||
|
const italicIcon = italicLabel ? null : "italic";
|
||||||
this.addButton({
|
this.addButton({
|
||||||
id: "italic",
|
id: "italic",
|
||||||
group: "fontStyles",
|
group: "fontStyles",
|
||||||
icon: "italic",
|
icon: italicIcon,
|
||||||
label: getButtonLabel("composer.italic_label", "I"),
|
label: italicLabel,
|
||||||
shortcut: "I",
|
shortcut: "I",
|
||||||
preventFocus: true,
|
preventFocus: true,
|
||||||
trimLeading: true,
|
trimLeading: true,
|
||||||
|
@ -88,6 +92,7 @@ class Toolbar {
|
||||||
if (opts.showLink) {
|
if (opts.showLink) {
|
||||||
this.addButton({
|
this.addButton({
|
||||||
id: "link",
|
id: "link",
|
||||||
|
icon: "link",
|
||||||
group: "insertions",
|
group: "insertions",
|
||||||
shortcut: "K",
|
shortcut: "K",
|
||||||
preventFocus: true,
|
preventFocus: true,
|
||||||
|
@ -114,6 +119,7 @@ class Toolbar {
|
||||||
id: "code",
|
id: "code",
|
||||||
group: "insertions",
|
group: "insertions",
|
||||||
shortcut: "E",
|
shortcut: "E",
|
||||||
|
icon: "code",
|
||||||
preventFocus: true,
|
preventFocus: true,
|
||||||
trimLeading: true,
|
trimLeading: true,
|
||||||
action: (...args) => this.context.send("formatCode", args),
|
action: (...args) => this.context.send("formatCode", args),
|
||||||
|
@ -170,7 +176,7 @@ class Toolbar {
|
||||||
tabindex: button.tabindex || "-1",
|
tabindex: button.tabindex || "-1",
|
||||||
className: button.className || button.id,
|
className: button.className || button.id,
|
||||||
label: button.label,
|
label: button.label,
|
||||||
icon: button.icon || button.id,
|
icon: button.icon,
|
||||||
action: button.action || ((a) => this.context.send("toolbarButton", a)),
|
action: button.action || ((a) => this.context.send("toolbarButton", a)),
|
||||||
perform: button.perform || function () {},
|
perform: button.perform || function () {},
|
||||||
trimLeading: button.trimLeading,
|
trimLeading: button.trimLeading,
|
||||||
|
|
Loading…
Reference in New Issue