Index: trunk/extensions/InlineEditor/InlineEditor.i18n.php |
— | — | @@ -28,6 +28,8 @@ |
29 | 29 | 'inline-editor-editmodes-undo' => 'Undo', |
30 | 30 | 'inline-editor-editmodes-redo' => 'Redo', |
31 | 31 | 'inline-editor-enable-preference' => 'Enable inline editing', |
| 32 | + 'inline-editor-preview' => 'Preview', |
| 33 | + 'inline-editor-cancel' => 'Cancel', |
32 | 34 | ); |
33 | 35 | |
34 | 36 | /** Language descriptions |
— | — | @@ -62,4 +64,6 @@ |
63 | 65 | unambiguous: it will be shown to the world. On the other hand, using the word "Publish" may have legal |
64 | 66 | consequences in some countries, which should be looked into.', |
65 | 67 | 'inline-editor-enable-preference' => '', |
| 68 | + 'inline-editor-preview' => '', |
| 69 | + 'inline-editor-cancel' => '', |
66 | 70 | ); |
Index: trunk/extensions/InlineEditor/jquery.inlineEditor.editors.basic.js |
— | — | @@ -35,9 +35,12 @@ |
36 | 36 | $input.text( wiki ); |
37 | 37 | |
38 | 38 | // build preview and cancel buttons and add click events |
39 | | - var $preview = $( '<input type="button" value="Preview" class="preview"/>' ); |
40 | | - var $cancel = $( '<input type="button" value="Cancel" class="cancel"/>' ); |
| 39 | + var $preview = $( '<input type="button" class="preview"/>' ); |
| 40 | + $preview.attr( 'value', mediaWiki.msg( 'inline-editor-preview' ) ); |
41 | 41 | $preview.click( $.inlineEditor.editors.basic.clickPreview ); |
| 42 | + |
| 43 | + var $cancel = $( '<input type="button" class="cancel"/>' ); |
| 44 | + $cancel.attr( 'value', mediaWiki.msg( 'inline-editor-cancel' ) ); |
42 | 45 | $cancel.click( $.inlineEditor.editors.basic.clickCancel ); |
43 | 46 | |
44 | 47 | // build a div for the buttons |
— | — | @@ -156,7 +159,7 @@ |
157 | 160 | * Reload the editor. |
158 | 161 | */ |
159 | 162 | reload: function() { |
160 | | - $.inlineEditor.editors.basic.bindEvents( $( '.inlineEditorElement .inlineEditorBasic' ) ); |
| 163 | + $.inlineEditor.editors.basic.bindEvents( $( '.inlineEditorBasic' ) ); |
161 | 164 | }, |
162 | 165 | |
163 | 166 | /** |
Index: trunk/extensions/InlineEditor/jquery.inlineEditor.js |
— | — | @@ -151,12 +151,9 @@ |
152 | 152 | }, |
153 | 153 | |
154 | 154 | /** |
155 | | - * Publishes the document in its current state. |
| 155 | + * Submit event, adds the json to the hidden field |
156 | 156 | */ |
157 | | - publish: function( event ) { |
158 | | - event.stopPropagation(); |
159 | | - event.preventDefault(); |
160 | | - |
| 157 | + submit: function( event ) { |
161 | 158 | // get the wikitext from the state as it's currently on the screen |
162 | 159 | var data = { |
163 | 160 | 'object': $.inlineEditor.states[$.inlineEditor.currentState].object |
— | — | @@ -165,6 +162,12 @@ |
166 | 163 | |
167 | 164 | // set and send the form |
168 | 165 | $( '#json' ).val( json ); |
| 166 | + }, |
| 167 | + |
| 168 | + /** |
| 169 | + * Publishes the document |
| 170 | + */ |
| 171 | + publish: function() { |
169 | 172 | $( '#editForm' ).submit(); |
170 | 173 | }, |
171 | 174 | |
— | — | @@ -172,6 +175,7 @@ |
173 | 176 | * Initializes the editor. |
174 | 177 | */ |
175 | 178 | init : function() { |
| 179 | + $( '#editForm' ).submit( $.inlineEditor.submit ); |
176 | 180 | $( '#publish' ).click( $.inlineEditor.publish ); |
177 | 181 | //$( '#undo' ).click( $.inlineEditor.undo ); |
178 | 182 | //$( '#redo' ).click( $.inlineEditor.redo ); |