Created
July 19, 2017 00:29
-
-
Save CosmoMyzrailGorynych/e61dfc0a51a564631670af199311ad8c to your computer and use it in GitHub Desktop.
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
// * ———————————————————————————————————————————————————————— * // | |
// * markdown directives for SimpleMDE | |
// * ———————————————————————————————————————————————————————— * // | |
$.ajaxSetup({ | |
cache: true | |
}) | |
// inject SimpleMDE's css into the admin interface | |
$('head') | |
.append('<link rel="stylesheet" type="text/css" href="/assets/vendor/simplemde/dist/simplemde.min.css">') | |
.append(` | |
<style> | |
.control-simplemde .CodeMirror { | |
max-height: 30rem; | |
} | |
</style> | |
`) | |
enduro_admin_app.compileProvider | |
.directive('marked', function() { | |
return { | |
link: function(scope, element, attrs) { | |
$.getScript('/assets/vendor/simplemde/dist/simplemde.min.js', function () { | |
var options = { | |
element: element[0], | |
spellChecker: false | |
} | |
var mde = new SimpleMDE(options) | |
mde.codemirror.on('change', function () { | |
scope.context[scope.terminatedkey] = mde.value() | |
}) | |
scope.simplemde = { | |
instance: mde | |
} | |
scope.$watch('current_culture', function () { | |
mde.value(scope.context[scope.terminatedkey] || ''); | |
}) | |
}) | |
} | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment