mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-28 05:42:28 +00:00
Fixed broken favourites in code editor
This commit is contained in:
parent
8594656f6e
commit
cd32597d4d
1 changed files with 7 additions and 2 deletions
|
@ -74,8 +74,13 @@ export class CodeEditor extends Component {
|
|||
|
||||
onChildEvent(button.parentElement, '.lang-option-favorite-toggle', 'click', () => {
|
||||
isFavorite = !isFavorite;
|
||||
const action = isFavorite ? this.favourites.add : this.favourites.delete;
|
||||
action(language);
|
||||
|
||||
if (isFavorite) {
|
||||
this.favourites.add(language);
|
||||
} else {
|
||||
this.favourites.delete(language);
|
||||
}
|
||||
|
||||
button.setAttribute('data-favourite', isFavorite ? 'true' : 'false');
|
||||
|
||||
window.$http.patch('/preferences/update-code-language-favourite', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue