Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	package-lock.json
#	package.json
#	src/public/app/services/note_content_renderer.js
This commit is contained in:
zadam 2020-10-30 15:40:57 +01:00
commit 3d808d638a
21 changed files with 176 additions and 114 deletions

View File

@ -6,26 +6,11 @@
<option name="TAB_SIZE" value="2" /> <option name="TAB_SIZE" value="2" />
</value> </value>
</option> </option>
<H2CodeStyleSettings version="5">
<option name="USE_GENERAL_STYLE" value="false" />
</H2CodeStyleSettings>
<JSCodeStyleSettings version="0"> <JSCodeStyleSettings version="0">
<option name="USE_EXPLICIT_JS_EXTENSION" value="TRUE" /> <option name="USE_EXPLICIT_JS_EXTENSION" value="TRUE" />
</JSCodeStyleSettings> </JSCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
</code_scheme> </code_scheme>
</component> </component>

View File

@ -1,4 +1,4 @@
FROM node:12.16.3-alpine FROM node:12.19.0-alpine
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@ -5,7 +5,7 @@ SERIES=${VERSION:0:4}-latest
cat package.json | grep -v electron > server-package.json cat package.json | grep -v electron > server-package.json
sudo docker build -t zadam/trilium:$VERSION -t zadam/trilium:$SERIES . sudo docker build -t zadam/trilium:$VERSION --network host -t zadam/trilium:$SERIES .
if [[ $VERSION != *"beta"* ]]; then if [[ $VERSION != *"beta"* ]]; then
sudo docker tag zadam/trilium:$VERSION zadam/trilium:latest sudo docker tag zadam/trilium:$VERSION zadam/trilium:latest

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

