Merge branch 'master' into next55

# Conflicts:
#	electron.js
#	package-lock.json
#	package.json
#	src/public/app/layouts/desktop_layout.js
#	src/public/app/widgets/note_tree.js
#	src/services/port.js
This commit is contained in:
zadam
2022-10-15 12:09:25 +02:00
112 changed files with 1817 additions and 418 deletions

View File

@@ -4,6 +4,7 @@ import dateNoteService from "../../services/date_notes.js";
import server from "../../services/server.js";
import appContext from "../../services/app_context.js";
import RightDropdownButtonWidget from "./right_dropdown_button.js";
import toastService from "../../services/toast.js";
const DROPDOWN_TPL = `
<div class="calendar-dropdown-widget">
@@ -62,7 +63,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
this.hideDropdown();
}
else {
alert("Cannot find day note");
toastService.showError("Cannot find day note");
}
});
}

View File

@@ -49,4 +49,10 @@ export default class EditButton extends ButtonWidget {
this.refresh();
}
}
async noteTypeMimeChangedEvent({noteId}) {
if (this.isNote(noteId)) {
await this.refresh();
}
}
}

View File

@@ -35,9 +35,31 @@ const TPL = `
bottom: -30px;
width: 100%;
height: 100%;
pointer-events: none;
}
.update-to-latest-version-button {
display: none;
}
.global-menu .zoom-buttons a {
display: inline-block;
border: 1px solid var(--button-border-color);
border-radius: var(--button-border-radius);
color: var(--button-text-color);
background-color: var(--button-background-color);
padding: 3px;
margin-left: 3px;
}
.global-menu .zoom-buttons a:hover {
text-decoration: none;
}
.global-menu .zoom-state {
margin-left: 5px;
margin-right: 5px;
}
</style>
<button type="button" data-toggle="dropdown" data-placement="right"
@@ -92,11 +114,30 @@ const TPL = `
Reload frontend
<kbd data-command="reloadFrontendApp"></kbd>
</a>
<span class="zoom-container dropdown-item" style="display: flex; flex-direction: row; justify-content: space-between;">
<div>
<span class="bx bx-empty"></span>
Zoom
</div>
<div class="zoom-buttons">
<a data-trigger-command="toggleFullscreen" title="Toggle fullscreen" class="bx bx-expand-alt"></a>
&nbsp;
<a data-trigger-command="zoomOut" title="Zoom out" class="bx bx-minus"></a>
<span class="zoom-state"></span>
<a data-trigger-command="zoomIn" title="Zoom in" class="bx bx-plus"></a>
</div>
</span>
<a class="dropdown-item" data-trigger-command="toggleFullscreen">
<span class="bx bx-empty"></span>
Toggle fullscreen
<kbd data-command="toggleFullscreen"></kbd>
<kbd ></kbd>
</a>
<a class="dropdown-item" data-trigger-command="showHelp">
@@ -146,9 +187,13 @@ export default class GlobalMenuWidget extends BasicWidget {
this.$widget.find(".open-dev-tools-button").toggle(isElectron);
this.$widget.find(".switch-to-mobile-version-button").toggle(!isElectron);
this.$widget.on('click', '.dropdown-item', e => {
if ($(e.target).parent(".zoom-buttons")) {
return;
}
this.$widget.on('click', '.dropdown-item',
() => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
this.$widget.find("[data-toggle='dropdown']").dropdown('toggle');
});
this.$widget.find(".global-menu-button-update-available").append(
this.updateAvailableWidget.render()
@@ -156,11 +201,34 @@ export default class GlobalMenuWidget extends BasicWidget {
this.$updateToLatestVersionButton = this.$widget.find(".update-to-latest-version-button");
if (!utils.isElectron()) {
this.$widget.find(".zoom-container").hide();
}
this.$zoomState = this.$widget.find(".zoom-state");
this.$widget.on('show.bs.dropdown', () => this.updateZoomState());
this.$widget.find(".zoom-buttons").on("click",
// delay to wait for the actual zoom change
() => setTimeout(() => this.updateZoomState(), 300)
);
this.updateVersionStatus();
setInterval(() => this.updateVersionStatus(), 8 * 60 * 60 * 1000);
}
updateZoomState() {
if (!utils.isElectron()) {
return;
}
const zoomFactor = utils.dynamicRequire('electron').webFrame.getZoomFactor();
const zoomPercent = Math.round(zoomFactor * 100);
this.$zoomState.text(zoomPercent + "%");
}
async updateVersionStatus() {
if (options.get("checkForUpdates") !== 'true') {
return;

View File

@@ -1,5 +1,6 @@
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import utils from "../../services/utils.js";
import branchService from "../../services/branches.js";
const TPL = `
<div class="dropdown note-actions">
@@ -30,6 +31,7 @@ const TPL = `
<a data-trigger-command="openNoteExternally" class="dropdown-item open-note-externally-button"><kbd data-command="openNoteExternally"></kbd> Open note externally</a>
<a class="dropdown-item import-files-button">Import files</a>
<a class="dropdown-item export-note-button">Export note</a>
<a class="dropdown-item delete-note-button">Delete note</a>
<a data-trigger-command="printActiveNote" class="dropdown-item print-active-note-button"><kbd data-command="printActiveNote"></kbd> Print note</a>
</div>
</div>`;
@@ -65,6 +67,15 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
this.$widget.on('click', '.dropdown-item', () => this.$widget.find("[data-toggle='dropdown']").dropdown('toggle'));
this.$openNoteExternallyButton = this.$widget.find(".open-note-externally-button");
this.$deleteNoteButton = this.$widget.find(".delete-note-button");
this.$deleteNoteButton.on("click", () => {
if (this.note.noteId === 'root') {
return;
}
branchService.deleteNotes([this.note.getParentBranches()[0].branchId], true);
});
}
refreshWithNote(note) {

View File

@@ -8,7 +8,7 @@ const TPL = `
height: 21px !important;
padding: 0 !important;
border-radius: 8px;
border-radius: var(--button-border-radius);
transform: scale(0.9);
border: none;
opacity: 0.8;