Compare commits
5 Commits
feat/extra
...
feature/pd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
869e0b3973 | ||
|
|
b68613dee4 | ||
|
|
ce0f32e7d5 | ||
|
|
78bc9b59c2 | ||
|
|
23cf3d2923 |
@@ -382,7 +382,8 @@ export type CommandMappings = {
|
||||
reloadTextEditor: CommandData;
|
||||
chooseNoteType: CommandData & {
|
||||
callback: ChooseNoteTypeCallback
|
||||
}
|
||||
};
|
||||
customDownload: CommandData;
|
||||
};
|
||||
|
||||
type EventMappings = {
|
||||
@@ -540,7 +541,6 @@ export type FilteredCommandNames<T extends CommandData> = keyof Pick<CommandMapp
|
||||
|
||||
export class AppContext extends Component {
|
||||
isMainWindow: boolean;
|
||||
windowId: string;
|
||||
components: Component[];
|
||||
beforeUnloadListeners: (WeakRef<BeforeUploadListener> | (() => boolean))[];
|
||||
tabManager!: TabManager;
|
||||
@@ -549,11 +549,10 @@ export class AppContext extends Component {
|
||||
|
||||
lastSearchString?: string;
|
||||
|
||||
constructor(isMainWindow: boolean, windowId: string) {
|
||||
constructor(isMainWindow: boolean) {
|
||||
super();
|
||||
|
||||
this.isMainWindow = isMainWindow;
|
||||
this.windowId = windowId;
|
||||
// non-widget/layout components needed for the application
|
||||
this.components = [];
|
||||
this.beforeUnloadListeners = [];
|
||||
@@ -683,7 +682,8 @@ export class AppContext extends Component {
|
||||
this.beforeUnloadListeners = this.beforeUnloadListeners.filter(l => l !== listener);
|
||||
}
|
||||
}
|
||||
const appContext = new AppContext(window.glob.isMainWindow, window.glob.windowId);
|
||||
|
||||
const appContext = new AppContext(window.glob.isMainWindow);
|
||||
|
||||
// we should save all outstanding changes before the page/app is closed
|
||||
$(window).on("beforeunload", () => {
|
||||
|
||||
@@ -142,15 +142,14 @@ export default class Entrypoints extends Component {
|
||||
}
|
||||
|
||||
async openInWindowCommand({ notePath, hoistedNoteId, viewScope }: NoteCommandData) {
|
||||
const extraWindowId = utils.randomString(4);
|
||||
const extraWindowHash = linkService.calculateHash({ notePath, hoistedNoteId, viewScope });
|
||||
|
||||
if (utils.isElectron()) {
|
||||
const { ipcRenderer } = utils.dynamicRequire("electron");
|
||||
|
||||
ipcRenderer.send("create-extra-window", { extraWindowId, extraWindowHash });
|
||||
ipcRenderer.send("create-extra-window", { extraWindowHash });
|
||||
} else {
|
||||
const url = `${window.location.protocol}//${window.location.host}${window.location.pathname}?extraWindow=${extraWindowId}${extraWindowHash}`;
|
||||
const url = `${window.location.protocol}//${window.location.host}${window.location.pathname}?extraWindow=1${extraWindowHash}`;
|
||||
|
||||
window.open(url, "", "width=1000,height=800");
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import linkService from "../services/link.js";
|
||||
import type { EventData } from "./app_context.js";
|
||||
import type FNote from "../entities/fnote.js";
|
||||
|
||||
const MAX_SAVED_WINDOWS = 10;
|
||||
|
||||
interface TabState {
|
||||
contexts: NoteContext[];
|
||||
position: number;
|
||||
@@ -43,6 +41,9 @@ export default class TabManager extends Component {
|
||||
this.recentlyClosedTabs = [];
|
||||
|
||||
this.tabsUpdate = new SpacedUpdate(async () => {
|
||||
if (!appContext.isMainWindow) {
|
||||
return;
|
||||
}
|
||||
if (options.is("databaseReadonly")) {
|
||||
return;
|
||||
}
|
||||
@@ -51,21 +52,9 @@ export default class TabManager extends Component {
|
||||
.map((nc) => nc.getPojoState())
|
||||
.filter((t) => !!t);
|
||||
|
||||
// Update the current window’s openNoteContexts in options
|
||||
const savedWindows = options.getJson("openNoteContexts") || [];
|
||||
const win = savedWindows.find(w => w.windowId === appContext.windowId);
|
||||
if (win) {
|
||||
win.contexts = openNoteContexts;
|
||||
} else {
|
||||
savedWindows.push({
|
||||
windowId: appContext.windowId,
|
||||
createdAt: Date.now(),
|
||||
closedAt: 0,
|
||||
contexts: openNoteContexts
|
||||
});
|
||||
}
|
||||
|
||||
await options.save("openNoteContexts", JSON.stringify(savedWindows));
|
||||
await server.put("options", {
|
||||
openNoteContexts: JSON.stringify(openNoteContexts)
|
||||
});
|
||||
});
|
||||
|
||||
appContext.addBeforeUnloadListener(this);
|
||||
@@ -80,13 +69,8 @@ export default class TabManager extends Component {
|
||||
}
|
||||
|
||||
async loadTabs() {
|
||||
// Get the current window’s openNoteContexts
|
||||
const savedWindows = options.getJson("openNoteContexts") || [];
|
||||
const currentWin = savedWindows.find(w => w.windowId === appContext.windowId);
|
||||
const openNoteContexts = currentWin ? currentWin.contexts : undefined;
|
||||
|
||||
try {
|
||||
const noteContextsToOpen = openNoteContexts || [];
|
||||
const noteContextsToOpen = (appContext.isMainWindow && options.getJson("openNoteContexts")) || [];
|
||||
|
||||
// preload all notes at once
|
||||
await froca.getNotes([...noteContextsToOpen.flatMap((tab: NoteContextState) =>
|
||||
@@ -135,32 +119,6 @@ export default class TabManager extends Component {
|
||||
}
|
||||
});
|
||||
|
||||
// Save window contents
|
||||
if (currentWin) {
|
||||
currentWin.createdAt = Date.now();
|
||||
currentWin.closedAt = 0;
|
||||
currentWin.contexts = filteredNoteContexts;
|
||||
} else {
|
||||
// Filter out the oldest entry (excluding the main window)
|
||||
if (savedWindows?.length >= MAX_SAVED_WINDOWS) {
|
||||
const candidates = savedWindows.filter(w => w.windowId !== "main");
|
||||
if (candidates.length > 0) {
|
||||
const oldest = candidates.reduce((a, b) =>
|
||||
a.createdAt < b.createdAt ? a : b
|
||||
);
|
||||
savedWindows.splice(savedWindows.indexOf(oldest), 1);
|
||||
}
|
||||
}
|
||||
savedWindows.push({
|
||||
windowId: appContext.windowId,
|
||||
createdAt: Date.now(),
|
||||
closedAt: 0,
|
||||
contexts: filteredNoteContexts
|
||||
});
|
||||
}
|
||||
|
||||
await options.save("openNoteContexts", JSON.stringify(savedWindows));
|
||||
|
||||
// if there's a notePath in the URL, make sure it's open and active
|
||||
// (useful, for e.g., opening clipped notes from clipper or opening link in an extra window)
|
||||
if (parsedFromUrl.notePath) {
|
||||
|
||||
@@ -27,6 +27,10 @@ async function processEntityChanges(entityChanges: EntityChange[]) {
|
||||
loadResults.addRevision(ec.entityId, ec.noteId, ec.componentId);
|
||||
} else if (ec.entityName === "options") {
|
||||
const attributeEntity = ec.entity as FAttributeRow;
|
||||
if (attributeEntity.name === "openNoteContexts") {
|
||||
continue; // only noise
|
||||
}
|
||||
|
||||
options.set(attributeEntity.name as OptionNames, attributeEntity.value);
|
||||
loadResults.addOption(attributeEntity.name as OptionNames);
|
||||
} else if (ec.entityName === "attachments") {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import utils from "./utils.js";
|
||||
import Component from "../components/component.js";
|
||||
import FNote from "../entities/fnote.js";
|
||||
import options from "./options.js";
|
||||
import server from "./server.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
type ExecFunction = (command: string, cb: (err: string, stdout: string, stderror: string) => void) => void;
|
||||
|
||||
@@ -36,9 +38,14 @@ function download(url: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export function downloadFileNote(noteId: string) {
|
||||
const url = `${getFileUrl("notes", noteId)}?${Date.now()}`; // don't use cache
|
||||
export function downloadFileNote(note: FNote, parentComponent: Component | null, ntxId: string | null | undefined) {
|
||||
if (note.type === "file" && note.mime === "application/pdf" && parentComponent) {
|
||||
// Special handling, manages its own downloading process.
|
||||
parentComponent.triggerEvent("customDownload", { ntxId });
|
||||
return;
|
||||
}
|
||||
|
||||
const url = `${getFileUrl("notes", note.noteId)}?${Date.now()}`; // don't use cache
|
||||
download(url);
|
||||
}
|
||||
|
||||
@@ -97,7 +104,7 @@ async function openCustom(type: string, entityId: string, mime: string) {
|
||||
// Note that the path separator must be \ instead of /
|
||||
filePath = filePath.replace(/\//g, "\\");
|
||||
}
|
||||
const command = `rundll32.exe shell32.dll,OpenAs_RunDLL ` + filePath;
|
||||
const command = `rundll32.exe shell32.dll,OpenAs_RunDLL ${ filePath}`;
|
||||
exec(command, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
console.error("Open Note custom: ", err);
|
||||
@@ -131,10 +138,10 @@ export function getUrlForDownload(url: string) {
|
||||
if (utils.isElectron()) {
|
||||
// electron needs absolute URL, so we extract current host, port, protocol
|
||||
return `${getHost()}/${url}`;
|
||||
} else {
|
||||
// web server can be deployed on subdomain, so we need to use a relative path
|
||||
return url;
|
||||
}
|
||||
// web server can be deployed on subdomain, so we need to use a relative path
|
||||
return url;
|
||||
|
||||
}
|
||||
|
||||
function canOpenInBrowser(mime: string) {
|
||||
|
||||
1
apps/client/src/types.d.ts
vendored
@@ -36,7 +36,6 @@ interface CustomGlobals {
|
||||
isProtectedSessionAvailable: boolean;
|
||||
isDev: boolean;
|
||||
isMainWindow: boolean;
|
||||
windowId: string;
|
||||
maxEntityChangeIdAtLoad: number;
|
||||
maxEntityChangeSyncIdAtLoad: number;
|
||||
assetPath: string;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { useContext } from "preact/hooks";
|
||||
|
||||
import FNote from "../../entities/fnote";
|
||||
import { t } from "../../services/i18n";
|
||||
import { downloadFileNote, openNoteExternally } from "../../services/open";
|
||||
@@ -8,11 +10,14 @@ import { formatSize } from "../../services/utils";
|
||||
import Button from "../react/Button";
|
||||
import { FormFileUploadButton } from "../react/FormFileUpload";
|
||||
import { useNoteBlob, useNoteLabel } from "../react/hooks";
|
||||
import { ParentComponent } from "../react/react_utils";
|
||||
import { TabContext } from "./ribbon-interface";
|
||||
|
||||
export default function FilePropertiesTab({ note }: { note?: FNote | null }) {
|
||||
export default function FilePropertiesTab({ note, ntxId }: TabContext) {
|
||||
const [ originalFileName ] = useNoteLabel(note, "originalFileName");
|
||||
const canAccessProtectedNote = !note?.isProtected || protected_session_holder.isProtectedSessionAvailable();
|
||||
const blob = useNoteBlob(note);
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
|
||||
return (
|
||||
<div className="file-properties-widget">
|
||||
@@ -40,7 +45,7 @@ export default function FilePropertiesTab({ note }: { note?: FNote | null }) {
|
||||
text={t("file_properties.download")}
|
||||
primary
|
||||
disabled={!canAccessProtectedNote}
|
||||
onClick={() => downloadFileNote(note.noteId)}
|
||||
onClick={() => downloadFileNote(note, parentComponent, ntxId)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function ImagePropertiesTab({ note, ntxId }: TabContext) {
|
||||
text={t("image_properties.download")}
|
||||
icon="bx bx-download"
|
||||
primary
|
||||
onClick={() => downloadFileNote(note.noteId)}
|
||||
onClick={() => downloadFileNote(note, parentComponent, ntxId)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -135,13 +135,13 @@ function OpenExternallyButton({ note, noteMime }: NoteActionsCustomInnerProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function DownloadFileButton({ note }: NoteActionsCustomInnerProps) {
|
||||
function DownloadFileButton({ note, parentComponent, ntxId }: NoteActionsCustomInnerProps) {
|
||||
return (
|
||||
<ActionButton
|
||||
icon="bx bx-download"
|
||||
text={t("file_properties.download")}
|
||||
disabled={!note.isContentAvailable()}
|
||||
onClick={() => downloadFileNote(note.noteId)}
|
||||
onClick={() => downloadFileNote(note, parentComponent, ntxId)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import FBlob from "../../../entities/fblob";
|
||||
import FNote from "../../../entities/fnote";
|
||||
import server from "../../../services/server";
|
||||
import { useViewModeConfig } from "../../collections/NoteList";
|
||||
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
|
||||
import { useTriliumEvent, useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
|
||||
|
||||
const VARIABLE_WHITELIST = new Set([
|
||||
"root-background",
|
||||
@@ -170,6 +170,13 @@ export default function PdfPreview({ note, blob, componentId, noteContext }: {
|
||||
}
|
||||
}, [ iframeRef.current?.contentWindow, noteContext ]);
|
||||
|
||||
useTriliumEvent("customDownload", ({ ntxId }) => {
|
||||
if (ntxId !== noteContext.ntxId) return;
|
||||
iframeRef.current?.contentWindow?.postMessage({
|
||||
type: "trilium-request-download"
|
||||
});
|
||||
});
|
||||
|
||||
return (historyConfig &&
|
||||
<iframe
|
||||
tabIndex={300}
|
||||
|
||||
|
Before Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 727 B |
|
Before Width: | Height: | Size: 828 B |
|
Before Width: | Height: | Size: 931 B |
|
Before Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 434 B |
|
Before Width: | Height: | Size: 492 B |
@@ -6,8 +6,6 @@ import sqlInit from "@triliumnext/server/src/services/sql_init.js";
|
||||
import windowService from "@triliumnext/server/src/services/window.js";
|
||||
import tray from "@triliumnext/server/src/services/tray.js";
|
||||
import options from "@triliumnext/server/src/services/options.js";
|
||||
import { randomString } from "@triliumnext/server/src/services/utils.js";
|
||||
|
||||
import electronDebug from "electron-debug";
|
||||
import electronDl from "electron-dl";
|
||||
import { PRODUCT_NAME } from "./app-info";
|
||||
@@ -74,8 +72,7 @@ async function main() {
|
||||
app.on("second-instance", (event, commandLine) => {
|
||||
const lastFocusedWindow = windowService.getLastFocusedWindow();
|
||||
if (commandLine.includes("--new-window")) {
|
||||
const extraWindowId = randomString(4);
|
||||
windowService.createExtraWindow(extraWindowId, "");
|
||||
windowService.createExtraWindow("");
|
||||
} else if (lastFocusedWindow) {
|
||||
if (lastFocusedWindow.isMinimized()) {
|
||||
lastFocusedWindow.restore();
|
||||
|
||||
2
apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json
generated
vendored
@@ -4,6 +4,7 @@
|
||||
<figcaption>Screenshot of the note contextual menu indicating the “Export as PDF”
|
||||
option.</figcaption>
|
||||
</figure>
|
||||
|
||||
<h2>Printing</h2>
|
||||
<p>This feature allows printing of notes. It works on both the desktop client,
|
||||
but also on the web.</p>
|
||||
@@ -52,27 +53,18 @@ class="admonition note">
|
||||
the default application might seem incorrect (such as opening in GIMP).
|
||||
This is because it uses Gnome's “Recommended applications” list.</p>
|
||||
<p>To solve this, you can change the recommended application for PDFs via
|
||||
this command line. First, list the available applications via <code spellcheck="false">gio mime application/pdf</code> and
|
||||
this command line. First, list the available applications via <code>gio mime application/pdf</code> and
|
||||
then set the desired one. For example to use GNOME's Evince:</p><pre><code class="language-text-x-trilium-auto">gio mime application/pdf</code></pre>
|
||||
<h3>Customizing exporting as PDF</h3>
|
||||
<p>When exporting to PDF, there are no customizable settings such as page
|
||||
orientation, size. However, there are a few <a class="reference-link"
|
||||
href="#root/_help_zEY4DaJG4YT5">Attributes</a> to adjust some of the settings:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="eec9214505f224e0ef7d50955357f6f52">To print in landscape mode instead of portrait (useful for big diagrams
|
||||
or slides), add <code spellcheck="false">#printLandscape</code>.</li>
|
||||
<li
|
||||
data-list-item-id="ebc1a98e97b39978d0165f0befbf103a9">By default, the resulting PDF will be in Letter format. It is possible
|
||||
to adjust it to another page size via the <code spellcheck="false">#printPageSize</code> attribute,
|
||||
with one of the following values: <code spellcheck="false">A0</code>,
|
||||
<code
|
||||
spellcheck="false">A1</code>, <code spellcheck="false">A2</code>, <code spellcheck="false">A3</code>,
|
||||
<code
|
||||
spellcheck="false">A4</code>, <code spellcheck="false">A5</code>, <code spellcheck="false">A6</code>,
|
||||
<code
|
||||
spellcheck="false">Legal</code>, <code spellcheck="false">Letter</code>, <code spellcheck="false">Tabloid</code>,
|
||||
<code
|
||||
spellcheck="false">Ledger</code>.</li>
|
||||
<li>To print in landscape mode instead of portrait (useful for big diagrams
|
||||
or slides), add <code>#printLandscape</code>.</li>
|
||||
<li>By default, the resulting PDF will be in Letter format. It is possible
|
||||
to adjust it to another page size via the <code>#printPageSize</code> attribute,
|
||||
with one of the following values: <code>A0</code>, <code>A1</code>, <code>A2</code>, <code>A3</code>, <code>A4</code>, <code>A5</code>, <code>A6</code>, <code>Legal</code>, <code>Letter</code>, <code>Tabloid</code>, <code>Ledger</code>.</li>
|
||||
</ul>
|
||||
<aside class="admonition note">
|
||||
<p>These options have no effect when used with the printing feature, since
|
||||
@@ -82,10 +74,9 @@ class="admonition note">
|
||||
<p>Since v0.100.0, it is possible to print more than one note at the time
|
||||
by using <a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="e218b7d45c9a9ce882f16112aec9333be">First create a collection.</li>
|
||||
<li data-list-item-id="e159ed2993b564448ee15f5796bba1d31">Configure it to use <a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>.</li>
|
||||
<li
|
||||
data-list-item-id="ea82f390047ea239e7793145768738b97">Print the collection note normally.</li>
|
||||
<li>First create a collection.</li>
|
||||
<li>Configure it to use <a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>.</li>
|
||||
<li>Print the collection note normally.</li>
|
||||
</ol>
|
||||
<p>The resulting collection will contain all the children of the collection,
|
||||
while maintaining the hierarchy.</p>
|
||||
@@ -102,9 +93,9 @@ class="admonition note">
|
||||
href="#root/_help_4TIF1oA4VQRO">Options</a> and assigning a key combination
|
||||
for:</p>
|
||||
<ul>
|
||||
<li class="ck-list-marker-italic" data-list-item-id="e6b80294fd7a2d5f5d7cbf831691b53c8"><em>Print Active Note</em>
|
||||
<li><em>Print Active Note</em>
|
||||
</li>
|
||||
<li class="ck-list-marker-italic" data-list-item-id="eb2cc694f51e4e25dcf1f814e64523df9"><em>Export Active Note as PDF</em>
|
||||
<li><em>Export Active Note as PDF</em>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Constraints & limitations</h2>
|
||||
@@ -112,44 +103,44 @@ class="admonition note">
|
||||
supported when printing, in which case the <em>Print</em> and <em>Export as PDF</em> options
|
||||
will be disabled.</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e38dd484ec45f9bddf43bb9ecf708d339">For <a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a> notes:
|
||||
<li>For <a class="reference-link" href="#root/_help_6f9hih2hXXZk">Code</a> notes:
|
||||
<ul>
|
||||
<li data-list-item-id="e88456d3f86ed7e8656f60b837bf27f9f">Line numbers are not printed.</li>
|
||||
<li data-list-item-id="e1e5e18b8dedac46c49cc46360b6a444f">Syntax highlighting is enabled, however a default theme (Visual Studio)
|
||||
<li>Line numbers are not printed.</li>
|
||||
<li>Syntax highlighting is enabled, however a default theme (Visual Studio)
|
||||
is enforced.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e025b80306e7f736f3ae08e5693ab522e">For <a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>,
|
||||
<li>For <a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>,
|
||||
the following are supported:
|
||||
<ul>
|
||||
<li data-list-item-id="e3553e19731217829ba704c7bbacf86f4"><a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>, allowing
|
||||
<li><a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>, allowing
|
||||
to print multiple notes at once while preserving hierarchy (similar to
|
||||
a book).</li>
|
||||
<li data-list-item-id="e96cab6a4cb4a18b1fa98d49f40d29496"><a class="reference-link" href="#root/_help_zP3PMqaG71Ct">Presentation</a>,
|
||||
<li><a class="reference-link" href="#root/_help_zP3PMqaG71Ct">Presentation</a>,
|
||||
where each slide/sub-note is displayed.
|
||||
<ul>
|
||||
<li data-list-item-id="ea145a7d22299304fbed7d8acb2cc05a0">Most note types are supported, especially the ones that have an image
|
||||
representation such as <a class="reference-link" href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/_help_grjYqerjn243">Canvas</a> and
|
||||
<li>Most note types are supported, especially the ones that have an image
|
||||
representation such as <a class="reference-link" href="#root/_help_grjYqerjn243">Canvas</a> and
|
||||
<a
|
||||
class="reference-link" href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/_help_gBbsAeiuUxI5">Mind Map</a>.</li>
|
||||
class="reference-link" href="#root/_help_gBbsAeiuUxI5">Mind Map</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e6eecc96905c6fb3d05ab360fbf02c395"><a class="reference-link" href="#root/_help_2FvYrpmOXm29">Table</a>, where the
|
||||
<li><a class="reference-link" href="#root/_help_2FvYrpmOXm29">Table</a>, where the
|
||||
table is rendered in a print-friendly way.
|
||||
<ul>
|
||||
<li data-list-item-id="e44cd46142fff861654387e9b040bb051">Tables that are too complex (especially if they have multiple columns)
|
||||
<li>Tables that are too complex (especially if they have multiple columns)
|
||||
might not fit properly, however tables with a large number of rows are
|
||||
supported thanks to pagination.</li>
|
||||
<li data-list-item-id="edf28072a875e21fc21e18e7ddc0fec26">Consider printing in landscape mode, or using <code spellcheck="false">#printLandscape</code> if
|
||||
<li>Consider printing in landscape mode, or using <code>#printLandscape</code> if
|
||||
exporting to PDF.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e504297e0bafefa23c8c0ba28d67889e8">The rest of the collections are not supported, but we plan to add support
|
||||
<li>The rest of the collections are not supported, but we plan to add support
|
||||
for all the collection types at some point.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="eb2113dc9bd86628162fe2eb47488f5f2">Using <a class="reference-link" href="#root/_help_AlhDUqhENtH7">Custom app-wide CSS</a> for
|
||||
printing is no longer supported, instead a custom <code spellcheck="false">printCss</code> relation
|
||||
<li>Using <a class="reference-link" href="#root/_help_AlhDUqhENtH7">Custom app-wide CSS</a> for
|
||||
printing is no longer supported, instead a custom <code>printCss</code> relation
|
||||
needs to be used (see below).</li>
|
||||
</ul>
|
||||
<h2>Customizing the print CSS</h2>
|
||||
@@ -159,10 +150,10 @@ class="admonition note">
|
||||
printing.</p>
|
||||
<p>To do so:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e3df5625e58cea9d50974335203d99caa">Create a CSS <a href="#root/_help_6f9hih2hXXZk">code note</a>.</li>
|
||||
<li data-list-item-id="e48c1388ee530c6301c75c8136617cf8f">On the note being printed, apply the <code spellcheck="false">~printCss</code> relation
|
||||
to point to the newly created CSS code note.</li>
|
||||
<li data-list-item-id="eaecc4fd4d22747aa15c85c988aab6d79">To apply the CSS to multiple notes, consider using <a href="#root/_help_bwZpz2ajCEwO">inheritable attributes</a> or
|
||||
<li>Create a CSS <a href="#root/_help_6f9hih2hXXZk">code note</a>.</li>
|
||||
<li>On the note being printed, apply the <code>~printCss</code> relation to
|
||||
point to the newly created CSS code note.</li>
|
||||
<li>To apply the CSS to multiple notes, consider using <a href="#root/_help_bwZpz2ajCEwO">inheritable attributes</a> or
|
||||
<a
|
||||
class="reference-link" href="#root/_help_KC1HB96bqqHX">Templates</a>.</li>
|
||||
</ul>
|
||||
@@ -173,23 +164,19 @@ class="admonition note">
|
||||
}</code></pre>
|
||||
<p>To remark:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="ec9cd88d328b97422c11f4b25c1042ed5">Multiple CSS notes can be add by using multiple <code spellcheck="false">~printCss</code> relations.</li>
|
||||
<li
|
||||
data-list-item-id="e5ff782914a559055a1a72dda1be246bd">If the note pointing to the <code spellcheck="false">printCss</code> doesn't
|
||||
have the right note type or mime type, it will be ignored.</li>
|
||||
<li data-list-item-id="eab7b697428ef92d60ab6cd65bda76b69">If migrating from a previous version where <a class="reference-link"
|
||||
href="#root/_help_AlhDUqhENtH7">Custom app-wide CSS</a>, there's no need for
|
||||
<code
|
||||
spellcheck="false">@media print {</code> since the style-sheet is used only for printing.</li>
|
||||
<li>Multiple CSS notes can be add by using multiple <code>~printCss</code> relations.</li>
|
||||
<li>If the note pointing to the <code>printCss</code> doesn't have the right
|
||||
note type or mime type, it will be ignored.</li>
|
||||
<li>If migrating from a previous version where <a class="reference-link"
|
||||
href="#root/_help_AlhDUqhENtH7">Custom app-wide CSS</a>, there's no need for <code>@media print {</code> since
|
||||
the style-sheet is used only for printing.</li>
|
||||
</ul>
|
||||
<h2>Under the hood</h2>
|
||||
<p>Both printing and exporting as PDF use the same mechanism: a note is rendered
|
||||
individually in a separate webpage that is then sent to the browser or
|
||||
the Electron application either for printing or exporting as PDF.</p>
|
||||
<p>The webpage that renders a single note can actually be accessed in a web
|
||||
browser. For example <code spellcheck="false">http://localhost:8080/#root/WWRGzqHUfRln/RRZsE9Al8AIZ?ntxId=0o4fzk</code> becomes
|
||||
<code
|
||||
spellcheck="false">http://localhost:8080/?print#root/WWRGzqHUfRln/RRZsE9Al8AIZ</code>.</p>
|
||||
browser. For example <code>http://localhost:8080/#root/WWRGzqHUfRln/RRZsE9Al8AIZ?ntxId=0o4fzk</code> becomes <code>http://localhost:8080/?print#root/WWRGzqHUfRln/RRZsE9Al8AIZ</code>.</p>
|
||||
<p>Accessing the print note in a web browser allows for easy debugging to
|
||||
understand why a particular note doesn't render well. The mechanism for
|
||||
rendering is similar to the one used in <a class="reference-link"
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
<p>Trilium supports custom user themes, allowing you to personalize the application's
|
||||
appearance. To create a custom theme, follow these steps:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="eca8bbfc636daa344eaabbbb94ea94c3f"><strong>Create a CSS Code Note</strong>: Start by creating a new <a href="#root/_help_6f9hih2hXXZk">code note</a> with
|
||||
the <code spellcheck="false">CSS</code> type.</li>
|
||||
<li data-list-item-id="e5ae35a0ee455e32c200fc095bf8415ac"><strong>Annotate with</strong> <code spellcheck="false">#appTheme</code>:
|
||||
Add the <a href="#root/_help_zEY4DaJG4YT5">attribute</a> <code spellcheck="false">#appTheme=my-theme-name</code> to
|
||||
your note, where <code spellcheck="false">my-theme-name</code> is the name
|
||||
of your custom theme.</li>
|
||||
<li data-list-item-id="e7cd8c79dcf2d9edc2d03c924b9d954e1"><strong>Define Your Styles</strong>: Write your custom CSS within the
|
||||
<li><strong>Create a CSS Code Note</strong>: Start by creating a new <a href="#root/_help_6f9hih2hXXZk">code note</a> with
|
||||
the <code>CSS</code> type.</li>
|
||||
<li><strong>Annotate with</strong> <code>#appTheme</code>: Add the <a href="#root/_help_zEY4DaJG4YT5">attribute</a> <code>#appTheme=my-theme-name</code> to
|
||||
your note, where <code>my-theme-name</code> is the name of your custom theme.</li>
|
||||
<li><strong>Define Your Styles</strong>: Write your custom CSS within the
|
||||
note. Below is an example of a custom theme:</li>
|
||||
</ol><pre><code class="language-text-x-trilium-auto">@font-face {
|
||||
font-family: 'Raleway';
|
||||
@@ -74,20 +72,18 @@ body .CodeMirror {
|
||||
<h3>Activating Your Custom Theme</h3>
|
||||
<p>Once you've created your custom theme:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="ee141db479e6972f78a12a2ece4be4d8f">Go to "Menu" -> "Options" -> "Appearance."</li>
|
||||
<li data-list-item-id="e36a48638934829faceb5b68dececd6c7">In the theme selection dropdown, you should see your custom theme listed
|
||||
under the name you provided with the <code spellcheck="false">#appTheme</code>
|
||||
<a
|
||||
href="#root/_help_zEY4DaJG4YT5">label</a>.</li>
|
||||
<li data-list-item-id="eb7987a455a323d619c83e04a3f660cf9">Select your custom theme to activate it.</li>
|
||||
<li>Go to "Menu" -> "Options" -> "Appearance."</li>
|
||||
<li>In the theme selection dropdown, you should see your custom theme listed
|
||||
under the name you provided with the <code>#appTheme</code> <a href="#root/_help_zEY4DaJG4YT5">label</a>.</li>
|
||||
<li>Select your custom theme to activate it.</li>
|
||||
</ol>
|
||||
<p>If you make changes to your theme, press <kbd>Ctrl</kbd> + <kbd>R</kbd> to
|
||||
reload the frontend and apply your updates.</p>
|
||||
<h3>Sharing and Importing Themes</h3>
|
||||
<p>Custom themes can be exported as <code spellcheck="false">.tar</code> archives,
|
||||
which can be shared with other users. However, be cautious when importing
|
||||
themes from untrusted sources, as they may contain executable scripts that
|
||||
could pose security risks.</p>
|
||||
<p>Custom themes can be exported as <code>.tar</code> archives, which can be
|
||||
shared with other users. However, be cautious when importing themes from
|
||||
untrusted sources, as they may contain executable scripts that could pose
|
||||
security risks.</p>
|
||||
<p>An example user theme, <em>Steel Blue</em>, is available in the demo document.</p>
|
||||
<p>
|
||||
<img src="Themes_steel-blue.png" alt="Steel Blue Theme">
|
||||
@@ -100,19 +96,17 @@ body .CodeMirror {
|
||||
<h3>Applying Custom CSS</h3>
|
||||
<p>To use custom CSS:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="e34f8b4bcba7c20fb1b7653fe36ded3da"><strong>Create a CSS Code Note</strong>: Create a new <a class="reference-link"
|
||||
href="#root/_help_6f9hih2hXXZk">Code</a> note with the <code spellcheck="false">CSS</code> type.</li>
|
||||
<li
|
||||
data-list-item-id="ec697ca6baf249b374caa04b0817a54f0"><strong>Add the</strong> <code spellcheck="false">appCss</code> <strong>Label</strong>:
|
||||
Annotate the note with the <code spellcheck="false">#appCss</code> <a href="#root/_help_zEY4DaJG4YT5">label</a>.</li>
|
||||
<li
|
||||
data-list-item-id="e33d95fa67b19ef88f2561c3addecade8"><strong>Write Your CSS</strong>: Add your custom CSS rules to the note.</li>
|
||||
<li><strong>Create a CSS Code Note</strong>: Create a new <a class="reference-link"
|
||||
href="#root/_help_6f9hih2hXXZk">Code</a> note with the <code>CSS</code> type.</li>
|
||||
<li><strong>Add the</strong> <code>appCss</code> <strong>Label</strong>: Annotate
|
||||
the note with the <code>#appCss</code> <a href="#root/_help_zEY4DaJG4YT5">label</a>.</li>
|
||||
<li><strong>Write Your CSS</strong>: Add your custom CSS rules to the note.</li>
|
||||
</ol>
|
||||
<p>For example:</p><pre><code class="language-text-x-trilium-auto">/* Custom CSS to style specific elements */
|
||||
.tree-item {
|
||||
color: #ff6347; /* Change tree item color */
|
||||
}</code></pre>
|
||||
<p>When Trilium's frontend starts, all notes labeled with <code spellcheck="false">appCss</code> are
|
||||
<p>When Trilium's frontend starts, all notes labeled with <code>appCss</code> are
|
||||
automatically included in the style element of the HTML page.</p>
|
||||
<p>After making changes, press <kbd>Ctrl</kbd> + <kbd>R</kbd> to reload the frontend
|
||||
and apply your new styles.</p>
|
||||
@@ -122,24 +116,22 @@ body .CodeMirror {
|
||||
<h3>Styling Specific Notes in the Tree</h3>
|
||||
<p>To apply specific styles to certain notes in the tree:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e885cbe8b8c440d4bf71c95d5f8c73340"><strong>Use the</strong> <code spellcheck="false">cssClass</code> <strong>Attribute</strong>:
|
||||
Add the <code spellcheck="false">cssClass</code> <a href="#root/_help_zEY4DaJG4YT5">attribute</a> to
|
||||
<li><strong>Use the</strong> <code>cssClass</code> <strong>Attribute</strong>:
|
||||
Add the <code>cssClass</code> <a href="#root/_help_zEY4DaJG4YT5">attribute</a> to
|
||||
a note, and assign it a value representing the desired CSS class.</li>
|
||||
<li
|
||||
data-list-item-id="e168c9c99d3bf9e7af0d0bd03ee6903f5"><strong>Define an</strong> <code spellcheck="false">iconClass</code>: You
|
||||
can also define a custom icon for a note using the <code spellcheck="false">iconClass</code> attribute,
|
||||
selecting from <a href="https://boxicons.com">Box Icons</a> or your own custom
|
||||
classes.</li>
|
||||
<li><strong>Define an</strong> <code>iconClass</code>: You can also define
|
||||
a custom icon for a note using the <code>iconClass</code> attribute, selecting
|
||||
from <a href="https://boxicons.com">Box Icons</a> or your own custom classes.</li>
|
||||
</ul>
|
||||
<p>For example, if you want to style notes of a specific type, such as notes
|
||||
containing PNG images, you can target them with classes like <code spellcheck="false">type-image mime-image-png</code>.</p>
|
||||
containing PNG images, you can target them with classes like <code>type-image mime-image-png</code>.</p>
|
||||
<h3>User-Provided Themes</h3>
|
||||
<p>A gallery of user-created themes is available, showcasing the variety
|
||||
of customizations that the Trilium community has developed. For more information,
|
||||
check the <a class="reference-link" href="#root/_help_VbjZvtUek0Ln">Theme Gallery</a>.</p>
|
||||
<h3>Asset Path Management</h3>
|
||||
<p>When referencing built-in assets like images in your custom themes or
|
||||
CSS, you can avoid hardcoding version numbers by using the <code spellcheck="false">vX</code> alias.
|
||||
For example, instead of specifying <code spellcheck="false">/assets/v0.57.0-beta/images/icon-grey.png</code>,
|
||||
you can use <code spellcheck="false">/assets/vX/images/icon-grey.png</code> to
|
||||
keep your theme compatible with future versions of Trilium.</p>
|
||||
CSS, you can avoid hardcoding version numbers by using the <code>vX</code> alias.
|
||||
For example, instead of specifying <code>/assets/v0.57.0-beta/images/icon-grey.png</code>,
|
||||
you can use <code>/assets/vX/images/icon-grey.png</code> to keep your theme
|
||||
compatible with future versions of Trilium.</p>
|
||||
@@ -3,22 +3,21 @@
|
||||
scratch (see below) or imported from a ZIP file from a third-party developer.</p>
|
||||
<aside
|
||||
class="admonition note">
|
||||
<p><strong>Icon packs are third-party content</strong>
|
||||
<br>
|
||||
<br>The Trilium maintainers are not responsible for keeping these icon packs
|
||||
<p><strong>Icon packs are third-party content</strong>
|
||||
</p>
|
||||
<p>The Trilium maintainers are not responsible for keeping these icon packs
|
||||
up to date. If you have an issue with a specific icon pack, then the issue
|
||||
must be reported to the third-party developer responsible for it, not the
|
||||
Trilium team.</p>
|
||||
</aside>
|
||||
<p>To import an icon pack:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="e72cd89899a976ca5c54e089df2285d41">Ideally, create a dedicated spot in your note tree where to place the
|
||||
<li>Ideally, create a dedicated spot in your note tree where to place the
|
||||
icon packs.</li>
|
||||
<li data-list-item-id="ed7f941fe865c5f14e1ae724831e49ba1">Right click the note where to put it and select <em>Import into note</em>.</li>
|
||||
<li
|
||||
data-list-item-id="e1b6980592dddab6a0235dd070b3b7067">Uncheck <em>Safe import</em>.</li>
|
||||
<li data-list-item-id="edd29376be6fbf3b9c59275145457de3b">Select <em>Import</em>.</li>
|
||||
<li data-list-item-id="ea9ae8004d6cd7b349ac648cde9141977"><a href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/_help_s8alTXmpFR61">Refresh the application</a>.</li>
|
||||
<li>Right click the note where to put it and select <em>Import into note</em>.</li>
|
||||
<li>Uncheck <em>Safe import</em>.</li>
|
||||
<li>Select <em>Import</em>.</li>
|
||||
<li><a href="#root/_help_s8alTXmpFR61">Refresh the application</a>.</li>
|
||||
</ol>
|
||||
<aside class="admonition warning">
|
||||
<p>Since <em>Safe import</em> is disabled, make sure you trust the source as
|
||||
@@ -30,11 +29,11 @@ class="admonition note">
|
||||
<h2>Creating an icon pack</h2>
|
||||
<p>Creating an icon pack requires some scripting knowledge outside Trilium
|
||||
in order to generate the list of icons. For information, see <a class="reference-link"
|
||||
href="#root/pKK96zzmvBGf/_help_g1mlRoU8CsqC">Creating an icon pack</a>.</p>
|
||||
href="#root/_help_g1mlRoU8CsqC">Creating an icon pack</a>.</p>
|
||||
<h2>Using an icon from an icon pack</h2>
|
||||
<p>After <a href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/_help_s8alTXmpFR61">refreshing the application</a>,
|
||||
the icon pack should be enabled by default. To test this, simply select
|
||||
an existing note or create a new one and try to change the note icon.</p>
|
||||
<p>After <a href="#root/_help_s8alTXmpFR61">refreshing the application</a>, the
|
||||
icon pack should be enabled by default. To test this, simply select an
|
||||
existing note or create a new one and try to change the note icon.</p>
|
||||
<p>There should be a <em>Filter</em> button to the right of the search bar
|
||||
in the icon list. Clicking it allows filtering by icon pack and the newly
|
||||
imported icon pack should be displayed there.</p>
|
||||
@@ -42,35 +41,31 @@ class="admonition note">
|
||||
<p>If the icon pack is missing from that list, then most likely there's something
|
||||
wrong with it.</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e0a36a4a12c83b68ed1affd67e7ffa850">Try checking the <a class="reference-link" href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/qzNzp9LYQyPT/_help_bnyigUA2UK7s">Backend (server) logs</a> for
|
||||
clues and make sure that the icon pack has the <code spellcheck="false">#iconPack</code>
|
||||
<li>Try checking the <a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a> for
|
||||
clues and make sure that the icon pack has the <code>#iconPack</code>
|
||||
<a
|
||||
href="#root/pOsGYCXsbNQG/tC7s2alapj8V/zEY4DaJG4YT5/_help_HI6GBBIduIgv">label</a>with a value assigned to it (a prefix).</li>
|
||||
<li data-list-item-id="e33510913f0656b1c14c5f0c7278093c7">Icon packs that are <a href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/BFs8mudNFgCS/_help_bwg0e8ewQMak">protected</a> are
|
||||
ignored.</li>
|
||||
href="#root/_help_HI6GBBIduIgv">label</a>with a value assigned to it (a prefix).</li>
|
||||
<li>Icon packs that are <a href="#root/_help_bwg0e8ewQMak">protected</a> are ignored.</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<h2>Integration with the share and export functionality</h2>
|
||||
<p>Custom icon packs are also supported by the <a class="reference-link"
|
||||
href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">Sharing</a> feature,
|
||||
where they will be shown in the note tree. However, in order for an icon
|
||||
pack to be visible to the share function, the icon pack note must also
|
||||
be shared.</p>
|
||||
<p>If you are using a custom share theme, make sure it supports the
|
||||
<code
|
||||
spellcheck="false">iconPackCss</code>, otherwise icons will not show up. Check the original
|
||||
share template source code for reference.</p>
|
||||
href="#root/_help_R9pX4DGra2Vt">Sharing</a> feature, where they will be
|
||||
shown in the note tree. However, in order for an icon pack to be visible
|
||||
to the share function, the icon pack note must also be shared.</p>
|
||||
<p>If you are using a custom share theme, make sure it supports the <code>iconPackCss</code>,
|
||||
otherwise icons will not show up. Check the original share template source
|
||||
code for reference.</p>
|
||||
<p>Custom icon packs will also be preserved when <a class="reference-link"
|
||||
href="#root/pOsGYCXsbNQG/tC7s2alapj8V/R9pX4DGra2Vt/_help_ycBFjKrrwE9p">Exporting static HTML for web publishing</a>.
|
||||
href="#root/_help_ycBFjKrrwE9p">Exporting static HTML for web publishing</a>.
|
||||
In this case, there's no requirement to make the icon pack shared.</p>
|
||||
<h2>What happens if I remove an icon pack</h2>
|
||||
<p>If an icon pack is removed or disabled (by removing or altering its
|
||||
<code
|
||||
spellcheck="false">#iconPack</code>label), all the notes that use this icon pack will show
|
||||
in the <a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_oPVyFC7WL2Lp">Note Tree</a> with
|
||||
no icon. This won't cause any issues apart from looking strange.</p>
|
||||
<p>If an icon pack is removed or disabled (by removing or altering its <code>#iconPack</code> label),
|
||||
all the notes that use this icon pack will show in the <a class="reference-link"
|
||||
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a> with no icon. This won't cause
|
||||
any issues apart from looking strange.</p>
|
||||
<p>The solution is to replace the icons with some else, try using
|
||||
<a
|
||||
class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/wArbEsdSae6g/_help_eIg8jdvaoNNd">Search</a> which supports bulk actions, to identify the notes with
|
||||
class="reference-link" href="#root/_help_eIg8jdvaoNNd">Search</a> which supports bulk actions, to identify the notes with
|
||||
the now deleted icon pack (by looking for the prefix) and changing or removing
|
||||
their <code spellcheck="false">iconClass</code>.</p>
|
||||
their <code>iconClass</code>.</p>
|
||||
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/1_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 652 KiB After Width: | Height: | Size: 15 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/2_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/3_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 612 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/4_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 612 KiB After Width: | Height: | Size: 10 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/5_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/6_File_image.png
generated
vendored
|
Before Width: | Height: | Size: 15 KiB |
90
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/File.html
generated
vendored
@@ -4,53 +4,35 @@
|
||||
<p>Since these files come from an external source, it is not possible to
|
||||
create a <em>File</em> note type directly:</p>
|
||||
<ul>
|
||||
<li>Drag a file into the <a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</li>
|
||||
<li>Right click a note and select <em>Import into note</em> and point it to
|
||||
<li data-list-item-id="e838d2edcf20254924c6945bb0677bc35">Drag a file into the <a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</li>
|
||||
<li
|
||||
data-list-item-id="e87405721a8eca37bf5258ce1a7d40847">Right click a note and select <em>Import into note</em> and point it to
|
||||
one of the supported files.</li>
|
||||
</ul>
|
||||
<h2>Supported file types</h2>
|
||||
<h3>PDFs</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:933/666;" src="File_image.png"
|
||||
width="933" height="666">
|
||||
</figure>
|
||||
<p>PDFs can be browsed directly from Trilium.</p>
|
||||
<p>Interaction:</p>
|
||||
<ul>
|
||||
<li>Press the menu icon at the top-left to see a preview (thumbnail) of all
|
||||
the pages, as well as a table of contents (if the PDF has this information).</li>
|
||||
<li>See or edit the page number at the top.</li>
|
||||
<li>Adjust the zoom using the buttons at the top or manually editing the value.</li>
|
||||
<li>Rotate the document if it's in the wrong orientation.</li>
|
||||
<li>In the contextual menu:
|
||||
<ul>
|
||||
<li>View two pages at once (great for books).</li>
|
||||
<li>Toggle annotations (if present in the document).</li>
|
||||
<li>View document properties.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>See <a class="reference-link" href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/W8vYD3Q1zjCR/_help_XJGJrpu7F9sh">PDFs</a>.</p>
|
||||
<h3>Images</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:879/766;" src="4_File_image.png"
|
||||
<img style="aspect-ratio:879/766;" src="3_File_image.png"
|
||||
width="879" height="766">
|
||||
</figure>
|
||||
<p>Interaction:</p>
|
||||
<ul>
|
||||
<li><em>Copy reference to clipboard</em>, for embedding the image within
|
||||
<li data-list-item-id="e2a48d88d6adf1a0d7467cb8a1c70084a"><em>Copy reference to clipboard</em>, for embedding the image within
|
||||
<a
|
||||
class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a> notes.
|
||||
<ul>
|
||||
<li>See <a class="reference-link" href="#root/_help_0Ofbk1aSuVRu">Image references</a> for
|
||||
<li data-list-item-id="ec686b380d3dc321b2d99d709315942d3">See <a class="reference-link" href="#root/_help_0Ofbk1aSuVRu">Image references</a> for
|
||||
more information.</li>
|
||||
<li>Alternatively, press the corresponding button from the <a class="reference-link"
|
||||
<li data-list-item-id="e0502ddadf07a7e370462c08e9ef09ee4">Alternatively, press the corresponding button from the <a class="reference-link"
|
||||
href="#root/_help_XpOYSgsLkTJy">Floating buttons</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Videos</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:854/700;" src="1_File_image.png"
|
||||
<img style="aspect-ratio:854/700;" src="File_image.png"
|
||||
width="854" height="700">
|
||||
</figure>
|
||||
<p>Video files can be added in as well. The file is streamed directly, so
|
||||
@@ -67,23 +49,23 @@
|
||||
</aside>
|
||||
<h3>Audio</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:850/243;" src="3_File_image.png"
|
||||
<img style="aspect-ratio:850/243;" src="2_File_image.png"
|
||||
width="850" height="243">
|
||||
</figure>
|
||||
<p>Adding a supported audio file will reveal a basic audio player that can
|
||||
be used to play it.</p>
|
||||
<p>Interactions:</p>
|
||||
<ul>
|
||||
<li>The audio can be played/paused using the dedicated button.</li>
|
||||
<li>Dragging the mouse across, or clicking the progress bar will seek through
|
||||
<li data-list-item-id="e3361343c2087cd5fd90f446c2db3aceb">The audio can be played/paused using the dedicated button.</li>
|
||||
<li data-list-item-id="e0681c0b088d2937257b1afc8d2ce3f04">Dragging the mouse across, or clicking the progress bar will seek through
|
||||
the song.</li>
|
||||
<li>The volume can be set.</li>
|
||||
<li>The playback speed can be adjusted via the contextual menu next to the
|
||||
<li data-list-item-id="e8d0e58bde64158d92b0a82e735299eb5">The volume can be set.</li>
|
||||
<li data-list-item-id="e76438c11c21e615066915ef5289732ab">The playback speed can be adjusted via the contextual menu next to the
|
||||
volume.</li>
|
||||
</ul>
|
||||
<h3>Text files</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:926/347;" src="2_File_image.png"
|
||||
<img style="aspect-ratio:926/347;" src="1_File_image.png"
|
||||
width="926" height="347">
|
||||
</figure>
|
||||
<p>Files that are identified as containing text will show a preview of their
|
||||
@@ -102,7 +84,7 @@
|
||||
application.</p>
|
||||
<h3>Unknown file types</h3>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;">
|
||||
<img style="aspect-ratio:532/240;" src="5_File_image.png"
|
||||
<img style="aspect-ratio:532/240;" src="4_File_image.png"
|
||||
width="532" height="240">
|
||||
</figure>
|
||||
<p>If the file could not be identified as any of the supported file types
|
||||
@@ -111,33 +93,35 @@
|
||||
file externally, but there will be no preview of the content.</p>
|
||||
<h2>Interaction</h2>
|
||||
<ul>
|
||||
<li>Regardless of the file type, a series of buttons will be displayed in
|
||||
<li data-list-item-id="e4b886a9448519b3cdd4b972fbde1a8fb">Regardless of the file type, a series of buttons will be displayed in
|
||||
the <em>Image</em> or <em>File</em> tab in the <a class="reference-link"
|
||||
href="#root/_help_BlN9DFI679QC">Ribbon</a>.
|
||||
<ul>
|
||||
<li><em>Download</em>, which will download the file for local use.</li>
|
||||
<li><em>Open</em>, will will open the file with the system-default application.</li>
|
||||
<li>Upload new revision to replace the file with a new one.</li>
|
||||
<li data-list-item-id="e50be8d9eea4871abc3d51a92ae05f136"><em>Download</em>, which will download the file for local use.</li>
|
||||
<li
|
||||
data-list-item-id="eec24704d1d2a5642d0881e38d5090b54"><em>Open</em>, will will open the file with the system-default application.</li>
|
||||
<li
|
||||
data-list-item-id="e5e576572cf69eb14753f33755f8a25b6">Upload new revision to replace the file with a new one.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>It is <strong>not</strong> possible to change the note type of a <em>File</em> note.</li>
|
||||
<li>Convert into an <a href="#root/_help_0vhv7lsOLy82">attachment</a> from the <a href="#root/_help_8YBEPzcpUgxw">note menu</a>.</li>
|
||||
</li>
|
||||
<li data-list-item-id="ee5a73a8d726754636a45086dd1612616">It is <strong>not</strong> possible to change the note type of a <em>File</em> note.</li>
|
||||
<li
|
||||
data-list-item-id="e3f6f719f94482df13f687503378d15cc">Convert into an <a href="#root/_help_0vhv7lsOLy82">attachment</a> from the <a href="#root/_help_8YBEPzcpUgxw">note menu</a>.</li>
|
||||
</ul>
|
||||
<h2>Relation with other notes</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<li data-list-item-id="eb364a811b42ed28431d698b7e617523f">
|
||||
<p>Files are also displayed in the <a class="reference-link" href="#root/_help_0ESUbbAxVnoK">Note List</a> based
|
||||
on their type:</p>
|
||||
<img class="image_resized" style="aspect-ratio:853/315;width:50%;"
|
||||
src="6_File_image.png" width="853" height="315">
|
||||
</li>
|
||||
<li>
|
||||
<p>Non-image files can be embedded into text notes as read-only widgets via
|
||||
the <a class="reference-link" href="#root/_help_nBAXQFj20hS1">Include Note</a> functionality.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Image files can be embedded into text notes like normal images via
|
||||
<a
|
||||
class="reference-link" href="#root/_help_0Ofbk1aSuVRu">Image references</a>.</p>
|
||||
<p>
|
||||
<img class="image_resized" style="aspect-ratio:853/315;width:50%;" src="5_File_image.png"
|
||||
width="853" height="315">
|
||||
</p>
|
||||
</li>
|
||||
<li data-list-item-id="e066146c6d5ab67fcd20d634f54a58a66">Non-image files can be embedded into text notes as read-only widgets via
|
||||
the <a class="reference-link" href="#root/_help_nBAXQFj20hS1">Include Note</a> functionality.</li>
|
||||
<li
|
||||
data-list-item-id="eaec442497ed868ee21da4ca456ead455">Image files can be embedded into text notes like normal images via
|
||||
<a
|
||||
class="reference-link" href="#root/_help_0Ofbk1aSuVRu">Image references</a>.</li>
|
||||
</ul>
|
||||
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/File/1_PDFs_image.png
generated
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
128
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/File/PDFs.html
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
<figure class="image image_resized" style="width:74.34%;">
|
||||
<img style="aspect-ratio:1360/698;" src="PDFs_image.png"
|
||||
width="1360" height="698">
|
||||
</figure>
|
||||
<p>PDFs file can be uploaded in Trilium, where they will be displayed without
|
||||
the need to download them first.</p>
|
||||
<p>Since v0.102.0, PDFs will be rendered using Trilium's built-in PDF viewer,
|
||||
which is a customization of <a href="https://mozilla.github.io/pdf.js/">Mozilla's PDF.js viewer</a> (also
|
||||
built-in in the Mozilla Firefox browser). Versions prior to that render
|
||||
PDFs using the browser's default PDF viewer.</p>
|
||||
<h2>Storing last position and settings</h2>
|
||||
<p>For every PDF, Trilium will remember the following information:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e800292c222a870700c853355e8f323a3">
|
||||
<p>The current page.</p>
|
||||
</li>
|
||||
<li data-list-item-id="eafe1af464be4b531cc88170014c92cb9">
|
||||
<p>The scroll position, within the current page.</p>
|
||||
</li>
|
||||
<li data-list-item-id="ed9b5e35df1c612b69742ff970c95a25b">
|
||||
<p>The rotation of the page.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>This makes it useful when reading large documents since the position is
|
||||
remembered automatically. This happens in the background, however it's
|
||||
recorded only a few seconds after stopping any scroll actions.</p>
|
||||
<aside
|
||||
class="admonition tip">
|
||||
<p>Technically, the information about the scroll position and rotation is
|
||||
stored in the <a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/BFs8mudNFgCS/_help_0vhv7lsOLy82">Attachments</a> section,
|
||||
in a dedicated attachment called <code spellcheck="false">pdfHistory.json</code>.</p>
|
||||
</aside>
|
||||
<h2>Annotations</h2>
|
||||
<p>Since v0.102.0 it's possible to annotate PDFs. To do so, look for the
|
||||
annotation buttons on the right side of the PDF toolbar (
|
||||
<img src="1_PDFs_image.png"
|
||||
width="120" height="32">).</p>
|
||||
<h3>Supported annotations</h3>
|
||||
<p>The following annotation methods are supported:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e22b0fd64079f222a6edf716d1e287fcd"><strong>Highlight</strong>
|
||||
<br>Allows highlighting text with one of the predefined colors.
|
||||
<ul>
|
||||
<li data-list-item-id="ed5816cda369a50d35356545b2e639106">The thickness is also adjustable.</li>
|
||||
<li data-list-item-id="eacd49e75a9b3c6ca88dcc3aecb6e7780">It's also possible to highlight the blank space, turning the feature more
|
||||
into a thicker pen.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="ed150361858da21a3a043fe273f3a8082"><strong>Text</strong>
|
||||
<br>Allows adding arbitrary text, with a custom color and size.</li>
|
||||
<li data-list-item-id="e1684364a9a848f88610727d8d903113d"><strong>Pen</strong>
|
||||
<br>Allows free drawing on the document, with variable color, thickness and
|
||||
opacity.</li>
|
||||
<li data-list-item-id="ebff3cc863fa39a4bf69ca9a3a25ed289"><strong>Image</strong>
|
||||
<br>Allows inserting images from outside Trilium directly into the document.</li>
|
||||
</ul>
|
||||
<h3>Editing existing annotations</h3>
|
||||
<p>Although annotations are stored in the PDF itself, they can be edited.
|
||||
To edit an annotation, press one of the annotation buttons from the previous
|
||||
section to enter edit mode and click on an existing annotation. This will
|
||||
reveal a toolbar with options to customize the annotation (e.g. to change
|
||||
a color), as well as the possibility to remove it.</p>
|
||||
<h3>How are annotations stored</h3>
|
||||
<p>Annotations are stored directly in the PDF. When modifications are made,
|
||||
Trilium will replace the PDF with the new one.</p>
|
||||
<p>Since modifications are automatically saved, there's no need to manually
|
||||
save the document after making modifications to the annotations.</p>
|
||||
<p>The benefit of “baked-in annotations” is that they are also accessible
|
||||
if downloading (for external use outside Trilium) or sharing the note.</p>
|
||||
<p>The downside is that the entire PDF needs to be sent back to the server,
|
||||
which can slow down performance for larger documents. If you encounter
|
||||
any issues from this system, feel free to <a href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/_help_wy8So3yZZlH9">report it</a>.</p>
|
||||
<h2>Filling out forms</h2>
|
||||
<p>Similar to annotations, forms are also supported by Trilium since v0.102.0.
|
||||
If the document has fields that can be filled-in, they will be indicated
|
||||
with a colored background.</p>
|
||||
<p>Simply type text in the forms and they will be automatically saved.</p>
|
||||
<h2>Sidebar navigation</h2>
|
||||
<aside class="admonition note">
|
||||
<p>This feature is only available if <a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_IjZS7iK5EXtb">New Layout</a> is
|
||||
enabled. If you are using the old layout, these features are still available
|
||||
by looking for a sidebar button in the PDF viewer toolbar.</p>
|
||||
</aside>
|
||||
<p>When a PDF file is opened in Trilium the <a class="reference-link"
|
||||
href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_RnaPdbciOfeq">Right Sidebar</a> is
|
||||
augmented with PDF-specific navigation, with the following features:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="ec98e84135caf286b8c34b65403a7c36b">Table of contents/outline
|
||||
<ul>
|
||||
<li data-list-item-id="e3d034433ea04b042c9425d0d183174f0">All the headings and “bookmarks” will be displayed hierarchially.</li>
|
||||
<li
|
||||
data-list-item-id="e6113a5ba02d24a74d858d8b9e5cd529d">The heading on the current page is also highlighted (note that it can
|
||||
be slightly offset depending on how many headings are on the same page).</li>
|
||||
<li
|
||||
data-list-item-id="e650d1274d9fcc67a61ed531be41664ba">Clicking on a heading will jump to the corresponding position in the PDF.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e7596d0db46b52000147e8c58035a9080">Pages
|
||||
<ul>
|
||||
<li data-list-item-id="e878951e72b24d63a5f427c09dbd5b43d">A preview of all the pages with a small thumbnail.</li>
|
||||
<li data-list-item-id="ee2a88c436e666ad03396e16afc5e820d">Clicking on a page will automatically navigate to that page.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e69b90e09bec99dd22e1d51b3fd47ad30">Attachments
|
||||
<ul>
|
||||
<li data-list-item-id="e32d2f3ca07155778516311955aad6bc1">If the PDF has its own attachments (not to be confused with Trilium's
|
||||
<a
|
||||
class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/BFs8mudNFgCS/_help_0vhv7lsOLy82">Attachments</a>), they will be displayed in a list.</li>
|
||||
<li data-list-item-id="e51eac1ae4ee919989c95a28940f77d1b">Some information such as the name and size of the attachment are displayed.</li>
|
||||
<li
|
||||
data-list-item-id="ee296a4cf55b2d4372496ab8e70691236">It's possible to download the attachment by clicking on the download button.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="ef51c3a38777e3a1a11b7691de57c3eab">Layers
|
||||
<ul>
|
||||
<li data-list-item-id="e09e2c2c5f8fdd0f5756ca6345a275e5d">A less common feature, if the PDF has toggle-able layers, these layers
|
||||
will be displayed in a list here.</li>
|
||||
<li data-list-item-id="e35568c33af1e6bf80f9e5d9c66fa903a">It's possible to toggle the visibility for each individual layer.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Share functionality</h2>
|
||||
<p>PDFs can also be shared using the <a class="reference-link" href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">Sharing</a> feature.
|
||||
This will also use Trilium's customized PDF viewer.</p>
|
||||
<p>If you are using a reverse proxy on your server with strict access limitations
|
||||
for the share functionality, make sure that <code spellcheck="false">[host].com/pdfjs</code> directory
|
||||
is accessible. Note that this directory is outside the <code spellcheck="false">/share</code> route
|
||||
as it's common with the rest of the application.</p>
|
||||
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/File/PDFs_image.png
generated
vendored
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/File_image.png
generated
vendored
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 652 KiB |
@@ -8,62 +8,60 @@
|
||||
into Trilium.</p>
|
||||
<p>Trilium only supports <strong>font-based icon sets</strong>, with the following
|
||||
formats:</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Extension</th>
|
||||
<th>MIME type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code spellcheck="false">.woff2</code>
|
||||
</td>
|
||||
<td><code spellcheck="false">font/woff2</code>
|
||||
</td>
|
||||
<td>Recommended due to great compression (low size).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code spellcheck="false">.woff</code>
|
||||
</td>
|
||||
<td><code spellcheck="false">font/woff</code>
|
||||
</td>
|
||||
<td>Higher compatibility, but the font file is bigger.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code spellcheck="false">.ttf</code>
|
||||
</td>
|
||||
<td><code spellcheck="false">font/ttf</code>
|
||||
</td>
|
||||
<td>Most common, but highest font size.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Extension</th>
|
||||
<th>MIME type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>.woff2</code>
|
||||
</td>
|
||||
<td><code>font/woff2</code>
|
||||
</td>
|
||||
<td>Recommended due to great compression (low size).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>.woff</code>
|
||||
</td>
|
||||
<td><code>font/woff</code>
|
||||
</td>
|
||||
<td>Higher compatibility, but the font file is bigger.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>.ttf</code>
|
||||
</td>
|
||||
<td><code>font/ttf</code>
|
||||
</td>
|
||||
<td>Most common, but highest font size.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Unsupported formats</h2>
|
||||
<p>Trilium <strong>does not</strong> support the following formats:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e82a131514827c3594823b95a1e032e55">SVG-based fonts.</li>
|
||||
<li data-list-item-id="ea255621003bfddf0c27b138800b7461e">Individual SVGs.</li>
|
||||
<li data-list-item-id="eb75d3b9b71a147f48925903844e878a0"><code spellcheck="false">.eot</code> fonts (legacy and proprietary).</li>
|
||||
<li
|
||||
data-list-item-id="e67532d402708b0d266f438de7afc617b">Duotone icons, since it requires a special CSS format that Trilium doesn't
|
||||
<li>SVG-based fonts.</li>
|
||||
<li>Individual SVGs.</li>
|
||||
<li><code>.eot</code> fonts (legacy and proprietary).</li>
|
||||
<li>Duotone icons, since it requires a special CSS format that Trilium doesn't
|
||||
support.</li>
|
||||
<li data-list-item-id="ee56cb0fb0ae77e969c44844a2b56ef94">Any other font format not specified in the <em>Supported formats</em> section.</li>
|
||||
<li>Any other font format not specified in the <em>Supported formats</em> section.</li>
|
||||
</ul>
|
||||
<p>In this case, the font must be manually converted to one of the supported
|
||||
formats (ideally <code spellcheck="false">.woff2</code>).</p>
|
||||
formats (ideally <code>.woff2</code>).</p>
|
||||
<h2>Prerequisites</h2>
|
||||
<p>In order to create a new icon pack from a set of icons, it must meet the
|
||||
following criteria:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="eba517372b7686baf9c5ffbec386e7853">It must have a web font of the supported format (see above).</li>
|
||||
<li data-list-item-id="e960457bf372dd1a2e3ec77140b38051c">It must have some kind of list, containing the name of each icon and the
|
||||
<li>It must have a web font of the supported format (see above).</li>
|
||||
<li>It must have some kind of list, containing the name of each icon and the
|
||||
corresponding Unicode code point. If this is missing, icon fonts usually
|
||||
ship with a <code spellcheck="false">.css</code> file that can be used to
|
||||
extract the icon names from.</li>
|
||||
ship with a <code>.css</code> file that can be used to extract the icon names
|
||||
from.</li>
|
||||
</ol>
|
||||
<h2>Step-by-step process</h2>
|
||||
<p>As an example throughout this page, we are going to go through the steps
|
||||
@@ -71,7 +69,7 @@
|
||||
<h3>Creating the manifest</h3>
|
||||
<p>This is the most difficult part of creating an icon pack, since it requires
|
||||
processing of the icon list to match Trilium's format.</p>
|
||||
<p>The icon pack manifest is a JSON file with the following structure:</p><pre><code class="language-text-x-trilium-auto">{
|
||||
<p>The icon pack manifest is a JSON file with the following structure:</p><pre><code class="language-application-ld-json">{
|
||||
"icons": {
|
||||
"bx-ball": {
|
||||
"glyph": "\ue9c2",
|
||||
@@ -84,20 +82,19 @@
|
||||
}
|
||||
}</code></pre>
|
||||
<ul>
|
||||
<li data-list-item-id="e421d9a5fbad061cc4bb80123d2b3b383">The JSON example is a sample from the Boxicons font.</li>
|
||||
<li data-list-item-id="e61b71a1639566cc9ff760a99aca2279a">This is simply a mapping between the CSS classes (<code spellcheck="false">bx-ball</code>),
|
||||
to its corresponding code point in the font (<code spellcheck="false">\ue9c2</code>)
|
||||
and the terms/aliases used for search purposes.</li>
|
||||
<li data-list-item-id="e7f407f989ab48267d31975f75c89d007">Note that it's also possible to use the unescaped glyph inside the JSON.
|
||||
<li>The JSON example is a sample from the Boxicons font.</li>
|
||||
<li>This is simply a mapping between the CSS classes (<code>bx-ball</code>),
|
||||
to its corresponding code point in the font (<code>\ue9c2</code>) and the
|
||||
terms/aliases used for search purposes.</li>
|
||||
<li>Note that it's also possible to use the unescaped glyph inside the JSON.
|
||||
It will appear strange (e.g. ), but it will be rendered properly regardless.</li>
|
||||
<li
|
||||
data-list-item-id="ec4b9b5ac1609500d36d35e659d61b61f">The first term is also considered the “name” of the icon, which is displayed
|
||||
<li>The first term is also considered the “name” of the icon, which is displayed
|
||||
while hovering over it in the icon selector.</li>
|
||||
</ul>
|
||||
<p>In order to generate this manifest, generally a script is needed that
|
||||
processes an already existing list. In the case of Phosphor Icons, the
|
||||
icon list comes in a file called <code spellcheck="false">selection.json</code> with
|
||||
the following format:</p><pre><code class="language-application-json">{
|
||||
icon list comes in a file called <code>selection.json</code> with the following
|
||||
format:</p><pre><code class="language-application-ld-json">{
|
||||
"icons": [
|
||||
{
|
||||
"icon": {
|
||||
@@ -155,36 +152,34 @@ console.log(processIconPack("light"));</code></pre>
|
||||
<aside class="admonition tip">
|
||||
<p><strong>Mind the escape format when processing CSS</strong>
|
||||
</p>
|
||||
<p>The Unicode escape syntax is different in CSS (<code spellcheck="false">"\ea3f"</code>)
|
||||
when compared to JSON (<code spellcheck="false">"\uea3f"</code>). Notice
|
||||
how the JSON escape is <code spellcheck="false">\u</code> and not <code spellcheck="false">\</code>.</p>
|
||||
<p>The Unicode escape syntax is different in CSS (<code>"\ea3f"</code>) when
|
||||
compared to JSON (<code>"\uea3f"</code>). Notice how the JSON escape is <code>\u</code> and
|
||||
not <code>\</code>.</p>
|
||||
<p>As a more compact alternative, provide the un-escaped character directly,
|
||||
as UTF-8 is supported.</p>
|
||||
</aside>
|
||||
<h3>Creating the icon pack</h3>
|
||||
<ol>
|
||||
<li data-list-item-id="e7d2cd4845de4760238012fc2ae8dc7a5">Create a note of type <em>Code</em>.</li>
|
||||
<li data-list-item-id="ef8c38938d0e7f8db06bc1e48654ba3d7">Set the language to <em>JSON</em>.</li>
|
||||
<li data-list-item-id="eb4d1eeb7b1af1474870e646096d5c71b">Copy and paste the manifest generated in the previous step as the content
|
||||
<li>Create a note of type <em>Code</em>.</li>
|
||||
<li>Set the language to <em>JSON</em>.</li>
|
||||
<li>Copy and paste the manifest generated in the previous step as the content
|
||||
of this note.</li>
|
||||
<li data-list-item-id="e1e5a73c0ed4c207555912ccae863aa1c">Go to the <a href="#root/_help_0vhv7lsOLy82">note attachment</a> and upload the
|
||||
font file (in <code spellcheck="false">.woff2</code>, <code spellcheck="false">.woff</code>,
|
||||
<code
|
||||
spellcheck="false">.ttf</code>) format.
|
||||
<ol>
|
||||
<li data-list-item-id="e2aaef242576df43f2c9259ec743593c4">Trilium identifies the font to use from attachments via the MIME type,
|
||||
make sure the MIME type is displayed correctly after uploading the attachment
|
||||
(for example <code spellcheck="false">font/woff2</code>).</li>
|
||||
<li data-list-item-id="ed7e90b501e2503f559c3af48c3d1ae0c">Make sure the <code spellcheck="false">role</code> appears as <code spellcheck="false">file</code>,
|
||||
otherwise the font will not be identified.</li>
|
||||
<li data-list-item-id="e7fe120986469e80972cfff7e08095ce3">Multiple attachments are supported, but only one font will actually be
|
||||
used in Trilium's order of preference: <code spellcheck="false">.woff2</code>,
|
||||
<code
|
||||
spellcheck="false">.woff</code>, <code spellcheck="false">.ttf</code>. As such, there's not
|
||||
much reason to upload more than one font per icon pack.</li>
|
||||
</ol>
|
||||
<li>Go to the <a href="#root/_help_0vhv7lsOLy82">note attachment</a> and upload the
|
||||
font file (in <code>.woff2</code>, <code>.woff</code>, <code>.ttf</code>)
|
||||
format.
|
||||
<ol>
|
||||
<li>Trilium identifies the font to use from attachments via the MIME type,
|
||||
make sure the MIME type is displayed correctly after uploading the attachment
|
||||
(for example <code>font/woff2</code>).</li>
|
||||
<li>Make sure the <code>role</code> appears as <code>file</code>, otherwise the
|
||||
font will not be identified.</li>
|
||||
<li>Multiple attachments are supported, but only one font will actually be
|
||||
used in Trilium's order of preference: <code>.woff2</code>, <code>.woff</code>, <code>.ttf</code>.
|
||||
As such, there's not much reason to upload more than one font per icon
|
||||
pack.</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li data-list-item-id="e07ea13454ff47d3a80d140e435f6e31a">Go back to the note and rename it. The name of the note will also be the
|
||||
<li>Go back to the note and rename it. The name of the note will also be the
|
||||
name of the icon pack as displayed in the list of icons.</li>
|
||||
</ol>
|
||||
<h3>Assigning the prefix</h3>
|
||||
@@ -193,53 +188,50 @@ console.log(processIconPack("light"));</code></pre>
|
||||
the application.</p>
|
||||
<p>To do so, Trilium makes use of the same format that was used for the internal
|
||||
icon pack (Boxicons). For example, when an icon from Boxicons is set, it
|
||||
looks like this: <code spellcheck="false">#iconClass="bx bxs-sushi"</code>.
|
||||
In this case, the icon pack prefix is <code spellcheck="false">bx</code> and
|
||||
the icon class name is <code spellcheck="false">bxs-sushi</code>.</p>
|
||||
looks like this: <code>#iconClass="bx bxs-sushi"</code>. In this case, the
|
||||
icon pack prefix is <code>bx</code> and the icon class name is <code>bxs-sushi</code>.</p>
|
||||
<p>In order for an icon pack to be recognized, the prefix must be specified
|
||||
in the <code spellcheck="false">#iconPack</code> label. </p>
|
||||
<p>For our example with Phosphor Icons, we can use the <code spellcheck="false">ph</code> prefix
|
||||
in the <code>#iconPack</code> label. </p>
|
||||
<p>For our example with Phosphor Icons, we can use the <code>ph</code> prefix
|
||||
since it also matches the prefix set in the original CSS. So in this case
|
||||
it would be <code spellcheck="false">#iconPack=ph</code>.</p>
|
||||
it would be <code>#iconPack=ph</code>.</p>
|
||||
<aside class="admonition important">
|
||||
<p>The prefix must consist of only alphanumeric characters, hyphens and underscore.
|
||||
If the prefix doesn't match these constraints, the icon pack will be ignored
|
||||
and an error will be logged in <a class="reference-link" href="#root/pOsGYCXsbNQG/BgmBlOIl72jZ/qzNzp9LYQyPT/_help_bnyigUA2UK7s">Backend (server) logs</a>.</p>
|
||||
and an error will be logged in <a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a>.</p>
|
||||
</aside>
|
||||
<h3>Final steps</h3>
|
||||
<ul>
|
||||
<li data-list-item-id="ea0a195d13028ebcfdd45cd27468bae7d"><a href="#root/_help_s8alTXmpFR61">Refresh the client</a>
|
||||
<li><a href="#root/_help_s8alTXmpFR61">Refresh the client</a>
|
||||
<ul>
|
||||
<li data-list-item-id="ecfbcbc9a17681cac7e86039dafa42280">Change the icon of the note and look for the <em>Filter</em> icon in the
|
||||
<li>Change the icon of the note and look for the <em>Filter</em> icon in the
|
||||
top-right side.</li>
|
||||
<li data-list-item-id="e37c446c42f22aa5fa6417a2521b4ea3f">Check if the new icon pack is displayed there and click on it to see the
|
||||
<li>Check if the new icon pack is displayed there and click on it to see the
|
||||
full list of icons.</li>
|
||||
<li data-list-item-id="e9546ed2a86e5debc1c3146972ce3ae5e">Go through most of the items to look for issues such as missing icon,
|
||||
<li>Go through most of the items to look for issues such as missing icon,
|
||||
wrong names (some icons have aliases/terms that can cause issues).</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e6d48f2f0011e6dbbbf2aedce5a63ddd8">Optionally, assign an icon from the new icon pack to this note. This icon
|
||||
<li>Optionally, assign an icon from the new icon pack to this note. This icon
|
||||
will be used in the icon pack filter for a visual distinction.</li>
|
||||
<li
|
||||
data-list-item-id="e9b5f41994bb6beae98a2d9a1e396fba0">The icon pack can then be <a href="#root/_help_mHbBMPDPkVV5">exported as ZIP</a> in
|
||||
<li>The icon pack can then be <a href="#root/_help_mHbBMPDPkVV5">exported as ZIP</a> in
|
||||
order to be distributed to other users.
|
||||
<ul>
|
||||
<li data-list-item-id="e9a0f122846acf046541a084e505aba81">It's important to note that icon packs are considered “unsafe” by default,
|
||||
<li>It's important to note that icon packs are considered “unsafe” by default,
|
||||
so “Safe mode” must be disabled when importing the ZIP.</li>
|
||||
<li data-list-item-id="e0e3990178843580147bb801c2c629a25">Consider linking new users to the <a class="reference-link" href="#root/_help_gOKqSJgXLcIj">Icon Packs</a> documentation
|
||||
<li>Consider linking new users to the <a class="reference-link" href="#root/_help_gOKqSJgXLcIj">Icon Packs</a> documentation
|
||||
in order to understand how to import and use an icon pack.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Troubleshooting</h3>
|
||||
<p>If the icon pack doesn't show up, look through the <a class="reference-link"
|
||||
href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a> for clues.</p>
|
||||
<ul>
|
||||
<li data-list-item-id="ea20b69c8a700cef8919d3c74cb564d4d">One example is if the font could not be retrieved: <code spellcheck="false">ERROR: Icon pack is missing WOFF/WOFF2/TTF attachment: Boxicons v3 400 (dup) (XRzqDQ67fHEK)</code>.</li>
|
||||
<li
|
||||
data-list-item-id="ec83897ba2caaeb0d906b29e9e4f52a77">Make sure the prefix is unique and not already taken by some other icon
|
||||
<li>One example is if the font could not be retrieved: <code>ERROR: Icon pack is missing WOFF/WOFF2/TTF attachment: Boxicons v3 400 (dup) (XRzqDQ67fHEK)</code>.</li>
|
||||
<li>Make sure the prefix is unique and not already taken by some other icon
|
||||
pack. When there are two icon packs with the same prefix, only one is used.
|
||||
The server logs will indicate if this situation occurs.</li>
|
||||
<li data-list-item-id="ed42cfe9240d7ec8626e512f9322bf8b9">Make sure the prefix consists only of alphanumeric characters, hyphens
|
||||
and underscore.</li>
|
||||
<li>Make sure the prefix consists only of alphanumeric characters, hyphens
|
||||
and underscore.</li>
|
||||
</ul>
|
||||
@@ -382,8 +382,6 @@
|
||||
"tooltip": "Trilium Notes",
|
||||
"close": "Quit Trilium",
|
||||
"recents": "Recent notes",
|
||||
"recently-closed-windows": "Recently closed windows",
|
||||
"tabs-total": "total {{number}} tabs",
|
||||
"bookmarks": "Bookmarks",
|
||||
"today": "Open today's journal note",
|
||||
"new-note": "New note",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</head>
|
||||
<body
|
||||
id="trilium-app"
|
||||
class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %> <%= isMainWindow ? '' : 'extra-window' %>"
|
||||
class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"
|
||||
lang="<%= currentLocale.id %>" dir="<%= currentLocale.rtl ? 'rtl' : 'ltr' %>"
|
||||
>
|
||||
<noscript><%= t("javascript-required") %></noscript>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
isDev: <%= isDev %>,
|
||||
appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>,
|
||||
isMainWindow: <%= isMainWindow %>,
|
||||
windowId: "<%= windowId %>",
|
||||
isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>,
|
||||
triliumVersion: "<%= triliumVersion %>",
|
||||
assetPath: "<%= assetPath %>",
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import cls from "../services/cls.js";
|
||||
import sql from "../services/sql.js";
|
||||
|
||||
export default () => {
|
||||
cls.init(() => {
|
||||
const row = sql.getRow<{ value: string }>(
|
||||
`SELECT value FROM options WHERE name = 'openNoteContexts'`
|
||||
);
|
||||
|
||||
if (!row || !row.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
let parsed: any;
|
||||
try {
|
||||
parsed = JSON.parse(row.value);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
// Already in new format (array + windowId), skip
|
||||
if (
|
||||
Array.isArray(parsed) &&
|
||||
parsed.length > 0 &&
|
||||
parsed[0] &&
|
||||
typeof parsed[0] === "object" &&
|
||||
parsed[0].windowId
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Old format: just contexts
|
||||
const migrated = [
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: 0,
|
||||
contexts: parsed
|
||||
}
|
||||
];
|
||||
|
||||
sql.execute(
|
||||
`UPDATE options SET value = ? WHERE name = 'openNoteContexts'`,
|
||||
[JSON.stringify(migrated)]
|
||||
);
|
||||
|
||||
});
|
||||
};
|
||||
@@ -6,11 +6,6 @@
|
||||
|
||||
// Migrations should be kept in descending order, so the latest migration is first.
|
||||
const MIGRATIONS: (SqlMigration | JsMigration)[] = [
|
||||
// Migrate openNoteContexts option to the new structured format with window metadata
|
||||
{
|
||||
version: 234,
|
||||
module: async () => import("./0234__migrate_open_note_contexts_format")
|
||||
},
|
||||
// Migrate geo map to collection
|
||||
{
|
||||
version: 233,
|
||||
|
||||
@@ -56,7 +56,6 @@ function index(req: Request, res: Response) {
|
||||
appCssNoteIds: getAppCssNoteIds(),
|
||||
isDev,
|
||||
isMainWindow: view === "mobile" ? true : !req.query.extraWindow,
|
||||
windowId: view !== "mobile" && req.query.extraWindow ? req.query.extraWindow : "main",
|
||||
isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(),
|
||||
triliumVersion: packageJson.version,
|
||||
assetPath,
|
||||
|
||||
@@ -4,7 +4,7 @@ import packageJson from "../../package.json" with { type: "json" };
|
||||
import dataDir from "./data_dir.js";
|
||||
import { AppInfo } from "@triliumnext/commons";
|
||||
|
||||
const APP_DB_VERSION = 234;
|
||||
const APP_DB_VERSION = 233;
|
||||
const SYNC_VERSION = 36;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
|
||||
@@ -72,19 +72,6 @@ function getOptionBool(name: FilterOptionsByType<boolean>): boolean {
|
||||
return val === "true";
|
||||
}
|
||||
|
||||
function getOptionJson(name: OptionNames) {
|
||||
const val = getOptionOrNull(name);
|
||||
|
||||
if (typeof val !== "string") {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(val);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function setOption<T extends OptionNames>(name: T, value: string | OptionDefinitions[T]) {
|
||||
const option = becca.getOption(name);
|
||||
|
||||
@@ -150,7 +137,6 @@ export default {
|
||||
getOption,
|
||||
getOptionInt,
|
||||
getOptionBool,
|
||||
getOptionJson,
|
||||
setOption,
|
||||
createOption,
|
||||
getOptions,
|
||||
|
||||
@@ -45,15 +45,8 @@ async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts =
|
||||
"openNoteContexts",
|
||||
JSON.stringify([
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: "root",
|
||||
active: true
|
||||
}
|
||||
]
|
||||
notePath: "root",
|
||||
active: true
|
||||
}
|
||||
]),
|
||||
false
|
||||
@@ -264,15 +257,8 @@ function initStartupOptions() {
|
||||
"openNoteContexts",
|
||||
JSON.stringify([
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: process.env.TRILIUM_START_NOTE_ID || "root",
|
||||
active: true
|
||||
}
|
||||
]
|
||||
notePath: process.env.TRILIUM_START_NOTE_ID || "root",
|
||||
active: true
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
@@ -147,15 +147,8 @@ async function createInitialDatabase(skipDemoDb?: boolean) {
|
||||
"openNoteContexts",
|
||||
JSON.stringify([
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: startNoteId,
|
||||
active: true
|
||||
}
|
||||
]
|
||||
notePath: startNoteId,
|
||||
active: true
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
@@ -196,38 +196,6 @@ function updateTrayMenu() {
|
||||
return menuItems;
|
||||
}
|
||||
|
||||
function buildClosedWindowsMenu() {
|
||||
const savedWindows = optionService.getOptionJson("openNoteContexts") || [];
|
||||
const openedWindowIds = windowService.getAllWindowIds();
|
||||
const closedWindows = savedWindows
|
||||
.filter(win => !openedWindowIds.includes(win.windowId))
|
||||
.sort((a, b) => { return b.closedAt - a.closedAt; }); // sort by time in descending order
|
||||
const menuItems: Electron.MenuItemConstructorOptions[] = [];
|
||||
|
||||
for (const win of closedWindows) {
|
||||
const activeCtx = win.contexts.find(c => c.active === true);
|
||||
const activateNotePath = (activeCtx ?? win.contexts[0])?.notePath;
|
||||
const activateNoteId = activateNotePath?.split("/").pop() ?? null;
|
||||
if (!activateNoteId) continue;
|
||||
|
||||
// Get the title of the closed window
|
||||
const winTitle = (() => {
|
||||
const raw = becca_service.getNoteTitle(activateNoteId);
|
||||
const truncated = raw.length > 20 ? `${raw.slice(0, 17)}…` : raw;
|
||||
const tabCount = win.contexts.filter(ctx => ctx.mainNtxId === null).length;
|
||||
return tabCount > 1 ? `${truncated} (${t("tray.tabs-total", { number: tabCount })})` : truncated;
|
||||
})();
|
||||
|
||||
menuItems.push({
|
||||
label: winTitle,
|
||||
type: "normal",
|
||||
click: () => win.windowId !== "main" ? windowService.createExtraWindow(win.windowId, "") : windowService.createMainWindow()
|
||||
});
|
||||
}
|
||||
|
||||
return menuItems;
|
||||
}
|
||||
|
||||
const windowVisibilityMenuItems: Electron.MenuItemConstructorOptions[] = [];
|
||||
|
||||
// Only call getWindowTitle if windowVisibilityMap has more than one window
|
||||
@@ -290,12 +258,6 @@ function updateTrayMenu() {
|
||||
icon: getIconPath("recents"),
|
||||
submenu: buildRecentNotesMenu()
|
||||
},
|
||||
{
|
||||
label: t("tray.recently-closed-windows"),
|
||||
type: "submenu",
|
||||
icon: getIconPath("closed-windows"),
|
||||
submenu: buildClosedWindowsMenu()
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
label: t("tray.close"),
|
||||
|
||||
@@ -16,45 +16,28 @@ import { formatDownloadTitle, isMac, isWindows } from "./utils.js";
|
||||
// Prevent the window being garbage collected
|
||||
let mainWindow: BrowserWindow | null;
|
||||
let setupWindow: BrowserWindow | null;
|
||||
let allWindows: BrowserWindow[] = []; // // Used to store all windows, sorted by the order of focus.
|
||||
|
||||
interface WindowEntry {
|
||||
window: BrowserWindow;
|
||||
windowId: string; // custom window ID
|
||||
}
|
||||
let allWindowEntries: WindowEntry[] = [];
|
||||
|
||||
function trackWindowFocus(win: BrowserWindow, windowId: string) {
|
||||
function trackWindowFocus(win: BrowserWindow) {
|
||||
// We need to get the last focused window from allWindows. If the last window is closed, we return the previous window.
|
||||
// Therefore, we need to push the window into the allWindows array every time it gets focused.
|
||||
win.on("focus", () => {
|
||||
allWindowEntries = allWindowEntries.filter(w => !w.window.isDestroyed() && w.window !== win);
|
||||
allWindowEntries.push({ window: win, windowId: windowId });
|
||||
|
||||
allWindows = allWindows.filter(w => !w.isDestroyed() && w !== win);
|
||||
allWindows.push(win);
|
||||
if (!optionService.getOptionBool("disableTray")) {
|
||||
electron.ipcMain.emit("reload-tray");
|
||||
}
|
||||
});
|
||||
|
||||
win.on("closed", () => {
|
||||
cls.wrap(() => {
|
||||
const savedWindows = optionService.getOptionJson("openNoteContexts") || [];
|
||||
|
||||
const win = savedWindows.find(w => w.windowId === windowId);
|
||||
if (win) {
|
||||
win.closedAt = Date.now();
|
||||
}
|
||||
|
||||
optionService.setOption("openNoteContexts", JSON.stringify(savedWindows));
|
||||
})();
|
||||
|
||||
allWindowEntries = allWindowEntries.filter(w => !w.window.isDestroyed());
|
||||
allWindows = allWindows.filter(w => !w.isDestroyed());
|
||||
if (!optionService.getOptionBool("disableTray")) {
|
||||
electron.ipcMain.emit("reload-tray");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function createExtraWindow(extraWindowId: string, extraWindowHash: string) {
|
||||
async function createExtraWindow(extraWindowHash: string) {
|
||||
const spellcheckEnabled = optionService.getOptionBool("spellCheckEnabled");
|
||||
|
||||
const { BrowserWindow } = await import("electron");
|
||||
@@ -73,15 +56,15 @@ async function createExtraWindow(extraWindowId: string, extraWindowHash: string)
|
||||
});
|
||||
|
||||
win.setMenuBarVisibility(false);
|
||||
win.loadURL(`http://127.0.0.1:${port}/?extraWindow=${extraWindowId}${extraWindowHash}`);
|
||||
win.loadURL(`http://127.0.0.1:${port}/?extraWindow=1${extraWindowHash}`);
|
||||
|
||||
configureWebContents(win.webContents, spellcheckEnabled);
|
||||
|
||||
trackWindowFocus(win, extraWindowId);
|
||||
trackWindowFocus(win);
|
||||
}
|
||||
|
||||
electron.ipcMain.on("create-extra-window", (event, arg) => {
|
||||
createExtraWindow(arg.extraWindowId, arg.extraWindowHash);
|
||||
createExtraWindow(arg.extraWindowHash);
|
||||
});
|
||||
|
||||
interface PrintOpts {
|
||||
@@ -185,8 +168,8 @@ async function getBrowserWindowForPrinting(e: IpcMainEvent, notePath: string, ac
|
||||
return { browserWindow, printReport };
|
||||
}
|
||||
|
||||
async function createMainWindow(app?: App) {
|
||||
if (app && "setUserTasks" in app) {
|
||||
async function createMainWindow(app: App) {
|
||||
if ("setUserTasks" in app) {
|
||||
app.setUserTasks([
|
||||
{
|
||||
program: process.execPath,
|
||||
@@ -236,7 +219,7 @@ async function createMainWindow(app?: App) {
|
||||
mainWindow.on("closed", () => (mainWindow = null));
|
||||
|
||||
configureWebContents(mainWindow.webContents, spellcheckEnabled);
|
||||
trackWindowFocus(mainWindow, "main");
|
||||
trackWindowFocus(mainWindow);
|
||||
}
|
||||
|
||||
function getWindowExtraOpts() {
|
||||
@@ -398,15 +381,11 @@ function getMainWindow() {
|
||||
}
|
||||
|
||||
function getLastFocusedWindow() {
|
||||
return allWindowEntries.length > 0 ? allWindowEntries[allWindowEntries.length - 1]?.window : null;
|
||||
return allWindows.length > 0 ? allWindows[allWindows.length - 1] : null;
|
||||
}
|
||||
|
||||
function getAllWindows() {
|
||||
return allWindowEntries.map(e => e.window);
|
||||
}
|
||||
|
||||
function getAllWindowIds(): string[] {
|
||||
return allWindowEntries.map(e => e.windowId);
|
||||
return allWindows;
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -417,6 +396,5 @@ export default {
|
||||
registerGlobalShortcuts,
|
||||
getMainWindow,
|
||||
getLastFocusedWindow,
|
||||
getAllWindows,
|
||||
getAllWindowIds
|
||||
getAllWindows
|
||||
};
|
||||
|
||||
@@ -481,7 +481,7 @@ function renderImage(result: Result, note: SNote | BNote) {
|
||||
|
||||
function renderFile(note: SNote | BNote, result: Result) {
|
||||
if (note.mime === "application/pdf") {
|
||||
result.content = `<iframe class="pdf-view" src="api/notes/${note.noteId}/view"></iframe>`;
|
||||
result.content = `<iframe class="pdf-view" src="../pdfjs/web/viewer.html?file=../../../share/api/notes/${note.noteId}/view"></iframe>`;
|
||||
} else {
|
||||
result.content = `<button type="button" onclick="location.href='api/notes/${note.noteId}/download'">Download file</button>`;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Documentation
|
||||
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/elhSPST0fyf2/Documentation_image.png" width="205" height="162">
|
||||
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/v280Ba21YUiA/Documentation_image.png" width="205" height="162">
|
||||
|
||||
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
|
||||
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.
|
||||
|
||||
110
docs/User Guide/!!!meta.json
vendored
@@ -10073,13 +10073,20 @@
|
||||
"value": "bx bx-file-blank",
|
||||
"isInheritable": false,
|
||||
"position": 140
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "XJGJrpu7F9sh",
|
||||
"isInheritable": false,
|
||||
"position": 150
|
||||
}
|
||||
],
|
||||
"format": "markdown",
|
||||
"dataFileName": "File.md",
|
||||
"attachments": [
|
||||
{
|
||||
"attachmentId": "82as0jgkDvVH",
|
||||
"attachmentId": "FoEnowwOhzLT",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
@@ -10087,7 +10094,7 @@
|
||||
"dataFileName": "File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "FoEnowwOhzLT",
|
||||
"attachmentId": "fZ7VMfQJWuLQ",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
@@ -10095,7 +10102,7 @@
|
||||
"dataFileName": "1_File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "fZ7VMfQJWuLQ",
|
||||
"attachmentId": "hddkgf7kr9g4",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
@@ -10103,7 +10110,7 @@
|
||||
"dataFileName": "2_File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "hddkgf7kr9g4",
|
||||
"attachmentId": "hIg9g5pgsjS3",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
@@ -10111,28 +10118,103 @@
|
||||
"dataFileName": "3_File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "hIg9g5pgsjS3",
|
||||
"attachmentId": "IC0j8LFCOKka",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
"position": 10,
|
||||
"dataFileName": "4_File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "IC0j8LFCOKka",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
"position": 10,
|
||||
"dataFileName": "5_File_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "wNHX24feZRAl",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
"position": 10,
|
||||
"dataFileName": "6_File_image.png"
|
||||
"dataFileName": "5_File_image.png"
|
||||
}
|
||||
],
|
||||
"dirFileName": "File",
|
||||
"children": [
|
||||
{
|
||||
"isClone": false,
|
||||
"noteId": "XJGJrpu7F9sh",
|
||||
"notePath": [
|
||||
"pOsGYCXsbNQG",
|
||||
"KSZ04uQ2D1St",
|
||||
"W8vYD3Q1zjCR",
|
||||
"XJGJrpu7F9sh"
|
||||
],
|
||||
"title": "PDFs",
|
||||
"notePosition": 10,
|
||||
"prefix": null,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "label",
|
||||
"name": "iconClass",
|
||||
"value": "bx bxs-file-pdf",
|
||||
"isInheritable": false,
|
||||
"position": 30
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "IjZS7iK5EXtb",
|
||||
"isInheritable": false,
|
||||
"position": 40
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "RnaPdbciOfeq",
|
||||
"isInheritable": false,
|
||||
"position": 50
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "0vhv7lsOLy82",
|
||||
"isInheritable": false,
|
||||
"position": 60
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "wy8So3yZZlH9",
|
||||
"isInheritable": false,
|
||||
"position": 70
|
||||
},
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "R9pX4DGra2Vt",
|
||||
"isInheritable": false,
|
||||
"position": 80
|
||||
}
|
||||
],
|
||||
"format": "markdown",
|
||||
"dataFileName": "PDFs.md",
|
||||
"attachments": [
|
||||
{
|
||||
"attachmentId": "6IIyelZjiGqC",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
"position": 10,
|
||||
"dataFileName": "PDFs_image.png"
|
||||
},
|
||||
{
|
||||
"attachmentId": "LT2iTknjYoZi",
|
||||
"title": "image.png",
|
||||
"role": "image",
|
||||
"mime": "image/png",
|
||||
"position": 10,
|
||||
"dataFileName": "1_PDFs_image.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
Icon packs are specific to Trilium, so they must either be created from scratch (see below) or imported from a ZIP file from a third-party developer.
|
||||
|
||||
> [!NOTE]
|
||||
> **Icon packs are third-party content**
|
||||
>
|
||||
> **Icon packs are third-party content**
|
||||
>
|
||||
> The Trilium maintainers are not responsible for keeping these icon packs up to date. If you have an issue with a specific icon pack, then the issue must be reported to the third-party developer responsible for it, not the Trilium team.
|
||||
|
||||
To import an icon pack:
|
||||
|
||||
|
Before Width: | Height: | Size: 652 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 612 KiB |
|
Before Width: | Height: | Size: 612 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 15 KiB |
27
docs/User Guide/User Guide/Note Types/File.md
vendored
@@ -12,24 +12,11 @@ Since these files come from an external source, it is not possible to create a _
|
||||
|
||||
### PDFs
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:933/666;" src="File_image.png" width="933" height="666"></figure>
|
||||
|
||||
PDFs can be browsed directly from Trilium.
|
||||
|
||||
Interaction:
|
||||
|
||||
* Press the menu icon at the top-left to see a preview (thumbnail) of all the pages, as well as a table of contents (if the PDF has this information).
|
||||
* See or edit the page number at the top.
|
||||
* Adjust the zoom using the buttons at the top or manually editing the value.
|
||||
* Rotate the document if it's in the wrong orientation.
|
||||
* In the contextual menu:
|
||||
* View two pages at once (great for books).
|
||||
* Toggle annotations (if present in the document).
|
||||
* View document properties.
|
||||
See <a class="reference-link" href="File/PDFs.md">PDFs</a>.
|
||||
|
||||
### Images
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:879/766;" src="4_File_image.png" width="879" height="766"></figure>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:879/766;" src="3_File_image.png" width="879" height="766"></figure>
|
||||
|
||||
Interaction:
|
||||
|
||||
@@ -39,7 +26,7 @@ Interaction:
|
||||
|
||||
### Videos
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:854/700;" src="1_File_image.png" width="854" height="700"></figure>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:854/700;" src="File_image.png" width="854" height="700"></figure>
|
||||
|
||||
Video files can be added in as well. The file is streamed directly, so when accessing the note from a server it doesn't have to download the entire video to start playing it.
|
||||
|
||||
@@ -48,7 +35,7 @@ Video files can be added in as well. The file is streamed directly, so when acce
|
||||
|
||||
### Audio
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:850/243;" src="3_File_image.png" width="850" height="243"></figure>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:850/243;" src="2_File_image.png" width="850" height="243"></figure>
|
||||
|
||||
Adding a supported audio file will reveal a basic audio player that can be used to play it.
|
||||
|
||||
@@ -61,7 +48,7 @@ Interactions:
|
||||
|
||||
### Text files
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:926/347;" src="2_File_image.png" width="926" height="347"></figure>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:926/347;" src="1_File_image.png" width="926" height="347"></figure>
|
||||
|
||||
Files that are identified as containing text will show a preview of their content. One common use case for this type of file is to embed text files whose content is not necessarily of interest to the user, such as third-party libraries or generated content, that can then be downloaded if needed.
|
||||
|
||||
@@ -71,7 +58,7 @@ Since one of the use cases for having files instead of notes is to display large
|
||||
|
||||
### Unknown file types
|
||||
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:532/240;" src="5_File_image.png" width="532" height="240"></figure>
|
||||
<figure class="image image-style-align-center image_resized" style="width:50%;"><img style="aspect-ratio:532/240;" src="4_File_image.png" width="532" height="240"></figure>
|
||||
|
||||
If the file could not be identified as any of the supported file types from above, it will be treated as an unknown file. In this case, all the default interactions will be available such as downloading or opening the file externally, but there will be no preview of the content.
|
||||
|
||||
@@ -88,6 +75,6 @@ If the file could not be identified as any of the supported file types from abov
|
||||
|
||||
* Files are also displayed in the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Note%20List.md">Note List</a> based on their type:
|
||||
|
||||
<img class="image_resized" style="aspect-ratio:853/315;width:50%;" src="6_File_image.png" width="853" height="315">
|
||||
<img class="image_resized" style="aspect-ratio:853/315;width:50%;" src="5_File_image.png" width="853" height="315">
|
||||
* Non-image files can be embedded into text notes as read-only widgets via the <a class="reference-link" href="Text/Include%20Note.md">Include Note</a> functionality.
|
||||
* Image files can be embedded into text notes like normal images via <a class="reference-link" href="Text/Images/Image%20references.md">Image references</a>.
|
||||
BIN
docs/User Guide/User Guide/Note Types/File/1_PDFs_image.png
vendored
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
86
docs/User Guide/User Guide/Note Types/File/PDFs.md
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# PDFs
|
||||
<figure class="image image_resized" style="width:74.34%;"><img style="aspect-ratio:1360/698;" src="PDFs_image.png" width="1360" height="698"></figure>
|
||||
|
||||
PDFs file can be uploaded in Trilium, where they will be displayed without the need to download them first.
|
||||
|
||||
Since v0.102.0, PDFs will be rendered using Trilium's built-in PDF viewer, which is a customization of [Mozilla's PDF.js viewer](https://mozilla.github.io/pdf.js/) (also built-in in the Mozilla Firefox browser). Versions prior to that render PDFs using the browser's default PDF viewer.
|
||||
|
||||
## Storing last position and settings
|
||||
|
||||
For every PDF, Trilium will remember the following information:
|
||||
|
||||
* The current page.
|
||||
* The scroll position, within the current page.
|
||||
* The rotation of the page.
|
||||
|
||||
This makes it useful when reading large documents since the position is remembered automatically. This happens in the background, however it's recorded only a few seconds after stopping any scroll actions.
|
||||
|
||||
> [!TIP]
|
||||
> Technically, the information about the scroll position and rotation is stored in the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Notes/Attachments.md">Attachments</a> section, in a dedicated attachment called `pdfHistory.json`.
|
||||
|
||||
## Annotations
|
||||
|
||||
Since v0.102.0 it's possible to annotate PDFs. To do so, look for the annotation buttons on the right side of the PDF toolbar (<img src="1_PDFs_image.png" width="120" height="32">).
|
||||
|
||||
### Supported annotations
|
||||
|
||||
The following annotation methods are supported:
|
||||
|
||||
* **Highlight**
|
||||
Allows highlighting text with one of the predefined colors.
|
||||
* The thickness is also adjustable.
|
||||
* It's also possible to highlight the blank space, turning the feature more into a thicker pen.
|
||||
* **Text**
|
||||
Allows adding arbitrary text, with a custom color and size.
|
||||
* **Pen**
|
||||
Allows free drawing on the document, with variable color, thickness and opacity.
|
||||
* **Image**
|
||||
Allows inserting images from outside Trilium directly into the document.
|
||||
|
||||
### Editing existing annotations
|
||||
|
||||
Although annotations are stored in the PDF itself, they can be edited. To edit an annotation, press one of the annotation buttons from the previous section to enter edit mode and click on an existing annotation. This will reveal a toolbar with options to customize the annotation (e.g. to change a color), as well as the possibility to remove it.
|
||||
|
||||
### How are annotations stored
|
||||
|
||||
Annotations are stored directly in the PDF. When modifications are made, Trilium will replace the PDF with the new one.
|
||||
|
||||
Since modifications are automatically saved, there's no need to manually save the document after making modifications to the annotations.
|
||||
|
||||
The benefit of “baked-in annotations” is that they are also accessible if downloading (for external use outside Trilium) or sharing the note.
|
||||
|
||||
The downside is that the entire PDF needs to be sent back to the server, which can slow down performance for larger documents. If you encounter any issues from this system, feel free to [report it](../../Troubleshooting/Reporting%20issues.md).
|
||||
|
||||
## Filling out forms
|
||||
|
||||
Similar to annotations, forms are also supported by Trilium since v0.102.0. If the document has fields that can be filled-in, they will be indicated with a colored background.
|
||||
|
||||
Simply type text in the forms and they will be automatically saved.
|
||||
|
||||
## Sidebar navigation
|
||||
|
||||
> [!NOTE]
|
||||
> This feature is only available if <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/New%20Layout.md">New Layout</a> is enabled. If you are using the old layout, these features are still available by looking for a sidebar button in the PDF viewer toolbar.
|
||||
|
||||
When a PDF file is opened in Trilium the <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/UI%20Elements/Right%20Sidebar.md">Right Sidebar</a> is augmented with PDF-specific navigation, with the following features:
|
||||
|
||||
* Table of contents/outline
|
||||
* All the headings and “bookmarks” will be displayed hierarchially.
|
||||
* The heading on the current page is also highlighted (note that it can be slightly offset depending on how many headings are on the same page).
|
||||
* Clicking on a heading will jump to the corresponding position in the PDF.
|
||||
* Pages
|
||||
* A preview of all the pages with a small thumbnail.
|
||||
* Clicking on a page will automatically navigate to that page.
|
||||
* Attachments
|
||||
* If the PDF has its own attachments (not to be confused with Trilium's <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Notes/Attachments.md">Attachments</a>), they will be displayed in a list.
|
||||
* Some information such as the name and size of the attachment are displayed.
|
||||
* It's possible to download the attachment by clicking on the download button.
|
||||
* Layers
|
||||
* A less common feature, if the PDF has toggle-able layers, these layers will be displayed in a list here.
|
||||
* It's possible to toggle the visibility for each individual layer.
|
||||
|
||||
## Share functionality
|
||||
|
||||
PDFs can also be shared using the <a class="reference-link" href="../../Advanced%20Usage/Sharing.md">Sharing</a> feature. This will also use Trilium's customized PDF viewer.
|
||||
|
||||
If you are using a reverse proxy on your server with strict access limitations for the share functionality, make sure that `[host].com/pdfjs` directory is accessible. Note that this directory is outside the `/share` route as it's common with the rest of the application.
|
||||
BIN
docs/User Guide/User Guide/Note Types/File/PDFs_image.png
vendored
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
docs/User Guide/User Guide/Note Types/File_image.png
vendored
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 652 KiB |
@@ -12,3 +12,12 @@
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
#downloadButton,
|
||||
#secondaryDownload {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#secondaryOpenFile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ async function main() {
|
||||
|
||||
app.eventBus.on("documentloaded", () => {
|
||||
manageSave();
|
||||
manageDownload();
|
||||
extractAndSendToc();
|
||||
setupScrollToHeading();
|
||||
setupActiveHeadingTracking();
|
||||
@@ -85,4 +86,15 @@ function manageSave() {
|
||||
});
|
||||
}
|
||||
|
||||
function manageDownload() {
|
||||
window.addEventListener("message", event => {
|
||||
if (event.origin !== window.location.origin) return;
|
||||
|
||||
if (event.data?.type === "trilium-request-download") {
|
||||
const app = window.PDFViewerApplication;
|
||||
app.eventBus.dispatch("download", { source: window });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||