Fixed a bug in the YUI simple editor for survey editing which was leaking memory. Also improved the object edit templates.

This commit is contained in:
Kaleb Murphy 2009-04-27 20:20:58 +00:00
parent 486d873d7b
commit c327353213
8 changed files with 37 additions and 22 deletions

View file

@ -8,7 +8,7 @@
- fixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction
- fixed #10238: Edit Calendar Event not working when proxy cache disabled
- Fixed a bug in the RssFeed aspect that would cause the wrong HEAD links to be made for the feeds when exporting.
- Fixed a bug in the YUI simple editor for survey editing which was leaking memory. Also improved the object edit templates.
7.7.4
- rfe: Extend DateTime for Week-Nrs (#9151)
- fixed: 7.6 upgrade left some default content marked as packages

View file

@ -197,4 +197,5 @@ Survey.Data = (function(){
YAHOO.util.Event.onDOMReady(function(){
//var ddTarget = new YAHOO.util.DDTarget("sections", "sections");
Survey.Comm.loadSurvey();
Survey.ObjectTemplate.initObjectEditor();
});

View file

@ -8,16 +8,35 @@ Survey.ObjectTemplate = (function(){
// Keep references to widgets here so that we can destory any instances before
// creating new ones (to avoid memory leaks)
var dialog, editor, resizeGotoExpression, gotoAutoComplete;
var dialog, editor, resizeGotoExpression, gotoAutoComplete, editing;
return {
hideEditor: function(){
YAHOO.util.Dom.setStyle("editor_container","visibility","hidden");
},
showEditor: function(){
editor.get('element').value = YAHOO.util.Dom.get('texteditortarget').value;
editor.setEditorHTML(YAHOO.util.Dom.get('texteditortarget').value);
YAHOO.util.Dom.setStyle("editor_container","visibility","visible");
var xy = YAHOO.util.Dom.getXY(YAHOO.util.Dom.get("texteditortarget").id);
YAHOO.util.Dom.setXY("editor_container",xy);
},
initObjectEditor: function() {
editor = new YAHOO.widget.SimpleEditor("editor", {
height: '100px',
width: '570px',
dompath: false
});
if (editor.get('toolbar')) {
editor.get('toolbar').titlebar = false;
}
editor.render();
},
unloadObject: function(){
// First destory the editor..
if (editor) {
editor.destroy();
editor = null;
}
// And then the Dialog that contains it.
if (dialog) {
@ -62,6 +81,8 @@ Survey.ObjectTemplate = (function(){
text: "Submit",
handler: function(){
editor.saveHTML();
YAHOO.util.Dom.get('texteditortarget').value = editor.getEditorHTML();
Survey.ObjectTemplate.hideEditor();
this.submit();
},
isDefault: true
@ -149,20 +170,9 @@ Survey.ObjectTemplate = (function(){
height = '300px';
}
// N.B. SimpleEditor has a memory leak so this eats memory on every instantiation
editor = new YAHOO.widget.SimpleEditor(textareaId, {
height: height,
width: '100%',
dompath: false //Turns on the bar at the bottom
});
if (editor.get('toolbar')) {
editor.get('toolbar').titlebar = false;
}
editor.render();
dialog.show();
initHoverHelp(type);
Survey.ObjectTemplate.showEditor();
}
};
})();

View file

@ -1,3 +1,7 @@
#editor_container {
visibility: hidden;
z-index: 100;
}
#loading-mask {
position: absolute;
@ -143,4 +147,4 @@ li.answer {
}
#sections-panel div.ft {
font-size: 100%;
}
}