Remember last editor chosen. Props mdawaffe. fixes #3978

git-svn-id: https://develop.svn.wordpress.org/trunk@6567 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-01-06 19:01:32 +00:00
parent debf80f07c
commit edbba502ed
8 changed files with 57 additions and 19 deletions
@@ -523,6 +523,7 @@ function switchEditors(id) {
pdr.style.height = 'auto';
pdr.style.overflow = 'display';
}
wpSetDefaultEditor( 'html' );
} else {
edToggle(P, H);
edCloseAllTags(); // :-(
@@ -557,6 +558,7 @@ function switchEditors(id) {
pdr.style.height = 'auto';
pdr.style.overflow = 'display';
}
wpSetDefaultEditor( 'tinymce' );
}
}
@@ -568,6 +570,19 @@ function edToggle(A, B) {
A.onclick = null;
}
function wpSetDefaultEditor( editor ) {
try {
editor = escape( editor.toString() );
} catch(err) {
editor = 'tinymce';
}
var userID = document.getElementById('user-id');
var date = new Date();
date.setTime(date.getTime()+(10*365*24*60*60*1000));
document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
}
function wpautop(pee) {
pee = pee + "\n\n";
pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");