<script>
import Moveable from "vue3-moveable";
import { ref } from "vue";

export default {
    components: { Moveable },
    setup() {
        const targetRef1 = ref(null);
        const targetRef2 = ref(null);
        const onClick = () => {
            targetRef1.value.focus();
        };
        const onClick$0 = () => {
            targetRef2.value.focus();
        };
        const onDrag = e => {
            e.target.style.cssText += e.cssText;
        };
        const onDrag$0 = e => {
            e.target.style.cssText += e.cssText;
        };
        return {
            onClick,
            targetRef1,
            onClick$0,
            targetRef2,
            onDrag,
            onDrag$0
        };
    }
};
</script>
<template>
    <div class="container">
        <p>
            Input
            <button @click="onClick">Focus Input</button>
        </p>
        <input
            type="input"
            class="target1"
            ref="targetRef1"
        ></input>
        <p>
            Content Editable
            <button @click="onClick$0">Focus contenteEditable</button>
        </p>
        <div
            class="target2"
            contentEditable="true"
            ref="targetRef2"
            style="width: 100px;height: 100px;"
        ></div>
        <Moveable
            :target="'.target1'"
            :draggable="true"
            :dragFocusedInput="true"
            @drag="onDrag"/>
        <Moveable
            :target="'.target2'"
            :draggable="true"
            :dragFocusedInput="true"
            @drag="onDrag$0"/>
    </div>
</template>