generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from renehernandez/highlight-improvements
Highlight improvements
- Loading branch information
Showing
25 changed files
with
600 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { IDateFactory, IDateHandler } from "./interface"; | ||
|
||
export class DateHandler implements IDateHandler { | ||
private moment: any; | ||
private date: any; | ||
|
||
constructor(date: any) { | ||
this.moment = window.moment; | ||
this.date = date; | ||
} | ||
|
||
fromNow(): string { | ||
return this.moment(this.date).fromNow(); | ||
} | ||
|
||
format(format?: string): string { | ||
return this.moment(this.date).format(format); | ||
} | ||
|
||
utc(): IDateHandler { | ||
return new DateHandler(this.moment(this.date).utc()); | ||
} | ||
} | ||
|
||
export class DateFactory implements IDateFactory { | ||
createHandler(date: any): IDateHandler { | ||
return new DateHandler(date); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export type { IDateFactory, IDateHandler } from "./interface"; | ||
export { DateHandler, DateFactory } from "./handler"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface IDateHandler { | ||
fromNow(): string; | ||
|
||
format(format?: string): string; | ||
|
||
utc(): IDateHandler; | ||
} | ||
|
||
export interface IDateFactory { | ||
createHandler(date: any): IDateHandler; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export type { IFileSystemHandler as IFileSystemHandler } from "./interface"; | ||
export { FileSystemHandler as FileSystemHandler } from "./handler"; | ||
export type { IFileSystemHandler } from "./interface"; | ||
export { FileSystemHandler } from "./handler"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.