2021-05-26 22:41:55 +02:00
|
|
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
|
|
|
import NoteTypeWidget from "../note_type.js";
|
|
|
|
import ProtectedNoteSwitchWidget from "../protected_note_switch.js";
|
2021-06-26 17:08:50 +02:00
|
|
|
import EditabilitySelectWidget from "../editability_select.js";
|
2021-10-05 22:08:02 +02:00
|
|
|
import BookmarkSwitchWidget from "../bookmark_switch.js";
|
2021-12-20 17:30:47 +01:00
|
|
|
import SharedSwitchWidget from "../shared_switch.js";
|
2021-05-26 22:41:55 +02:00
|
|
|
|
|
|
|
const TPL = `
|
|
|
|
<div class="basic-properties-widget">
|
|
|
|
<style>
|
|
|
|
.basic-properties-widget {
|
2021-06-26 17:08:50 +02:00
|
|
|
padding: 0px 12px 6px 12px;
|
2021-05-26 22:41:55 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: baseline;
|
2021-06-26 17:08:50 +02:00
|
|
|
flex-wrap: wrap;
|
2021-05-26 22:41:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.basic-properties-widget > * {
|
|
|
|
margin-right: 30px;
|
2021-06-26 17:08:50 +02:00
|
|
|
margin-top: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.note-type-container, .editability-select-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-05-26 22:41:55 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-06-13 22:55:31 +02:00
|
|
|
<div class="note-type-container">
|
2021-05-26 22:41:55 +02:00
|
|
|
<span>Note type:</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="protected-note-switch-container"></div>
|
2021-06-26 17:08:50 +02:00
|
|
|
|
|
|
|
<div class="editability-select-container">
|
|
|
|
<span>Editable:</span>
|
|
|
|
</div>
|
2021-10-05 22:08:02 +02:00
|
|
|
|
|
|
|
<div class="bookmark-switch-container"></div>
|
2021-12-20 17:30:47 +01:00
|
|
|
|
|
|
|
<div class="shared-switch-container"></div>
|
2021-05-26 22:41:55 +02:00
|
|
|
</div>`;
|
|
|
|
|
|
|
|
export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
2021-06-13 22:55:31 +02:00
|
|
|
this.noteTypeWidget = new NoteTypeWidget().contentSized();
|
|
|
|
this.protectedNoteSwitchWidget = new ProtectedNoteSwitchWidget().contentSized();
|
2021-06-26 17:08:50 +02:00
|
|
|
this.editabilitySelectWidget = new EditabilitySelectWidget().contentSized();
|
2021-10-05 22:08:02 +02:00
|
|
|
this.bookmarkSwitchWidget = new BookmarkSwitchWidget().contentSized();
|
2021-12-20 17:30:47 +01:00
|
|
|
this.sharedSwitchWidget = new SharedSwitchWidget().contentSized();
|
2021-05-26 22:41:55 +02:00
|
|
|
|
2021-10-05 22:08:02 +02:00
|
|
|
this.child(
|
|
|
|
this.noteTypeWidget,
|
|
|
|
this.protectedNoteSwitchWidget,
|
|
|
|
this.editabilitySelectWidget,
|
2021-12-20 17:30:47 +01:00
|
|
|
this.bookmarkSwitchWidget,
|
|
|
|
this.sharedSwitchWidget
|
2021-10-05 22:08:02 +02:00
|
|
|
);
|
2021-05-26 22:41:55 +02:00
|
|
|
}
|
|
|
|
|
2021-06-27 12:53:05 +02:00
|
|
|
get name() {
|
|
|
|
return "basicProperties";
|
|
|
|
}
|
|
|
|
|
2021-07-05 09:44:41 +02:00
|
|
|
get toggleCommand() {
|
|
|
|
return "toggleRibbonBasicProperties";
|
|
|
|
}
|
|
|
|
|
2021-05-26 22:41:55 +02:00
|
|
|
getTitle() {
|
|
|
|
return {
|
2022-08-05 19:15:28 +02:00
|
|
|
show: !this.note.isLaunchBarConfig(),
|
2021-05-26 22:41:55 +02:00
|
|
|
title: 'Basic Properties',
|
|
|
|
icon: 'bx bx-slider'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
doRender() {
|
|
|
|
this.$widget = $(TPL);
|
2021-06-13 22:55:31 +02:00
|
|
|
this.contentSized();
|
2021-05-26 22:41:55 +02:00
|
|
|
|
|
|
|
this.$widget.find(".note-type-container").append(this.noteTypeWidget.render());
|
|
|
|
this.$widget.find(".protected-note-switch-container").append(this.protectedNoteSwitchWidget.render());
|
2021-06-26 17:08:50 +02:00
|
|
|
this.$widget.find(".editability-select-container").append(this.editabilitySelectWidget.render());
|
2021-10-05 22:08:02 +02:00
|
|
|
this.$widget.find(".bookmark-switch-container").append(this.bookmarkSwitchWidget.render());
|
2021-12-20 17:30:47 +01:00
|
|
|
this.$widget.find(".shared-switch-container").append(this.sharedSwitchWidget.render());
|
2021-05-26 22:41:55 +02:00
|
|
|
}
|
2021-10-08 16:18:00 +02:00
|
|
|
|
|
|
|
async refreshWithNote(note) {
|
|
|
|
await super.refreshWithNote(note);
|
|
|
|
|
|
|
|
this.$widget.find(".editability-select-container").toggle(this.note && ['text', 'code'].includes(this.note.type))
|
|
|
|
}
|
2021-05-26 22:41:55 +02:00
|
|
|
}
|