mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(web_view): open externally from note preview
This commit is contained in:
parent
cda8fc7146
commit
1dfe27d3df
@ -65,6 +65,9 @@ async function getRenderedContent(this: {} | { ctx: string }, entity: FNote | FA
|
|||||||
|
|
||||||
$renderedContent.append($("<div>").append("<div>This note is protected and to access it you need to enter password.</div>").append("<br/>").append($button));
|
$renderedContent.append($("<div>").append("<div>This note is protected and to access it you need to enter password.</div>").append("<br/>").append($button));
|
||||||
} else if (entity instanceof FNote) {
|
} else if (entity instanceof FNote) {
|
||||||
|
$renderedContent
|
||||||
|
.css("display", "flex")
|
||||||
|
.css("flex-direction", "column");
|
||||||
$renderedContent.append(
|
$renderedContent.append(
|
||||||
$("<div>")
|
$("<div>")
|
||||||
.css("display", "flex")
|
.css("display", "flex")
|
||||||
@ -72,8 +75,33 @@ async function getRenderedContent(this: {} | { ctx: string }, entity: FNote | FA
|
|||||||
.css("align-items", "center")
|
.css("align-items", "center")
|
||||||
.css("height", "100%")
|
.css("height", "100%")
|
||||||
.css("font-size", "500%")
|
.css("font-size", "500%")
|
||||||
|
.css("flex-grow", "1")
|
||||||
.append($("<span>").addClass(entity.getIcon()))
|
.append($("<span>").addClass(entity.getIcon()))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (entity.type === "webView" && entity.hasLabel("webViewSrc")) {
|
||||||
|
const $footer = $("<footer>")
|
||||||
|
.addClass("webview-footer");
|
||||||
|
const $openButton = $(`
|
||||||
|
<button class="file-open btn btn-primary" type="button">
|
||||||
|
<span class="bx bx-link-external"></span>
|
||||||
|
${t("content_renderer.open_externally")}
|
||||||
|
</button>
|
||||||
|
`)
|
||||||
|
.appendTo($footer)
|
||||||
|
.on("click", () => {
|
||||||
|
const webViewSrc = entity.getLabelValue("webViewSrc");
|
||||||
|
if (webViewSrc) {
|
||||||
|
if (utils.isElectron()) {
|
||||||
|
const electron = utils.dynamicRequire("electron");
|
||||||
|
electron.shell.openExternal(webViewSrc);
|
||||||
|
} else {
|
||||||
|
window.open(webViewSrc, '_blank', 'noopener,noreferrer');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$footer.appendTo($renderedContent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof FNote) {
|
if (entity instanceof FNote) {
|
||||||
|
@ -1937,12 +1937,14 @@ body.zen .note-title-widget input {
|
|||||||
|
|
||||||
/* Content renderer */
|
/* Content renderer */
|
||||||
|
|
||||||
footer.file-footer {
|
footer.file-footer,
|
||||||
|
footer.webview-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer.file-footer button {
|
footer.file-footer button,
|
||||||
|
footer.webview-footer button {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2002,5 +2002,8 @@
|
|||||||
"search_history_description": "View previous searches",
|
"search_history_description": "View previous searches",
|
||||||
"configure_launch_bar_title": "Configure Launch Bar",
|
"configure_launch_bar_title": "Configure Launch Bar",
|
||||||
"configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
|
"configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
|
||||||
|
},
|
||||||
|
"content_renderer": {
|
||||||
|
"open_externally": "Open externally"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user