Skip to content

Commit 758dfc6

Browse files
committed
feat: plugin compliance fixes and feed manager enhancements
1 parent ab682c8 commit 758dfc6

File tree

16 files changed

+438
-397
lines changed

16 files changed

+438
-397
lines changed

2.1.6.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/releases/2.1.6.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 2.1.6
22

3-
## Fixes
4-
- Removed `async` keyword from `onOpen` method in `dashboard-view.ts` to resolve warning about missing `await` expression.
3+
## Fixed
54

5+
- Removed `async` keyword from `onOpen` method in `dashboard-view.ts` to resolve warning about missing `await` expression.

docs/releases/2.1.7.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## 2.1.7
2+
3+
### Fixed
4+
- Improved CSS specificity to avoid conflicts with other plugins by adding plugin-specific classes
5+
- Fixed UI text to use sentence case as per Obsidian guidelines
6+
- Replaced type casting with `requireApiVersion()` for proper API version checking
7+
- Updated to use `FileManager.renameFile()` instead of `Vault.rename()` for better link updating
8+
- Made commands conditional based on active dashboard view
9+
- Implemented `AbstractInputSuggest` for file/folder selection with type-ahead support
10+
- Added `normalizePath()` for cleaning user-defined paths
11+
- Properly registered event listeners for clean plugin unloading
12+
- Removed manual folder hierarchy creation (let `Vault.createFolder()` handle it)
13+
- Considered media query alternatives to resize observers for better performance
14+
15+
### Added
16+
- Search functionality to Feed Manager modal with real-time filtering
17+
- Visual differentiation between folder names and feed names with improved hierarchy styling
18+
19+
### Changed
20+
- Removed URL column from Feed Manager modal for cleaner layout
21+
- Enhanced Feed Manager UI with top controls layout (search + add button)

main.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
WorkspaceLeaf,
55
setIcon,
66
Setting,
7-
Platform
7+
Platform,
8+
requireApiVersion
89
} from "obsidian";
910

