1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/inhu-angular-ueditor

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
angular-ueditor.coffee 2.1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Dio Отправлено 11 лет назад 9bdbf39
###*
Created by Dio on 17-9.
http://inhu.net
###
"use strict"
(->
NGUeditor = angular.module "ng.ueditor",[]
NGUeditor.directive "ueditor",[
->
restrict: "C"
require: "ngModel"
scope:
config:"="
ready:"="
link:($S, element, attr, ctrl) ->
class _NGUeditor
constructor :->
@bindRender()
@initEditor()
return
###*
* 初始化编辑器
* @return {[type]} [description]
###
initEditor : ->
_self = @
if typeof UE is 'undefined'
console.error "Please import the local resources of ueditor!"
return
# 新建UEditor,可根据API文档进行配置
_UEConfig = if $S.config then $S.config else {}
_editorId = if attr.id then attr.id else "_editor#{Date.now()}"
element[0].id = _editorId
@editor = new UE.getEditor(_editorId,_UEConfig)
@editor.ready ->
_self.editorReady = true
# 监听编辑器内容改变事件
_self.editor.addListener "contentChange", ->
ctrl.$setViewValue _self.editor.getContent()
$S.$apply() unless $S.$$phase
return
_self.setEditorContent()
$S.ready?(_self.editor)
return
setEditorContent : (content = @modelContent) ->
@editor.setContent content if @editor and @editorReady
return
bindRender : ->
_self = @
ctrl.$render = ->
_self.modelContent = (if ctrl.$isEmpty(ctrl.$viewValue) then "" else ctrl.$viewValue)
_self.setEditorContent()
return
return
new _NGUeditor()
return
]
return
)()

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/inhu-angular-ueditor.git
git@gitlife.ru:oschina-mirror/inhu-angular-ueditor.git
oschina-mirror
inhu-angular-ueditor
inhu-angular-ueditor
master