Skip to content

Commit

Permalink
Merge pull request #87 from jparkerweb/develop
Browse files Browse the repository at this point in the history
v2.15.2
  • Loading branch information
jparkerweb authored Dec 21, 2024
2 parents 614e594 + acf81d8 commit 195c178
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Pixel Banner plugin will be documented in this file.

## v2.15.2
### 🐛 Fixed
- Fixed an issue with using the `Select Image` button to select an image with a `[` in the filename

## v2.15.1
### ✨ Added
- Option to select/upload images from your file system when using the `Select Image` button
Expand Down
4 changes: 4 additions & 0 deletions UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 🎉 What's New

### v2.15.2
#### 🐛 Fixed
- Fixed an issue with using the `Select Image` button to select an image with a `[` in the filename

### v2.15.1
#### ✨ Added
- Option to select/upload images from your file system when using the `Select Image` button
Expand Down
Binary file modified example-vault.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
"showPinIcon": true,
"pinnedImageFolder": "pixel-banner-images",
"showReleaseNotes": true,
"lastVersion": "2.15.0",
"lastVersion": "2.15.1",
"showRefreshIcon": true,
"showViewImageIcon": true,
"hidePixelBannerFields": true,
"hidePropertiesSectionIfOnlyBanner": true,
"hidePixelBannerFields": false,
"hidePropertiesSectionIfOnlyBanner": false,
"titleColor": "var(--inline-title-color)",
"enableImageShuffle": false,
"hideEmbeddedNoteTitles": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ var SaveImageModal = class extends import_obsidian2.Modal {
};

// virtual-module:virtual:release-notes
var releaseNotes = '<h2>\u{1F389} What&#39;s New</h2>\n<h3>v2.15.1</h3>\n<h4>\u2728 Added</h4>\n<ul>\n<li>Option to select/upload images from your file system when using the <code>Select Image</code> button</li>\n</ul>\n<h3>v2.15.0</h3>\n<h4>\u2728 Added</h4>\n<ul>\n<li>New \u{1F3F7}\uFE0F <code>Select Image</code> button icon to streamline selecting banner images via an image search modal (enabled by default)</li>\n<li>Default path setting to pre-filter the image search modal to a specific folder in your vault</li>\n<li>New command palette option to quickly open the image search/selection modal</li>\n<li>These enhancements make applying Pixel Banners to your notes simpler and more intuitive than ever</li>\n</ul>\n<p><a href="https://raw.githubusercontent.com/jparkerweb/ref/refs/heads/main/equill-labs/pixel-banner/pixel-banner-v2.15.0.jpg"><img src="https://raw.githubusercontent.com/jparkerweb/ref/refs/heads/main/equill-labs/pixel-banner/pixel-banner-v2.15.0.jpg" alt="screenshot"></a></p>\n';
var releaseNotes = '<h2>\u{1F389} What&#39;s New</h2>\n<h3>v2.15.2</h3>\n<h4>\u{1F41B} Fixed</h4>\n<ul>\n<li>Fixed an issue with using the <code>Select Image</code> button to select an image with a <code>[</code> in the filename</li>\n</ul>\n<h3>v2.15.1</h3>\n<h4>\u2728 Added</h4>\n<ul>\n<li>Option to select/upload images from your file system when using the <code>Select Image</code> button</li>\n</ul>\n<h3>v2.15.0</h3>\n<h4>\u2728 Added</h4>\n<ul>\n<li>New \u{1F3F7}\uFE0F <code>Select Image</code> button icon to streamline selecting banner images via an image search modal (enabled by default)</li>\n<li>Default path setting to pre-filter the image search modal to a specific folder in your vault</li>\n<li>New command palette option to quickly open the image search/selection modal</li>\n<li>These enhancements make applying Pixel Banners to your notes simpler and more intuitive than ever</li>\n</ul>\n<p><a href="https://raw.githubusercontent.com/jparkerweb/ref/refs/heads/main/equill-labs/pixel-banner/pixel-banner-v2.15.0.jpg"><img src="https://raw.githubusercontent.com/jparkerweb/ref/refs/heads/main/equill-labs/pixel-banner/pixel-banner-v2.15.0.jpg" alt="screenshot"></a></p>\n';

