Migrate QR editor preferences to accountStorage
| @@ -10,6 +10,7 @@ import { SlashCommandExecutor } from '../../../slash-commands/SlashCommandExecut | ||
| 10 | 10 | import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js'; |
| 11 | 11 | import { SlashCommandParserError } from '../../../slash-commands/SlashCommandParserError.js'; |
| 12 | 12 | import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js'; |
| 13 | +import { accountStorage } from '../../../util/AccountStorage.js'; | |
| 13 | 14 | import { debounce, delay, getSortableDelay, showFontAwesomePicker } from '../../../utils.js'; |
| 14 | 15 | import { log, quickReplyApi, warn } from '../index.js'; |
| 15 | 16 | import { QuickReplyContextLink } from './QuickReplyContextLink.js'; |
| @@ -544,9 +545,9 @@ export class QuickReply { | ||
| 544 | 545 | this.editorSyntax = messageSyntaxInner; |
| 545 | 546 | /**@type {HTMLInputElement}*/ |
| 546 | 547 | const wrap = dom.querySelector('#qr--modal-wrap'); |
| 547 | 548 | wrap.checked = JSON.parse(localStorageaccountStorage.getItem('qr--wrap') ?? 'false'); |
| 548 | 549 | wrap.addEventListener('click', () => { |
| 549 | 550 | localStorageaccountStorage.setItem('qr--wrap', JSON.stringify(wrap.checked)); |
| 550 | 551 | updateWrap(); |
| 551 | 552 | }); |
| 552 | 553 | const updateWrap = () => { |
| @@ -594,27 +595,27 @@ export class QuickReply { | ||
| 594 | 595 | }; |
| 595 | 596 | /**@type {HTMLInputElement}*/ |
| 596 | 597 | const tabSize = dom.querySelector('#qr--modal-tabSize'); |
| 597 | 598 | tabSize.value = JSON.parse(localStorageaccountStorage.getItem('qr--tabSize') ?? '4'); |
| 598 | 599 | const updateTabSize = () => { |
| 599 | 600 | message.style.tabSize = tabSize.value; |
| 600 | 601 | messageSyntaxInner.style.tabSize = tabSize.value; |
| 601 | 602 | updateScrollDebounced(); |
| 602 | 603 | }; |
| 603 | 604 | tabSize.addEventListener('change', () => { |
| 604 | 605 | localStorageaccountStorage.setItem('qr--tabSize', JSON.stringify(Number(tabSize.value))); |
| 605 | 606 | updateTabSize(); |
| 606 | 607 | }); |
| 607 | 608 | /**@type {HTMLInputElement}*/ |
| 608 | 609 | const executeShortcut = dom.querySelector('#qr--modal-executeShortcut'); |
| 609 | 610 | executeShortcut.checked = JSON.parse(localStorageaccountStorage.getItem('qr--executeShortcut') ?? 'true'); |
| 610 | 611 | executeShortcut.addEventListener('click', () => { |
| 611 | 612 | localStorageaccountStorage.setItem('qr--executeShortcut', JSON.stringify(executeShortcut.checked)); |
| 612 | 613 | }); |
| 613 | 614 | /**@type {HTMLInputElement}*/ |
| 614 | 615 | const syntax = dom.querySelector('#qr--modal-syntax'); |
| 615 | 616 | syntax.checked = JSON.parse(localStorageaccountStorage.getItem('qr--syntax') ?? 'true'); |
| 616 | 617 | syntax.addEventListener('click', () => { |
| 617 | 618 | localStorageaccountStorage.setItem('qr--syntax', JSON.stringify(syntax.checked)); |
| 618 | 619 | updateSyntaxEnabled(); |
| 619 | 620 | }); |
| 620 | 621 | if (navigator.keyboard) { |
| @@ -21,6 +21,10 @@ const MIGRATABLE_KEYS = [ | ||
| 21 | 21 | /^Personas_PerPage$/, |
| 22 | 22 | /^Personas_GridView$/, |
| 23 | 23 | /^Proxy_SkipConfirm_/, |
| 24 | + /^qr--executeShortcut$/, | |
| 25 | + /^qr--syntax$/, | |
| 26 | + /^qr--tabSize$/, | |
| 27 | + /^qr--wrap$/, | |
| 24 | 28 | /^RegenerateWithCtrlEnter$/, |
| 25 | 29 | /^SelectedNavTab$/, |
| 26 | 30 | /^sendAsNamelessWarningShown$/, |