Created
May 15, 2014 13:07
-
-
Save Ingelheim/d43d042909155c9c10dd to your computer and use it in GitHub Desktop.
Refactoring of wysiwyg directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global angular */ | |
/*jshint globalstrict:true*/ | |
'use strict'; | |
angular.module('clientApp').directive('qenWysiwygTheOne', ['$timeout', 'qenWysiwygImage', 'imageTagService', function ($timeout, qenWysiwygImage, imageTagService) { | |
var QenWysiwyg = QEN.directives.QenWysiwyg($timeout, qenWysiwygImage, imageTagService); | |
var QenPrintWysiwyg = QEN.directives.QenPrintWysiwyg(imageTagService); | |
RedactorPlugins.qenImage = qenWysiwygImage; | |
return { | |
restrict: 'E', | |
require: 'ngModel', | |
scope: { | |
editorId: '@qenId', | |
placeholder: '@', | |
ngModel: '=' | |
}, | |
template: function(element, attrs) { | |
var inputEditable = attrs.inputeditable; | |
return inputEditable === 'false' ? QenPrintWysiwyg.template : QenWysiwyg.template; | |
}, | |
replace: true, | |
compile: function (element, attrs, ngModel) { | |
var inputEditable = attrs.inputeditable; | |
return inputEditable === 'true' ? QenPrintWysiwyg.link : QenWysiwyg.link; | |
} | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment