折叠第一条批注
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 调用本接口。
MarginNote 收到请求后,会把改动写回批注实际归属的卡片 ownerNoteId。
POST
/
notes
/
{noteid}
/
comments
/
fold
折叠第一条批注
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": "这句话是本段的中心句。"
}
]
}路径参数
请求体
application/json
响应
批注折叠结果。看 persisted 与是否存在 error 判断写入是否成功。
写操作响应的公共部分。部分接口另带自己的字段。