feat: middle-click + mod-click on bookmarks opens in new tab

- File bookmarks: middle-click opens in new tab, mod+click opens in new leaf
- Group bookmarks: middle-click opens group's linked file in new tab,
  mod+click opens group's linked file (click still toggles collapse)
This commit is contained in:
olivier committed 2026-06-10 20:16:17 -04:00
1 parent 99a3ea80ae
commit 4278507ae2
2 files changed
+36 -8

No files matched your search

+4 -4
View File
@@ -2,15 +2,15 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/ */
var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var U=(f,d)=>{for(var t in d)$(f,t,{get:d[t],enumerable:!0})},K=(f,d,t,e)=>{if(d&&typeof d=="object"||typeof d=="function")for(let n of H(d))!_.call(f,n)&&n!==t&&$(f,n,{get:()=>d[n],enumerable:!(e=z(d,n))||e.enumerable});return f};var X=f=>K($({},"__esModule",{value:!0}),f);var ee={};U(ee,{default:()=>R});module.exports=X(ee);var u=require("obsidian");var j={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[]}};var g=require("obsidian"),W=class extends g.PluginSettingTab{constructor(d,t,e,n){super(d,t),this.plugin=t,this.settings=e,this.onSettingsChange=n}display(){let{containerEl:d}=this;d.empty(),new g.Setting(d).setHeading().setName("Calendar"),new g.Setting(d).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(r=>{this.settings.calendar.firstDayOfWeek=parseInt(r,10),this.saveAndRefresh()})}),new g.Setting(d).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(r=>{this.settings.calendar.showNoteIndicators=r,this.saveAndRefresh()})}),new g.Setting(d).setHeading().setName("Periodic Note Paths"),this.addPeriodNoteSettings("Daily",this.settings.daily),this.addPeriodNoteSettings("Weekly",this.settings.weekly),this.addPeriodNoteSettings("Monthly",this.settings.monthly),this.addPeriodNoteSettings("Quarterly",this.settings.quarterly),this.addPeriodNoteSettings("Yearly",this.settings.yearly),new g.Setting(d).setHeading().setName("Recent Files"),new g.Setting(d).setName("Max items").setDesc("Maximum number of recent files to track.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.setAttr("placeholder","50"),n.setValue(String(this.settings.recentFiles.maxItems)),n.inputEl.onblur=()=>{let r=parseInt(n.getValue(),10);!isNaN(r)&&r>0&&(this.settings.recentFiles.maxItems=r,this.saveAndRefresh())}}),new g.Setting(d).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(n=>{n.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(r=>{this.settings.recentFiles.updateOn=r,this.saveAndRefresh()})});let t=new DocumentFragment;t.appendText("Regex patterns for paths to exclude. One per line."),new g.Setting(d).setName("Omitted paths").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`^archives/ var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var U=(y,c)=>{for(var t in c)$(y,t,{get:c[t],enumerable:!0})},K=(y,c,t,e)=>{if(c&&typeof c=="object"||typeof c=="function")for(let n of H(c))!_.call(y,n)&&n!==t&&$(y,n,{get:()=>c[n],enumerable:!(e=z(c,n))||e.enumerable});return y};var X=y=>K($({},"__esModule",{value:!0}),y);var ee={};U(ee,{default:()=>R});module.exports=X(ee);var u=require("obsidian");var j={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[]}};var g=require("obsidian"),W=class extends g.PluginSettingTab{constructor(c,t,e,n){super(c,t),this.plugin=t,this.settings=e,this.onSettingsChange=n}display(){let{containerEl:c}=this;c.empty(),new g.Setting(c).setHeading().setName("Calendar"),new g.Setting(c).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(r=>{this.settings.calendar.firstDayOfWeek=parseInt(r,10),this.saveAndRefresh()})}),new g.Setting(c).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(r=>{this.settings.calendar.showNoteIndicators=r,this.saveAndRefresh()})}),new g.Setting(c).setHeading().setName("Periodic Note Paths"),this.addPeriodNoteSettings("Daily",this.settings.daily),this.addPeriodNoteSettings("Weekly",this.settings.weekly),this.addPeriodNoteSettings("Monthly",this.settings.monthly),this.addPeriodNoteSettings("Quarterly",this.settings.quarterly),this.addPeriodNoteSettings("Yearly",this.settings.yearly),new g.Setting(c).setHeading().setName("Recent Files"),new g.Setting(c).setName("Max items").setDesc("Maximum number of recent files to track.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.setAttr("placeholder","50"),n.setValue(String(this.settings.recentFiles.maxItems)),n.inputEl.onblur=()=>{let r=parseInt(n.getValue(),10);!isNaN(r)&&r>0&&(this.settings.recentFiles.maxItems=r,this.saveAndRefresh())}}),new g.Setting(c).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(n=>{n.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(r=>{this.settings.recentFiles.updateOn=r,this.saveAndRefresh()})});let t=new DocumentFragment;t.appendText("Regex patterns for paths to exclude. One per line."),new g.Setting(c).setName("Omitted paths").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`^archives/
\\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(` \\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.getValue().split(` `)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.getValue().split(`
`).filter(r=>r.trim()),this.saveAndRefresh()}});let e=new DocumentFragment;e.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new g.Setting(d).setName("Omitted tags").setDesc(e).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore `).filter(r=>r.trim()),this.saveAndRefresh()}});let e=new DocumentFragment;e.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new g.Setting(c).setName("Omitted tags").setDesc(e).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore
archive`),n.setValue(this.settings.recentFiles.omittedTags.join(` archive`),n.setValue(this.settings.recentFiles.omittedTags.join(`
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(` `)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(`
`).filter(r=>r.trim()),this.saveAndRefresh()}})}addPeriodNoteSettings(d,t){new g.Setting(this.containerEl).setHeading().setName(d),new g.Setting(this.containerEl).setName("Folder").setDesc(`Folder path for ${d.toLowerCase()} notes.`).addText(e=>{e.setPlaceholder("periodic/daily"),e.setValue(t.folder),e.onChange(n=>{t.folder=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Name format").setDesc(`Date format for ${d.toLowerCase()} note filenames (moment.js format).`).addText(e=>{e.setPlaceholder("yyyy-MM-dd"),e.setValue(t.nameFormat),e.onChange(n=>{t.nameFormat=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(e=>{e.setPlaceholder("Templates/Daily note"),e.setValue(t.templateFile),e.onChange(n=>{t.templateFile=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(e=>{e.setPlaceholder("daily-note"),e.setValue(t.typeProperty),e.onChange(n=>{t.typeProperty=n,this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveData(this.settings),this.onSettingsChange()}};var h=require("obsidian");var T=require("obsidian");function Q(f,d,t){let e=(0,T.moment)({year:f,month:d,day:1}),n=(0,T.moment)(e).endOf("month"),r=(0,T.moment)(e).subtract((e.day()-t+7)%7,"days"),a=(0,T.moment)().startOf("day"),s=[],o=(0,T.moment)(r);for(;o.isBefore(n)||o.month()===d;){let i=[];for(let l=0;l<7;l++)i.push({date:(0,T.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(a,"day"),isCurrentMonth:o.month()===d,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:i[0].isoWeekNumber,days:i}),s.length>=6)break}return s}var b="waypoint-view",Y=class extends h.ItemView{constructor(t,e){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.plugin=e}getViewType(){return b}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let e=t.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),r=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=e.createDiv({cls:"waypoint-calendar-top"}),s=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=r.format("[Q]Q");s.createSpan({cls:"waypoint-clickable",text:o}).addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",r)});let l=r.format("MMMM");s.createSpan({cls:"waypoint-clickable",text:l}).addEventListener("click",()=>{this.plugin.openPeriodNote("month",r)});let c=r.format("YYYY");s.createSpan({cls:"waypoint-clickable",text:c}).addEventListener("click",()=>{this.plugin.openPeriodNote("year",r)});let D=a.createDiv({cls:"waypoint-calendar-today-group"}),I=D.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),D.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let M=D.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(M,"chevron-right"),M.addEventListener("click",()=>this.navigateMonth(1));let E=e.createEl("table"),x=E.createEl("thead").createEl("tr");x.createEl("th",{text:""});let y=["sun","mon","tue","wed","thu","fri","sat"],N=this.plugin.settings.calendar.firstDayOfWeek;for(let v=0;v<7;v++){let S=(N+v)%7;x.createEl("th",{text:y[S]})}let w=E.createEl("tbody"),C=Q(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let v of C){let S=w.createEl("tr"),B=S.createEl("td",{cls:"waypoint-weeknum"});B.setText(String(v.weekNumber)),B.addEventListener("click",()=>{let k=v.days[0].date;this.plugin.openPeriodNote("week",k)});for(let k of v.days){let P=S.createEl("td",{cls:"waypoint-day"});if(P.setText(String(k.dayOfMonth)),k.isCurrentMonth||P.addClass("other-month"),k.isToday&&P.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let O=k.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(V=>V.extension==="md"&&V.basename===O)&&P.addClass("has-note")}P.addEventListener("click",()=>{this.plugin.openPeriodNote("day",k.date)})}}}navigateMonth(t){let e=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.redraw()}renderRecentFiles(){let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){ Line truncated `).filter(r=>r.trim()),this.saveAndRefresh()}})}addPeriodNoteSettings(c,t){new g.Setting(this.containerEl).setHeading().setName(c),new g.Setting(this.containerEl).setName("Folder").setDesc(`Folder path for ${c.toLowerCase()} notes.`).addText(e=>{e.setPlaceholder("periodic/daily"),e.setValue(t.folder),e.onChange(n=>{t.folder=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Name format").setDesc(`Date format for ${c.toLowerCase()} note filenames (moment.js format).`).addText(e=>{e.setPlaceholder("yyyy-MM-dd"),e.setValue(t.nameFormat),e.onChange(n=>{t.nameFormat=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(e=>{e.setPlaceholder("Templates/Daily note"),e.setValue(t.templateFile),e.onChange(n=>{t.templateFile=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(e=>{e.setPlaceholder("daily-note"),e.setValue(t.typeProperty),e.onChange(n=>{t.typeProperty=n,this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveData(this.settings),this.onSettingsChange()}};var h=require("obsidian");var T=require("obsidian");function Q(y,c,t){let e=(0,T.moment)({year:y,month:c,day:1}),n=(0,T.moment)(e).endOf("month"),r=(0,T.moment)(e).subtract((e.day()-t+7)%7,"days"),a=(0,T.moment)().startOf("day"),s=[],o=(0,T.moment)(r);for(;o.isBefore(n)||o.month()===c;){let i=[];for(let l=0;l<7;l++)i.push({date:(0,T.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(a,"day"),isCurrentMonth:o.month()===c,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:i[0].isoWeekNumber,days:i}),s.length>=6)break}return s}var D="waypoint-view",Y=class extends h.ItemView{constructor(t,e){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.plugin=e}getViewType(){return D}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let e=t.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),r=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=e.createDiv({cls:"waypoint-calendar-top"}),s=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=r.format("[Q]Q");s.createSpan({cls:"waypoint-clickable",text:o}).addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",r)});let l=r.format("MMMM");s.createSpan({cls:"waypoint-clickable",text:l}).addEventListener("click",()=>{this.plugin.openPeriodNote("month",r)});let d=r.format("YYYY");s.createSpan({cls:"waypoint-clickable",text:d}).addEventListener("click",()=>{this.plugin.openPeriodNote("year",r)});let v=a.createDiv({cls:"waypoint-calendar-today-group"}),I=v.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),v.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let S=v.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(S,"chevron-right"),S.addEventListener("click",()=>this.navigateMonth(1));let E=e.createEl("table"),x=E.createEl("thead").createEl("tr");x.createEl("th",{text:""});let f=["sun","mon","tue","wed","thu","fri","sat"],N=this.plugin.settings.calendar.firstDayOfWeek;for(let w=0;w<7;w++){let L=(N+w)%7;x.createEl("th",{text:f[L]})}let k=E.createEl("tbody"),P=Q(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let w of P){let L=k.createEl("tr"),B=L.createEl("td",{cls:"waypoint-weeknum"});B.setText(String(w.weekNumber)),B.addEventListener("click",()=>{let b=w.days[0].date;this.plugin.openPeriodNote("week",b)});for(let b of w.days){let C=L.createEl("td",{cls:"waypoint-day"});if(C.setText(String(b.dayOfMonth)),b.isCurrentMonth||C.addClass("other-month"),b.isToday&&C.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let O=b.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(V=>V.extension==="md"&&V.basename===O)&&C.addClass("has-note")}C.addEventListener("click",()=>{this.plugin.openPeriodNote("day",b.date)})}}}navigateMonth(t){let e=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.redraw()}renderRecentFiles(){let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){ Line truncated
type: ${a.typeProperty} type: ${a.typeProperty}
date: ${e.format("YYYY-MM-DD")} date: ${e.format("YYYY-MM-DD")}
--- ---
`;i=await this.app.vault.create(o,c)}}catch(l){new u.Notice(`Failed to create ${r.label.toLowerCase()} note: ${l.message}`);return}new u.Notice(`Created ${r.label.toLowerCase()} note: ${s}`)}i&&await this.app.workspace.getLeaf(!1).openFile(i)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,u.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,u.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,u.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,u.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,u.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let e=this.app.workspace.getActiveFile();if(!e){new u.Notice("No active file");return}let n=this.detectPeriodType(e.basename);if(!n){new u.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:r,date:a}=n;if(!a.isValid()){new u.Notice(`Could not parse date from filename: ${e.basename}`);return}let s=t==="next"?1:-1,o=r==="quarter"?a.clone().add(s*3,"months"):a.clone().add(s,`${r}s`);await this.openPeriodNote(r,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(b);for(let e of t)e.view instanceof Y&&e.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(e=>e.extension==="md"&&e.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(e=>e.extension==="md"&&e.basename===t)}}; `;i=await this.app.vault.create(o,d)}}catch(l){new u.Notice(`Failed to create ${r.label.toLowerCase()} note: ${l.message}`);return}new u.Notice(`Created ${r.label.toLowerCase()} note: ${s}`)}i&&await this.app.workspace.getLeaf(!1).openFile(i)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,u.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,u.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,u.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,u.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,u.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let e=this.app.workspace.getActiveFile();if(!e){new u.Notice("No active file");return}let n=this.detectPeriodType(e.basename);if(!n){new u.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:r,date:a}=n;if(!a.isValid()){new u.Notice(`Could not parse date from filename: ${e.basename}`);return}let s=t==="next"?1:-1,o=r==="quarter"?a.clone().add(s*3,"months"):a.clone().add(s,`${r}s`);await this.openPeriodNote(r,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(D);for(let e of t)e.view instanceof Y&&e.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(e=>e.extension==="md"&&e.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(e=>e.extension==="md"&&e.basename===t)}};
+32 -4
View File
@@ -540,10 +540,27 @@ export class WaypointView extends ItemView {
const labelEl = rowEl.createDiv({ cls: 'waypoint-bm-label', text: item.label }); const labelEl = rowEl.createDiv({ cls: 'waypoint-bm-label', text: item.label });
rowEl.addEventListener('click', () => { rowEl.addEventListener('click', (event: MouseEvent) => {
// Mod+click opens group's linked file
if (item.filePath && Keymap.isModEvent(event)) {
const tfile = this.app.vault.getFileByPath(item.filePath);
if (tfile) this.app.workspace.getLeaf(false).openFile(tfile);
return;
}
this.plugin.updateBookmark(item.id, { collapsed: !item.collapsed }); this.plugin.updateBookmark(item.id, { collapsed: !item.collapsed });
}); });
// Middle click on group header → open group's linked file in new tab
rowEl.addEventListener('mousedown', (event: MouseEvent) => {
if (event.button === 1 && item.filePath) {
event.preventDefault();
const tfile = this.app.vault.getFileByPath(item.filePath);
if (tfile) {
this.app.workspace.getLeaf('tab').openFile(tfile);
}
}
});
const childrenContainer = container.createDiv({ const childrenContainer = container.createDiv({
cls: `waypoint-bookmark-children${item.collapsed ? ' collapsed' : ''}`, cls: `waypoint-bookmark-children${item.collapsed ? ' collapsed' : ''}`,
}); });
@@ -559,18 +576,29 @@ export class WaypointView extends ItemView {
const labelEl = rowEl.createDiv({ cls: 'waypoint-bm-label', text: item.label }); const labelEl = rowEl.createDiv({ cls: 'waypoint-bm-label', text: item.label });
setTooltip(rowEl, item.filePath); setTooltip(rowEl, item.filePath);
rowEl.addEventListener('click', () => { rowEl.addEventListener('click', (event: MouseEvent) => {
if (item.filePath) { if (item.filePath) {
const tfile = this.app.vault.getFileByPath(item.filePath); const tfile = this.app.vault.getFileByPath(item.filePath);
if (tfile) { if (tfile) {
const leaf = this.app.workspace.getLeaf(false); const newLeaf = Keymap.isModEvent(event);
leaf.openFile(tfile); this.app.workspace.getLeaf(newLeaf as any).openFile(tfile);
} else { } else {
new Notice('File not found'); new Notice('File not found');
this.plugin.removeBookmark(item.id); this.plugin.removeBookmark(item.id);
} }
} }
}); });
// Middle click → open in new tab
rowEl.addEventListener('mousedown', (event: MouseEvent) => {
if (event.button === 1 && item.filePath) {
event.preventDefault();
const tfile = this.app.vault.getFileByPath(item.filePath);
if (tfile) {
this.app.workspace.getLeaf('tab').openFile(tfile);
}
}
});
} }
// ── Right-click context menu (both types) ── // ── Right-click context menu (both types) ──