예제 PDF와 통계 및 표시 속성 한글화와 검증 기록
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
{
|
||||
"version": 4,
|
||||
"changes": [
|
||||
{
|
||||
"noteId": "EW0u2LoAZTYv",
|
||||
"oldTitle": "표 표시 (renderTable)",
|
||||
"title": "표 표시 (renderTable)",
|
||||
"oldContentSha256": "26e6f64bc522c1d9077082929c16a0f11ccdf33b935b3c3d3a288bd15dc3bf1d",
|
||||
"content": "module.exports = counts => {\n const $statsTable = api.$container.find('.stats-table');\n \n addRow('합계', \n counts.reduce((acc, cur) => acc + cur.countNotDeleted, 0), \n counts.reduce((acc, cur) => acc + cur.countDeleted, 0)\n );\n \n for (const count of counts) {\n addRow(({\"text\":\"텍스트\",\"code\":\"코드\",\"file\":\"파일\",\"image\":\"이미지\",\"search\":\"저장된 검색\",\"book\":\"책\",\"relationMap\":\"관계도\",\"noteMap\":\"노트 지도\",\"render\":\"렌더링 노트\",\"mermaid\":\"Mermaid 도표\",\"canvas\":\"캔버스\",\"webView\":\"웹 보기\",\"mindMap\":\"마인드맵\",\"geoMap\":\"지리 지도\",\"doc\":\"도움말\",\"launcher\":\"실행 도구\"})[count.type] || count.type, count.countNotDeleted, count.countDeleted);\n }\n\n function addRow(type, countNotDeleted, countDeleted) {\n $statsTable.append(\n $(\"<tr>\")\n .append($(\"<td>\").text(type))\n .append($(\"<td>\").text(countNotDeleted))\n .append($(\"<td>\").text(countDeleted))\n );\n }\n}"
|
||||
},
|
||||
{
|
||||
"noteId": "WJaFVVj6QO1J",
|
||||
"oldTitle": "자바스크립트 (js)",
|
||||
"title": "자바스크립트 (js)",
|
||||
"oldContentSha256": "47ea6714048328372870e445b73794e6710045412c5ecc6a6601f4b1ec41a04c",
|
||||
"content": "const noteCounts = await api.runOnBackend(() => {\n return api.sql.getRows(`\n SELECT\n type,\n isDeleted,\n SUM(CASE WHEN isDeleted=0 THEN 1 ELSE 0 END) AS countNotDeleted,\n SUM(CASE WHEN isDeleted=1 THEN 1 ELSE 0 END) AS countDeleted\n FROM notes\n GROUP BY type\n ORDER BY countNotDeleted DESC`);\n});\n\nrenderPieChart(noteCounts.map(nc => {\n return {\n name: ({\"text\":\"텍스트\",\"code\":\"코드\",\"file\":\"파일\",\"image\":\"이미지\",\"search\":\"저장된 검색\",\"book\":\"책\",\"relationMap\":\"관계도\",\"noteMap\":\"노트 지도\",\"render\":\"렌더링 노트\",\"mermaid\":\"Mermaid 도표\",\"canvas\":\"캔버스\",\"webView\":\"웹 보기\",\"mindMap\":\"마인드맵\",\"geoMap\":\"지리 지도\",\"doc\":\"도움말\",\"launcher\":\"실행 도구\"})[nc.type] || nc.type,\n count: nc.countNotDeleted\n };\n}));\n\nrenderTable(noteCounts);"
|
||||
},
|
||||
{
|
||||
"noteId": "ga590IKu7zmy",
|
||||
"oldTitle": "속성 변경 처리 (attributechanged)",
|
||||
"title": "속성 변경 처리 (attributechanged)",
|
||||
"oldContentSha256": "6ee6ecf4954ce691d03e2e3f1cfa163652557800ed85a392dfc6c06a7371bc2f",
|
||||
"content": "if (![\"task\", \"location\", \"tag\", \"todoDate\", \"doneDate\"].includes(api.originEntity.name)) {\n return;\n}\n\nconst tagRootNote = api.getNoteWithLabel('taskTagRoot');\nconst doneRootNote = api.getNoteWithLabel('taskDoneRoot');\nconst todoRootNote = api.getNoteWithLabel('taskTodoRoot');\n\nif (!tagRootNote || !doneRootNote || !todoRootNote) {\n console.log(\"태그 또는 완료 목록 또는 할 일 목록의 기준 노트를 찾을 수 없습니다.\");\n return;\n}\n\nconst note = api.originEntity.getNote();\n\nif (note.isDeleted) {\n return;\n}\n \nconst attributes = note.getAttributes();\n\nconst todoDate = note.getLabelValue('todoDate');\nconst doneDate = note.getLabelValue('doneDate');\n\nfunction isWithinExpectedRange(date) {\n if (!date) {\n return true;\n }\n \n const year = parseInt(date.substr(0, 4));\n \n return year >= 2010 && year < 2050;\n}\n\nif (!isWithinExpectedRange(todoDate) || !isWithinExpectedRange(doneDate)) {\n console.log(`날짜가 허용 범위를 벗어났습니다. 예정일: ${todoDate} / 완료일: ${doneDate}`);\n \n return;\n}\n\nconst isTaskDone = !!doneDate;\n\napi.toggleNoteInParent(isTaskDone, note.noteId, doneRootNote.noteId);\napi.toggleNoteInParent(!isTaskDone, note.noteId, todoRootNote.noteId);\n\nconst location = note.getLabelValue('location');\nconst locationRootNote = api.getNoteWithLabel('taskLocationRoot');\n\nreconcileAssignments(note, locationRootNote, location ? [location] : [], 'taskLocationNote', isTaskDone);\n\nconst tags = attributes.filter(attr => attr.type === 'label' && attr.name === 'tag').map(attr => attr.value);\n\nreconcileAssignments(note, tagRootNote, tags, 'taskTagNote', isTaskDone);\n\nnote.toggleLabel(isTaskDone, \"cssClass\", \"done\");\n\nconst doneTargetNoteId = isTaskDone ? api.getDayNote(doneDate).noteId : null;\napi.setNoteToParent(note.noteId, '완료', doneTargetNoteId);\n\nnote.toggleLabel(!isTaskDone, \"cssClass\", \"todo\");\n\nconst todoTargetNoteId = (!isTaskDone && todoDate) ? api.getDayNote(todoDate).noteId : null;\napi.setNoteToParent(note.noteId, '할 일', todoTargetNoteId);"
|
||||
}
|
||||
],
|
||||
"attributes": [
|
||||
{
|
||||
"attributeId": "teXYgLEYyqww",
|
||||
"noteId": "7NfbiSmiVFyR",
|
||||
"name": "label:weight",
|
||||
"value": "promoted,number,single,precision=1,alias=체중",
|
||||
"oldValue": "promoted,number,single,precision=1"
|
||||
},
|
||||
{
|
||||
"attributeId": "Gt3n5YmjWd92",
|
||||
"noteId": "1A2pDj0rZWRk",
|
||||
"name": "label:geolocation",
|
||||
"value": "promoted,single,text,alias=위치 좌표",
|
||||
"oldValue": "promoted,alias=Geolocation,single,text"
|
||||
},
|
||||
{
|
||||
"attributeId": "mNukzJtxNy9F",
|
||||
"noteId": "PF0ofV83QNq9",
|
||||
"name": "label:readingEnd",
|
||||
"value": "promoted,single,date,alias=독서 종료일",
|
||||
"oldValue": "promoted,single,date"
|
||||
},
|
||||
{
|
||||
"attributeId": "84Eslb7zduKM",
|
||||
"noteId": "PF0ofV83QNq9",
|
||||
"name": "label:readingStart",
|
||||
"value": "promoted,single,date,alias=독서 시작일",
|
||||
"oldValue": "promoted,single,date"
|
||||
},
|
||||
{
|
||||
"attributeId": "oOhOmvlQA1l7",
|
||||
"noteId": "PF0ofV83QNq9",
|
||||
"name": "label:author",
|
||||
"value": "promoted,single,text,alias=저자",
|
||||
"oldValue": "promoted,single,text"
|
||||
},
|
||||
{
|
||||
"attributeId": "ovlzSwPHBESP",
|
||||
"noteId": "PF0ofV83QNq9",
|
||||
"name": "label:link",
|
||||
"value": "promoted,single,url,alias=링크",
|
||||
"oldValue": "promoted,single,url"
|
||||
},
|
||||
{
|
||||
"attributeId": "1YTM1UQRQtnt",
|
||||
"noteId": "rjbXo0acF0uE",
|
||||
"name": "label:location",
|
||||
"value": "promoted,text,single,alias=장소",
|
||||
"oldValue": "promoted,text,single"
|
||||
},
|
||||
{
|
||||
"attributeId": "KbYhsredrwOt",
|
||||
"noteId": "rjbXo0acF0uE",
|
||||
"name": "label:tag",
|
||||
"value": "promoted,text,multi,alias=태그",
|
||||
"oldValue": "promoted,text,multi"
|
||||
},
|
||||
{
|
||||
"attributeId": "UE1YHe51q07k",
|
||||
"noteId": "rjbXo0acF0uE",
|
||||
"name": "label:todoDate",
|
||||
"value": "promoted,date,single,alias=예정일",
|
||||
"oldValue": "promoted,date,single"
|
||||
},
|
||||
{
|
||||
"attributeId": "PmBHwLv8Dtf3",
|
||||
"noteId": "rjbXo0acF0uE",
|
||||
"name": "label:doneDate",
|
||||
"value": "promoted,date,single,alias=완료일",
|
||||
"oldValue": "promoted,date,single"
|
||||
}
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"branchId": "E1e6RXYb7KDR_HlLfbi37EMDe",
|
||||
"noteId": "HlLfbi37EMDe",
|
||||
"prefix": "할 일",
|
||||
"oldPrefix": "TODO"
|
||||
},
|
||||
{
|
||||
"branchId": "Zqbx4QzZLAw2_0za9R4spbuOD",
|
||||
"noteId": "0za9R4spbuOD",
|
||||
"prefix": "완료",
|
||||
"oldPrefix": "DONE"
|
||||
},
|
||||
{
|
||||
"branchId": "GIfEhKrDNdnn_2JsGaSEmZSku",
|
||||
"noteId": "2JsGaSEmZSku",
|
||||
"prefix": "완료",
|
||||
"oldPrefix": "DONE"
|
||||
},
|
||||
{
|
||||
"branchId": "GIfEhKrDNdnn_hpxIn2I2IdAJ",
|
||||
"noteId": "hpxIn2I2IdAJ",
|
||||
"prefix": "할 일",
|
||||
"oldPrefix": "TODO"
|
||||
},
|
||||
{
|
||||
"branchId": "m6DbuIecq3cC_BdeGRs0x9xSN",
|
||||
"noteId": "BdeGRs0x9xSN",
|
||||
"prefix": "2017년 11월 28일",
|
||||
"oldPrefix": "28. 11. 2017"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user