Skip to content

Commit 80002ed

Browse files
committed
3.4.2
1 parent 313f8c0 commit 80002ed

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

main.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
350350
}
351351
const scrollItemsIntoView = obsidian.debounce( async (e,el) => {
352352
let target = ( el ? el : /body/i.test(e?.target?.tagName) ? workspace.getActiveViewOfType(obsidian.View).containerEl : e?.target || e?.containerEl );
353-
if ( target === undefined || target.closest('.is_continuous_mode') === null || /menu-item/.test(e.target.className) ) { return } // ignore e.target ancestor is not in continuous mode
353+
if ( target === undefined || target.closest('.is_continuous_mode') === null || /menu-item-title/.test(e?.target?.className) ) { return } // ignore e.target ancestor is not in continuous mode
354354
switch(true) {
355355
case ( target.closest('.mod-sidedock.mod-left-split,.mod-sidedock.mod-right-split') !== null ): scrollSideBarItems(target); break; // scroll sidebar items
356356
case ( /workspace-tab-header|workspace-leaf/.test(target.className) ): scrollRootItems(e,target); break; // scroll leaf into view
@@ -546,15 +546,13 @@ class ContinuousModePlugin extends obsidian.Plugin {
546546
&& !this.settings.excludedNames.includes( item.basename +'.'+ item.extension ) // remove items excluded by name
547547
);
548548
switch(true) { // warnings:
549+
case items.length > this.settings.maximumItemsToOpen && !window.confirm('Continuous Mode:\nOpening '+ this.settings.maximumItemsToOpen +' of '+ items.length +' items.\n(Change the “Maximum number of items to open at one time” setting to adjust this value.)'): resetPinnedLeaves(); return; // opening multiple items
549550
case (/replace/.test(action)) && this.settings.disableWarnings !== true
550-
&& !window.confirm('You are about to replace all items in the active split. Are you sure you want to do this? (This warning can be disabled in the settings.)'):
551-
resetPinnedLeaves(); return; // confirm
552-
case items.length > 99 && this.settings.disableWarnings !== true
553-
&& !window.confirm('Are you sure you want to open '+ items.length +' items? (This warning can be disabled in the settings.)'):
554-
resetPinnedLeaves(); return;// warn on opening > 99 notes
551+
&& !window.confirm('Continuous Mode:\nYou are about to replace all items currently open in the active split.\nAre you sure you want to do this?\n(This warning can be disabled in the settings.)'):
552+
resetPinnedLeaves(); return; // confirm replacing open items
555553
case items.length === 0:
556-
alert(type === 'document links' ? 'No document links found.' :
557-
'No readable files found.\nCheck the Settings to see if you have included any specific file types to be opened in Continuous Mode.');
554+
alert(type === 'document links' ? 'Continuous Mode: No document links found.' :
555+
'Continuous Mode:\nNo readable files found.\nCheck the Settings to see if you have included any specific file types to be opened in Continuous Mode.');
558556
resetPinnedLeaves(); return; // alert no items found
559557
}
560558
switch(true) {
@@ -677,6 +675,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
677675
this.registerDomEvent(document,'click', (e) => {
678676
let action = this.settings.allowSingleClickOpenFolderAction, path = '', items = null, active_leaf, active_compact_leaf;
679677
switch(true) {
678+
case ( /tree-item-icon/.test(e.target.className) ): e.stopPropagation(); break;
680679
case typeof e.target.className === 'string' && e.target?.className?.includes('metadata-'): break;
681680
case e.target.classList.contains('continuous_mode_open_links_button'): // nobreak
682681
case e.target.closest('.continuous_mode_open_links_button') !== null: showLinksMenu(e); break; // open links in continuous mode
@@ -689,12 +688,14 @@ class ContinuousModePlugin extends obsidian.Plugin {
689688
break;
690689
case ( /nav-folder-title/.test(e.target.className) && this.settings.allowSingleClickOpenFolder === true ) // open file explorer folders on single click
691690
&& e.target.closest('.nav-folder-collapse-indicator') === null && e.target.closest('.collapse-icon') === null
692-
&& !e.altKey && !e.ctrlKey && !e.shiftKey && e.button !== 2
693-
&& action !== 'disabled':
694-
sleep(0).then( () => {
695-
path = e.target.closest('.nav-folder-title')?.dataset?.path, items = this.app.vault.getFolderByPath(path)?.children;
696-
openItemsInContinuousMode(items,action,'folder');
697-
}); break;
691+
&& !e.altKey && !e.ctrlKey && !e.shiftKey && e.button !== 2:
692+
switch(true) {
693+
case action === 'disabled': return alert("Continuous Mode:\nPlease select a single click action in the settings.");
694+
default: sleep(0).then( () => {
695+
path = e.target.closest('.nav-folder-title')?.dataset?.path, items = this.app.vault.getFolderByPath(path)?.children;
696+
openItemsInContinuousMode(items,action,'folder');
697+
});
698+
} break;
698699
case e.target.classList.contains('menu-item-title'): // focus tab and scroll into view
699700
sleep(0).then( () => {
700701
active_leaf = workspace.activeTabGroup.children.find(child => child.tabHeaderEl.className.includes('is-active'));
@@ -711,6 +712,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
711712
let action = this.settings.allowSingleClickOpenFolderAction, path = '', items = null, active_leaf, active_compact_leaf;
712713
const testStr = /append .+ in active tab group|replace active tab group|open .+ in new split|compact mode:/i;
713714
switch(true) {
715+
case ( /tree-item-icon/.test(e.target.className) ): e.stopPropagation(); break;
714716
case ( e.target.classList.contains('menu-item-title') && testStr.test(e.target.innerText) ): setPinnedLeaves(); break; // CM menu items
715717
case ( /nav-folder-title/.test(e.target.className) && this.settings.allowSingleClickOpenFolder === true && !e.altKey && !e.ctrlKey && !e.shiftKey && e.button !== 2 ):
716718
setPinnedLeaves();
@@ -731,6 +733,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
731733
});
732734
this.registerDomEvent(document,'mouseup', (e) => {
733735
switch(true) {
736+
case ( /tree-item-icon/.test(e.target.className) ): e.stopPropagation();
734737
case this.settings.allowSingleClickOpenFolder === false:
735738
case this.settings.allowSingleClickOpenFolderAction === 'disabled':
736739
case ( /Toggle Compact Mode/.test(e.target.innerText) ): // from Tab Group Menu
@@ -768,7 +771,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
768771
}
769772
});
770773
this.registerDomEvent(window,'dragstart', (e) => {
771-
if ( !e.target.closest('.workspace-tabs')?.classList.contains('is_continuous_mode')) { return; }
774+
if ( e.target.nodeType !== 1 || !e.target?.closest('.workspace-tabs')?.classList?.contains('is_continuous_mode') ) { return; }
772775
if ( e.target.classList.contains('workspace-tab-header') ) { onTabHeaderDragEnd(e,getTabHeaderIndex(e)); } // get initial tab header index for onTabHeaderDragEnd()
773776
});
774777
/*-----------------------------------------------*/
@@ -1128,7 +1131,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
11281131
callback: () => {
11291132
let items = workspace.getLeavesOfType('file-explorer')[0].view.tree.focusedItem?.file?.children || workspace.getLeavesOfType('file-explorer')[0].view.tree?.focusedItem?.file || workspace.getLeavesOfType('file-explorer')[0].view.tree?.activeDom?.file;
11301133
if ( !items ) {
1131-
alert('No file explorer item selected')
1134+
alert('Continuous Mode:\nNo file explorer item selected')
11321135
} else {
11331136
setPinnedLeaves();
11341137
openItemsInContinuousMode(items,'open_'+action,'folder');
@@ -1165,7 +1168,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
11651168
if ( workspace.activeTabGroup.containerEl.classList.contains('is_continuous_mode') ) {
11661169
sortItems(this.app.appId +'_'+ workspace.activeTabGroup.id,key);
11671170
} else {
1168-
alert('Active tab group is not in continuous mode.');
1171+
alert('Continuous Mode:\nActive tab group is not in continuous mode.');
11691172
}
11701173
}
11711174
});
@@ -1302,7 +1305,7 @@ let ContinuousModeSettings = class extends obsidian.PluginSettingTab {
13021305
});
13031306
});
13041307
new obsidian.Setting(containerEl).setName('Maximum number of items to open at one time').setDesc('Leave empty (or set to 0) to open all items at once. Otherwise, setting a value here allows you to incrementally open the items in a folder (or search results or document links) by repeatedly selecting “Append items in Continuous Mode.” Useful for dealing with folders containing a large number of items. (Note: The “single click” action above must be set to one of the “Append” options.)')
1305-
.addText((A) => A.setPlaceholder("").setValue(this.plugin.settings.maximumItemsToOpen?.toString() || '')
1308+
.addText((A) => A.setPlaceholder("").setValue(this.plugin.settings.maximumItemsToOpen?.toString() || '0')
13061309
.onChange(async (value) => {
13071310
if ( isNaN(Number(value)) || !Number.isInteger(Number(value)) ) {
13081311
alert('Please enter a positive integer, 0, or leave blank.');

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "continuous-mode",
33
"name": "Continuous Mode",
4-
"version": "3.4.1",
4+
"version": "3.4.2",
55
"minAppVersion": "0.15.0",
66
"description": "Displays all open notes in a tab group as if they were a continuous scrollable document (sometimes called \"Scrivenings mode\"). Open all notes in Continuous Mode from a folder, search results, or links in a file or Dataview/query block; use arrow keys to navigate between notes; display notes in “Compact Mode” similar to Evernote or Bear; reorder notes via tab header drag-and-drop, sorting, more.",
77
"author": "Michael Schrauzer",

versions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"3.4.2": "3.4.2",
23
"3.4.1": "3.4.1",
34
"3.4.0": "3.4.0",
45
"3.3.3": "3.3.3",

0 commit comments

Comments
 (0)