Skip to content

Commit

Permalink
Merge pull request #208 from snezhig/dev
Browse files Browse the repository at this point in the history
Add window frame feature, replace starred manager with bookmarks feature
  • Loading branch information
snezhig authored Mar 7, 2024
2 parents c64e198 + 7f6345b commit 743384b
Show file tree
Hide file tree
Showing 29 changed files with 353 additions and 325 deletions.
9 changes: 7 additions & 2 deletions config/services/feature.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import EnsureStrategy from "@src/Feature/Alias/Strategy/EnsureStrategy";
import AdjustStrategy from "@src/Feature/Alias/Strategy/AdjustStrategy";
import ReplaceStrategy from "@src/Feature/Alias/Strategy/ReplaceStrategy";
import SuggestFeature from "@src/Feature/Suggest/SuggestFeature";
import StarredManager from "@src/Feature/Starred/StarredManager";
import BookmarksManager from "@src/Feature/Bookmarks/BookmarksManager";
import GraphManager from "@src/Feature/Graph/GraphManager";
import { MarkdownHeaderManager } from "@src/Feature/MarkdownHeader/MarkdownHeaderManager";
import {
Expand All @@ -37,6 +37,7 @@ import { TFileExplorerItem } from "obsidian";
import { ResolverInterface } from "@src/Resolver/Interfaces";
import { ExplorerFileItemMutator } from "@src/Feature/Explorer/ExplorerFileItemMutator";
import Storage from "@src/Storage/Storage";
import WindowFrameFeature from "@src/Feature/WindowFrame/WindowFrameFeature";
import Container = interfaces.Container;

export default (container: Container) => {
Expand All @@ -57,9 +58,13 @@ export default (container: Container) => {
return feature;
});
container.bind<FeatureInterface<any>>(SI.feature).to(AliasFeature).whenTargetNamed(AliasFeature.getId());
container
.bind<FeatureInterface<any>>(SI.feature)
.to(WindowFrameFeature)
.whenTargetNamed(WindowFrameFeature.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(ExplorerManager).whenTargetNamed(ExplorerManager.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(SearchFeature).whenTargetNamed(SearchFeature.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(StarredManager).whenTargetNamed(StarredManager.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(BookmarksManager).whenTargetNamed(BookmarksManager.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(TabManager).whenTargetNamed(TabManager.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(SuggestFeature).whenTargetNamed(SuggestFeature.getId());
container.bind<FeatureInterface<any>>(SI.feature).to(GraphManager).whenTargetNamed(GraphManager.getId());
Expand Down
2 changes: 1 addition & 1 deletion docker.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker run -it -u 1000 -w /app -v "$(pwd)":/app -v "$(pwd)/../ofmt-api":/ofmt-api node "$@"
docker run -it -u 1000 -w /app -v "$(pwd)":/app -v "$(pwd)/../ofmt-api":/ofmt-api node "$@"
51 changes: 29 additions & 22 deletions docs/Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,81 @@

> Modify frontmatter cache to add or replace alias or just ensure that the one exists
| Disabled | Enabled |
|:---------------------------------------:|:--------------------------------------:|
| Disabled | Enabled |
|:------------------------:|:-----------------------:|
| ![](img/Alias%20Off.png) | ![](img/Alias%20On.png) |

## Explorer

> Display titles in app`s file explorer
| Disabled | Enabled |
|:------------------------------------------:|:-----------------------------------------:|
| Disabled | Enabled |
|:---------------------------:|:--------------------------:|
| ![](img/Explorer%20Off.png) | ![](img/Explorer%20On.png) |

## Explorer Sort

> Sort files by custom titles. Available only if Explorer is enabled
| Disabled | Enabled |
|:-----------------------------------------:|:---------------------------------------------:|
| Disabled | Enabled |
|:--------------------------:|:------------------------------:|
| ![](img/Explorer%20On.png) | ![](img/ExplorerSort%20On.png) |

## Graph

> Display titles in app's graph and local-graph
| Disabled | Enabled |
|:---------------------------------------:|:--------------------------------------:|
| Disabled | Enabled |
|:------------------------:|:-----------------------:|
| ![](img/Graph%20Off.png) | ![](img/Graph%20On.png) |

## Header

> Display title in opened file's header
| Disabled | Enabled |
|:-----------------------------------------:|:----------------------------------------:|
| Disabled | Enabled |
|:--------------------------:|:-------------------------:|
| ![](img/Heading%20Off.png) | ![](img/Heading%20On.png) |

## Starred
## Bookmarks

> Display title in starred window
> Display title in bookmarks window
| Disabled | Enabled |
|:-----------------------------------------:|:----------------------------------------:|
| ![](img/Starred%20Off.png) | ![](img/Starred%20on.png) |
| Disabled | Enabled |
|:-------------------------:|:------------------------:|
| ![](img/BookmarksOff.png) | ![](img/BookmarksOn.png) |

## Search

> Display titles in the search window
| Disabled | Enabled |
|:----------------------------------------:|:---------------------------------------:|
| Disabled | Enabled |
|:-------------------------:|:------------------------:|
| ![](img/Search%20Off.png) | ![](img/Search%20On.png) |

## Suggest

> Display titles in suggest modal\windows.
| Disabled | Enabled |
|:---------------------------------------------:|:--------------------------------------------:|
| Disabled | Enabled |
|:------------------------------:|:-----------------------------:|
| ![](img/Suggest%20Off%201.png) | ![](img/Suggest%20On%201.png) |
| ![](img/Suggest%20Off%202.png) | ![](img/Suggest%20On%202.png) |

## Tab

> Display titles in leaf's tab
| Disabled | Enabled |
|:-------------------------------------:|:------------------------------------:|
| Disabled | Enabled |
|:----------------------:|:---------------------:|
| ![](img/Tab%20Off.png) | ![](img/Tab%20On.png) |

## Note Link
> [Click Here](./Features/NoteLink.md)

> [Click Here](./Features/NoteLink.md)
## Window Frame

| Disabled | Enabled |
|:---------------------------:|:--------------------------:|
| ![](img/WindowFrameOff.png) | ![](img/WindowFrameOn.png) |
Binary file added docs/img/BookmarksOff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/BookmarksOn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/Starred Off.png
Binary file not shown.
Binary file removed docs/img/Starred on.png
Binary file not shown.
Binary file added docs/img/WindowFrameOff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/WindowFrameOn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "obsidian-front-matter-title-plugin",
"name": "Front Matter Title",
"version": "3.8.4",
"minAppVersion": "0.16.3",
"version": "3.9.0",
"minAppVersion": "1.5.3",
"description": "Lets you define a title in frontmatter to be displayed as the filename for explorer, graph, search and etc.",
"author": "Snezhig",
"authorUrl": "https://github.com/snezhig",
Expand Down
2 changes: 1 addition & 1 deletion modules/api-provider
47 changes: 28 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-sample-plugin",
"version": "3.8.4",
"version": "3.9.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -33,7 +33,7 @@
"eslint": "^8.44.0",
"jest": "^29.6.1",
"jest-mock-extended": "^3.0.4",
"obsidian": "^1.2.8",
"obsidian": "^1.4.11",
"prettier": "^2.8.8",
"ts-debounce": "^4.0.0",
"ts-jest": "^29.1.1",
Expand Down
6 changes: 3 additions & 3 deletions src/Enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export enum Leaves {
MD = "markdown",
BL = "backlink",
S = "search",
ST = "starred",
Bookmarks = "bookmarks",
CV = "canvas",
}

export enum Feature {
Explorer = "explorer",
Graph = "graph",
Header = "header",
Starred = "starred",
Bookmarks = "bookmarks",
Search = Leaves.S,
Tab = "tab",
Alias = "alias",
Expand All @@ -22,13 +22,13 @@ export enum Feature {
Canvas = "canvas",
Backlink = Leaves.BL,
NoteLink = "noteLink",
WindowFrame = "windowFrame",
}

export const Managers = [
Feature.Explorer,
Feature.Graph,
Feature.Header,
Feature.Starred,
Feature.Tab,
Feature.InlineTitle,
Feature.Canvas,
Expand Down
3 changes: 2 additions & 1 deletion src/Feature/Alias/Alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default class Alias {
}

public getValue(): string | string[] | null {
return this.cache[this.getKey()] ?? null;
const val = this.cache[this.getKey()] ?? null;
return Array.isArray(val) ? [...val] : val;
}

public setValue(alias: string | string[]): void {
Expand Down
Loading

0 comments on commit 743384b

Please sign in to comment.