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

This commit is contained in:
Elian Doran 2025-09-20 12:38:05 +03:00
parent c8a9b994d6
commit 2f4e13b1bb
No known key found for this signature in database
2 changed files with 17 additions and 22 deletions

View File

@ -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>
)
}

View File

@ -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();
}
}
}