diff --git a/dev.xml b/dev.xml index 93e4394..b260578 100644 --- a/dev.xml +++ b/dev.xml @@ -73,10 +73,10 @@ echo -e '\e[33;1;5mDONE!\e[0m \e[33;1;3m Connect using "vagrant ssh" \e[0m' +} + runtests.py from __future__ import absolute_import @@ -311,4 +312,4 @@ failures = test_runner( failfast=False).run_tests(['tests']) sys.exit(failures) - + \ No newline at end of file diff --git a/markdownx/static/markdownx/admin/css/markdownx.min.css b/markdownx/static/markdownx/admin/css/markdownx.min.css new file mode 100644 index 0000000..9555f2f --- /dev/null +++ b/markdownx/static/markdownx/admin/css/markdownx.min.css @@ -0,0 +1 @@ +.markdownx{display:inline-block}.markdownx .markdownx-editor,.markdownx .markdownx-preview{margin-left:0;width:610px}.markdownx .markdownx-preview{overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-size:100%;font-size:1em;line-height:1.5em}.markdownx .markdownx-preview *{line-height:1.5}.markdownx .markdownx-preview a{color:#5b80b2;text-decoration:underline}.markdownx .markdownx-preview a:visited{color:#0b0080}.markdownx .markdownx-preview a:hover{color:#0645ad}.markdownx .markdownx-preview a:active{color:#faa700}.markdownx .markdownx-preview a:focus{outline:thin dotted}.markdownx .markdownx-preview a:active,.markdownx .markdownx-preview a:hover{outline:0}.markdownx .markdownx-preview p{margin:1em 0;padding:0;font-size:14px}.markdownx .markdownx-preview img{max-width:100%}.markdownx .markdownx-preview h1,.markdownx .markdownx-preview h2,.markdownx .markdownx-preview h3,.markdownx .markdownx-preview h4,.markdownx .markdownx-preview h5,.markdownx .markdownx-preview h6{font-weight:400;color:#111;margin-top:.75em;margin-bottom:.75em;padding:0;background:0 0}.markdownx .markdownx-preview h4,.markdownx .markdownx-preview h5,.markdownx .markdownx-preview h6{font-weight:700}.markdownx .markdownx-preview h1{font-size:2.5em}.markdownx .markdownx-preview h2{font-size:2em}.markdownx .markdownx-preview h3{font-size:1.5em}.markdownx .markdownx-preview h4{font-size:1.2em}.markdownx .markdownx-preview h5{font-size:1em}.markdownx .markdownx-preview h6{font-size:.9em}.markdownx .markdownx-preview blockquote{color:#666;margin:0;padding-left:1.5em;border-left:.5em #eee solid}.markdownx .markdownx-preview hr{display:block;height:0;border:0;font-style:italic;border-bottom:1px solid #ccc;margin:20px 0;padding:0}.markdownx .markdownx-preview code,.markdownx .markdownx-preview kbd,.markdownx .markdownx-preview pre,.markdownx .markdownx-preview samp{font-family:monospace,monospace;font-size:14px}.markdownx .markdownx-preview code,.markdownx .markdownx-preview pre{margin:0 2px;padding:0 5px;border:1px solid #ddd;background-color:#f8f8f8;border-radius:2px;color:#444}.markdownx .markdownx-preview pre{margin:1.5em 0 1.5em 0;padding:1em;white-space:pre;white-space:pre-wrap;word-wrap:break-word}.markdownx .markdownx-preview pre code{margin:0;padding:0;background:0 0;border:none}.markdownx .markdownx-preview b,.markdownx .markdownx-preview strong{font-weight:700}.markdownx .markdownx-preview dfn{font-style:italic}.markdownx .markdownx-preview ins{background:#ff9;color:#000;text-decoration:none}.markdownx .markdownx-preview mark{background:#ff0;color:#000;font-style:italic;font-weight:700}.markdownx .markdownx-preview sub,.markdownx .markdownx-preview sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.markdownx .markdownx-preview sup{top:-.5em}.markdownx .markdownx-preview sub{bottom:-.25em}.markdownx .markdownx-preview ol,.markdownx .markdownx-preview ul{margin:1em 0!important;padding:0 0 0 2em!important}.markdownx .markdownx-preview ol li,.markdownx .markdownx-preview ul li{font-size:14px!important;margin-bottom:.75em}.markdownx .markdownx-preview li p:last-child{margin:0}.markdownx .markdownx-preview dd{margin:0 0 0 2em}.markdownx .markdownx-preview img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle}.markdownx .markdownx-preview table{border-collapse:collapse;border-spacing:0}.markdownx .markdownx-preview th{background:0 0;background:#f8f8f8;font-size:14px}.markdownx .markdownx-preview td{vertical-align:top;font-size:14px} \ No newline at end of file diff --git a/markdownx/static/markdownx/js/markdownx.js b/markdownx/static/markdownx/js/markdownx.js index c5620b3..07a3496 100644 --- a/markdownx/static/markdownx/js/markdownx.js +++ b/markdownx/static/markdownx/js/markdownx.js @@ -19,6 +19,7 @@ */ // Import, definitions and constant ------------------------------------------------------------------------------------ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("./utils"); var UPLOAD_URL_ATTRIBUTE = "data-markdownx-upload-urls-path", PROCESSING_URL_ATTRIBUTE = "data-markdownx-urls-path", RESIZABILITY_ATTRIBUTE = "data-markdownx-editor-resizable", LATENCY_ATTRIBUTE = "data-markdownx-latency", LATENCY_MINIMUM = 500, // microseconds. XHR_RESPONSE_ERROR = "Invalid response", UPLOAD_START_OPACITY = "0.3", NORMAL_OPACITY = "1"; @@ -568,6 +569,7 @@ docReady(function () { },{"./utils":2}],2:[function(require,module,exports){ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /** * Looks for a cookie, and if found, returns the values. * diff --git a/markdownx/static/markdownx/js/markdownx.min.js b/markdownx/static/markdownx/js/markdownx.min.js index 948b751..fc03fb7 100644 --- a/markdownx/static/markdownx/js/markdownx.min.js +++ b/markdownx/static/markdownx/js/markdownx.min.js @@ -1 +1 @@ -(function e(t,r,n){function a(s,o){if(!r[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[s]={exports:{}};t[s][0].call(c.exports,function(e){var r=t[s][1][e];return a(r?r:e)},c,c.exports,e,t,r,n)}return r[s].exports}var i=typeof require=="function"&&require;for(var s=0;s0&&e.value[e.start-1].match(/\t/)!==null?e.start-1:e.start;t=e.value.substring(e.start).replace(" ","")}else if(!r){t=e.value.substring(e.start).replace(" ","")}else{t=e.value.substring(e.start,e.end).replace(/^\t/gm,"")+e.value.substring(e.end)}return e.value.substring(0,e.start)+t},_multiLineIndentation:function(e){var t=new RegExp("(?:\n|.){0,"+e.end+"}(^.*$)","m").exec(e.value)[1];return e.value.substring(e.value.indexOf(new RegExp("(?:\n|.){0,"+e.start+"}(^.*$)","m").exec(e.value)[1]),e.value.indexOf(t)?e.value.indexOf(t)+t.length:e.end)},applyIndentation:function(e){if(e.start===e.end){var t=new RegExp("(?:\n|.){0,"+e.start+"}(^.+$)","m").exec(e.value)[1];return e.value.replace(t," "+t)}var r=this._multiLineIndentation({start:e.start,end:e.end,value:e.value});return e.value.replace(r,r.replace(/(^.+$)\n*/gim," $&"))},removeIndentation:function(e){if(e.start===e.end){var t=new RegExp("(?:\n|.){0,"+e.start+"}(^ .+$)","m").exec(e.value)[1];return e.value.replace(t,t.substring(1))}var r=this._multiLineIndentation({start:e.start,end:e.end,value:e.value});return e.value.replace(r,r.replace(/^\t(.+)\n*$/gim,"$1"))},applyDuplication:function(e){if(e.start!==e.end)return e.value.substring(0,e.start)+e.value.substring(e.start,e.end)+(~e.value.charAt(e.start-1).indexOf("\n")||~e.value.charAt(e.start).indexOf("\n")?"\n":"")+e.value.substring(e.start,e.end)+e.value.substring(e.end);var t=new RegExp("(?:.|\n){0,160}(^.*$)","m"),r="";e.value.replace(t,function(e,t){return r+=t});return e.value.replace(r,r+"\n"+r)}},hub:function(e){switch(e.key){case this.keys.TAB:return e.shiftKey?this.handlers.removeTab:this.handlers.applyTab;case this.keys.DUPLICATE:return e.ctrlKey||e.metaKey?this.handlers.applyDuplication:false;case this.keys.INDENT:return e.ctrlKey||e.metaKey?this.handlers.applyIndentation:false;case this.keys.UNINDENT:return e.ctrlKey||e.metaKey?this.handlers.removeIndentation:false;default:return false}}};function v(e){return Math.max(parseInt(window.getComputedStyle(e).height),parseInt(e.style.height)||0)}function m(e){if(e.scrollTop)e.style.height=e.scrollTop+v(e)+"px";return e}var h=function(e,t,r){var v=this;var h={editor:t,preview:r,parent:e,_latency:null,_editorIsResizable:null};var g=function(){v.timeout=null;var e={object:document,listeners:[{type:"drop",capture:false,listener:f.inhibitDefault},{type:"dragover",capture:false,listener:f.inhibitDefault},{type:"dragenter",capture:false,listener:f.inhibitDefault},{type:"dragleave",capture:false,listener:f.inhibitDefault}]},t={object:h.editor,listeners:[{type:"drop",capture:false,listener:x},{type:"input",capture:true,listener:b},{type:"keydown",capture:true,listener:w},{type:"dragover",capture:false,listener:f.onDragEnter},{type:"dragenter",capture:false,listener:f.onDragEnter},{type:"dragleave",capture:false,listener:f.inhibitDefault},{type:"compositionstart",capture:true,listener:w}]};n.mountEvents(t,e);h.editor.style.transition="opacity 1s ease";h.editor.style.webkitTransition="opacity 1s ease";h._latency=Math.max(parseInt(h.editor.getAttribute(o))||0,u);h._editorIsResizable=(h.editor.getAttribute(s).match(/true/i)||[]).length>0&&h.editor.offsetHeight>0&&h.editor.offsetWidth>0;T();n.triggerCustomEvent("markdownx.init")};var y=function(){clearTimeout(v.timeout);v.timeout=setTimeout(T,h._latency)};var b=function(){h.editor=h._editorIsResizable?m(h.editor):h.editor;return y()};var x=function(e){if(e.dataTransfer&&e.dataTransfer.files.length)Object.keys(e.dataTransfer.files).map(function(t){return E(e.dataTransfer.files[t])});f.inhibitDefault(e)};var w=function(e){var t=p.hub(e);if(typeof t!="function")return false;f.inhibitDefault(e);var r=h.editor.selectionStart;h.editor.value=t({start:h.editor.selectionStart,end:h.editor.selectionEnd,value:h.editor.value});y();h.editor.focus();h.editor.selectionEnd=h.editor.selectionStart=r;return false};var E=function(e){h.editor.style.opacity=c;var t=new n.Request(h.editor.getAttribute(a),n.preparePostData({image:e}));t.success=function(e){var t=JSON.parse(e);if(t.image_code){k(t.image_code);n.triggerCustomEvent("markdownx.fileUploadEnd",h.parent,[t])}else if(t.image_path){k('![]("'+t.image_path+'")');n.triggerCustomEvent("markdownx.fileUploadEnd",h.parent,[t])}else{console.error(l,t);n.triggerCustomEvent("markdownx.fileUploadError",h.parent,[t]);return null}h.editor.style.opacity=d};t.error=function(e){h.editor.style.opacity=d;console.error(e);n.triggerCustomEvent("fileUploadError",h.parent,[e])};return t.send()};var T=function(){var e=new n.Request(h.editor.getAttribute(i),n.preparePostData({content:h.editor.value}));e.success=function(e){h.preview.innerHTML=e;h.editor=m(h.editor);n.triggerCustomEvent("markdownx.update",h.parent,[e])};e.error=function(e){console.error(e);n.triggerCustomEvent("markdownx.updateError",h.parent,[e])};return e.send()};var k=function(e){h.editor.value=h.editor.value.substring(0,h.editor.selectionStart)+"\n\n"+e+("\n\n"+h.editor.value.substring(h.editor.selectionEnd));h.editor.selectionStart=h.editor.selectionEnd=h.editor.selectionStart+e.length;n.triggerEvent(h.editor,"keyup");b()};g()};r.MarkdownX=h;(function(e,t){e=e||"docReady";t=t||window;var r=[],n=false,a=false;var i=function(){if(!n){n=true;r.map(function(e){return e.fn.call(window,e.ctx)});r=[]}};var s=function(){return document.readyState==="complete"?i():null};t[e]=function(e,t){if(n){setTimeout(function(){return e(t)},1);return}else{r.push({fn:e,ctx:t})}if(document.readyState==="complete"){setTimeout(i,1)}else if(!a){document.addEventListener("DOMContentLoaded",i,false);window.addEventListener("load",i,false);a=true}}})("docReady",window);docReady(function(){var e=document.getElementsByClassName("markdownx");return Object.keys(e).map(function(t){return new h(e[t],e[t].querySelector(".markdownx-editor"),e[t].querySelector(".markdownx-preview"))})})},{"./utils":2}],2:[function(e,t,r){"use strict";function n(e){if(document.cookie&&document.cookie.length){var t=document.cookie.split(";").filter(function(t){return t.indexOf(e+"=")!==-1})[0];try{return decodeURIComponent(t.trim().substring(e.length+1))}catch(t){if(t instanceof TypeError){console.info('No cookie with key "'+e+'". Wrong name?');return null}throw t}}return null}r.getCookie=n;function a(){var e=[];for(var t=0;t-1)r.splice(n,1);e.className=r.join(" ")}})}r.removeClass=f},{}]},{},[1]); \ No newline at end of file +(function e(t,r,n){function a(o,s){if(!r[o]){if(!t[o]){var u=typeof require=="function"&&require;if(!s&&u)return u(o,!0);if(i)return i(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return a(r?r:e)},c,c.exports,e,t,r,n)}return r[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&e.value[e.start-1].match(/\t/)!==null?e.start-1:e.start;t=e.value.substring(e.start).replace("\t","")}else if(!r){t=e.value.substring(e.start).replace("\t","")}else{t=e.value.substring(e.start,e.end).replace(/^\t/gm,"")+e.value.substring(e.end)}return e.value.substring(0,e.start)+t},_multiLineIndentation:function(e){var t=new RegExp("(?:\n|.){0,"+e.end+"}(^.*$)","m").exec(e.value)[1];return e.value.substring(e.value.indexOf(new RegExp("(?:\n|.){0,"+e.start+"}(^.*$)","m").exec(e.value)[1]),e.value.indexOf(t)?e.value.indexOf(t)+t.length:e.end)},applyIndentation:function(e){if(e.start===e.end){var t=new RegExp("(?:\n|.){0,"+e.start+"}(^.+$)","m").exec(e.value)[1];return e.value.replace(t,"\t"+t)}var r=this._multiLineIndentation({start:e.start,end:e.end,value:e.value});return e.value.replace(r,r.replace(/(^.+$)\n*/gim,"\t$&"))},removeIndentation:function(e){if(e.start===e.end){var t=new RegExp("(?:\n|.){0,"+e.start+"}(^\t.+$)","m").exec(e.value)[1];return e.value.replace(t,t.substring(1))}var r=this._multiLineIndentation({start:e.start,end:e.end,value:e.value});return e.value.replace(r,r.replace(/^\t(.+)\n*$/gim,"$1"))},applyDuplication:function(e){if(e.start!==e.end)return e.value.substring(0,e.start)+e.value.substring(e.start,e.end)+(~e.value.charAt(e.start-1).indexOf("\n")||~e.value.charAt(e.start).indexOf("\n")?"\n":"")+e.value.substring(e.start,e.end)+e.value.substring(e.end);var t=new RegExp("(?:.|\n){0,160}(^.*$)","m"),r="";e.value.replace(t,function(e,t){return r+=t});return e.value.replace(r,r+"\n"+r)}},hub:function(e){switch(e.key){case this.keys.TAB:return e.shiftKey?this.handlers.removeTab:this.handlers.applyTab;case this.keys.DUPLICATE:return e.ctrlKey||e.metaKey?this.handlers.applyDuplication:false;case this.keys.INDENT:return e.ctrlKey||e.metaKey?this.handlers.applyIndentation:false;case this.keys.UNINDENT:return e.ctrlKey||e.metaKey?this.handlers.removeIndentation:false;default:return false}}};function v(e){return Math.max(parseInt(window.getComputedStyle(e).height),parseInt(e.style.height)||0)}function h(e){if(e.scrollTop)e.style.height=e.scrollTop+v(e)+"px";return e}var m=function(e,t,r){var v=this;var m={editor:t,preview:r,parent:e,_latency:null,_editorIsResizable:null};var g=function(){v.timeout=null;var e={object:document,listeners:[{type:"drop",capture:false,listener:f.inhibitDefault},{type:"dragover",capture:false,listener:f.inhibitDefault},{type:"dragenter",capture:false,listener:f.inhibitDefault},{type:"dragleave",capture:false,listener:f.inhibitDefault}]},t={object:m.editor,listeners:[{type:"drop",capture:false,listener:x},{type:"input",capture:true,listener:b},{type:"keydown",capture:true,listener:w},{type:"dragover",capture:false,listener:f.onDragEnter},{type:"dragenter",capture:false,listener:f.onDragEnter},{type:"dragleave",capture:false,listener:f.inhibitDefault},{type:"compositionstart",capture:true,listener:w}]};n.mountEvents(t,e);m.editor.style.transition="opacity 1s ease";m.editor.style.webkitTransition="opacity 1s ease";m._latency=Math.max(parseInt(m.editor.getAttribute(s))||0,u);m._editorIsResizable=(m.editor.getAttribute(o).match(/true/i)||[]).length>0&&m.editor.offsetHeight>0&&m.editor.offsetWidth>0;T();n.triggerCustomEvent("markdownx.init")};var y=function(){clearTimeout(v.timeout);v.timeout=setTimeout(T,m._latency)};var b=function(){m.editor=m._editorIsResizable?h(m.editor):m.editor;return y()};var x=function(e){if(e.dataTransfer&&e.dataTransfer.files.length)Object.keys(e.dataTransfer.files).map(function(t){return E(e.dataTransfer.files[t])});f.inhibitDefault(e)};var w=function(e){var t=p.hub(e);if(typeof t!="function")return false;f.inhibitDefault(e);var r=m.editor.selectionStart;m.editor.value=t({start:m.editor.selectionStart,end:m.editor.selectionEnd,value:m.editor.value});y();m.editor.focus();m.editor.selectionEnd=m.editor.selectionStart=r;return false};var E=function(e){m.editor.style.opacity=c;var t=new n.Request(m.editor.getAttribute(a),n.preparePostData({image:e}));t.success=function(e){var t=JSON.parse(e);if(t.image_code){k(t.image_code);n.triggerCustomEvent("markdownx.fileUploadEnd",m.parent,[t])}else if(t.image_path){k('![]("'+t.image_path+'")');n.triggerCustomEvent("markdownx.fileUploadEnd",m.parent,[t])}else{console.error(l,t);n.triggerCustomEvent("markdownx.fileUploadError",m.parent,[t]);return null}m.editor.style.opacity=d};t.error=function(e){m.editor.style.opacity=d;console.error(e);n.triggerCustomEvent("fileUploadError",m.parent,[e])};return t.send()};var T=function(){var e=new n.Request(m.editor.getAttribute(i),n.preparePostData({content:m.editor.value}));e.success=function(e){m.preview.innerHTML=e;m.editor=h(m.editor);n.triggerCustomEvent("markdownx.update",m.parent,[e])};e.error=function(e){console.error(e);n.triggerCustomEvent("markdownx.updateError",m.parent,[e])};return e.send()};var k=function(e){m.editor.value=m.editor.value.substring(0,m.editor.selectionStart)+"\n\n"+e+("\n\n"+m.editor.value.substring(m.editor.selectionEnd));m.editor.selectionStart=m.editor.selectionEnd=m.editor.selectionStart+e.length;n.triggerEvent(m.editor,"keyup");b()};g()};r.MarkdownX=m;(function(e,t){e=e||"docReady";t=t||window;var r=[],n=false,a=false;var i=function(){if(!n){n=true;r.map(function(e){return e.fn.call(window,e.ctx)});r=[]}};var o=function(){return document.readyState==="complete"?i():null};t[e]=function(e,t){if(n){setTimeout(function(){return e(t)},1);return}else{r.push({fn:e,ctx:t})}if(document.readyState==="complete"){setTimeout(i,1)}else if(!a){document.addEventListener("DOMContentLoaded",i,false);window.addEventListener("load",i,false);a=true}}})("docReady",window);docReady(function(){var e=document.getElementsByClassName("markdownx");return Object.keys(e).map(function(t){return new m(e[t],e[t].querySelector(".markdownx-editor"),e[t].querySelector(".markdownx-preview"))})})},{"./utils":2}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});function n(e){if(document.cookie&&document.cookie.length){var t=document.cookie.split(";").filter(function(t){return t.indexOf(e+"=")!==-1})[0];try{return decodeURIComponent(t.trim().substring(e.length+1))}catch(t){if(t instanceof TypeError){console.info('No cookie with key "'+e+'". Wrong name?');return null}throw t}}return null}r.getCookie=n;function a(){var e=[];for(var t=0;t-1)r.splice(n,1);e.className=r.join(" ")}})}r.removeClass=f},{}]},{},[1]); \ No newline at end of file