Skip to content
Snippets Groups Projects
Unverified Commit fd3ba151 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

wip

parent 94cb695d
No related branches found
No related tags found
No related merge requests found
......@@ -50,8 +50,8 @@ window.osuny.contentEditor = {
animation: 150,
fallbackOnBody: true,
swapThreshold: 0.65,
onChoose: this.onSortableChoose.bind(this),
onUnchoose: this.onSortableUnchoose.bind(this),
onChoose: this.onSortableChoose.bind(this),
onUnchoose: this.onSortableUnchoose.bind(this),
onStart: this.onSortableStart.bind(this),
onEnd: this.onSortableEnd.bind(this)
});
......@@ -73,6 +73,14 @@ window.osuny.contentEditor = {
} else if (kind === 'heading') {
this.sortableRootContainer.classList.add('content-editor__elements__root--dragging-heading');
}
if (event.to.id === 'content-editor-elements-root') {
// Dragged to root list
console.log('no parent');
console.log([...event.to.children].map(item => `${item.dataset.kind}-${item.dataset.id}`));
} else {
// Dragged to element's children list
console.log('parent id is: ', evt.to.parentNode.dataset.id);
}
},
onSortableEnd: function (event) {
......@@ -112,7 +120,7 @@ window.osuny.contentEditor = {
// itemId: item.dataset.id
// });
},
onSortableUnchoose: function (event) {
'use strict';
this.sortableRootContainer.classList.remove('content-editor__elements__root--dragging');
......@@ -121,9 +129,9 @@ window.osuny.contentEditor = {
},
debugTree: function () {
getElementById: function (id) {
'use strict';
console.log('TODO Debug Tree');
return this.elements[id];
},
invoke: function () {
......
window.osuny.contentEditor.Element = function Element (container) {
'use strict';
this.container = container;
this.kind = this.container.dataset.kind;
this.id = this.container.dataset.id;
this.childrenList = this.container.querySelector('.js-content-editor-sortable-container');
};
window.osuny.contentEditor.Element.prototype.XXX = function () {
window.osuny.contentEditor.Element.prototype.getChildrenIds = function () {
'use strict';
// ...
var children = [],
child,
i;
if (this.childrenList === null) {
return children;
}
for (i = 0; i < this.childrenList.children.length; i += 1) {
child = this.childrenList.children[i];
children.push(child.dataset.id);
}
return children;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment