Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 1915e8a

Browse files
MrMartiniModeeg
authored andcommitted
fix($dirty): fix dirty usage
fixes #238 closes #239
1 parent 32473bf commit 1915e8a

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Diff for: dist/tinymce.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/tinymce.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ angular.module('ui.tinymce', [])
6363
$timeout.cancel(debouncedUpdateTimer);
6464
debouncedUpdateTimer = $timeout(function() {
6565
return (function(ed) {
66-
ed.save();
67-
updateView(ed);
66+
if (ed.isDirty()) {
67+
ed.save();
68+
updateView(ed);
69+
}
6870
})(ed);
6971
}, debouncedUpdateDelay);
7072
};

Diff for: test/tinymce.spec.js

+11
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ describe('uiTinymce', function () {
101101
done();
102102
}, 100);
103103
});
104+
it('shouldn\'t make the form dirty', function(done) {
105+
compile();
106+
setTimeout(function() {
107+
scope.foo = text;
108+
scope.$apply();
109+
110+
expect(directiveElement.controller('form').$dirty).toBe(false);
111+
112+
done();
113+
});
114+
});
104115
// TODO: Fix test
105116
xit('should handle undefined gracefully', function(done) {
106117
compile();

0 commit comments

Comments
 (0)