Skip to content

Commit

Permalink
https://github.com/Kademi/keditor/issues/67
Browse files Browse the repository at this point in the history
  • Loading branch information
ducdhm committed Jul 21, 2019
1 parent 35ff8ca commit 48e6aeb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
8 changes: 4 additions & 4 deletions dist/js/keditor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/keditor/constants/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export default {
},

/*
* Callback will be called when initializing content area. It can return array of jQuery objects which will be initialized as container in content area. By default, all first level sections under content area will be initialized
* Callback will be called when initializing content area
* @option {Function}
* @param {jQuery} contentArea
*/
Expand Down
2 changes: 1 addition & 1 deletion src/keditor/container/getContainerContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export default function getContainerContent (container, isNested) {
containerContent.html(content);
});

return `<section>${containerInner.html()}</section>`;
return `${containerInner.html()}`;
}
2 changes: 1 addition & 1 deletion src/keditor/container/initContainerContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function (contentArea, container, containerContent, isNested) {
containerContentInner.sortable({
handle: `.${CSS_CLASS.COMPONENT_MOVE}, .${CSS_CLASS.CONTAINER_MOVE}`,
helper: 'clone',
items: '> section',
items: `> .${CSS_CLASS.COMPONENT}`,
connectWith: `.${CSS_CLASS.CONTAINER_CONTENT_INNER}`,
tolerance: 'pointer',
receive: function (event, ui) {
Expand Down
13 changes: 3 additions & 10 deletions src/keditor/contentArea/initContentArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function (contentArea, dontInitToolbar) {

contentAreaInner.sortable({
handle: `.${CSS_CLASS.TOOLBAR_CONTAINER}:not(.${CSS_CLASS.TOOLBAR_SUB_CONTAINER}) .${CSS_CLASS.CONTAINER_MOVE}`,
items: '> section',
items: `> .${CSS_CLASS.CONTAINER}`,
helper: 'clone',
connectWith: `.${CSS_CLASS.CONTENT_AREA}`,
axis: 'y',
Expand Down Expand Up @@ -64,16 +64,9 @@ export default function (contentArea, dontInitToolbar) {
}
});

contentAreaInner.children('section').each(function () {
contentAreaInner.children().each(function () {
convertToContainer.call(self, contentArea, $(this));
});

if (typeof options.onInitContentArea === 'function') {
let contentData = options.onInitContentArea.call(self, contentArea);
if (contentData && contentData.length > 0) {
$.each(contentData, function () {
convertToContainer.call(self, contentArea, $(this));
});
}
}
typeof options.onInitContentArea === 'function' && options.onInitContentArea.call(self, contentArea);
};

0 comments on commit 48e6aeb

Please sign in to comment.