Index: trunk/extensions/InlineEditor/InlineEditorFunctional.php |
— | — | @@ -1,12 +0,0 @@ |
2 | | -<?php |
3 | | -require_once( dirname(__FILE__) . "/InlineEditor.php" ); |
4 | | -require_once( dirname(__FILE__) . "/SentenceEditor/SentenceEditor.php" ); |
5 | | -require_once( dirname(__FILE__) . "/ListEditor/ListEditor.php" ); |
6 | | -require_once( dirname(__FILE__) . "/ReferenceEditor/ReferenceEditor.php" ); |
7 | | -require_once( dirname(__FILE__) . "/MediaEditor/MediaEditor.php" ); |
8 | | -require_once( dirname(__FILE__) . "/TemplateEditor/TemplateEditor.php" ); |
9 | | -require_once( dirname(__FILE__) . "/FullEditor/FullEditor.php" ); |
10 | | -require_once( dirname(__FILE__) . "/ParagraphEditor/ParagraphEditor.php" ); |
11 | | -require_once( dirname(__FILE__) . "/SectionEditor/SectionEditor.php" ); |
12 | | -$wgInlineEditorParagraphEditorVisible = false; |
13 | | -$wgInlineEditorSectionEditorVisible = false; |
Index: trunk/extensions/InlineEditor/InlineEditorBlocks.php |
— | — | @@ -1,6 +0,0 @@ |
2 | | -<?php |
3 | | -require_once( dirname(__FILE__) . "/InlineEditor.php" ); |
4 | | -require_once( dirname(__FILE__) . "/SentenceEditor/SentenceEditor.php" ); |
5 | | -require_once( dirname(__FILE__) . "/ParagraphEditor/ParagraphEditor.php" ); |
6 | | -require_once( dirname(__FILE__) . "/SectionEditor/SectionEditor.php" ); |
7 | | -require_once( dirname(__FILE__) . "/FullEditor/FullEditor.php" ); |
Index: trunk/extensions/InlineEditor/jquery.textWidth.js |
— | — | @@ -1,33 +0,0 @@ |
2 | | -/** |
3 | | - * Function to determine the actual usable width of a span. |
4 | | - * This means that the span has to start at the left of the containing element, |
5 | | - * and the text inside the span may wrap if it gets too long. |
6 | | - */ |
7 | | -( function( $ ) { |
8 | | - $.fn.textWidth = function(){ |
9 | | - var element = $j(this); |
10 | | - |
11 | | - // build an outer element that stretches to the maximum width, so the span will |
12 | | - // be located to the leftmost position |
13 | | - var outer = $('<div style="width: 100%"></div>'); |
14 | | - |
15 | | - // build a span inside the outer div |
16 | | - var inner = $('<span></span>'); |
17 | | - inner.html(element.html()); |
18 | | - outer.append(inner); |
19 | | - |
20 | | - // place the outer div after the original element and hide the original element so it'll |
21 | | - // be in exactly the same place |
22 | | - element.after(outer); |
23 | | - element.hide(); |
24 | | - |
25 | | - // calculate the div of the span (which will wrap when it meets the maximum width) |
26 | | - var width = inner.width(); |
27 | | - |
28 | | - // remove the test elements and show the original element again |
29 | | - outer.remove(); |
30 | | - element.show(); |
31 | | - |
32 | | - return width; |
33 | | - }; |
34 | | -} ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/BasicEditor.css |
— | — | @@ -0,0 +1,131 @@ |
| 2 | +#editContent .inlineEditorElement.bar { |
| 3 | + /* show a clickable bar on the left and have some space with elements below */ |
| 4 | + border-left: 10px solid #E4F0F9; |
| 5 | + margin-left: 5px; |
| 6 | + padding-left: 5px; |
| 7 | + margin-bottom: 5px; |
| 8 | +} |
| 9 | + |
| 10 | +#editContent .inlineEditorElement.nobar { |
| 11 | + /* highlight the entire element when not showing a bar */ |
| 12 | + background-color: #E4F0F9; |
| 13 | +} |
| 14 | + |
| 15 | +#editContent .inlineEditorElement.bar.edited { |
| 16 | + /* have a yellow colour to highlight edited elements, basically the orange colour with the hue shifted */ |
| 17 | + border-left: 10px solid #F9F2A7; |
| 18 | +} |
| 19 | + |
| 20 | +#editContent .inlineEditorElement.nobar.edited { |
| 21 | + /* have a yellow colour to highlight edited elements, basically the orange colour with the hue shifted */ |
| 22 | + background-color: #F9F2A7; |
| 23 | +} |
| 24 | + |
| 25 | +#editContent .inlineEditorElement.bar.hover { |
| 26 | + /* highlight the bar on hover */ |
| 27 | + border-left: 10px solid #a7d7f9; |
| 28 | +} |
| 29 | + |
| 30 | +#editContent .inlineEditorElement.hover, #editContent .inlineEditorElement.nobar:hover { |
| 31 | + /* highlight the element with a darker colour */ |
| 32 | + background-color: #a7d7f9; |
| 33 | + |
| 34 | + /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
| 35 | + cursor: pointer; |
| 36 | + cursor: hand; |
| 37 | +} |
| 38 | + |
| 39 | +#editContent .inlineEditorElement.hover .inlineEditorElement { |
| 40 | + /* also have elements inside coloured */ |
| 41 | + border-color: transparent; |
| 42 | + background-color: #a7d7f9; |
| 43 | +} |
| 44 | + |
| 45 | +#editContent .inlineEditorElement.nobar.notEditing * { |
| 46 | + /* make sure all the child elements inherit the background colour */ |
| 47 | + background-color: inherit !important; |
| 48 | +} |
| 49 | + |
| 50 | +#editContent .editing { |
| 51 | + /* keeping the custom padding and margin breaks in Webkit browsers */ |
| 52 | + padding: 0px; |
| 53 | + margin: 0px; |
| 54 | + |
| 55 | + /* reset the cursor when editing */ |
| 56 | + cursor: auto; |
| 57 | + |
| 58 | + /* position the element above the other elements and have it span a large part of the screen */ |
| 59 | + background-color: #a7d7f9; |
| 60 | + padding: 10px; |
| 61 | + width: 90%; |
| 62 | + position: absolute; |
| 63 | + left: 0px; |
| 64 | +} |
| 65 | + |
| 66 | +#editContent a, #editContent a:hover, #editContent a:visited, #editContent a:active { |
| 67 | + /* remove the link underline because that way it looks they're clickable */ |
| 68 | + text-decoration: none; |
| 69 | +} |
| 70 | + |
| 71 | +#editContent .inline { |
| 72 | + /* use this instead of actually having a span, as this is treated differently by the parser */ |
| 73 | + display: inline; |
| 74 | +} |
| 75 | + |
| 76 | +#editContent .editbar { |
| 77 | + /* this is used to position the elements inside using position absolute */ |
| 78 | + position: relative; |
| 79 | + width: 100%; |
| 80 | +} |
| 81 | + |
| 82 | +#editContent .editbar textarea { |
| 83 | + /* style the textarea font, as this differs heavily from browser to browser */ |
| 84 | + font-family: "Lucida Console", "Courier New", monospace; |
| 85 | + font-size: 1.0em; |
| 86 | + line-height: 1.3em; |
| 87 | + margin: 0px; |
| 88 | + padding: 0px; |
| 89 | + height: 50px; |
| 90 | + width: 100%; |
| 91 | + |
| 92 | + /* disable resizing for browsers like Chrome, as we do this ourselves */ |
| 93 | + resize: none; |
| 94 | +} |
| 95 | + |
| 96 | +#editContent .saving { |
| 97 | + /* have a cross-browser alpha overlay, see http://www.quirksmode.org/css/opacity.html */ |
| 98 | + opacity: 0.95; |
| 99 | + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=95)"; |
| 100 | + filter: alpha(opacity=95); |
| 101 | +} |
| 102 | + |
| 103 | +#editContent .overlay { |
| 104 | + /* position the overly to cover the entire editbar */ |
| 105 | + height: 100%; |
| 106 | + left: 0; |
| 107 | + position: absolute; |
| 108 | + text-align: center; |
| 109 | + top: 0; |
| 110 | + width: 100%; |
| 111 | +} |
| 112 | + |
| 113 | +#editContent .overlay img.spinner { |
| 114 | + /* position the spinner exactly in the middle */ |
| 115 | + left: 50%; |
| 116 | + margin-left: -8px; |
| 117 | + margin-top: -8px; |
| 118 | + position: absolute; |
| 119 | + top: 50%; |
| 120 | + width: 16px; |
| 121 | + height: 16px; |
| 122 | +} |
| 123 | + |
| 124 | +#editContent .overlay .alpha { |
| 125 | + /* have a cross-browser alpha overlay, see http://www.quirksmode.org/css/opacity.html */ |
| 126 | + width: 100%; |
| 127 | + height: 100%; |
| 128 | + background-color: #333; |
| 129 | + opacity: 0.8; |
| 130 | + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; |
| 131 | + filter: alpha(opacity=80); |
| 132 | +} |
Property changes on: trunk/extensions/InlineEditor/BasicEditor.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 133 | + native |
Index: trunk/extensions/InlineEditor/InlineEditor.class.php |
— | — | @@ -11,12 +11,11 @@ |
12 | 12 | const REASON_ADVANCED = 2; /// < reason is editing an 'advanced' page, whatever that may be |
13 | 13 | |
14 | 14 | private $article; /// < Article object to edit |
15 | | - private $editModes; /// < array of different edit modes, see addEditMode() |
16 | 15 | private $extendedEditPage; /// < ExtendedEditPage object we're using to handle editor logic |
17 | 16 | |
18 | 17 | /** |
19 | 18 | * Main entry point, hooks into MediaWikiPerformAction. |
20 | | - * Checks whether or not to spawn the editor, and does so if nessicary. |
| 19 | + * Checks whether or not to spawn the editor, and does so if necessary. |
21 | 20 | */ |
22 | 21 | public static function mediaWikiPerformAction( $output, $article, $title, $user, $request, $wiki ) { |
23 | 22 | global $wgHooks; |
— | — | @@ -38,6 +37,7 @@ |
39 | 38 | return true; |
40 | 39 | } |
41 | 40 | |
| 41 | + // for now, ignore section edits and just edit the whole page |
42 | 42 | unset( $_GET['section'] ); |
43 | 43 | unset( $_POST['section'] ); |
44 | 44 | $request->setVal( 'section', null ); |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | | - * Entry point for the 'Preview' function through Ajax. |
| 145 | + * Entry point for the 'Preview' function through ajax. |
146 | 146 | * No real point in securing this, as nothing is actually saved. |
147 | 147 | * @param $json string JSON object from the client |
148 | 148 | * @param $pageName string The page we're editing |
— | — | @@ -182,7 +182,6 @@ |
183 | 183 | */ |
184 | 184 | public function __construct( $article ) { |
185 | 185 | $this->article = $article; |
186 | | - $editmodes = array(); |
187 | 186 | } |
188 | 187 | |
189 | 188 | /** |
— | — | @@ -208,7 +207,7 @@ |
209 | 208 | $text = new InlineEditorText( $this->article ); |
210 | 209 | } |
211 | 210 | |
212 | | - // try to init, or else return false, which will spawn an 'advanced page' notice |
| 211 | + // try to initialise, or else return false, which will spawn an 'advanced page' notice |
213 | 212 | $this->extendedEditPage = new ExtendedEditPage( $this->article ); |
214 | 213 | if ( $this->extendedEditPage->initInlineEditor() ) { |
215 | 214 | // IMPORTANT: if the page was being saved, the script has been terminated by now!! |
— | — | @@ -216,11 +215,11 @@ |
217 | 216 | // include the required JS and CSS files |
218 | 217 | $output->includeJQuery(); |
219 | 218 | $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.elastic.js?0" ); |
220 | | - $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.textWidth.js?0" ); |
221 | 219 | $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.inlineEditor.js?0" ); |
222 | 220 | $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.inlineEditor.basicEditor.js?0" ); |
223 | 221 | $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery-ui-effects-1.8.4.min.js?0" ); |
224 | 222 | $output->addExtensionStyle( $wgExtensionAssetsPath . "/InlineEditor/InlineEditor.css?0" ); |
| 223 | + $output->addExtensionStyle( $wgExtensionAssetsPath . "/InlineEditor/BasicEditor.css?0" ); |
225 | 224 | |
226 | 225 | // have the different kind of editors register themselves |
227 | 226 | wfRunHooks( 'InlineEditorDefineEditors', array( &$this, &$output ) ); |
— | — | @@ -236,20 +235,19 @@ |
237 | 236 | $output->addParserOutput( $parserOutput ); |
238 | 237 | $output->setPageTitle( $parserOutput->getTitleText() ); |
239 | 238 | |
| 239 | + // convert the text object into an initial state to send |
240 | 240 | $initial = InlineEditorText::initialState( $text ); |
241 | 241 | |
| 242 | + // store the actual object in the session, as it can be quite large |
242 | 243 | $objectID = (isset($_SESSION['inline-editor-id']) ? $_SESSION['inline-editor-id'] + 1 : 0); |
243 | 244 | $_SESSION['inline-editor-id'] = $objectID; |
244 | 245 | $_SESSION['inline-editor-object-' . $objectID] = $initial['object']; |
245 | 246 | $initial['object'] = $objectID; |
246 | | - |
247 | | - $initialJSON = FormatJson::encode( $initial ); |
248 | 247 | |
249 | | - // add the different edit modes and initial JSON state in Javascript, and finally init the editor |
| 248 | + // add the initial JSON state in Javascript, and then initialise the editor |
| 249 | + $initialJSON = FormatJson::encode( $initial ); |
250 | 250 | $output->addInlineScript( |
251 | 251 | 'jQuery( document ).ready( function() { |
252 | | - jQuery.inlineEditor.editModes = ["' . implode( '","', array_keys( $this->editModes ) ) . '"]; |
253 | | - jQuery.inlineEditor.currentMode = "' . reset( $this->editModes ) . '"; |
254 | 252 | jQuery.inlineEditor.addInitialState( ' . $initialJSON . ' ); |
255 | 253 | jQuery.inlineEditor.init(); |
256 | 254 | } );' |
— | — | @@ -279,19 +277,26 @@ |
280 | 278 | * @return string |
281 | 279 | */ |
282 | 280 | public function preview ( $json ) { |
| 281 | + // decode the JSON |
283 | 282 | $request = FormatJson::decode( $json, true ); |
284 | 283 | |
| 284 | + // add the actual object from session, as it's quite big |
285 | 285 | $request['object'] = $_SESSION['inline-editor-object-' . $request['object']]; |
286 | 286 | |
| 287 | + // load the JSON to a text object and perform the edit |
287 | 288 | $text = InlineEditorText::restoreObject( $request, $this->article ); |
288 | 289 | $text->doEdit( $request['lastEdit']['id'], $request['lastEdit']['text'] ); |
289 | 290 | |
| 291 | + // get the next state |
290 | 292 | $subseq = InlineEditorText::subsequentState( $text ); |
| 293 | + |
| 294 | + // save the object to a new unique key in the session |
291 | 295 | $objectID = (isset($_SESSION['inline-editor-id']) ? $_SESSION['inline-editor-id'] + 1 : 0); |
292 | 296 | $_SESSION['inline-editor-id'] = $objectID; |
293 | 297 | $_SESSION['inline-editor-object-' . $objectID] = $subseq['object']; |
294 | 298 | $subseq['object'] = $objectID; |
295 | 299 | |
| 300 | + // send back the JSON |
296 | 301 | return FormatJson::encode( $subseq ); |
297 | 302 | } |
298 | 303 | |
— | — | @@ -300,26 +305,11 @@ |
301 | 306 | * @param $siteNotice string |
302 | 307 | */ |
303 | 308 | public function siteNoticeBefore( &$siteNotice ) { |
304 | | - $siteNotice = $this->renderEditBox() . $this->renderEditModes(); |
| 309 | + $siteNotice = $this->renderEditBox(); |
305 | 310 | return false; |
306 | 311 | } |
307 | 312 | |
308 | 313 | /** |
309 | | - * Add an edit mode to the list. |
310 | | - * @param $name string Name to be used in id-fields |
311 | | - * @param $caption string Name to be displayed |
312 | | - * @param $description string Description to be displayed when the mode is selected (*escaped* HTML only!) |
313 | | - */ |
314 | | - public function addEditMode( $name, $caption, $description ) { |
315 | | - $this->editModes[$name] = array( |
316 | | - 'radioid' => 'radio-' . $name, |
317 | | - 'descriptionid' => 'description-' . $name, |
318 | | - 'caption' => $caption, |
319 | | - 'description' => $description |
320 | | - ); |
321 | | - } |
322 | | - |
323 | | - /** |
324 | 314 | * Generates "Edit box" (the first one) |
325 | 315 | * This looks like this: |
326 | 316 | * <div class="editbox"> |
— | — | @@ -335,7 +325,9 @@ |
336 | 326 | * inline-editor-editbox-publish-notice |
337 | 327 | * <div class="terms">inline-editor-editbox-publish-terms</div> |
338 | 328 | * </div> |
339 | | - * <a id="publish">inline-editor-editbox-publish-caption</a></div> |
| 329 | + * <a id="publish">inline-editor-editbox-publish-caption</a> |
| 330 | + * </div> |
| 331 | + * |
340 | 332 | * @return string HTML |
341 | 333 | */ |
342 | 334 | private function renderEditBox() { |
— | — | @@ -369,68 +361,9 @@ |
370 | 362 | } |
371 | 363 | |
372 | 364 | /** |
373 | | - * Generates "Edit mode" box (the second one) |
374 | | - * This looks like this: |
375 | | - * <div class="editmode"> |
376 | | - * <div class="header"> |
377 | | - * <div class="radio title">Edit mode: <!-- inline-editor-editmodes-caption --></div> |
378 | | - * <div class="radio"><!-- radio button + label --></div> |
379 | | - * <div class="radio"><!-- radio button + label --></div> |
380 | | - * <!-- for every edit mode one button --> |
381 | | - * <!-- and finally undo and redo buttons (with class 'button') --> |
382 | | - * </div> |
383 | | - * <div class="descriptionOuter"> |
384 | | - * <div class="descriptionInner" id="description-text"> |
385 | | - * <!-- for every edit mode a description --> |
386 | | - * </div> |
387 | | - * </div> |
388 | | - * @return string HTML |
389 | | - */ |
390 | | - private function renderEditModes() { |
391 | | - if ( !isset( $this->editModes ) ) return ''; |
392 | | - |
393 | | - $header = Html::rawElement( 'div', array( 'class' => 'radio title' ), |
394 | | - wfMsgExt( 'inline-editor-editmodes-caption', 'parseinline' ) ); |
395 | | - |
396 | | - $descriptions = ''; |
397 | | - $first = true; |
398 | | - foreach ( $this->editModes as $editmode ) { |
399 | | - $inputOptions = array( 'id' => $editmode['radioid'], 'class' => 'optionMode' ); |
400 | | - if ( $first ) { |
401 | | - $inputOptions['checked'] = 'checked'; |
402 | | - $first = false; |
403 | | - } |
404 | | - $input = Html::input( 'optionMode', '', 'radio', $inputOptions ); |
405 | | - $label = Html::rawElement( 'label', array( 'for' => $editmode['radioid'] ), $editmode['caption'] ); |
406 | | - |
407 | | - $header .= Html::rawElement( 'div', array( 'class' => 'radio' ), $input . $label ); |
408 | | - |
409 | | - $descriptions .= Html::rawElement( 'div', array( 'class' => 'descriptionInner', 'id' => $editmode['descriptionid'] ), |
410 | | - $editmode['description'] ); |
411 | | - } |
412 | | - |
413 | | - $header .= Html::rawElement( 'div', array( 'class' => 'button' ), |
414 | | - Html::rawElement( 'a', array( 'id' => 'redo', 'href' => '#' ), |
415 | | - wfMsgExt( 'inline-editor-editmodes-redo', 'parseinline' ) ) |
416 | | - ); |
417 | | - $header .= Html::rawElement( 'div', array( 'class' => 'button' ), |
418 | | - Html::rawElement( 'a', array( 'id' => 'undo', 'href' => '#' ), |
419 | | - wfMsgExt( 'inline-editor-editmodes-undo', 'parseinline' ) ) |
420 | | - ); |
421 | | - $header .= Html::rawElement( 'div', array( 'class' => 'button' ), |
422 | | - Html::rawElement( 'div', array( 'id' => 'editCounter', 'href' => '#' ), '#0' ) |
423 | | - ); |
424 | | - |
425 | | - return Html::rawElement( 'div', array( 'class' => 'editmode' ), |
426 | | - Html::rawElement( 'div', array( 'class' => 'header' ), $header ) |
427 | | - . Html::rawElement( 'div', array( 'class' => 'descriptionOuter' ), $descriptions ) |
428 | | - ); |
429 | | - } |
430 | | - |
431 | | - /** |
432 | 365 | * Make sure the entire page rerenders when rendering a reference. |
433 | 366 | * |
434 | | - * This should be moved over to the Cite extension, and something like this should |
| 367 | + * @todo: FIXME: This should be moved over to the Cite extension, and something like this should |
435 | 368 | * be included in other extensions as well. In the future, something smarter should be |
436 | 369 | * implemented, to be able to only rerender the dependencies and not the entire page. |
437 | 370 | * |
Index: trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.i18n.php |
— | — | @@ -1,36 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension TemplateEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'template-editor-desc' => 'Adds the "Templates" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'template-editor-editmode-caption' => "Templates", |
19 | | - 'template-editor-editmode-description' => "Templates are used to show the same thing on multiple pages. |
20 | | -To fully understand templates, you should read documentation found online. |
21 | | - |
22 | | -[http://www.mediawiki.org/wiki/Help:Templates More information].", |
23 | | -); |
24 | | - |
25 | | - |
26 | | -/** Dutch / Nederlands |
27 | | - * @author Jan Paul Posma |
28 | | - */ |
29 | | -$messages['nl'] = array( |
30 | | - 'template-editor-desc' => 'Voegt de "Sjablonen" optie toe aan InlineEditor', |
31 | | - |
32 | | - 'template-editor-editmode-caption' => "Sjablonen", |
33 | | - 'template-editor-editmode-description' => "Sjablonen worden gebruikt om hetzelfde te tonen op meerdere pagina's. |
34 | | -Om sjablonen goed te begrijpen, is het aan te raden er over te lezen. |
35 | | - |
36 | | -[http://nl.wikipedia.org/wiki/Help:Gebruik_van_sjablonen More information].", |
37 | | -); |
Index: trunk/extensions/InlineEditor/TemplateEditor/jquery.inlineEditor.editors.templateEditor.js |
— | — | @@ -1,30 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the TemplateEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.templateEditor = { |
6 | | - |
7 | | -enable: function() { |
8 | | - // do what we also do when reloading the page |
9 | | - $.inlineEditor.editors.templateEditor.reload(); |
10 | | - |
11 | | - // add the identifying class to #editContent |
12 | | - $( '#editContent' ).addClass( 'templateEditor' ); |
13 | | -}, |
14 | | - |
15 | | -reload: function() { |
16 | | - // make templates clickable |
17 | | - $( '.templateEditorElement' ).click( $.inlineEditor.basicEditor.click ); |
18 | | -}, |
19 | | - |
20 | | -disable: function() { |
21 | | - // remove the click event from the templates |
22 | | - $( '.templateEditorElement' ).unbind( 'click' ); |
23 | | - |
24 | | - // remove the identifying class from #editContent |
25 | | - $( '#editContent' ).removeClass( 'templateEditor' ); |
26 | | - |
27 | | - // cancel all open editors |
28 | | - $.inlineEditor.basicEditor.cancelAll(); |
29 | | -} |
30 | | - |
31 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.css |
— | — | @@ -1,41 +0,0 @@ |
2 | | -.templateEditor .templateEditorElement { |
3 | | - /* soft-blue background color to highlight editable templates */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | -} |
10 | | - |
11 | | -.templateEditor .sentenceEditorElement.edited, |
12 | | -.templateEditor .listEditorElement.edited, |
13 | | -.templateEditor .referenceEditorElement.edited, |
14 | | -.templateEditor .mediaEditorElement.edited, |
15 | | -.templateEditor .templateEditorElement.edited { |
16 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
17 | | - background-color: #F9F2A7; |
18 | | -} |
19 | | - |
20 | | -.templateEditor .templateEditorElement:hover { |
21 | | - /* indicate the template to be edited with a darker color */ |
22 | | - background-color: #a7d7f9; |
23 | | -} |
24 | | - |
25 | | -.templateEditor .templateEditorElement.notEditing * { |
26 | | - /* make sure all the child elements inherit the background color */ |
27 | | - background-color: inherit !important; |
28 | | -} |
29 | | - |
30 | | -.templateEditor .editing { |
31 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
32 | | - padding: 0px; |
33 | | - margin: 0px; |
34 | | - |
35 | | - /* reset the cursor when editing */ |
36 | | - cursor: auto; |
37 | | -} |
38 | | - |
39 | | -.templateEditor .lastEdit { |
40 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
41 | | - background-color: #f9c9a7; |
42 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'TemplateEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#TemplateEditor', |
28 | | - 'descriptionmsg' => 'template-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,7 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'TemplateEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'TemplateEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['TemplateEditor'] = $dir . 'TemplateEditor.i18n.php'; |
Index: trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php |
— | — | @@ -18,29 +18,9 @@ |
19 | 19 | foreach ( $matches[0] as $match ) { |
20 | 20 | $start = $match[1]; |
21 | 21 | $end = $start + strlen( $match[0] ); |
22 | | - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'templateEditorElement templateEditorElementNotEditing', false ) ); |
| 22 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'templateEditorElement', true, false ) ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | return true; |
26 | 26 | } |
27 | | - |
28 | | - /** |
29 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
30 | | - * @param $editor InlineEditor |
31 | | - * @param $output OutputPage |
32 | | - */ |
33 | | - public static function defineEditors( &$editor, &$output ) { |
34 | | - global $wgExtensionAssetsPath; |
35 | | - |
36 | | - $editor->addEditMode( |
37 | | - 'templateEditor', |
38 | | - wfMsgExt( 'template-editor-editmode-caption', 'parseinline' ), |
39 | | - wfMsgExt( 'template-editor-editmode-description', 'parseinline' ) |
40 | | - ); |
41 | | - |
42 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/TemplateEditor/TemplateEditor.css?0" ); |
43 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/TemplateEditor/jquery.inlineEditor.editors.templateEditor.js?0" ); |
44 | | - |
45 | | - return true; |
46 | | - } |
47 | 27 | } |
Index: trunk/extensions/InlineEditor/ListEditor/ListEditor.i18n.php |
— | — | @@ -1,71 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension ListEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'list-editor-desc' => 'Adds the "Lists" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'list-editor-editmode-caption' => "Lists", |
19 | | - 'list-editor-editmode-description' => "Lists work like shown below. |
20 | | -You can also make a new list by going in any other mode, like the '''Sentences''' mode, and add a list like the one below. |
21 | | - |
22 | | -{| width=\"100%\" style=\"background-color: inherit\" |
23 | | -! Code |
24 | | -! Output |
25 | | -|- |
26 | | -| |
27 | | -<code><nowiki>* Lists are easy to do:</nowiki></code><br/> |
28 | | -<code><nowiki>** start every line</nowiki></code><br/> |
29 | | -<code><nowiki>* with a star</nowiki></code><br/> |
30 | | -<code><nowiki>** more stars mean</nowiki></code><br/> |
31 | | -<code><nowiki>*** deeper levels</nowiki></code><br/> |
32 | | -| |
33 | | -* Lists are easy to do: |
34 | | -** start every line |
35 | | -* with a star |
36 | | -** more stars mean |
37 | | -*** deeper levels |
38 | | -|} |
39 | | - |
40 | | -[http://meta.wikimedia.org/wiki/Help:List More information]", |
41 | | -); |
42 | | - |
43 | | -/** Dutch / Nederlands |
44 | | - * @author Jan Paul Posma |
45 | | - */ |
46 | | -$messages['nl'] = array( |
47 | | - 'list-editor-desc' => 'Voegt de "Lijsten" optie toe aan InlineEditor', |
48 | | - |
49 | | - 'list-editor-editmode-caption' => "Lijsten", |
50 | | - 'list-editor-editmode-description' => "Lijsten werken zoals hieronder aangegeven. |
51 | | -Je kunt ook een nieuwe lijst maken door voor een andere optie te kiezen, zoals '''Zinnen''', en dan een lijst zoals die hieronder toe te voegen. |
52 | | - |
53 | | -{| width=\"100%\" style=\"background-color: inherit\" |
54 | | -! Code |
55 | | -! Output |
56 | | -|- |
57 | | -| |
58 | | -<code><nowiki>* Lijsten zijn heel makkelijk:</nowiki></code><br/> |
59 | | -<code><nowiki>** begin elke lijn</nowiki></code><br/> |
60 | | -<code><nowiki>* met een ster</nowiki></code><br/> |
61 | | -<code><nowiki>** meer sterren betekent</nowiki></code><br/> |
62 | | -<code><nowiki>*** diepere niveaus</nowiki></code><br/> |
63 | | -| |
64 | | -* Lijsten zijn heel makkelijk: |
65 | | -** begin elke lijn |
66 | | -* met een ster |
67 | | -** meer sterren betekent |
68 | | -*** diepere niveaus |
69 | | -|} |
70 | | - |
71 | | -[http://nl.wikibooks.org/wiki/Inleiding_MediaWiki/Bewerken/Lijsten Meer informatie]", |
72 | | -); |
Index: trunk/extensions/InlineEditor/ListEditor/jquery.inlineEditor.editors.listEditor.js |
— | — | @@ -1,30 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the ListEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.listEditor = { |
6 | | - |
7 | | -enable: function() { |
8 | | - // do what we also do when reloading the page |
9 | | - $.inlineEditor.editors.listEditor.reload(); |
10 | | - |
11 | | - // add the identifying class to #editContent |
12 | | - $( '#editContent' ).addClass( 'listEditor' ); |
13 | | -}, |
14 | | - |
15 | | -reload: function() { |
16 | | - // make lists clickable |
17 | | - $( '.listEditorElement' ).click( $.inlineEditor.basicEditor.click ); |
18 | | -}, |
19 | | - |
20 | | -disable: function() { |
21 | | - // remove the click event from the lists |
22 | | - $( '.listEditorElement' ).unbind( 'click' ); |
23 | | - |
24 | | - // remove the identifying class from #editContent |
25 | | - $( '#editContent' ).removeClass( 'listEditor' ); |
26 | | - |
27 | | - // cancel all open editors |
28 | | - $.inlineEditor.basicEditor.cancelAll(); |
29 | | -} |
30 | | - |
31 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ListEditor/ListEditor.css |
— | — | @@ -1,32 +0,0 @@ |
2 | | -.listEditor .listEditorElement { |
3 | | - /* soft-blue background color to highlight editable lists */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | -} |
10 | | - |
11 | | -.listEditor .edited { |
12 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
13 | | - background-color: #F9F2A7; |
14 | | -} |
15 | | - |
16 | | -.listEditor .listEditorElement:hover { |
17 | | - /* indicate the list to be edited with a darker color */ |
18 | | - background-color: #a7d7f9; |
19 | | -} |
20 | | - |
21 | | -.listEditor .editing { |
22 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
23 | | - padding: 0px; |
24 | | - margin: 0px; |
25 | | - |
26 | | - /* reset the cursor when editing */ |
27 | | - cursor: auto; |
28 | | -} |
29 | | - |
30 | | -.listEditor .lastEdit { |
31 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
32 | | - background-color: #f9c9a7; |
33 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ListEditor/ListEditor.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * |
11 | 11 | * Usage: Include the following line in your LocalSettings.php |
12 | 12 | * require_once( "$IP/extensions/InlineEditor/ListEditor/ListEditor.php" ); |
13 | | - * |
| 13 | + * |
14 | 14 | * @author Jan Paul Posma <jp.posma@gmail.com> |
15 | 15 | * @license GPL v2 or later |
16 | 16 | * @version 0.0.0 |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'ListEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#ListEditor', |
28 | | - 'descriptionmsg' => 'list-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,7 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'ListEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'ListEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['ListEditor'] = $dir . 'ListEditor.i18n.php'; |
Index: trunk/extensions/InlineEditor/ListEditor/ListEditor.class.php |
— | — | @@ -22,29 +22,9 @@ |
23 | 23 | // do not include the trailing newline |
24 | 24 | if ( substr( $match[0], -1 ) == "\n" ) $end--; |
25 | 25 | |
26 | | - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'listEditorElement', false ) ); |
| 26 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'listEditorElement', true, false ) ); |
27 | 27 | } |
28 | 28 | |
29 | 29 | return true; |
30 | 30 | } |
31 | | - |
32 | | - /** |
33 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
34 | | - * @param $editor InlineEditor |
35 | | - * @param $output OutputPage |
36 | | - */ |
37 | | - public static function defineEditors( &$editor, &$output ) { |
38 | | - global $wgExtensionAssetsPath; |
39 | | - |
40 | | - $editor->addEditMode( |
41 | | - 'listEditor', |
42 | | - wfMsgExt( 'list-editor-editmode-caption', 'parseinline' ), |
43 | | - wfMsgExt( 'list-editor-editmode-description', 'parseinline' ) |
44 | | - ); |
45 | | - |
46 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/ListEditor/ListEditor.css?0" ); |
47 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/ListEditor/jquery.inlineEditor.editors.listEditor.js?0" ); |
48 | | - |
49 | | - return true; |
50 | | - } |
51 | 31 | } |
Index: trunk/extensions/InlineEditor/InlineEditorText.class.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | private $article; /// < article object for parsing |
20 | 20 | private $markings; /// < array of InlineEditorMarking objects |
21 | 21 | private $previous; /// < array of InlineEditorMarking objects before this edit |
22 | | - private $editedPiece; /// < InlineEditorMarking object to describe the range where edits occured |
| 22 | + private $editedPiece; /// < InlineEditorMarking object to describe the range where edits occurred |
23 | 23 | private $changedNode; /// < Node which should be rendered when doing a partial rendering |
24 | 24 | private $root; /// < Root of the tree where the markings are arranged in |
25 | 25 | |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | * Before and after partial rendering hooks are called (InlineEditorPartialBeforeParse and |
52 | 52 | * InlineEditorPartialAfterParse), to have the ability to terminate in the case something in |
53 | 53 | * the partial rendering has a dependency elsewhere on the page. In this case, the entire page |
54 | | - * is rerendered. |
| 54 | + * is re-rendered. |
55 | 55 | * |
56 | 56 | * @return array An array with the id of the object to replace, and the html to replace it with |
57 | 57 | */ |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | | - * Add a marking to the list of markings. To be called by the different edit modes. |
| 102 | + * Add a marking to the list of markings. To be called by the different edit extensions. |
103 | 103 | * @param $marking InlineEditorMarking |
104 | 104 | */ |
105 | 105 | public function addMarking( InlineEditorMarking $marking ) { |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | } |
146 | 146 | |
147 | 147 | // add 'edited' and 'lastEdit' classes to the edited marking |
148 | | - // 'edited' will stay (yellow highlight), 'lastEdit' will vanish after an animation |
| 148 | + // 'edited' will stay (yellow highlight), 'lastEdit' will be removed quickly |
149 | 149 | $editMarking->addClasses( array( 'edited', 'lastEdit' ) ); |
150 | 150 | |
151 | 151 | // store a copy of the edited marking to denote the range of changed wikitext |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | unset( $this->markings ); |
158 | 158 | |
159 | 159 | // remove all 'lastEdit' classes so that when copying previous markings to new markings, |
160 | | - // no leftover animations will be present |
| 160 | + // no leftover classes are there |
161 | 161 | foreach( $this->previous as $marking ) { |
162 | 162 | $marking->removeClass( 'lastEdit' ); |
163 | 163 | } |
— | — | @@ -225,16 +225,16 @@ |
226 | 226 | * depending on the sorting conditions, which are start position (asc), length (desc) |
227 | 227 | * and class names (asc). |
228 | 228 | * Whenever a match is found, the previous marking is used to preserve the ids already |
229 | | - * present at the client so we don't have to rerender this piece. Whenever a mismatch |
| 229 | + * present at the client so we don't have to re-render this piece. Whenever a mismatch |
230 | 230 | * occurs, $this->editedPiece grows to include the mismatch, because it needs to be |
231 | | - * rerendered. |
| 231 | + * re-rendered. |
232 | 232 | */ |
233 | 233 | protected function matchPreviousMarkings() { |
234 | 234 | // abort if there is nothing to match |
235 | 235 | if( empty( $this->previous ) ) return; |
236 | 236 | |
237 | | - // sort the previous markings, while *rekeying* to natural numbers (0, 1, 2, ...) |
238 | | - // this is nessicary to be able to run through the array using an integer pointer |
| 237 | + // sort the previous markings, while *re-keying* to natural numbers (0, 1, 2, ...) |
| 238 | + // this is necessary to be able to run through the array using an integer pointer |
239 | 239 | usort( $this->previous, 'InlineEditorText::sortByStartAndLength' ); |
240 | 240 | |
241 | 241 | // point to the start of the previous markings list |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | $root = new InlineEditorRoot( $this->wikiOriginal ); |
301 | 301 | |
302 | 302 | // $workingNode is the node we're trying to add children to |
303 | | - // init it to the root node |
| 303 | + // initialise it to the root node |
304 | 304 | $workingNode = $root; |
305 | 305 | |
306 | 306 | foreach( $markingsSorted as $marking ) { |
— | — | @@ -372,6 +372,7 @@ |
373 | 373 | * Sort function which sorts markings - in this particular order - on: |
374 | 374 | * - start position (asc) |
375 | 375 | * - length (desc) |
| 376 | + * - level (desc) |
376 | 377 | * - class name (asc) |
377 | 378 | * @param $a InlineEditorMarking |
378 | 379 | * @param $b InlineEditorMarking |
— | — | @@ -380,11 +381,11 @@ |
381 | 382 | private static function sortByStartAndLength( $a, $b ) { |
382 | 383 | if( $a->getStart() == $b->getStart() ) { |
383 | 384 | if( $a->getLength() == $b->getLength() ) { |
384 | | - if( $a->getPriority() == $b->getPriority() ) { |
| 385 | + if( $a->getLevel() == $b->getLevel() ) { |
385 | 386 | return strcmp( $a->getClass(), $b->getClass() ); |
386 | 387 | } |
387 | 388 | else { |
388 | | - return ( $a->getPriority() > $b->getPriority() ? -1 : 1 ); |
| 389 | + return ( $a->getLevel() > $b->getLevel() ? -1 : 1 ); |
389 | 390 | } |
390 | 391 | } |
391 | 392 | else { |
— | — | @@ -399,7 +400,7 @@ |
400 | 401 | /** |
401 | 402 | * Serialize by doing a normal serialization of the original wikitext, the markings |
402 | 403 | * and the unique identifier to guarantee unique ids across the session. The serialization |
403 | | - * is base64 encoded to make sure it won't be fragged up by javascript. |
| 404 | + * is base64 encoded to make sure it won't be screwed up by javascript. |
404 | 405 | */ |
405 | 406 | public function serialize() { |
406 | 407 | return base64_encode( serialize( array( |
Index: trunk/extensions/InlineEditor/InlineEditorNode.class.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * @param $marking InlineEditorMarking Marking to wrap in the tree |
14 | 14 | */ |
15 | 15 | public function __construct( &$wiki, InlineEditorMarking $marking ) { |
16 | | - parent::__construct( $wiki ); |
| 16 | + parent::__construct( &$wiki ); |
17 | 17 | $this->marking = $marking; |
18 | 18 | } |
19 | 19 | |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | public function getParent() { |
57 | 57 | return $this->parent; |
58 | 58 | } |
59 | | - |
| 59 | + |
60 | 60 | /** |
61 | 61 | * Render the start tag by calling the corresponding marking. |
62 | 62 | * @return string HTML |
Index: trunk/extensions/InlineEditor/InlineEditorPiece.class.php |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * InlineEditorPiece is a base (abstract) class for everything that describes a start- |
5 | | - * and endpoint, and provides some basic functionality. Subclasses have to implement |
| 4 | + * InlineEditorPiece is a base (abstract) class for everything that describes a start |
| 5 | + * and end point, and provides some basic functionality. Subclasses have to implement |
6 | 6 | * getStart() and getEnd(), and then things like getLength(), equals(), etc. are provided |
7 | | - * as a convenience. |
| 7 | + * for your convenience. |
8 | 8 | */ |
9 | 9 | abstract class InlineEditorPiece { |
10 | 10 | /** |
Index: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.i18n.php |
— | — | @@ -1,39 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension MediaEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'media-editor-desc' => 'Adds the "Media" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'media-editor-editmode-caption' => "Media", |
19 | | - 'media-editor-editmode-description' => "You can edit media like images, video and sound using this mode. |
20 | | -Sometimes templates are used to display images, in which case you have to use the '''Template''' mode. |
21 | | - |
22 | | -:<code><nowiki>[[File:Example.jpg|thumb|An example file]]</nowiki></code> |
23 | | - |
24 | | -[http://en.wikipedia.org/wiki/Help:Files More information].", |
25 | | -); |
26 | | - |
27 | | -/** Dutch / Nederlands |
28 | | - * @author Jan Paul Posma |
29 | | - */ |
30 | | -$messages['nl'] = array( |
31 | | - 'media-editor-desc' => 'Voegt de "Media" optie toe aan InlineEditor', |
32 | | - |
33 | | - 'media-editor-editmode-caption' => "Media", |
34 | | - 'media-editor-editmode-description' => "Met deze optie kun je media bewerken, zoals afbeeldingen, video en geluid. |
35 | | -Soms worden sjablonen gebruikt om afbeeldingen weer te geven, gebruik dan de '''Sjablonen''' optie. |
36 | | - |
37 | | -:<code><nowiki>[[File:Voorbeeld.jpg|thumb|Voorbeeldbestand]]</nowiki></code> |
38 | | - |
39 | | -[http://nl.wikipedia.org/wiki/Wikipedia:Bestanden Meer informatie].", |
40 | | -); |
Index: trunk/extensions/InlineEditor/MediaEditor/jquery.inlineEditor.editors.mediaEditor.js |
— | — | @@ -1,30 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the MediaEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.mediaEditor = { |
6 | | - |
7 | | -enable: function() { |
8 | | - // do what we also do when reloading the page |
9 | | - $.inlineEditor.editors.mediaEditor.reload(); |
10 | | - |
11 | | - // add the identifying class to #editContent |
12 | | - $( '#editContent' ).addClass( 'mediaEditor' ); |
13 | | -}, |
14 | | - |
15 | | -reload: function() { |
16 | | - // make media clickable |
17 | | - $( '.mediaEditorElement' ).click( $.inlineEditor.basicEditor.click ); |
18 | | -}, |
19 | | - |
20 | | -disable: function() { |
21 | | - // remove the click event from the media |
22 | | - $( '.mediaEditorElement' ).unbind( 'click' ); |
23 | | - |
24 | | - // remove the identifying class from #editContent |
25 | | - $( '#editContent' ).removeClass( 'mediaEditor' ); |
26 | | - |
27 | | - // cancel all open editors |
28 | | - $.inlineEditor.basicEditor.cancelAll(); |
29 | | -} |
30 | | - |
31 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.css |
— | — | @@ -1,37 +0,0 @@ |
2 | | -.mediaEditor .mediaEditorElement { |
3 | | - /* soft-blue background color to highlight editable media */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | -} |
10 | | - |
11 | | -.mediaEditor .edited { |
12 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
13 | | - background-color: #F9F2A7; |
14 | | -} |
15 | | - |
16 | | -.mediaEditor .mediaEditorElement:hover { |
17 | | - /* indicate the media to be edited with a darker color */ |
18 | | - background-color: #a7d7f9; |
19 | | -} |
20 | | - |
21 | | -.mediaEditor .editing { |
22 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
23 | | - padding: 0px; |
24 | | - margin: 0px; |
25 | | - |
26 | | - /* reset the cursor when editing */ |
27 | | - cursor: auto; |
28 | | -} |
29 | | - |
30 | | -.mediaEditor .lastEdit { |
31 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
32 | | - background-color: #f9c9a7; |
33 | | -} |
34 | | - |
35 | | -.mediaEditor .thumb, |
36 | | -.mediaEditor .thumbinner { |
37 | | - background-color: inherit !important; |
38 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php |
— | — | @@ -31,30 +31,10 @@ |
32 | 32 | if ( $namespace == NS_FILE ) { |
33 | 33 | $start = $match[1]; |
34 | 34 | $end = $start + strlen( $match[0] ); |
35 | | - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'mediaEditorElement', false ) ); |
| 35 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'mediaEditorElement', true, false ) ); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | return true; |
40 | 40 | } |
41 | | - |
42 | | - /** |
43 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
44 | | - * @param $editor InlineEditor |
45 | | - * @param $output OutputPage |
46 | | - */ |
47 | | - public static function defineEditors( &$editor, &$output ) { |
48 | | - global $wgExtensionAssetsPath; |
49 | | - |
50 | | - $editor->addEditMode( |
51 | | - 'mediaEditor', |
52 | | - wfMsgExt( 'media-editor-editmode-caption', 'parseinline' ), |
53 | | - wfMsgExt( 'media-editor-editmode-description', 'parseinline' ) |
54 | | - ); |
55 | | - |
56 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/MediaEditor/MediaEditor.css?0" ); |
57 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/MediaEditor/jquery.inlineEditor.editors.mediaEditor.js?0" ); |
58 | | - |
59 | | - return true; |
60 | | - } |
61 | 41 | } |
Index: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'MediaEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#MediaEditor', |
28 | | - 'descriptionmsg' => 'media-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,7 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'MediaEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'MediaEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['MediaEditor'] = $dir . 'MediaEditor.i18n.php'; |
Index: trunk/extensions/InlineEditor/InlineEditorMarking.class.php |
— | — | @@ -5,41 +5,40 @@ |
6 | 6 | * and whether or not it has been matched before. |
7 | 7 | */ |
8 | 8 | class InlineEditorMarking extends InlineEditorPiece { |
9 | | - const defaultClasses = 'notEditing'; // default classes; unfortunately we cannot use an array here |
| 9 | + const defaultClasses = 'inlineEditorElement notEditing'; // default classes; unfortunately we cannot use an array here |
| 10 | + const autoClasses = 'block inline bar nobar'; // automatically added classes which shouldn't be added by hand |
10 | 11 | protected static $lastId = 0; /// < counter which is used to generate unique ids |
11 | 12 | |
12 | 13 | protected $start; /// < start position of the marking in the wikitext |
13 | 14 | protected $end; /// < end position of the marking in the wikitext |
14 | | - protected $classes; /// < class(es) attached to the marking, usually identifies the edit mode |
15 | | - protected $inline; /// < whether or not the marking is inline or not |
| 15 | + protected $classes; /// < class(es) attached to the marking which identifies the type |
| 16 | + protected $block; /// < whether the tag should be added as a block or inline |
| 17 | + protected $bar; /// < whether the text should carry a bar at the left, or be fully selectable |
16 | 18 | protected $id; /// < id in the original text; this will be unique even when calculating new ids! |
17 | 19 | protected $matched; /// < bool whether or not this marking has been matched with a previous marking (default: true) |
18 | | - protected $priority; |
| 20 | + protected $level; /// < nesting level, which is used to sort consistently when two markings are of same length |
19 | 21 | |
20 | | - public function setPriority( $value ) { |
21 | | - $this->priority = $value; |
22 | | - } |
23 | | - |
24 | | - public function getPriority() { |
25 | | - return $this->priority; |
26 | | - } |
27 | | - |
28 | 22 | /** |
29 | 23 | * @param $start int Start of the marking, offset in number of characters from the begin of the wikitext |
30 | 24 | * @param $end int End of the marking, offset in number of characters from the begin of the wikitext |
31 | 25 | * @param $classes mixed Class(es) the marking should be labeled with, can be either a string or an array of strings |
32 | | - * @param $inline bool Whether the marking is inline or not |
| 26 | + * @param $block bool Whether the tag should be added as a block or inline |
| 27 | + * @param $bar bool Whether the text should carry a bar at the left, or be fully selectable |
| 28 | + * @param $level int Nesting level, which is used to sort consistently when two markings are of same length, default: 0 |
33 | 29 | */ |
34 | | - function __construct( $start, $end, $classes, $inline ) { |
| 30 | + function __construct( $start, $end, $classes, $block, $bar, $level = 0 ) { |
35 | 31 | $this->start = $start; |
36 | 32 | $this->end = $end; |
37 | | - $this->inline = $inline; |
| 33 | + $this->block = $block; |
| 34 | + $this->bar = $bar; |
| 35 | + $this->level = $level; |
| 36 | + |
| 37 | + $this->matched = true; |
38 | 38 | $this->id = self::uniqueId(); |
39 | | - $this->matched = true; |
40 | 39 | |
41 | 40 | $this->classes = array(); |
42 | 41 | $this->addClasses( $classes ); |
43 | | - $this->priority = 0; |
| 42 | + |
44 | 43 | } |
45 | 44 | |
46 | 45 | /** |
— | — | @@ -126,6 +125,9 @@ |
127 | 126 | // exclude the default classes that are always included |
128 | 127 | $classes = array_diff( $classes, self::getDefaultClassesArray() ); |
129 | 128 | |
| 129 | + // also exclude classes that are automatically included |
| 130 | + $classes = array_diff( $classes, self::getAutoClassesArray() ); |
| 131 | + |
130 | 132 | // merge with the current classes and remove duplicates |
131 | 133 | $this->classes = array_unique( array_merge( $this->classes, $classes ) ); |
132 | 134 | } |
— | — | @@ -149,6 +151,9 @@ |
150 | 152 | // exclude the default classes that are always included |
151 | 153 | $classes = array_diff( $classes, self::getDefaultClassesArray() ); |
152 | 154 | |
| 155 | + // also exclude classes that are automatically included |
| 156 | + $classes = array_diff( $classes, self::getAutoClassesArray() ); |
| 157 | + |
153 | 158 | // save the difference between the existing classes and the classes we're removing |
154 | 159 | $this->classes = array_diff( $this->classes, $classes ); |
155 | 160 | } |
— | — | @@ -171,6 +176,22 @@ |
172 | 177 | } |
173 | 178 | |
174 | 179 | /** |
| 180 | + * Get the nesting level, which is used to sort consistently when two markings are of same length. |
| 181 | + * @param $value int |
| 182 | + */ |
| 183 | + public function getLevel() { |
| 184 | + return $this->level; |
| 185 | + } |
| 186 | + |
| 187 | + /** |
| 188 | + * Set the nesting level, which is used to sort consistently when two markings are of same length. |
| 189 | + * @param $value int |
| 190 | + */ |
| 191 | + public function setLevel( $value ) { |
| 192 | + $this->level = $value; |
| 193 | + } |
| 194 | + |
| 195 | + /** |
175 | 196 | * Overrides InlineEditorPiece to be able to check for equality between markings, |
176 | 197 | * where also classes are compared. This also adds the ability to ignore certain |
177 | 198 | * classes when comparing (such as classes for what has been edited, etc.) |
— | — | @@ -192,8 +213,8 @@ |
193 | 214 | } |
194 | 215 | |
195 | 216 | /** |
196 | | - * Render the open tag with classes and id. Depending on $this->inline there will be |
197 | | - * a newline after the tag, or an extra 'inline' class. |
| 217 | + * Render the open tag with classes and id. Depending on $this->block there will be |
| 218 | + * a newline after the tag, or not. |
198 | 219 | * @return string HTML |
199 | 220 | */ |
200 | 221 | public function renderStartTag() { |
— | — | @@ -202,7 +223,7 @@ |
203 | 224 | } |
204 | 225 | |
205 | 226 | /** |
206 | | - * Render the close tag (</div>) with an extra newline before it if !$this->inline. |
| 227 | + * Render the close tag (</div>) with an extra newline before it if $this->block. |
207 | 228 | * @return string HTML |
208 | 229 | */ |
209 | 230 | public function renderEndTag() { |
— | — | @@ -211,19 +232,22 @@ |
212 | 233 | |
213 | 234 | /** |
214 | 235 | * Get the full class string to render. Includes the default classes |
215 | | - * for more convenient CSS, and depending on $this->inline an extra 'inline' class. |
| 236 | + * for more convenient CSS, and depending on the class values |
| 237 | + * additionally 'block' or 'inline', plus 'bar' or 'nobar'. |
216 | 238 | * @return string Space separated classes |
217 | 239 | */ |
218 | 240 | protected function getFullClass() { |
219 | | - return $this->getClass() . ' ' . self::defaultClasses . ($this->inline ? ' inline' : ''); |
| 241 | + return $this->getClass() . ' ' . self::defaultClasses |
| 242 | + . ( $this->block ? ' block' : ' inline' ) |
| 243 | + . ( $this->bar ? ' bar' : ' nobar' ); |
220 | 244 | } |
221 | 245 | |
222 | 246 | /** |
223 | | - * Get a newline or not based on $this->inline. |
224 | | - * @return string Empty string or single newline character |
| 247 | + * Get a newline when $this->block is set or else an empty string. |
| 248 | + * @return string Newline or nothing |
225 | 249 | */ |
226 | 250 | protected function getNewline() { |
227 | | - return $this->inline ? '' : "\n"; |
| 251 | + return $this->block ? "\n": ''; |
228 | 252 | } |
229 | 253 | |
230 | 254 | /** |
— | — | @@ -233,6 +257,14 @@ |
234 | 258 | protected static function getDefaultClassesArray() { |
235 | 259 | return explode( ' ', self::defaultClasses ); |
236 | 260 | } |
| 261 | + |
| 262 | + /** |
| 263 | + * Get an array version of the automatically added classes |
| 264 | + * @return array |
| 265 | + */ |
| 266 | + protected static function getAutoClassesArray() { |
| 267 | + return explode( ' ', self::autoClasses ); |
| 268 | + } |
237 | 269 | |
238 | 270 | /** |
239 | 271 | * Get a unique id by using self::$lastId and incrementing it. |
— | — | @@ -252,7 +284,7 @@ |
253 | 285 | |
254 | 286 | /** |
255 | 287 | * Set the $lastId variable in order to preserve it across requests. |
256 | | - * @param $state int State aquired by getUniqueIdState() |
| 288 | + * @param $state int State acquired by getUniqueIdState() |
257 | 289 | */ |
258 | 290 | public static function setUniqueIdState( $state ) { |
259 | 291 | if( $state > self::$lastId ) self::$lastId = $state; |
Index: trunk/extensions/InlineEditor/InlineEditor.i18n.php |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | 'inline-editor-editbox-publish-terms' => 'When you click "Publish", you agree with our copyright policy. |
24 | 24 | See $1 for more information.', |
25 | 25 | 'inline-editor-editbox-publish-caption' => 'Publish', |
26 | | - 'inline-editor-editmodes-caption' => 'Edit mode:', |
27 | 26 | 'inline-editor-redirect-browser' => 'The new editing interface is not supported by your browser.', |
28 | 27 | 'inline-editor-redirect-advanced' => "Editing this page is considered '''advanced''' use of {{SITENAME}}. |
29 | 28 | You can only use the '''full editor''' for this page.", |
— | — | @@ -30,23 +29,36 @@ |
31 | 30 | 'inline-editor-editmodes-redo' => 'Redo', |
32 | 31 | ); |
33 | 32 | |
34 | | -/** Dutch / Nederlands |
| 33 | +/** Language descriptions |
35 | 34 | * @author Jan Paul Posma |
36 | 35 | */ |
37 | | -$messages['nl'] = array( |
38 | | - 'inline-editor-desc' => 'Stelt een alternatieve editor in die makkelijker in gebruik is.', |
| 36 | +$messages['qqq'] = array( |
| 37 | + 'inline-editor-editbox-top' => 'The "edit box" should be as small as possible. It should present the most essential information, and nothing more. It should ask for nothing more but the bare minimum. I chose to include a few basic guidelines, starting with some positive reinforcement: "Awesome, you\'re editing Wikipedia!". This invites novice users to actually edit the article. After all, what they are doing is "awesome"!', |
| 38 | + 'inline-editor-editbox-changes-question' => "The line above the edit summary is chosen very carefully: \"Can you briefly describe the changes you're making?\" |
| 39 | +Asking for \"changes you ''have'' made\" looks strange when first encountering this page. |
| 40 | +Asking for \"changes you ''will be'' making\" looks strange when |
| 41 | +the changes have actually been made. Therefore, the page asks to describe |
| 42 | +\"changes you ''are'' making\", which is a continuous process, without |
| 43 | +defined start and end points.", |
| 44 | + 'inline-editor-editbox-changes-example' => "The line under the textbox suggests some things you can type into it: \"For |
| 45 | +example: 'Fixed spelling mistake', 'Corrected facts', 'Wrote a new |
| 46 | +paragraph', etc.\" These are not just possible inputs for the textfield, but |
| 47 | +possible ''actions'' when editing the page. The user is encouraged to look for |
| 48 | +mistakes, and even to write a new paragraph.", |
| 49 | + 'inline-editor-editbox-publish-notice' => 'Next to the button is a description: "When you\'re done, don\'t forget to |
| 50 | +publish the page!". This text serves two purposes. When reading from top to |
| 51 | +bottom, the user is reminded that somewhere there is a way of publishing. |
| 52 | +When users haven\'t already found this button, they will now. The second |
| 53 | +purpose is telling that anything you do is not final until the page is |
| 54 | +published. This way the user is invited to try some things out, as it will not |
| 55 | +be published before hitting the button.', |
| 56 | + 'inline-editor-editbox-publish-terms' => '', |
| 57 | + 'inline-editor-editbox-publish-caption' => 'Below the edit summary is the most important button on the page: the |
| 58 | +"Publish" button. On the original edit-page, there are some problems with the |
| 59 | +"Save" button. The first problem is the caption. "Save" can mean different |
| 60 | +things: "Will it be visible for everyone or just saved for myself?", "Will |
| 61 | +it be saved into some kind of database, waiting for approval?" "Publish" is |
| 62 | +unambiguous: it will be shown to the world. On the other hand, using the word "Publish" may have legal |
| 63 | +consequences in some countries, which should be looked into.', |
39 | 64 | |
40 | | - 'inline-editor-editbox-top' => "'''Geweldig, je bewerkt nu {{SITENAME}}!'''<br />Je kunt het artikel hieronder bewerken, door op <span class=\"highlightExample\">blauwe elementen</span> te klikken.", |
41 | | - 'inline-editor-editbox-changes-question' => "Kun je kort beschrijven wat voor veranderingen je maakt?", |
42 | | - 'inline-editor-editbox-changes-example' => 'Bijvoorbeeld: "Typfout verbeterd", "Feiten gecontroleerd", "Nieuwe paragraaf geschreven", etc.', |
43 | | - 'inline-editor-editbox-publish-notice' => "Vergeet niet de pagina te publiceren als je klaar bent!", |
44 | | - 'inline-editor-editbox-publish-terms' => 'Wanneer je op "Publiceren" klikt, ga je akkoord met de voorwaarden omtrend auteursrechten. |
45 | | -Zie $1 voor meer informatie.', |
46 | | - 'inline-editor-editbox-publish-caption' => 'Publiceren', |
47 | | - 'inline-editor-editmodes-caption' => 'Bewerkoptie:', |
48 | | - 'inline-editor-redirect-browser' => 'De nieuwe editor wordt niet ondersteund door de browser.', |
49 | | - 'inline-editor-redirect-advanced' => "Het bewerken van deze pagina wordt gezien als '''geavanceerd''' gebruik van {{SITENAME}}. |
50 | | -Je kunt alleen de '''volledige editor''' gebruiken.", |
51 | | - 'inline-editor-editmodes-undo' => 'Ongedaan maken', |
52 | | - 'inline-editor-editmodes-redo' => 'Opnieuw', |
53 | 65 | ); |
Index: trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.i18n.php |
— | — | @@ -1,39 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension ReferenceEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'reference-editor-desc' => 'Adds the "References" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'reference-editor-editmode-caption' => "References", |
19 | | - 'reference-editor-editmode-description' => "References are placed after a piece of text. |
20 | | -You can edit them in this mode, and add new references in the '''Sentences''' mode. |
21 | | - |
22 | | -:<code><nowiki>According to scientists, the Sun is pretty big. <ref>E. Miller, The Sun, (New York: Academic Press, 2005), 23-5.</ref></nowiki></code> |
23 | | - |
24 | | -[http://www.mediawiki.org/wiki/Extension:Cite/Cite.php More information].", |
25 | | -); |
26 | | - |
27 | | -/** Dutch / Nederlands |
28 | | - * @author Jan Paul Posma |
29 | | - */ |
30 | | -$messages['nl'] = array( |
31 | | - 'reference-editor-desc' => 'Voegt de "Referenties" optie toe aan InlineEditor', |
32 | | - |
33 | | - 'reference-editor-editmode-caption' => "Referenties", |
34 | | - 'reference-editor-editmode-description' => "Referenties worden na een stuk tekst geplaatst. |
35 | | -Je kunt ze bewerken met deze optie, en nieuwe toevoegen in de '''Zinnen''' optie. |
36 | | - |
37 | | -:<code><nowiki>Wetenschappers zeggen dat de zon behoorlijk groot is. <ref>E. Miller, The Sun, (New York: Academic Press, 2005), 23-5.</ref></nowiki></code> |
38 | | - |
39 | | -[http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Meer informatie].", |
40 | | -); |
Index: trunk/extensions/InlineEditor/ReferenceEditor/jquery.inlineEditor.editors.referenceEditor.js |
— | — | @@ -1,43 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the ReferenceEditor. Defines $.inlineEditor.editors.referenceEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.referenceEditor = { |
6 | | - |
7 | | -click: function( event ) { |
8 | | - // prevent clicks from reaching other elements |
9 | | - event.stopPropagation(); |
10 | | - event.preventDefault(); |
11 | | - |
12 | | - // find the element and retrieve the corresponding wikitext |
13 | | - var $field = $(this); |
14 | | - var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) ); |
15 | | - |
16 | | - $newField = $.inlineEditor.basicEditor.newField( $field, $.inlineEditor.basicEditor.click ); |
17 | | - $.inlineEditor.basicEditor.addEditBar( $newField, 600, wiki ); |
18 | | -}, |
19 | | - |
20 | | -enable: function() { |
21 | | - // do what we also do when reloading the page |
22 | | - $.inlineEditor.editors.referenceEditor.reload(); |
23 | | - |
24 | | - // add the identifying class to #editContent |
25 | | - $( '#editContent' ).addClass( 'referenceEditor' ); |
26 | | -}, |
27 | | - |
28 | | -reload: function() { |
29 | | - // make references clickable |
30 | | - $( '.referenceEditorElement' ).click( $.inlineEditor.editors.referenceEditor.click ); |
31 | | -}, |
32 | | - |
33 | | -disable: function() { |
34 | | - // remove the click event from the references |
35 | | - $( '.referenceEditorElement' ).unbind( 'click' ); |
36 | | - |
37 | | - // remove the identifying class from #editContent |
38 | | - $( '#editContent' ).removeClass( 'referenceEditor' ); |
39 | | - |
40 | | - // cancel all open editors |
41 | | - $.inlineEditor.basicEditor.cancelAll(); |
42 | | -} |
43 | | - |
44 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.css |
— | — | @@ -1,35 +0,0 @@ |
2 | | -.referenceEditor .referenceEditorElement { |
3 | | - /* soft-blue background color to highlight editable references */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | - |
10 | | - /* add a lot of padding to make them stand out */ |
11 | | - padding: 0.5em; |
12 | | -} |
13 | | - |
14 | | -.referenceEditor .edited { |
15 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
16 | | - background-color: #F9F2A7; |
17 | | -} |
18 | | - |
19 | | -.referenceEditor .referenceEditorElement:hover { |
20 | | - /* indicate the reference to be edited with a darker color */ |
21 | | - background-color: #a7d7f9; |
22 | | -} |
23 | | - |
24 | | -.referenceEditor .editing { |
25 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
26 | | - padding: 0px; |
27 | | - margin: 0px; |
28 | | - |
29 | | - /* reset the cursor when editing */ |
30 | | - cursor: auto; |
31 | | -} |
32 | | - |
33 | | -.referenceEditor .lastEdit { |
34 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
35 | | - background-color: #f9c9a7; |
36 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.class.php |
— | — | @@ -18,29 +18,9 @@ |
19 | 19 | foreach ( $matches[0] as $match ) { |
20 | 20 | $start = $match[1]; |
21 | 21 | $end = $start + strlen( $match[0] ); |
22 | | - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'referenceEditorElement', true ) ); |
| 22 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'referenceEditorElement', false, false ) ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | return true; |
26 | 26 | } |
27 | | - |
28 | | - /** |
29 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
30 | | - * @param $editor InlineEditor |
31 | | - * @param $output OutputPage |
32 | | - */ |
33 | | - public static function defineEditors( &$editor, &$output ) { |
34 | | - global $wgExtensionAssetsPath; |
35 | | - |
36 | | - $editor->addEditMode( |
37 | | - 'referenceEditor', |
38 | | - wfMsgExt( 'reference-editor-editmode-caption', 'parseinline' ), |
39 | | - wfMsgExt( 'reference-editor-editmode-description', 'parseinline' ) |
40 | | - ); |
41 | | - |
42 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/ReferenceEditor/ReferenceEditor.css?0" ); |
43 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/ReferenceEditor/jquery.inlineEditor.editors.referenceEditor.js?0" ); |
44 | | - |
45 | | - return true; |
46 | | - } |
47 | 27 | } |
Index: trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'ReferenceEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#ReferenceEditor', |
28 | | - 'descriptionmsg' => 'reference-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,7 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'ReferenceEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'ReferenceEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['ReferenceEditor'] = $dir . 'ReferenceEditor.i18n.php'; |
Index: trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js |
— | — | @@ -4,64 +4,47 @@ |
5 | 5 | ( function( $ ) { $.inlineEditor.basicEditor = { |
6 | 6 | |
7 | 7 | /** |
8 | | - * Creates a new field which stores the original field inside. |
9 | | - * The original click event is required to bind with the original field. |
| 8 | + * Creates a new hovering edit field. |
10 | 9 | */ |
11 | 10 | newField: function( $field, originalClickEvent ) { |
12 | | - // store the original field in a hidden field |
13 | | - var $orig = $( '<' + $field.get(0).nodeName + '/>' ); |
14 | | - $orig.html( $field.html() ); |
15 | | - $orig.attr( 'id', $field.attr( 'id' ) ); |
16 | | - $orig.addClass( $field.attr( 'class' ) ); |
17 | | - $orig.addClass( 'orig' ); |
18 | | - $orig.click( originalClickEvent ); |
19 | | - |
20 | | - // create a new field and add the original text |
| 11 | + // create a new field |
21 | 12 | var $newField = $( '<' + $field.get(0).nodeName + '/>' ); |
22 | | - $newField.addClass( $field.attr('class' ) ); |
23 | | - $newField.removeClass( 'notEditing' ); |
24 | 13 | $newField.addClass( 'editing' ); |
25 | | - $newField.append( $orig ); |
26 | 14 | |
27 | | - // add the new field after the current one, and remove the current one |
28 | | - // editing the current field is buggy in Webkit browsers |
| 15 | + // position the field floating on the page, at the same position the original field |
| 16 | + $newField.css( 'top', $field.position().top ); |
| 17 | + |
| 18 | + // point to the original field using jQuery data |
| 19 | + $newField.data( 'orig', $field ); |
| 20 | + |
| 21 | + // add the field after the current field in code |
29 | 22 | $field.after( $newField ); |
30 | | - $field.remove(); |
31 | | - |
32 | 23 | return $newField; |
33 | 24 | }, |
34 | 25 | |
35 | 26 | /** |
36 | | - * Get a good width for the edit bar based on the original field. |
37 | | - */ |
38 | | -fieldWidth: function( $field, minWidth ) { |
39 | | - // calculate width based on the text width witin the page flow |
40 | | - // this means that this width will never exeed the original width when it's a multiline sentence |
41 | | - var width = $field.textWidth() - 5; |
42 | | - if( minWidth === undefined ) minWidth = 300; |
43 | | - if( width < minWidth ) width = minWidth; |
44 | | - return width; |
45 | | -}, |
46 | | - |
47 | | -/** |
48 | 27 | * Adds an edit bar to the field with preview and cancel functionality. |
49 | 28 | */ |
50 | | -addEditBar: function( $newSpan, width, wiki ) { |
| 29 | +addEditBar: function( $newSpan, wiki ) { |
51 | 30 | // build the input field |
52 | | - var $input = $( '<textarea style="width: ' + (width-65-65-10) + 'px;"></textarea>' ); |
| 31 | + var $input = $( '<textarea></textarea>' ); |
53 | 32 | $input.text( wiki ); |
54 | 33 | |
55 | 34 | // build preview and cancel buttons and add click events |
56 | | - var $preview = $( '<input type="button" value="Preview" style="width: 65px; margin-left: ' + (3) + 'px;" class="preview"/>' ); |
57 | | - var $cancel = $( '<input type="button" value="Cancel" style="width: 65px; margin-left: ' + (65+3+3) + 'px;" class="cancel"/>' ); |
| 35 | + var $preview = $( '<input type="button" value="Preview" class="preview"/>' ); |
| 36 | + var $cancel = $( '<input type="button" value="Cancel" class="cancel"/>' ); |
58 | 37 | $preview.click( $.inlineEditor.basicEditor.preview ); |
59 | 38 | $cancel.click( $.inlineEditor.basicEditor.cancel ); |
60 | 39 | |
| 40 | + // build a div for the buttons |
| 41 | + var $buttons = $( '<div class="buttons"></div> '); |
| 42 | + $buttons.append( $preview ); |
| 43 | + $buttons.append( $cancel ); |
| 44 | + |
61 | 45 | // build the edit bar from the input field and buttons |
62 | | - var $editBar = $( '<span class="editbar" style="width: ' + width + 'px"></span>' ); |
| 46 | + var $editBar = $( '<div class="editbar"></div>' ); |
63 | 47 | $editBar.append( $input ); |
64 | | - $editBar.append( $preview ); |
65 | | - $editBar.append( $cancel ); |
| 48 | + $editBar.append( $buttons ); |
66 | 49 | |
67 | 50 | // append the edit bar to the new span |
68 | 51 | $newSpan.append( $editBar ); |
— | — | @@ -79,17 +62,23 @@ |
80 | 63 | * Default click handler for simple editors. Recommended to override. |
81 | 64 | */ |
82 | 65 | click: function( event ) { |
83 | | - // prevent clicks from reaching other elements |
84 | | - event.stopPropagation(); |
85 | | - event.preventDefault(); |
86 | | - |
87 | | - // find the element and retrieve the corresponding wikitext |
88 | 66 | var $field = $(this); |
89 | | - var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) ); |
90 | | - var width = $.inlineEditor.basicEditor.fieldWidth( $field ); |
91 | 67 | |
92 | | - $newField = $.inlineEditor.basicEditor.newField( $field, $.inlineEditor.basicEditor.click ); |
93 | | - $.inlineEditor.basicEditor.addEditBar( $newField, width, wiki ); |
| 68 | + if( $field.hasClass( 'nobar' ) || event.pageX - $field.offset().left < 10 ) { |
| 69 | + // prevent clicks from reaching other elements |
| 70 | + event.stopPropagation(); |
| 71 | + event.preventDefault(); |
| 72 | + |
| 73 | + // disable the existing editing field if necessary |
| 74 | + $.inlineEditor.basicEditor.cancelAll(); |
| 75 | + |
| 76 | + // find the element and retrieve the corresponding wikitext |
| 77 | + var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) ); |
| 78 | + |
| 79 | + // create the edit field and build the edit bar |
| 80 | + $newField = $.inlineEditor.basicEditor.newField( $field, $.inlineEditor.basicEditor.click ); |
| 81 | + $.inlineEditor.basicEditor.addEditBar( $newField, wiki ); |
| 82 | + } |
94 | 83 | }, |
95 | 84 | |
96 | 85 | /** |
— | — | @@ -100,24 +89,22 @@ |
101 | 90 | event.stopPropagation(); |
102 | 91 | event.preventDefault(); |
103 | 92 | |
104 | | - // find the outer span, two parents above the buttons |
105 | | - var $span = $(this).parent().parent(); |
| 93 | + // find the outer span, three parents above the buttons |
| 94 | + var $span = $(this).parent().parent().parent(); |
106 | 95 | |
107 | 96 | // find the span with the original value |
108 | | - var $orig = $span.children('.orig'); |
| 97 | + var $orig = $span.data( 'orig' ); |
109 | 98 | |
110 | 99 | // convert the span to it's original state |
111 | 100 | $orig.removeClass( 'orig' ); |
| 101 | + $orig.removeClass( 'hover' ); |
112 | 102 | |
113 | 103 | // place the original span after the current span and remove the current span |
114 | | - // editing the current span is buggy in Webkit browsers |
115 | 104 | $span.after( $orig ); |
116 | 105 | $span.remove(); |
117 | 106 | |
118 | | - // highlight the text orange and have it fade to blue again |
119 | | - // this is a visual indicator to where the element is now |
120 | | - $orig.addClass( 'lastEdit' ); |
121 | | - $orig.removeClass( 'lastEdit', 800 ); |
| 107 | + // reload the editor to fix stuff that might or might not be broken |
| 108 | + $.inlineEditor.reload(); |
122 | 109 | }, |
123 | 110 | |
124 | 111 | /** |
— | — | @@ -128,8 +115,8 @@ |
129 | 116 | event.stopPropagation(); |
130 | 117 | event.preventDefault(); |
131 | 118 | |
132 | | - // find the span with class 'editbar', one parent above the buttons |
133 | | - var $editbar = $(this).parent(); |
| 119 | + // find the span with class 'editbar', two parent above the buttons |
| 120 | + var $editbar = $(this).parent().parent(); |
134 | 121 | |
135 | 122 | // the element is one level above the editbar |
136 | 123 | var $element = $editbar.parent(); |
— | — | @@ -137,30 +124,56 @@ |
138 | 125 | // add a visual indicator to show the preview is loading |
139 | 126 | $element.addClass( 'saving' ); |
140 | 127 | var $overlay = $( '<div class="overlay"><div class="alpha"></div><img class="spinner" src="' + wgScriptPath + '/extensions/InlineEditor/ajax-loader.gif"/></div>' ); |
| 128 | + $editbar.after( $overlay ); |
141 | 129 | |
142 | | - // if it's an inline element, put it *inside* the editbar, else outside |
143 | | - if( $element.hasClass( 'inline' ) ) { |
144 | | - $editbar.append( $overlay ); |
145 | | - } |
146 | | - else { |
147 | | - $editbar.after( $overlay ); |
148 | | - } |
149 | | - |
150 | 130 | // get the edited text and the id to save it to |
151 | 131 | text = $editbar.children( 'textarea' ).val(); |
152 | | - id = $element.children( '.orig' ).attr( 'id' ); |
| 132 | + id = $element.data( 'orig' ).attr( 'id' ); |
153 | 133 | |
154 | 134 | // let the inlineEditor framework handle the preview |
155 | 135 | $.inlineEditor.previewTextById( text, id ); |
156 | 136 | }, |
157 | 137 | |
158 | 138 | /** |
159 | | - * Cancel all basic editors. Recommended to call when switching edit modes. |
| 139 | + * Cancel all basic editors. |
160 | 140 | */ |
161 | 141 | cancelAll: function() { |
162 | 142 | $('.editing').find('.cancel').click(); |
| 143 | +}, |
| 144 | + |
| 145 | +/** |
| 146 | + * Bind all required events. |
| 147 | + */ |
| 148 | +bindEvents: function( $elements ) { |
| 149 | + $elements.unbind(); |
| 150 | + $elements.click( $.inlineEditor.basicEditor.click ); |
| 151 | + $elements.mousemove( $.inlineEditor.basicEditor.mouseMove ); |
| 152 | + $elements.mouseleave( $.inlineEditor.basicEditor.mouseLeave ); |
| 153 | +}, |
| 154 | + |
| 155 | +/** |
| 156 | + * Do a javascript hover on the bars at the left. |
| 157 | + */ |
| 158 | +mouseMove: function( event ) { |
| 159 | + $field = $( this ); |
| 160 | + if( $field.hasClass( 'bar' ) ) { |
| 161 | + if( event.pageX - $field.offset().left < 10 ) { |
| 162 | + $field.addClass( 'hover' ); |
| 163 | + } |
| 164 | + else { |
| 165 | + $field.removeClass( 'hover' ); |
| 166 | + } |
| 167 | + } |
| 168 | +}, |
| 169 | + |
| 170 | +/** |
| 171 | + * Remove the hover class when leaving the element. |
| 172 | + */ |
| 173 | +mouseLeave: function( event ) { |
| 174 | + $field = $( this ); |
| 175 | + if( $field.hasClass( 'bar' ) ) { |
| 176 | + $field.removeClass( 'hover' ); |
| 177 | + } |
163 | 178 | } |
164 | 179 | |
165 | 180 | }; } ) ( jQuery ); |
166 | | - |
167 | | - |
Index: trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php |
— | — | @@ -1,35 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension FullEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'fulleditor-desc' => 'Provides a link to the full editor for the InlineEditor', |
17 | | - |
18 | | - 'fulleditor-editmode-caption' => 'Full editor', |
19 | | - 'fulleditor-editmode-description' => "If you want full control over the page, you can use the full editor. |
20 | | -With this editor you can edit the [http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki markup] directly. |
21 | | -The editor is also more complex to use, but to have full control of editing this wikis, may be worth it!", |
22 | | - 'fulleditor-editmode-description-link' => 'Use the full editor »', |
23 | | -); |
24 | | - |
25 | | -/** Dutch / Nederlands |
26 | | - * @author Jan Paul Posma |
27 | | - */ |
28 | | -$messages['nl'] = array( |
29 | | - 'fulleditor-desc' => 'Zorgt voor een link naar de volledige editor in InlineEditor', |
30 | | - |
31 | | - 'fulleditor-editmode-caption' => 'Volledige editor', |
32 | | - 'fulleditor-editmode-description' => "Als je echt de controle over de pagina wil, kun je de volledige editor gebruiken. |
33 | | -Met deze editor kun je de [http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki codes] direct veranderen. |
34 | | -Deze editor is lastiger te gebruiken, maar voor de totale controle kan dat het waard zijn!", |
35 | | - 'fulleditor-editmode-description-link' => 'Gebruik de volledige editor »', |
36 | | -); |
Index: trunk/extensions/InlineEditor/FullEditor/FullEditor.php |
— | — | @@ -1,40 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * FullEditor extension for the InlineEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - * |
9 | | - * This is the include file for the FullEditor. |
10 | | - * |
11 | | - * Usage: Include the following line in your LocalSettings.php |
12 | | - * require_once( "$IP/extensions/InlineEditor/FullEditor/FullEditor.php" ); |
13 | | - * |
14 | | - * @author Jan Paul Posma <jp.posma@gmail.com> |
15 | | - * @license GPL v2 or later |
16 | | - * @version 0.0.0 |
17 | | - */ |
18 | | - |
19 | | -if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | | - |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'FullEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#FullEditor', |
28 | | - 'descriptionmsg' => 'fulleditor-desc', |
29 | | -); |
30 | | - |
31 | | -// current directory including trailing slash |
32 | | -$dir = dirname( __FILE__ ) . '/'; |
33 | | - |
34 | | -// add autoload classes |
35 | | -$wgAutoloadClasses['FullEditor'] = $dir . 'FullEditor.class.php'; |
36 | | - |
37 | | -// register hooks |
38 | | -$wgHooks['InlineEditorDefineEditors'][] = 'FullEditor::defineEditors'; |
39 | | - |
40 | | -// i18n messages |
41 | | -$wgExtensionMessagesFiles['FullEditor'] = $dir . 'FullEditor.i18n.php'; |
Index: trunk/extensions/InlineEditor/FullEditor/FullEditor.php |
— | — | @@ -0,0 +1,27 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * FullEditor extension for the InlineEditor. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This is the include file for the FullEditor. |
| 10 | + * |
| 11 | + * Usage: Include the following line in your LocalSettings.php |
| 12 | + * require_once( "$IP/extensions/InlineEditor/FullEditor/FullEditor.php" ); |
| 13 | + * |
| 14 | + * @author Jan Paul Posma <jp.posma@gmail.com> |
| 15 | + * @license GPL v2 or later |
| 16 | + * @version 0.0.0 |
| 17 | + */ |
| 18 | + |
| 19 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
| 20 | + |
| 21 | +// current directory including trailing slash |
| 22 | +$dir = dirname( __FILE__ ) . '/'; |
| 23 | + |
| 24 | +// add autoload classes |
| 25 | +$wgAutoloadClasses['FullEditor'] = $dir . 'FullEditor.class.php'; |
| 26 | + |
| 27 | +// register hooks |
| 28 | +$wgHooks['InlineEditorMark'][] = 'FullEditor::mark'; |
Property changes on: trunk/extensions/InlineEditor/FullEditor/FullEditor.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 29 | + native |
Index: trunk/extensions/InlineEditor/FullEditor/FullEditor.class.php |
— | — | @@ -1,18 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * This 'editor' just shows some description with a link to the full/traditional editor. |
6 | | - */ |
7 | | -class FullEditor { |
8 | | - public static function defineEditors( &$editor, &$output ) { |
9 | | - $editor->addEditMode( |
10 | | - 'FullEditor', |
11 | | - wfMsgExt( 'fulleditor-editmode-caption', 'parseinline' ), |
12 | | - wfMsgExt( 'fulleditor-editmode-description', 'parseinline' ) |
13 | | - . '<br /><a class="fulleditor" href="' . $editor->getArticle()->getTitle()->getLocalURL( 'action=edit&fulleditor=1' ) . '">' |
14 | | - . wfMsgExt( 'fulleditor-editmode-description-link', 'parseinline' ) |
15 | | - . '</a>' |
16 | | - ); |
17 | | - return true; |
18 | | - } |
19 | | -} |
Index: trunk/extensions/InlineEditor/FullEditor/FullEditor.class.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Simple editor that wraps everything. |
| 6 | + */ |
| 7 | +class FullEditor { |
| 8 | + /** |
| 9 | + * This function hooks into InlineEditorMark and marks everything. |
| 10 | + * @param $inlineEditorText InlineEditorText |
| 11 | + */ |
| 12 | + public static function mark( &$inlineEditorText ) { |
| 13 | + // get the original wikitext |
| 14 | + $text = $inlineEditorText->getWikiOriginal(); |
| 15 | + |
| 16 | + // match everything |
| 17 | + $inlineEditorText->addMarking( new InlineEditorMarking( 0, strlen( $text ), 'fullEditorElement', true, true, 100 ) ); |
| 18 | + |
| 19 | + return true; |
| 20 | + } |
| 21 | +} |
Property changes on: trunk/extensions/InlineEditor/FullEditor/FullEditor.class.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 22 | + native |
Index: trunk/extensions/InlineEditor/InlineEditor.php |
— | — | @@ -1,19 +1,14 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * InlineEditor extension. |
| 4 | + * InlineEditor extension, basic include file. |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | 8 | * |
9 | 9 | * This is the include file for the InlineEditor. |
10 | 10 | * |
11 | | - * Usage: It's recommended to use one of the following configurations in LocalSettings.php: |
12 | | - * |
13 | | - * 1. For editors like "Sentences", "Lists", "Media", etc. use: |
14 | | - * require_once( "$IP/extensions/InlineEditor/InlineEditorFunctional.php" ); |
15 | | - * |
16 | | - * 2. For editors "Sentences", "Paragraphs" and "Sections" use: |
17 | | - * require_once( "$IP/extensions/InlineEditor/InlineEditorBlocks.php" ); |
| 11 | + * Usage: It's recommended to use the following configuration LocalSettings.php: |
| 12 | + * require_once( "$IP/extensions/InlineEditor/InlineEditorRecommended.php" ); |
18 | 13 | * |
19 | 14 | * @author Jan Paul Posma <jp.posma@gmail.com> |
20 | 15 | * @license GPL v2 or later |
Index: trunk/extensions/InlineEditor/SectionEditor/SectionEditor.i18n.php |
— | — | @@ -1,37 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension SectionEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'section-editor-desc' => 'Adds the "Sections" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'section-editor-editmode-caption' => "Sections", |
19 | | - |
20 | | - 'section-editor-editmode-description' => "You can edit entire sections using this mode.", |
21 | | - |
22 | | -/* 'section-editor-editmode-description' => "There are a few [http://en.wikipedia.org/wiki/Wikipedia:Simplified_ruleset guidelines] for editing an article:<br/> |
23 | | -* Write what you think is best for the article, or as we say here: [http://en.wikipedia.org/wiki/Wikipedia:Be_bold be bold when updating pages]! If you feel that a rule prevents you from improving Wikipedia, [http://en.wikipedia.org/wiki/Wikipedia:Ignore_all_rules ignore it]. |
24 | | -* [http://en.wikipedia.org/wiki/Wikipedia:What_Wikipedia_is_not Wikipedia is an encyclopedia.] Someone else should be able to [http://en.wikipedia.org/wiki/Wikipedia:Verifiability verify] what you've written, for example in books or online. |
25 | | -* Write from a [http://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view], and use your [http://en.wikipedia.org/wiki/Wikipedia:Copyrights own words].", |
26 | | -*/ |
27 | | -); |
28 | | - |
29 | | -/** Dutch / Nederlands |
30 | | - * @author Jan Paul Posma |
31 | | - */ |
32 | | -$messages['nl'] = array( |
33 | | - 'section-editor-desc' => 'Voegt de "Secties" optie toe aan InlineEditor.', |
34 | | - |
35 | | - 'section-editor-editmode-caption' => "Secties", |
36 | | - 'section-editor-editmode-description' => "Met deze optie kun je hele secties bewerken. |
37 | | -Je kunt nogal wat wiki codes tegen komen. [http://nl.wikipedia.org/wiki/Help:Tekstopmaak Meer informatie].", |
38 | | -); |
Index: trunk/extensions/InlineEditor/SectionEditor/jquery.inlineEditor.editors.sectionEditor.js |
— | — | @@ -1,44 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the SectionEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.sectionEditor = { |
6 | | - |
7 | | -click: function( event ) { |
8 | | - // prevent clicks from reaching other elements |
9 | | - event.stopPropagation(); |
10 | | - event.preventDefault(); |
11 | | - |
12 | | - // find the element and retrieve the corresponding wikitext |
13 | | - var $field = $(this); |
14 | | - var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) ); |
15 | | - var width = $field.width(); |
16 | | - |
17 | | - $newField = $.inlineEditor.basicEditor.newField( $field, $.inlineEditor.editors.sectionEditor.click ); |
18 | | - $.inlineEditor.basicEditor.addEditBar( $newField, width, wiki ); |
19 | | -}, |
20 | | - |
21 | | -enable: function() { |
22 | | - // do what we also do when reloading the page |
23 | | - $.inlineEditor.editors.sectionEditor.reload(); |
24 | | - |
25 | | - // add the identifying class to #editContent |
26 | | - $( '#editContent' ).addClass( 'sectionEditor' ); |
27 | | -}, |
28 | | - |
29 | | -reload: function() { |
30 | | - // make sections clickable |
31 | | - $( '.sectionEditorElement' ).click( $.inlineEditor.editors.sectionEditor.click ); |
32 | | -}, |
33 | | - |
34 | | -disable: function() { |
35 | | - // remove the click event from the sections |
36 | | - $( '.sectionEditorElement' ).unbind( 'click' ); |
37 | | - |
38 | | - // remove the identifying class from #editContent |
39 | | - $( '#editContent' ).removeClass( 'sectionEditor' ); |
40 | | - |
41 | | - // cancel all open editors |
42 | | - $.inlineEditor.basicEditor.cancelAll(); |
43 | | -} |
44 | | - |
45 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SectionEditor/SectionEditor.css |
— | — | @@ -1,40 +0,0 @@ |
2 | | -.sectionEditor .sectionEditorElement { |
3 | | - /* soft-blue background color to highlight editable sections */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | - |
10 | | - /* add some space on the top and bottom to make sure they are spaced apart */ |
11 | | - margin: 0.5em 0; |
12 | | -} |
13 | | - |
14 | | -.sectionEditor .sectionEditorElement.edited { |
15 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
16 | | - background-color: #F9F2A7; |
17 | | -} |
18 | | - |
19 | | -.sectionEditor .sectionEditorElement:hover { |
20 | | - /* indicate the section to be edited with a darker color */ |
21 | | - background-color: #a7d7f9; |
22 | | -} |
23 | | - |
24 | | -.sectionEditor .sectionEditorElement.notEditing * { |
25 | | - /* make sure all the child elements inherit the background color */ |
26 | | - background-color: inherit !important; |
27 | | -} |
28 | | - |
29 | | -.sectionEditor .editing { |
30 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
31 | | - padding: 0px; |
32 | | - margin: 0px; |
33 | | - |
34 | | - /* reset the cursor when editing */ |
35 | | - cursor: auto; |
36 | | -} |
37 | | - |
38 | | -.sectionEditor .lastEdit { |
39 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
40 | | - background-color: #f9c9a7; |
41 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SectionEditor/SectionEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'SectionEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#SectionEditor', |
28 | | - 'descriptionmsg' => 'section-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,9 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'SectionEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'SectionEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['SectionEditor'] = $dir . 'SectionEditor.i18n.php'; |
43 | | - |
44 | | -$wgInlineEditorSectionEditorVisible = true; |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SectionEditor/SectionEditor.class.php |
— | — | @@ -23,33 +23,9 @@ |
24 | 24 | $end = $match[1]-1; |
25 | 25 | $prevPos = $match[1]; |
26 | 26 | |
27 | | - $marking = new InlineEditorMarking( $start, $end, 'sectionEditorElement', false ); |
28 | | - $marking->setPriority( 2 ); |
29 | | - $inlineEditorText->addMarking( $marking ); |
| 27 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'sectionEditorElement', true, true, 2 ) ); |
30 | 28 | } |
31 | 29 | |
32 | 30 | return true; |
33 | 31 | } |
34 | | - |
35 | | - /** |
36 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
37 | | - * @param $editor InlineEditor |
38 | | - * @param $output OutputPage |
39 | | - */ |
40 | | - public static function defineEditors( &$editor, &$output ) { |
41 | | - global $wgExtensionAssetsPath, $wgInlineEditorSectionEditorVisible; |
42 | | - |
43 | | - if( $wgInlineEditorSectionEditorVisible ) { |
44 | | - $editor->addEditMode( |
45 | | - 'sectionEditor', |
46 | | - wfMsgExt( 'section-editor-editmode-caption', 'parseinline' ), |
47 | | - wfMsgExt( 'section-editor-editmode-description', 'parseinline' ) |
48 | | - ); |
49 | | - |
50 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/SectionEditor/SectionEditor.css?0" ); |
51 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/SectionEditor/jquery.inlineEditor.editors.sectionEditor.js?0" ); |
52 | | - } |
53 | | - |
54 | | - return true; |
55 | | - } |
56 | 32 | } |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.i18n.php |
— | — | @@ -1,67 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension SentenceEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'sentence-editor-desc' => 'Adds the "Sentences" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'sentence-editor-editmode-caption' => "Sentences", |
19 | | -/* |
20 | | - 'sentence-editor-editmode-description' => "There are a few [http://en.wikipedia.org/wiki/Wikipedia:Simplified_ruleset guidelines] for editing an article:<br/> |
21 | | -* Write what you think is best for the article, or as we say here: [http://en.wikipedia.org/wiki/Wikipedia:Be_bold be bold when updating pages]! If you feel that a rule prevents you from improving Wikipedia, [http://en.wikipedia.org/wiki/Wikipedia:Ignore_all_rules ignore it]. |
22 | | -* [http://en.wikipedia.org/wiki/Wikipedia:What_Wikipedia_is_not Wikipedia is an encyclopedia.] Someone else should be able to [http://en.wikipedia.org/wiki/Wikipedia:Verifiability verify] what you've written, for example in books or online. |
23 | | -* Write from a [http://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view], and use your [http://en.wikipedia.org/wiki/Wikipedia:Copyrights own words].", |
24 | | -*/ |
25 | | - 'sentence-editor-editmode-description' => "Edit sentences by clicking on them. You can use wiki syntax to format the text. Some examples: |
26 | | -{| width=\"100%\" style=\"background-color: inherit\" |
27 | | -! Code |
28 | | -! Output |
29 | | -|- |
30 | | -| <code><nowiki>Here's a link to the [[Main Page]].</nowiki></code> |
31 | | -| Here is a link to the [[Main Page]]. |
32 | | -|- |
33 | | -| <code><nowiki>This is ''italic text'' and this is '''bold text'''.</nowiki></code> |
34 | | -| This is ''italic text'' and this is '''bold text'''. |
35 | | -|- |
36 | | -| <code><nowiki>[http://meta.wikimedia.org/wiki/Help:Editing More information]</nowiki></code> |
37 | | -| [http://meta.wikimedia.org/wiki/Help:Editing More information] |
38 | | -|}", |
39 | | -); |
40 | | - |
41 | | -/** Dutch / Nederlands |
42 | | - * @author Jan Paul Posma |
43 | | - */ |
44 | | -$messages['nl'] = array( |
45 | | - 'sentence-editor-desc' => 'Voegt de "Zinnen" optie toe aan InlineEditor', |
46 | | - |
47 | | - 'sentence-editor-editmode-caption' => "Zinnen", |
48 | | -/* |
49 | | - 'sentence-editor-editmode-description' => "There are a few [http://en.wikipedia.org/wiki/Wikipedia:Simplified_ruleset guidelines] for editing an article:<br/> |
50 | | -* Write what you think is best for the article, or as we say here: [http://en.wikipedia.org/wiki/Wikipedia:Be_bold be bold when updating pages]! If you feel that a rule prevents you from improving Wikipedia, [http://en.wikipedia.org/wiki/Wikipedia:Ignore_all_rules ignore it]. |
51 | | -* [http://en.wikipedia.org/wiki/Wikipedia:What_Wikipedia_is_not Wikipedia is an encyclopedia.] Someone else should be able to [http://en.wikipedia.org/wiki/Wikipedia:Verifiability verify] what you've written, for example in books or online. |
52 | | -* Write from a [http://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view neutral point of view], and use your [http://en.wikipedia.org/wiki/Wikipedia:Copyrights own words].", |
53 | | -*/ |
54 | | - 'sentence-editor-editmode-description' => "Bewerk zinnen door op ze te klikken. Je kunt wiki codes gebruiken om de tekst op te maken. Enkele voorbeelden: |
55 | | -{| width=\"100%\" style=\"background-color: inherit\" |
56 | | -! Code |
57 | | -! Resultaat |
58 | | -|- |
59 | | -| <code><nowiki>Hier is een link naar de [[Hoofdpagina]].</nowiki></code> |
60 | | -| Hier is een link naar de [[Hoofdpagina]]. |
61 | | -|- |
62 | | -| <code><nowiki>Dit is ''schuingedrukt'' en dit is '''dikgedrukt'''.</nowiki></code> |
63 | | -| Dit is ''schuingedrukt'' en dit is '''dikgedrukt'''. |
64 | | -|- |
65 | | -| <code><nowiki>[http://nl.wikipedia.org/wiki/Help:Tekstopmaak Meer informatie]</nowiki></code> |
66 | | -| [http://nl.wikipedia.org/wiki/Help:Tekstopmaak Meer informatie] |
67 | | -|}", |
68 | | -); |
Index: trunk/extensions/InlineEditor/SentenceEditor/jquery.inlineEditor.editors.sentenceEditor.js |
— | — | @@ -1,30 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the SentenceEditor. Defines $.inlineEditor.editors.sentenceEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.sentenceEditor = { |
6 | | - |
7 | | -enable: function() { |
8 | | - // do what we also do when reloading the page |
9 | | - $.inlineEditor.editors.sentenceEditor.reload(); |
10 | | - |
11 | | - // add the identifying class to #editContent |
12 | | - $( '#editContent' ).addClass( 'sentenceEditor' ); |
13 | | -}, |
14 | | - |
15 | | -reload: function() { |
16 | | - // make sentences clickable |
17 | | - $( '.sentenceEditorElement' ).click( $.inlineEditor.basicEditor.click ); |
18 | | -}, |
19 | | - |
20 | | -disable: function() { |
21 | | - // remove the click event from the sentences |
22 | | - $( '.sentenceEditorElement' ).unbind( 'click' ); |
23 | | - |
24 | | - // remove the identifying class from #editContent |
25 | | - $( '#editContent' ).removeClass( 'sentenceEditor' ); |
26 | | - |
27 | | - // cancel all open editors |
28 | | - $.inlineEditor.basicEditor.cancelAll(); |
29 | | -} |
30 | | - |
31 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.css |
— | — | @@ -1,40 +0,0 @@ |
2 | | -.sentenceEditor .sentenceEditorElement { |
3 | | - /* soft-blue background color to highlight editable sentences */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | - |
10 | | - /* have the background color extend just a bit around the text border, looks better */ |
11 | | - margin: -1px; |
12 | | - padding: 1px; |
13 | | -} |
14 | | - |
15 | | -.sentenceEditor .sentenceEditorElement.edited, |
16 | | -.sentenceEditor .listEditorElement.edited, |
17 | | -.sentenceEditor .referenceEditorElement.edited, |
18 | | -.sentenceEditor .mediaEditorElement.edited, |
19 | | -.sentenceEditor .templateEditorElement.edited { |
20 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
21 | | - background-color: #F9F2A7; |
22 | | -} |
23 | | - |
24 | | -.sentenceEditor .sentenceEditorElement:hover { |
25 | | - /* indicate the sentence to be edited with a darker color */ |
26 | | - background-color: #a7d7f9; |
27 | | -} |
28 | | - |
29 | | -.sentenceEditor .editing { |
30 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
31 | | - padding: 0px; |
32 | | - margin: 0px; |
33 | | - |
34 | | - /* reset the cursor when editing */ |
35 | | - cursor: auto; |
36 | | -} |
37 | | - |
38 | | -.sentenceEditor .sentenceEditorElement.lastEdit { |
39 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
40 | | - background-color: #f9c9a7; |
41 | | -} |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SentenceEditor/jquery.elastic.js |
— | — | @@ -1,6 +0,0 @@ |
2 | | -(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;} |
3 | | -var $textarea=jQuery(this),$twin=jQuery('<div />').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;} |
4 | | -$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));} |
5 | | -function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}} |
6 | | -function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'<br />');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}} |
7 | | -$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SentenceEditor/jquery.textWidth.js |
— | — | @@ -1,33 +0,0 @@ |
2 | | -/** |
3 | | - * Function to determine the actual usable width of a span. |
4 | | - * This means that the span has to start at the left of the containing element, |
5 | | - * and the text inside the span may wrap if it gets too long. |
6 | | - */ |
7 | | -( function( $ ) { |
8 | | - $.fn.textWidth = function(){ |
9 | | - var element = $j(this); |
10 | | - |
11 | | - // build an outer element that stretches to the maximum width, so the span will |
12 | | - // be located to the leftmost position |
13 | | - var outer = $('<div style="width: 100%"></div>'); |
14 | | - |
15 | | - // build a span inside the outer div |
16 | | - var inner = $('<span></span>'); |
17 | | - inner.html(element.html()); |
18 | | - outer.append(inner); |
19 | | - |
20 | | - // place the outer div after the original element and hide the original element so it'll |
21 | | - // be in exactly the same place |
22 | | - element.after(outer); |
23 | | - element.hide(); |
24 | | - |
25 | | - // calculate the div of the span (which will wrap when it meets the maximum width) |
26 | | - var width = inner.width(); |
27 | | - |
28 | | - // remove the test elements and show the original element again |
29 | | - outer.remove(); |
30 | | - element.show(); |
31 | | - |
32 | | - return width; |
33 | | - }; |
34 | | -} ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'SentenceEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#SentenceEditor', |
28 | | - 'descriptionmsg' => 'sentence-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -37,10 +27,6 @@ |
38 | 28 | |
39 | 29 | // register hooks |
40 | 30 | $wgHooks['InlineEditorMark'][] = 'SentenceEditor::mark'; |
41 | | -$wgHooks['InlineEditorDefineEditors'][] = 'SentenceEditor::defineEditors'; |
42 | 31 | |
43 | | -// i18n messages |
44 | | -$wgExtensionMessagesFiles['SentenceEditor'] = $dir . 'SentenceEditor.i18n.php'; |
45 | | - |
46 | 32 | // default settings |
47 | 33 | $wgSentenceEditorDetectionDefault = 'SentenceDetectionBasic'; |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/SentenceDetectionBasic.class.php |
— | — | @@ -1,8 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Basic implementation of sentence splitting. Not recommended for actual use, but does the job |
6 | | - * for a simple demo. |
| 5 | + * Basic implementation of sentence splitting. Works until a certain degree, for Western languages. |
| 6 | + * It's recommended to use an algorithm that uses a trained data set for a specific language to get |
| 7 | + * better results. |
7 | 8 | */ |
8 | 9 | class SentenceDetectionBasic implements ISentenceDetection { |
9 | 10 | private $wikiTexts; |
— | — | @@ -15,7 +16,11 @@ |
16 | 17 | $this->wikiTexts[] = array( 'text' => $text, 'offset' => $offset ); |
17 | 18 | } |
18 | 19 | |
19 | | - public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $inline ) { |
| 20 | + /** |
| 21 | + * Splits sentences at '.', '?' and '!', only when a dot is not one, two or three positions to the |
| 22 | + * left or to the right of the character. |
| 23 | + */ |
| 24 | + public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $block, $bar ) { |
20 | 25 | foreach ( $this->wikiTexts as $wikiText ) { |
21 | 26 | $sentences = preg_split( "/(?<!\..|\...|\....)([\?\!\.]+)\s(?!.\.|..\.|...\.)/u", $wikiText['text'], -1, |
22 | 27 | PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_DELIM_CAPTURE ); |
— | — | @@ -27,7 +32,7 @@ |
28 | 33 | } |
29 | 34 | $start = $wikiText['offset'] + $sentence[1]; |
30 | 35 | $end = $start + strlen( $sentence[0] ); |
31 | | - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, $class, $inline ) ); |
| 36 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, $class, $block, $bar ) ); |
32 | 37 | } |
33 | 38 | } |
34 | 39 | } |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/ISentenceDetection.class.php |
— | — | @@ -18,7 +18,8 @@ |
19 | 19 | * All the sentences and their offsets have to be added as markings to $inlineEditorText. |
20 | 20 | * @param $inlineEditorText InlineEditorText Object the markings should be added to |
21 | 21 | * @param $class string Class name of the markings |
22 | | - * @param $inline bool Whether the markings are inline or not |
| 22 | + * @param $block bool Whether the markings are block or inline |
| 23 | + * @param $bar bool Whether the markings have a bar at the left or are fully clickable |
23 | 24 | */ |
24 | | - public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $inline ); |
| 25 | + public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $block, $bar ); |
25 | 26 | } |
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.class.php |
— | — | @@ -38,32 +38,12 @@ |
39 | 39 | |
40 | 40 | // have the detection class add the markings to the InlineEditorText object, |
41 | 41 | // class 'sentenceEditorElement', inline elements |
42 | | - $detection->addMarkingsToText( $inlineEditorText, 'sentenceEditorElement', true ); |
| 42 | + $detection->addMarkingsToText( $inlineEditorText, 'sentenceEditorElement', false, false ); |
43 | 43 | |
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
49 | | - * @param $editor InlineEditor |
50 | | - * @param $output OutputPage |
51 | | - */ |
52 | | - public static function defineEditors( &$editor, &$output ) { |
53 | | - global $wgExtensionAssetsPath; |
54 | | - |
55 | | - $editor->addEditMode( |
56 | | - 'sentenceEditor', |
57 | | - wfMsgExt( 'sentence-editor-editmode-caption', 'parseinline' ), |
58 | | - wfMsgExt( 'sentence-editor-editmode-description', 'parseinline' ) |
59 | | - ); |
60 | | - |
61 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/SentenceEditor/SentenceEditor.css?0" ); |
62 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/SentenceEditor/jquery.inlineEditor.editors.sentenceEditor.js?0" ); |
63 | | - |
64 | | - return true; |
65 | | - } |
66 | | - |
67 | | - /** |
68 | 48 | * Replaces all occurences of unsupported wikitext by spaces. This is to make sure the |
69 | 49 | * positions of what's left are still the same as those in the original wikitext |
70 | 50 | * @param $wikitext string |
Index: trunk/extensions/InlineEditor/InlineEditor.css |
— | — | @@ -180,91 +180,3 @@ |
181 | 181 | top: 0px; |
182 | 182 | left: 0px; |
183 | 183 | } |
184 | | - |
185 | | -#editContent a, #editContent a:hover, #editContent a:visited, #editContent a:active { |
186 | | - /* remove the link underline because that way it looks they're clickable */ |
187 | | - text-decoration: none; |
188 | | -} |
189 | | - |
190 | | -#editContent .inline { |
191 | | - display: inline; |
192 | | -} |
193 | | - |
194 | | -#editContent .orig { |
195 | | - /* hide the original element */ |
196 | | - display: none; |
197 | | -} |
198 | | - |
199 | | -#editContent .editbar { |
200 | | - /* use an inline-block to support no-wrap and width; this makes sure everything is on one line |
201 | | - the inline-block is cross-browser supported because a span is inline by default, |
202 | | - see http://www.quirksmode.org/css/display.html */ |
203 | | - display: inline-block; |
204 | | - white-space: no-wrap; |
205 | | - |
206 | | - /* this is used for vertical alignment */ |
207 | | - position: relative; |
208 | | - vertical-align: middle; |
209 | | - |
210 | | - margin: 2px; |
211 | | -} |
212 | | - |
213 | | -#editContent .editbar input { |
214 | | - /* vertically align the inputs */ |
215 | | - position: absolute; |
216 | | - top: 50%; |
217 | | - height: 22px; |
218 | | - margin-top: -11px; |
219 | | -} |
220 | | - |
221 | | -#editContent .editbar textarea { |
222 | | - /* style the textarea font, as this differs heavily from browser to browser */ |
223 | | - font-family: sans-serif; |
224 | | - font-size: 1.0em; |
225 | | - line-height: 1.3em; |
226 | | - margin: 0px; |
227 | | - padding: 0px; |
228 | | - height: 50px; |
229 | | - |
230 | | - /* disable resizing for browsers like Chrome, as we do this ourselves */ |
231 | | - resize: none; |
232 | | -} |
233 | | - |
234 | | -#editContent .saving { |
235 | | - /* have a cross-browser alpha overlay, see http://www.quirksmode.org/css/opacity.html */ |
236 | | - position: relative; |
237 | | - opacity: 0.95; |
238 | | - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=95)"; |
239 | | - filter: alpha(opacity=95); |
240 | | -} |
241 | | - |
242 | | -#editContent .overlay { |
243 | | - /* position the overly to cover the entire editbar */ |
244 | | - height: 100%; |
245 | | - left: 0; |
246 | | - position: absolute; |
247 | | - text-align: center; |
248 | | - top: 0; |
249 | | - width: 100%; |
250 | | -} |
251 | | - |
252 | | -#editContent .overlay img.spinner { |
253 | | - /* position the spinner exactly in the middle */ |
254 | | - left: 50%; |
255 | | - margin-left: -8px; |
256 | | - margin-top: -8px; |
257 | | - position: absolute; |
258 | | - top: 50%; |
259 | | - width: 16px; |
260 | | - height: 16px; |
261 | | -} |
262 | | - |
263 | | -#editContent .overlay .alpha { |
264 | | - /* have a cross-browser alpha overlay, see http://www.quirksmode.org/css/opacity.html */ |
265 | | - width: 100%; |
266 | | - height: 100%; |
267 | | - background-color: #333; |
268 | | - opacity: 0.8; |
269 | | - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; |
270 | | - filter: alpha(opacity=80); |
271 | | -} |
Index: trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.i18n.php |
— | — | @@ -1,30 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Internationalisation file for extension ParagraphEditor. |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | - |
10 | | -$messages = array(); |
11 | | - |
12 | | -/** English |
13 | | - * @author Jan Paul Posma |
14 | | - */ |
15 | | -$messages['en'] = array( |
16 | | - 'paragraph-editor-desc' => 'Adds the "Paragraphs" edit mode for the InlineEditor', |
17 | | - |
18 | | - 'paragraph-editor-editmode-caption' => "Paragraphs", |
19 | | - 'paragraph-editor-editmode-description' => "Using this mode you can edit entire paragraphs.", |
20 | | -); |
21 | | - |
22 | | -/** Dutch / Nederlands |
23 | | - * @author Jan Paul Posma |
24 | | - */ |
25 | | -$messages['nl'] = array( |
26 | | - 'paragraph-editor-desc' => 'Voegt de "Paragrafen" optie toe aan InlineEditor', |
27 | | - |
28 | | - 'paragraph-editor-editmode-caption' => "Paragrafen", |
29 | | - 'paragraph-editor-editmode-description' => "Met deze optie kun je hele paragrafen bewerken. |
30 | | -Je kunt nogal wat wiki codes tegen komen. [http://nl.wikipedia.org/wiki/Help:Tekstopmaak Meer informatie].", |
31 | | -); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ParagraphEditor/jquery.inlineEditor.editors.paragraphEditor.js |
— | — | @@ -1,45 +0,0 @@ |
2 | | -/** |
3 | | - * Client side part of the ParagraphEditor. |
4 | | - */ |
5 | | -( function( $ ) { $.inlineEditor.editors.paragraphEditor = { |
6 | | - |
7 | | -click: function( event ) { |
8 | | - // prevent clicks from reaching other elements |
9 | | - event.stopPropagation(); |
10 | | - event.preventDefault(); |
11 | | - |
12 | | - // find the element and retrieve the corresponding wikitext |
13 | | - var $field = $(this); |
14 | | - var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) ); |
15 | | - var width = $field.textWidth() - 5; |
16 | | - if( width < 500 ) width = $field.width(); |
17 | | - |
18 | | - $newField = $.inlineEditor.basicEditor.newField( $field, $.inlineEditor.editors.paragraphEditor.click ); |
19 | | - $.inlineEditor.basicEditor.addEditBar( $newField, width, wiki ); |
20 | | -}, |
21 | | - |
22 | | -enable: function() { |
23 | | - // do what we also do when reloading the page |
24 | | - $.inlineEditor.editors.paragraphEditor.reload(); |
25 | | - |
26 | | - // add the identifying class to #editContent |
27 | | - $( '#editContent' ).addClass( 'paragraphEditor' ); |
28 | | -}, |
29 | | - |
30 | | -reload: function() { |
31 | | - // make paragraphs clickable |
32 | | - $( '.paragraphEditorElement' ).click( $.inlineEditor.editors.paragraphEditor.click ); |
33 | | -}, |
34 | | - |
35 | | -disable: function() { |
36 | | - // remove the click event from the paragraphs |
37 | | - $( '.paragraphEditorElement' ).unbind( 'click' ); |
38 | | - |
39 | | - // remove the identifying class from #editContent |
40 | | - $( '#editContent' ).removeClass( 'paragraphEditor' ); |
41 | | - |
42 | | - // cancel all open editors |
43 | | - $.inlineEditor.basicEditor.cancelAll(); |
44 | | -} |
45 | | - |
46 | | -}; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.css |
— | — | @@ -1,40 +0,0 @@ |
2 | | -.paragraphEditor .paragraphEditorElement { |
3 | | - /* soft-blue background color to highlight editable paragraphs */ |
4 | | - background-color: #E4F0F9; |
5 | | - |
6 | | - /* create a hand cursor, cross-browser hack: http://www.quirksmode.org/css/cursor.html */ |
7 | | - cursor: pointer; |
8 | | - cursor: hand; |
9 | | - |
10 | | - /* add some space on the top and bottom to make sure they are spaced apart */ |
11 | | - margin: 0.5em 0; |
12 | | -} |
13 | | - |
14 | | -.paragraphEditor .paragraphEditorElement.edited { |
15 | | - /* have a yellow color to highlight edited elements, basically the orange color with the hue shifted */ |
16 | | - background-color: #F9F2A7; |
17 | | -} |
18 | | - |
19 | | -.paragraphEditor .paragraphEditorElement:hover { |
20 | | - /* indicate the paragraph to be edited with a darker color */ |
21 | | - background-color: #a7d7f9; |
22 | | -} |
23 | | - |
24 | | -.paragraphEditor .paragraphEditorElement.notEditing * { |
25 | | - /* make sure all the child elements inherit the background color */ |
26 | | - background-color: inherit !important; |
27 | | -} |
28 | | - |
29 | | -.paragraphEditor .editing { |
30 | | - /* keeping the custom padding and margin breaks in Webkit browsers */ |
31 | | - padding: 0px; |
32 | | - margin: 0px; |
33 | | - |
34 | | - /* reset the cursor when editing */ |
35 | | - cursor: auto; |
36 | | -} |
37 | | - |
38 | | -.paragraphEditor .paragraphEditorElement.lastEdit { |
39 | | - /* have an orange color, the exact complement of the hover color, for highlighting on preview/cancel */ |
40 | | - background-color: #f9c9a7; |
41 | | -} |
Index: trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.php |
— | — | @@ -17,16 +17,6 @@ |
18 | 18 | |
19 | 19 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
20 | 20 | |
21 | | -// credits |
22 | | -$wgExtensionCredits['other'][] = array( |
23 | | - 'path' => __FILE__, |
24 | | - 'name' => 'ParagraphEditor', |
25 | | - 'author' => array( 'Jan Paul Posma' ), |
26 | | - 'version' => '0.1.0', |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:InlineEditor#ParagraphEditor', |
28 | | - 'descriptionmsg' => 'paragraph-editor-desc', |
29 | | -); |
30 | | - |
31 | 21 | // current directory including trailing slash |
32 | 22 | $dir = dirname( __FILE__ ) . '/'; |
33 | 23 | |
— | — | @@ -35,9 +25,3 @@ |
36 | 26 | |
37 | 27 | // register hooks |
38 | 28 | $wgHooks['InlineEditorMark'][] = 'ParagraphEditor::mark'; |
39 | | -$wgHooks['InlineEditorDefineEditors'][] = 'ParagraphEditor::defineEditors'; |
40 | | - |
41 | | -// i18n messages |
42 | | -$wgExtensionMessagesFiles['ParagraphEditor'] = $dir . 'ParagraphEditor.i18n.php'; |
43 | | - |
44 | | -$wgInlineEditorParagraphEditorVisible = true; |
\ No newline at end of file |
Index: trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.class.php |
— | — | @@ -22,33 +22,9 @@ |
23 | 23 | // do not include the trailing newline |
24 | 24 | if ( substr( $match[0], -1 ) == "\n" ) $end--; |
25 | 25 | |
26 | | - $marking = new InlineEditorMarking( $start, $end, 'paragraphEditorElement', false ); |
27 | | - $marking->setPriority( 1 ); |
28 | | - $inlineEditorText->addMarking( $marking ); |
| 26 | + $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'paragraphEditorElement', true, true, 1 ) ); |
29 | 27 | } |
30 | 28 | |
31 | 29 | return true; |
32 | 30 | } |
33 | | - |
34 | | - /** |
35 | | - * Hooks into InlineEditorDefineEditors. Adds the option to to the list and adds CSS and JS files |
36 | | - * @param $editor InlineEditor |
37 | | - * @param $output OutputPage |
38 | | - */ |
39 | | - public static function defineEditors( &$editor, &$output ) { |
40 | | - global $wgExtensionAssetsPath, $wgInlineEditorParagraphEditorVisible; |
41 | | - |
42 | | - if( $wgInlineEditorParagraphEditorVisible ) { |
43 | | - $editor->addEditMode( |
44 | | - 'paragraphEditor', |
45 | | - wfMsgExt( 'paragraph-editor-editmode-caption', 'parseinline' ), |
46 | | - wfMsgExt( 'paragraph-editor-editmode-description', 'parseinline' ) |
47 | | - ); |
48 | | - |
49 | | - $output->addExtensionStyle( "$wgExtensionAssetsPath/InlineEditor/ParagraphEditor/ParagraphEditor.css?0" ); |
50 | | - $output->addScriptFile( "$wgExtensionAssetsPath/InlineEditor/ParagraphEditor/jquery.inlineEditor.editors.paragraphEditor.js?0" ); |
51 | | - } |
52 | | - |
53 | | - return true; |
54 | | - } |
55 | 31 | } |
Index: trunk/extensions/InlineEditor/InlineEditorRecommended.php |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * InlineEditor extension, recommended include file. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This is the recommended include file for the InlineEditor, which also loads a |
| 10 | + * lot of editing detecting extensions that are part of the InlineEditor. |
| 11 | + * |
| 12 | + * Usage: Add this line to LocalSettings.php: |
| 13 | + * require_once( "$IP/extensions/InlineEditor/InlineEditorRecommended.php" ); |
| 14 | + * |
| 15 | + * @author Jan Paul Posma <jp.posma@gmail.com> |
| 16 | + * @license GPL v2 or later |
| 17 | + * @version 0.0.0 |
| 18 | + */ |
| 19 | +require_once( dirname(__FILE__) . "/InlineEditor.php" ); |
| 20 | +require_once( dirname(__FILE__) . "/SentenceEditor/SentenceEditor.php" ); |
| 21 | +require_once( dirname(__FILE__) . "/ListEditor/ListEditor.php" ); |
| 22 | +require_once( dirname(__FILE__) . "/ReferenceEditor/ReferenceEditor.php" ); |
| 23 | +require_once( dirname(__FILE__) . "/MediaEditor/MediaEditor.php" ); |
| 24 | +require_once( dirname(__FILE__) . "/TemplateEditor/TemplateEditor.php" ); |
| 25 | +require_once( dirname(__FILE__) . "/ParagraphEditor/ParagraphEditor.php" ); |
| 26 | +require_once( dirname(__FILE__) . "/SectionEditor/SectionEditor.php" ); |
| 27 | +require_once( dirname(__FILE__) . "/FullEditor/FullEditor.php" ); |
Property changes on: trunk/extensions/InlineEditor/InlineEditorRecommended.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 28 | + native |
Index: trunk/extensions/InlineEditor/jquery.inlineEditor.js |
— | — | @@ -1,13 +1,10 @@ |
2 | 2 | /** |
3 | 3 | * Client side framework of the InlineEditor. Facilitates publishing, previewing, |
4 | | - * switching edit modes and undo/redo operations. |
| 4 | + * using specific editors, and undo/redo operations. |
5 | 5 | */ |
6 | 6 | ( function( $ ) { $.inlineEditor = { |
7 | 7 | editors: {}, |
8 | 8 | |
9 | | -editModes: [], |
10 | | -currentMode: '', |
11 | | - |
12 | 9 | states: [], |
13 | 10 | currentState: 0, |
14 | 11 | lastState: 0, |
— | — | @@ -52,7 +49,7 @@ |
53 | 50 | addNewState: function( request ) { |
54 | 51 | state = JSON.parse( request.responseText ); |
55 | 52 | |
56 | | - // restore the html to the current state, instantly remove the animations, |
| 53 | + // restore the html to the current state, instantly remove the lastEdit, |
57 | 54 | // and then add the new html |
58 | 55 | $( '#editContent' ).html( $.inlineEditor.states[$.inlineEditor.currentState].html ); |
59 | 56 | $( '.lastEdit' ).removeClass( 'lastEdit' ); |
— | — | @@ -83,12 +80,19 @@ |
84 | 81 | * Reloads the current editor and finish some things in the HTML. |
85 | 82 | */ |
86 | 83 | reload: function() { |
87 | | - // reload the current editor |
88 | | - $.inlineEditor.editors[$.inlineEditor.currentMode].reload(); |
| 84 | + $.inlineEditor.basicEditor.cancelAll(); |
89 | 85 | |
90 | | - // fade out all lastEdit elements |
91 | | - $('.lastEdit').removeClass( 'lastEdit', 800 ); |
| 86 | + // bind all events of the basic editor |
| 87 | + $.inlineEditor.basicEditor.bindEvents( $( '.inlineEditorElement' ) ); |
92 | 88 | |
| 89 | + // reload the specific editors |
| 90 | + for( var optionNr in $.inlineEditor.editors) { |
| 91 | + $.inlineEditor.editors[optionNr].reload(); |
| 92 | + } |
| 93 | + |
| 94 | + // remove all lastEdit elements |
| 95 | + $('.lastEdit').removeClass( 'lastEdit' ); |
| 96 | + |
93 | 97 | // make the links in the article unusable |
94 | 98 | $( '#editContent a' ).click( function( event ) { event.preventDefault(); } ); |
95 | 99 | }, |
— | — | @@ -147,57 +151,6 @@ |
148 | 152 | }, |
149 | 153 | |
150 | 154 | /** |
151 | | - * Checks if the mode radio button has changed and selects the new editor and description. |
152 | | - */ |
153 | | -changeMode: function( event ) { |
154 | | - // set the currently visible descriptions in the foreground to have them |
155 | | - // fade away nicely |
156 | | - $( '.editmode .descriptionInner' ).css( 'z-index', 2 ); |
157 | | - $( '.editmode .descriptionInner' ).fadeOut(300); |
158 | | - |
159 | | - // check for all options if they are selected |
160 | | - for( var optionNr in $.inlineEditor.editModes ) { |
161 | | - if( $.inlineEditor.editModes[optionNr] ) { |
162 | | - var option = $.inlineEditor.editModes[optionNr]; |
163 | | - |
164 | | - // if a certain option is selected, show the description |
165 | | - // and set the edit mode in #content, then exit this function as only |
166 | | - // one mode can be selected |
167 | | - if( $( '#radio-' + option ).attr( 'checked' ) ) { |
168 | | - // get the description, put it behind the currently visible description, |
169 | | - // and show it instantly |
170 | | - $description = $( '#description-' + option ); |
171 | | - $description.show(); |
172 | | - $description.css( 'z-index', 1 ); |
173 | | - |
174 | | - // resize the outer box to match the description height, also take in |
175 | | - // account the padding of the description box |
176 | | - $( '.editmode .descriptionOuter' ).animate( { |
177 | | - height: $description.height() + 15 |
178 | | - }, 600); |
179 | | - |
180 | | - // if we've actually switched, disable the previous editor and enable |
181 | | - // the new one |
182 | | - if( $.inlineEditor.currentMode != option ) { |
183 | | - if( $.inlineEditor.editors[$.inlineEditor.currentMode] ) { |
184 | | - $.inlineEditor.editors[$.inlineEditor.currentMode].disable(); |
185 | | - } |
186 | | - |
187 | | - $.inlineEditor.currentMode = option; |
188 | | - |
189 | | - if( $.inlineEditor.editors[$.inlineEditor.currentMode] ) { |
190 | | - $.inlineEditor.editors[$.inlineEditor.currentMode].enable(); |
191 | | - } |
192 | | - } |
193 | | - |
194 | | - // we've found the option to switch to, nothing to be done anymore |
195 | | - return; |
196 | | - } |
197 | | - } |
198 | | - } |
199 | | -}, |
200 | | - |
201 | | -/** |
202 | 155 | * Publishes the document in its current state. |
203 | 156 | */ |
204 | 157 | publish: function( event ) { |
— | — | @@ -206,7 +159,7 @@ |
207 | 160 | |
208 | 161 | // get the wikitext from the state as it's currently on the screen |
209 | 162 | var data = { |
210 | | - 'object': $.inlineEditor.states[$.inlineEditor.currentState].object, |
| 163 | + 'object': $.inlineEditor.states[$.inlineEditor.currentState].object |
211 | 164 | }; |
212 | 165 | var json = JSON.stringify( data ); |
213 | 166 | |
— | — | @@ -219,22 +172,10 @@ |
220 | 173 | * Initializes the editor. |
221 | 174 | */ |
222 | 175 | init : function() { |
223 | | - // make the edit mode radiobuttons clickable |
224 | | - $( '.optionMode' ).change( $.inlineEditor.changeMode ); |
225 | | - |
226 | 176 | $( '#publish' ).click( $.inlineEditor.publish ); |
227 | | - $( '#undo' ).click( $.inlineEditor.undo ); |
228 | | - $( '#redo' ).click( $.inlineEditor.redo ); |
| 177 | + //$( '#undo' ).click( $.inlineEditor.undo ); |
| 178 | + //$( '#redo' ).click( $.inlineEditor.redo ); |
229 | 179 | |
230 | | - // initially hide the descriptions, else things look messy because of the animation |
231 | | - $( '.editmode .descriptionInner' ).hide(); |
232 | | - |
233 | | - // open all our links in a new window except for switching to the full editor |
234 | | - $( '#siteNotice a[class!=fulleditor]' ).attr( 'target', '_blank' ); |
235 | | - |
236 | | - // check the current selected edit mode |
237 | | - $.inlineEditor.changeMode(); |
238 | | - |
239 | 180 | // reload the current editor |
240 | 181 | $.inlineEditor.reload(); |
241 | 182 | } |