X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0600fa257660dd107bada5971b3296b3244fea03..4c49e768f97e6e158b70abd3c241387fa1148d6d:/platforma/static/js/models.js?ds=sidebyside diff --git a/platforma/static/js/models.js b/platforma/static/js/models.js old mode 100644 new mode 100755 index f945238d..ba2f3ce3 --- a/platforma/static/js/models.js +++ b/platforma/static/js/models.js @@ -228,7 +228,7 @@ Editor.HTMLModel = Editor.Model.extend({ getXMLPart: function(elem, callback) { - var path = elem.attr('wl2o:path'); + var path = elem.attr('x-pointer'); if(!this.xmlParts[path]) this.loadXMLPart(elem, callback); else @@ -237,7 +237,7 @@ Editor.HTMLModel = Editor.Model.extend({ loadXMLPart: function(elem, callback) { - var path = elem.attr('wl2o:path'); + var path = elem.attr('x-pointer'); var self = this; $.ajax({ @@ -262,10 +262,10 @@ Editor.HTMLModel = Editor.Model.extend({ }); }, - putXMLPart: function(elem, data) { + putXMLPart: function(elem, data, callback) { var self = this; - var path = elem.attr('wl2o:path'); + var path = elem.attr('x-pointer'); this.xmlParts[path] = data; this.set('state', 'dirty'); @@ -281,7 +281,7 @@ Editor.HTMLModel = Editor.Model.extend({ // format: 'nl' }, success: function(htmldata) { - elem.html(htmldata); + callback(elem, htmldata); self.set('state', 'dirty'); } }); @@ -596,10 +596,13 @@ Editor.DocumentModel = Editor.Model.extend({ mergeCompleted: function(xhr, textStatus) { console.log(xhr.status, xhr.responseText); var response = parseXHRResponse(xhr); - if(response.success) - { - if( (response.data.result == 'no-op') - || (response.data.shared_timestamp == response.data.shared_parent_timestamp)) + + if(response.success) { + + if( (response.data.result == 'no-op') || + ( response.data.shared_parent_timestamp + && response.data.shared_timestamp + && (response.data.shared_timestamp == response.data.shared_parent_timestamp)) ) { if( (response.data.revision) && (response.data.revision != this.get('revision')) ) {