Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/type_widget): bring back order of editor/preview

Elian Doran2f4e13b1bba1
diff --git a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx
index 64fffd1fc6..f2554d9e17 100644
--- a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx
+++ b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx
@@ -16,19 +16,25 @@ export default function SplitEditor({ note }: TypeWidgetProps) {
const splitEditorOrientation = useSplitOrientation();
const [ readOnly ] = useNoteLabelBoolean(note, "readOnly");
+ const editor = (!readOnly &&
+ <div className="note-detail-split-editor-col">
+ <div className="note-detail-split-editor">Detail goes here.</div>
+ <div className="admonition caution note-detail-error-container hidden-ext">Errors go here.</div>
+ </div>
+ );
+
+ const preview = (
+ <div className="note-detail-split-preview-col">
+ <div className="note-detail-split-preview">Preview goes here</div>
+ <div className="btn-group btn-group-sm map-type-switcher content-floating-buttons preview-buttons bottom-right" role="group">Buttons go here</div>
+ </div>
+ );
+
return (
<div className={`note-detail-split note-detail-printable ${"split-" + splitEditorOrientation} ${readOnly ? "split-read-only" : ""}`}>
- {!readOnly && (
- <div className="note-detail-split-editor-col">
- <div className="note-detail-split-editor">Detail goes here.</div>
- <div className="admonition caution note-detail-error-container hidden-ext">Errors go here.</div>
- </div>
- )}
-
- <div className="note-detail-split-preview-col">
- <div className="note-detail-split-preview">Preview goes here</div>
- <div className="btn-group btn-group-sm map-type-switcher content-floating-buttons preview-buttons bottom-right" role="group">Buttons go here</div>
- </div>
+ {splitEditorOrientation === "horizontal"
+ ? <>{editor}{preview}</>
+ : <>{preview}{editor}</>}
</div>
)
}
diff --git a/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts b/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts
index 3850bd0830..5234f00376 100644
--- a/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts
+++ b/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts
@@ -104,11 +104,6 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
return;
}
- let elements = [ this.$editorCol[0], this.$previewCol[0] ];
- if (this.layoutOrientation === "vertical") {
- elements.reverse();
- }
-
this.splitInstance?.destroy();
if (!this.isReadOnly) {
@@ -158,10 +153,4 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
return this.editorTypeWidget.getData();
}
- entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
- if (loadResults.isOptionReloaded("splitEditorOrientation")) {
- this.refresh();
- }
- }
-
}