Compare commits

...

13 Commits

Author SHA1 Message Date
zadam
df11b076bc release 0.42.1 2020-05-06 23:24:13 +02:00
MeIchthys
54ecd2ee75 Prevent td text from overlapping th text (#1002)
This makes all of the Note Info sections more consistent with each other. It prevents overlapping of text when the window is displayed in a small-width environment.
2020-05-06 23:12:28 +02:00
zadam
2369bcf9fc fixes for image download 2020-05-06 23:11:34 +02:00
zadam
5d8808a2ad fix renaming existing attributes + added new label autoReadOnlyDisabled to control automatic setting to readOnly mode 2020-05-06 21:41:14 +02:00
zadam
62b993f06f fix closing tab by mouse 2020-05-06 21:24:51 +02:00
zadam
8aa5608085 fix "Render note" and "Execute script" buttons + refactoring around data-trigger-command handling 2020-05-06 00:00:14 +02:00
zadam
b452d7e5c5 Merge remote-tracking branch 'origin/stable' 2020-05-06 00:00:01 +02:00
zadam
9b9d6d86d0 remove debugging console.log 2020-05-05 22:51:53 +02:00
zadam
7f2755d4a0 refresh button state change on note update 2020-05-05 22:18:09 +02:00
zadam
3b268cc8eb fix selecting note title after creation, closes #997 2020-05-05 21:42:18 +02:00
zadam
6dfe335707 added global menu item to open new empty window + some refactoring 2020-05-05 19:30:03 +02:00
zadam
c7125d2b50 createNoteAfter should have saveSelection: false 2020-05-05 19:09:01 +02:00
zadam
e8a33a5ee7 fix note title not updating when changing the title 2020-05-05 18:56:12 +02:00
25 changed files with 248 additions and 231 deletions

18
.idea/dataSources.xml generated
View File

@@ -1,25 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true"> <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="document.db" uuid="a2c75661-f9e2-478f-a69f-6a9409e69997"> <data-source source="LOCAL" name="SQLite - document.db" uuid="d0fd879f-1e1d-4d5c-9c21-0e5cf9ab2976">
<driver-ref>sqlite.xerial</driver-ref> <driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver> <jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$USER_HOME$/trilium-data/document.db</jdbc-url> <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/../trilium-data/document.db</jdbc-url>
</data-source>
<data-source source="LOCAL" name="document" uuid="066dc5f4-4097-429e-8cf1-3adc0a9d648a">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/dist/trilium linux x64/trilium-data/document.db</jdbc-url>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.16.1/xerial-sqlite-license.txt</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.16.1/sqlite-jdbc-3.16.1.jar</url>
</library>
</libraries>
</data-source> </data-source>
</component> </component>
</project> </project>

174
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.41.6", "version": "0.42.0-beta",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -1192,38 +1192,38 @@
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
}, },
"app-builder-bin": { "app-builder-bin": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.5.6.tgz", "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-3.5.8.tgz",
"integrity": "sha512-gY9ABoV5jh67IrPEwF81R8l9LwE3RqHUyU3rIKitwqMpKhplN5OZC6WEHOXO3XhwiLCIlr9LLI6OPhr3bmtQIg==", "integrity": "sha512-ni3q7QTfQNWHNWuyn5x3FZu6GnQZv+TFnfgk5++svqleKEhHGqS1mIaKsh7x5pBX6NFXU3/+ktk98wA/AW4EXw==",
"dev": true "dev": true
}, },
"app-builder-lib": { "app-builder-lib": {
"version": "22.5.1", "version": "22.6.0",
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-22.5.1.tgz", "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-22.6.0.tgz",
"integrity": "sha512-VtB/PD8actR1317D/0uGzuJIYbpw4pRrfMB6IyTLwGynUd3ihqiCFjejVWHjCwopgCct2kE0MvLwo8P49xHIeQ==", "integrity": "sha512-ky2aLYy92U+Gh6dKq/e8/bNmCotp6/GMhnX8tDZPv9detLg9WuBnWWi1ktBPlpbl1DREusy+TIh+9rgvfduQoA==",
"dev": true, "dev": true,
"requires": { "requires": {
"7zip-bin": "~5.0.3", "7zip-bin": "~5.0.3",
"@develar/schema-utils": "~2.6.5", "@develar/schema-utils": "~2.6.5",
"async-exit-hook": "^2.0.1", "async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.9", "bluebird-lst": "^1.0.9",
"builder-util": "22.5.1", "builder-util": "22.6.0",
"builder-util-runtime": "8.7.0", "builder-util-runtime": "8.7.0",
"chromium-pickle-js": "^0.2.0", "chromium-pickle-js": "^0.2.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"ejs": "^3.0.2", "ejs": "^3.1.2",
"electron-publish": "22.5.1", "electron-publish": "22.6.0",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"hosted-git-info": "^3.0.4", "hosted-git-info": "^3.0.4",
"is-ci": "^2.0.0", "is-ci": "^2.0.0",
"isbinaryfile": "^4.0.5", "isbinaryfile": "^4.0.6",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"lazy-val": "^1.0.4", "lazy-val": "^1.0.4",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"normalize-package-data": "^2.5.0", "normalize-package-data": "^2.5.0",
"read-config-file": "6.0.0", "read-config-file": "6.0.0",
"sanitize-filename": "^1.6.3", "sanitize-filename": "^1.6.3",
"semver": "^7.1.3", "semver": "^7.3.2",
"temp-file": "^3.3.7" "temp-file": "^3.3.7"
}, },
"dependencies": { "dependencies": {
@@ -1864,23 +1864,23 @@
} }
}, },
"builder-util": { "builder-util": {
"version": "22.5.1", "version": "22.6.0",
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-22.5.1.tgz", "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-22.6.0.tgz",
"integrity": "sha512-CelDTP3+fvDfZfbwy3PXif7mudPaWankJ8vrRg/NtCGvL+hXnwycnJZr46d5EQL7AgQcpJ27o9LTdfu61cxTFw==", "integrity": "sha512-jgdES2ExJYkuXC3DEaGAjFctKNA81C4QDy8zdoc+rqdSqheTizuDNtZg02uMFklmUES4V4fggmqds+Y7wraqng==",
"dev": true, "dev": true,
"requires": { "requires": {
"7zip-bin": "~5.0.3", "7zip-bin": "~5.0.3",
"@types/debug": "^4.1.5", "@types/debug": "^4.1.5",
"@types/fs-extra": "^8.1.0", "@types/fs-extra": "^8.1.0",
"app-builder-bin": "3.5.6", "app-builder-bin": "3.5.8",
"bluebird-lst": "^1.0.9", "bluebird-lst": "^1.0.9",
"builder-util-runtime": "8.7.0", "builder-util-runtime": "8.7.0",
"chalk": "^3.0.0", "chalk": "^4.0.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"is-ci": "^2.0.0", "is-ci": "^2.0.0",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"source-map-support": "^0.5.16", "source-map-support": "^0.5.19",
"stat-mode": "^1.0.0", "stat-mode": "^1.0.0",
"temp-file": "^3.3.7" "temp-file": "^3.3.7"
}, },
@@ -1896,9 +1896,9 @@
} }
}, },
"chalk": { "chalk": {
"version": "3.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
@@ -1920,6 +1920,16 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true "dev": true
}, },
"source-map-support": {
"version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"stat-mode": { "stat-mode": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz", "resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz",
@@ -3143,13 +3153,13 @@
} }
}, },
"dmg-builder": { "dmg-builder": {
"version": "22.5.1", "version": "22.6.0",
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-22.5.1.tgz", "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-22.6.0.tgz",
"integrity": "sha512-AwIiyGwgqhA8Ty/YnEU20aSzfrWZns6suOBTqddD+rLDI4jEASKGQadfvcXRSWgaK/VQW0GrhheXrhJpzZzt3g==", "integrity": "sha512-rJxuGhHIpcuDGBtWZMM8aLxkbZNgYO2MO5dUerDIBXebhX1K8DA23iz/uZ8ahcRNgWEv57b8GDqJbXKEfr5T0A==",
"dev": true, "dev": true,
"requires": { "requires": {
"app-builder-lib": "22.5.1", "app-builder-lib": "22.6.0",
"builder-util": "22.5.1", "builder-util": "22.6.0",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"iconv-lite": "^0.5.1", "iconv-lite": "^0.5.1",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
@@ -3335,9 +3345,9 @@
} }
}, },
"electron": { "electron": {
"version": "9.0.0-beta.18", "version": "9.0.0-beta.22",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.18.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.22.tgz",
"integrity": "sha512-mOdPB4nPc4kO2uwpvvbNZz0RDrRDIko/C8XFmOZmz7k3JaU7r0h/tLxdeypiqfLwxW/Bu1n+uwqG1X34i3fTEw==", "integrity": "sha512-dfqAf+CXXTKcNDj7DU7mYsmx+oZQcXOvJnZ8ZsgAHjrE9Tv8zsYUgCP3JlO4Z8CIazgleKXYmgh6H2stdK7fEA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",
@@ -3346,18 +3356,18 @@
} }
}, },
"electron-builder": { "electron-builder": {
"version": "22.5.1", "version": "22.6.0",
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-22.5.1.tgz", "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-22.6.0.tgz",
"integrity": "sha512-7gnHN8Ml5zecDerN8/ljAwUKtE+hhGLuT/X2/zO0FJM2q2hlLx/6ZgzESFILKqnPQFEBRxQ8SL1OxjdIY0HIrw==", "integrity": "sha512-aLHlB6DTfjJ3MI4AUIFeWnwIozNgNlbOk2c2sTHxB10cAKp0dBVSPZ7xF5NK0uwDhElvRzJQubnHtJD6zKg42Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/yargs": "^15.0.4", "@types/yargs": "^15.0.4",
"app-builder-lib": "22.5.1", "app-builder-lib": "22.6.0",
"bluebird-lst": "^1.0.9", "bluebird-lst": "^1.0.9",
"builder-util": "22.5.1", "builder-util": "22.6.0",
"builder-util-runtime": "8.7.0", "builder-util-runtime": "8.7.0",
"chalk": "^3.0.0", "chalk": "^4.0.0",
"dmg-builder": "22.5.1", "dmg-builder": "22.6.0",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"is-ci": "^2.0.0", "is-ci": "^2.0.0",
"lazy-val": "^1.0.4", "lazy-val": "^1.0.4",
@@ -3378,9 +3388,9 @@
} }
}, },
"chalk": { "chalk": {
"version": "3.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
@@ -3724,16 +3734,16 @@
} }
}, },
"electron-publish": { "electron-publish": {
"version": "22.5.1", "version": "22.6.0",
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.5.1.tgz", "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.6.0.tgz",
"integrity": "sha512-g5bwLAHZT6A++yU1+Et+fncnFAdXXgkRao9rzTFAvhQ0QJBsmLiyOd0Ta2RI/EQcVoy6jyHtxFs7CWIXE5aZOA==", "integrity": "sha512-+v05SBf9qR7Os5au+fifloNHy5QxHQkUGudBj68YaTb43Pn37UkwRxSc49Lf13s4wW32ohM45g8BOVInPJEdnA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/fs-extra": "^8.1.0", "@types/fs-extra": "^8.1.0",
"bluebird-lst": "^1.0.9", "bluebird-lst": "^1.0.9",
"builder-util": "22.5.1", "builder-util": "22.6.0",
"builder-util-runtime": "8.7.0", "builder-util-runtime": "8.7.0",
"chalk": "^3.0.0", "chalk": "^4.0.0",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.0",
"lazy-val": "^1.0.4", "lazy-val": "^1.0.4",
"mime": "^2.4.4" "mime": "^2.4.4"
@@ -3750,9 +3760,9 @@
} }
}, },
"chalk": { "chalk": {
"version": "3.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
@@ -4438,9 +4448,9 @@
} }
}, },
"file-type": { "file-type": {
"version": "14.2.0", "version": "14.3.0",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-14.2.0.tgz", "resolved": "https://registry.npmjs.org/file-type/-/file-type-14.3.0.tgz",
"integrity": "sha512-CAkX5G5jq8LIgFu++dpM3giMZadYdU+QVQoPLajjNboo8IzaR4cKpBCVEuz+suhd/vHqoAJeSWhEubKjRPQHJg==", "integrity": "sha512-s71v6jMkbfwVdj87csLeNpL5K93mv4lN+lzgzifoICtPHhnXokDwBa3jrzfg+z6FK872iYJ0vS0i74v8XmoFDA==",
"requires": { "requires": {
"readable-web-to-node-stream": "^2.0.0", "readable-web-to-node-stream": "^2.0.0",
"strtok3": "^6.0.0", "strtok3": "^6.0.0",
@@ -6207,9 +6217,9 @@
} }
}, },
"jest-worker": { "jest-worker": {
"version": "25.4.0", "version": "25.5.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.4.0.tgz", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.5.0.tgz",
"integrity": "sha512-ghAs/1FtfYpMmYQ0AHqxV62XPvKdUDIBBApMZfly+E9JEmYh2K45G0R5dWxx986RN12pRCxsViwQVtGl+N4whw==", "integrity": "sha512-/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw==",
"dev": true, "dev": true,
"requires": { "requires": {
"merge-stream": "^2.0.0", "merge-stream": "^2.0.0",
@@ -9715,7 +9725,6 @@
"version": "2.88.0", "version": "2.88.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
"dev": true,
"requires": { "requires": {
"aws-sign2": "~0.7.0", "aws-sign2": "~0.7.0",
"aws4": "^1.8.0", "aws4": "^1.8.0",
@@ -9742,14 +9751,12 @@
"qs": { "qs": {
"version": "6.5.2", "version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
"dev": true
}, },
"tunnel-agent": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true,
"requires": { "requires": {
"safe-buffer": "^5.0.1" "safe-buffer": "^5.0.1"
} }
@@ -10110,9 +10117,9 @@
} }
}, },
"serialize-javascript": { "serialize-javascript": {
"version": "2.1.2", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==",
"dev": true "dev": true
}, },
"serve-favicon": { "serve-favicon": {
@@ -10265,9 +10272,9 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
}, },
"source-map-support": { "source-map-support": {
"version": "0.5.16", "version": "0.5.19",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
"integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
"dev": true, "dev": true,
"requires": { "requires": {
"buffer-from": "^1.0.0", "buffer-from": "^1.0.0",
@@ -10341,12 +10348,13 @@
"integrity": "sha512-1bBO+me3gXRfqwRR3K9aNDoSbTkQ87o6fSjj/BE2gSHHsK3qIDR+LoFZHgZ6kSPdFBoLTsy5/w/+8PBBaK+lvg==" "integrity": "sha512-1bBO+me3gXRfqwRR3K9aNDoSbTkQ87o6fSjj/BE2gSHHsK3qIDR+LoFZHgZ6kSPdFBoLTsy5/w/+8PBBaK+lvg=="
}, },
"sqlite3": { "sqlite3": {
"version": "4.2.0", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.2.0.tgz", "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.1.1.tgz",
"integrity": "sha512-roEOz41hxui2Q7uYnWsjMOTry6TcNUNmp8audCx18gF10P2NknwdpF+E+HKvz/F2NvPKGGBF4NGc+ZPQ+AABwg==", "integrity": "sha512-CvT5XY+MWnn0HkbwVKJAyWEMfzpAPwnTiB3TobA5Mri44SrTovmmh499NPQP+gatkeOipqPlBLel7rn4E/PCQg==",
"requires": { "requires": {
"nan": "^2.12.1", "nan": "^2.12.1",
"node-pre-gyp": "^0.11.0" "node-pre-gyp": "^0.11.0",
"request": "^2.87.0"
} }
}, },
"squeak": { "squeak": {
@@ -10701,9 +10709,9 @@
"dev": true "dev": true
}, },
"terser": { "terser": {
"version": "4.6.11", "version": "4.6.13",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.6.11.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.13.tgz",
"integrity": "sha512-76Ynm7OXUG5xhOpblhytE7X58oeNSmC8xnNhjWVo8CksHit0U0kO4hfNbPrrYwowLWFgM2n9L176VNx2QaHmtA==", "integrity": "sha512-wMvqukYgVpQlymbnNbabVZbtM6PN63AzqexpwJL8tbh/mRT9LE5o+ruVduAGL7D6Fpjl+Q+06U5I9Ul82odAhw==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "^2.20.0", "commander": "^2.20.0",
@@ -10720,19 +10728,19 @@
} }
}, },
"terser-webpack-plugin": { "terser-webpack-plugin": {
"version": "2.3.5", "version": "2.3.6",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.5.tgz", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.6.tgz",
"integrity": "sha512-WlWksUoq+E4+JlJ+h+U+QUzXpcsMSSNXkDy9lBVkSqDn1w23Gg29L/ary9GeJVYCGiNJJX7LnVc4bwL1N3/g1w==", "integrity": "sha512-I8IDsQwZrqjdmOicNeE8L/MhwatAap3mUrtcAKJuilsemUNcX+Hier/eAzwStVqhlCxq0aG3ni9bK/0BESXkTg==",
"dev": true, "dev": true,
"requires": { "requires": {
"cacache": "^13.0.1", "cacache": "^13.0.1",
"find-cache-dir": "^3.2.0", "find-cache-dir": "^3.3.1",
"jest-worker": "^25.1.0", "jest-worker": "^25.4.0",
"p-limit": "^2.2.2", "p-limit": "^2.3.0",
"schema-utils": "^2.6.4", "schema-utils": "^2.6.6",
"serialize-javascript": "^2.1.2", "serialize-javascript": "^3.0.0",
"source-map": "^0.6.1", "source-map": "^0.6.1",
"terser": "^4.4.3", "terser": "^4.6.12",
"webpack-sources": "^1.4.3" "webpack-sources": "^1.4.3"
}, },
"dependencies": { "dependencies": {
@@ -11458,9 +11466,9 @@
"integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA=="
}, },
"webpack": { "webpack": {
"version": "5.0.0-beta.15", "version": "5.0.0-beta.16",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.0.0-beta.15.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.0.0-beta.16.tgz",
"integrity": "sha512-nT+l7LteKTIzB3lmroEGL4qcCBqgHMpa3EJUvhQdfXRWjxCfWnnWdBARhp/To61omZhyNPz2Ye2J1ZEf070kWA==", "integrity": "sha512-O6YzI5H7XDPoXFrdC338P0GsSdhmYvz0//HL8LxVFHuRSbtHcV8mfx5U8ouWihFqwyvbfy27Bqoz2KY62kME9Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@webassemblyjs/ast": "1.9.0", "@webassemblyjs/ast": "1.9.0",
@@ -11482,7 +11490,7 @@
"pkg-dir": "^4.2.0", "pkg-dir": "^4.2.0",
"schema-utils": "^2.5.0", "schema-utils": "^2.5.0",
"tapable": "2.0.0-beta.9", "tapable": "2.0.0-beta.9",
"terser-webpack-plugin": "^2.3.1", "terser-webpack-plugin": "^2.3.6",
"watchpack": "2.0.0-beta.13", "watchpack": "2.0.0-beta.13",
"webpack-sources": "2.0.0-beta.8" "webpack-sources": "2.0.0-beta.8"
} }

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.42.0-beta", "version": "0.42.1",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {
@@ -37,7 +37,7 @@
"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": "14.2.0", "file-type": "14.3.0",
"fs-extra": "9.0.0", "fs-extra": "9.0.0",
"helmet": "3.22.0", "helmet": "3.22.0",
"html": "1.0.0", "html": "1.0.0",
@@ -84,7 +84,7 @@
"electron-rebuild": "1.10.1", "electron-rebuild": "1.10.1",
"jsdoc": "3.6.4", "jsdoc": "3.6.4",
"lorem-ipsum": "2.0.3", "lorem-ipsum": "2.0.3",
"webpack": "5.0.0-beta.15", "webpack": "5.0.0-beta.16",
"webpack-cli": "4.0.0-beta.8" "webpack-cli": "4.0.0-beta.8"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@@ -45,10 +45,12 @@ class AppContext extends Component {
$("body").append($renderedWidget); $("body").append($renderedWidget);
$renderedWidget.on('click', "[data-trigger-command]", e => { $renderedWidget.on('click', "[data-trigger-command]", function() {
const commandName = $(e.target).attr('data-trigger-command'); const commandName = $(this).attr('data-trigger-command');
const $component = $(this).closest(".component");
const component = $component.prop("component");
this.triggerCommand(commandName); component.triggerCommand(commandName, {$el: $(this)});
}); });
this.tabManager = new TabManager(); this.tabManager = new TabManager();
@@ -92,6 +94,8 @@ class AppContext extends Component {
} }
} }
// this might hint at error but sometimes this is used by components which are at different places
// in the component tree to communicate with each other
console.debug(`Unhandled command ${name}, converting to event.`); console.debug(`Unhandled command ${name}, converting to event.`);
return this.triggerEvent(name, data); return this.triggerEvent(name, data);
@@ -100,19 +104,6 @@ class AppContext extends Component {
getComponentByEl(el) { getComponentByEl(el) {
return $(el).closest(".component").prop('component'); return $(el).closest(".component").prop('component');
} }
async openInNewWindow(notePath) {
if (utils.isElectron()) {
const {ipcRenderer} = utils.dynamicRequire('electron');
ipcRenderer.send('create-extra-window', {notePath});
}
else {
const url = window.location.protocol + '//' + window.location.host + window.location.pathname + '?extra=1#' + notePath;
window.open(url, '', 'width=1000,height=800');
}
}
} }
const appContext = new AppContext(window.glob.isMainWindow); const appContext = new AppContext(window.glob.isMainWindow);

View File

@@ -7,6 +7,7 @@ import Component from "../widgets/component.js";
import toastService from "./toast.js"; import toastService from "./toast.js";
import noteCreateService from "./note_create.js"; import noteCreateService from "./note_create.js";
import ws from "./ws.js"; import ws from "./ws.js";
import bundleService from "./bundle.js";
export default class Entrypoints extends Component { export default class Entrypoints extends Component {
constructor() { constructor() {
@@ -182,4 +183,40 @@ export default class Entrypoints extends Component {
} }
createTopLevelNoteCommand() { noteCreateService.createNewTopLevelNote(); } createTopLevelNoteCommand() { noteCreateService.createNewTopLevelNote(); }
async openInWindowCommand({notePath}) {
if (utils.isElectron()) {
const {ipcRenderer} = utils.dynamicRequire('electron');
ipcRenderer.send('create-extra-window', {notePath});
}
else {
const url = window.location.protocol + '//' + window.location.host + window.location.pathname + '?extra=1#' + notePath;
window.open(url, '', 'width=1000,height=800');
}
}
async openNewWindowCommand() {
this.openInWindowCommand({notePath: ''});
}
async runActiveNoteCommand() {
const note = appContext.tabManager.getActiveTabNote();
// ctrl+enter is also used elsewhere so make sure we're running only when appropriate
if (!note || note.type !== 'code') {
return;
}
if (note.mime.endsWith("env=frontend")) {
await bundleService.getAndExecuteBundle(note.noteId);
}
if (note.mime.endsWith("env=backend")) {
await server.post('script/run/' + note.noteId);
}
toastService.showMessage("Note executed");
}
} }

View File

@@ -93,8 +93,8 @@ function updateDisplayedShortcuts($container) {
} }
}); });
$container.find('button[data-command],a.icon-action[data-command],.kb-in-title').each(async (i, el) => { $container.find('[data-trigger-command]').each(async (i, el) => {
const actionName = $(el).attr('data-command'); const actionName = $(el).attr('data-trigger-command');
const action = await getAction(actionName, true); const action = await getAction(actionName, true);
if (action) { if (action) {

View File

@@ -114,7 +114,7 @@ function newTabContextMenu(e) {
y: e.pageY, y: e.pageY,
items: [ items: [
{title: "Open note in new tab", command: "openNoteInNewTab", uiIcon: "arrow-up-right"}, {title: "Open note in new tab", command: "openNoteInNewTab", uiIcon: "arrow-up-right"},
{title: "Open note in new window", command: "openNoteInNewWindow", uiIcon: "arrow-up-right"} {title: "Open note in new window", command: "openNoteInNewWindow", uiIcon: "window-open"}
], ],
selectMenuItemHandler: ({command}) => { selectMenuItemHandler: ({command}) => {
if (command === 'openNoteInNewTab') { if (command === 'openNoteInNewTab') {

View File

@@ -38,12 +38,6 @@ export default class MainTreeExecutors extends Component {
isProtected: activeNote.isProtected, isProtected: activeNote.isProtected,
saveSelection: false saveSelection: false
}); });
await ws.waitForMaxKnownSyncId();
appContext.tabManager.getActiveTabContext().setNote(note.noteId);
appContext.triggerCommand('focusAndSelectTitle');
} }
async createNoteAfterCommand() { async createNoteAfterCommand() {
@@ -55,17 +49,11 @@ export default class MainTreeExecutors extends Component {
return; return;
} }
const {note} = await noteCreateService.createNote(parentNoteId, { await noteCreateService.createNote(parentNoteId, {
target: 'after', target: 'after',
targetBranchId: node.data.branchId, targetBranchId: node.data.branchId,
isProtected: isProtected, isProtected: isProtected,
saveSelection: true saveSelection: false
}); });
await ws.waitForMaxKnownSyncId();
appContext.tabManager.getActiveTabContext().setNote(note.noteId);
appContext.triggerCommand('focusAndSelectTitle');
} }
} }

View File

@@ -48,8 +48,12 @@ async function createNote(parentNoteId, options = {}) {
} }
if (options.activate) { if (options.activate) {
await ws.waitForMaxKnownSyncId();
const activeTabContext = appContext.tabManager.getActiveTabContext(); const activeTabContext = appContext.tabManager.getActiveTabContext();
activeTabContext.setNote(note.noteId); await activeTabContext.setNote(note.noteId);
appContext.triggerCommand('focusAndSelectTitle');
} }
return {note, branch}; return {note, branch};

View File

@@ -82,7 +82,7 @@ export default class TabManager extends Component {
if (filteredTabs.length === 0) { if (filteredTabs.length === 0) {
filteredTabs.push({ filteredTabs.push({
notePath: 'root', notePath: this.isMainWindow ? 'root' : '',
active: true active: true
}); });
} }
@@ -196,7 +196,9 @@ export default class TabManager extends Component {
async openTabWithNote(notePath, activate, tabId = null) { async openTabWithNote(notePath, activate, tabId = null) {
const tabContext = await this.openEmptyTab(tabId); const tabContext = await this.openEmptyTab(tabId);
await tabContext.setNote(notePath, !activate); // if activate is false then send normal noteSwitched event if (notePath) {
await tabContext.setNote(notePath, !activate); // if activate is false then send normal noteSwitched event
}
if (activate) { if (activate) {
this.activateTab(tabContext.tabId, false); this.activateTab(tabContext.tabId, false);
@@ -330,7 +332,7 @@ export default class TabManager extends Component {
this.removeTab(tabId); this.removeTab(tabId);
appContext.openInNewWindow(notePath); this.triggerCommand('openInWindow', {notePath});
} }
async hoistedNoteChangedEvent({hoistedNoteId}) { async hoistedNoteChangedEvent({hoistedNoteId}) {

View File

@@ -57,7 +57,7 @@ class TreeContextMenu {
return [ return [
{ title: 'Open in a new tab <kbd>Ctrl+Click</kbd>', command: "openInTab", uiIcon: "empty", enabled: noSelectedNotes }, { title: 'Open in a new tab <kbd>Ctrl+Click</kbd>', command: "openInTab", uiIcon: "empty", enabled: noSelectedNotes },
{ title: 'Open in a new window', command: "openInWindow", uiIcon: "empty", enabled: noSelectedNotes }, { title: 'Open in a new window', command: "openInWindow", uiIcon: "window-open", enabled: noSelectedNotes },
{ title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "plus", { title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "plus",
items: insertNoteAfterEnabled ? this.getNoteTypeItems("insertNoteAfter") : null, items: insertNoteAfterEnabled ? this.getNoteTypeItems("insertNoteAfter") : null,
enabled: insertNoteAfterEnabled && noSelectedNotes }, enabled: insertNoteAfterEnabled && noSelectedNotes },
@@ -113,9 +113,6 @@ class TreeContextMenu {
if (command === 'openInTab') { if (command === 'openInTab') {
appContext.tabManager.openTabWithNote(notePath); appContext.tabManager.openTabWithNote(notePath);
} }
else if (command === 'openInWindow') {
appContext.openInNewWindow(notePath);
}
else if (command === "insertNoteAfter") { else if (command === "insertNoteAfter") {
const parentNoteId = this.node.data.parentNoteId; const parentNoteId = this.node.data.parentNoteId;
const isProtected = await treeService.getParentProtectedStatus(this.node); const isProtected = await treeService.getParentProtectedStatus(this.node);
@@ -134,7 +131,7 @@ class TreeContextMenu {
}); });
} }
else { else {
this.treeWidget.triggerCommand(command, {node: this.node}); this.treeWidget.triggerCommand(command, {node: this.node, notePath: notePath});
} }
} }
} }

View File

@@ -21,15 +21,15 @@ const TPL = `
</style> </style>
<tr> <tr>
<th nowrap>Note ID:</th> <th>Note ID:</th>
<td nowrap colspan="3" class="note-info-note-id"></td> <td nowrap colspan="3" class="note-info-note-id"></td>
</tr> </tr>
<tr> <tr>
<th nowrap>Created:</th> <th>Created:</th>
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-created"></td> <td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-created"></td>
</tr> </tr>
<tr> <tr>
<th nowrap>Modified:</th> <th>Modified:</th>
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-modified"></td> <td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-modified"></td>
</tr> </tr>
<tr> <tr>
@@ -79,4 +79,4 @@ export default class NoteInfoWidget extends CollapsibleWidget {
this.refresh(); this.refresh();
} }
} }
} }

View File

@@ -18,17 +18,14 @@ const WIDGET_TPL = `
<a data-trigger-command="collapseTree" <a data-trigger-command="collapseTree"
title="Collapse note tree" title="Collapse note tree"
data-command="collapseTree"
class="icon-action bx bx-layer-minus"></a> class="icon-action bx bx-layer-minus"></a>
<a data-trigger-command="scrollToActiveNote" <a data-trigger-command="scrollToActiveNote"
title="Scroll to active note" title="Scroll to active note"
data-command="scrollToActiveNote"
class="icon-action bx bx-crosshair"></a> class="icon-action bx bx-crosshair"></a>
<a data-trigger-command="searchNotes" <a data-trigger-command="searchNotes"
title="Search in notes" title="Search in notes"
data-command="searchNotes"
class="icon-action bx bx-search"></a> class="icon-action bx bx-search"></a>
</div> </div>
`; `;

View File

@@ -1,5 +1,4 @@
import BasicWidget from "./basic_widget.js"; import BasicWidget from "./basic_widget.js";
import keyboardActionService from "../services/keyboard_actions.js";
import utils from "../services/utils.js"; import utils from "../services/utils.js";
import syncService from "../services/sync.js"; import syncService from "../services/sync.js";
@@ -39,6 +38,12 @@ const TPL = `
Sync (<span id="outstanding-syncs-count">0</span>) Sync (<span id="outstanding-syncs-count">0</span>)
</a> </a>
<a class="dropdown-item" data-trigger-command="openNewWindow">
<span class="bx bx-window-open"></span>
Open new window
<kbd data-command="openNewWindow"></kbd>
</a>
<a class="dropdown-item open-dev-tools-button" data-trigger-command="openDevTools"> <a class="dropdown-item open-dev-tools-button" data-trigger-command="openDevTools">
<span class="bx bx-terminal"></span> <span class="bx bx-terminal"></span>
Open Dev Tools Open Dev Tools

View File

@@ -186,7 +186,9 @@ export default class NoteDetailWidget extends TabAwareWidget {
const noteComplement = await this.tabContext.getNoteComplement(); const noteComplement = await this.tabContext.getNoteComplement();
if (note.hasLabel('readOnly') || if (note.hasLabel('readOnly') ||
(noteComplement.content && noteComplement.content.length > 10000)) { (noteComplement.content
&& noteComplement.content.length > 10000)
&& !note.hasLabel('autoReadOnlyDisabled')) {
type = 'read-only-text'; type = 'read-only-text';
} }
} }
@@ -195,7 +197,9 @@ export default class NoteDetailWidget extends TabAwareWidget {
const noteComplement = await this.tabContext.getNoteComplement(); const noteComplement = await this.tabContext.getNoteComplement();
if (note.hasLabel('readOnly') || if (note.hasLabel('readOnly') ||
(noteComplement.content && noteComplement.content.length > 30000)) { (noteComplement.content
&& noteComplement.content.length > 30000)
&& !note.hasLabel('autoReadOnlyDisabled')) {
type = 'read-only-code'; type = 'read-only-code';
} }
} }

View File

@@ -877,18 +877,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
noteIdsToUpdate.add(noteId); noteIdsToUpdate.add(noteId);
} }
for (const noteId of noteIdsToReload) {
for (const node of this.getNodesByNoteId(noteId)) {
await node.load(true);
this.updateNode(node);
}
}
await this.batchUpdate(async () => { await this.batchUpdate(async () => {
for (const noteId of noteIdsToUpdate) { for (const noteId of noteIdsToReload) {
for (const node of this.getNodesByNoteId(noteId)) { for (const node of this.getNodesByNoteId(noteId)) {
this.updateNode(node); await node.load(true);
noteIdsToUpdate.add(noteId);
} }
} }
@@ -910,6 +904,13 @@ export default class NoteTreeWidget extends TabAwareWidget {
} }
}); });
// for some reason node update cannot be in the batchUpdate() block (node is not re-rendered)
for (const noteId of noteIdsToUpdate) {
for (const node of this.getNodesByNoteId(noteId)) {
this.updateNode(node);
}
}
if (activeNotePath) { if (activeNotePath) {
let node = await this.expandToNote(activeNotePath); let node = await this.expandToNote(activeNotePath);

View File

@@ -3,10 +3,12 @@ import TabAwareWidget from "./tab_aware_widget.js";
const TPL = ` const TPL = `
<div style="display: inline-flex;"> <div style="display: inline-flex;">
<button class="btn btn-sm icon-button bx bx-play-circle render-button" <button class="btn btn-sm icon-button bx bx-play-circle render-button"
data-trigger-command="renderActiveNote"
title="Render"></button> title="Render"></button>
<button class="btn btn-sm icon-button bx bx-play-circle execute-script-button" <button class="btn btn-sm icon-button bx bx-play-circle execute-script-button"
title="Execute (Ctrl+Enter)"></button> data-trigger-command="runActiveNote"
title="Execute"></button>
</div>`; </div>`;
export default class RunScriptButtonsWidget extends TabAwareWidget { export default class RunScriptButtonsWidget extends TabAwareWidget {
@@ -21,6 +23,12 @@ export default class RunScriptButtonsWidget extends TabAwareWidget {
refreshWithNote(note) { refreshWithNote(note) {
this.$renderButton.toggle(note.type === 'render'); this.$renderButton.toggle(note.type === 'render');
this.$executeScriptButton.toggle(note.mime.startsWith('application/javascript')); this.$executeScriptButton.toggle(note.type === 'code' && note.mime.startsWith('application/javascript'));
}
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();
}
} }
} }

View File

@@ -29,11 +29,11 @@ const TAB_TPL = `
<div class="note-tab-wrapper"> <div class="note-tab-wrapper">
<div class="note-tab-title"></div> <div class="note-tab-title"></div>
<div class="note-tab-drag-handle"></div> <div class="note-tab-drag-handle"></div>
<div class="note-tab-close kb-in-title" title="Close tab" data-command="closeActiveTab"><span>×</span></div> <div class="note-tab-close" title="Close tab" data-trigger-command="closeActiveTab"><span>×</span></div>
</div> </div>
</div>`; </div>`;
const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab kb-in-title" data-command="openNewTab" title="Add new tab">+</div>`; const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab" data-trigger-command="openNewTab" title="Add new tab">+</div>`;
const FILLER_TPL = `<div class="tab-row-filler"> const FILLER_TPL = `<div class="tab-row-filler">
<div class="tab-row-border"></div> <div class="tab-row-border"></div>
</div>`; </div>`;
@@ -258,9 +258,9 @@ export default class TabRowWidget extends BasicWidget {
x: e.pageX, x: e.pageX,
y: e.pageY, y: e.pageY,
items: [ items: [
{title: "Move this tab to a new window", command: "moveTabToNewWindow", uiIcon: "empty"}, {title: "Move this tab to a new window", command: "moveTabToNewWindow", uiIcon: "window-open"},
{title: "Close all tabs", command: "removeAllTabs", uiIcon: "empty"}, {title: "Close all tabs", command: "removeAllTabs", uiIcon: "x"},
{title: "Close all tabs except for this", command: "removeAllTabsExceptForThis", uiIcon: "empty"}, {title: "Close all tabs except for this", command: "removeAllTabsExceptForThis", uiIcon: "x"},
], ],
selectMenuItemHandler: ({command}) => { selectMenuItemHandler: ({command}) => {
this.triggerCommand(command, {tabId}); this.triggerCommand(command, {tabId});
@@ -394,10 +394,13 @@ export default class TabRowWidget extends BasicWidget {
this.setupDraggabilly(); this.setupDraggabilly();
} }
setTabCloseEvent($tab) { closeActiveTabCommand({$el}) {
$tab.find('.note-tab-close') const tabId = $el.closest(".note-tab").attr('data-tab-id');
.on('click', _ => appContext.tabManager.removeTab($tab.attr('data-tab-id')));
appContext.tabManager.removeTab(tabId);
}
setTabCloseEvent($tab) {
$tab.on('mousedown', e => { $tab.on('mousedown', e => {
if (e.which === 2) { if (e.which === 2) {
appContext.tabManager.removeTab($tab.attr('data-tab-id')); appContext.tabManager.removeTab($tab.attr('data-tab-id'));
@@ -558,8 +561,6 @@ export default class TabRowWidget extends BasicWidget {
this.$newTab = $(NEW_TAB_BUTTON_TPL); this.$newTab = $(NEW_TAB_BUTTON_TPL);
this.$tabContainer.append(this.$newTab); this.$tabContainer.append(this.$newTab);
this.$newTab.on('click', _ => this.triggerCommand('openNewTab'));
} }
setupFiller() { setupFiller() {

View File

@@ -1,9 +1,6 @@
import libraryLoader from "../../services/library_loader.js"; import libraryLoader from "../../services/library_loader.js";
import bundleService from "../../services/bundle.js";
import toastService from "../../services/toast.js";
import server from "../../services/server.js";
import keyboardActionService from "../../services/keyboard_actions.js";
import TypeWidget from "./type_widget.js"; import TypeWidget from "./type_widget.js";
import keyboardActionService from "../../services/keyboard_actions.js";
const TPL = ` const TPL = `
<div class="note-detail-code note-detail-printable"> <div class="note-detail-code note-detail-printable">
@@ -27,11 +24,8 @@ export default class EditableCodeTypeWidget extends TypeWidget {
doRender() { doRender() {
this.$widget = $(TPL); this.$widget = $(TPL);
this.$editor = this.$widget.find('.note-detail-code-editor'); this.$editor = this.$widget.find('.note-detail-code-editor');
this.$executeScriptButton = this.$widget.find(".execute-script-button");
keyboardActionService.setElementActionHandler(this.$widget, 'runActiveNote', () => this.executeCurrentNote()); keyboardActionService.setupActionsForElement('code-detail', this.$widget, this);
this.$executeScriptButton.on('click', () => this.executeCurrentNote());
this.initialized = this.initEditor(); this.initialized = this.initEditor();
@@ -106,26 +100,6 @@ export default class EditableCodeTypeWidget extends TypeWidget {
this.codeEditor.focus(); this.codeEditor.focus();
} }
async executeCurrentNote() {
// ctrl+enter is also used elsewhere so make sure we're running only when appropriate
if (this.note.type !== 'code') {
return;
}
// make sure note is saved so we load latest changes
await this.spacedUpdate.updateNowIfNecessary();
if (this.note.mime.endsWith("env=frontend")) {
await bundleService.getAndExecuteBundle(this.noteId);
}
if (this.note.mime.endsWith("env=backend")) {
await server.post('script/run/' + this.noteId);
}
toastService.showMessage("Note executed");
}
cleanup() { cleanup() {
if (this.codeEditor) { if (this.codeEditor) {
this.spacedUpdate.allowUpdateWithoutChange(() => { this.spacedUpdate.allowUpdateWithoutChange(() => {

View File

@@ -25,9 +25,6 @@ export default class RenderTypeWidget extends TypeWidget {
this.$widget = $(TPL); this.$widget = $(TPL);
this.$noteDetailRenderHelp = this.$widget.find('.note-detail-render-help'); this.$noteDetailRenderHelp = this.$widget.find('.note-detail-render-help');
this.$noteDetailRenderContent = this.$widget.find('.note-detail-render-content'); this.$noteDetailRenderContent = this.$widget.find('.note-detail-render-content');
this.$renderButton = this.$widget.find('.render-button');
this.$renderButton.on('click', () => this.refresh());
return this.$widget; return this.$widget;
} }
@@ -46,4 +43,10 @@ export default class RenderTypeWidget extends TypeWidget {
cleanup() { cleanup() {
this.$noteDetailRenderContent.empty(); this.$noteDetailRenderContent.empty();
} }
renderActiveNoteEvent() {
if (this.tabContext.isActive()) {
this.refresh();
}
}
} }

View File

@@ -101,7 +101,7 @@ async function updateNoteAttributes(req) {
|| (attribute.type === 'relation' && attribute.value !== attributeEntity.value)) { || (attribute.type === 'relation' && attribute.value !== attributeEntity.value)) {
if (attribute.type !== 'relation' || !!attribute.value.trim()) { if (attribute.type !== 'relation' || !!attribute.value.trim()) {
const newAttribute = attribute.createClone(attribute.type, attribute.name, attribute.value); const newAttribute = attributeEntity.createClone(attribute.type, attribute.name, attribute.value);
await newAttribute.save(); await newAttribute.save();
} }
@@ -139,6 +139,7 @@ async function updateNoteAttributes(req) {
} }
const note = await repository.getNote(noteId); const note = await repository.getNote(noteId);
note.invalidateAttributeCache();
return await note.getAttributes(); return await note.getAttributes();
} }

View File

@@ -19,6 +19,7 @@ const BUILTIN_ATTRIBUTES = [
{ type: 'label', name: 'appTheme' }, { type: 'label', name: 'appTheme' },
{ type: 'label', name: 'hidePromotedAttributes' }, { type: 'label', name: 'hidePromotedAttributes' },
{ type: 'label', name: 'readOnly' }, { type: 'label', name: 'readOnly' },
{ type: 'label', name: 'autoReadOnlyDisabled' },
{ type: 'label', name: 'cssClass' }, { type: 'label', name: 'cssClass' },
{ type: 'label', name: 'iconClass' }, { type: 'label', name: 'iconClass' },
{ type: 'label', name: 'keyboardShortcut' }, { type: 'label', name: 'keyboardShortcut' },

View File

@@ -1 +1 @@
module.exports = { buildDate:"2020-05-04T21:59:14+02:00", buildRevision: "cafcb67a8a3a1943acac829590b34ff729b57e09" }; module.exports = { buildDate:"2020-05-06T23:24:13+02:00", buildRevision: "54ecd2ee75d1177cedadf9fee10319687feee5f0" };

View File

@@ -193,7 +193,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
{ {
separator: "Tabs" separator: "Tabs & Windows"
}, },
{ {
actionName: "openNewTab", actionName: "openNewTab",
@@ -219,6 +219,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [
description: "Activates tab on the left", description: "Activates tab on the left",
scope: "window" scope: "window"
}, },
{
actionName: "openNewWindow",
defaultShortcuts: [],
description: "Open new empty window",
scope: "window"
},
{ {

View File

@@ -293,15 +293,11 @@ async function downloadImages(noteId, content) {
if (!url.includes('api/images/') if (!url.includes('api/images/')
// this is and exception for the web clipper's "imageId" // this is and exception for the web clipper's "imageId"
&& (url.length !== 20 || url.toLowerCase().startsWith('http'))) { && (url.length !== 20 || url.toLowerCase().startsWith('http'))) {
if (url in downloadImagePromises) {
// download is already in progress
continue;
}
if (url in imageUrlToNoteIdMapping) { if (url in imageUrlToNoteIdMapping) {
const imageNote = await repository.getNote(imageUrlToNoteIdMapping[url]); const imageNote = await repository.getNote(imageUrlToNoteIdMapping[url]);
if (imageNote || imageNote.isDeleted) { if (!imageNote || imageNote.isDeleted) {
delete imageUrlToNoteIdMapping[url]; delete imageUrlToNoteIdMapping[url];
} }
else { else {
@@ -322,6 +318,11 @@ async function downloadImages(noteId, content) {
continue; continue;
} }
if (url in downloadImagePromises) {
// download is already in progress
continue;
}
// this is done asynchronously, it would be too slow to wait for the download // this is done asynchronously, it would be too slow to wait for the download
// given that save can be triggered very often // given that save can be triggered very often
downloadImagePromises[url] = downloadImage(noteId, url); downloadImagePromises[url] = downloadImage(noteId, url);
@@ -338,28 +339,30 @@ async function downloadImages(noteId, content) {
// are downloaded and the IMG references are not updated. For this occassion we have this code // are downloaded and the IMG references are not updated. For this occassion we have this code
// which upon the download of all the images will update the note if the links have not been fixed before // which upon the download of all the images will update the note if the links have not been fixed before
const imageNotes = await repository.getNotes(Object.values(imageUrlToNoteIdMapping)); await sql.transactional(async () => {
const imageNotes = await repository.getNotes(Object.values(imageUrlToNoteIdMapping));
const origNote = await repository.getNote(noteId); const origNote = await repository.getNote(noteId);
const origContent = await origNote.getContent(); const origContent = await origNote.getContent();
let updatedContent = origContent; let updatedContent = origContent;
for (const url in imageUrlToNoteIdMapping) { for (const url in imageUrlToNoteIdMapping) {
const imageNote = imageNotes.find(note => note.noteId === imageUrlToNoteIdMapping[url]); const imageNote = imageNotes.find(note => note.noteId === imageUrlToNoteIdMapping[url]);
if (imageNote && !imageNote.isDeleted) { if (imageNote && !imageNote.isDeleted) {
updatedContent = replaceUrl(updatedContent, url, imageNote); updatedContent = replaceUrl(updatedContent, url, imageNote);
}
} }
}
// update only if the links have not been already fixed. // update only if the links have not been already fixed.
if (updatedContent !== origContent) { if (updatedContent !== origContent) {
await origNote.setContent(updatedContent); await origNote.setContent(updatedContent);
await scanForLinks(origNote); await scanForLinks(origNote);
console.log(`Fixed the image links for note ${noteId} to the offline saved.`); console.log(`Fixed the image links for note ${noteId} to the offline saved.`);
} }
});
}, 5000); }, 5000);
}); });