Skip to content

Commit

Permalink
addresses #1 and #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Ziggas authored and Joshua Ziggas committed Feb 7, 2017
1 parent f8add4d commit 04c56a2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion coverage/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 07 2017 00:19:03 GMT-0500 (EST)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 07 2017 16:12:16 GMT-0500 (EST)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/ng-ck.min.js

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

2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = (config) => {
dir: 'coverage',
reporters: [
{type: 'html', subdir: 'html'},
{type: 'text', file: 'coverage.txt'}
{type: 'text'}
]
}
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-ck",
"version": "1.0.0",
"version": "1.1.0",
"description": "An Angular 1 Component for CKEditor",
"main": "src/ng-ck.js",
"dependencies": {
Expand Down
33 changes: 29 additions & 4 deletions src/ng-ck.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ app.component('ngCk', {
debug: '<?',
maxLength: '<?',
minLength: '<?',
placeholder: '<?',
readOnly: '<?',
required: '<?',
onBlur: '&?',
onContentChanged: '&?',
onFocus: '&?',
onInstanceReady: '&?'
onInstanceReady: '&?',
onKey: '&?',
onPaste: '&?',
onResize: '&?',
onSave: '&?'
},
template: '<textarea ng-attr-placeholder="{{vm.placeholder}}"></textarea>',
controller: ['$element', 'ngCkConfig', function NgCk ($element, ngCkConfig) {
Expand Down Expand Up @@ -113,6 +118,26 @@ app.component('ngCk', {
if (vm.onInstanceReady) {
vm.onInstanceReady({editor: editor})
}
if (vm.onKey) {
editor.on('key', function onEditorKey (event) {
vm.onKey({$event: event, editor: editor})
})
}
if (vm.onResize) {
editor.on('resize', function onEditorResize (event) {
vm.onResize({$event: event, editor: editor})
})
}
if (vm.onPaste) {
editor.on('paste', function onEditorPaste (event) {
vm.onPaste({$event: event, editor: editor})
})
}
if (vm.onSave) {
editor.on('save', function onEditorSave (event) {
vm.onSave({$event: event, editor: editor})
})
}
vm.ngModelCtrl.$render()
}

Expand Down Expand Up @@ -162,9 +187,9 @@ app.component('ngCk', {

function onChanges (changes) {
if (
changes.ngModel &&
changes.ngModel.currentValue !== changes.ngModel.previousValue
) {
changes.ngModel &&
changes.ngModel.currentValue !== changes.ngModel.previousValue
) {
content = changes.ngModel.currentValue
if (editor && !editorChanged) {
if (content) {
Expand Down

0 comments on commit 04c56a2

Please sign in to comment.