X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/995d7d01ab2f1a0a378fcf180f069845a454689a..c3f7497f5070c9b317a963a2db6cfe5880ff8d15:/redakcja/static/js/wiki/wikiapi.js diff --git a/redakcja/static/js/wiki/wikiapi.js b/redakcja/static/js/wiki/wikiapi.js index d901e847..8df3ef5a 100644 --- a/redakcja/static/js/wiki/wikiapi.js +++ b/redakcja/static/js/wiki/wikiapi.js @@ -227,16 +227,24 @@ * Set document's text */ WikiDocument.prototype.setText = function(text) { - this.text = text; - this.has_local_changes = true; + return this.setDocumentProperty('text', text); }; /* * Set document's gallery link */ WikiDocument.prototype.setGalleryLink = function(gallery) { - this.galleryLink = gallery; - this.has_local_changes = true; + return this.setDocumentProperty('galleryLink', gallery); + }; + + /* + * Set document's property + */ + WikiDocument.prototype.setDocumentProperty = function(property, value) { + if(this[property] !== value) { + this[property] = value; + this.has_local_changes = true; + } }; /*