diff --git a/share/src/main/resources/META-INF/components/markdown-edit.js b/share/src/main/resources/META-INF/components/markdown-edit.js new file mode 100644 index 0000000..d3d0b45 --- /dev/null +++ b/share/src/main/resources/META-INF/components/markdown-edit.js @@ -0,0 +1,96 @@ +require(["dojo/dom", "dojo/query", "dojo/on", "dojo/request", "showdown", "showdown-github", "showdown-table", "dojo/domReady!"], function(dom, query, on, request, showdown, showdownGithub, showdownTable){ + + function resizeFrame(elem) { + elem.style.height = (window.innerHeight - 280) + "px"; + } + + function getURLParameter(name) { + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null + } + + var nodePath = getURLParameter("nodeRef").replace(":/",""); + + request.get(Alfresco.constants.PROXY_URI_RELATIVE + "/slingshot/doclib2/node/" + nodePath,{ handleAs: "json"}).then(function(nodeData) { + + + var locationPath = Alfresco.constants.PROXY_URI_RELATIVE + "markdown" + nodeData.item.location.repoPath + "/"; + + //Once we have the content, let's create a converter and add the html to the div element + var converter = new showdown.Converter({ + extensions: [ + function() { + return [{ + type: 'output', + filter: function(source) { + return source.replace(/