Wiki source code of ContentEditable
Last modified by mflorea on 2010/07/06 16:39
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{html clean="false"}} | ||
2 | <script type="text/javascript"> | ||
3 | function onAction(hook){ | ||
4 | var iframe = document.createElement('iframe'); | ||
5 | iframe.style.border = '1px solid black'; | ||
6 | iframe.addEventListener('load', function() { | ||
7 | iframe.contentWindow.document.body.innerHTML = '<link rel="stylesheet" type="text/css" href="/xwiki/bin/ssx/Test/ContentEditable?language=en"/><p>before<span contentEditable="false" class="readOnly" onclick="this.className=\'readOnly readOnly-selected\'">text</span>after</p>'; | ||
8 | //iframe.contentWindow.document.designMode = 'on'; | ||
9 | iframe.contentWindow.document.body.contentEditable = true; | ||
10 | iframe.focus(); | ||
11 | }, false); | ||
12 | hook.parentNode.insertBefore(iframe, hook); | ||
13 | } | ||
14 | </script> | ||
15 | <button onclick="onAction(this)">Action</button> | ||
16 | {{/html}} |