annotate src/test/editor.html @ 48:4e1a01db19ec

add lists
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 17 Nov 2022 00:11:44 -0700
parents 3ea49246d6a7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 <!doctype html>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 <html>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 <head>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 <meta name="viewport" content="width=device-width, initial-scale=1">
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 <style>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 [contentEditable] {
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 padding: 7px;
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 border: 1px solid #777;
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 white-space: pre-wrap;
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 }
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 </style>
20
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
12 <script src="/site.js"></script>
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 <script>
20
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
14 function getBrowser() {
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
15 let userAgent = navigator.userAgent;
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
16 if( userAgent.match(/chrome|chromium|crios/i) )
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
17 return 'chrome';
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
18 if( userAgent.match(/firefox|fxios/i) )
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
19 return 'firefox';
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
20 if( userAgent.match(/safari/i) )
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
21 return 'safari';
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
22 if( userAgent.match(/opr\//i) )
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
23 return 'opera';
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
24 if( userAgent.match(/edg/i) )
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
25 return 'edge';
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
26 return "unknown";
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
27 }
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
28
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 function log() {
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 let edit = document.querySelector('[contentEditable]');
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 console.log(edit.innerHTML);
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 //console.log(edit.textContent);
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 }
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 function test() {
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 let edit = document.querySelector('[contentEditable]');
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 edit.focus();
20
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
37 editorEnter();
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 }
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 </script>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 </head>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 <body>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 <p>top</p>
20
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
43 <div contentEditable onkeypress="return editorKey()">
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 aaa <b>bbb</b> <i>iii</i>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
45 1
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46 2
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
47 3
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 zzz
20
3ea49246d6a7 bbcode work
Franklin Schmidt <fschmidt@gmail.com>
parents: 19
diff changeset
49 </div>
19
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
50 <p>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
51 <button onclick="log()">log</button>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52 <button onclick="test()">test</button>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53 </p>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
54 <p>bottom</p>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
55 </body>
da006d1c1eba use contentEditable
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56 </html>