mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-01 12:27:41 +08:00
36 lines
765 B
JavaScript
36 lines
765 B
JavaScript
import options from "./options.js";
|
|
|
|
let instance;
|
|
|
|
function setupSplit(leftPaneVisible) {
|
|
if (instance) {
|
|
instance.destroy();
|
|
instance = null;
|
|
}
|
|
|
|
$("#left-pane").toggle(leftPaneVisible);
|
|
|
|
if (!leftPaneVisible) {
|
|
$("#center-pane").css('width', '100%');
|
|
|
|
return;
|
|
}
|
|
|
|
let leftPaneWidth = options.getInt('leftPaneWidth');
|
|
if (!leftPaneWidth || leftPaneWidth < 5) {
|
|
leftPaneWidth = 5;
|
|
}
|
|
|
|
if (leftPaneVisible) {
|
|
instance = Split(['#left-pane', '#center-pane'], {
|
|
sizes: [leftPaneWidth, 100 - leftPaneWidth],
|
|
gutterSize: 5,
|
|
onDragEnd: sizes => options.save('leftPaneWidth', Math.round(sizes[0]))
|
|
});
|
|
}
|
|
}
|
|
|
|
export default {
|
|
setupSplit
|
|
};
|