mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 16:56:34 +01:00
Compare commits
18 Commits
v0.6.0-bet
...
v0.6.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd02c6102d | ||
|
|
30c712a6be | ||
|
|
3928c96640 | ||
|
|
d86f655658 | ||
|
|
abdad1c3ae | ||
|
|
9e5f1a0a87 | ||
|
|
8028b09351 | ||
|
|
ebe66eaed9 | ||
|
|
5bce9a5f94 | ||
|
|
dfd9927310 | ||
|
|
9bf1735bde | ||
|
|
2e8eeda5ab | ||
|
|
1cef0ce5f9 | ||
|
|
1efac99828 | ||
|
|
0e9473119e | ||
|
|
7bbfef7af3 | ||
|
|
5cb93509c1 | ||
|
|
89e89e04d8 |
1
db/migrations/0076__add_attribute_name_index.sql
Normal file
1
db/migrations/0076__add_attribute_name_index.sql
Normal file
@@ -0,0 +1 @@
|
||||
CREATE INDEX IDX_attributes_name_value ON attributes (name, value);
|
||||
@@ -120,6 +120,7 @@ CREATE INDEX IDX_note_images_noteId ON note_images (noteId);
|
||||
CREATE INDEX IDX_note_images_imageId ON note_images (imageId);
|
||||
CREATE INDEX IDX_note_images_noteId_imageId ON note_images (noteId, imageId);
|
||||
CREATE INDEX IDX_attributes_noteId ON attributes (noteId);
|
||||
CREATE INDEX IDX_attributes_name_value ON attributes (name, value);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "api_tokens"
|
||||
(
|
||||
|
||||
22
electron.js
22
electron.js
@@ -3,9 +3,11 @@
|
||||
const electron = require('electron');
|
||||
const path = require('path');
|
||||
const config = require('./src/services/config');
|
||||
const log = require('./src/services/log');
|
||||
const url = require("url");
|
||||
|
||||
const app = electron.app;
|
||||
const globalShortcut = electron.globalShortcut;
|
||||
|
||||
// Adds debug features like hotkeys for triggering dev tools and reload
|
||||
require('electron-debug')();
|
||||
@@ -67,6 +69,26 @@ app.on('activate', () => {
|
||||
|
||||
app.on('ready', () => {
|
||||
mainWindow = createMainWindow();
|
||||
|
||||
const result = globalShortcut.register('CommandOrControl+Alt+P', async () => {
|
||||
const date_notes = require('./src/services/date_notes');
|
||||
const utils = require('./src/services/utils');
|
||||
|
||||
const parentNoteId = await date_notes.getDateNoteId(utils.nowDate());
|
||||
|
||||
// window may be hidden / not in focus
|
||||
mainWindow.focus();
|
||||
|
||||
mainWindow.webContents.send('create-day-sub-note', parentNoteId);
|
||||
});
|
||||
|
||||
if (!result) {
|
||||
log.error("Could not register global shortcut CTRL+ALT+P");
|
||||
}
|
||||
});
|
||||
|
||||
app.on('will-quit', () => {
|
||||
globalShortcut.unregisterAll();
|
||||
});
|
||||
|
||||
require('./src/www');
|
||||
|
||||
78
package-lock.json
generated
78
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.4.1",
|
||||
"version": "0.6.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -3061,19 +3061,19 @@
|
||||
"integrity": "sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo="
|
||||
},
|
||||
"electron": {
|
||||
"version": "1.8.2-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-1.8.2-beta.4.tgz",
|
||||
"integrity": "sha1-GDayBO6s6dx3Bi7Ugg/bxsvZoZU=",
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-1.8.2.tgz",
|
||||
"integrity": "sha512-0TV5Hy92g8ACnPn+PVol6a/2uk+khzmRtWxhah/FcKs6StCytm5hD14QqOdZxEdJN8HljXIVCayN/wJX+0wDiQ==",
|
||||
"requires": {
|
||||
"@types/node": "8.5.9",
|
||||
"@types/node": "8.9.4",
|
||||
"electron-download": "3.3.0",
|
||||
"extract-zip": "1.6.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.9.tgz",
|
||||
"integrity": "sha512-s+c3AjymyAccTI4hcgNFK4mToH8l+hyPDhu4LIkn71lRy56FLijGu00fyLgldjM/846Pmk9N4KFUs2P8GDs0pA=="
|
||||
"version": "8.9.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.4.tgz",
|
||||
"integrity": "sha512-dSvD36qnQs78G1BPsrZFdPpvLgMW/dnvr5+nTW2csMs5TiP9MOXrjUbnMZOEwnIuBklXtn7b6TPA2Cuq07bDHA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3325,9 +3325,9 @@
|
||||
}
|
||||
},
|
||||
"electron-packager": {
|
||||
"version": "10.1.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-10.1.1.tgz",
|
||||
"integrity": "sha1-MWp/ossf/CYz9YBcn8IJE8vAnZQ=",
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-11.0.1.tgz",
|
||||
"integrity": "sha1-wtH/nsqBEL6evIGCbiqSHATRIA4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"asar": "0.14.0",
|
||||
@@ -3343,13 +3343,19 @@
|
||||
"pify": "3.0.0",
|
||||
"plist": "2.1.0",
|
||||
"pruner": "0.0.7",
|
||||
"rcedit": "0.9.0",
|
||||
"rcedit": "1.0.0",
|
||||
"resolve": "1.4.0",
|
||||
"sanitize-filename": "1.6.1",
|
||||
"semver": "5.4.1",
|
||||
"yargs-parser": "8.1.0"
|
||||
"yargs-parser": "9.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
|
||||
"dev": true
|
||||
},
|
||||
"electron-download": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-download/-/electron-download-4.1.0.tgz",
|
||||
@@ -3437,6 +3443,12 @@
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||
"dev": true
|
||||
},
|
||||
"rcedit": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-1.0.0.tgz",
|
||||
"integrity": "sha512-W7DNa34x/3OgWyDHsI172AG/Lr/lZ+PkavFkHj0QhhkBRcV9QTmRJE1tDKrWkx8XHPSBsmZkNv9OKue6pncLFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"sumchecker": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-2.0.2.tgz",
|
||||
@@ -3456,20 +3468,29 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz",
|
||||
"integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"electron-prebuilt-compile": {
|
||||
"version": "1.8.2-beta.4",
|
||||
"resolved": "https://registry.npmjs.org/electron-prebuilt-compile/-/electron-prebuilt-compile-1.8.2-beta.4.tgz",
|
||||
"integrity": "sha512-whVdRgFEDovWSFrAsbMXIiush6RQ8IV3XhYdL59zShck4U1eXGmdkaBCy+2tlkGmUGr0fRu+S4FpUx2ebBkRhQ==",
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/electron-prebuilt-compile/-/electron-prebuilt-compile-1.8.2.tgz",
|
||||
"integrity": "sha512-wiDVjy8S0PA/K/TUM0lw5gzZ+SmyVVGQ0qt9iFYXHJc6t8TzDXFY3DsoK37H3A7nWnkvXvoPdpJ5/h9KbTMoAw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-array-includes": "2.0.3",
|
||||
"babel-plugin-transform-async-to-generator": "6.24.1",
|
||||
"babel-preset-es2016-node5": "1.1.2",
|
||||
"babel-preset-react": "6.24.1",
|
||||
"electron": "1.8.2-beta.4",
|
||||
"electron": "1.8.2",
|
||||
"electron-compile": "6.4.2",
|
||||
"electron-compilers": "5.9.0",
|
||||
"yargs": "6.6.0"
|
||||
@@ -8472,12 +8493,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"rcedit": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/rcedit/-/rcedit-0.9.0.tgz",
|
||||
"integrity": "sha1-ORDfVzRTmeKwMl9KUZAH+J5V7xw=",
|
||||
"dev": true
|
||||
},
|
||||
"read-all-stream": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz",
|
||||
@@ -11694,23 +11709,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz",
|
||||
"integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "4.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"yauzl": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.6.0-beta",
|
||||
"version": "0.6.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"repository": {
|
||||
@@ -27,7 +27,7 @@
|
||||
"debug": "~3.1.0",
|
||||
"devtron": "^1.4.0",
|
||||
"ejs": "~2.5.7",
|
||||
"electron": "^1.8.2-beta.4",
|
||||
"electron": "^1.8.2",
|
||||
"electron-debug": "^1.5.0",
|
||||
"electron-in-page-search": "^1.2.4",
|
||||
"express": "~4.16.2",
|
||||
@@ -60,8 +60,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron-compile": "^6.4.2",
|
||||
"electron-packager": "^10.1.1",
|
||||
"electron-prebuilt-compile": "1.8.2-beta.4",
|
||||
"electron-packager": "^11.0.1",
|
||||
"electron-prebuilt-compile": "1.8.2",
|
||||
"electron-rebuild": "^1.7.3",
|
||||
"tape": "^4.8.0",
|
||||
"xo": "^0.18.0"
|
||||
|
||||
@@ -38,6 +38,7 @@ async function getDateNoteIdForReddit(dateTimeStr, rootNoteId) {
|
||||
redditDateNoteId = await createNote(dateNoteId, "Reddit");
|
||||
|
||||
await attributes.createAttribute(redditDateNoteId, REDDIT_DATE_ATTRIBUTE, dateStr);
|
||||
await attributes.createAttribute(redditDateNoteId, "hide_in_autocomplete");
|
||||
}
|
||||
|
||||
return redditDateNoteId;
|
||||
|
||||
@@ -30,7 +30,8 @@ const recentNotes = (function() {
|
||||
$dialog.dialog({
|
||||
modal: true,
|
||||
width: 800,
|
||||
height: 400
|
||||
height: 100,
|
||||
position: { my: "center top+100", at: "top", of: window }
|
||||
});
|
||||
|
||||
$searchInput.val('');
|
||||
|
||||
@@ -126,6 +126,10 @@ $.ui.autocomplete.filter = (array, terms) => {
|
||||
|
||||
if (found) {
|
||||
results.push(item);
|
||||
|
||||
if (results.length > 100) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,4 +196,21 @@ $(document).ready(() => {
|
||||
executeScript(script);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (isElectron()) {
|
||||
require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) {
|
||||
// this might occur when day note had to be created
|
||||
if (!noteTree.noteExists(parentNoteId)) {
|
||||
await noteTree.reload();
|
||||
}
|
||||
|
||||
await noteTree.activateNode(parentNoteId);
|
||||
|
||||
setTimeout(() => {
|
||||
const node = noteTree.getCurrentNode();
|
||||
|
||||
noteTree.createNote(node, node.data.noteId, 'into', node.data.isProtected);
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
@@ -116,6 +116,32 @@ const noteEditor = (function() {
|
||||
isNewNoteCreated = true;
|
||||
}
|
||||
|
||||
function setContent(content) {
|
||||
if (currentNote.detail.type === 'text') {
|
||||
// temporary workaround for https://github.com/ckeditor/ckeditor5-enter/issues/49
|
||||
editor.setData(content ? content : "<p></p>");
|
||||
|
||||
noteDetailEl.show();
|
||||
noteDetailCodeEl.hide();
|
||||
noteDetailRenderEl.html('').hide();
|
||||
}
|
||||
else if (currentNote.detail.type === 'code') {
|
||||
noteDetailEl.hide();
|
||||
noteDetailCodeEl.show();
|
||||
noteDetailRenderEl.html('').hide();
|
||||
|
||||
// this needs to happen after the element is shown, otherwise the editor won't be refresheds
|
||||
codeEditor.setValue(content);
|
||||
|
||||
const info = CodeMirror.findModeByMIME(currentNote.detail.mime);
|
||||
|
||||
if (info) {
|
||||
codeEditor.setOption("mode", info.mime);
|
||||
CodeMirror.autoLoadMode(codeEditor, info.mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadNoteToEditor(noteId) {
|
||||
currentNote = await loadNote(noteId);
|
||||
|
||||
@@ -146,30 +172,7 @@ const noteEditor = (function() {
|
||||
noteType.setNoteType(currentNote.detail.type);
|
||||
noteType.setNoteMime(currentNote.detail.mime);
|
||||
|
||||
if (currentNote.detail.type === 'text') {
|
||||
// temporary workaround for https://github.com/ckeditor/ckeditor5-enter/issues/49
|
||||
editor.setData(currentNote.detail.content ? currentNote.detail.content : "<p></p>");
|
||||
|
||||
noteDetailEl.show();
|
||||
noteDetailCodeEl.hide();
|
||||
noteDetailRenderEl.html('').hide();
|
||||
}
|
||||
else if (currentNote.detail.type === 'code') {
|
||||
noteDetailEl.hide();
|
||||
noteDetailCodeEl.show();
|
||||
noteDetailRenderEl.html('').hide();
|
||||
|
||||
// this needs to happen after the element is shown, otherwise the editor won't be refresheds
|
||||
codeEditor.setValue(currentNote.detail.content);
|
||||
|
||||
const info = CodeMirror.findModeByMIME(currentNote.detail.mime);
|
||||
|
||||
if (info) {
|
||||
codeEditor.setOption("mode", info.mime);
|
||||
CodeMirror.autoLoadMode(codeEditor, info.mode);
|
||||
}
|
||||
}
|
||||
else if (currentNote.detail.type === 'render') {
|
||||
if (currentNote.detail.type === 'render') {
|
||||
noteDetailEl.hide();
|
||||
noteDetailCodeEl.hide();
|
||||
noteDetailRenderEl.html('').show();
|
||||
@@ -179,7 +182,7 @@ const noteEditor = (function() {
|
||||
noteDetailRenderEl.html(subTree);
|
||||
}
|
||||
else {
|
||||
throwError("Unrecognized type " + currentNote.detail.type);
|
||||
setContent(currentNote.detail.content);
|
||||
}
|
||||
|
||||
noteChangeDisabled = false;
|
||||
@@ -314,6 +317,7 @@ const noteEditor = (function() {
|
||||
getEditor,
|
||||
focus,
|
||||
executeCurrentNote,
|
||||
loadAttributeList
|
||||
loadAttributeList,
|
||||
setContent
|
||||
};
|
||||
})();
|
||||
@@ -14,6 +14,8 @@ const noteTree = (function() {
|
||||
let parentChildToNoteTreeId = {};
|
||||
let noteIdToTitle = {};
|
||||
|
||||
let hiddenInAutocomplete = {};
|
||||
|
||||
function getNoteTreeId(parentNoteId, childNoteId) {
|
||||
assertArguments(parentNoteId, childNoteId);
|
||||
|
||||
@@ -640,16 +642,21 @@ const noteTree = (function() {
|
||||
return document.location.hash.substr(1); // strip initial #
|
||||
}
|
||||
|
||||
function loadTree() {
|
||||
return server.get('tree').then(resp => {
|
||||
startNotePath = resp.start_note_path;
|
||||
async function loadTree() {
|
||||
const resp = await server.get('tree');
|
||||
startNotePath = resp.start_note_path;
|
||||
|
||||
if (document.location.hash) {
|
||||
startNotePath = getNotePathFromAddress();
|
||||
}
|
||||
if (document.location.hash) {
|
||||
startNotePath = getNotePathFromAddress();
|
||||
}
|
||||
|
||||
return prepareNoteTree(resp.notes);
|
||||
});
|
||||
hiddenInAutocomplete = {};
|
||||
|
||||
for (const noteId of resp.hiddenInAutocomplete) {
|
||||
hiddenInAutocomplete[noteId] = true;
|
||||
}
|
||||
|
||||
return prepareNoteTree(resp.notes);
|
||||
}
|
||||
|
||||
$(() => loadTree().then(noteTree => initFancyTree(noteTree)));
|
||||
@@ -706,6 +713,10 @@ const noteTree = (function() {
|
||||
const autocompleteItems = [];
|
||||
|
||||
for (const childNoteId of parentToChildren[parentNoteId]) {
|
||||
if (hiddenInAutocomplete[childNoteId]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const childNotePath = (notePath ? (notePath + '/') : '') + childNoteId;
|
||||
const childTitlePath = (titlePath ? (titlePath + ' / ') : '') + getNoteTitle(childNoteId, parentNoteId);
|
||||
|
||||
@@ -775,7 +786,7 @@ const noteTree = (function() {
|
||||
};
|
||||
|
||||
if (target === 'after') {
|
||||
node.appendSibling(newNode).setActive(true);
|
||||
await node.appendSibling(newNode).setActive(true);
|
||||
}
|
||||
else if (target === 'into') {
|
||||
if (!node.getChildren() && node.isFolder()) {
|
||||
@@ -785,7 +796,7 @@ const noteTree = (function() {
|
||||
node.addChildren(newNode);
|
||||
}
|
||||
|
||||
node.getLastChild().setActive(true);
|
||||
await node.getLastChild().setActive(true);
|
||||
|
||||
node.folder = true;
|
||||
node.renderTitle();
|
||||
@@ -794,6 +805,8 @@ const noteTree = (function() {
|
||||
throwError("Unrecognized target: " + target);
|
||||
}
|
||||
|
||||
clearSelectedNodes(); // to unmark previously active node
|
||||
|
||||
showMessage("Created!");
|
||||
}
|
||||
|
||||
@@ -803,6 +816,10 @@ const noteTree = (function() {
|
||||
await reload();
|
||||
}
|
||||
|
||||
function noteExists(noteId) {
|
||||
return !!childToParents[noteId];
|
||||
}
|
||||
|
||||
$(document).bind('keydown', 'ctrl+o', e => {
|
||||
const node = getCurrentNode();
|
||||
const parentNoteId = node.data.parentNoteId;
|
||||
@@ -876,6 +893,7 @@ const noteTree = (function() {
|
||||
removeParentChildRelation,
|
||||
setParentChildRelation,
|
||||
getSelectedNodes,
|
||||
sortAlphabetically
|
||||
sortAlphabetically,
|
||||
noteExists
|
||||
};
|
||||
})();
|
||||
@@ -268,8 +268,4 @@ div.ui-tooltip {
|
||||
#attribute-list button {
|
||||
padding: 2px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.recent-notes-autocomplete {
|
||||
border: 0 !important;
|
||||
}
|
||||
@@ -29,8 +29,20 @@ router.get('/', auth.checkApiAuth, wrap(async (req, res, next) => {
|
||||
|
||||
protected_session.decryptNotes(req, notes);
|
||||
|
||||
const hiddenInAutocomplete = await sql.getColumn(`
|
||||
SELECT
|
||||
DISTINCT noteId
|
||||
FROM
|
||||
attributes
|
||||
JOIN notes USING(noteId)
|
||||
WHERE
|
||||
attributes.name = 'hide_in_autocomplete'
|
||||
AND attributes.isDeleted = 0
|
||||
AND notes.isDeleted = 0`);
|
||||
|
||||
res.send({
|
||||
notes: notes,
|
||||
hiddenInAutocomplete: hiddenInAutocomplete,
|
||||
start_note_path: await options.getOption('start_note_path')
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -61,10 +61,8 @@ router.put('/:noteTreeId/move-before/:beforeNoteTreeId', auth.checkApiAuth, wrap
|
||||
|
||||
await sync_table.addNoteReorderingSync(beforeNote.parentNoteId, sourceId);
|
||||
|
||||
const now = utils.nowDate();
|
||||
|
||||
await sql.execute("UPDATE note_tree SET parentNoteId = ?, notePosition = ?, dateModified = ? WHERE noteTreeId = ?",
|
||||
[beforeNote.parentNoteId, beforeNote.notePosition, now, noteTreeId]);
|
||||
[beforeNote.parentNoteId, beforeNote.notePosition, utils.nowDate(), noteTreeId]);
|
||||
|
||||
await sync_table.addNoteTreeSync(noteTreeId, sourceId);
|
||||
});
|
||||
|
||||
@@ -8,4 +8,6 @@ window.goToday = async function() {
|
||||
});
|
||||
|
||||
api.activateNote(todayNoteId);
|
||||
};
|
||||
};
|
||||
|
||||
$(document).bind('keydown', "alt+t", window.goToday);
|
||||
@@ -40,7 +40,8 @@
|
||||
await this.createNote(parentNoteId, 'data', jsonContent, {
|
||||
json: true,
|
||||
attributes: {
|
||||
date_data: date
|
||||
date_data: date,
|
||||
hide_in_autocomplete: null
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -70,7 +71,9 @@
|
||||
return data;
|
||||
});
|
||||
|
||||
var config = {
|
||||
const ctx = $("#canvas")[0].getContext("2d");
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: data.map(row => row.date),
|
||||
@@ -82,10 +85,7 @@
|
||||
fill: false
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
var ctx = $("#canvas")[0].getContext("2d");
|
||||
new Chart(ctx, config);
|
||||
});
|
||||
}
|
||||
|
||||
$("#weight-form").submit(event => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
const build = require('./build');
|
||||
const packageJson = require('../../package');
|
||||
|
||||
const APP_DB_VERSION = 75;
|
||||
const APP_DB_VERSION = 76;
|
||||
|
||||
module.exports = {
|
||||
app_version: packageJson.version,
|
||||
|
||||
@@ -5,7 +5,12 @@ const utils = require('./utils');
|
||||
const sync_table = require('./sync_table');
|
||||
const Repository = require('./repository');
|
||||
|
||||
const BUILTIN_ATTRIBUTES = [ 'run_on_startup', 'disable_versioning', 'calendar_root' ];
|
||||
const BUILTIN_ATTRIBUTES = [
|
||||
'run_on_startup',
|
||||
'disable_versioning',
|
||||
'calendar_root',
|
||||
'hide_in_autocomplete'
|
||||
];
|
||||
|
||||
async function getNoteAttributeMap(noteId) {
|
||||
return await sql.getMap(`SELECT name, value FROM attributes WHERE noteId = ?`, [noteId]);
|
||||
|
||||
@@ -22,7 +22,7 @@ function info(message) {
|
||||
|
||||
function error(message) {
|
||||
// we're using .info() instead of .error() because simple-node-logger emits weird error for showError()
|
||||
info(message);
|
||||
info("ERROR: " + message);
|
||||
}
|
||||
|
||||
const requestBlacklist = [ "/libraries", "/javascripts", "/images", "/stylesheets" ];
|
||||
|
||||
@@ -54,6 +54,8 @@ function ScriptContext(noteId, dataKey) {
|
||||
return noteId;
|
||||
};
|
||||
|
||||
this.createAttribute = attributes.createAttribute;
|
||||
|
||||
this.updateEntity = this.repository.updateEntity;
|
||||
|
||||
this.log = function(message) {
|
||||
|
||||
@@ -43,6 +43,14 @@ function nowDate() {
|
||||
return dateStr(new Date());
|
||||
}
|
||||
|
||||
function localDate() {
|
||||
const date = new Date();
|
||||
|
||||
return date.getFullYear() + "-"
|
||||
+ (date.getMonth() < 9 ? "0" : "") + (date.getMonth() + 1) + "-"
|
||||
+ (date.getDate() < 10 ? "0" : "") + date.getDate();
|
||||
}
|
||||
|
||||
function dateStr(date) {
|
||||
return date.toISOString();
|
||||
}
|
||||
@@ -125,6 +133,7 @@ module.exports = {
|
||||
randomSecureToken,
|
||||
randomString,
|
||||
nowDate,
|
||||
localDate,
|
||||
dateStr,
|
||||
parseDate,
|
||||
parseDateTime,
|
||||
|
||||
Reference in New Issue
Block a user