diff --git a/src/scripts/js/es6/common/api/init.js b/src/scripts/js/es6/common/api/init.js new file mode 100644 index 00000000..bbd9898d --- /dev/null +++ b/src/scripts/js/es6/common/api/init.js @@ -0,0 +1 @@ +export { thenMarkdownToHtml } from './markdown' \ No newline at end of file diff --git a/src/templates/nodes/custom/post/create.pug b/src/templates/nodes/custom/post/create.pug index 83b3987d..db3d43fc 100644 --- a/src/templates/nodes/custom/post/create.pug +++ b/src/templates/nodes/custom/post/create.pug @@ -128,15 +128,7 @@ script(type="text/javascript"). $contentPreview = $('
').insertAfter($contentField); function parseDescriptionContent(content) { - - $.ajax({ - url: "{{ url_for('nodes.preview_markdown')}}", - type: 'post', - data: {content: content}, - headers: {"X-CSRFToken": csrf_token}, - headers: {}, - dataType: 'json' - }) + pillar.api.thenMarkdownToHtml(content) .done(function (data) { $contentPreview.html(data.content); }) diff --git a/src/templates/nodes/edit_embed.pug b/src/templates/nodes/edit_embed.pug index d0a191b9..352b5a91 100644 --- a/src/templates/nodes/edit_embed.pug +++ b/src/templates/nodes/edit_embed.pug @@ -106,14 +106,7 @@ script(type="text/javascript"). function parseDescriptionContent(content) { - $.ajax({ - url: "{{ url_for('nodes.preview_markdown')}}", - type: 'post', - data: {content: content}, - headers: {"X-CSRFToken": csrf_token}, - headers: {}, - dataType: 'json' - }) + pillar.api.thenMarkdownToHtml(content) .done(function (data) { $contentPreview.html(data.content); }) diff --git a/src/templates/projects/edit.pug b/src/templates/projects/edit.pug index 032c9590..81ff8432 100644 --- a/src/templates/projects/edit.pug +++ b/src/templates/projects/edit.pug @@ -140,14 +140,7 @@ script(type="text/javascript"). function parseDescriptionContent(content) { - $.ajax({ - url: "{{ url_for('nodes.preview_markdown')}}", - type: 'post', - data: {content: content}, - headers: {"X-CSRFToken": csrf_token}, - headers: {}, - dataType: 'json' - }) + pillar.api.thenMarkdownToHtml(content) .done(function (data) { $contentPreview.html(data.content); })