-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslidenotes.htm
191 lines (181 loc) · 8.75 KB
/
slidenotes.htm
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>zweiter ansatz - aufgeräumt und javascript in extra datei</title>
<link rel="stylesheet" href="layout.css">
<script language="javascript" src="slidenotes.js"></script>
<script language="javascript"><!--
var slidenote;
var presentation; //TODO: sollte noch entfernt werden. nur noch slidenote-objekt global
/* = new slidenotes(document.getElementById("quelltext"),
document.getElementById("texteditorerrorlayer"),
document.getElementById("wysiwygarea"),
document.getElementById("fehlercode"),
document.getElementById("praesentation")
);
dubbidu
*/
var editorinit=false; //wird nicht mehr gebraucht?
function initeditor(){
//console.log("initeditor:"+editorinit + "slidenote:"+(slidenote==null));
//console.log(slidenote);
if(slidenote==null){
var texted = document.getElementById("quelltext");
var texterr = document.getElementById("texteditorerrorlayer");
var wys = document.getElementById("wysiwygarea");
var errordet = document.getElementById("fehlercode");
var slideshow = document.getElementById("praesentation");
if(texted==null||texterr==null||wys==null||errordet==null||slideshow==null){
//etwas fehlt noch...
console.log("etwas fehlt noch")
setTimeout("initeditor()",500); //gib ihm noch Zeit
} else{
slidenote = new slidenotes(texted, texterr, wys, errordet, slideshow );
presentation = slidenote.presentation;
texted.onresize= function(){slidenote.parseneu();};
texted.onkeydown= function(event){if(slidenote.wysiwygactivated)slidenote.keypressdown(event, texted);};
texted.onkeypress= function(event){if(slidenote.wysiwygactivated)slidenote.keypresswebkit(event, texted);};
texted.onkeyup=function(event){slidenote.keypressup(event, texted);};
texted.onpaste=function(){setTimeout('slidenote.parseneu()',150)};
texted.oncut=function(){setTimeout('slidenote.parseneu()',150)};
//autofocus tonfocus="initeditor(this.value);
texted.onscroll=function(){slidenote.scroll(texted);};
wys.onmouseup=function(event){slidenote.wysiwyg.copyCursorToTextarea(event);};
wys.onmousedown=function(event){slidenote.wysiwyg.mousedown(event);};
wys.onpaste=function(event){
console.log(event.clipboardData.getData('Text'));
console.log("textareaselstartend:"+slidenote.textarea.selectionStart + "->" +slidenote.textarea.selectionEnd);
var selstart=slidenote.textarea.selectionStart;
var selend = slidenote.textarea.selectionEnd;
var pastetext = event.clipboardData.getData('Text');
if(!webkit){
//chromium: does not select textarea, so insert "by hand" (firefox ignores this because it never fires on wysiwyg i think)
slidenote.textarea.value = slidenote.textarea.value.substring(0,selstart)+
pastetext +
slidenote.textarea.value.substring(selend);
setTimeout('slidenote.textarea.focus()',150);
slidenote.textarea.selectionEnd= selend+pastetext.length;
slidenote.textarea.selectionStart = slidenote.textarea.selectionEnd;
}else{
//webkit-version: just set a new selectionstart/end to select textarea as insert-point
slidenote.textarea.selectionStart = selstart;
slidenote.textarea.selectionEnd = selend;
}
setTimeout('slidenote.parseneu()',160);
};
wys.oncut=function(event){
if(!webkit){
//chromium:
var selstart = slidenote.textarea.selectionStart;
slidenote.textarea.value = slidenote.textarea.value.substring(0,slidenote.textarea.selectionStart)+
slidenote.textarea.value.substring(slidenote.textarea.selectionEnd);
slidenote.textarea.selectionEnd = selstart;
slidenote.textarea.selectionStart = selstart;
setTimeout('slidenote.textarea.focus()',100);
setTimeout('slidenote.parseneu()',100);
//return false;
}else{
//webkit: verzöger action weil sonst nichts ins clipboard kopiert wird
//setTimeout("cutcurrentselection()",200);
//neu: webkit: selection neu auswählen sorgt bereits für richtige selection
slidenote.textarea.selectionEnd = slidenote.textarea.selectionEnd;
slidenote.textarea.selectionStart = slidenote.textarea.selectionStart;
slidenote.textarea.focus();
setTimeout('slidenote.parseneu()',200);
}
};
//wys.onkeyup=function(){setTimeout('slidenote.wysiwyg.copyCursorToTextarea()',1);};
wys.onkeyup=function(event){slidenote.keypressup(event,wys)};
wys.onkeydown=function(event){slidenote.wysiwyg.shiftkeydown(event);};
slidenote.parseneu();
console.log("slidenotes geladen");
console.log(slidenote);
texted.addEventListener("focusout", function(){setTimeout("slidenote.wysiwyg.hideorshowcursor()", 100);});
}
}
}
function insertbutton(code){
if(slidenote!=null)slidenote.insertbutton(code);
}
--></script>
</head>
<body>
<div id="editorblock">
<div id="texteditorrahmen">
<h1>Testform zum Text eingeben - ohne wysiwyg</h1>
<form name="testform">
<div id="texteditorbuttons">
<!--<input type="button" onclick="cursorspantest()" value="cursorspantest">-->
<input type="button" onclick="insertbutton('**')" value="**bold**">
<input type="button" onclick="insertbutton('*')" value="*italics*">
<input type="button" onclick="insertbutton('~~')" value="~~stroke~~">
<input type="button" onclick="insertbutton('%head')" value="title">
<input type="button" onclick="insertbutton('%list')" value="unordered list">
<input type="button" onclick="insertbutton('%nrlist')" value="ordered list">
<input type="button" onclick="insertbutton('%quote')" value="quote">
<input type="button" onclick="insertbutton('%link')" value="link">
<input type="button" onclick="insertbutton('%image')" value="image">
<input type="button" onclick="insertbutton('%code')" value="code">
<input type="button" onclick="slidenote.presentation.showpresentation()" value="show presentation">
<input type="button" onclick="slidenote.showErrorDetails()" value="show parseerrors">
<input type="button" onclick="document.getElementById('wysiwygrahmen').classList.add('vollbild');document.getElementById('quelltext').focus();" value="wysiwyg-vollbild">
<select id="editorchoice" onchange="slidenote.choseEditor(this.value)">
<option value="wysiwyg">Wysiwyg-Editor</option>
<option value="md-texteditor">MD-Code Editor</option>
</select>
</div>
<div id="texteditor" class="texteditor">
<div id="texteditorerrorlayer"></div>
<!-- onresize="slidenotes.parseneu()"
onkeydown="slidenotes.keypressdown(event, this)"
onkeyup="slidenotes.keypressup(event, this)"
autofocus onfocus="initeditor(this.value)"
onscroll="slidenotes.editorscroll(this)"> -->
<textarea spellcheck="false" id="quelltext" onload="initeditor()" autofocus onfocus="initeditor();"></textarea>
</div>
</form>
</div>
<div id="wysiwygrahmen">
<h1>quasi-wysiwyg:</h1>
<div class="buttonarea">
<input type="button" onclick="insertbutton('**')" value="**bold**">
<input type="button" onclick="insertbutton('*')" value="*italics*">
<input type="button" onclick="insertbutton('~~')" value="~~stroke~~">
<input type="button" onclick="insertbutton('%head')" value="title">
<input type="button" onclick="insertbutton('%list')" value="unordered list">
<input type="button" onclick="insertbutton('%nrlist')" value="ordered list">
<input type="button" onclick="insertbutton('%quote')" value="quote">
<input type="button" onclick="insertbutton('%link')" value="link">
<input type="button" onclick="insertbutton('%image')" value="image">
<input type="button" onclick="insertbutton('%code')" value="code">
<input type="button" onclick="slidenote.presentation.showpresentation()" value="show presentation">
<input type="button" onclick="document.getElementById('wysiwygrahmen').classList.remove('vollbild');document.getElementById('quelltext').focus();" value="exit fullscreen">
</div>
<div id="wysiwygarea" contenteditable="true"></div>
</div>
</div>
<div>
<!--
<h1>geparster html-code</h1>
<div id="zieltextrahmen"><div id="zieltext"></div></div>
-->
<div id="fehlercoderahmen">
<div id="fehlercode"></div>
<input type="button" onclick="this.parentNode.classList.remove('active')" value="close">
</div>
<!--<h1>Praesentation nach pages:</h1>-->
<div id="praesentationrahmen">
<div id="praesentation"></div>
<div class="praesentationsteuerung">
<input type="button" value="last page please" onclick="presentation.lastPage()">
<input type="button" value="next page please" onclick="presentation.nextPage()">
<input type="button" onclick="presentation.showpresentation()" value="hide presentation">
</div>
</div>
</div>
<div id="imagecontainer">
<img src="images/lapa.jpg">
</div>
</body>
</html>