From 65a20a9fc43a20664e7d90de5d266ec134f9020a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 22 Dec 2019 14:45:26 +0900 Subject: Enable addon on blacklisted sites --- src/content/controllers/SettingController.ts | 4 ++-- src/content/usecases/KeymapUseCase.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/content') diff --git a/src/content/controllers/SettingController.ts b/src/content/controllers/SettingController.ts index 9124188..2d32c09 100644 --- a/src/content/controllers/SettingController.ts +++ b/src/content/controllers/SettingController.ts @@ -18,9 +18,9 @@ export default class SettingController { const url = new URL(window.location.href); const disabled = current.blacklist.includesEntireBlacklist(url); if (disabled) { - this.addonEnabledUseCase.disable(); + await this.addonEnabledUseCase.disable(); } else { - this.addonEnabledUseCase.enable(); + await this.addonEnabledUseCase.enable(); } } catch (e) { // Sometime sendMessage fails when background script is not ready. diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts index 074de72..7aa7e92 100644 --- a/src/content/usecases/KeymapUseCase.ts +++ b/src/content/usecases/KeymapUseCase.ts @@ -39,16 +39,16 @@ export default class KeymapUseCase { nextOps(key: Key): { repeat: number, op: operations.Operation } | null { const sequence = this.repository.enqueueKey(key); const baseSequence = sequence.trimNumericPrefix(); + const keymaps = this.keymapEntityMap(); + const matched = keymaps.filter(([seq]) => seq.startsWith(sequence)); + const baseMatched = keymaps.filter(([seq]) => seq.startsWith(baseSequence)); + if (baseSequence.length() === 1 && this.blacklistKey(key)) { // ignore if the input starts with black list keys this.repository.clear(); return null; } - const keymaps = this.keymapEntityMap(); - const matched = keymaps.filter(([seq]) => seq.startsWith(sequence)); - const baseMatched = keymaps.filter(([seq]) => seq.startsWith(baseSequence)); - if (matched.length === 1 && sequence.length() === matched[0][0].length()) { // keys are matched with an operation -- cgit v1.2.3