mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(popup_editor): integrate classic editor toolbar
This commit is contained in:
parent
308f319138
commit
91f94106fb
@ -266,6 +266,7 @@ export default class DesktopLayout {
|
|||||||
.cssBlock(".title-row > * { margin: 5px; }")
|
.cssBlock(".title-row > * { margin: 5px; }")
|
||||||
.child(new NoteIconWidget())
|
.child(new NoteIconWidget())
|
||||||
.child(new NoteTitleWidget()))
|
.child(new NoteTitleWidget()))
|
||||||
|
.child(new ClassicEditorToolbar())
|
||||||
.child(new NoteDetailWidget()));
|
.child(new NoteDetailWidget()));
|
||||||
|
|
||||||
applyModals(rootContainer);
|
applyModals(rootContainer);
|
||||||
|
@ -76,7 +76,6 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
|
|||||||
const $modalBody = $newWidget.find(".modal-body");
|
const $modalBody = $newWidget.find(".modal-body");
|
||||||
|
|
||||||
const children = this.$widget.children();
|
const children = this.$widget.children();
|
||||||
console.log("Got children", children);
|
|
||||||
$modalHeader.append(children[0]);
|
$modalHeader.append(children[0]);
|
||||||
$modalBody.append(children.slice(1));
|
$modalBody.append(children.slice(1));
|
||||||
this.$widget = $newWidget;
|
this.$widget = $newWidget;
|
||||||
|
@ -178,13 +178,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isClassicEditor) {
|
if (isClassicEditor) {
|
||||||
let $classicToolbarWidget;
|
const $classicToolbarWidget = this.findClassicToolbar();
|
||||||
if (!utils.isMobile()) {
|
|
||||||
const $parentSplit = this.$widget.parents(".note-split.type-text");
|
|
||||||
$classicToolbarWidget = $parentSplit.find("> .ribbon-container .classic-toolbar-widget");
|
|
||||||
} else {
|
|
||||||
$classicToolbarWidget = $("body").find(".classic-toolbar-widget");
|
|
||||||
}
|
|
||||||
|
|
||||||
$classicToolbarWidget.empty();
|
$classicToolbarWidget.empty();
|
||||||
if ($classicToolbarWidget.length) {
|
if ($classicToolbarWidget.length) {
|
||||||
@ -515,6 +509,22 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findClassicToolbar(): JQuery<HTMLElement> {
|
||||||
|
if (!utils.isMobile()) {
|
||||||
|
const $parentSplit = this.$widget.parents(".note-split.type-text");
|
||||||
|
|
||||||
|
if ($parentSplit.length) {
|
||||||
|
// The editor is in a normal tab.
|
||||||
|
return $parentSplit.find("> .ribbon-container .classic-toolbar-widget");
|
||||||
|
} else {
|
||||||
|
// The editor is in a popup.
|
||||||
|
return this.$widget.closest(".modal-body").find(".classic-toolbar-widget");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $("body").find(".classic-toolbar-widget");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTouchBarCommand(data: CommandListenerData<"buildTouchBar">) {
|
buildTouchBarCommand(data: CommandListenerData<"buildTouchBar">) {
|
||||||
const { TouchBar, buildIcon } = data;
|
const { TouchBar, buildIcon } = data;
|
||||||
const { TouchBarSegmentedControl, TouchBarGroup, TouchBarButton } = TouchBar;
|
const { TouchBarSegmentedControl, TouchBarGroup, TouchBarButton } = TouchBar;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user