Skip to content

Instantly share code, notes, and snippets.

@shirashin
Created August 10, 2014 12:50
Show Gist options
  • Select an option

  • Save shirashin/4e02da4a903ad022533b to your computer and use it in GitHub Desktop.

Select an option

Save shirashin/4e02da4a903ad022533b to your computer and use it in GitHub Desktop.
timelinesListApp.directive 'ckeditor', ->
require: '?ngModel'
link: (scope, elm, attr, ngModel)->
ck = CKEDITOR.instances[elm[0].id]
unless ngModel then return
ck.on 'pasteState', ->
scope.$apply ->
ngModel.$setViewValue ck.getData()
ngModel.$render = (value)-> ck.setData ngModel.$viewValue
CKEDITOR.replace 'content',
customConfig: 'config/post_timeline.js',
on:
loaded: (ev) ->
$('#cke_1_top').hide()
instanceReady: (ev) ->
ev.editor.on 'focus', (ev) ->
$('#cke_1_top').show()
ev.editor.resize(472, 100, true)
ev.editor.on 'blur', (ev) ->
$('#cke_1_top').hide()
ev.editor.resize(472, 36, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment