<!DOCTYPE html> <html lang="ru"> <head> <meta charset="utf-8"> </head> <body> <form> <textarea id="post-content"></textarea> <button></button> </form> <div id="markitup-elfinder"></div> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css"/> <link rel="stylesheet" type="text/css" href="js/markitup/skins/simple/style.css"/> <link rel="stylesheet" type="text/css" href="js/markitup/sets/markdown/style.css"/> <link rel="stylesheet" type="text/css" href="js/elfinder/css/elfinder.min.css"/> <link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox.css"/> <script src="http://www.google.com/jsapi"></script> <script>google.load("jquery", "1");</script> <script>google.load("jqueryui", "1");</script> <script src="js/markitup/jquery.markitup.js"></script> <script src="js/markitup/sets/markdown/set.js"></script> <script src="js/elfinder/js/elfinder.min.js"></script> <script src="js/elfinder/js/i18n/elfinder.ru.js"></script> <script src="js/fancybox/jquery.fancybox.pack.js"></script> <script src="js/script.js"></script> </body> </html>
function markitupElfinder(){ $('#markitup-elfinder').elfinder({ lang: 'ru', url : '/admin/dash/fm/', // getFileCallback:function(file){ $.markItUp({ replaceWith:''}); $.fancybox.close(); } }).elfinder('instance'); $.fancybox({ content: $('#markitup-elfinder') }); } $(document).ready(function(){ $("#post-content").markItUp(mySettings); });
js/markitup/sets/markdown/set.js
find a string of the type {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'}
and replace it with {name:'Picture', key:'P', call: 'markitupElfinder'}
.
Source: https://habr.com/ru/post/141450/