mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-02 13:02:00 +08:00
chore(client/ts): port services/render
This commit is contained in:
parent
f3a7de58d5
commit
214a71892d
@ -1,7 +1,12 @@
|
|||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
import bundleService from "./bundle.js";
|
import bundleService from "./bundle.js";
|
||||||
|
import FNote from "../entities/fnote.js";
|
||||||
|
|
||||||
async function render(note, $el) {
|
interface Bundle {
|
||||||
|
html: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function render(note: FNote, $el: JQuery<HTMLElement>) {
|
||||||
const relations = note.getRelations('renderNote');
|
const relations = note.getRelations('renderNote');
|
||||||
const renderNoteIds = relations
|
const renderNoteIds = relations
|
||||||
.map(rel => rel.value)
|
.map(rel => rel.value)
|
||||||
@ -10,7 +15,7 @@ async function render(note, $el) {
|
|||||||
$el.empty().toggle(renderNoteIds.length > 0);
|
$el.empty().toggle(renderNoteIds.length > 0);
|
||||||
|
|
||||||
for (const renderNoteId of renderNoteIds) {
|
for (const renderNoteId of renderNoteIds) {
|
||||||
const bundle = await server.post(`script/bundle/${renderNoteId}`);
|
const bundle = await server.post<Bundle>(`script/bundle/${renderNoteId}`);
|
||||||
|
|
||||||
const $scriptContainer = $('<div>');
|
const $scriptContainer = $('<div>');
|
||||||
$el.append($scriptContainer);
|
$el.append($scriptContainer);
|
Loading…
x
Reference in New Issue
Block a user