const state = await mn.api('/notes/' + noteid + '/comments');
if (state.error) throw new Error(state.error.code);
const r = await mn.api('/notes/' + noteid + '/comments/fold', {
method: 'POST',
body: {
targets: [{ index: 1 }],
collapsed: true,
expectedRevision: state.revision,
confirm: true
}
});
if (r.error) mn.log(r.error.code);{
"persisted": true,
"noteid": "D3085422-2CB9-4B68-A78D-DEE351CF9C38",
"collapsed": true,
"requestedCount": 1,
"changedCount": 1,
"affectedOwnerNoteIds": [
"D3085422-2CB9-4B68-A78D-DEE351CF9C38"
],
"revision": "ccbf2fc6b50a1b61d4aa62f94b4d9589f0a7f3c1e2d5a1b3c4d5e6f708192a3b",
"comments": [
{
"index": 1,
"ownerNoteId": "D3085422-2CB9-4B68-A78D-DEE351CF9C38",
"commentId": "1F4C2A90-6C2B-4E1F-9F3A-2B7C1D5E8A44",
"collapsed": true,
"type": "TextNote",
"text": "这句话是本段的中心句。"
}
]
}折叠或展开卡片批注
修改一条或多条批注的折叠状态。该接口改的是批注列表里的 Comment 级状态,不是脑图分支的
collapsed / mindclose 状态。
调用前先读取 GET /notes/{noteid}/comments。请求里的 expectedRevision 必须使用该响应顶层
的 revision。revision 属于当前卡片的完整批注投影,不在单条批注上。
targets 支持两种定位方式:
{ "index": 1 }:按GET /notes/{noteid}/comments返回的 1 起始序号定位。序号 0 不是批注。{ "ownerNoteId": "...", "commentId": "..." }:按实际归属卡片与稳定批注身份定位。
较早的批注可能没有 commentId,读取时返回 null。这类批注首次修改建议用 index 定位。
引用卡显示原卡共享批注时,应在当前显示用的卡片 noteid 上调用本接口;宿主会把共享批注写回
实际 ownerNoteId。
const state = await mn.api('/notes/' + noteid + '/comments');
if (state.error) throw new Error(state.error.code);
const r = await mn.api('/notes/' + noteid + '/comments/fold', {
method: 'POST',
body: {
targets: [{ index: 1 }],
collapsed: true,
expectedRevision: state.revision,
confirm: true
}
});
if (r.error) mn.log(r.error.code);{
"persisted": true,
"noteid": "D3085422-2CB9-4B68-A78D-DEE351CF9C38",
"collapsed": true,
"requestedCount": 1,
"changedCount": 1,
"affectedOwnerNoteIds": [
"D3085422-2CB9-4B68-A78D-DEE351CF9C38"
],
"revision": "ccbf2fc6b50a1b61d4aa62f94b4d9589f0a7f3c1e2d5a1b3c4d5e6f708192a3b",
"comments": [
{
"index": 1,
"ownerNoteId": "D3085422-2CB9-4B68-A78D-DEE351CF9C38",
"commentId": "1F4C2A90-6C2B-4E1F-9F3A-2B7C1D5E8A44",
"collapsed": true,
"type": "TextNote",
"text": "这句话是本段的中心句。"
}
]
}路径参数
卡片的 noteid。取自卡片命令响应的 noteid、POST /notes/batch-get 响应里 items[].noteid,或 GET /ui-state 的 state.focusnoteid。
请求体
要折叠或展开的批注。重复目标返回 422 INVALID_INPUT。
1 - 200 elements批注折叠目标。只能使用 index 或 ownerNoteId + commentId 其中一种定位方式。
index 来自 GET /notes/{noteid}/comments,从 1 开始。较早的批注可能没有 commentId,
这类条目使用 index 定位。
- Option 1
- Option 2
Show child attributes
Show child attributes
true 折叠,false 展开。
GET /notes/{noteid}/comments 响应顶层的 revision。读写之间批注投影变化时返回 409 COMMENT_CHANGED。
必填。由 MarginNote 自动补上。
响应
批注折叠结果。看 persisted 与是否存在 error 判断写入是否成功。
写操作响应的公共部分。部分接口另带自己的字段。