MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / importNotesData

Function importNotesData

notes.js:4108–4133  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

4106
4107 // 导入笔记数据(供配置同步使用)
4108 function importNotesData(data) {
4109 try {
4110 if (data.categories && Array.isArray(data.categories)) {
4111 writeJSON(LS_KEYS.categories, data.categories);
4112 }
4113 if (data.notes && typeof data.notes === 'object') {
4114 writeJSON(LS_KEYS.notes, data.notes);
4115 }
4116 if (data.fontColors && Array.isArray(data.fontColors)) {
4117 writeJSON(LS_KEYS.fontColors, data.fontColors);
4118 }
4119 if (data.bgColors && Array.isArray(data.bgColors)) {
4120 writeJSON(LS_KEYS.bgColors, data.bgColors);
4121 }
4122 if (data.trash && Array.isArray(data.trash)) {
4123 writeJSON(LS_KEYS.trash, data.trash); // 添加回收站数据导入
4124 }
4125 if (data.lastSelectedNote) {
4126 writeJSON(LS_KEYS.lastSelectedNote, data.lastSelectedNote);
4127 }
4128 return true;
4129 } catch (error) {
4130 console.error('导入笔记数据失败:', error);
4131 return false;
4132 }
4133 }
4134
4135 window.NodeSeekNotes = {
4136 showNotesDialog: buildDialog,

Callers

nothing calls this directly

Calls 1

writeJSONFunction · 0.85

Tested by

no test coverage detected