mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-16 17:38:18 +08:00
Fixed broken favourites in code editor
This commit is contained in:
@ -74,8 +74,13 @@ export class CodeEditor extends Component {
|
|||||||
|
|
||||||
onChildEvent(button.parentElement, '.lang-option-favorite-toggle', 'click', () => {
|
onChildEvent(button.parentElement, '.lang-option-favorite-toggle', 'click', () => {
|
||||||
isFavorite = !isFavorite;
|
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');
|
button.setAttribute('data-favourite', isFavorite ? 'true' : 'false');
|
||||||
|
|
||||||
window.$http.patch('/preferences/update-code-language-favourite', {
|
window.$http.patch('/preferences/update-code-language-favourite', {
|
||||||
|
Reference in New Issue
Block a user