diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index cd01c3f86..3835f788b 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/packages-7.7.5/root_import_survey_default-answer-edit.wgpkg b/docs/upgrades/packages-7.7.5/root_import_survey_default-answer-edit.wgpkg new file mode 100644 index 000000000..965aaeb90 Binary files /dev/null and b/docs/upgrades/packages-7.7.5/root_import_survey_default-answer-edit.wgpkg differ diff --git a/docs/upgrades/packages-7.7.5/root_import_survey_default-question-edit.wgpkg b/docs/upgrades/packages-7.7.5/root_import_survey_default-question-edit.wgpkg new file mode 100644 index 000000000..ceae4765e Binary files /dev/null and b/docs/upgrades/packages-7.7.5/root_import_survey_default-question-edit.wgpkg differ diff --git a/docs/upgrades/packages-7.7.5/root_import_survey_default-section-edit.wgpkg b/docs/upgrades/packages-7.7.5/root_import_survey_default-section-edit.wgpkg new file mode 100644 index 000000000..050d44919 Binary files /dev/null and b/docs/upgrades/packages-7.7.5/root_import_survey_default-section-edit.wgpkg differ diff --git a/docs/upgrades/packages-7.7.5/root_import_survey_default-survey-edit.wgpkg b/docs/upgrades/packages-7.7.5/root_import_survey_default-survey-edit.wgpkg new file mode 100644 index 000000000..2710d64f2 Binary files /dev/null and b/docs/upgrades/packages-7.7.5/root_import_survey_default-survey-edit.wgpkg differ diff --git a/www/extras/wobject/Survey/editsurvey.js b/www/extras/wobject/Survey/editsurvey.js index 36f5c3956..848c8779c 100644 --- a/www/extras/wobject/Survey/editsurvey.js +++ b/www/extras/wobject/Survey/editsurvey.js @@ -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(); }); diff --git a/www/extras/wobject/Survey/editsurvey/object.js b/www/extras/wobject/Survey/editsurvey/object.js index ee4a7711b..80bdf569d 100644 --- a/www/extras/wobject/Survey/editsurvey/object.js +++ b/www/extras/wobject/Survey/editsurvey/object.js @@ -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(); } }; })(); diff --git a/www/extras/wobject/Survey/surveyedit.css b/www/extras/wobject/Survey/surveyedit.css index 5f32faba1..b6f4c84e2 100644 --- a/www/extras/wobject/Survey/surveyedit.css +++ b/www/extras/wobject/Survey/surveyedit.css @@ -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%; -} \ No newline at end of file +}