+
\ No newline at end of file
+
+
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs
index 7a0072ca23..e2f0aab317 100644
--- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs
+++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs
@@ -67,6 +67,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
[StringLength(PostConsts.MaxUrlLength)]
public string Url { get; set; }
+ [HiddenInput]
[StringLength(PostConsts.MaxContentLength)]
public string Content { get; set; }
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml
index cdc04643bf..a8c01af63b 100644
--- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml
+++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml
@@ -22,7 +22,7 @@
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js
index 60fb760de1..e912f65528 100644
--- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js
+++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js
@@ -1,4 +1,65 @@
(function ($) {
+
+ var $container = $("#edit-post-container");
+ var $editorContainer = $container.find(".edit-post-editor");
+ var $submitButton = $container.find("button[type=submit]");
+ var $form = $container.find("form#edit-post-form");
+ var editorDataKey = "tuiEditor";
+
+ var uploadImage = function (file, callbackFn) {
+ var formData = new FormData();
+ formData.append('file', file);
+
+ $.ajax({
+ type: "POST",
+ url: "",
+ data: formData,
+ contentType: false,
+ processData: false,
+ success: function (response) {
+ callbackFn(response.fileUrl);
+ }
+ });
+ };
+
+ console.log($form.find("input[name='Post.Content']").val() + "asda");
+ var newPostEditor = $editorContainer.tuiEditor({
+ usageStatistics: false,
+ initialEditType: 'markdown',
+ previewStyle: 'tab',
+ height: "auto",
+ initialValue: $form.find("input[name='Post.Content']").val(),
+ hooks: {
+ addImageBlobHook: function (blob, callback, source) {
+ var imageAltText = blob.name;
+
+ uploadImage(blob,
+ function (fileUrl) {
+ callback(fileUrl, imageAltText);
+ });
+ }
+ },
+ events: {
+ load: function () {
+ $editorContainer.find(".loading-cover").remove();
+ $submitButton.prop("disabled", false);
+ }
+ }
+ }).data(editorDataKey);
+
+
+
+ $container.find("form#edit-post-form").submit(function (e) {
+ var $postTextInput = $form.find("input[name='Post.Content']");
+
+ var postText = newPostEditor.getMarkdown();
+ $postTextInput.val(postText);
+ console.log(postText);
+
+ $submitButton.buttonBusy();
+ $(this).off('submit').submit();
+ });
+
$('#Post_Title').on("change paste keyup", function() {
var title = $('#Post_Title').val();
diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js
index 072e1eb0bb..5fd102ff28 100644
--- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js
+++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js
@@ -4,6 +4,7 @@
var $container = $("#qa-new-post-container");
var $editorContainer = $container.find(".new-post-editor");
var $submitButton = $container.find("button[type=submit]");
+ var $form = $container.find("form#new-post-form");
var editorDataKey = "tuiEditor";
var uploadImage = function (file, callbackFn) {
@@ -48,12 +49,10 @@
$container.find("form#new-post-form").submit(function (e) {
- var $form = $container.find("form#new-post-form");
var $postTextInput = $form.find("input[name='Post.Content']");
var postText = newPostEditor.getMarkdown();
$postTextInput.val(postText);
- console.log(postText);
$submitButton.buttonBusy();
$(this).off('submit').submit();