Skip to content

Commit 8bba2f4

Browse files
committed
Allow templating in hash params
Some contexts, like Webviews, don't have a traditional document.location, or don't allow it to be easily set. In those contexts, allow templating in the hash params
1 parent 7f66bd2 commit 8bba2f4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/web/editor.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@
3232
var themeOnLoad = localSettings.getItem('theme') || 'default';
3333
document.body.classList.remove("default");
3434
document.body.classList.add(themeOnLoad);
35+
var optionalTemplatedHash = "{{ &HASH_OPTIONS }}";
3536
var params = {};
36-
document.location.hash.substr(1).split("&").forEach(function (p) {
37+
let hash;
38+
if(optionalTemplatedHash !== "") {
39+
hash = optionalTemplatedHash;
40+
}
41+
else {
42+
hash = document.location.hash;
43+
}
44+
hash.substr(1).split("&").forEach(function (p) {
3745
var parts = p.split("=");
3846
if (parts.length === 1) {
3947
params[parts[0]] = true;

0 commit comments

Comments
 (0)