Merge branch 'develop' into feature/insert-image

# Conflicts:
#	web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx.cs
#	web/documentserver-example/java/src/main/java/controllers/EditorServlet.java
#	web/documentserver-example/java/src/main/webapp/editor.jsp
#	web/documentserver-example/nodejs/app.js
#	web/documentserver-example/nodejs/views/editor.ejs
#	web/documentserver-example/php/doceditor.php
#	web/documentserver-example/python/src/views/actions.py
#	web/documentserver-example/python/templates/editor.html
#	web/documentserver-example/ruby/app/models/file_model.rb
#	web/documentserver-example/ruby/app/views/home/editor.html.erb
This commit is contained in:
Alexandr Fedorov
2021-01-28 15:12:36 +03:00
18 changed files with 226 additions and 9 deletions

View File

@ -115,6 +115,10 @@
})
};
var onRequestCompareFile = function () {
docEditor.setRevisedFile(<%= compareFileData%>);
};
var onMakeActionLink = function (event) {
var actionData = event.data;
var linkParam = JSON.stringify(actionData);
@ -142,6 +146,7 @@
'onMakeActionLink': onMakeActionLink,
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestCompareFile': onRequestCompareFile,
};
<% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData))

View File

@ -56,6 +56,7 @@ namespace OnlineEditorsExample
protected string History { get; private set; }
protected string HistoryData { get; private set; }
protected string InsertImageConfig { get; private set; }
protected string compareFileData { get; private set; }
public static string CallbackUrl
{
get
@ -213,6 +214,23 @@ namespace OnlineEditorsExample
tmp = tmp.Replace("}", "");
InsertImageConfig = tmp;
var compareFileUrl = _Default.Host;
compareFileUrl.Path =
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx";
compareFileUrl.Query = "type=download" + "&fileName=" + HttpUtility.UrlEncode("demo.docx");
var dataCompareFile = new Dictionary<string, object>
{
{ "fileType", "docx" },
{ "url", compareFileUrl.ToString() }
};
if (JwtManager.Enabled)
{
var compareFileToken = JwtManager.Encode(dataCompareFile);
dataCompareFile.Add("token", compareFileToken);
}
compareFileData = jss.Serialize(dataCompareFile);
Dictionary<string, object> hist;
Dictionary<string, object> histData;

View File

@ -48,6 +48,9 @@ namespace OnlineEditorsExample
case "remove":
Remove(context);
break;
case "download":
Download(context);
break;
}
}
@ -237,7 +240,18 @@ namespace OnlineEditorsExample
}
}
}
private static void Download(HttpContext context)
{
var filename = context.Request["filename"];
var csvPath = HttpRuntime.AppDomainAppPath + "app_data/" + filename;
FileInfo fileinf = new FileInfo(csvPath);
context.Response.AddHeader("Content-Length", "" + fileinf.Length);
context.Response.AddHeader("Content-Type", MimeMapping.GetMimeMapping(csvPath));
var tmp = HttpUtility.UrlEncode(csvPath);
tmp = tmp.Replace("+", "%20");
context.Response.AddHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + tmp);
context.Response.TransmitFile(csvPath);
}
public bool IsReusable
{
get { return false; }