- getWlxmlClass: function() {
- var klass = this._container().attr('wlxml-class');
- if(klass) {
- return klass.replace(/-/g, '.');
+ onNodeAdded: function(event) {
+ if(event.meta.node.isRoot()) {
+ this.canvas.reloadRoot();
+ return;
+ }
+
+ var ptr = event.meta.node.prev(),
+ referenceElement, referenceAction, actionArg;
+
+ while(ptr && !(referenceElement = utils.getElementForElementRootNode(ptr))) {
+ ptr = ptr.prev();
+ }
+
+ if(referenceElement) {
+ referenceAction = 'after';
+ } else {
+ referenceElement = this;
+ referenceAction = 'prepend';
+ }
+
+ if(event.meta.move) {
+ /* Let's check if this node had its own canvas element and it's accessible. */
+ actionArg = utils.getElementForElementRootNode(event.meta.node);
+ }
+ if(!actionArg) {
+ actionArg = event.meta.node;
+ }
+
+ referenceElement[referenceAction](actionArg);
+
+ if(event.meta.node.is('comment')) {
+ this.commentTip.show();
+ this.commentsView.render();