1011
import {
@@ -36,8 +37,8 @@ export default class RssDashboardPlugin extends Plugin {
3637
public async getActiveDashboardView(): Promise<RssDashboardView | null> {
3738
const leaves = this.app.workspace.getLeavesOfType(RSS_DASHBOARD_VIEW_TYPE);
3839
for (const leaf of leaves) {
39-
if (typeof (leaf as WorkspaceLeaf & { loadIfDeferred?: () => Promise<void> }).loadIfDeferred === 'function') {
40-
await (leaf as WorkspaceLeaf & { loadIfDeferred: () => Promise<void> }).loadIfDeferred();
40+
if (requireApiVersion('1.7.2')) {
41+
await leaf.loadIfDeferred();
4142
}
4243
const view = leaf.view;
4344
if (view instanceof RssDashboardView) {
@@ -50,8 +51,8 @@ export default class RssDashboardPlugin extends Plugin {
5051
public async getActiveDiscoverView(): Promise<DiscoverView | null> {
5152
const leaves = this.app.workspace.getLeavesOfType(RSS_DISCOVER_VIEW_TYPE);
5253
for (const leaf of leaves) {
53-
if (typeof (leaf as WorkspaceLeaf & { loadIfDeferred?: () => Promise<void> }).loadIfDeferred === 'function') {
54-
await (leaf as WorkspaceLeaf & { loadIfDeferred: () => Promise<void> }).loadIfDeferred();
54+
if (requireApiVersion('1.7.2')) {
55+
await leaf.loadIfDeferred();
5556
}
5657
const view = leaf.view;
5758
if (view instanceof DiscoverView) {
@@ -64,8 +65,8 @@ export default class RssDashboardPlugin extends Plugin {
6465
public async getActiveReaderView(): Promise<ReaderView | null> {
6566
const leaves = this.app.workspace.getLeavesOfType(RSS_READER_VIEW_TYPE);
6667
for (const leaf of leaves) {
67-
if (typeof (leaf as WorkspaceLeaf & { loadIfDeferred?: () => Promise<void> }).loadIfDeferred === 'function') {
68-
await (leaf as WorkspaceLeaf & { loadIfDeferred: () => Promise<void> }).loadIfDeferred();
68+
if (requireApiVersion('1.7.2')) {
69+
await leaf.loadIfDeferred();
6970
}
7071
const view = leaf.view;
7172
if (view instanceof ReaderView) {
@@ -189,13 +190,22 @@ export default class RssDashboardPlugin extends Plugin {
189190
this.addCommand({
190191
id: "toggle-sidebar",
191192
name: "Toggle sidebar",
192-
callback: async () => {
193-
const view = await this.getActiveDashboardView();
194-
if (view) {
195-
this.settings.sidebarCollapsed = !this.settings.sidebarCollapsed;
196-
await this.saveSettings();
197-
view.render();
193+
checkCallback: (checking: boolean) => {
194+
const leaves = this.app.workspace.getLeavesOfType(RSS_DASHBOARD_VIEW_TYPE);
195+
if (leaves.length > 0) {
196+
if (!checking) {
197+
void (async () => {
198+
const view = await this.getActiveDashboardView();
199+
if (view) {
200+
this.settings.sidebarCollapsed = !this.settings.sidebarCollapsed;
201+
await this.saveSettings();
202+
view.render();
203+
}
204+
})();
205+
}
206+
return true;
198207
}
208+
return false;
199209
},
200210
});
201211

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"id": "rss-dashboard",
33
"name": "RSS Dashboard",
4-
"version": "2.1.6",
4+
"version": "2.1.7",
55
"minAppVersion": "1.1.0",
6-
"description": "A Dashboard for organizing and consuming RSS feeds, YouTube channels, and podcasts with smart tagging, media playback, and seamless content flow.",
6+
"description": "A dashboard for organizing and consuming RSS feeds, YouTube channels, and podcasts with smart tagging, media playback, and seamless content flow.",
77
"author": "Aditya Amatya",
88
"authorUrl": "https://github.com/amatya-aditya",
99
"fundingUrl": "https://buymeacoffee.com/amatya_aditya",

src/components/folder-suggest.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { AbstractInputSuggest, App } from "obsidian";
2+
import type { Folder } from "../types/types";
3+
4+
/**
5+
* Provides type-ahead folder suggestions for text inputs
6+
*/
7+
export class FolderSuggest extends AbstractInputSuggest<string> {
8+
private folders: string[];
9+
10+
/**
11+
* Collects all folder paths from the folder tree
12+
*/
13+
private collectAllFolders(folders: Folder[], base = ""): string[] {
14+
let paths: string[] = [];
15+
for (const f of folders) {
16+
const path = base ? `${base}/${f.name}` : f.name;
17+
paths.push(path);
18+
if (f.subfolders && f.subfolders.length > 0) {
19+
paths = paths.concat(this.collectAllFolders(f.subfolders, path));
20+
}
21+
}
22+
return paths.sort((a, b) => a.localeCompare(b));
23+
}
24+
25+
constructor(app: App, inputEl: HTMLInputElement, folders: Folder[]) {
26+
super(app, inputEl);
27+
this.folders = this.collectAllFolders(folders);
28+
}
29+
30+
/**
31+
* Updates the available folders
32+
*/
33+
public updateFolders(folders: Folder[]): void {
34+
this.folders = this.collectAllFolders(folders);
35+
}
36+
37+
/**
38+
* Returns filtered folder suggestions based on the query
39+
*/
40+
protected getSuggestions(query: string): string[] {
41+
const lowerQuery = query.toLowerCase();
42+
return this.folders.filter(folder =>
43+
folder.toLowerCase().includes(lowerQuery)
44+
);
45+
}
46+
47+
/**
48+
* Renders a folder suggestion in the dropdown
49+
*/
50+
public renderSuggestion(folder: string, el: HTMLElement): void {
51+
el.setText(folder);
52+
}
53+
54+
/**
55+
* Called when a folder is selected
56+
*/
57+
public selectSuggestion(folder: string): void {
58+
this.setValue(folder);
59+
this.close();
60+
}
61+
}

src/components/sidebar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ export class Sidebar {
875875
placeholder: "Enter folder name",
876876
autocomplete: "off"
877877
},
878-
cls: "full-width-input input-margin-bottom"
878+
cls: "rss-full-width-input rss-input-margin-bottom"
879879
});
880880
nameInput.spellcheck = false;
881881
nameInput.addEventListener("focus", () => nameInput.select());

0 commit comments

Comments
 (0)