generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 17
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 #15 from chhoumann/v1.6.1
- Loading branch information
Showing
13 changed files
with
191 additions
and
65 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
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,28 @@ | ||
import {TextInputSuggest} from "../../suggest"; | ||
import type {App} from "obsidian"; | ||
|
||
export class GenericTextSuggester extends TextInputSuggest<string> { | ||
|
||
constructor(public app: App, public inputEl: HTMLInputElement, private items: string[]) { | ||
super(app, inputEl); | ||
} | ||
|
||
getSuggestions(inputStr: string): string[] { | ||
const inputLowerCase: string = inputStr.toLowerCase(); | ||
return this.items.map(item => { | ||
if (item.toLowerCase().contains(inputLowerCase)) | ||
return item; | ||
}); | ||
} | ||
|
||
selectSuggestion(item: string): void { | ||
this.inputEl.value = item; | ||
this.inputEl.trigger("input"); | ||
this.close(); | ||
} | ||
|
||
renderSuggestion(value: string, el: HTMLElement): void { | ||
if (value) | ||
el.setText(value); | ||
} | ||
} |
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,4 @@ | ||
export interface DatedFileCacheItem { | ||
content: string, | ||
updateTime: number | ||
} |
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,28 @@ | ||
export class UniqueQueue<T> { | ||
private readonly elements: T[]; | ||
|
||
constructor() { | ||
this.elements = []; | ||
} | ||
|
||
public enqueue(item: T): boolean { | ||
if (this.elements.contains(item)) { | ||
return false; | ||
} | ||
|
||
this.elements.push(item); | ||
return true; | ||
} | ||
|
||
public dequeue(): T | undefined { | ||
return this.elements.shift(); | ||
} | ||
|
||
public peek(): T | undefined{ | ||
return this.elements[0]; | ||
} | ||
|
||
public isEmpty(): boolean { | ||
return this.elements.length === 0; | ||
} | ||
} |
Oops, something went wrong.