X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/9aa850ad8fb519b03bb854f3b731af32e42c54fa..9a7ea3b25b1989eeb004820bfa8c939426599c8a:/modules/documentCanvas/canvas/documentElement.js?ds=inline diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 4c09b75..0558a3e 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -148,8 +148,10 @@ $.extend(DocumentNodeElement, { } element.data('other-attrs', params.others); - if(params.rawChildren) { + if(params.rawChildren && params.rawChildren.length) { container.append(params.rawChildren); + } else if(params.prepopulateOnEmpty) { + element.append(DocumentTextElement.create({text: ''})); } return dom; }, @@ -528,8 +530,9 @@ $.extend(DocumentTextElement.prototype, { prev.setText(prev.getText() + this.getText() + next.getText()); next.detach(); } else if (prev || next) { - var target = prev ? prev : next; - target.setText(target.getText() + this.getText()); + var target = prev ? prev : next, + newText = prev ? target.getText() + this.getText() : this.getText() + target.getText(); + target.setText(newText); } else { parent.after(this); }