138
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.44.8", "version": "0.45.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1252,6 +1252,33 @@
"safer-buffer": "~2.1.0" "safer-buffer": "~2.1.0"
} }
}, },
"asn1.js": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz",
"integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==",
"requires": {
"bn.js": "^4.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"safer-buffer": "^2.1.0"
}
},
"asn1.js-rfc2560": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/asn1.js-rfc2560/-/asn1.js-rfc2560-5.0.1.tgz",
"integrity": "sha512-1PrVg6kuBziDN3PGFmRk3QrjpKvP9h/Hv5yMrFZvC1kpzP6dQRzf5BpKstANqHBkaOUmTpakJWhicTATOA/SbA==",
"requires": {
"asn1.js-rfc5280": "^3.0.0"
}
},
"asn1.js-rfc5280": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/asn1.js-rfc5280/-/asn1.js-rfc5280-3.0.0.tgz",
"integrity": "sha512-Y2LZPOWeZ6qehv698ZgOGGCZXBQShObWnGthTrIFlIQjuV1gg2B8QOhWFRExq/MR1VnPpIIe7P9vX2vElxv+Pg==",
"requires": {
"asn1.js": "^5.0.0"
}
},
"assert-plus": { "assert-plus": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
@ -1320,9 +1347,9 @@
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
}, },
"axios": { "axios": {
"version": "0.21.0", "version": "0.20.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
"requires": { "requires": {
"follow-redirects": "^1.10.0" "follow-redirects": "^1.10.0"
} }
@ -1430,6 +1457,11 @@
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=" "integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM="
}, },
"bn.js": {
"version": "4.11.9",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz",
"integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="
},
"body-parser": { "body-parser": {
"version": "1.19.0", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
@ -1796,9 +1828,9 @@
"dev": true "dev": true
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001150", "version": "1.0.30001148",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001150.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz",
"integrity": "sha512-kiNKvihW0m36UhAFnl7bOAv0i1K1f6wpfVtTF5O5O82XzgtBnb05V0XeV3oZ968vfg2sRNChsHw8ASH2hDfoYQ==", "integrity": "sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw==",
"dev": true "dev": true
}, },
"caseless": { "caseless": {
@ -2352,9 +2384,9 @@
} }
}, },
"dayjs": { "dayjs": {
"version": "1.9.4", "version": "1.9.3",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.9.4.tgz", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.9.3.tgz",
"integrity": "sha512-ABSF3alrldf7nM9sQ2U+Ln67NRwmzlLOqG7kK03kck0mw3wlSSEKv/XhKGGxUjQcS57QeiCyNdrFgtj9nWlrng==" "integrity": "sha512-V+1SyIvkS+HmNbN1G7A9+ERbFTV9KTXu6Oor98v2xHmzzpp52OIJhQuJSTywWuBY5pyAEmlwbCi1Me87n/SLOw=="
}, },
"debug": { "debug": {
"version": "4.1.1", "version": "4.1.1",
@ -2626,9 +2658,9 @@
} }
}, },
"electron": { "electron": {
"version": "9.3.2", "version": "9.3.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.3.2.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-9.3.3.tgz",
"integrity": "sha512-0lleEf9msAXGDi2GukAuiGdw3VDgSTlONOnJgqDEz1fuSEVsXz5RX+hNPKDsVDerLTFg/C34RuJf4LwHvkKcBA==", "integrity": "sha512-xghKeUY1qgnEcJ5w2rXo/toH+8NT2Dktx2aAxBNPV7CIJr3mejJJAPwLbycwtddzr37tgKxHeHlc8ivfKtMkJQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",
@ -3241,9 +3273,9 @@
} }
}, },
"enhanced-resolve": { "enhanced-resolve": {
"version": "5.3.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.3.0.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.2.0.tgz",
"integrity": "sha512-EENz3E701+77g0wfbOITeI8WLPNso2kQNMBIBEi/TH/BEa9YXtS01X7sIEk5XXsfFq1jNkhIpu08hBPH1TRLIQ==", "integrity": "sha512-NZlGLl8DxmZoq0uqPPtJfsCAir68uR047+Udsh1FH4+5ydGQdMurn/A430A1BtxASVmMEuS7/XiJ5OxJ9apAzQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",
@ -4441,6 +4473,11 @@
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
}, },
"is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
},
"is-potential-custom-element-name": { "is-potential-custom-element-name": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz",
@ -4495,6 +4532,14 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
}, },
"isobject": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
"integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
"requires": {
"isarray": "1.0.0"
}
},
"isstream": { "isstream": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
@ -4777,9 +4822,12 @@
"integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==" "integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA=="
}, },
"kruptein": { "kruptein": {
"version": "2.1.3", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/kruptein/-/kruptein-2.1.3.tgz", "resolved": "https://registry.npmjs.org/kruptein/-/kruptein-2.2.1.tgz",
"integrity": "sha512-qFoE8aJRqAx+tTCdYGXY46kvIiy8w0m3MtTROsp+cvREX3xxS2mqUcT4DEtbaNx6WyhuFdPM2EnzMLuh/3GavQ==" "integrity": "sha512-eT168L5ZN3Qu6VvFQSNuImysxriKj+u0OAOw7b8+a99xayPxUKwGfZF2hjIdgWuBt9/n7SSmLs5mGwJa76rNtA==",
"requires": {
"asn1.js-rfc2560": "^5.0.1"
}
}, },
"latest-version": { "latest-version": {
"version": "5.1.0", "version": "5.1.0",
@ -4812,16 +4860,6 @@
"requires": { "requires": {
"isarray": "^1.0.0", "isarray": "^1.0.0",
"isobject": "^2.0.0" "isobject": "^2.0.0"
},
"dependencies": {
"isobject": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
"integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
"requires": {
"isarray": "1.0.0"
}
}
} }
}, },
"linkify-it": { "linkify-it": {
@ -5145,6 +5183,11 @@
"dom-walk": "^0.1.0" "dom-walk": "^0.1.0"
} }
}, },
"minimalistic-assert": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
"integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
},
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@ -5234,9 +5277,9 @@
"dev": true "dev": true
}, },
"nanoid": { "nanoid": {
"version": "3.1.13", "version": "3.1.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.13.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.12.tgz",
"integrity": "sha512-oYL7jWZUdScASxYOrcwE8EvISFGzO3/1g+t56vCyR0s2nrpmBcOc7hTAFJaVf6HMyEPJrnNelnjRnMN6KZnCPA==" "integrity": "sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A=="
}, },
"napi-build-utils": { "napi-build-utils": {
"version": "1.0.2", "version": "1.0.2",
@ -5398,9 +5441,9 @@
} }
}, },
"node-releases": { "node-releases": {
"version": "1.1.64", "version": "1.1.63",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.64.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.63.tgz",
"integrity": "sha512-Iec8O9166/x2HRMJyLLLWkd0sFFLrFNy+Xf+JQfSQsdBJzPcHpNl3JQ9gD4j+aJxmCa25jNsIbM4bmACtSbkSg==", "integrity": "sha512-ukW3iCfQaoxJkSPN+iK7KznTeqDGVJatAEuXsJERYHa9tn/KaT5lBdIyxQjLEVTzSkyjJEuQ17/vaEjrOauDkg==",
"dev": true "dev": true
}, },
"noop-logger": { "noop-logger": {
@ -6512,11 +6555,6 @@
"domutils": "^2.0.0", "domutils": "^2.0.0",
"entities": "^2.0.0" "entities": "^2.0.0"
} }
},
"is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
} }
} }
}, },
@ -7142,9 +7180,9 @@
"dev": true "dev": true
}, },
"terser": { "terser": {
"version": "5.3.8", "version": "5.3.7",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.3.8.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.7.tgz",
"integrity": "sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ==", "integrity": "sha512-lJbKdfxWvjpV330U4PBZStCT9h3N9A4zZVA5Y4k9sCWXknrpdyxi1oMsRKLmQ/YDMDxSBKIh88v0SkdhdqX06w==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",
@ -7622,9 +7660,9 @@
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="
}, },
"webpack": { "webpack": {
"version": "5.2.0", "version": "5.1.3",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.2.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.1.3.tgz",
"integrity": "sha512-evtOjOJQq3zaHJIWsJjM4TGtNHtSrNVAIyQ+tdPW/fRd+4PLGbUG6S3xt+N4+QwDBOaCVd0xCWiHd4R6lWO5DQ==", "integrity": "sha512-bNBF5EOpt5a6NeCBFu0+8KJtG61cVmOb2b/a5tPNRLz3OWgDpHMbmnDkaSm3nf/UQ6ufw4PWYGVsVOAi8UfL2A==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-scope": "^3.7.0", "@types/eslint-scope": "^3.7.0",
@ -7633,11 +7671,11 @@
"@webassemblyjs/helper-module-context": "1.9.0", "@webassemblyjs/helper-module-context": "1.9.0",
"@webassemblyjs/wasm-edit": "1.9.0", "@webassemblyjs/wasm-edit": "1.9.0",
"@webassemblyjs/wasm-parser": "1.9.0", "@webassemblyjs/wasm-parser": "1.9.0",
"acorn": "^8.0.4", "acorn": "^8.0.3",
"browserslist": "^4.14.5", "browserslist": "^4.14.3",
"chrome-trace-event": "^1.0.2", "chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.3.0", "enhanced-resolve": "^5.2.0",
"eslint-scope": "^5.1.1", "eslint-scope": "^5.1.0",
"events": "^3.2.0", "events": "^3.2.0",
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4", "graceful-fs": "^4.2.4",

View File

@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.44.8", "version": "0.45.2",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {
@ -40,7 +40,6 @@
"electron-window-state": "5.0.3", "electron-window-state": "5.0.3",
"express": "4.17.1", "express": "4.17.1",
"express-session": "1.17.1", "express-session": "1.17.1",
"file-type": "16.0.0",
"fs-extra": "9.0.1", "fs-extra": "9.0.1",
"helmet": "4.1.1", "helmet": "4.1.1",
"html": "1.0.0", "html": "1.0.0",
@ -77,7 +76,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.2", "cross-env": "7.0.2",
"electron": "9.3.2", "electron": "9.3.3",
"electron-builder": "22.9.1", "electron-builder": "22.9.1",
"electron-packager": "15.1.0", "electron-packager": "15.1.0",
"electron-rebuild": "2.3.2", "electron-rebuild": "2.3.2",

View File

@ -57,8 +57,15 @@ function id() {
return randtoken.generate(10); return randtoken.generate(10);
} }
function note(title, type = 'text', mime = 'text/html') { function note(title, extraParams = {}) {
const note = new Note(noteCache, {noteId: id(), title, type, mime}); const row = Object.assign({
noteId: id(),
title: title,
type: 'text',
mime: 'text/html'
}, extraParams);
const note = new Note(noteCache, row);
return new NoteBuilder(note); return new NoteBuilder(note);
} }

View File

@ -247,6 +247,6 @@ describe("Invalid expressions", () => {
searchContext searchContext
}); });
expect(searchContext.error).toEqual('Misplaced or incomplete expression "="') expect(searchContext.error).toEqual('Relation can be compared only with property, e.g. ~relation.title=hello in ""')
}); });
}); });

