0
私はwirisプラグインでckeditorを持っていますが、ユーザがck-editorの任意のインスタンスで任意のwiris質問を投稿すると、 ck-editorの3インスタンスがng-repeatであれば、ユーザはwirisの式を使ってck-editorの2番目のインスタンスを投稿し、その投稿はck-editorの2番目のインスタンスのみに表示されます。第1の例。 私のhtmlの:JSAngularjs複数のckEditorsは同じngModelを持っています
app.directive('ckEditor', function() {
return {
require: '?ngModel',
link: function(scope, elm, attr, ngModel) {
var ck = CKEDITOR.replace(elm[0]);
if (!ngModel) return;
ck.on('instanceReady', function() {
ck.setData(ngModel.$viewValue);
});
function updateModel() {
scope.$apply(function() {
ngModel.$setViewValue(ck.getData());
});
}
ck.on('change', updateModel);
ck.on('focus', updateModel);
ck.on('key', updateModel);
ck.on('dataReady', updateModel);
ngModel.$render = function(value) {
ck.setData(ngModel.$viewValue);
};
}
};
});
で
<div ng-repeat="item in items">
<form role="form" name="DiscussionForm" novalidate>
<input type="text" name="followup" ng-model="followupDis"
ck-editor placeholder="Compose" required>
<div><button type="submit"ng-click="start()">Post</button>
</div>
</form>
</div>
私はそれを変更する必要がありますので、私は最初の要素var ck = CKEDITOR.replace(elm[0]);
のインスタンスを作成しているディレクティブに期待しています。 したがって、ckeditorの複数のインスタンスのソリューションをwirisと共有することができます。