Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -183,8 +183,10 @@ |
184 | 184 | |
185 | 185 | |
186 | 186 | function createDialog( $templateDiv ){ |
187 | | - var templateModel = $templateDiv.data('model'); |
188 | | - console.log(templateModel.getText()); |
| 187 | + var $wikitext = $templateDiv.children('.wikiEditor-template-text'); |
| 188 | + //TODO: check if template model has been changed |
| 189 | + var templateModel = new $.wikiEditor.modules.templateEditor.fn.model( $wikitext.text() ); |
| 190 | + $templateDiv.data('model', templateModel); |
189 | 191 | var $dialog = $("<div></div>"); |
190 | 192 | var $title = $("<div>" + templateModel.getName() + "</div>").addClass('wikiEditor-template-dialog-title'); |
191 | 193 | var $table = $("<table></table>") |
— | — | @@ -213,6 +215,9 @@ |
214 | 216 | $('.wikiEditor-template-dialog-value input').each( function(){ |
215 | 217 | templateModel.setValue( $(this).data('name'), $(this).val() ); |
216 | 218 | }); |
| 219 | + //keep text consistent |
| 220 | + $wikitext.text( templateModel.getText() ); |
| 221 | + |
217 | 222 | $dialog.dialog('close'); |
218 | 223 | |
219 | 224 | }).text("OK").appendTo($dialog); |