Skip to content

Commit 1c85c08

Browse files
author
Navneet Kumar
committed
Fixed model initialzation
1 parent bf3354c commit 1c85c08

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

demo/app.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313
charCounterCount: false,
1414
toolbarInline: true,
1515
events: {
16-
'initialized': function() {
17-
console.log('initialized');
16+
'contentChanged':function(e, editor) {
17+
console.log('content changed',$scope.titleOptions.froalaEditor.html.get());
18+
},
19+
'initialized': function(editor) {
20+
console.log('initialized', this);
1821
}
1922
}
2023
};
2124

2225
$scope.initialize = function(initControls) {
2326
$scope.initControls = initControls;
2427
$scope.deleteAll = function() {
25-
initControls.getEditor().html.set('');
28+
initControls.getEditor().html.set('34434');
2629
};
2730
};
2831

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-froala",
3-
"version": "3.0.0-rc.2",
3+
"version": "3.0.0-rc.2-1",
44
"description": "Angular.js bindings for Froala WYSIWYG HTML rich text editor",
55
"main": "src/angular-froala.js",
66
"scripts": {
@@ -50,6 +50,6 @@
5050
},
5151
"dependencies": {
5252
"coffee-script": "^1.12.7",
53-
"froala-editor": "3.0.0-rc.1"
53+
"froala-editor": "3.0.0-rc.2"
5454
}
5555
}

src/angular-froala.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,18 @@
107107
ngModel.$render()
108108
});
109109

110-
ctrl.registerEventsWithCallbacks('initialized', function () {
111-
ctrl.editorInitialized = true;
112-
ngModel.$render()
113-
})
114-
115110
ctrl.registerEventsWithCallbacks('initialized', ctrl.options.events && ctrl.options.events.initialized)
116-
111+
var initEvent = ctrl.options.events.initialized;
117112
if (!ctrl.options.events) ctrl.options.events = {};
118113
ctrl.options.events.initialized = function () {
114+
initEvent && initEvent();
119115
ctrl.initListeners();
116+
ctrl.editorInitialized = true;
117+
ngModel.$render()
120118
}
121119

122120
ctrl.froalaEditor = new FroalaEditor(element[0], ctrl.options);
123-
element.innerHTML = ctrl.froalaElement = ctrl.froalaEditor.$el[0];
121+
element[0].innerHTML = ctrl.froalaElement = ctrl.froalaEditor.$el[0];
124122

125123
//assign the froala instance to the options object to make methods available in parent scope
126124
if (scope.froalaOptions) {

0 commit comments

Comments
 (0)