mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 18:09:58 +08:00
feat(editor): add shortcut to highlighter tool (#11604)
Closes: [BS-3092](https://linear.app/affine-design/issue/BS-3092/highlighter-快捷键) ### What's Changed! * Added shortcut `⇧ P` to highlighter tool [Screen Recording 2025-04-10 at 16.33.30.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov" />](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { property } from 'lit/decorators.js';
|
||||
import { repeat } from 'lit-html/directives/repeat.js';
|
||||
|
||||
export class TooltipContentWithShortcut extends LitElement {
|
||||
static override styles = css`
|
||||
@@ -9,6 +10,10 @@ export class TooltipContentWithShortcut extends LitElement {
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.tooltip__shortcuts {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
}
|
||||
.tooltip__shortcut {
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
@@ -28,19 +33,30 @@ export class TooltipContentWithShortcut extends LitElement {
|
||||
opacity: 0.2;
|
||||
}
|
||||
.tooltip__label {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
white-space: pre;
|
||||
}
|
||||
`;
|
||||
|
||||
get shortcuts() {
|
||||
let shortcut = this.shortcut;
|
||||
if (!shortcut) return [];
|
||||
return shortcut.split(' ');
|
||||
}
|
||||
|
||||
override render() {
|
||||
const { tip, shortcut, postfix } = this;
|
||||
const { tip, shortcuts, postfix } = this;
|
||||
|
||||
return html`
|
||||
<div class="tooltip-with-shortcut">
|
||||
<span class="tooltip__label">${tip}</span>
|
||||
${shortcut
|
||||
? html`<span class="tooltip__shortcut">${shortcut}</span>`
|
||||
: ''}
|
||||
<div class="tooltip__shortcuts">
|
||||
${repeat(
|
||||
shortcuts,
|
||||
shortcut => html`<span class="tooltip__shortcut">${shortcut}</span>`
|
||||
)}
|
||||
</div>
|
||||
${postfix ? html`<span class="tooltip__postfix">${postfix}</span>` : ''}
|
||||
</div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user