mirror of
https://github.com/discourse/discourse.git
synced 2025-03-14 10:33:43 +00:00
UX: add title and aria-label to md/rich editor toggle (#31784)
This commit is contained in:
@ -3,6 +3,7 @@ import { on } from "@ember/modifier";
|
||||
import { action } from "@ember/object";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
import icon from "discourse/helpers/d-icon";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
export default class ComposerToggleSwitch extends Component {
|
||||
@action
|
||||
@ -12,6 +13,14 @@ export default class ComposerToggleSwitch extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
get label() {
|
||||
if (this.args.state) {
|
||||
return i18n("composer.switch_to_markdown");
|
||||
} else {
|
||||
return i18n("composer.switch_to_rich_text");
|
||||
}
|
||||
}
|
||||
|
||||
<template>
|
||||
{{! template-lint-disable no-redundant-role }}
|
||||
<button
|
||||
@ -22,6 +31,8 @@ export default class ComposerToggleSwitch extends Component {
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={{if @state "true" "false"}}
|
||||
aria-label={{this.label}}
|
||||
title={{this.label}}
|
||||
{{! template-lint-disable no-pointer-down-event-binding }}
|
||||
{{on "mousedown" this.mouseDown}}
|
||||
...attributes
|
||||
|
@ -2753,6 +2753,8 @@ en:
|
||||
show_preview: "show preview"
|
||||
hide_preview: "hide preview"
|
||||
|
||||
switch_to_markdown: "Switch to standard Markdown editor"
|
||||
switch_to_rich_text: "Switch to new rich text editor"
|
||||
quote_post_title: "Quote whole post"
|
||||
bold_label: "B"
|
||||
bold_title: "Strong"
|
||||
|
Reference in New Issue
Block a user