UI: Hyperlink dialog follows the selection

Insert Hyperlink opened on https:// with an empty ScreenTip, so OK
replaced a web address, email, slide link or tip. The dialog now
starts from the link it would edit, and leaves actions it cannot
edit in place.
This commit is contained in:
Nikita Rakitin
2026-10-14 05:40:06 +03:00
parent 457406a7a5
commit 8c0147cfa7
6 changed files with 363 additions and 19 deletions
+2 -2
View File
@@ -54,7 +54,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Link",
["Insert", "Links"],
Some("Cmd+K"),
"{url? | slide?: index, tooltip?, text?: shown when nothing is selected, ids?}",
"{url? | slide?: index, tooltip?, text?: shown when nothing is selected, highlightClick?, ids?}",
has_text_or_shapes,
hyperlink
),
@@ -589,7 +589,7 @@ fn hyperlink(s: &mut Session, p: &Value) -> Result<Value> {
return Err(bad("insert.hyperlink", "missing `url` or `slide`"));
};
let display = str_param(p, "text").map_or(display, str::to_string);
let link = Hyperlink { action, tooltip: str_param(p, "tooltip").unwrap_or("").to_string(), highlight_click: false };
let link = Hyperlink { action, tooltip: str_param(p, "tooltip").unwrap_or("").to_string(), highlight_click: bool_or(p, "highlightClick", false) };
if s.doc()?.selection.text.is_some() {
return super::text::link_text(s, link, &display);
}