<script>
import Moveable from "vue-moveable";

export default {
    components: { Moveable },
    data() {
        const targetRef1 = null;
        const targetRef2 = null;
        return { targetRef1, targetRef2 };
    },
    methods: {
        onClick() {
            this.$refs.targetRef1.focus();
        },
        onClick$0() {
            this.$refs.targetRef2.focus();
        },
        onDrag(e) {
            e.target.style.cssText += e.cssText;
        },
        onDrag$0(e) {
            e.target.style.cssText += e.cssText;
        }
    },
    mounted() {
        this.targetRef1 = this.$refs.targetRef1;
        this.targetRef2 = this.$refs.targetRef2;
    }
};
</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>