I have the Following Code-which gives the cache data on opening the new browser-session in Firefox, but in IE 7+ it does not give the data but saves the data on refreshing.
< textarea name="tinyeditor" id="tinyeditor" style="width: 400px; height: 200px; visibility:hidden;" onfocus="yuicontent('','Get');">< /textarea>
// Save the contents of the textarea after each keystroke.
Y.StorageLite.setItem('editors', string);
//alert (Y.StorageLite.getItem('editors'));
//alert(document.getElementById("tinyeditor").value);
//alert(Y.StorageLite.getItem('editors'));
//tinyeditor3=tinyeditor2;
});
});
};
if(condition==='Set'){
// Save the contents of the textarea after each keystroke.
Y.StorageLite.setItem('editors', string);
//alert (Y.StorageLite.getItem('editors'));
//alert(document.getElementById("tinyeditor").value);
//alert(Y.StorageLite.getItem('editors'));
//tinyeditor3=tinyeditor2;
}
});
});
};
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
elements : "tinyeditor",
skin : "o2k7",
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example word content CSS (should be your site CSS) this one removes paragraph margins
content_css : "css/word.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
},
// Call the Function to load the storage-lite content for the first-time //
setup : function(ed) {
//default-first-action-to-load-data
// Call the YUI Storage lite function to fetch data
// It is run-time investment
//getyuicontent();
yuicontent('','Get');
//document.getElementById('tinyeditor').innerHTML=yuicontent('','Get');
alert ('You are now in the Editor Mode');
//tinyMCE.get('tinyeditor').setContent(yuicontent('','Get'));;
//document.getElementById('tinyeditor').value=yuicontent('','Get');
//if(getyuicontent()) {
if(yuicontent('','Get')) {
//getdata=getyuicontent();
getdata=yuicontent('','Get');
//alert (yuicontent('','Get'));
//alert (getyuicontent());
tinyMCE.get('tinyeditor').setContent(getdata);
document.getElementById('tinyeditor').innerHTML=Y.StorageLite.getItem('editors');
//document.getElementById('tinyeditor').value=getdata;
}
ed.onKeyDown.add(function(ed, e) {
//alert ('hehehe');
if(document.getElementById('tinyeditor').value!='<p><br></p>'){//get the content from some other dom
//var content = tinyMCE.get('tinyeditor').getContent();
var content =tinyMCE.get('tinyeditor').getContent();
//setyuicontent(content);
yuicontent(content,'Set');
}
});
}
});
I have the Following Code-which gives the cache data on opening the new browser-session in Firefox, but in IE 7+ it does not give the data but saves the data on refreshing.
http://liquidpaisa.com/softwares/JS_Based_Templates/TinyMCE/TinyMCE-Hacks.zip
You can get the code from above ftp site:
< !DOCTYPE html>
< html>
< head>
< meta charset="utf-8">
< title>Word processor example< /title>
< style type="text/css">
html {
background: #fff;
color: #000;
}
< script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js">< /script>
< script src="http://yui.yahooapis.com/3.8.1/build/yui/yui-min.js">< /script>
< /head>
< body class="yui-skin-sam">
< form>
< !-- Testarea had the name name="notes" -->
< p>
< textarea name="tinyeditor" id="tinyeditor" style="width: 400px; height: 200px; visibility:hidden;" onfocus="yuicontent('','Get');">< /textarea>
< /p>
< /form>
< script type="text/javascript">
var global='';
function getyuicontent(){
YUI().use('gallery-storage-lite', 'node-base', function (Y) { // 1.2.1 //
Y.StorageLite.on('storage-lite:ready', function () { // 1.2.1.1
// Populate the textarea with the stored note text on page load.
//alert(Y.StorageLite.getItem('editors'));
if(Y.StorageLite.getItem('editors')===null){
//alert('It is not defined 1');
return (global='');
}
else {
return global=(Y.StorageLite.getItem('editors'));
}
});
});
function setyuicontent(string){
YUI().use('gallery-storage-lite', 'node-base', function (Y) { // 1.2.1 //
Y.StorageLite.on('storage-lite:ready', function () { // 1.2.1.1
function yuicontent(string,condition){
YUI().use('gallery-storage-lite', 'node-base', function (Y) { // 1.2.1 //
Y.StorageLite.on('storage-lite:ready', function () { // 1.2.1.1
if(condition==='Get'){
// Populate the textarea with the stored note text on page load.
Y.StorageLite.getItem('editors');
//document.getElementById('tinyeditor').innerHTML=Y.StorageLite.getItem('editors');
document.getElementById('tinyeditor').innerHTML=Y.StorageLite.getItem('editors');
//document.getElementById('tinyeditor').innerHTML=':))';
if(Y.StorageLite.getItem('editors')===null){
//alert('It is not defined 1');
return (global='');
}
else {
return global=(Y.StorageLite.getItem('editors'));
}
}
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}
< /script>
< /body>
< /html>