mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 08:46:43 +01:00
Compare commits
1 Commits
kev/share-
...
feat/websi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff06376a30 |
@@ -1492,7 +1492,7 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
color: var(--launcher-pane-text-color);
|
||||
background-color: transparent;
|
||||
background: transparent;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,14 +63,6 @@ export default function Card({
|
||||
setBranchIdToEdit?.(branch.branchId);
|
||||
}, [ setBranchIdToEdit, branch ]);
|
||||
|
||||
const handleKeyDown = useCallback((e: KeyboardEvent) => {
|
||||
if (e.key === "Enter") {
|
||||
api.openNote(note.noteId);
|
||||
} else if (e.key === "F2") {
|
||||
setBranchIdToEdit?.(branch.branchId);
|
||||
}
|
||||
}, [ setBranchIdToEdit, note ]);
|
||||
|
||||
useEffect(() => {
|
||||
editorRef.current?.focus();
|
||||
}, [ isEditing ]);
|
||||
@@ -91,11 +83,9 @@ export default function Card({
|
||||
onDragEnd={handleDragEnd}
|
||||
onContextMenu={handleContextMenu}
|
||||
onClick={!isEditing ? handleOpen : undefined}
|
||||
onKeyDown={handleKeyDown}
|
||||
style={{
|
||||
display: !isVisible ? "none" : undefined
|
||||
}}
|
||||
tabIndex={300}
|
||||
>
|
||||
{!isEditing ? (
|
||||
<>
|
||||
|
||||
@@ -50,12 +50,6 @@ export default function Column({
|
||||
openColumnContextMenu(api, e, column);
|
||||
}, [ api, column ]);
|
||||
|
||||
const handleTitleKeyDown = useCallback((e: KeyboardEvent) => {
|
||||
if (e.key === "F2") {
|
||||
setColumnNameToEdit?.(column);
|
||||
}
|
||||
}, [ column ]);
|
||||
|
||||
/** Allow using mouse wheel to scroll inside card, while also maintaining column horizontal scrolling. */
|
||||
const handleScroll = useCallback((event: JSX.TargetedWheelEvent<HTMLDivElement>) => {
|
||||
const el = event.currentTarget;
|
||||
@@ -88,6 +82,7 @@ export default function Column({
|
||||
onDragOver={isAnyColumnDragging ? handleColumnDragOver : handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
onWheel={handleScroll}
|
||||
style={{
|
||||
display: !isVisible ? "none" : undefined
|
||||
}}
|
||||
@@ -98,8 +93,6 @@ export default function Column({
|
||||
onDragStart={handleColumnDragStart}
|
||||
onDragEnd={handleColumnDragEnd}
|
||||
onContextMenu={handleContextMenu}
|
||||
onKeyDown={handleTitleKeyDown}
|
||||
tabIndex={300}
|
||||
>
|
||||
{!isEditing ? (
|
||||
<>
|
||||
@@ -119,35 +112,33 @@ export default function Column({
|
||||
)}
|
||||
</h3>
|
||||
|
||||
<div className="board-column-content" onWheel={handleScroll}>
|
||||
{(columnItems ?? []).map(({ note, branch }, index) => {
|
||||
const showIndicatorBefore = dropPosition?.column === column &&
|
||||
dropPosition.index === index &&
|
||||
draggedCard?.noteId !== note.noteId;
|
||||
{(columnItems ?? []).map(({ note, branch }, index) => {
|
||||
const showIndicatorBefore = dropPosition?.column === column &&
|
||||
dropPosition.index === index &&
|
||||
draggedCard?.noteId !== note.noteId;
|
||||
|
||||
return (
|
||||
<>
|
||||
{showIndicatorBefore && (
|
||||
<div className="board-drop-placeholder show" />
|
||||
)}
|
||||
<Card
|
||||
key={note.noteId}
|
||||
api={api}
|
||||
note={note}
|
||||
branch={branch}
|
||||
column={column}
|
||||
index={index}
|
||||
isDragging={draggedCard?.noteId === note.noteId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
{dropPosition?.column === column && dropPosition.index === (columnItems?.length ?? 0) && (
|
||||
<div className="board-drop-placeholder show" />
|
||||
)}
|
||||
return (
|
||||
<>
|
||||
{showIndicatorBefore && (
|
||||
<div className="board-drop-placeholder show" />
|
||||
)}
|
||||
<Card
|
||||
key={note.noteId}
|
||||
api={api}
|
||||
note={note}
|
||||
branch={branch}
|
||||
column={column}
|
||||
index={index}
|
||||
isDragging={draggedCard?.noteId === note.noteId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
{dropPosition?.column === column && dropPosition.index === (columnItems?.length ?? 0) && (
|
||||
<div className="board-drop-placeholder show" />
|
||||
)}
|
||||
|
||||
<AddNewItem api={api} column={column} />
|
||||
</div>
|
||||
<AddNewItem api={api} column={column} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -155,18 +146,11 @@ export default function Column({
|
||||
function AddNewItem({ column, api }: { column: string, api: BoardApi }) {
|
||||
const [ isCreatingNewItem, setIsCreatingNewItem ] = useState(false);
|
||||
const addItemCallback = useCallback(() => setIsCreatingNewItem(true), []);
|
||||
const handleKeyDown = useCallback((e: KeyboardEvent) => {
|
||||
if (!isCreatingNewItem && e.key === "Enter") {
|
||||
setIsCreatingNewItem(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`board-new-item ${isCreatingNewItem ? "editing" : ""}`}
|
||||
onClick={addItemCallback}
|
||||
onKeyDown={handleKeyDown}
|
||||
tabIndex={300}
|
||||
>
|
||||
{!isCreatingNewItem ? (
|
||||
<>
|
||||
|
||||
@@ -24,13 +24,10 @@
|
||||
border: 2px solid transparent;
|
||||
border-radius: 8px;
|
||||
padding: 0.5em;
|
||||
padding-bottom: 0;
|
||||
background-color: var(--accented-background-color);
|
||||
transition: border-color 0.2s ease;
|
||||
overflow-y: auto;
|
||||
max-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.board-view-container .board-column.drag-over {
|
||||
@@ -40,7 +37,7 @@
|
||||
|
||||
.board-view-container .board-column h3 {
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
margin-bottom: 0.75em;
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
border-bottom: 1px solid var(--main-border-color);
|
||||
cursor: grab;
|
||||
@@ -101,12 +98,6 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.board-view-container .board-column > .board-column-content {
|
||||
flex-grow: 1;
|
||||
overflow: scroll;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.board-view-container .board-column h3:hover .edit-icon,
|
||||
.board-view-container .board-note:hover .edit-icon {
|
||||
opacity: 1;
|
||||
@@ -130,11 +121,6 @@
|
||||
font-size: var(--card-font-size);
|
||||
}
|
||||
|
||||
.board-view-container :focus {
|
||||
outline: 3px solid var(--input-focus-outline-color);
|
||||
outline-offset: 0;
|
||||
}
|
||||
|
||||
.board-view-container .board-note {
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease, margin-top 0.2s ease;
|
||||
}
|
||||
|
||||
@@ -227,12 +227,10 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
|
||||
isNewItem?: boolean;
|
||||
}) {
|
||||
const inputRef = useRef<any>(null);
|
||||
const focusElRef = useRef<Element>(null);
|
||||
const dismissOnNextRefreshRef = useRef(false);
|
||||
const shouldDismiss = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
focusElRef.current = document.activeElement;
|
||||
inputRef.current?.focus();
|
||||
inputRef.current?.select();
|
||||
}, [ inputRef ]);
|
||||
@@ -256,11 +254,8 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin
|
||||
onKeyDown={(e: TargetedKeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||
if (e.key === "Enter" || e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
shouldDismiss.current = (e.key === "Escape");
|
||||
if (focusElRef.current instanceof HTMLElement) {
|
||||
focusElRef.current.focus();
|
||||
}
|
||||
e.currentTarget.blur();
|
||||
}
|
||||
}}
|
||||
onBlur={(newValue) => {
|
||||
|
||||
@@ -59,8 +59,8 @@ function ListNoteCard({ note, parentNote, expand, highlightedTokens }: { note: F
|
||||
const [ isExpanded, setExpanded ] = useState(expand);
|
||||
const notePath = getNotePath(parentNote, note);
|
||||
|
||||
// Reset expand state if switching to another note, or if user manually toggled expansion state.
|
||||
useEffect(() => setExpanded(expand), [ note, expand ]);
|
||||
// Reset expand state if switching to another note.
|
||||
useEffect(() => setExpanded(expand), [ note ]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
|
||||
|
||||
return (
|
||||
<div className="table-view">
|
||||
{rowData !== undefined && persistenceProps && (
|
||||
{persistenceProps && (
|
||||
<>
|
||||
<Tabulator
|
||||
tabulatorRef={tabulatorRef}
|
||||
|
||||
@@ -16,7 +16,7 @@ interface TableProps<T> extends Omit<Options, "data" | "footerElement" | "index"
|
||||
footerElement?: string | HTMLElement | JSX.Element;
|
||||
}
|
||||
|
||||
export default function Tabulator<T>({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, index, dataTree, ...restProps }: TableProps<T>) {
|
||||
export default function Tabulator<T>({ className, columns, data, modules, tabulatorRef: externalTabulatorRef, footerElement, events, index, ...restProps }: TableProps<T>) {
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const tabulatorRef = useRef<VanillaTabulator>(null);
|
||||
@@ -36,7 +36,6 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
|
||||
data,
|
||||
footerElement: (parentComponent && isValidElement(footerElement) ? renderReactWidget(parentComponent, footerElement)[0] : undefined),
|
||||
index: index as string | number | undefined,
|
||||
dataTree,
|
||||
...restProps
|
||||
});
|
||||
|
||||
@@ -46,7 +45,7 @@ export default function Tabulator<T>({ className, columns, data, modules, tabula
|
||||
});
|
||||
|
||||
return () => tabulator.destroy();
|
||||
}, [ dataTree ] );
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const tabulator = tabulatorRef.current;
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
user-select: none;
|
||||
scrollbar-width: 0 !important;
|
||||
}
|
||||
|
||||
.classic-toolbar-widget::-webkit-scrollbar:horizontal {
|
||||
.classic-toolbar-widget::-webkit-scrollbar {
|
||||
height: 0 !important;
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
.classic-toolbar-widget.dropdown-active {
|
||||
|
||||
@@ -116,13 +116,6 @@ class="admonition tip">
|
||||
<td>JavaScript note which will be injected into the share page. JS note must
|
||||
be in the shared sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>shareHtml</code>
|
||||
</td>
|
||||
<td>HTML note which will be injected into the share page at locations specified
|
||||
by the <code>shareHtmlLocation</code> label. HTML note must be in the shared
|
||||
sub-tree as well. Consider using <code>share_hidden_from_tree</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>shareTemplate</code>
|
||||
</td>
|
||||
|
||||
36
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html
generated
vendored
36
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html
generated
vendored
@@ -234,34 +234,6 @@ class="image">
|
||||
This allows you to access note attributes or traverse the note tree using
|
||||
the <code>fetchNote()</code> API, which retrieves note data based on its
|
||||
ID.</p>
|
||||
<h3>Adding custom HTML</h3>
|
||||
<p>You can inject custom HTML snippets into specific locations of the shared
|
||||
page using the <code>~shareHtml</code> relation. The HTML note should contain
|
||||
the raw HTML content you want to inject, and you can control where it appears
|
||||
by adding the <code>#shareHtmlLocation</code> label to the HTML snippet note
|
||||
itself.</p>
|
||||
<p>The <code>#shareHtmlLocation</code> label accepts values in the format <code>location:position</code>:</p>
|
||||
<ul>
|
||||
<li><strong>Locations</strong>: <code>head</code>, <code>body</code>, <code>content</code>
|
||||
</li>
|
||||
<li><strong>Positions</strong>: <code>start</code>, <code>end</code>
|
||||
</li>
|
||||
</ul>
|
||||
<p>For example:</p>
|
||||
<ul>
|
||||
<li><code>#shareHtmlLocation=head:start</code> - Injects HTML at the beginning
|
||||
of the <code><head></code> section</li>
|
||||
<li><code>#shareHtmlLocation=head:end</code> - Injects HTML at the end of the <code><head></code> section
|
||||
(default)</li>
|
||||
<li><code>#shareHtmlLocation=body:start</code> - Injects HTML at the beginning
|
||||
of the <code><body></code> section</li>
|
||||
<li><code>#shareHtmlLocation=content:start</code> - Injects HTML at the beginning
|
||||
of the content area</li>
|
||||
<li><code>#shareHtmlLocation=content:end</code> - Injects HTML at the end of
|
||||
the content area</li>
|
||||
</ul>
|
||||
<p>If no location is specified, the HTML will be injected at <code>content:end</code> by
|
||||
default.</p>
|
||||
<p>Example:</p><pre><code class="language-application-javascript-env-backend">const currentNote = await fetchNote();
|
||||
const parentNote = await fetchNote(currentNote.parentNoteIds[0]);
|
||||
|
||||
@@ -372,14 +344,6 @@ for (const attr of parentNote.attributes) {
|
||||
</td>
|
||||
<td>Note with this label will list all roots of shared notes.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>shareHtmlLocation</code>
|
||||
</td>
|
||||
<td>defines where custom HTML injected via <code>~shareHtml</code> relation
|
||||
should be placed. Applied to the HTML snippet note itself. Format: <code>location:position</code> where
|
||||
location is <code>head</code>, <code>body</code>, or <code>content</code> and
|
||||
position is <code>start</code> or <code>end</code>. Defaults to <code>content:end</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -15,74 +15,61 @@
|
||||
in a hierarchy.</p>
|
||||
<h2>Interaction with columns</h2>
|
||||
<ul>
|
||||
<li data-list-item-id="e53cd56f64ad0a087af5c123894261ff1">Create a new column by pressing <em>Add Column</em> near the last column.
|
||||
<li>Create a new column by pressing <em>Add Column</em> near the last column.
|
||||
<ul>
|
||||
<li data-list-item-id="eaf5a55c795e0cfe57a2a05d6b9f89761">Once pressed, a text box will be displayed to set the name of the column.
|
||||
<li>Once pressed, a text box will be displayed to set the name of the column.
|
||||
Press <kbd>Enter</kbd> to confirm, or <kbd>Escape</kbd> to dismiss.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e2d7f17b56a6a8027d26e5d30f16bd7f6">To reorder a column, simply hold the mouse over the title and drag it
|
||||
<li>To reorder a column, simply hold the mouse over the title and drag it
|
||||
to the desired position.</li>
|
||||
<li data-list-item-id="ef0f57de87814bf725cf846cecca01899">To delete a column, right click on its title and select <em>Delete column</em>.</li>
|
||||
<li
|
||||
data-list-item-id="e00cb99d9b34dbf63523f053a57f28fe8">To rename a column, click on the note title.
|
||||
<li>To delete a column, right click on its title and select <em>Delete column</em>.</li>
|
||||
<li>To rename a column, click on the note title.
|
||||
<ul>
|
||||
<li data-list-item-id="ea86b1d902db4bbab1fe85bcf669c595c">Press Enter to confirm.</li>
|
||||
<li data-list-item-id="e6d1bc52b0a8b3d554fd4be0f1f009b04">Upon renaming a column, the corresponding status attribute of all its
|
||||
<li>Press Enter to confirm.</li>
|
||||
<li>Upon renaming a column, the corresponding status attribute of all its
|
||||
notes will be changed in bulk.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="ea1dd557786a534468e61f445aaea665f">If there are many columns, use the mouse wheel to scroll.</li>
|
||||
</li>
|
||||
<li>If there are many columns, use the mouse wheel to scroll.</li>
|
||||
</ul>
|
||||
<h2>Interaction with notes</h2>
|
||||
<ul>
|
||||
<li data-list-item-id="ec25f6e597c61e1f56422d72a91777cb8">Create a new note in any column by pressing <em>New item</em>
|
||||
<li>Create a new note in any column by pressing <em>New item</em>
|
||||
<ul>
|
||||
<li data-list-item-id="e3027de7ac16543b3a3be526c6700f22e">Enter the name of the note and press <kbd>Enter</kbd> or click away. To
|
||||
<li>Enter the name of the note and press <kbd>Enter</kbd> or click away. To
|
||||
dismiss the creation of a new note, simply press <kbd>Escape</kbd> or leave
|
||||
the name empty.</li>
|
||||
<li data-list-item-id="ef97c736e327952225517534711a8e329">Once created, the new note will have an attribute (<code>status</code> label
|
||||
<li>Once created, the new note will have an attribute (<code>status</code> label
|
||||
by default) set to the name of the column.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e0558241e1901ee6a5b765644c115f95c">To open the note, simply click on it.</li>
|
||||
<li data-list-item-id="e1580878e9963e2039332f9c3ff40dc9d">To change the title of the note directly from the board, hover the mouse
|
||||
<li>To open the note, simply click on it.</li>
|
||||
<li>To change the title of the note directly from the board, hover the mouse
|
||||
over its card and press the edit button on the right.</li>
|
||||
<li data-list-item-id="e817b2e5103fd08622477663a5a8b9683">To change the state of a note, simply drag a note from one column to the
|
||||
<li>To change the state of a note, simply drag a note from one column to the
|
||||
other to change its state.</li>
|
||||
<li data-list-item-id="e5f86d7f2f545470451040860ca3e8890">The order of the notes in each column corresponds to their position in
|
||||
<li>The order of the notes in each column corresponds to their position in
|
||||
the tree.
|
||||
<ul>
|
||||
<li data-list-item-id="e0b47ff4af56dc7cd21a118fbc9b1808a">It's possible to reorder notes simply by dragging them to the desired
|
||||
<li>It's possible to reorder notes simply by dragging them to the desired
|
||||
position within the same columns.</li>
|
||||
<li data-list-item-id="e9eb4fa22b9ed927a24aee3e94d5a1b5d">It's also possible to drag notes across columns, at the desired position.</li>
|
||||
<li>It's also possible to drag notes across columns, at the desired position.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="e94ebbbe060ccfe7fbb1c67616e272b35">For more options, right click on a note to display a context menu with
|
||||
<li>For more options, right click on a note to display a context menu with
|
||||
the following options:
|
||||
<ul>
|
||||
<li data-list-item-id="e5516bb20b5c4534580854c6422107b1d">Open the note in a new tab/split/window or quick edit.</li>
|
||||
<li data-list-item-id="e8419784dbd01baae6c1e1e8875baa84a">Move the note to any column.</li>
|
||||
<li data-list-item-id="e6ab7181ef973bbd96e3bbbfed5e302d1">Insert a new note above/below the current one.</li>
|
||||
<li data-list-item-id="e8aae7a4c6ddb5f191d6dcd914f0c3b78">Archive/unarchive the current note.</li>
|
||||
<li data-list-item-id="e0bf5bc2c60b27a7fd0078001816d8ca4">Delete the current note.</li>
|
||||
<li>Open the note in a new tab/split/window or quick edit.</li>
|
||||
<li>Move the note to any column.</li>
|
||||
<li>Insert a new note above/below the current one.</li>
|
||||
<li>Archive/unarchive the current note.</li>
|
||||
<li>Delete the current note.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="ec32b9f786e2c612fb63677c8c5089365">If there are many notes within the column, move the mouse over the column
|
||||
<li>If there are many notes within the column, move the mouse over the column
|
||||
and use the mouse wheel to scroll.</li>
|
||||
</ul>
|
||||
<h2>Keyboard interaction</h2>
|
||||
<p>The board view has mild support for keyboard-based navigation:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e0c992a7fdac57768851c53137a2cfa64">Use <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> to navigate between
|
||||
column titles, notes and the “New item” button for each of the columns,
|
||||
in sequential order.</li>
|
||||
<li data-list-item-id="e4c143d1ec92d0fc5b75e850cf10f4377">To rename a column or a note, press <kbd>F2</kbd> while it is focused.</li>
|
||||
<li
|
||||
data-list-item-id="ee3008937bdfd14e06c308a5f0846addf">To open a specific note or create a new item, press <kbd>Enter</kbd> while
|
||||
it is focused.</li>
|
||||
<li data-list-item-id="e70ceff80dcd5422e2361c4fbcd805773">To dismiss a rename of a note or a column, press <kbd>Escape</kbd>.</li>
|
||||
</ul>
|
||||
<h2>Configuration</h2>
|
||||
<h3>Grouping by another attribute</h3>
|
||||
<p>By default, the label used to group the notes is <code>#status</code>.
|
||||
@@ -96,5 +83,5 @@ class="admonition note">
|
||||
<h2>Interaction</h2>
|
||||
<h2>Limitations</h2>
|
||||
<ul>
|
||||
<li data-list-item-id="e61ec93de3282934fd37d302933d208b8">It is not possible yet to use group by a relation, only by label.</li>
|
||||
<li>It is not possible yet to use group by a relation, only by label.</li>
|
||||
</ul>
|
||||
@@ -66,7 +66,6 @@ export default [
|
||||
{ type: "label", name: "shareDisallowRobotIndexing" },
|
||||
{ type: "label", name: "shareCredentials" },
|
||||
{ type: "label", name: "shareIndex" },
|
||||
{ type: "label", name: "shareHtmlLocation" },
|
||||
{ type: "label", name: "displayRelations" },
|
||||
{ type: "label", name: "hideRelations" },
|
||||
{ type: "label", name: "titleTemplate", isDangerous: true },
|
||||
@@ -106,7 +105,6 @@ export default [
|
||||
{ type: "relation", name: "renderNote", isDangerous: true },
|
||||
{ type: "relation", name: "shareCss" },
|
||||
{ type: "relation", name: "shareJs" },
|
||||
{ type: "relation", name: "shareHtml" },
|
||||
{ type: "relation", name: "shareTemplate" },
|
||||
{ type: "relation", name: "shareFavicon" }
|
||||
];
|
||||
|
||||
@@ -3,6 +3,7 @@ a.download-button {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1em;
|
||||
font-weight: 500;
|
||||
|
||||
@media (min-width: 720px) {
|
||||
display: flex !important;
|
||||
@@ -11,12 +12,12 @@ a.download-button {
|
||||
.platform {
|
||||
font-size: 0.75em;
|
||||
opacity: 0.75;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
&.big {
|
||||
padding: 0.5em 3.5em;
|
||||
margin: 1em 0;
|
||||
gap: m;
|
||||
text-align: left;
|
||||
|
||||
.platform {
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DownloadButton({ big }: DownloadButtonProps) {
|
||||
Download now{" "}
|
||||
{big
|
||||
? <span class="platform">v{packageJson.version} for {recommendedDownload.name}</span>
|
||||
: <span class="platform">for {recommendedDownload.name}</span>
|
||||
: null
|
||||
}
|
||||
</>}
|
||||
/>
|
||||
@@ -40,7 +40,7 @@ export default function DownloadButton({ big }: DownloadButtonProps) {
|
||||
Download now{" "}
|
||||
{big
|
||||
? <span class="platform">v{packageJson.version} for Linux</span>
|
||||
: <span class="platform">for Linux</span>
|
||||
: null
|
||||
}
|
||||
</>}
|
||||
/>
|
||||
|
||||
26563
docs/User Guide/!!!meta.json
vendored
26563
docs/User Guide/!!!meta.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,5 @@ These relations are supported and used internally by Trilium.
|
||||
| `widget_relation` | target of this relation will be executed and rendered as a widget in the sidebar |
|
||||
| `shareCss` | CSS note which will be injected into the share page. CSS note must be in the shared sub-tree as well. Consider using `share_hidden_from_tree` and `share_omit_default_css` as well. |
|
||||
| `shareJs` | JavaScript note which will be injected into the share page. JS note must be in the shared sub-tree as well. Consider using `share_hidden_from_tree`. |
|
||||
| `shareHtml` | HTML note which will be injected into the share page at locations specified by the `shareHtmlLocation` label. HTML note must be in the shared sub-tree as well. Consider using `share_hidden_from_tree`. |
|
||||
| `shareTemplate` | Embedded JavaScript note that will be used as the template for displaying the shared note. Falls back to the default template. Consider using `share_hidden_from_tree`. |
|
||||
| `shareFavicon` | Favicon note to be set in the shared page. Typically you want to set it to share root and make it inheritable. Favicon note must be in the shared sub-tree as well. Consider using `share_hidden_from_tree`. |
|
||||
@@ -67,25 +67,6 @@ The default design should be a good starting point, but you can customize it usi
|
||||
|
||||
You can inject custom JavaScript into the shared note using the `~shareJs` relation. This allows you to access note attributes or traverse the note tree using the `fetchNote()` API, which retrieves note data based on its ID.
|
||||
|
||||
### Adding custom HTML
|
||||
|
||||
You can inject custom HTML snippets into specific locations of the shared page using the `~shareHtml` relation. The HTML note should contain the raw HTML content you want to inject, and you can control where it appears by adding the `#shareHtmlLocation` label to the HTML snippet note itself.
|
||||
|
||||
The `#shareHtmlLocation` label accepts values in the format `location:position`:
|
||||
|
||||
* **Locations**: `head`, `body`, `content`
|
||||
* **Positions**: `start`, `end`
|
||||
|
||||
For example:
|
||||
|
||||
* `#shareHtmlLocation=head:start` - Injects HTML at the beginning of the `<head>` section
|
||||
* `#shareHtmlLocation=head:end` - Injects HTML at the end of the `<head>` section (default)
|
||||
* `#shareHtmlLocation=body:start` - Injects HTML at the beginning of the `<body>` section
|
||||
* `#shareHtmlLocation=content:start` - Injects HTML at the beginning of the content area
|
||||
* `#shareHtmlLocation=content:end` - Injects HTML at the end of the content area
|
||||
|
||||
If no location is specified, the HTML will be injected at `content:end` by default.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
@@ -125,7 +106,7 @@ To do so, create a shared text note and apply the `shareIndex` label. When viewe
|
||||
|
||||
## Attribute reference
|
||||
|
||||
<table><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>shareHiddenFromTree</code></td><td>this note is hidden from left navigation tree, but still accessible with its URL</td></tr><tr><td><code>shareExternalLink</code></td><td>note will act as a link to an external website in the share tree</td></tr><tr><td><code>shareAlias</code></td><td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code></td></tr><tr><td><code>shareOmitDefaultCss</code></td><td>default share page CSS will be omitted. Use when you make extensive styling changes.</td></tr><tr><td><code>shareRoot</code></td><td>marks note which is served on /share root.</td></tr><tr><td><code>shareDescription</code></td><td>define text to be added to the HTML meta tag for description</td></tr><tr><td><code>shareRaw</code></td><td>Note will be served in its raw format, without HTML wrapper. See also <a class="reference-link" href="Sharing/Serving%20directly%20the%20content%20o.md">Serving directly the content of a note</a> for an alternative method without setting an attribute.</td></tr><tr><td><code>shareDisallowRobotIndexing</code></td><td><p>Indicates to web crawlers that the page should not be indexed of this note by:</p><ul><li data-list-item-id="e6baa9f60bf59d085fd31aa2cce07a0e7">Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li><li data-list-item-id="ec0d067db136ef9794e4f1033405880b7">Setting the <code>noindex, follow</code> meta tag.</li></ul></td></tr><tr><td><code>shareCredentials</code></td><td>require credentials to access this shared note. Value is expected to be in format <code>username:password</code>. Don't forget to make this inheritable to apply to child-notes/images.</td></tr><tr><td><code>shareIndex</code></td><td>Note with this label will list all roots of shared notes.</td></tr><tr><td><code>shareHtmlLocation</code></td><td>defines where custom HTML injected via <code>~shareHtml</code> relation should be placed. Applied to the HTML snippet note itself. Format: <code>location:position</code> where location is <code>head</code>, <code>body</code>, or <code>content</code> and position is <code>start</code> or <code>end</code>. Defaults to <code>content:end</code>.</td></tr></tbody></table>
|
||||
<table><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>shareHiddenFromTree</code></td><td>this note is hidden from left navigation tree, but still accessible with its URL</td></tr><tr><td><code>shareExternalLink</code></td><td>note will act as a link to an external website in the share tree</td></tr><tr><td><code>shareAlias</code></td><td>define an alias using which the note will be available under <code>https://your_trilium_host/share/[your_alias]</code></td></tr><tr><td><code>shareOmitDefaultCss</code></td><td>default share page CSS will be omitted. Use when you make extensive styling changes.</td></tr><tr><td><code>shareRoot</code></td><td>marks note which is served on /share root.</td></tr><tr><td><code>shareDescription</code></td><td>define text to be added to the HTML meta tag for description</td></tr><tr><td><code>shareRaw</code></td><td>Note will be served in its raw format, without HTML wrapper. See also <a class="reference-link" href="Sharing/Serving%20directly%20the%20content%20o.md">Serving directly the content of a note</a> for an alternative method without setting an attribute.</td></tr><tr><td><code>shareDisallowRobotIndexing</code></td><td><p>Indicates to web crawlers that the page should not be indexed of this note by:</p><ul><li data-list-item-id="e6baa9f60bf59d085fd31aa2cce07a0e7">Setting the <code>X-Robots-Tag: noindex</code> HTTP header.</li><li data-list-item-id="ec0d067db136ef9794e4f1033405880b7">Setting the <code>noindex, follow</code> meta tag.</li></ul></td></tr><tr><td><code>shareCredentials</code></td><td>require credentials to access this shared note. Value is expected to be in format <code>username:password</code>. Don't forget to make this inheritable to apply to child-notes/images.</td></tr><tr><td><code>shareIndex</code></td><td>Note with this label will list all roots of shared notes.</td></tr></tbody></table>
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
@@ -39,15 +39,6 @@ Notes are displayed recursively, so even the child notes of the child notes will
|
||||
* Delete the current note.
|
||||
* If there are many notes within the column, move the mouse over the column and use the mouse wheel to scroll.
|
||||
|
||||
## Keyboard interaction
|
||||
|
||||
The board view has mild support for keyboard-based navigation:
|
||||
|
||||
* Use <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> to navigate between column titles, notes and the “New item” button for each of the columns, in sequential order.
|
||||
* To rename a column or a note, press <kbd>F2</kbd> while it is focused.
|
||||
* To open a specific note or create a new item, press <kbd>Enter</kbd> while it is focused.
|
||||
* To dismiss a rename of a note or a column, press <kbd>Escape</kbd>.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Grouping by another attribute
|
||||
|
||||
@@ -1,31 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<%
|
||||
const hasTree = subRoot.note.hasVisibleChildren();
|
||||
|
||||
// Collect HTML snippets by location
|
||||
const htmlSnippetsByLocation = {};
|
||||
for (const htmlRelation of note.getRelations("shareHtml")) {
|
||||
const htmlNote = htmlRelation.targetNote;
|
||||
if (htmlNote) {
|
||||
let location = htmlNote.getLabelValue("shareHtmlLocation") || "content:end";
|
||||
// Default to :end if no position specified
|
||||
if (!location.includes(":")) {
|
||||
location = location + ":end";
|
||||
}
|
||||
if (!htmlSnippetsByLocation[location]) {
|
||||
htmlSnippetsByLocation[location] = [];
|
||||
}
|
||||
htmlSnippetsByLocation[location].push(htmlNote.getContent());
|
||||
}
|
||||
}
|
||||
const renderSnippets = (location) => {
|
||||
const snippets = htmlSnippetsByLocation[location];
|
||||
return snippets ? snippets.join("\n") : "";
|
||||
};
|
||||
%>
|
||||
<%- renderSnippets("head:start") %>
|
||||
<% const hasTree = subRoot.note.hasVisibleChildren(); %>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
@@ -77,7 +53,6 @@
|
||||
<meta name="twitter:image" content="<%= openGraphImage %>">
|
||||
<!-- Meta Tags Generated via https://opengraph.dev -->
|
||||
<meta name="theme-color" content="<%= openGraphColor %>">
|
||||
<%- renderSnippets("head:end") %>
|
||||
</head>
|
||||
<%
|
||||
const customLogoId = subRoot.note.getRelation("shareLogo")?.value;
|
||||
@@ -97,7 +72,6 @@ content = content.replaceAll(headingRe, (...match) => {
|
||||
});
|
||||
%>
|
||||
<body data-note-id="<%= note.noteId %>" class="type-<%= note.type %><%= themeClass %>" data-ancestor-note-id="<%= subRoot.note.noteId %>">
|
||||
<%- renderSnippets("body:start") %>
|
||||
<div id="mobile-header">
|
||||
<a href="<%= shareRootLink %>">
|
||||
<img src="<%= logoUrl %>" width="32" height="<%= mobileLogoHeight %>" alt="Logo" />
|
||||
@@ -147,8 +121,8 @@ content = content.replaceAll(headingRe, (...match) => {
|
||||
</div>
|
||||
<div id="right-pane">
|
||||
<div id="main">
|
||||
|
||||
<div id="content" class="type-<%= note.type %><% if (note.type === "text") { %> ck-content<% } %><% if (isEmpty) { %> no-content<% } %>">
|
||||
<%- renderSnippets("content:start") %>
|
||||
<h1 id="title"><%= note.title %></h1>
|
||||
<% if (isEmpty && (!note.hasVisibleChildren() && note.type !== "book")) { %>
|
||||
<p>This note has no content.</p>
|
||||
@@ -158,7 +132,6 @@ content = content.replaceAll(headingRe, (...match) => {
|
||||
%>
|
||||
<%- content %>
|
||||
<% } %>
|
||||
<%- renderSnippets("content:end") %>
|
||||
</div>
|
||||
|
||||
<% if (note.hasVisibleChildren() || note.type === "book") { %>
|
||||
@@ -191,7 +164,7 @@ content = content.replaceAll(headingRe, (...match) => {
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<% if (hasTree) { %>
|
||||
<% if (hasTree) { %>
|
||||
<%- include("prev_next", { note: note, subRoot: subRoot }) %>
|
||||
<% } %>
|
||||
</footer>
|
||||
@@ -232,6 +205,5 @@ content = content.replaceAll(headingRe, (...match) => {
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<%- renderSnippets("body:end") %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user