-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(styler): Parse QML styles loaded via URL
Move base64 icon fix to separate function and file
- Loading branch information
1 parent
6bc2182
commit 2e07f3c
Showing
4 changed files
with
30 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Parse QML string style and make base64 symbols usable in browser by | ||
* | ||
* Look for prop elements with source attribute | ||
* and prepend its content to v while switching : with , | ||
*/ | ||
export function parseBase64Style(styleString: string) { | ||
const regex = /<prop([^>]*source="(data:[^"]*)"[^>]*v="base64:([^"]*)")/g; | ||
|
||
return styleString.startsWith('<qgis') | ||
? styleString.replace(regex, (match, p1, p2, p3) => { | ||
return match.replace(`v="base64:${p3}"`, `v="${p2}base64,${p3}"`); | ||
}) | ||
: styleString; | ||
} |
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