Compare commits

...

13 Commits

Author SHA1 Message Date
zadam
6d2394a9da release 0.33.6 2019-07-02 22:26:05 +02:00
zadam
196264b8c2 use bootstrap modal to confirm note deletion which fixes #582 2019-07-02 21:54:37 +02:00
zadam
afe24866f0 some debug logging for duplicated nodes 2019-07-02 20:35:06 +02:00
zadam
d18a20cc06 fix focus issue from title to the text content with tab/enter 2019-07-02 20:28:57 +02:00
zadam
9c91b0459e release 0.33.5 2019-06-30 21:47:04 +02:00
zadam
af21dd4463 fix mobile text editor display 2019-06-30 20:14:57 +02:00
zadam
1ea0d283de fix text instance sometimes remaining displayed when switching to e.g. image 2019-06-30 19:41:26 +02:00
zadam
6e3d8472e1 avoid duplicate key error 2019-06-28 21:50:15 +02:00
zadam
2a9f36a027 fix activating parent note after delete 2019-06-27 22:58:04 +02:00
zadam
cf3726289c attempt to fix the duplicate issue 2019-06-27 21:24:25 +02:00
zadam
c8e4a5c9e7 release 0.33.4 2019-06-26 21:20:30 +02:00
zadam
a3951f1cce make sure autocomplete is closed when navigating to note 2019-06-26 21:08:54 +02:00
zadam
7c77ae758b fix frontend reload again 2019-06-26 20:49:17 +02:00
18 changed files with 69 additions and 28 deletions

View File

