Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set bookmarks' default shortcut to an unused value, #200

Merged
merged 2 commits into from
May 21, 2024

Conversation

DrJKL
Copy link
Contributor

@DrJKL DrJKL commented Apr 17, 2024

At least for the first 36...

Duplicates the shortcutKey getter in #198

@DrJKL
Copy link
Contributor Author

DrJKL commented Apr 17, 2024

bookmark_increment.mp4

@DrJKL
Copy link
Contributor Author

DrJKL commented Apr 17, 2024

Note: Doesn't handle cloning yet. Might be worth adding onCloned to the base node to allow for that.

return usedShortcuts;
}

const SHORTCUT_DEFAULTS = `1234567890abcdefghijklmnopqrstuvwxyz`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use regular quotes and split this upfront in the const:

const SHORTCUT_DEFAULTS = "1234567890abcdefghijklmnopqrstuvwxyz".split("");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :-)


function getNextShortcut() {
const existingShortcuts = getExistingShortcuts();
for (const char of SHORTCUT_DEFAULTS.split('')) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can use find:

return SHORTCUT_DEFAULTS.find((char) => !existingShortcuts.has(char)) ?? '1';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :-)

@rgthree
Copy link
Owner

rgthree commented Apr 20, 2024

Nice!

@DrJKL
Copy link
Contributor Author

DrJKL commented Apr 21, 2024

Rebased to include the other change.

@DrJKL DrJKL requested a review from rgthree May 7, 2024 01:25
@DrJKL DrJKL force-pushed the drjkl/bookmark-increment branch from bcbd1c7 to f25a161 Compare May 7, 2024 02:30
@DrJKL DrJKL force-pushed the drjkl/bookmark-increment branch from f25a161 to 738441a Compare May 20, 2024 19:52
@DrJKL
Copy link
Contributor Author

DrJKL commented May 20, 2024

Updated with the recent changes.

@rgthree rgthree merged commit aa9f29f into rgthree:main May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants