Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions build/angular-kindeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

var linkFn = function (scope, elm, attr, ctrl) {


if (typeof KindEditor === 'undefined') {
console.error('Please import the local resources of kindeditor!');
return;
Expand All @@ -25,9 +26,7 @@
this.loadPlugin('autoheight');
}
};

var editorId = elm[0],
editorConfig = scope.config || _config;
var editorId = elm[0], editorConfig = scope.config || _config;

editorConfig.afterChange = function () {
if (!scope.$$phase) {
Expand All @@ -37,8 +36,20 @@
}
};


if (KindEditor) {
KindEditor.create(editorId, editorConfig);
var editor = KindEditor.create(editorId, editorConfig);
console.log("model value: "+ctrl.$modelValue);
var flag = 2;
scope.$watch(function () {
return ctrl.$modelValue;
}, function(newValue) {
if(flag>0) {
console.log("new value: " + newValue);
editor.html(newValue);
flag--;
}
});
}

ctrl.$parsers.push(function (viewValue) {
Expand All @@ -49,7 +60,7 @@

return {
require: 'ngModel',
scope: { config: '=config' },
scope: { config: '=config'},
link: linkFn
};
});
Expand Down
4 changes: 2 additions & 2 deletions build/angular-kindeditor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions src/angular-kindeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

var linkFn = function (scope, elm, attr, ctrl) {


if (typeof KindEditor === 'undefined') {
console.error('Please import the local resources of kindeditor!');
return;
Expand All @@ -25,9 +26,7 @@
this.loadPlugin('autoheight');
}
};

var editorId = elm[0],
editorConfig = scope.config || _config;
var editorId = elm[0], editorConfig = scope.config || _config;

editorConfig.afterChange = function () {
if (!scope.$$phase) {
Expand All @@ -37,8 +36,20 @@
}
};


if (KindEditor) {
KindEditor.create(editorId, editorConfig);
var editor = KindEditor.create(editorId, editorConfig);
console.log("model value: "+ctrl.$modelValue);
var flag = 2;
scope.$watch(function () {
return ctrl.$modelValue;
}, function(newValue) {
if(flag>0) {
console.log("new value: " + newValue);
editor.html(newValue);
flag--;
}
});
}

ctrl.$parsers.push(function (viewValue) {
Expand All @@ -49,7 +60,7 @@

return {
require: 'ngModel',
scope: { config: '=config' },
scope: { config: '=config'},
link: linkFn
};
});
Expand Down