-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtexteditor.html
54 lines (50 loc) · 2.15 KB
/
texteditor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE HTML>
<html style="width:100%; height:100%; margin:0px; padding:0px" xml:lang="en" lang="en">
<head>
<!--
Example page for how to use the Wodo.TextEditor
This page is not usable directly from the WebODF sources, only from the build or from the released Wodo.TextEditor package.
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Wodo.TextEditor</title>
<script src="wodotexteditor/wodotexteditor.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function createEditor() {
// begin: check for being served by a webserver
// just done to catch a mistake sometimes done by people testing Wodo.TextEditor
// who might have missed this requirement before
var href = window.location.href;
if (! /^http(s)?:/.test(href)) {
alert("texteditor.html must be served by a webserver.");
return;
}
// end: check for being served by a webserver
var editorOptions = {
userData: {
fullName: "Tim Lee",
color: "blue"
},
annotationsEnabled: true
};
function onEditorCreated(err, editor) {
if (err) {
// something failed unexpectedly, deal with it (here just a simple alert)
alert(err);
return;
}
editor.openDocumentFromUrl("welcome.odt", function(err) {
if (err) {
// something failed unexpectedly, deal with it (here just a simple alert)
alert("There was an error on opening the document: " + err);
}
});
}
Wodo.createTextEditor('editorContainer', editorOptions, onEditorCreated);
}
</script>
</head>
<body style="width:100%; height:100%; margin:0px; padding:0px" onload="createEditor();">
<div id="editorContainer" style="width:100%; height:100%; margin:0px; padding:0px">
</div>
</body>
</html>