fix: accept direct icon URLs
Use valid direct HTTP(S) icon URLs without repository search.
This commit is contained in:
1 parent
fcc5130068
commit
edb56f3fcd
3 files changed
+14
-4
No files matched your search
@@ -31,4 +31,4 @@ Icons that are high quality and printable ([SVG](https://wikipedia.org/wiki/Scal
|
|||||||
|
|
||||||
### Using external icons
|
### Using external icons
|
||||||
If you don't find the icon you're looking for on Dashboard Icons or wish to use a different source, you can simply enter a URL that points to an icon.
|
If you don't find the icon you're looking for on Dashboard Icons or wish to use a different source, you can simply enter a URL that points to an icon.
|
||||||
It is important that the URL directly points to the file without any advertisements or elements around it.
|
Direct HTTP(S) image URLs are used as entered instead of being searched in the built-in repositories. It is important that the URL directly points to the file without any advertisements or elements around it.
|
||||||
@@ -28,7 +28,7 @@ The name must be at least one character long and can be chosen freely.
|
|||||||
### Icon URL
|
### Icon URL
|
||||||
|
|
||||||
This is the URL to the icon that will be displayed on the app widget.
|
This is the URL to the icon that will be displayed on the app widget.
|
||||||
It can be a url to an image in the internet, one from the included icon repositories or a local file uploaded through the upload button.
|
You can paste a direct HTTP(S) URL to an image, search the included icon repositories by name, or upload a local file through the upload button. Direct image URLs are used as entered and are not searched in the icon repositories.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -165,8 +165,18 @@ export const IconPicker = ({
|
|||||||
leftSection={leftSection}
|
leftSection={leftSection}
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
combobox.openDropdown();
|
const nextValue = event.currentTarget.value;
|
||||||
setQuery(event.currentTarget.value);
|
const trimmedValue = nextValue.trim();
|
||||||
|
if (/^https?:\/\/[^\s/]+(?:\/\S*)?$/i.test(trimmedValue)) {
|
||||||
|
startTransition(() => {
|
||||||
|
setValue(trimmedValue);
|
||||||
|
setQuery("");
|
||||||
|
combobox.closeDropdown();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
combobox.openDropdown();
|
||||||
|
setQuery(nextValue);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onClick={() => combobox.openDropdown()}
|
onClick={() => combobox.openDropdown()}
|
||||||
onFocus={(event) => {
|
onFocus={(event) => {
|
||||||
|
|||||||
Reference in new issue
Block a user