// src/main.js
function getFrontmatterValue(frontmatter, fieldNames) {
Expand Down Expand Up @@ -1803,7 +1803,7 @@ module.exports = class PixelBannerPlugin extends import_obsidian3.Plugin {
if (shufflePath) {
const randomImagePath = await this.getRandomImageFromFolder(shufflePath);
if (randomImagePath) {
bannerImage = `[[${randomImagePath}]]`;
bannerImage = `"${randomImagePath}"`;
}
}
if (!bannerImage) {
Expand Down Expand Up @@ -2826,15 +2826,15 @@ module.exports = class PixelBannerPlugin extends import_obsidian3.Plugin {
cleanedFrontmatter = cleanedFrontmatter.replace(fieldRegex, "");
});
cleanedFrontmatter = cleanedFrontmatter.trim();
const newFrontmatter = `${bannerField}: [[${selectedFile.path}]]${cleanedFrontmatter ? "\n" + cleanedFrontmatter : ""}`;
const newFrontmatter = `${bannerField}: "${selectedFile.path}"${cleanedFrontmatter ? "\n" + cleanedFrontmatter : ""}`;
return `---
${newFrontmatter}
---`;
});
} else {
const cleanContent = fileContent.replace(/^\s+/, "");
updatedContent = `---
${bannerField}: [[${selectedFile.path}]]
${bannerField}: "${selectedFile.path}"
---
${cleanContent}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "pexels-banner",
"name": "Pixel Banner",
"version": "2.15.1",
"version": "2.15.2",
"minAppVersion": "1.6.0",
"description": "Apply an image from various sources as a banner to your notes.",
"author": "Justin Parker (eQui\\\\ Labs)",
Expand Down
35 changes: 27 additions & 8 deletions example-vault/pixel-banner-example/.obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"state": {
"type": "markdown",
"state": {
"file": "🚩 Pixel-Banner.md",
"file": "Random Shuffle/Disney Lorcana.md",
"mode": "preview",
"source": true
},
"icon": "lucide-file",
"title": "🚩 Pixel-Banner"
"title": "Disney Lorcana"
}
}
]
Expand Down Expand Up @@ -1614,6 +1614,26 @@
{
"id": "885a094721cb9cec",
"type": "leaf",
"state": {
"type": "empty",
"state": {},
"icon": "lucide-file",
"title": "New tab"
}
},
{
"id": "f3d5566ab6e20998",
"type": "leaf",
"state": {
"type": "empty",
"state": {},
"icon": "lucide-file",
"title": "New tab"
}
},
{
"id": "b34c7709d94f729f",
"type": "leaf",
"state": {
"type": "Saved Queries View",
"state": {},
Expand All @@ -1622,7 +1642,7 @@
}
}
],
"currentTab": 150
"currentTab": 152
}
],
"direction": "horizontal",
Expand All @@ -1642,6 +1662,10 @@
},
"active": "5772e414935a6c5e",
"lastOpenFiles": [
"🚩 Pixel-Banner.md",
"Untitled.md",
"pixel-banner-images/garden[1].jpg",
"Untitled 1.md",
"shuffle-images/bell-hidden-archer.jpg",
"test blank note.png",
"test blank note.md",
Expand All @@ -1654,13 +1678,10 @@
"pixel-banner-images/good-art-is-never-forgotten.png",
"pixel-banner-images/justin.png",
"pixel-banner-images/father-and-child.png",
"pixel-banner-images/dog.png",
"pixel-banner-images/double-stack2.jpg",
"notes/📜 Embedded Note with Banner.md",
"notes/subfolder/Embedded Note in Subfolder.md",
"notes/📃 Embedded Note.md",
"releases/v2.14.0 - 👩‍👧‍👦 Hide the Children.md",
"🚩 Pixel-Banner.md",
"releases/v2.10.0 - 🖌️ Title Color.md",
"releases/v2.12.0 - 🔀 Random Image Shuffle.md",
"releases/v2.11.0 - 📌 Pin my URL Please.md",
Expand All @@ -1671,13 +1692,11 @@
"tests/🧪 test - 7- shuffle time!.md",
"tests/🧪 test - 3 - direct url link.md",
"tests/🧪 test - 5 - absolute position.md",
"Untitled 1.md",
"test.md",
"api.md",
"tests/🧪 test - 1 - internal link.md",
"tests/🧪 test - 2 - internal link - quoted.md",
"Lorem.Ipsum.md",
"tests/🧪 test - 7 - embed tests.md",
"Random Shuffle",
"shuffle-images",
"releases",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "pexels-banner",
"name": "Pixel Banner",
"version": "2.15.1",
"version": "2.15.2",
"minAppVersion": "1.6.0",
"description": "Apply an image from various sources as a banner to your notes.",
"author": "Justin Parker (eQui\\\\ Labs)",
Expand Down
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ module.exports = class PixelBannerPlugin extends Plugin {
// If shuffle path exists in frontmatter, use it
const randomImagePath = await this.getRandomImageFromFolder(shufflePath);
if (randomImagePath) {
bannerImage = `[[${randomImagePath}]]`;
bannerImage = `"${randomImagePath}"`;
}
}

Expand Down Expand Up @@ -1720,12 +1720,12 @@ module.exports = class PixelBannerPlugin extends Plugin {

// Add the new banner field at the start, ensuring no extra newlines
cleanedFrontmatter = cleanedFrontmatter.trim();
const newFrontmatter = `${bannerField}: [[${selectedFile.path}]]${cleanedFrontmatter ? '\n' + cleanedFrontmatter : ''}`;
const newFrontmatter = `${bannerField}: "${selectedFile.path}"${cleanedFrontmatter ? '\n' + cleanedFrontmatter : ''}`;
return `---\n${newFrontmatter}\n---`;
});
} else {
const cleanContent = fileContent.replace(/^\s+/, '');
updatedContent = `---\n${bannerField}: [[${selectedFile.path}]]\n---\n\n${cleanContent}`;
updatedContent = `---\n${bannerField}: "${selectedFile.path}"\n---\n\n${cleanContent}`;
}

updatedContent = updatedContent.replace(/^\s+/, '');
Expand Down

0 comments on commit 195c178

Please sign in to comment.