Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@types/mozilla-readability": "^0.2.0",
"@types/turndown": "^5.0.1"
},
"version": "1.7.2",
"version": "1.7.3",
"samepage": {
"extends": "node_modules/roamjs-components/package.json"
}
Expand Down
24 changes: 7 additions & 17 deletions src/features/jumpNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,22 +478,12 @@ const toggleQueries = () =>
.forEach((element) => {
element.click();
});
const addShortcutToLeftSidebar = () => {
const previousElement = document.activeElement as HTMLElement;
const emptyShortcuts = document.getElementsByClassName(
"bp3-button bp3-icon-star-empty"
) as HTMLCollectionOf<HTMLSpanElement>;
const shortcuts = document.getElementsByClassName(
"bp3-button bp3-icon-star"
) as HTMLCollectionOf<HTMLSpanElement>;
if (emptyShortcuts.length) {
emptyShortcuts[0].click();
previousElement?.focus();
} else if (shortcuts.length) {
shortcuts[0]?.click();
previousElement?.focus();
}
};
const addShortcutToLeftSidebar = () =>
getCurrentPageUid().then((uid) =>
window.roamAlphaAPI.data.page
// @ts-expect-error - addShortcut is not yet in roamjs-components types
.addShortcut(uid, 0)
);
const pasteBlockWithChildrenAsReferences = () => {
const uid = window.roamAlphaAPI.ui.getFocusedBlock()?.["block-uid"];
if (uid) {
Expand Down Expand Up @@ -630,7 +620,7 @@ const commands = [
{ label: "Collapse all blocks on page", callback: collapseAllBlocksOnPage },
{ label: "Open this page in sidebar", callback: openPageInSidebar },
{
label: "Add shortcut to page to left sidebar",
label: "Add current page to shortcuts",
callback: addShortcutToLeftSidebar,
},
{ label: "Toggle Linked Refs", callback: toggleLinkedRefs },
Expand Down