kalk_web placeholder

This commit is contained in:
PaddiM8 2021-01-05 01:25:30 +01:00
parent a2153d3b16
commit 79facb1bd8
3 changed files with 12 additions and 2 deletions

View File

@ -38,6 +38,7 @@ I am not aware of a better way.
The colours in the component can be changed by using these attributes.
```html
<kalk-calculator
hintText="Type something..."
identifierColor="cornflowerblue"
operatorColor="darkorange"
promptColor="mediumseagreen"

View File

@ -1,6 +1,6 @@
{
"name": "@paddim8/kalk-component",
"version": "1.0.0",
"version": "1.0.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",
@ -60,4 +60,4 @@
"browserslist": [
"defaults"
]
}
}

View File

@ -8,6 +8,7 @@
export let promptColor = "mediumseagreen";
export let errorColor = "tomato";
export let linkColor = "cornflowerblue";
export let hintText = "";
type Kalk = typeof import("@paddim8/kalk");
@ -282,6 +283,13 @@
outline: none;
}
}
[contenteditable][placeholder]:empty:before {
content: attr(placeholder);
position: absolute;
color: gray;
background-color: transparent;
}
</style>
<svelte:options tag="kalk-calculator" />
@ -305,6 +313,7 @@
<div
contenteditable="true"
class="input"
placeholder={hintText}
on:keydown={(event) => handleKeyDown(event, kalk)}
on:keyup={handleKeyUp}
on:input={handleInput}