Skip to content

Commit

Permalink
Fixes for plugin approval
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparschott committed Dec 23, 2023
1 parent 79da545 commit 5e7f1bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,16 @@ class ContinuousModePlugin extends obsidian.Plugin {
// REARRANGE LEAVES on dragend
const rearrangeLeaves = (e,initialTabHeaderIndex) => {
let this_tab_container = e.target.closest('.workspace-tabs').querySelector('.workspace-tab-container'); // get current tab container
let leaves = Array.from(this_tab_container.querySelectorAll('.workspace-leaf')); // get current tab container leaves
let leaves = Array.from(this_tab_container.children); // get current tab container leaves
let finalTabHeaderIndex = getTabHeaderIndex(e); // get final dropped tab header index
let rearranged = ''; // define rearranged leaves variable
let moved = leaves.splice(initialTabHeaderIndex,1); // get the moved leave
leaves.toSpliced(finalTabHeaderIndex,0,moved[0]); // move the moved leaf into position
leaves.forEach( leaf => rearranged += leaf.outerHTML ); // compose rearranged HTML
this_tab_container.innerHTML = rearranged; // replace tab container content with rearranged leaves
let rearranged = leaves.toSpliced(finalTabHeaderIndex,0,moved[0]); // move the moved leaf into position
this_tab_container.setChildrenInPlace(rearranged); // replace tab container content with rearranged leaves
getTabGroupHeaders()[finalTabHeaderIndex].click(); // confirm drag and focus leaf by clicking tab
}
// ARROW NAVIGATION between open leaves
const leafArrowNavigation = (e) => {
if ( getActiveLeaf().containerEl.closest('.workspace-split.mod-root') === null ) { return; } // return if not in leaf editor
if ( getActiveLeaf().containerEl.closest('.workspace-split.mod-root') === null || !getActiveEditor()?.hasFocus() ) { return; } // return if not in leaf editor or editor not focussed
let cursorAnchor = getActiveEditor()?.getCursor('anchor');
let activeTabGroupChildren = getActiveLeaf().workspace.activeTabGroup.children;
switch(true) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Continuous Mode",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "Displays all open notes (or \"leaves\") in a tab group as a continuous scrollable \"page\" (sometimes called \"Scrivenings mode\"). Features include arrow navigation between notes and the ability to reorder notes via tab header drag-and-drop.",
"description": "Displays all open notes (or \"leaves\") in a tab group as a continuous scrollable document (sometimes called \"Scrivenings mode\"). Features include arrow navigation between notes and the ability to reorder notes via tab header drag-and-drop.",
"author": "Michael Schrauzer",
"authorURL": "https://github.com/gasparschott/",
"fundingUrl": "https://www.buymeacoffee.com/fiLtliTFxQ",
Expand Down

0 comments on commit 5e7f1bd

Please sign in to comment.