Skip to content

Commit

Permalink
version convenience launcher methods
Browse files Browse the repository at this point in the history
  • Loading branch information
egonSchiele committed Aug 12, 2023
1 parent d8ba7bd commit 1c9786d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/components/LibraryLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <WrenchIcon className="h-4 w-4" aria-hidden="true" />,
});

launchItems.push({
label: "Switch To Other Version",
onClick: async () => {
dispatch(
librarySlice.actions.switchVersion({
index: state.editor.activeTextIndex,
versionid: currentTextBlock.versions![0].id,
})
);
},
icon: <WrenchIcon className="h-4 w-4" aria-hidden="true" />,
});
}

/* if (settings.admin) {
launchItems.push({
label: state.recording ? "Stop Recording" : "Start Recording",
Expand Down

0 comments on commit 1c9786d

Please sign in to comment.