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

Implement hashmark link support for openCellAsUrl in calls to HYPERLINK #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jparoz
Copy link
Contributor

@jparoz jparoz commented Jan 3, 2024

If the URL argument to a call to HYPERLINK begins with a hash (#), then change the current page's hash to equal the given hash; otherwise open the link in a new tab as normal.

I changed the regex (used for functionMatch) to be more permissive, because the link_label argument to HYPERLINK is optional. This is a bug, which causes the behaviour shown in #34 (should have opened the sheet in a new tab, with the new hash); but also caused links with any label other than a string literal (i.e. any links with indirect references) to not be openable with the ;o action.
Possibly the regex is now too permissive, as it will work on some malformed formulae; but this seems like a small issue or non-issue to me.

Also, I'm not 100% sure why I have to call this.commitCellChanges() twice? I haven't read that function in great detail though, and it's probable that it's dependent on some state which is changed by assigning window.location.hash = functionMatch[1] above. The extra call should probably be removable with some further investigation.

Fixes #34

If the URL argument to a call to HYPERLINK begins with a hash (`#`),
then change the current page's hash to equal the given hash;
otherwise open the link in a new tab as normal.
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.

"Open link" command should work with hashmark links
1 participant