mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
123 lines
3.5 KiB
Plaintext
123 lines
3.5 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DocEditor.aspx.cs" Inherits="OnlineEditorsExample.DocEditor" Title="ONLYOFFICE" %>
|
||
|
||
<%@ Import Namespace="System.IO" %>
|
||
<%@ Import Namespace="OnlineEditorsExample" %>
|
||
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head runat="server">
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<link rel="icon" href="~/favicon.ico" type="image/x-icon" />
|
||
<title>ONLYOFFICE</title>
|
||
|
||
<style>
|
||
html {
|
||
height: 100%;
|
||
width: 100%;
|
||
}
|
||
|
||
body {
|
||
background: #fff;
|
||
color: #333;
|
||
font-family: Arial, Tahoma,sans-serif;
|
||
font-size: 12px;
|
||
font-weight: normal;
|
||
height: 100%;
|
||
margin: 0;
|
||
overflow-y: hidden;
|
||
padding: 0;
|
||
text-decoration: none;
|
||
}
|
||
|
||
form {
|
||
height: 100%;
|
||
}
|
||
|
||
div {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
</style>
|
||
|
||
<script language="javascript" type="text/javascript" src="<%= DocServiceApiUri %>"></script>
|
||
|
||
<script type="text/javascript" language="javascript">
|
||
|
||
var docEditor;
|
||
|
||
var innerAlert = function (message) {
|
||
if (console && console.log)
|
||
console.log(message);
|
||
};
|
||
|
||
var onAppReady = function () {
|
||
innerAlert("Document editor ready");
|
||
};
|
||
|
||
var onDocumentStateChange = function (event) {
|
||
var title = document.title.replace(/\*$/g, "");
|
||
document.title = title + (event.data ? "*" : "");
|
||
};
|
||
|
||
var onRequestEditRights = function () {
|
||
location.href = location.href.replace(RegExp("action=view\&?", "i"), "");
|
||
};
|
||
|
||
var onError = function (event) {
|
||
if (event)
|
||
innerAlert(event.data);
|
||
};
|
||
|
||
var onOutdatedVersion = function (event) {
|
||
location.reload(true);
|
||
};
|
||
|
||
var config = <%= DocConfig %>;
|
||
|
||
config.width = "100%";
|
||
config.height = "100%";
|
||
|
||
config.events = {
|
||
'onAppReady': onAppReady,
|
||
'onDocumentStateChange': onDocumentStateChange,
|
||
'onRequestEditRights': onRequestEditRights,
|
||
'onError': onError,
|
||
'onOutdatedVersion': onOutdatedVersion,
|
||
};
|
||
|
||
<% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData))
|
||
{ %>
|
||
config.events['onRequestHistory'] = function () {
|
||
docEditor.refreshHistory(<%= History %>);
|
||
};
|
||
config.events['onRequestHistoryData'] = function (event) {
|
||
var ver = event.data;
|
||
var histData = <%= HistoryData %>;
|
||
docEditor.setHistoryData(histData[ver]);
|
||
};
|
||
config.events['onRequestHistoryClose '] = function () {
|
||
document.location.reload();
|
||
};
|
||
<% } %>
|
||
|
||
var сonnectEditor = function () {
|
||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||
};
|
||
|
||
if (window.addEventListener) {
|
||
window.addEventListener("load", сonnectEditor);
|
||
} else if (window.attachEvent) {
|
||
window.attachEvent("load", сonnectEditor);
|
||
}
|
||
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<form id="form1" runat="server">
|
||
<div id="iframeEditor">
|
||
</div>
|
||
</form>
|
||
</body>
|
||
</html>
|