Skip to content

Commit

Permalink
docs: improve theme generator
Browse files Browse the repository at this point in the history
closes: #3092, closes: #2645
  • Loading branch information
jondoe297tt authored Jun 24, 2024
1 parent e50918d commit c05d796
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/docs/src/routes/(docs)/theme-generator/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ function generateColors(newColorToCheck = "transparent") {
console.log(`${newColorToCheck} is not a valid color`)
}
}
//prevent paste span tag outside text
function handlePastedText(event,color){
const text = event.clipboardData.getData('Text')
color.value = text
event.preventDefault()
}
function resetColors() {
if (browser && localStorage.getItem("theme-generator-colors")) {
Expand Down Expand Up @@ -490,6 +496,7 @@ onMount(() => {
contenteditable="true"
bind:innerHTML="{color.value}"
oninput="{() => generateColors(color.value)}"
onpaste="{ event => handlePastedText(event,color)}"
onkeyup="{() => generateColors(color.value)}">{color.value}</button>",
</code>{/each}<code>{` },
},
Expand Down

0 comments on commit c05d796

Please sign in to comment.