I'm trying to reorder the colors in a palette using DnD. Pen is here: - https://codepen.io/neon22/project/editor/XbqvYe
<script type="text/x-template" id="cpalette">
<div>
<draggable v-model="colors" class="dragArea">
<ul class="color-list" >
<input type="hidden" :name="inputId" :id="inputId" v-model="colors">
<li v-if="emptyOption">
<a class="noColor" v-if="emptyOption !== 'true'" href="" @click.prevent="setColor();" :title="emptyOption === 'true' ? '' : emptyOption" :class="{selected: !selectedColor && !noSelection}"></a>
</li>
<!-- <draggable v-model="colors" tag='li' class="dragArea"> -->
<li v-for="color in colors" :key="color.id" :data-id="color.id" >
<a href="" :style="{background: color.hex}" :title="color.stash" @click.prevent="setColor(color.hex, color.id, color.stash)" :class="{selected: selectedColor === color.hex}"></a>
</li>
<!-- </draggable> -->
</ul>
</draggable>
</div>
</script>
I.e. I'm reordering in the same array. (I also want to enable dropping it into a separate region for copying etc). Instead I can drag the entire UL but not the individual li elements. I have noodled with it for a while now and have confused myself. I can see classes changing in chrome dev so I think its almost working. Maybe the input is getting in the way ?
I'm trying to get an end result like this: - https://sortablejs.github.io/Vue.Draggable/#/transition-example-2 but I have not added the transition-group yet.
I will also want to be able to drop the individual colors into a second area (where a @dropend will copy them and etc etc...) In fact if I can get a better grip on draggable then maybe I'd do a delete trashcan instead of a button.
So I want to reorder individual colors and enable a separate drop target.
Any help would be greatly appreciated. I'm sure its something simple :(