Nooku Components is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

nooku-components

Commit 1564

User picture
  • Author: stiandidriksen
  • 2012-03-01 19:44 (about 2 years ago)

re #65 isDirty didn't work properly on empty textareas

Files Affected

 
15631564
148
            settings.setup =  function(ed) {
148
            settings.setup =  function(ed) {
149
                ed.onBeforeRenderUI.add(function(ed) {
149
                ed.onBeforeRenderUI.add(function(ed) {
150
                    var editor = self.create.call(self, ed.id, options), dirty = false, isDirty = function(ed){
150
                    var editor = self.create.call(self, ed.id, options), dirty = false, isDirty = function(ed){
151
                        if(!dirty && ed.isDirty()) {
151
                        var startContent = self.startContent, edContent = ed.getContent({format : 'raw', no_events : 1});
 
 
152
 
 
 
153
                        if(!dirty && ed.isDirty() && !(startContent == '<p><br _mce_bogus="1"></p>' && !ed.getContent())) {
152
                            editor.fireEvent('isDirty');
154
                            editor.fireEvent('isDirty');
153
                            dirty = true;
155
                            dirty = true;
154
                        } else if(dirty && ed.getContent({format : 'raw', no_events : 1}).length === self.startContent.length && ed.getContent({format : 'raw', no_events : 1}) === self.startContent) {
156
                        } else if(dirty && ( (edContent === startContent) || (startContent == '<p><br _mce_bogus="1"></p>' && !ed.getContent()) )) {
155
                            editor.fireEvent('isNotDirty');
157
                            editor.fireEvent('isNotDirty');
156
                            dirty = false;
158
                            dirty = false;
157
                        }
159
                        }