An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
{
"ID": "20211226120508-yzh70eh",
"Spec": "2",
"Type": "NodeDocument",
"Properties": {
"id": "20211226120508-yzh70eh",
"title": "嵌入內容區塊",
"type": "doc",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20211226120744-k3bw3kf",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20211226120744-k3bw3kf",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "概述"
}
]
},
{
"ID": "20211226120744-0dnr5d6",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-0dnr5d6",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入內容區塊依查詢在目前位置顯示所需內容區塊,適合彙整任務、整理主題或集中檢視分散的筆記。"
}
]
},
{
"ID": "20261024163828-coroj4x",
"Type": "NodeHeading",
"Properties": {
"id": "20261024163828-coroj4x",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "插入 SQL 嵌入"
}
],
"HeadingLevel": 3
},
{
"ID": "20261024163828-y1fb0xe",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024163828-y1fb0xe",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "將 SQL 查詢放在 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{{"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "}}"
},
{
"Type": "NodeText",
"Data": " 之間,並獨占一行,例如 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{{ SELECT * FROM blocks WHERE content LIKE '%關鍵字%' }}"
},
{
"Type": "NodeText",
"Data": "。可查詢的資料表和欄位見 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "block-ref",
"TextMarkBlockRefID": "20211226121808-fnxmngk",
"TextMarkBlockRefSubtype": "s",
"TextMarkTextContent": "SQL 索引資料表"
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20261024163828-aotkvz8",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024163828-aotkvz8",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "內容區塊/嵌入"
}
]
},
{
"ID": "20211226120744-67wud4s",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20211226120744-67wud4s",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "示例"
}
]
},
{
"ID": "20211226120744-33v8vjb",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20211226120744-33v8vjb",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20211226120744-piuzjfm",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20211226120744-piuzjfm"
},
"Children": [
{
"ID": "20211226120744-dy9obsv",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-dy9obsv"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢內容中包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "內容區塊"
},
{
"Type": "NodeText",
"Data": " 的列表項:"
}
]
},
{
"ID": "20211226120744-xd6l5b8",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20211226120744-xd6l5b8"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"ID": "20220307092237-il1a9cm",
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%內容區塊%' AND type = 'i' }}\n",
"Properties": {
"id": "20220307092237-il1a9cm"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20211226120744-7zvfv94",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20211226120744-7zvfv94",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20211226120744-89429m7",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-89429m7"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢內容中同時包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "內容區塊"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "引用"
},
{
"Type": "NodeText",
"Data": " 段落區塊:"
}
]
},
{
"ID": "20211226120744-geyuzi2",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20211226120744-geyuzi2",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"ID": "20220307092237-p737tab",
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%內容區塊%' AND content LIKE '%引用%' AND type = 'p' }}\n",
"Properties": {
"id": "20220307092237-p737tab"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20211226120744-kvhl45z",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20211226120744-kvhl45z"
},
"Children": [
{
"ID": "20211226120744-o1nml8h",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-o1nml8h"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢內容中同時包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "內容區塊"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "嵌入"
},
{
"Type": "NodeText",
"Data": " 的標題區塊並按更新時間降序結果取前 2 條:"
}
]
},
{
"ID": "20211226120744-z791pb9",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20211226120744-z791pb9"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"ID": "20220307092237-15k4ape",
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%內容區塊%' AND content LIKE '%嵌入%' AND type = 'h' ORDER BY updated DESC LIMIT 2 }}\n",
"Properties": {
"id": "20220307092237-15k4ape"
}
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
}
]
},
{
"ID": "20211226120744-m07di8w",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20211226120744-m07di8w",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例一"
}
]
},
{
"ID": "20211226120744-4up21i9",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-4up21i9",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢最近更新的 7 個非空段落區塊:"
}
]
},
{
"ID": "20211226120744-om182d6",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20211226120744-om182d6",
"style": "height: 149px;",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE type = 'p' AND content != '' ORDER BY updated DESC LIMIT 7"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20211226120744-jsi9w11",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20211226120744-jsi9w11",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例二"
}
]
},
{
"ID": "20211226120744-4akirlb",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-4akirlb",
"updated": "20260730184353"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢包含標簽 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#內容區塊/嵌入#"
},
{
"Type": "NodeText",
"Data": " 或 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#內容區塊/引用#"
},
{
"Type": "NodeText",
"Data": " 的段落區塊:"
}
]
},
{
"ID": "20211226120744-xrkqego",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20211226120744-xrkqego",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE (content LIKE '%#內容區塊/嵌入#%' OR content LIKE '%#內容區塊/引用#%') AND hpath NOT LIKE '%嵌入內容區塊%' AND type = 'p'"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20211226120744-jmbp9wm",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20211226120744-jmbp9wm",
"updated": "20211225234425"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例三"
}
]
},
{
"ID": "20211226120744-c2der0w",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-c2der0w",
"updated": "20260730184353"
},
"Children": [
{
"Type": "NodeText",
"Data": "有時候我們可能需要隨機漫遊顯示內容區塊,以方便回顧。"
}
]
},
{
"ID": "20211226120744-233ma1p",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20211226120744-233ma1p",
"updated": "20211225234425"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks ORDER BY random() LIMIT 3"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20211226120744-9fcpf0i",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20211226120744-9fcpf0i",
"updated": "20260612202457"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例四"
}
]
},
{
"ID": "20211226120744-gzaqyix",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226120744-gzaqyix",
"updated": "20211228134246"
},
"Children": [
{
"Type": "NodeText",
"Data": "查詢未完成的任務列表項,這裡需要使用 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "markdown"
},
{
"Type": "NodeText",
"Data": " 欄位而不是 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "content"
},
{
"Type": "NodeText",
"Data": " 欄位:"
}
]
},
{
"ID": "20211226120744-6ayofcc",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20211226120744-6ayofcc",
"updated": "20211225234425"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE markdown LIKE '%[ ]%' AND subtype = 't' AND type = 'i'"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20260612202457-cgu87b8",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20260612202457-cgu87b8",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入區塊執行 JavaScript"
}
]
},
{
"ID": "20260612202457-piyz66c",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-piyz66c",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入區塊支援透過 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "//!js"
},
{
"Type": "NodeText",
"Data": " 前綴執行 JavaScript 程式碼,動態決定要嵌入哪些區塊,適合 SQL 查詢無法滿足的複雜場景。"
}
]
},
{
"ID": "20260924143000-oesbt3o",
"Type": "NodeParagraph",
"Properties": {
"id": "20260924143000-oesbt3o",
"updated": "20260924143000"
},
"Children": [
{
"Type": "NodeText",
"Data": "匯出圖片或 PDF 時會渲染 JavaScript 嵌入區塊,並等待指令碼和區塊查詢完成後再匯出。安全模式和遠端核心環境仍然禁止執行指令碼。"
}
]
},
{
"ID": "20260612202457-tp9uaus",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202457-tp9uaus",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "編輯方式"
}
]
},
{
"ID": "20260612202457-9r9tm6j",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-9r9tm6j",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "在嵌入區塊編輯框中輸入以 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "//!js"
},
{
"Type": "NodeText",
"Data": " 開頭的程式碼即可進入 JS 模式。"
}
]
},
{
"ID": "20260612202457-kbzaaf1",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202457-kbzaaf1",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "可用的上下文變數"
}
]
},
{
"ID": "20260612202457-ud0zzkc",
"Type": "NodeTable",
"TableAligns": [
0,
0,
0
],
"Properties": {
"colgroup": "||",
"id": "20260612202457-ud0zzkc",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeTableHead",
"Data": "thead",
"Children": [
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "參數"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "型別"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "說明"
}
]
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "fetchSyncPost"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "(url, data?, headers?, process?, signal?) => Promise<IWebSocketData>"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "發起非同步 POST 請求,使用 await 或 .then() 讀取回應;第三個參數是請求標頭物件,不是回呼函式"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "item"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "HTMLElement"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "當前嵌入區塊 DOM 元素"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "protyle"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "IProtyle"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "當前文件的 Protyle 編輯器實例"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "top"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "number | undefined"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "捲動位置(前進/後退定位用)"
}
]
}
]
}
]
},
{
"ID": "20260612202457-zngmbbn",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202457-zngmbbn",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "返回值"
}
]
},
{
"ID": "20260612202457-1ew3mlh",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-1ew3mlh",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "要自動渲染內容區塊,請"
},
{
"Type": "NodeTextMark",
"TextMarkType": "strong",
"TextMarkTextContent": "返回一個區塊 ID 陣列"
},
{
"Type": "NodeText",
"Data": "("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "string[]"
},
{
"Type": "NodeText",
"Data": ",格式為 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "YYYYMMDDHHMMSS-[a-z0-9]{7}"
},
{
"Type": "NodeText",
"Data": "),支援同步與非同步:"
}
]
},
{
"ID": "20260612202457-4h59iyd",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202457-4h59iyd",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\n// 同步返回\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20261024162311-90tdh0l",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024162311-90tdh0l",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "也可以傳回 Promise。下面是另一種寫法,與上面的同步範例分別使用:"
}
]
},
{
"ID": "20261024162311-x9caqoi",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20261024162311-x9caqoi",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\n// 非同步返回(Promise 會被自動 await)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待辦\" })\n .then(r => r.data.blocks.map(b => b.id));\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202457-sj5i3ja",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-sj5i3ja",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "返回陣列中 ID 的順序即為最終顯示順序。"
}
]
},
{
"ID": "20260612202457-2da64g3",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202457-2da64g3",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "實用範例"
}
]
},
{
"ID": "20260612202457-lzfif1r",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-lzfif1r",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入固定的幾個區塊:"
}
]
},
{
"ID": "20260612202457-x9j6wcc",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202457-x9j6wcc",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202457-7196e3q",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-7196e3q",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "透過全文搜尋動態獲取:"
}
]
},
{
"ID": "20260612202457-68k9wdn",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202457-68k9wdn",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst resp = await fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待辦\" });\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nreturn resp.data.blocks.map(b => b.id);\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202457-41bqs87",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-41bqs87",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "取得目前文件的直接子區塊:"
}
]
},
{
"ID": "20260612202457-groigh0",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202457-groigh0",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst docID = protyle.block.rootID;\nconst resp = await fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nreturn resp.data.map(b => b.id);\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202457-1ch46fk",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-1ch46fk",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "按自訂屬性過濾:"
}
]
},
{
"ID": "20260612202457-btr2ts2",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202457-btr2ts2",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst resp = await fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) => attrs[\"custom-tag\"] === \"重要\")\n .map(([id]) => id);\nreturn filtered;\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202457-90085nz",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202457-90085nz",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "特性與限制"
}
]
},
{
"ID": "20260612202457-5m8wdz1",
"Type": "NodeList",
"ListData": {
"Typ": 1
},
"Properties": {
"id": "20260612202457-5m8wdz1",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20260612202457-bgzz268",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "MS4=",
"Num": 1
},
"Properties": {
"id": "20260612202457-bgzz268",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202457-ac1guia",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-ac1guia",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "不做自動索引"
},
{
"Type": "NodeText",
"Data": ":JS 模式嵌入區塊需要瀏覽器執行環境,後端不會自動索引更新內容,由前端主動渲染"
}
]
}
]
},
{
"ID": "20260612202457-1ppogvu",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "Mi4=",
"Num": 2
},
"Properties": {
"id": "20260612202457-1ppogvu",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202457-8btanut",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-8btanut",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "最大巢狀 4 層"
},
{
"Type": "NodeText",
"Data": ":嵌入區塊內的嵌入區塊最多遞迴渲染 4 層,超出部分不再展開"
}
]
}
]
},
{
"ID": "20260612202457-jifsodl",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "My4=",
"Num": 3
},
"Properties": {
"id": "20260612202457-jifsodl",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202457-n56xksf",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-n56xksf",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "不巢狀自身型別"
},
{
"Type": "NodeText",
"Data": ":嵌入區塊內部不會再次嵌入其他 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "query_embed"
},
{
"Type": "NodeText",
"Data": " 區塊"
}
]
}
]
},
{
"ID": "20260612202457-sc73hud",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NC4=",
"Num": 4
},
"Properties": {
"id": "20260612202457-sc73hud",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20260612202457-jv0rdwa",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-jv0rdwa",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "渲染與錯誤提示:返回區塊 ID 陣列時自動渲染對應內容區塊,沒有結果時顯示「引用已過期」;返回非陣列時保留指令碼自訂的 DOM 並結束載入;執行異常時顯示實際錯誤訊息"
}
]
}
]
},
{
"ID": "20260612202457-cnmbf67",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NS4=",
"Num": 5
},
"Properties": {
"id": "20260612202457-cnmbf67",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202457-3sr59u6",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202457-3sr59u6",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "安全性"
},
{
"Type": "NodeText",
"Data": ":後端渲染/匯出時會移除 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "<script>"
},
{
"Type": "NodeText",
"Data": " 標籤和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "javascript:"
},
{
"Type": "NodeText",
"Data": " 協定等危險內容"
}
]
}
]
}
]
}
]
}