View File

@ -53,8 +53,8 @@ describe("Search", () => {
it("normal search looks also at type and mime", () => { it("normal search looks also at type and mime", () => {
rootNote rootNote
.child(note("Effective Java", 'book', '')) .child(note("Effective Java", {type: 'book', mime:''}))
.child(note("Hello World.java", 'code', 'text/x-java')); .child(note("Hello World.java", {type: 'code', mime: 'text/x-java'}));
const searchContext = new SearchContext(); const searchContext = new SearchContext();
let searchResults = searchService.findNotesWithQuery('book', searchContext); let searchResults = searchService.findNotesWithQuery('book', searchContext);
@ -178,7 +178,7 @@ describe("Search", () => {
// dates should not be coerced into numbers which would then give wrong numbers // dates should not be coerced into numbers which would then give wrong numbers
rootNote rootNote
.child(note("My note") .child(note("My note", {dateCreated: dateUtils.localNowDateTime()})
.label('year', new Date().getFullYear().toString()) .label('year', new Date().getFullYear().toString())
.label('month', dateUtils.localNowDate().substr(0, 7)) .label('month', dateUtils.localNowDate().substr(0, 7))
.label('date', dateUtils.localNowDate()) .label('date', dateUtils.localNowDate())
@ -209,6 +209,8 @@ describe("Search", () => {
test("#month = month", 1); test("#month = month", 1);
test("#month = 'MONTH'", 0); test("#month = 'MONTH'", 0);
test("note.dateCreated =* month", 1);
test("#date = TODAY", 1); test("#date = TODAY", 1);
test("#date = today", 1); test("#date = today", 1);
test("#date = 'today'", 0); test("#date = 'today'", 0);
@ -586,7 +588,7 @@ describe("Search", () => {
const searchContext = new SearchContext(); const searchContext = new SearchContext();
let searchResults = searchService.findNotesWithQuery('# note.text *=* rati and note.noteId != root', searchContext); let searchResults = searchService.findNotesWithQuery('# note.text *=* vaki and note.noteId != root', searchContext);
expect(searchResults.length).toEqual(1); expect(searchResults.length).toEqual(1);
expect(noteCache.notes[searchResults[0].noteId].title).toEqual("Slovakia"); expect(noteCache.notes[searchResults[0].noteId].title).toEqual("Slovakia");
}); });

View File

@ -2,6 +2,7 @@ import utils from '../services/utils.js';
import server from '../services/server.js'; import server from '../services/server.js';
import toastService from "../services/toast.js"; import toastService from "../services/toast.js";
import appContext from "../services/app_context.js"; import appContext from "../services/app_context.js";
import libraryLoader from "../services/library_loader.js";
const $dialog = $("#note-revisions-dialog"); const $dialog = $("#note-revisions-dialog");
const $list = $("#note-revision-list"); const $list = $("#note-revision-list");
@ -132,6 +133,12 @@ async function setContentPane() {
if (revisionItem.type === 'text') { if (revisionItem.type === 'text') {
$content.html(fullNoteRevision.content); $content.html(fullNoteRevision.content);
if ($content.find('span.math-tex').length > 0) {
await libraryLoader.requireLibrary(libraryLoader.KATEX);
renderMathInElement($content[0], {});
}
} }
else if (revisionItem.type === 'code') { else if (revisionItem.type === 'code') {
$content.html($("<pre>").text(fullNoteRevision.content)); $content.html($("<pre>").text(fullNoteRevision.content));

View File

@ -8,6 +8,11 @@ const TPL = `
<p>Your username is <strong id="credentials-username"></strong>.</p> <p>Your username is <strong id="credentials-username"></strong>.</p>
<h3>Change password</h3> <h3>Change password</h3>
<div class="alert alert-warning" role="alert" style="font-weight: bold; color: red !important;">
Please take care to remember your new password. Password is used to encrypt protected notes. If you forget your password, then all your protected notes are forever lost with no recovery options.
</div>
<form id="change-password-form"> <form id="change-password-form">
<div class="form-group"> <div class="form-group">
<label for="old-password">Old password</label> <label for="old-password">Old password</label>

View File

@ -3,6 +3,7 @@ import utils from "./utils.js";
import renderService from "./render.js"; import renderService from "./render.js";
import protectedSessionService from "./protected_session.js"; import protectedSessionService from "./protected_session.js";
import protectedSessionHolder from "./protected_session_holder.js"; import protectedSessionHolder from "./protected_session_holder.js";
import libraryLoader from "./library_loader.js";
async function getRenderedContent(note, options = {}) { async function getRenderedContent(note, options = {}) {
options = Object.assign({ options = Object.assign({
@ -17,6 +18,12 @@ async function getRenderedContent(note, options = {}) {
const fullNote = await server.get('notes/' + note.noteId); const fullNote = await server.get('notes/' + note.noteId);
$rendered = $('<div class="ck-content">').html(trim(fullNote.content, options.trim)); $rendered = $('<div class="ck-content">').html(trim(fullNote.content, options.trim));
if ($rendered.find('span.math-tex').length > 0) {
await libraryLoader.requireLibrary(libraryLoader.KATEX);
renderMathInElement($rendered[0], {});
}
} }
else if (type === 'code') { else if (type === 'code') {
const fullNote = await server.get('notes/' + note.noteId); const fullNote = await server.get('notes/' + note.noteId);

View File

@ -3,6 +3,7 @@ import linkService from "./link.js";
import treeCache from "./tree_cache.js"; import treeCache from "./tree_cache.js";
import utils from "./utils.js"; import utils from "./utils.js";
import attributeRenderer from "./attribute_renderer.js"; import attributeRenderer from "./attribute_renderer.js";
import libraryLoader from "./library_loader.js";
function setupGlobalTooltip() { function setupGlobalTooltip() {
$(document).on("mouseenter", "a", mouseEnterHandler); $(document).on("mouseenter", "a", mouseEnterHandler);
@ -101,7 +102,15 @@ async function renderTooltip(note, noteComplement) {
} }
if (note.type === 'text' && !utils.isHtmlEmpty(noteComplement.content)) { if (note.type === 'text' && !utils.isHtmlEmpty(noteComplement.content)) {
content += '<div class="ck-content">' + noteComplement.content + '</div>'; const $content = $('<div class="ck-content">').append(noteComplement.content);
if ($content.find('span.math-tex').length > 0) {
await libraryLoader.requireLibrary(libraryLoader.KATEX);
renderMathInElement($content[0], {});
}
content += $content[0].outerHTML;
} }
else if (note.type === 'code' && noteComplement.content && noteComplement.content.trim()) { else if (note.type === 'code' && noteComplement.content && noteComplement.content.trim()) {
content += $("<pre>") content += $("<pre>")

View File

@ -54,7 +54,7 @@ function closePersistent(id) {
} }
function showMessage(message, delay = 2000) { function showMessage(message, delay = 2000) {
console.debug(utils.now(), "message: ", message); console.debug(utils.now(), "message:", message);
toast({ toast({
title: "Info", title: "Info",

View File

@ -203,6 +203,11 @@ class TreeCache {
// force to load all the notes at once instead of one by one // force to load all the notes at once instead of one by one
await this.getNotes(searchResultNoteIds); await this.getNotes(searchResultNoteIds);
// reset all the virtual branches from old search results
if (note.noteId in treeCache.notes) {
treeCache.notes[note.noteId].children = [];
}
const branches = resp.branches.filter(b => b.noteId === note.noteId || b.parentNoteId === note.noteId); const branches = resp.branches.filter(b => b.noteId === note.noteId || b.parentNoteId === note.noteId);
searchResultNoteIds.forEach((resultNoteId, index) => branches.push({ searchResultNoteIds.forEach((resultNoteId, index) => branches.push({

View File

@ -154,7 +154,7 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
} }
}]); }]);
$input.on('autocomplete:noteselected', e => this.promotedAttributeChanged(e)) $input.on('autocomplete:selected', e => this.promotedAttributeChanged(e))
}); });
} }
else if (definition.labelType === 'number') { else if (definition.labelType === 'number') {

View File

@ -1 +1 @@
module.exports = { buildDate:"2020-10-21T22:57:54+02:00", buildRevision: "283808d69181628b84d7d48b5029c51bc5a1cf98" }; module.exports = { buildDate:"2020-10-29T22:57:25+01:00", buildRevision: "4f75b6aaafef8144080fd17f403a605f61f5590d" };

View File

@ -1,5 +1,4 @@
const sax = require("sax"); const sax = require("sax");
const FileType = require('file-type');
const stream = require('stream'); const stream = require('stream');
const log = require("../log"); const log = require("../log");
const utils = require("../utils"); const utils = require("../utils");
@ -138,17 +137,6 @@ function importEnex(taskContext, file, parentNote) {
} }
else if (currentTag === 'mime') { else if (currentTag === 'mime') {
resource.mime = text.toLowerCase(); resource.mime = text.toLowerCase();
if (text.startsWith("image/")) {
resource.title = "image";
// images don't have "file-name" tag so we'll create attribute here
resource.attributes.push({
type: 'label',
name: 'originalFileName',
value: resource.title + "." + text.substr(6) // extension from mime type
});
}
} }
} }
else if (previousTag === 'note') { else if (previousTag === 'note') {
@ -243,11 +231,7 @@ function importEnex(taskContext, file, parentNote) {
const mediaRegex = new RegExp(`<en-media hash="${hash}"[^>]*>`, 'g'); const mediaRegex = new RegExp(`<en-media hash="${hash}"[^>]*>`, 'g');
const fileTypeFromBuffer = FileType.fromBuffer(resource.content); resource.mime = resource.mime || "application/octet-stream";
if (fileTypeFromBuffer) {
// If fileType returns something for buffer, then set the mime given
resource.mime = fileTypeFromBuffer.mime;
}
const createFileNote = () => { const createFileNote = () => {
const resourceNote = noteService.createNewNote({ const resourceNote = noteService.createNewNote({
@ -260,7 +244,7 @@ function importEnex(taskContext, file, parentNote) {
}).note; }).note;
for (const attr of resource.attributes) { for (const attr of resource.attributes) {
noteEntity.addAttribute(attr.type, attr.name, attr.value); resourceNote.addAttribute(attr.type, attr.name, attr.value);
} }
updateDates(resourceNote.noteId, utcDateCreated, utcDateModified); updateDates(resourceNote.noteId, utcDateCreated, utcDateModified);
@ -274,10 +258,18 @@ function importEnex(taskContext, file, parentNote) {
if (resource.mime && resource.mime.startsWith('image/')) { if (resource.mime && resource.mime.startsWith('image/')) {
try { try {
const originalName = "image." + resource.mime.substr(6); const originalName = (resource.title && resource.title !== 'resource')
? resource.title
: `image.${resource.mime.substr(6)}`; // default if real name is not present
const {url, note: imageNote} = imageService.saveImage(noteEntity.noteId, resource.content, originalName, taskContext.data.shrinkImages); const {url, note: imageNote} = imageService.saveImage(noteEntity.noteId, resource.content, originalName, taskContext.data.shrinkImages);
for (const attr of resource.attributes) {
if (attr.name !== 'originalFileName') { // this one is already saved in imageService
imageNote.addAttribute(attr.type, attr.name, attr.value);
}
}
updateDates(imageNote.noteId, utcDateCreated, utcDateModified); updateDates(imageNote.noteId, utcDateCreated, utcDateModified);
const imageLink = `<img src="${url}">`; const imageLink = `<img src="${url}">`;

View File

@ -5,9 +5,9 @@ const stringComparators = {
">=": comparedValue => (val => val >= comparedValue), ">=": comparedValue => (val => val >= comparedValue),
"<": comparedValue => (val => val < comparedValue), "<": comparedValue => (val => val < comparedValue),
"<=": comparedValue => (val => val <= comparedValue), "<=": comparedValue => (val => val <= comparedValue),
"*=": comparedValue => (val => val.endsWith(comparedValue)), "*=": comparedValue => (val => val && val.endsWith(comparedValue)),
"=*": comparedValue => (val => val.startsWith(comparedValue)), "=*": comparedValue => (val => val && val.startsWith(comparedValue)),
"*=*": comparedValue => (val => val.includes(comparedValue)), "*=*": comparedValue => (val => val && val.includes(comparedValue)),
}; };
const numericComparators = { const numericComparators = {

View File

@ -80,10 +80,14 @@ function getExpression(tokens, searchContext, level = 0) {
if (i + 2 < tokens.length) { if (i + 2 < tokens.length) {
if (tokens[i + 1].token === '+') { if (tokens[i + 1].token === '+') {
delta += parseInt(tokens[i + 2].token); i += 2;
delta += parseInt(tokens[i].token);
} }
else if (tokens[i + 1].token === '-') { else if (tokens[i + 1].token === '-') {
delta -= parseInt(tokens[i + 2].token); i += 2;
delta -= parseInt(tokens[i].token);
} }
} }
@ -196,16 +200,18 @@ function getExpression(tokens, searchContext, level = 0) {
if (PropertyComparisonExp.isProperty(tokens[i].token)) { if (PropertyComparisonExp.isProperty(tokens[i].token)) {
const propertyName = tokens[i].token; const propertyName = tokens[i].token;
const operator = tokens[i + 1].token; const operator = tokens[i + 1].token;
const comparedValue = tokens[i + 2].token;
i += 2;
const comparedValue = resolveConstantOperand();
const comparator = buildComparator(operator, comparedValue); const comparator = buildComparator(operator, comparedValue);
if (!comparator) { if (!comparator) {
searchContext.addError(`Can't find operator '${operator}' in ${context(i)}`); searchContext.addError(`Can't find operator '${operator}' in ${context(i - 2)}`);
return; return;
} }
i += 2;
return new PropertyComparisonExp(propertyName, comparator); return new PropertyComparisonExp(propertyName, comparator);
} }