mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
refactored promoted attribute change handler
This commit is contained in:
@@ -54,10 +54,7 @@ INSERT INTO notes VALUES('HgaAwBX5zVcP','chartjs',X'2f2a210a202a2043686172742e6a
|
||||
INSERT INTO notes VALUES('IYKhW6LTUpwP','Task manager',replace('<h3>Intro</h3>\n<p>This is a simple example of </p>','\n',char(10)),0,0,'2018-08-28T20:50:48.441Z','2018-08-28T20:50:48.441Z','text','text/html','xffZ47OsiP');
|
||||
INSERT INTO notes VALUES('L9qettZi0csz','TODO','',0,0,'2018-08-28T20:50:48.468Z','2018-08-28T20:50:48.468Z','text','text/html','pYhbMrsilQ');
|
||||
INSERT INTO notes VALUES('Dyahpf7LroQY','Locations','',0,0,'2018-08-28T20:50:48.478Z','2018-08-28T20:50:48.478Z','text','text/html','T5ttXvR2+2');
|
||||
INSERT INTO notes VALUES('y4T7SoDx38PF','grocery','',0,0,'2018-08-28T20:50:48.486Z','2018-08-28T20:50:48.486Z','text','text/html','vob1eTuqMJ');
|
||||
INSERT INTO notes VALUES('fkkjOqepOiT6','tesco','',0,0,'2018-08-28T20:50:48.499Z','2018-08-28T20:50:48.499Z','text','text/html','ijhqgaquSu');
|
||||
INSERT INTO notes VALUES('nUgD4SYx2gt7','Tags','',0,0,'2018-08-28T20:50:48.506Z','2018-08-28T20:50:48.506Z','text','text/html','f5a1WP0Pz5');
|
||||
INSERT INTO notes VALUES('UzutkVKVydIs','groceries','',0,0,'2018-08-28T20:50:48.518Z','2018-08-28T20:50:48.518Z','text','text/html','1S5rmr2hVm');
|
||||
INSERT INTO notes VALUES('9HHqPxJkLAkl','Done','',0,0,'2018-08-28T20:50:48.527Z','2018-08-28T20:50:48.527Z','text','text/html','3M1b9ysLaG');
|
||||
INSERT INTO notes VALUES('hL4rychNFWZs','Implementation','',0,0,'2018-08-28T20:50:48.537Z','2018-08-28T20:50:48.537Z','text','text/html','8fnUKl/ty7');
|
||||
INSERT INTO notes VALUES('vVhlPtM5YgWe','reconcileAssignments',replace('module.exports = async function(note, categoryRootNote, assignedCategories, labelName, isTaskDone) {\n const found = {};\n \n for (const categoryNote of await categoryRootNote.getChildNotes()) {\n const label = await categoryNote.getLabel(labelName);\n \n if (label) {\n found[label.value] = !isTaskDone && assignedCategories.includes(label.value);\n\n await api.toggleNoteInParent(found[label.value], note.noteId, categoryNote.noteId);\n }\n }\n \n if (!isTaskDone) {\n for (const assignedCategory of assignedCategories) {\n if (!found[assignedCategory]) {\n const categoryNote = (await api.createNote(categoryRootNote.noteId, assignedCategory, "", {\n attributes: [ { type: "label", name: labelName, value: assignedCategory } ]\n })).note;\n\n await api.ensureNoteIsPresentInParent(note.noteId, categoryNote.noteId);\n }\n }\n }\n}','\n',char(10)),0,0,'2018-08-28T20:50:48.554Z','2018-08-28T20:50:48.554Z','code','application/javascript;env=backend','4jq+oVoENR');
|
||||
@@ -82,8 +79,6 @@ INSERT INTO notes VALUES('eXHZAKsMYgur','Books','<p>Expand note on the left pane
|
||||
INSERT INTO notes VALUES('Lt8IUldw7d7H','Day template','',0,0,'2018-08-29T17:23:45.189Z','2018-08-29T17:23:52.521Z','text','text/html','1V3BTW/Qzw');
|
||||
INSERT INTO notes VALUES('GpGnjmcAPeWG','28 - Tuesday','',0,0,'2017-12-23T03:44:57.036Z','2018-08-29T17:28:22.525Z','text','text/html','JdiPCl+HVd');
|
||||
INSERT INTO notes VALUES('Iha4YwchR413','21 - Thursday','',0,0,'2017-12-23T03:44:21.176Z','2018-08-29T17:28:27.526Z','text','text/html','nf9l6wd8vt');
|
||||
INSERT INTO notes VALUES('MG0wntwILQW6','22 - Friday','<p>Daily summary</p>',0,0,'2017-12-23T01:21:10.517Z','2018-08-29T17:28:32.520Z','text','text/html','OkviiLoTGu');
|
||||
INSERT INTO notes VALUES('cwPuYRAGKtUi','19 - Tuesday','',0,0,'2018-08-29T17:29:16.628Z','2018-08-29T17:29:24.733Z','text','text/html','zzBNYSR1hq');
|
||||
INSERT INTO notes VALUES('tX80udgxnW5n','18 - Monday','',0,0,'2018-08-29T17:29:24.548Z','2018-08-29T17:29:30.389Z','text','text/html','pADkQHkGIg');
|
||||
INSERT INTO notes VALUES('rUsGgtpohm7T','23 - Saturday','',0,0,'2018-08-29T17:29:32.934Z','2018-08-29T17:29:42.287Z','text','text/html','BugaZKKDJ+');
|
||||
INSERT INTO notes VALUES('sXti7HgialF2','24 - Sunday - Christmas Eve!','',0,0,'2018-08-29T17:29:43.127Z','2018-08-29T17:29:57.523Z','text','text/html','RfShVwTOAB');
|
||||
@@ -91,3 +86,21 @@ INSERT INTO notes VALUES('1Fi3MpUkZkLk','20 - Wednesday','',0,0,'2018-08-29T17:2
|
||||
INSERT INTO notes VALUES('kV2NwNNvepGF','js',replace('const ctx = $("#canvas")[0].getContext("2d");\n\nnew chartjs.Chart(ctx, {\n type: ''line'',\n data: await getChartData()\n});','\n',char(10)),0,0,'2018-08-28T20:50:36.092Z','2018-08-29T17:33:52.529Z','code','application/javascript;env=frontend','agNnVWkuJY');
|
||||
INSERT INTO notes VALUES('NGSqsVZkg0Fb','getChartData',replace('module.exports = async function() {\n const days = await api.runOnServer(async () => {\n const notes = await api.getNotesWithLabel(''weight'');\n const days = [];\n\n for (const note of notes) {\n const date = await note.getLabelValue(''dateNote'');\n const weight = parseFloat(await note.getLabelValue(''weight''));\n\n if (date && weight) {\n days.push({ date, weight });\n }\n }\n\n days.sort((a, b) => a.date > b.date ? 1 : -1);\n\n return days;\n });\n\n const datasets = [\n {\n label: "Weight (kg)",\n backgroundColor: ''red'',\n borderColor: ''red'',\n data: days.map(day => day.weight),\n fill: false,\n spanGaps: true,\n datalabels: {\n display: false\n }\n }\n ];\n\n return {\n datasets: datasets,\n labels: days.map(day => day.date)\n };\n}','\n',char(10)),0,0,'2018-08-28T20:50:36.105Z','2018-08-29T17:46:00.512Z','code','application/javascript;env=frontend','+Qo8EFUUf9');
|
||||
INSERT INTO notes VALUES('yK4SBJfwD3tY','Work','<p>Expand note on the left pane to see content.</p><p> </p><p> </p>',0,0,'2017-12-23T04:06:32.833Z','2018-08-29T18:23:35.049Z','text','text/html','my57OxteKd');
|
||||
INSERT INTO notes VALUES('uP3V8BqwXC05','Buy milk','',0,0,'2018-08-29T19:42:32.712Z','2018-08-29T19:42:38.958Z','text','text/html','PGFo1+haU8');
|
||||
INSERT INTO notes VALUES('Z4CC9azzMNhg','tesco','',0,0,'2018-08-29T19:42:47.853Z','2018-08-29T19:42:47.853Z','text','text/html','I6EArEtFH/');
|
||||
INSERT INTO notes VALUES('q6A62bZE2R1r','groceries','',0,0,'2018-08-29T19:42:51.137Z','2018-08-29T19:42:51.137Z','text','text/html','mSbxrm1pq+');
|
||||
INSERT INTO notes VALUES('tQmqkQOMHgQJ','mall','',0,0,'2018-08-29T19:43:40.321Z','2018-08-29T19:43:40.321Z','text','text/html','tRORZ6Y92z');
|
||||
INSERT INTO notes VALUES('Lom0LEnCes1l','christmas','',0,0,'2018-08-29T19:43:44.020Z','2018-08-29T19:43:44.020Z','text','text/html','V8diNwZGLR');
|
||||
INSERT INTO notes VALUES('ydix6JqjXiUm','Maybe Black Swan?','<p><a href="https://en.wikipedia.org/wiki/The_Black_Swan:_The_Impact_of_the_Highly_Improbable">https://en.wikipedia.org/wiki/The_Black_Swan:_The_Impact_of_the_Highly_Improbable</a></p><p> </p><p><i><strong>The Black Swan: The Impact of the Highly Improbable</strong></i> is a 2007 book by author and former <a href="https://en.wikipedia.org/wiki/Options_trader">options trader</a> <a href="https://en.wikipedia.org/wiki/Nassim_Nicholas_Taleb">Nassim Nicholas Taleb</a>. The book focuses on the extreme impact of rare and unpredictable <a href="https://en.wikipedia.org/wiki/Outlier">outlier</a> events — and the human tendency to find simplistic explanations for these events, retrospectively. Taleb calls this the <a href="https://en.wikipedia.org/wiki/Black_Swan_theory">Black Swan theory</a>.</p>',0,0,'2018-08-29T19:46:03.348Z','2018-08-29T19:46:18.965Z','text','text/html','ma55jm1LJ6');
|
||||
INSERT INTO notes VALUES('XoLNnnlwdjBi','Buy some book for Bob','<p>Bob likes to read popular science books so something like that ..</p>',0,0,'2018-08-29T19:43:06.385Z','2018-08-29T19:46:33.959Z','text','text/html','/8VtxyCmab');
|
||||
INSERT INTO notes VALUES('prjUbW6QtsL4','Buy a board game for Alice','',0,0,'2018-08-29T19:46:42.135Z','2018-08-29T19:47:43.954Z','text','text/html','c0hI1KRILc');
|
||||
INSERT INTO notes VALUES('EluAg7EiealE','Get a gym membership','<p>Just in time for new years resolution!</p>',0,0,'2018-08-29T19:53:44.526Z','2018-08-29T19:54:18.702Z','text','text/html','/UwbTs3YGO');
|
||||
INSERT INTO notes VALUES('vkoNZlNO5TO4','gym','',0,0,'2018-08-29T19:54:19.614Z','2018-08-29T19:54:19.614Z','text','text/html','6ZdjkVrgjU');
|
||||
INSERT INTO notes VALUES('cUWgYJfpp8G8','28 - Thursday','',0,0,'2018-08-29T19:55:04.659Z','2018-08-29T19:55:04.659Z','text','text/html','g96BaV8SGj');
|
||||
INSERT INTO notes VALUES('cmYy3Z22F4MY','Dentist appointment','',0,0,'2018-08-29T19:56:35.605Z','2018-08-29T19:56:43.698Z','text','text/html','rNyV4tYv7n');
|
||||
INSERT INTO notes VALUES('2V9Zg9CXdNvn','health','',0,0,'2018-08-29T19:57:02.268Z','2018-08-29T19:57:02.268Z','text','text/html','QQYGpa/4DF');
|
||||
INSERT INTO notes VALUES('d04CnuZxPXj2','shopping','',0,0,'2018-08-29T19:58:59.133Z','2018-08-29T19:58:59.133Z','text','text/html','wWU276L2X9');
|
||||
INSERT INTO notes VALUES('TTl2nD4CqzC9','work','',0,0,'2018-08-29T19:59:38.878Z','2018-08-29T19:59:38.878Z','text','text/html','hIuAZE3DRY');
|
||||
INSERT INTO notes VALUES('ve3Ib30x9nGf','Send invites for christmas party','',0,0,'2018-08-29T19:59:04.328Z','2018-08-29T19:59:39.777Z','text','text/html','d1/wzQEAwD');
|
||||
INSERT INTO notes VALUES('MG0wntwILQW6','22 - Friday','',0,0,'2017-12-23T01:21:10.517Z','2018-08-29T20:01:14.789Z','text','text/html','Jus3ysHko7');
|
||||
INSERT INTO notes VALUES('cwPuYRAGKtUi','19 - Tuesday','',0,0,'2018-08-29T17:29:16.628Z','2018-08-29T17:29:24.733Z','text','text/html','zzBNYSR1hq');
|
||||
|
||||
Reference in New Issue
Block a user