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
|
//initialise RTE editor
function initialiseWebWizRTE(){
//début code ajouté
var i
for(i=0;i<NomTextArea.length;i++)
{
//fin code ajouté
var textArea = document.getElementById(NomTextArea[i]);
var textAreaWidth = parseInt(textArea.offsetWidth);
var textAreaHeight = parseInt(textArea.offsetHeight);
//hide textarea
textArea.style.display = 'none';
//create the iframe
var iframe = document.createElement('iframe');
iframe.setAttribute('id', NomsIFrame[i]);
iframe.setAttribute('onfocus', 'strIFrameName=this.id;');
textArea.parentNode.insertBefore(iframe, textArea);
//style iframe
iframe.style.width = textAreaWidth + 'px';
iframe.style.height = textAreaHeight + 'px';
iframe.style.border = '#A5ACB2 1px solid';
//make toolbar the same size
document.getElementById('toolbar').width = textAreaWidth + 2 + 'px';
var editor = document.getElementById(NomsIFrame[i]).contentWindow.document;
//create iframe page content
var iframeContent;
iframeContent = '<html>\n';
iframeContent += '<head>\n';
iframeContent += '<link href="RTE_configuration/default_style.css" rel="stylesheet" type="text/css" />\n';
iframeContent += '<style>html,body{border:0px;background-color:<% = strRTEbackgroundColour %>;}\ntd{border:1px dotted #CCCCCC;}\n</style>\n';
iframeContent += '</head>\n';
iframeContent += '<body leftmargin="1" topmargin="1" marginwidth="1" marginheight="1" class="RTEtextarea">\n';
iframeContent += textArea.value;
iframeContent += '</body>\n';
iframeContent += '</html>';
editor.open();
editor.write(iframeContent);
editor.close();
function initIframe(){
<%
'IE uses contentEditable instead of designMode to prevent runtime errors in IE6.0.26 to IE6.0.28
'IE uses proprietary attachEvent instead of following the W3C Events module and using addEventListener
'IE SUCKS!!
If RTEenabled = "winIE" Then
%>
editor.attachEvent('onkeypress', editorEvents);
editor.attachEvent('onmousedown', editorEvents);
document.attachEvent('onmousedown', hideIframes);
editor.body.contentEditable = true;
<%
'Gekco needs designMode enabled AFTER we listen for events using addEventListener
Else
%> editor.addEventListener('keypress', editorEvents, true);
editor.addEventListener('mousedown', editorEvents, true);
document.addEventListener('mousedown', hideIframes, true);
editor.designMode = 'on';
<%
End If
%> }
setTimeout(initIframe, 300);
//get present onsubmit events
if (typeof textArea.form.onsubmit == 'function'){
textArea.form.originalOnSubmit = [];
textArea.form.originalOnSubmit.push(textArea.form.onsubmit);
}
//get textrea value from RTE and run any original onSubmit events
textArea.form.onsubmit = function(){
textArea.value = editor.body.innerHTML;
for (i in this.originalOnSubmit){
return this.originalOnSubmit[i]();
}
}
//resetting the form
textArea.form.onreset = function(){
if (window.confirm('<% = strResetWarningFormConfirm %>')){
editor.body.innerHTML = '';
return true;
}
return false;
}
//unload event so we don't loose the data
window.onunload = function(){
textArea.value = editor.body.innerHTML;
}
}
} |
Partager