Skip to content

Commit

Permalink
worked on component drop
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Nov 4, 2023
1 parent a98446c commit a651c51
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/client/vanilla/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ function ContentProvider() {
const onCanvasDrop = async (e) => {
e.preventDefault()

const componentId = e.dataTransfer.getData('component')
const data = await fetch(`/${componentId}.html`)
const html = await data.text()
// const componentId = e.dataTransfer.getData('component')
// const data = await fetch(`/${componentId}.html`)
// const html = await data.text()

const components = getComponents()
if (components.length === 0) {
const html = components[0].source

const _components = getComponents()
if (_components.length === 0) {
canvasRef.current.innerHTML = html
} else if (isElementTopHalf(hoveredComponent, e)) {
hoveredComponent.insertAdjacentHTML('beforebegin', html)
Expand Down

0 comments on commit a651c51

Please sign in to comment.