Implement hashmark link support for openCellAsUrl
in calls to HYPERLINK
#49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thelink_label
argument toHYPERLINK
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 assigningwindow.location.hash = functionMatch[1]
above. The extra call should probably be removable with some further investigation.Fixes #34