mirror of
https://github.com/rabirabirara/obsidian-jelly-snippets.git
synced 2026-07-22 07:30:22 +00:00
fix: snippet rhs works with part divider correctly
This commit is contained in:
parent
6a0dd42fa7
commit
066cdab341
1 changed files with 5 additions and 3 deletions
8
main.ts
8
main.ts
|
|
@ -132,10 +132,12 @@ export default class JellySnippets extends Plugin {
|
|||
// trim() is used so that each snippet line does not retain newlines.
|
||||
// TODO: Add the newline symbol for dividers.
|
||||
let snippetParts = snippet.trim().split(this.settings.snippetPartDivider);
|
||||
if (snippetParts.length === 2) {
|
||||
this.searchSnippets[snippetParts[0]] = snippetParts[1];
|
||||
} else {
|
||||
let lhs = snippetParts.shift();
|
||||
let rhs = snippetParts.join(this.settings.snippetPartDivider);
|
||||
if (lhs === undefined) {
|
||||
console.log("Failed to register search snippet: ", snippet);
|
||||
} else {
|
||||
this.searchSnippets[lhs] = rhs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue