Skip to content

Commit b27c510

Browse files
committed
fix bg and fg header adding extra div, don't format https:// links with NomadNet handler
1 parent 8d7c207 commit b27c510

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

js/micron-parser.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ class MicronParser {
7575
}
7676

7777
static formatNomadnetworkUrl(url) {
78+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(url)) {
79+
return url;
80+
}
7881
return `nomadnetwork://${url}`;
7982
}
8083

@@ -337,7 +340,7 @@ class MicronParser {
337340
this.appendOutput(container, outputParts, state);
338341

339342
// if theres a background color, wrap with outer div
340-
if (state.bg_color !== this.DEFAULT_BG) {
343+
if (state.bg_color !== state.default_bg && state.bg_color !== "default") {
341344
const outerDiv = document.createElement("div");
342345
outerDiv.style.backgroundColor = this.colorToCss(state.bg_color);
343346
outerDiv.style.width = "100%";
@@ -350,7 +353,7 @@ class MicronParser {
350353
} else {
351354
// empty line but maintain background color if set
352355
const br = document.createElement("br");
353-
if (state.bg_color !== this.DEFAULT_BG) {
356+
if (state.bg_color !== state.default_bg && state.bg_color !== "default") {
354357
const outerDiv = document.createElement("div");
355358
outerDiv.style.backgroundColor = this.colorToCss(state.bg_color);
356359
outerDiv.style.width = "100%";
@@ -369,7 +372,7 @@ class MicronParser {
369372
} else {
370373
// Empty line handling for just newline background color
371374
const br = document.createElement("br");
372-
if (state.bg_color !== this.DEFAULT_BG) {
375+
if (state.bg_color !== state.default_bg && state.bg_color !== "default") {
373376
const outerDiv = document.createElement("div");
374377
outerDiv.style.backgroundColor = this.colorToCss(state.bg_color);
375378
outerDiv.style.width = "100%";
@@ -427,7 +430,7 @@ class MicronParser {
427430

428431
const flushSpan = () => {
429432
if (currentSpan) {
430-
if (currentStyle && currentStyle.bg !== this.DEFAULT_BG) {
433+
if (currentStyle && currentStyle.bg !== state.default_bg && currentStyle.bg !== "default") {
431434
currentSpan.style.display = "inline-block";
432435
currentSpan.style.padding = "0 2px";
433436
}

0 commit comments

Comments
 (0)