Skip to content

Commit 33a4086

Browse files
committed
Add mix-blend-mode fix for now
1 parent 9f835ba commit 33a4086

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

code-input.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, co
5252
}
5353
code-input:not(.code-input_pre-element-styled) pre code, code-input.code-input_pre-element-styled pre {
5454
height: max-content;
55-
width: max-content;
55+
width: max-content;
5656
}
5757

5858
code-input:not(.code-input_pre-element-styled) pre, code-input.code-input_pre-element-styled pre code {
@@ -99,8 +99,11 @@ code-input:not(.code-input_loaded)::after {
9999
/* Make textarea almost completely transparent, except for caret and placeholder */
100100

101101
code-input textarea {
102-
color: transparent;
103-
background: transparent;
102+
color: black;
103+
background-color: white;
104+
mix-blend-mode: lighten;
105+
/* color: transparent;
106+
background: transparent; */
104107
caret-color: inherit!important; /* Or choose your favourite color */
105108
}
106109
code-input textarea::placeholder {

code-input.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,13 @@ var codeInput = {
540540
if(this.needsHighlight) {
541541
this.update();
542542
this.needsHighlight = false;
543-
// this.needsDisableDuplicateSearching = true;
543+
this.needsDisableDuplicateSearching = true;
544+
}
545+
if(this.needsDisableDuplicateSearching && this.codeElement.querySelector("*") != null) {
546+
// Has been highlighted
547+
this.resultElementDisableSearching();
548+
this.needsDisableDuplicateSearching = false;
544549
}
545-
// if(this.needsDisableDuplicateSearching && this.codeElement.querySelector("*") != null) {
546-
// // Has been highlighted
547-
// this.resultElementDisableSearching();
548-
// this.needsDisableDuplicateSearching = false;
549-
// }
550550

551551
window.requestAnimationFrame(this.animateFrame.bind(this));
552552
}
@@ -607,8 +607,16 @@ var codeInput = {
607607
// Turn plain text node into span element
608608
element.replaceChild(document.createElement('span'), element.childNodes[i]);
609609
element.childNodes[i].classList.add("code-input_searching-disabled")
610-
element.childNodes[i].setAttribute("data-content", content);
611-
element.childNodes[i].innerText = '';
610+
// element.childNodes[i].setAttribute("data-content", content);
611+
let newContent = "";
612+
for(let i = 0; i < content.length; i++) {
613+
if(content[i] == "\t" || content[i] == "\n") {
614+
newContent += content[i];
615+
} else {
616+
newContent += "█";
617+
}
618+
}
619+
element.childNodes[i].textContent = newContent;
612620
} else {
613621
// Recurse deeper
614622
this.resultElementDisableSearching(element.childNodes[i]);
@@ -695,7 +703,6 @@ var codeInput = {
695703
// Create result element
696704
let code = document.createElement("code");
697705
let pre = document.createElement("pre");
698-
pre.setAttribute("aria-hidden", "true"); // Hide for screen readers
699706

700707
// Save elements internally
701708
this.preElement = pre;

0 commit comments

Comments
 (0)