Open exam-ple opened 3 months ago
@pjeby What I said "fix" doesn't mean fix the popover's position, it means if I open backlinks in the popover, it can be opened in another pane, not in the popover pane.
But now cann't tell if the popover has already been fixed or not, because the popover's interface keeps the same after using obsidian's pin command. So is it possible to show some difference in the popover's interface after using obsidian's pin command? like different color or shape of the pin icon in title bar
Sorry for my poor english. Thanks for your great plugin.
Unfortunately this is not a trivial thing; current versions of Obsidian have removed the code that used to show a pin icon on the view header, and Obsidian does not provide any style basis for knowing whether a pane is pinned. So we'd have to duplicate the application logic for this sort of thing and figure out how to add it. It's not likely to be something I'll have time for in the immediate future.
In the meantime, what I would recommend doing is that if you want things to open in a particular place, the easiest way to guarantee the location is to drag the link instead of clicking it. If you want it to open in the current pane, drag it to the tab or view header, otherwise drag it to a different tab or view header, and it will open there. This doesn't require you to pin or unpin anything.
@pjeby
Dragging the link(like links in linked mentions) can open it, but it's only opened at the top of the linked file, not at the position of the link.
Fortunately, some amazing guy has just solved this issue. Maybe it can inspire you and add this new feature to next version. https://forum-zh.obsidian.md/t/topic/38725/11?u=epe
const activeLeaf = app.workspace.activeLeaf;
const isPinned = activeLeaf?.getViewState()?.pinned;
if(!isPinned) {
activeLeaf.setPinned(true);
const hoverPinStyle = activeLeaf.containerEl.closest(".hover-popover")?.querySelector(".mod-pin-popover > svg")?.style;
if(hoverPinStyle) hoverPinStyle.color = 'red';
} else {
activeLeaf.setPinned(false);
const hoverPinStyle = activeLeaf.containerEl.closest(".hover-popover")?.querySelector(".mod-pin-popover > svg")?.style;
if(hoverPinStyle) hoverPinStyle.color = '';
if(!isPinned) {
activeLeaf.containerEl.closest(".hover-popover")?.querySelector(".popover-header-icon:not(.is-active)")?.click();
} else {
activeLeaf.containerEl.closest(".hover-popover")?.querySelector(".popover-header-icon.is-active")?.click();
}
The popover can be pinned to prevent it from auto closing, but it doesn't mean the popover is fixed, if I need to fix it, I have to use obsidian's pin command. The problem is sometimes I can't tell if the the popover is fixed or not, because even if I have used obsidian's pin command to fix it, there's no change in the popover's interface. So please show some change, like changing pin icon's color, to let user know the popover pane is fixed or not. Thanks.