require.config({ paths: { cm: '/bower_components/codemirror' } }); define([ 'jquery', '/common/cryptpad-common.js', '/bower_components/chainpad-listmap/chainpad-listmap.js', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/marked/marked.min.js', '/common/toolbar2.js', 'cm/lib/codemirror', 'cm/mode/markdown/markdown', 'less!/profile/main.less', 'less!/customize/src/less/toolbar.less', 'less!/customize/src/less/cryptpad.less', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', ], function ($, Cryptpad, Listmap, Crypto, Marked, Toolbar, CodeMirror) { var APP = window.APP = { Cryptpad: Cryptpad, _onRefresh: [] }; $(window.document).on('decryption', function (e) { var decrypted = e.originalEvent; if (decrypted.callback) { decrypted.callback(); } }) .on('decryptionError', function (e) { var error = e.originalEvent; Cryptpad.alert(error.message); }); // Marked var renderer = new Marked.Renderer(); Marked.setOptions({ renderer: renderer, sanitize: true }); // Tasks list var checkedTaskItemPtn = /^\s*\[x\]\s*/; var uncheckedTaskItemPtn = /^\s*\[ \]\s*/; renderer.listitem = function (text) { var isCheckedTaskItem = checkedTaskItemPtn.test(text); var isUncheckedTaskItem = uncheckedTaskItemPtn.test(text); if (isCheckedTaskItem) { text = text.replace(checkedTaskItemPtn, ' ') + '\n'; } if (isUncheckedTaskItem) { text = text.replace(uncheckedTaskItemPtn, ' ') + '\n'; } var cls = (isCheckedTaskItem || isUncheckedTaskItem) ? ' class="todo-list-item"' : ''; return '