-
Notifications
You must be signed in to change notification settings - Fork 1
The anchor Element
The anchor element can be clicked by the user. When it is clicked, it navigates to href
.
href
: A hyper reference, aka URL
This link will navigate to google.com when it is clicked.
<a href = "google.com"></a>
"a": {
"color": "blue",
"cursor": "pointer",
# "text-decoration": "underline"
}
a:visited {
color: purple
}
click
: Pushes the href
attribute onto the Navigator
if given
auxclick
: Same as click
def on_click(self):
if href := self.attrs.get("href"):
Navigator.push(href)
else:
log_error("Anchor without href clicked")
The Element will get a custom context menu. The content is not determined yet, but should be configurable by the user by setting some attribute of the positron.Element.AnchorElement
class.
For this, a Draggable API needs to be designed first.
The linked document will be downloaded instead of being navigated to. The options of what happens are:
- The file is downloaded and the default file explorer will just open up at the location of the already saved file.
- Or it could open a save dialogue and suggest the filename given by the download attribute or derived from the
href
.
The link is disabled, its default color becomes more of a gray instead of blue, the anchor element generally behaves more like a "normal" element, has no drag, no pointer cursor and has no default click behavior. The context menu is also the default context menu.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-type