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