@@ -74,7 +74,7 @@ async function createMainWindow() {
const parsedUrl = url.parse(targetUrl);
// we still need to allow internal redirects from setup and migration pages
if (parsedUrl.hostname !== 'localhost' || parsedUrl.hostname !== '127.0.0.1' || (parsedUrl.path && parsedUrl.path !== '/')) {
if (!['localhost', '127.0.0.1'].includes(parsedUrl.hostname) || (parsedUrl.path && parsedUrl.path !== '/')) {
ev.preventDefault();
}
});

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.33.2-beta",
"version": "0.33.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2820,9 +2820,9 @@
"integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q=="
},
"electron": {
"version": "6.0.0-beta.10",
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.0-beta.10.tgz",
"integrity": "sha512-eKDUv5ZZGjFE2ccBQzBpY6j3oT1NvnHGLcSoGXp6vCWkx+ZYjPyujwG3gW61FK7iL5FMKyg9IlhCOsIy4HEruw==",
"version": "6.0.0-beta.11",
"resolved": "https://registry.npmjs.org/electron/-/electron-6.0.0-beta.11.tgz",
"integrity": "sha512-B6zh9c5pJ0BKKNkOEbF6vKXnBCWgtvY8LaUYDNeR9ttnPP0CCm0oovIoqP9/nN5gL8rlCoCgKWsjmiHu0jg7mA==",
"dev": true,
"requires": {
"@types/node": "^10.12.18",

View File

@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
"version": "0.33.3",
"version": "0.33.6",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
@@ -75,7 +75,7 @@
},
"devDependencies": {
"devtron": "1.4.0",
"electron": "6.0.0-beta.10",
"electron": "6.0.0-beta.11",
"electron-builder": "20.44.2",
"electron-compile": "6.4.4",
"electron-installer-debian": "2.0.0",

View File

@@ -7,8 +7,11 @@ const $custom = $("#confirm-dialog-custom");
const DELETE_NOTE_BUTTON_ID = "confirm-dialog-delete-note";
let resolve;
let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards
function confirm(message) {
$originallyFocused = $(':focus');
$custom.hide();
glob.activeDialog = $dialog;
@@ -55,6 +58,11 @@ $dialog.on("hidden.bs.modal", () => {
if (resolve) {
resolve(false);
}
if ($originallyFocused) {
$originallyFocused.focus();
$originallyFocused = null;
}
});
function doResolve(ret) {

View File

@@ -5,8 +5,11 @@ const $infoContent = $("#info-dialog-content");
const $okButton = $("#info-dialog-ok-button");
let resolve;
let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards
function info(message) {
$originallyFocused = $(':focus');
utils.closeActiveDialog();
glob.activeDialog = $dialog;
@@ -24,6 +27,11 @@ $dialog.on("hidden.bs.modal", () => {
if (resolve) {
resolve();
}
if ($originallyFocused) {
$originallyFocused.focus();
$originallyFocused = null;
}
});
$okButton.click(() => $dialog.modal("hide"));

View File

@@ -6,6 +6,7 @@ import treeCache from "./tree_cache.js";
import treeUtils from "./tree_utils.js";
import hoistedNoteService from "./hoisted_note.js";
import noteDetailService from "./note_detail.js";
import confirmDialog from "../dialogs/confirm.js";
async function moveBeforeNode(nodesToMove, beforeNode) {
nodesToMove = await filterRootNote(nodesToMove);
@@ -82,7 +83,7 @@ async function moveToNode(nodesToMove, toNode) {
async function deleteNodes(nodes) {
nodes = await filterRootNote(nodes);
if (nodes.length === 0 || !confirm('Are you sure you want to delete select note(s) and all the sub-notes?')) {
if (nodes.length === 0 || !await confirmDialog.confirm('Are you sure you want to delete select note(s) and all the sub-notes?')) {
return false;
}
@@ -102,7 +103,7 @@ async function deleteNodes(nodes) {
next = nodes[0].getPrevSibling();
}
if (!next && !hoistedNoteService.isTopLevelNode(nodes[0])) {
if (!next && !await hoistedNoteService.isTopLevelNode(nodes[0])) {
next = nodes[0].getParent();
}

View File

@@ -88,10 +88,13 @@ setTimeout(() => {
console.log("Lost connection to server");
}
try {
ws.send(JSON.stringify({
type: 'ping',
lastSyncId: lastSyncId
}));
}
catch (e) {} // if the connection is closed then this produces a lot of messages
}, 1000);
}, 0);

View File

@@ -405,7 +405,7 @@ tabRow.addListener('tabRemove', async ({ detail }) => {
if (tabContextToDelete) {
// sometimes there are orphan autocompletes after closing the tab
tabContextToDelete.$tabContent.find('.aa-input').autocomplete('close');
tabContextToDelete.closeAutocomplete();
await tabContextToDelete.saveNoteIfChanged();
tabContextToDelete.$tabContent.remove();

View File

@@ -1,5 +1,4 @@
import utils from "./utils.js";
import noteDetailService from "./note_detail.js";
import infoService from "./info.js";
import server from "./server.js";

View File

@@ -8,6 +8,7 @@ class NoteDetailText {
constructor(ctx) {
this.ctx = ctx;
this.$component = ctx.$tabContent.find('.note-detail-text');
this.$editorEl = this.$component.find('.note-detail-text-editor');
this.textEditor = null;
this.$component.on("dblclick", "img", e => {
@@ -39,7 +40,7 @@ class NoteDetailText {
// textEditor might have been initialized during previous await so checking again
// looks like double initialization can freeze CKEditor pretty badly
if (!this.textEditor) {
this.textEditor = await BalloonEditor.create(this.$component[0], {
this.textEditor = await BalloonEditor.create(this.$editorEl[0], {
placeholder: "Type the content of your note here ..."
});
@@ -73,7 +74,7 @@ class NoteDetailText {
}
focus() {
this.$component.focus();
this.$editorEl.focus();
}
getEditor() {

View File

@@ -109,6 +109,8 @@ class TabContext {
this.setTitleBar();
this.closeAutocomplete(); // esp. on windows autocomplete is not getting closed automatically
setTimeout(async () => {
// we include the note into recent list only if the user stayed on the note at least 5 seconds
if (notePath && notePath === this.notePath) {
@@ -334,6 +336,12 @@ class TabContext {
}
}
}
closeAutocomplete() {
if (utils.isDesktop()) {
this.$tabContent.find('.aa-input').autocomplete('close');
}
}
}
export default TabContext;

View File

@@ -630,10 +630,13 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
extraClasses: await treeBuilder.getExtraClasses(noteEntity),
icon: await treeBuilder.getIcon(noteEntity),
folder: extraOptions.type === 'search',
lazy: true
lazy: true,
key: utils.randomString(12) // this should prevent some "duplicate key" errors
};
if (target === 'after') {
console.log(`Appending node...`); // to debug duplicated nodes
await node.appendSibling(newNode).setActive(true);
}
else if (target === 'into') {
@@ -641,6 +644,8 @@ async function createNote(node, parentNoteId, target, extraOptions = {}) {
await node.setExpanded();
}
console.log(`Adding node as child...`); // to debug duplicated nodes
node.addChildren(newNode);
await node.getLastChild().setActive(true);

View File

@@ -83,7 +83,8 @@ async function prepareNode(branch) {
icon: await getIcon(note),
refKey: note.noteId,
expanded: branch.isExpanded || hoistedNoteId === note.noteId,
lazy: true
lazy: true,
key: utils.randomString(12) // this should prevent some "duplicate key" errors
};
if (note.hasChildren() || note.type === 'search') {

View File

@@ -135,13 +135,16 @@ ul.fancytree-container {
.note-detail-text h6 { font-size: 1.1em; }
.note-detail-text {
overflow: auto;
font-family: var(--detail-text-font-family);
}
.note-detail-text-editor {
padding-top: 10px;
border: 0 !important;
box-shadow: none !important;
/* This is because with empty content height of editor is 0 and it's impossible to click into it */
min-height: 200px;
padding-top: 10px;
overflow: auto;
font-family: var(--detail-text-font-family);
}
.note-detail-text p:first-child, .note-detail-text::before {

View File

@@ -1 +1 @@
module.exports = { buildDate:"2019-06-24T20:47:50+02:00", buildRevision: "1b831f94a98dbbb7184048f329ea89175841dec2" };
module.exports = { buildDate:"2019-07-02T22:26:05+02:00", buildRevision: "196264b8c2fc626e3114d65423c7110cff99ae85" };

View File

@@ -49,7 +49,9 @@
</div>
<div class="note-detail-component-wrapper">
<div class="note-detail-text note-detail-component" tabindex="10000"></div>
<div class="note-detail-text note-detail-component" tabindex="10000">
<div class="note-detail-text-editor"></div>
</div>
<div class="note-detail-code note-detail-component"></div>

View File

@@ -11,7 +11,9 @@
<table class="note-detail-promoted-attributes"></table>
<div class="note-detail-component-wrapper">
<div class="note-detail-text note-detail-component" tabindex="10000"></div>
<div class="note-detail-text note-detail-component">
<div class="note-detail-text-editor" tabindex="10000"></div>
</div>
<div class="note-detail-code note-detail-component"></div>