break;
}
- case LFUN_URL_INSERT: {
- InsetCommandParams p("url");
+ case LFUN_HYPERLINK_INSERT: {
+ InsetCommandParams p("href");
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
}
p["target"] = (cmd.argument().empty()) ?
content : cmd.argument();
- string const data = InsetCommandMailer::params2string("url", p);
+ string const data = InsetCommandMailer::params2string("href", p);
if (p["target"].empty()) {
- bv->showInsetDialog("url", data, 0);
- } else {
- FuncRequest fr(LFUN_INSET_INSERT, data);
- dispatch(cur, fr);
- }
- break;
- }
-
- case LFUN_HTML_INSERT: {
- InsetCommandParams p("htmlurl");
- docstring content;
- if (cur.selection()) {
- content = cur.selectionAsString(false);
- cutSelection(cur, true, false);
- }
- p["target"] = (cmd.argument().empty()) ?
- content : cmd.argument();
- string const data = InsetCommandMailer::params2string("url", p);
- if (p["target"].empty()) {
- bv->showInsetDialog("url", data, 0);
+ bv->showInsetDialog("href", data, 0);
} else {
FuncRequest fr(LFUN_INSET_INSERT, data);
dispatch(cur, fr);
}
case LFUN_INFO_INSERT: {
- if (!cur.selection())
- break;
Inset * inset = createInset(&cur.bv(), cmd);
if (!inset)
break;
- // use selected text as info to avoid a separate UI
- docstring ds = cur.selectionAsString(false);
- cutSelection(cur, true, false);
+ // if an empty inset is created (cmd.argument() is empty)
+ // use current selection as parameter.
+ if (cmd.argument().empty() && cur.selection()) {
+ // use selected text as info to avoid a separate UI
+ docstring ds = cur.selectionAsString(false);
+ cutSelection(cur, true, false);
+ static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
+ }
insertInset(cur, inset);
- static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
cur.posRight();
break;
}
code = FLOAT_CODE;
else if (cmd.argument() == "graphics")
code = GRAPHICS_CODE;
+ else if (cmd.argument() == "href")
+ code = HYPERLINK_CODE;
else if (cmd.argument() == "include")
code = INCLUDE_CODE;
else if (cmd.argument() == "index")
code = REF_CODE;
else if (cmd.argument() == "toc")
code = TOC_CODE;
- else if (cmd.argument() == "url")
- code = URL_CODE;
else if (cmd.argument() == "vspace")
code = VSPACE_CODE;
else if (cmd.argument() == "wrap")
case LFUN_TOC_INSERT:
code = TOC_CODE;
break;
- case LFUN_HTML_INSERT:
- case LFUN_URL_INSERT:
- code = URL_CODE;
+ case LFUN_HYPERLINK_INSERT:
+ code = HYPERLINK_CODE;
break;
case LFUN_QUOTE_INSERT:
// always allow this, since we will inset a raw quote