mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Replace pin icon with lock icon
Credit goes out to @kleinerpirat
This commit is contained in:
parent
ebf423bc9c
commit
da0317cb85
3 changed files with 17 additions and 10 deletions
|
@ -477,7 +477,10 @@ class Editor:
|
||||||
ord = int(num)
|
ord = int(num)
|
||||||
|
|
||||||
fld = self.note.model()["flds"][ord]
|
fld = self.note.model()["flds"][ord]
|
||||||
fld["sticky"] = not fld["sticky"]
|
new_state = not fld["sticky"]
|
||||||
|
fld["sticky"] = new_state
|
||||||
|
|
||||||
|
return new_state
|
||||||
|
|
||||||
def mungeHTML(self, txt: str) -> str:
|
def mungeHTML(self, txt: str) -> str:
|
||||||
return gui_hooks.editor_will_munge_html(txt, self)
|
return gui_hooks.editor_will_munge_html(txt, self)
|
||||||
|
|
|
@ -143,8 +143,4 @@ button.highlighted {
|
||||||
.nightMode & {
|
.nightMode & {
|
||||||
color: var(--bs-light);
|
color: var(--bs-light);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.is-active {
|
|
||||||
color: var(--bs-danger);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ export class LabelContainer extends HTMLDivElement {
|
||||||
this.className = "d-flex";
|
this.className = "d-flex";
|
||||||
|
|
||||||
this.sticky = document.createElement("span");
|
this.sticky = document.createElement("span");
|
||||||
this.sticky.className = "bi bi-pin-angle-fill me-1 sticky-icon";
|
this.sticky.className = "bi me-1 sticky-icon";
|
||||||
this.sticky.hidden = true;
|
this.sticky.hidden = true;
|
||||||
this.appendChild(this.sticky);
|
this.appendChild(this.sticky);
|
||||||
|
|
||||||
|
@ -32,14 +32,22 @@ export class LabelContainer extends HTMLDivElement {
|
||||||
this.label.innerText = labelName;
|
this.label.innerText = labelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSticky(state: boolean): void {
|
||||||
|
this.sticky.classList.toggle("bi-lock-fill", state);
|
||||||
|
this.sticky.classList.toggle("bi-unlock-fill", !state);
|
||||||
|
}
|
||||||
|
|
||||||
activateSticky(initialState: boolean): void {
|
activateSticky(initialState: boolean): void {
|
||||||
this.sticky.classList.toggle("is-active", initialState);
|
this.setSticky(initialState);
|
||||||
this.sticky.hidden = false;
|
this.sticky.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSticky(): void {
|
toggleSticky(): void {
|
||||||
bridgeCommand(`toggleSticky:${this.getAttribute("ord")}`, () => {
|
bridgeCommand(
|
||||||
this.sticky.classList.toggle("is-active");
|
`toggleSticky:${this.getAttribute("ord")}`,
|
||||||
});
|
(newState: boolean): void => {
|
||||||
|
this.setSticky(newState);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue