Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/lib/editorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ async function EditorManager($header, $body) {
const primaryPane = createPaneShell($container);
paneLayoutRoot = createPaneNode(primaryPane);
$paneRoot.append(paneLayoutRoot.element);
applyOpenFileListLayout();
const problemButton = SideButton({
text: strings.problems,
icon: "warningreport_problem",
Expand Down Expand Up @@ -3941,8 +3942,8 @@ async function EditorManager($header, $body) {
}

function syncOpenFileList() {
applyOpenFileListLayout();
if (isPaneTabLayout()) {
$paneRoot.classList.remove("hide-pane-tabs");
panes.forEach((pane) => {
const preserveCurrentTabOrder = !!pane.tabList.querySelector(
'[data-editor-tab-dragging="true"]',
Expand All @@ -3958,7 +3959,6 @@ async function EditorManager($header, $body) {
return;
}

$paneRoot.classList.add("hide-pane-tabs");
if (!$openFileList || $openFileList === $globalOpenFileList) {
initFileTabContainer();
}
Expand Down Expand Up @@ -4180,6 +4180,26 @@ async function EditorManager($header, $body) {
);
}

function applyOpenFileListLayout(
openFileListPos = appSettings.value.openFileListPos,
) {
const showPaneTabs =
openFileListPos === appSettings.OPEN_FILE_LIST_POS_HEADER ||
openFileListPos === appSettings.OPEN_FILE_LIST_POS_BOTTOM;

$paneRoot.classList.toggle("hide-pane-tabs", !showPaneTabs);
if (openFileListPos === appSettings.OPEN_FILE_LIST_POS_BOTTOM) {
$paneRoot.dataset.tabsPosition = "bottom";
} else if (openFileListPos === appSettings.OPEN_FILE_LIST_POS_HEADER) {
// Header mode is rendered as the pane's top tab bar.
$paneRoot.dataset.tabsPosition = "top";
} else {
// Sidebar mode has no pane tab placement.
delete $paneRoot.dataset.tabsPosition;
}
root.setAttribute("open-file-list-pos", openFileListPos);
}

/**
* Sets up the editor with various configurations and event listeners.
* @returns {Promise<void>} A promise that resolves once the editor is set up.
Expand Down Expand Up @@ -4977,10 +4997,6 @@ async function EditorManager($header, $body) {
const { openFileListPos } = appSettings.value;
if (isPaneTabLayout()) {
$openFileList = $globalOpenFileList;
$paneRoot.dataset.tabsPosition =
openFileListPos === appSettings.OPEN_FILE_LIST_POS_BOTTOM
? "bottom"
: "top";
root.classList.remove("top-bar");
syncOpenFileList();
} else {
Expand All @@ -5000,7 +5016,6 @@ async function EditorManager($header, $body) {
syncOpenFileList();
}

root.setAttribute("open-file-list-pos", openFileListPos);
manager.emit("int-open-file-list", openFileListPos);
}

Expand Down