From 1c9786d8422e20ce820c50705b1d81507f5bbf96 Mon Sep 17 00:00:00 2001 From: Aditya Bhargava Date: Sat, 12 Aug 2023 11:08:56 -0500 Subject: [PATCH] version convenience launcher methods --- src/components/LibraryLauncher.tsx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/components/LibraryLauncher.tsx b/src/components/LibraryLauncher.tsx index 219cca5..715a0eb 100644 --- a/src/components/LibraryLauncher.tsx +++ b/src/components/LibraryLauncher.tsx @@ -880,6 +880,33 @@ export default function LibraryLauncher({ onLauncherClose }) { }); } + if (currentTextBlock.versions && currentTextBlock.versions.length === 1) { + launchItems.push({ + label: "Diff With Version", + onClick: async () => { + const originalText = currentTextBlock.text; + const newText = currentTextBlock.versions![0].text; + const textForDiff = { originalText, newText }; + dispatch(librarySlice.actions.setTextForDiff(textForDiff)); + dispatch(librarySlice.actions.setViewMode("diff")); + }, + icon: