Próbuję skonfigurować somme rodzaju przeciągnij i upuść edytora wysiwyg przy użyciu JQuery UI.JQuery Draggable Droppable i Sortable w tym samym czasie do DOM manipulacji
Udało mi się skonfigurować elementy, ale mają dziwne zachowanie.
Jest prawie niemożliwe sortowanie elementów ze względu na ciągłe migotanie.
konfiguracji i moje draggables takie jak ten:
el.draggable({
containement:'.main-form-container',
revert: "invalid",
connectToSortable: '.sortable'
}).disableSelection();
Jeśli dont ustawić go jako przeciągany sortable umieści zastępczy na sobie! czemu?
Czasami, gdy element zostaje wrzucony do innego elementu staje się JEDNYM, przeciągalnym elementem i wydaje się być sklejony. choć wydaje się, że ustalona z nadrzędnymi sortable aktualizacji:
update: function (event, ui) {
$(ui.item).css({
position: 'relative',
top:0,
left:0,
width: 'auto'
});
// init droppable draggable and sortable on this item
setupDandD($(ui.item));
}
i setupDandD metody:
setupDandD($('.form-container'));
function setupDandD(el) {
el.draggable({
containement:'.main-form-container',
revert: "invalid",
connectToSortable: '.sortable'
}).disableSelection();
el.droppable({
accept: '[data-section="toolbox"]',
greedy: true,
hoverClass: 'droppable-hovered',
drop: handleDrop
}).disableSelection();
el.filter('.sortable').sortable({
tolerance:'pointer',
containement:'.main-form-container',
connectWith: ".sortable:not(#" + $(this).id + ")",
revert: 'invalid',
helper: function() {
return $(this);
},
update: function (event, ui) {
console.log('here');
$(ui.item).css({
position: 'relative',
top:0,
left:0,
width: 'auto'
});
setupDandD($(ui.item));
}
}).disableSelection();
};
Chyba trzeba pickup jakieś zdarzenie gdzieś na sortable ale ja zupełnie stracił teraz ...