diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-05-09 06:16:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 06:16:16 +0000 |
commit | 479efbdb4116a13d27f0ac7e8abb3ef86bdd6273 (patch) | |
tree | 84c7c8713cb5b2d8846f4d7d6a10a0003ac73577 /src/background/operators/impls | |
parent | 93af58dae4e19b8e0024fd593d1feb1e4459e2ad (diff) | |
parent | 410189d7499886b1ac5d8e12a4fe76863cc28934 (diff) |
Merge pull request #1145 from ueokande/toggle-reader-mode
Toggle reader view
Diffstat (limited to 'src/background/operators/impls')
-rw-r--r-- | src/background/operators/impls/TabOperatorFactoryChain.ts | 3 | ||||
-rw-r--r-- | src/background/operators/impls/ToggleReaderOperator.ts | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/background/operators/impls/TabOperatorFactoryChain.ts b/src/background/operators/impls/TabOperatorFactoryChain.ts index edd3eaf..d526f86 100644 --- a/src/background/operators/impls/TabOperatorFactoryChain.ts +++ b/src/background/operators/impls/TabOperatorFactoryChain.ts @@ -16,6 +16,7 @@ import PinTabOperator from "./PinTabOperator"; import UnpinTabOperator from "./UnpinTabOperator"; import TogglePinnedTabOperator from "./TogglePinnedTabOperator"; import DuplicateTabOperator from "./DuplicateTabOperator"; +import ToggleReaderOperator from "./ToggleReaderOperator"; @injectable() export default class TabOperatorFactoryChain implements OperatorFactoryChain { @@ -58,6 +59,8 @@ export default class TabOperatorFactoryChain implements OperatorFactoryChain { return new TogglePinnedTabOperator(this.tabPresenter); case operations.TAB_DUPLICATE: return new DuplicateTabOperator(this.tabPresenter); + case operations.TAB_TOGGLE_READER: + return new ToggleReaderOperator(this.tabPresenter); } return null; } diff --git a/src/background/operators/impls/ToggleReaderOperator.ts b/src/background/operators/impls/ToggleReaderOperator.ts new file mode 100644 index 0000000..681e4c3 --- /dev/null +++ b/src/background/operators/impls/ToggleReaderOperator.ts @@ -0,0 +1,11 @@ +import Operator from "../Operator"; +import TabPresenter from "../../presenters/TabPresenter"; + +export default class ToggleReaderOperator implements Operator { + constructor(private readonly tabPresenter: TabPresenter) {} + + async run(): Promise<void> { + const tab = await this.tabPresenter.getCurrent(); + return this.tabPresenter.toggleReaderMode(tab.id as number); + } +} |