mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
Merge remote-tracking branch 'origin/develop' into feature/client_typescript_port1
; Conflicts: ; package-lock.json ; package.json ; src/public/app/components/app_context.ts ; src/public/app/services/hoisted_note.ts ; src/public/app/services/open.ts ; src/public/app/services/toast.ts
This commit is contained in:
@@ -87,6 +87,9 @@ function now() {
|
||||
return formatTimeWithSeconds(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the client is currently running under Electron, or `false` if running in a web browser.
|
||||
*/
|
||||
function isElectron() {
|
||||
return !!(window && window.process && window.process.type);
|
||||
}
|
||||
@@ -201,7 +204,7 @@ function getMimeTypeClass(mime: string) {
|
||||
|
||||
function closeActiveDialog() {
|
||||
if (glob.activeDialog) {
|
||||
glob.activeDialog.modal('hide');
|
||||
bootstrap.Modal.getOrCreateInstance(glob.activeDialog).hide();
|
||||
glob.activeDialog = null;
|
||||
}
|
||||
}
|
||||
@@ -245,8 +248,7 @@ async function openDialog($dialog: JQuery<HTMLElement>, closeActDialog = true) {
|
||||
}
|
||||
|
||||
saveFocusedElement();
|
||||
|
||||
$dialog.modal();
|
||||
bootstrap.Modal.getOrCreateInstance($dialog).show();
|
||||
|
||||
$dialog.on('hidden.bs.modal', () => {
|
||||
$(".aa-input").autocomplete("close");
|
||||
@@ -335,7 +337,7 @@ function initHelpDropdown($el: JQuery<HTMLElement>) {
|
||||
initHelpButtons($dropdownMenu);
|
||||
}
|
||||
|
||||
const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";
|
||||
const wikiBaseUrl = "https://triliumnext.github.io/Docs/Wiki/";
|
||||
|
||||
function openHelp($button: JQuery<HTMLElement>) {
|
||||
const helpPage = $button.attr("data-help-page");
|
||||
@@ -512,6 +514,26 @@ function createImageSrcUrl(note: { noteId: string; title: string }) {
|
||||
return `api/images/${note.noteId}/${encodeURIComponent(note.title)}?timestamp=${Date.now()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string representation of an SVG, triggers a download of the file on the client device.
|
||||
*
|
||||
* @param {string} nameWithoutExtension the name of the file. The .svg suffix is automatically added to it.
|
||||
* @param {string} svgContent the content of the SVG file download.
|
||||
*/
|
||||
function downloadSvg(nameWithoutExtension, svgContent) {
|
||||
const filename = `${nameWithoutExtension}.svg`;
|
||||
const element = document.createElement('a');
|
||||
element.setAttribute('href', `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgContent)}`);
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
export default {
|
||||
reloadFrontendApp,
|
||||
parseDate,
|
||||
@@ -551,5 +573,6 @@ export default {
|
||||
escapeRegExp,
|
||||
areObjectsEqual,
|
||||
copyHtmlToClipboard,
|
||||
createImageSrcUrl
|
||||
createImageSrcUrl,
|
||||
downloadSvg
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user