Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:memo: https://github.com/siyuan-note/siyuan/issues/12176

Daniel15853e7368ed
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201117112518-dott91x.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201117112518-dott91x.sy
index 54b3be23a1..4fc2923dc5 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201117112518-dott91x.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201117112518-dott91x.sy
@@ -6,7 +6,7 @@
"id": "20201117112518-dott91x",
"title": "Embed Content Block",
"type": "doc",
- "updated": "20240731204825"
+ "updated": "20260612202529"
},
"Children": [
{
@@ -581,7 +581,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20210630172523-9xe9jj2",
- "updated": "20210630172530"
+ "updated": "20260612202529"
},
"Children": [
{
@@ -647,6 +647,881 @@
"Type": "NodeCloseBrace"
}
]
+ },
+ {
+ "ID": "20260612202529-iytdii0",
+ "Type": "NodeHeading",
+ "HeadingLevel": 2,
+ "Properties": {
+ "id": "20260612202529-iytdii0",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Embed Block JavaScript Execution"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-yw2m7sw",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-yw2m7sw",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Embed blocks support executing JavaScript code via the "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ prefix, allowing dynamic determination of which blocks to embed. This is suitable for complex scenarios where SQL queries are insufficient"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-36g9e2h",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202529-36g9e2h",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "How to Edit"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-gki8m5i",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-gki8m5i",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Enter code starting with "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ in the embed block editor to enter JS mode"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-9d8y4l1",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202529-9d8y4l1",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Available Context Variables"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-qhxlt57",
+ "Type": "NodeTable",
+ "TableAligns": [
+ 0,
+ 0,
+ 0
+ ],
+ "Properties": {
+ "colgroup": "||",
+ "id": "20260612202529-qhxlt57",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTableHead",
+ "Data": "thead",
+ "Children": [
+ {
+ "Type": "NodeTableRow",
+ "Data": "tr",
+ "Children": [
+ {
+ "Type": "NodeTableCell",
+ "Data": "th",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Parameter"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "th",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Type"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "th",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Description"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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, callback?) =\u0026gt; void"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Send synchronous POST request"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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": "The current embed block DOM element"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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": "The current document's Protyle editor instance"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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 \u0026#124; undefined"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Scroll position (for forward/back navigation)"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-n0b2kco",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202529-n0b2kco",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Return Value"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-n7a8u46",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-n7a8u46",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "You must "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "return an array of block IDs"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " ("
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "string[]"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​, format: "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "YYYYMMDDHHMMSS-[a-z0-9]{7}"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​). Both synchronous and asynchronous returns are supported:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-mimar76",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202529-mimar76",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "// Synchronous return\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n\n// Asynchronous return (Promise will be automatically await'd)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"todo\" })\n .then(r =\u003e r.data.blocks.map(b =\u003e b.id));\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-fkmdwuz",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-fkmdwuz",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "The order of IDs in the returned array determines the final display order"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-tm04p7m",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202529-tm04p7m",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Practical Examples"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-n6xesmj",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-n6xesmj",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Embed a fixed set of blocks:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-prxsrxp",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202529-prxsrxp",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-mqqlrsl",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-mqqlrsl",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Dynamically fetch via full-text search:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-jid9olh",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202529-jid9olh",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"todo\" });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-7oe7nua",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-7oe7nua",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Get all child blocks of the current document:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-hnj4v12",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202529-hnj4v12",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst docID = protyle.block.rootID;\nconst resp = fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-ovpa5wl",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-ovpa5wl",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Filter by custom attributes:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-8as8rn5",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202529-8as8rn5",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) =\u003e attrs[\"custom-tag\"] === \"important\")\n .map(([id]) =\u003e id);\nreturn filtered;\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-f1btjt3",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202529-f1btjt3",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "Features and Limitations"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-xxa1lw6",
+ "Type": "NodeList",
+ "ListData": {
+ "Typ": 1
+ },
+ "Properties": {
+ "id": "20260612202529-xxa1lw6",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-0wxcq3g",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "MS4=",
+ "Num": 1
+ },
+ "Properties": {
+ "id": "20260612202529-0wxcq3g",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-d7yq1k9",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-d7yq1k9",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "No automatic indexing"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ": JS-mode embed blocks require a browser runtime environment, so the backend does not auto-index their content. The frontend handles rendering proactively"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-qs5d5rg",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "Mi4=",
+ "Num": 2
+ },
+ "Properties": {
+ "id": "20260612202529-qs5d5rg",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-ywzi343",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-ywzi343",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Maximum 4 levels of nesting"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ": Embed blocks nested inside embed blocks are recursively rendered up to 4 levels deep; deeper levels are not expanded"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-ra1leyg",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "My4=",
+ "Num": 3
+ },
+ "Properties": {
+ "id": "20260612202529-ra1leyg",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-4k96j6t",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-4k96j6t",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "No self-type nesting"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ": Embed blocks will not embed other "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "query_embed"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ blocks inside them"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-2ju81sc",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NC4=",
+ "Num": 4
+ },
+ "Properties": {
+ "id": "20260612202529-2ju81sc",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-itlebo8",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-itlebo8",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Error display"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ": When JS execution fails or returns a non-array value, \"Reference expired\" is displayed"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202529-vtu370m",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NS4=",
+ "Num": 5
+ },
+ "Properties": {
+ "id": "20260612202529-vtu370m",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "ID": "20260612202529-pyx0zis",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202529-pyx0zis",
+ "updated": "20260612202529"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "Security"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ": The backend removes "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "\u0026lt;script\u0026gt;"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ tags and "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "javascript:"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ protocols and other dangerous content during rendering/export"
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
]
}
\ No newline at end of file
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201117101902-2ewjjum.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201117101902-2ewjjum.sy
index fc7eb61c03..d130586430 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201117101902-2ewjjum.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201117101902-2ewjjum.sy
@@ -6,7 +6,7 @@
"id": "20201117101902-2ewjjum",
"title": "嵌入内容块",
"type": "doc",
- "updated": "20240731204712"
+ "updated": "20260612202926"
},
"Children": [
{
@@ -15,13 +15,9 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210111224435-y1fesd1",
- "updated": "20210512154656"
+ "updated": "20260612202926"
},
"Children": [
- {
- "Type": "NodeHeadingC8hMarker",
- "Data": "## "
- },
{
"Type": "NodeText",
"Data": "概述"
@@ -33,7 +29,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-1ros46z",
- "updated": "20210512154659"
+ "updated": "20260612202926"
},
"Children": [
{
@@ -47,7 +43,7 @@
},
{
"Type": "NodeText",
- "Data": " 和 "
+ "Data": "​ 和 "
},
{
"Type": "NodeTextMark",
@@ -56,7 +52,7 @@
},
{
"Type": "NodeText",
- "Data": " 将 SQL 脚本包裹起来并独占一行:"
+ "Data": "​ 将 SQL 脚本包裹起来并独占一行:"
},
{
"Type": "NodeTextMark",
@@ -65,7 +61,7 @@
},
{
"Type": "NodeText",
- "Data": ",数据库表请参考"
+ "Data": "​,数据库表请参考"
},
{
"Type": "NodeTextMark",
@@ -82,6 +78,10 @@
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "内容块/嵌入"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
}
]
},
@@ -90,13 +90,10 @@
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
- "id": "20201224120447-e6zyfti"
+ "id": "20201224120447-e6zyfti",
+ "updated": "20201224120447"
},
"Children": [
- {
- "Type": "NodeHeadingC8hMarker",
- "Data": "## "
- },
{
"Type": "NodeText",
"Data": "示例"
@@ -106,12 +103,7 @@
{
"ID": "20201224120447-znjkoy5",
"Type": "NodeList",
- "ListData": {
- "BulletChar": 42,
- "Padding": 2,
- "Marker": "Kg==",
- "Num": -1
- },
+ "ListData": {},
"Properties": {
"id": "20201224120447-znjkoy5",
"updated": "20210503152123"
@@ -120,22 +112,21 @@
{
"ID": "20201224120447-n30ybcs",
"Type": "NodeListItem",
- "Data": "*",
"ListData": {
"BulletChar": 42,
- "Padding": 2,
- "Marker": "Kg==",
- "Num": -1
+ "Marker": "Kg=="
},
"Properties": {
- "id": "20201224120447-n30ybcs"
+ "id": "20201224120447-n30ybcs",
+ "updated": "20201224120447"
},
"Children": [
{
"ID": "20201224120447-qmgtpok",
"Type": "NodeParagraph",
"Properties": {
- "id": "20201224120447-qmgtpok"
+ "id": "20201224120447-qmgtpok",
+ "updated": "20201224120447"
},
"Children": [
{
@@ -149,7 +140,15 @@
},
{
"Type": "NodeText",
- "Data": " 的列表项:"
+ "Data": "​ 的"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "列表项"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":"
}
]
},
@@ -157,36 +156,26 @@
"ID": "20201224120447-7zxu4l5",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
- "CodeBlockFenceChar": 96,
- "CodeBlockFenceLen": 3,
- "CodeBlockOpenFence": "YGBg",
- "CodeBlockInfo": "c3Fs",
- "CodeBlockCloseFence": "YGBg",
"Properties": {
- "id": "20201224120447-7zxu4l5"
+ "id": "20201224120447-7zxu4l5",
+ "updated": "20201224120447"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
- "ID": "20220307091943-nnvt195",
"Type": "NodeCodeBlockCode",
- "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND type = 'i' }}\n",
- "Properties": {
- "id": "20220307091943-nnvt195"
- }
+ "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND type = 'i' }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
}
]
}
@@ -195,23 +184,21 @@
{
"ID": "20201224120447-s8m8new",
"Type": "NodeListItem",
- "Data": "*",
"ListData": {
- "Tight": true,
"BulletChar": 42,
- "Padding": 2,
- "Marker": "Kg==",
- "Num": -1
+ "Marker": "Kg=="
},
"Properties": {
- "id": "20201224120447-s8m8new"
+ "id": "20201224120447-s8m8new",
+ "updated": "20201224120447"
},
"Children": [
{
"ID": "20201224120447-5c10xrv",
"Type": "NodeParagraph",
"Properties": {
- "id": "20201224120447-5c10xrv"
+ "id": "20201224120447-5c10xrv",
+ "updated": "20201224120447"
},
"Children": [
{
@@ -225,7 +212,7 @@
},
{
"Type": "NodeText",
- "Data": " 和 "
+ "Data": "​ 和 "
},
{
"Type": "NodeTextMark",
@@ -234,7 +221,15 @@
},
{
"Type": "NodeText",
- "Data": " 段落块:"
+ "Data": "​ "
+ },
+ {
+ "Type": "NodeText",
+ "Data": "段落块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":"
}
]
},
@@ -242,36 +237,26 @@
"ID": "20201224120447-0y91i5d",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
- "CodeBlockFenceChar": 96,
- "CodeBlockFenceLen": 3,
- "CodeBlockOpenFence": "YGBg",
- "CodeBlockInfo": "c3Fs",
- "CodeBlockCloseFence": "YGBg",
"Properties": {
- "id": "20201224120447-0y91i5d"
+ "id": "20201224120447-0y91i5d",
+ "updated": "20201224120447"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
- "ID": "20220307091943-yr7wm1v",
"Type": "NodeCodeBlockCode",
- "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%引用%' AND type = 'p') }}\n",
- "Properties": {
- "id": "20220307091943-yr7wm1v"
- }
+ "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%引用%' AND type = 'p') }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
}
]
}
@@ -280,16 +265,13 @@
{
"ID": "20201224120447-7lzhgko",
"Type": "NodeListItem",
- "Data": "*",
"ListData": {
- "Tight": true,
"BulletChar": 42,
- "Padding": 2,
- "Marker": "Kg==",
- "Num": -1
+ "Marker": "Kg=="
},
"Properties": {
- "id": "20201224120447-7lzhgko"
+ "id": "20201224120447-7lzhgko",
+ "updated": "20201224120447"
},
"Children": [
{
@@ -311,7 +293,7 @@
},
{
"Type": "NodeText",
- "Data": " 和 "
+ "Data": "​ 和 "
},
{
"Type": "NodeTextMark",
@@ -320,7 +302,15 @@
},
{
"Type": "NodeText",
- "Data": " 的标题块并按更新时间降序结果取前 2 条:"
+ "Data": "​ 的标题块并按更新时间降序结果取前 "
+ },
+ {
+ "Type": "NodeText",
+ "Data": "2"
+ },
+ {
+ "Type": "NodeText",
+ "Data": " 条:"
}
]
},
@@ -328,36 +318,26 @@
"ID": "20201224120447-zgg5lvx",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
- "CodeBlockFenceChar": 96,
- "CodeBlockFenceLen": 3,
- "CodeBlockOpenFence": "YGBg",
- "CodeBlockInfo": "c3Fs",
- "CodeBlockCloseFence": "YGBg",
"Properties": {
- "id": "20201224120447-zgg5lvx"
+ "id": "20201224120447-zgg5lvx",
+ "updated": "20201224120447"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
- "ID": "20220307091943-wjxtfog",
"Type": "NodeCodeBlockCode",
- "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%嵌入%' AND type = 'h' ORDER BY updated DESC LIMIT 2 }}\n",
- "Properties": {
- "id": "20220307091943-wjxtfog"
- }
+ "Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%嵌入%' AND type = 'h' ORDER BY updated DESC LIMIT 2 }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
- "Data": "```",
- "CodeBlockFenceLen": 3
+ "Data": "```"
}
]
}
@@ -370,13 +350,10 @@
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
- "id": "20201224120447-fnapz6h"
+ "id": "20201224120447-fnapz6h",
+ "updated": "20201224120447"
},
"Children": [
- {
- "Type": "NodeHeadingC8hMarker",
- "Data": "### "
- },
{
"Type": "NodeText",
"Data": "案例一"
@@ -387,7 +364,8 @@
"ID": "20201224120447-acd7hwp",
"Type": "NodeParagraph",
"Properties": {
- "id": "20201224120447-acd7hwp"
+ "id": "20201224120447-acd7hwp",
+ "updated": "20201224120447"
},
"Children": [
{
@@ -401,7 +379,7 @@
},
{
"Type": "NodeText",
- "Data": " 和 "
+ "Data": "​ 和 "
},
{
"Type": "NodeTextMark",
@@ -410,7 +388,23 @@
},
{
"Type": "NodeText",
- "Data": " 文本的段落块,并排除当前文档(否则当段落块也会包含到结果集中,因为当前段落同样包含了这两个文本,下面的案例类似):"
+ "Data": "​ 文本的"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "段落块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",并排除当前文档(否则当"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "段落块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "也会包含到结果集中,因为当前段落同样包含了这两个文本,下面的案例类似):"
}
]
},
@@ -449,10 +443,6 @@
"updated": "20240731204712"
},
"Children": [
- {
- "Type": "NodeHeadingC8hMarker",
- "Data": "### "
- },
{
"Type": "NodeText",
"Data": "案例二"
@@ -487,7 +477,15 @@
},
{
"Type": "NodeText",
- "Data": "​ 的段落块:"
+ "Data": "​ 的"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "段落块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":"
}
]
},
@@ -496,7 +494,6 @@
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20201224120447-veyqmvr",
- "style": "height: 100px;",
"updated": "20240731204356"
},
"Children": [
@@ -523,13 +520,10 @@
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
- "id": "20201224120447-v7yfh5v"
+ "id": "20201224120447-v7yfh5v",
+ "updated": "20201224120447"
},
"Children": [
- {
- "Type": "NodeHeadingC8hMarker",
- "Data": "### "
- },
{
"Type": "NodeText",
"Data": "案例三"
@@ -540,21 +534,30 @@
"ID": "20201224120447-s5zmpsa",
"Type": "NodeParagraph",
"Properties": {
- "id": "20201224120447-s5zmpsa"
+ "id": "20201224120447-s5zmpsa",
+ "updated": "20201224120447"
},
"Children": [
{
"Type": "NodeText",
- "Data": "有时候我们可能需要随机漫游显示内容块,以方便回顾。"
+ "Data": "有时候我们可能需要随机漫游显示"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "内容块"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ",以方便回顾。"
}
]
},
{
"ID": "20201224120447-kewa9nr",
"Type": "NodeBlockQueryEmbed",
- "Data": "{{SELECT * FROM blocks ORDER BY random() LIMIT 3}}\n",
"Properties": {
- "id": "20201224120447-kewa9nr"
+ "id": "20201224120447-kewa9nr",
+ "updated": "20201224120447"
},
"Children": [
{
@@ -581,7 +584,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20210630172050-m3pgmkt",
- "updated": "20210630172057"
+ "updated": "20260612202058"
},
"Children": [
{
@@ -600,7 +603,23 @@
"Children": [
{
"Type": "NodeText",
- "Data": "查询未完成的任务列表项,这里需要使用 "
+ "Data": "查询未完成的任务"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "列表项"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ","
+ },
+ {
+ "Type": "NodeText",
+ "Data": "这里"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "需要使用 "
},
{
"Type": "NodeTextMark",
@@ -609,7 +628,7 @@
},
{
"Type": "NodeText",
- "Data": " 字段而不是 "
+ "Data": "​ 字段而不是 "
},
{
"Type": "NodeTextMark",
@@ -618,7 +637,7 @@
},
{
"Type": "NodeText",
- "Data": " 字段:"
+ "Data": "​ 字段:"
}
]
},
@@ -647,6 +666,881 @@
"Type": "NodeCloseBrace"
}
]
+ },
+ {
+ "ID": "20260612202058-4nvpz56",
+ "Type": "NodeHeading",
+ "HeadingLevel": 2,
+ "Properties": {
+ "id": "20260612202058-4nvpz56",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "嵌入块执行 JavaScript"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-q54zwf8",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-q54zwf8",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "嵌入块支持通过 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 前缀执行 JavaScript 代码,动态决定要嵌入哪些块,适合 SQL 查询无法满足的复杂场景"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-1tfila8",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202058-1tfila8",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "编辑方式"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-paqopye",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-paqopye",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "在嵌入块编辑框中输入以 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 开头的代码即可进入 JS 模式"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-u31815k",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202058-u31815k",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "可用的上下文变量"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-ef6nmf4",
+ "Type": "NodeTable",
+ "TableAligns": [
+ 0,
+ 0,
+ 0
+ ],
+ "Properties": {
+ "colgroup": "||",
+ "id": "20260612202058-ef6nmf4",
+ "updated": "20260612202058"
+ },
+ "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, callback?) =\u0026gt; void"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "发起同步 POST 请求"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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 \u0026#124; undefined"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "滚动位置(前进/后退定位用)"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-8ljs229",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202058-8ljs229",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "返回值"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-7u53ctj",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-7u53ctj",
+ "updated": "20260612202058"
+ },
+ "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": "20260612202058-2dobv32",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202058-2dobv32",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "// 同步返回\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n\n// 异步返回(Promise 会被自动 await)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待办\" })\n .then(r =\u003e r.data.blocks.map(b =\u003e b.id));\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-81vbloa",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-81vbloa",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "返回数组中 ID 的顺序即为最终显示顺序"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-dt9gwb2",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202058-dt9gwb2",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "实用示例"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-8quyqb9",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-8quyqb9",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "嵌入固定的几个块:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-tv6co88",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202058-tv6co88",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-nzro8zw",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-nzro8zw",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "通过全文搜索动态获取:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-wp4nan2",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202058-wp4nan2",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待办\" });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-2v9xnq8",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-2v9xnq8",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "获取当前文档下所有子块:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-wvrepjj",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202058-wvrepjj",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst docID = protyle.block.rootID;\nconst resp = fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-kb0mobj",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-kb0mobj",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "按自定义属性过滤:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-6kivtwm",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202058-6kivtwm",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) =\u003e attrs[\"custom-tag\"] === \"重要\")\n .map(([id]) =\u003e id);\nreturn filtered;\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-7o8g0fu",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202058-7o8g0fu",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "特性与限制"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-ih0e8zv",
+ "Type": "NodeList",
+ "ListData": {
+ "Typ": 1
+ },
+ "Properties": {
+ "id": "20260612202058-ih0e8zv",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-x78zwd5",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "MS4=",
+ "Num": 1
+ },
+ "Properties": {
+ "id": "20260612202058-x78zwd5",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-eixyatk",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-eixyatk",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "不做自动索引"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JS 模式嵌入块需要浏览器运行时环境,后端不会自动索引更新内容,由前端主动渲染"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-zjwzokw",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "Mi4=",
+ "Num": 2
+ },
+ "Properties": {
+ "id": "20260612202058-zjwzokw",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-57rsop5",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-57rsop5",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "最大嵌套 4 层"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":嵌入块内的嵌入块最多递归渲染 4 层,超出部分不再展开"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-niuyc9c",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "My4=",
+ "Num": 3
+ },
+ "Properties": {
+ "id": "20260612202058-niuyc9c",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-0x1tkd6",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-0x1tkd6",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "不嵌套自身类型"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":嵌入块内部不会再次嵌入其他 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "query_embed"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 块"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-vuy2gbe",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NC4=",
+ "Num": 4
+ },
+ "Properties": {
+ "id": "20260612202058-vuy2gbe",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-c32za6h",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-c32za6h",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "错误提示"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JS 执行异常或返回非数组时,显示\"引用已过期\""
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202058-8zhr6r3",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NS4=",
+ "Num": 5
+ },
+ "Properties": {
+ "id": "20260612202058-8zhr6r3",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "ID": "20260612202058-qh54hmx",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202058-qh54hmx",
+ "updated": "20260612202058"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "安全性"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":后端渲染/导出时会移除 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "\u0026lt;script\u0026gt;"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 标签和 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "javascript:"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 协议等危险内容"
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
]
}
\ No newline at end of file
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120508-yzh70eh.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120508-yzh70eh.sy
index ca65b0094c..089038cec9 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120508-yzh70eh.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120508-yzh70eh.sy
@@ -6,7 +6,7 @@
"id": "20211226120508-yzh70eh",
"title": "嵌入內容塊",
"type": "doc",
- "updated": "20240731204705"
+ "updated": "20260612202457"
},
"Children": [
{
@@ -528,7 +528,7 @@
"HeadingLevel": 3,
"Properties": {
"id": "20211226120744-9fcpf0i",
- "updated": "20211225234425"
+ "updated": "20260612202457"
},
"Children": [
{
@@ -596,12 +596,879 @@
]
},
{
- "ID": "20211226120744-wyqf6uf",
+ "ID": "20260612202457-cgu87b8",
+ "Type": "NodeHeading",
+ "HeadingLevel": 2,
+ "Properties": {
+ "id": "20260612202457-cgu87b8",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "嵌入塊執行 JavaScript"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-piyz66c",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-piyz66c",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "嵌入塊支援透過 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 前綴執行 JavaScript 程式碼,動態決定要嵌入哪些塊,適合 SQL 查詢無法滿足的複雜場景"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-tp9uaus",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202457-tp9uaus",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "編輯方式"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-9r9tm6j",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-9r9tm6j",
+ "updated": "20260612202457"
+ },
+ "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": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "可用的上下文變數"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-ud0zzkc",
+ "Type": "NodeTable",
+ "TableAligns": [
+ 0,
+ 0,
+ 0
+ ],
+ "Properties": {
+ "colgroup": "||",
+ "id": "20260612202457-ud0zzkc",
+ "updated": "20260612202457"
+ },
+ "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, callback?) =\u0026gt; void"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "發起同步 POST 請求"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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 \u0026#124; undefined"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "捲動位置(前進/後退定位用)"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-zngmbbn",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202457-zngmbbn",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "返回值"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-1ew3mlh",
"Type": "NodeParagraph",
"Properties": {
- "id": "20211226120744-wyqf6uf",
- "updated": "20211226120744"
- }
+ "id": "20260612202457-1ew3mlh",
+ "updated": "20260612202457"
+ },
+ "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": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "// 同步返回\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n\n// 非同步返回(Promise 會被自動 await)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待辦\" })\n .then(r =\u003e r.data.blocks.map(b =\u003e b.id));\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-sj5i3ja",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-sj5i3ja",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "返回陣列中 ID 的順序即為最終顯示順序"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-2da64g3",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202457-2da64g3",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "實用範例"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-lzfif1r",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-lzfif1r",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "嵌入固定的幾個塊:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-x9j6wcc",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202457-x9j6wcc",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-7196e3q",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-7196e3q",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "透過全文搜尋動態獲取:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-68k9wdn",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202457-68k9wdn",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待辦\" });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-41bqs87",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-41bqs87",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "取得當前文件下所有子塊:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-groigh0",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202457-groigh0",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst docID = protyle.block.rootID;\nconst resp = fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-1ch46fk",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-1ch46fk",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "按自訂屬性過濾:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-btr2ts2",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202457-btr2ts2",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) =\u003e attrs[\"custom-tag\"] === \"重要\")\n .map(([id]) =\u003e id);\nreturn filtered;\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-90085nz",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202457-90085nz",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "特性與限制"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-5m8wdz1",
+ "Type": "NodeList",
+ "ListData": {
+ "Typ": 1
+ },
+ "Properties": {
+ "id": "20260612202457-5m8wdz1",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-bgzz268",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "MS4=",
+ "Num": 1
+ },
+ "Properties": {
+ "id": "20260612202457-bgzz268",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-ac1guia",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-ac1guia",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "不做自動索引"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JS 模式嵌入塊需要瀏覽器執行環境,後端不會自動索引更新內容,由前端主動渲染"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-1ppogvu",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "Mi4=",
+ "Num": 2
+ },
+ "Properties": {
+ "id": "20260612202457-1ppogvu",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-8btanut",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-8btanut",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "最大巢狀 4 層"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":嵌入塊內的嵌入塊最多遞迴渲染 4 層,超出部分不再展開"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-jifsodl",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "My4=",
+ "Num": 3
+ },
+ "Properties": {
+ "id": "20260612202457-jifsodl",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-n56xksf",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-n56xksf",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "不巢狀自身型別"
+ },
+ {
+ "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": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-jv0rdwa",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-jv0rdwa",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "錯誤提示"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JS 執行異常或返回非陣列時,顯示「引用已過期」"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202457-cnmbf67",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NS4=",
+ "Num": 5
+ },
+ "Properties": {
+ "id": "20260612202457-cnmbf67",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "ID": "20260612202457-3sr59u6",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202457-3sr59u6",
+ "updated": "20260612202457"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "安全性"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":後端渲染/匯出時會移除 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "\u0026lt;script\u0026gt;"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 標籤和 "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "javascript:"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ 協定等危險內容"
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
]
}
\ No newline at end of file
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-1vvnhju.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-1vvnhju.sy
index 1114a5050e..7b036fff87 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-1vvnhju.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-gvtksyj/20240530101000-1vvnhju.sy
@@ -7,7 +7,7 @@
"id": "20240530101000-1vvnhju",
"title": "埋め込みコンテンツブロック",
"type": "doc",
- "updated": "20240731205025"
+ "updated": "20260612202513"
},
"Children": [
{
@@ -567,7 +567,7 @@
"Properties": {
"ID": "20240530101000-kdlm913",
"id": "20240530101000-liqp77v",
- "updated": "20240530101000"
+ "updated": "20260612202513"
},
"Children": [
{
@@ -638,13 +638,875 @@
]
},
{
- "ID": "20240530101000-r5dvp5m",
+ "ID": "20260612202513-yhlrbpu",
+ "Type": "NodeHeading",
+ "HeadingLevel": 2,
+ "Properties": {
+ "id": "20260612202513-yhlrbpu",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "埋め込みブロックでJavaScriptを実行する"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-yxwvpxl",
"Type": "NodeParagraph",
"Properties": {
- "ID": "20240530101000-25kltp1",
- "id": "20240530101000-r5dvp5m",
- "updated": "20240530101000"
- }
+ "id": "20260612202513-yxwvpxl",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "埋め込みブロックは "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ プレフィックスを使用してJavaScriptコードを実行し、埋め込むブロックを動的に決定できます。SQLクエリでは対応できない複雑なケースに適しています"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-ewrm2vu",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202513-ewrm2vu",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "編集方法"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-ja76rsv",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-ja76rsv",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "埋め込みブロックの編集ボックスで "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "//!js"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ で始まるコードを入力するとJSモードに入ります"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-19hv4qk",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202513-19hv4qk",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "利用可能なコンテキスト変数"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-vhqtc2u",
+ "Type": "NodeTable",
+ "TableAligns": [
+ 0,
+ 0,
+ 0
+ ],
+ "Properties": {
+ "colgroup": "||",
+ "id": "20260612202513-vhqtc2u",
+ "updated": "20260612202513"
+ },
+ "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, callback?) =\u0026gt; void"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "同期POSTリクエストを送信"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "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 \u0026#124; undefined"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​"
+ }
+ ]
+ },
+ {
+ "Type": "NodeTableCell",
+ "Data": "td",
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "スクロール位置(進む/戻るの位置決め用)"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-x2r5w1f",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202513-x2r5w1f",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "戻り値"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-vi0swg2",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-vi0swg2",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "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": "20260612202513-wlx9c05",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202513-wlx9c05",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "// 同期的に返す\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n\n// 非同期的に返す(Promiseは自動的にawaitされる)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"TODO\" })\n .then(r =\u003e r.data.blocks.map(b =\u003e b.id));\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-nnq73ws",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-nnq73ws",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "返された配列内のIDの順序が最終的な表示順序になります"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-l6jncw7",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202513-l6jncw7",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "実用例"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-kuc3bzo",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-kuc3bzo",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "固定のブロックを埋め込む:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-bujer9j",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202513-bujer9j",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-ah8dn5j",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-ah8dn5j",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "全文検索で動的に取得:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-v3xc4yv",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202513-v3xc4yv",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"TODO\" });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-tsy5jda",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-tsy5jda",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "現在のドキュメントのすべての子ブロックを取得:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-xmi5ilb",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202513-xmi5ilb",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst docID = protyle.block.rootID;\nconst resp = fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nreturn resp.data.blocks.map(b =\u003e b.id);\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-zx75ddl",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-zx75ddl",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "カスタム属性でフィルタリング:"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-zj8ks59",
+ "Type": "NodeCodeBlock",
+ "IsFencedCodeBlock": true,
+ "Properties": {
+ "id": "20260612202513-zj8ks59",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeCodeBlockFenceOpenMarker",
+ "Data": "```"
+ },
+ {
+ "Type": "NodeCodeBlockFenceInfoMarker",
+ "CodeBlockInfo": "anM="
+ },
+ {
+ "Type": "NodeCodeBlockCode",
+ "Data": "{{ //!js\nconst resp = fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) =\u003e attrs[\"custom-tag\"] === \"重要\")\n .map(([id]) =\u003e id);\nreturn filtered;\n}}\n"
+ },
+ {
+ "Type": "NodeCodeBlockFenceCloseMarker",
+ "Data": "```"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-sow3tzu",
+ "Type": "NodeHeading",
+ "HeadingLevel": 3,
+ "Properties": {
+ "id": "20260612202513-sow3tzu",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "特性と制限"
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-3lgymqo",
+ "Type": "NodeList",
+ "ListData": {
+ "Typ": 1
+ },
+ "Properties": {
+ "id": "20260612202513-3lgymqo",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-d7nom6r",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "MS4=",
+ "Num": 1
+ },
+ "Properties": {
+ "id": "20260612202513-d7nom6r",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-743m4h2",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-743m4h2",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "自動インデックス非対応"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JSモードの埋め込みブロックはブラウザの実行環境が必要なため、バックエンドは自動的に内容をインデックスせず、フロントエンドがアクティブにレンダリングします"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-wlpr983",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "Mi4=",
+ "Num": 2
+ },
+ "Properties": {
+ "id": "20260612202513-wlpr983",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-87klqer",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-87klqer",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "最大4階層までネスト可能"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":埋め込みブロック内の埋め込みブロックは最大4階層まで再帰的にレンダリングされ、それ以上は展開されません"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-hwfb9c2",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "My4=",
+ "Num": 3
+ },
+ "Properties": {
+ "id": "20260612202513-hwfb9c2",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-n5fiwqt",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-n5fiwqt",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "自身の型をネストしない"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":埋め込みブロックの内部に他の "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "query_embed"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ ブロックが含まれることはありません"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-vevjm1h",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NC4=",
+ "Num": 4
+ },
+ "Properties": {
+ "id": "20260612202513-vevjm1h",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-1eher1f",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-1eher1f",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "エラー表示"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":JSの実行に失敗するか配列以外が返された場合、「参照が期限切れです」と表示されます"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "ID": "20260612202513-7gppogm",
+ "Type": "NodeListItem",
+ "ListData": {
+ "Typ": 1,
+ "Delimiter": 46,
+ "Marker": "NS4=",
+ "Num": 5
+ },
+ "Properties": {
+ "id": "20260612202513-7gppogm",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "ID": "20260612202513-2ig16g2",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20260612202513-2ig16g2",
+ "updated": "20260612202513"
+ },
+ "Children": [
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "strong",
+ "TextMarkTextContent": "セキュリティ"
+ },
+ {
+ "Type": "NodeText",
+ "Data": ":バックエンドでのレンダリング/エクスポート時に "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "\u0026lt;script\u0026gt;"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ タグや "
+ },
+ {
+ "Type": "NodeTextMark",
+ "TextMarkType": "code",
+ "TextMarkTextContent": "javascript:"
+ },
+ {
+ "Type": "NodeText",
+ "Data": "​ プロトコルなどの危険な内容が除去されます"
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
]
}
\ No newline at end of file