Skip to content

Commit

Permalink
kalk_web: Added placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
bakk committed May 29, 2021
1 parent 5401415 commit ddd075e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kalk_web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paddim8/kalk-component",
"version": "1.2.0",
"version": "1.2.1",
"description": "A Svelte component for kalk, a calculator that supports user-defined functions and variables.",
"svelte": "src/main.ts",
"main": "public/build/bundle.js",
Expand Down
12 changes: 11 additions & 1 deletion kalk_web/src/KalkCalculator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
function setHtml(html: string) {
highlightedTextElement.innerHTML = html;
inputElement.value = highlightedTextElement.textContent;
if (!html) {
highlightedTextElement.innerHTML = `<span class='placeholder'>${hinttext}</div>`;
}
}
function getHtml(): string {
Expand Down Expand Up @@ -310,7 +314,9 @@
class="highlighted-text"
aria-hidden
bind:this={highlightedTextElement}
/>
>
<span class="placeholder">{hinttext}</span>
</div>
<textarea
class="input"
placeholder={hinttext}
Expand Down Expand Up @@ -388,6 +394,10 @@
box-sizing: border-box;
}
.placeholder {
color: gray;
}
.prompt {
background-color: inherit;
}
Expand Down

0 comments on commit ddd075e

Please sign in to comment.