mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
UX: adds shortcuts for quote (q) and fast edit (e) (#14552)
This commit is contained in:
parent
a55642a30a
commit
2af6052307
4 changed files with 32 additions and 1 deletions
|
@ -232,6 +232,8 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
}
|
}
|
||||||
|
|
||||||
$quoteButton.offset({ top, left });
|
$quoteButton.offset({ top, left });
|
||||||
|
|
||||||
|
this.element.querySelector("button")?.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -279,6 +281,24 @@ export default Component.extend(KeyEnterEscape, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
keyDown(event) {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
if (!this.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._displayFastEditInput && event.key === "e") {
|
||||||
|
this._toggleFastEditForm();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === "q") {
|
||||||
|
this.insertQuote();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
$(document)
|
$(document)
|
||||||
.off("mousedown.quote-button")
|
.off("mousedown.quote-button")
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
class="btn-flat insert-quote"
|
class="btn-flat insert-quote"
|
||||||
action=(action "insertQuote")
|
action=(action "insertQuote")
|
||||||
icon="quote-left"
|
icon="quote-left"
|
||||||
label="post.quote_reply"}}
|
label="post.quote_reply"
|
||||||
|
title="post.quote_reply_shortcut"
|
||||||
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if siteSettings.enable_fast_edit}}
|
{{#if siteSettings.enable_fast_edit}}
|
||||||
|
@ -14,6 +16,7 @@
|
||||||
action=(action "_toggleFastEditForm")
|
action=(action "_toggleFastEditForm")
|
||||||
label="post.quote_edit"
|
label="post.quote_edit"
|
||||||
class="btn-flat quote-edit-label"
|
class="btn-flat quote-edit-label"
|
||||||
|
title="post.quote_edit_shortcut"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -423,6 +423,12 @@ aside.quote {
|
||||||
color: var(--secondary-or-primary);
|
color: var(--secondary-or-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn:focus:not(:hover),
|
||||||
|
.btn:focus:not(:hover) .d-icon {
|
||||||
|
color: var(--secondary);
|
||||||
|
background-color: var(--secondary-high);
|
||||||
|
}
|
||||||
|
|
||||||
.insert-quote + .quote-sharing {
|
.insert-quote + .quote-sharing {
|
||||||
border-left: 1px solid rgba(255, 255, 255, 0.3);
|
border-left: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3016,7 +3016,9 @@ en:
|
||||||
|
|
||||||
post:
|
post:
|
||||||
quote_reply: "Quote"
|
quote_reply: "Quote"
|
||||||
|
quote_reply_shortcut: "Or press q"
|
||||||
quote_edit: "Edit"
|
quote_edit: "Edit"
|
||||||
|
quote_edit_shortcut: "Or press e"
|
||||||
quote_share: "Share"
|
quote_share: "Share"
|
||||||
edit_reason: "Reason: "
|
edit_reason: "Reason: "
|
||||||
post_number: "post %{number}"
|
post_number: "post %{number}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue