diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2022-05-31 12:07:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 06:07:17 -0500 |
commit | ca7b7db66b357193f89cf5baf9f86d07d5941fc7 (patch) | |
tree | 02f57a7f961c0c5b57b27af250315896c57e9ced /src/webview/lib | |
parent | 6.0.0-nightly.49 [skip ci] (diff) | |
download | ferdium-app-ca7b7db66b357193f89cf5baf9f86d07d5941fc7.tar.gz ferdium-app-ca7b7db66b357193f89cf5baf9f86d07d5941fc7.tar.zst ferdium-app-ca7b7db66b357193f89cf5baf9f86d07d5941fc7.zip |
Expose a new utility method 'Ferdium.isImage' for use by recipes
Diffstat (limited to 'src/webview/lib')
-rw-r--r-- | src/webview/lib/RecipeWebview.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/webview/lib/RecipeWebview.ts b/src/webview/lib/RecipeWebview.ts index e7a39579b..3afb93acb 100644 --- a/src/webview/lib/RecipeWebview.ts +++ b/src/webview/lib/RecipeWebview.ts | |||
@@ -93,6 +93,15 @@ class RecipeWebview { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Find if url contains image | ||
97 | * | ||
98 | * @param {string | number | undefined | null} text to be parsed | ||
99 | */ | ||
100 | isImage(url): boolean { | ||
101 | return /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url); | ||
102 | } | ||
103 | |||
104 | /** | ||
96 | * Injects the contents of a CSS file into the current webview | 105 | * Injects the contents of a CSS file into the current webview |
97 | * | 106 | * |
98 | * @param {Array} files CSS files that should be injected. This must | 107 | * @param {Array} files CSS files that should be injected. This must |