r80717 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80716‎ | r80717 | r80718 >
Date:22:32, 21 January 2011
Author:janpaul123
Status:deferred
Tags:
Comment:
Completely new, more natural approach. Basic algorithm is unchanged. Removed a lot of files and lines of code, which is usually a good sign! :-)
Modified paths:
  • /trunk/extensions/InlineEditor/BasicEditor.css (added) (history)
  • /trunk/extensions/InlineEditor/FullEditor/FullEditor.class.php (replaced) (history)
  • /trunk/extensions/InlineEditor/FullEditor/FullEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/FullEditor/FullEditor.php (replaced) (history)
  • /trunk/extensions/InlineEditor/InlineEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditor.css (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditor.i18n.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditorBlocks.php (deleted) (history)
  • /trunk/extensions/InlineEditor/InlineEditorFunctional.php (deleted) (history)
  • /trunk/extensions/InlineEditor/InlineEditorMarking.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditorNode.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditorPiece.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/InlineEditorRecommended.php (added) (history)
  • /trunk/extensions/InlineEditor/InlineEditorText.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/ListEditor/ListEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/ListEditor/ListEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/ListEditor/ListEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/ListEditor/ListEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/ListEditor/jquery.inlineEditor.editors.listEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/MediaEditor/MediaEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/MediaEditor/MediaEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/MediaEditor/MediaEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/MediaEditor/MediaEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/MediaEditor/jquery.inlineEditor.editors.mediaEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/ParagraphEditor/ParagraphEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/ParagraphEditor/jquery.inlineEditor.editors.paragraphEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/ReferenceEditor/jquery.inlineEditor.editors.referenceEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/SectionEditor/SectionEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/SectionEditor/SectionEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/SectionEditor/SectionEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/SectionEditor/SectionEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/SectionEditor/jquery.inlineEditor.editors.sectionEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/ISentenceDetection.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/SentenceDetectionBasic.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/jquery.elastic.js (deleted) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/jquery.inlineEditor.editors.sentenceEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/SentenceEditor/jquery.textWidth.js (deleted) (history)
  • /trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.class.php (modified) (history)
  • /trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.css (deleted) (history)
  • /trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.i18n.php (deleted) (history)
  • /trunk/extensions/InlineEditor/TemplateEditor/TemplateEditor.php (modified) (history)
  • /trunk/extensions/InlineEditor/TemplateEditor/jquery.inlineEditor.editors.templateEditor.js (deleted) (history)
  • /trunk/extensions/InlineEditor/jquery.inlineEditor.basicEditor.js (modified) (history)
  • /trunk/extensions/InlineEditor/jquery.inlineEditor.js (modified) (history)
  • /trunk/extensions/InlineEditor/jquery.textWidth.js (deleted) (history)

Diff [purge]

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
1133 + native
Index: trunk/extensions/InlineEditor/InlineEditor.class.php
@@ -11,12 +11,11 @@
1212 const REASON_ADVANCED = 2; /// < reason is editing an 'advanced' page, whatever that may be
1313
1414 private $article; /// < Article object to edit
15 - private $editModes; /// < array of different edit modes, see addEditMode()
1615 private $extendedEditPage; /// < ExtendedEditPage object we're using to handle editor logic
1716
1817 /**
1918 * 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.
2120 */
2221 public static function mediaWikiPerformAction( $output, $article, $title, $user, $request, $wiki ) {
2322 global $wgHooks;
@@ -38,6 +37,7 @@
3938 return true;
4039 }
4140
 41+ // for now, ignore section edits and just edit the whole page
4242 unset( $_GET['section'] );
4343 unset( $_POST['section'] );
4444 $request->setVal( 'section', null );
@@ -141,7 +141,7 @@
142142 }
143143
144144 /**
145 - * Entry point for the 'Preview' function through Ajax.
 145+ * Entry point for the 'Preview' function through ajax.
146146 * No real point in securing this, as nothing is actually saved.
147147 * @param $json string JSON object from the client
148148 * @param $pageName string The page we're editing
@@ -182,7 +182,6 @@
183183 */
184184 public function __construct( $article ) {
185185 $this->article = $article;
186 - $editmodes = array();
187186 }
188187
189188 /**
@@ -208,7 +207,7 @@
209208 $text = new InlineEditorText( $this->article );
210209 }
211210
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
213212 $this->extendedEditPage = new ExtendedEditPage( $this->article );
214213 if ( $this->extendedEditPage->initInlineEditor() ) {
215214 // IMPORTANT: if the page was being saved, the script has been terminated by now!!
@@ -216,11 +215,11 @@
217216 // include the required JS and CSS files
218217 $output->includeJQuery();
219218 $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.elastic.js?0" );
220 - $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.textWidth.js?0" );
221219 $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.inlineEditor.js?0" );
222220 $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery.inlineEditor.basicEditor.js?0" );
223221 $output->addScriptFile( $wgExtensionAssetsPath . "/InlineEditor/jquery-ui-effects-1.8.4.min.js?0" );
224222 $output->addExtensionStyle( $wgExtensionAssetsPath . "/InlineEditor/InlineEditor.css?0" );
 223+ $output->addExtensionStyle( $wgExtensionAssetsPath . "/InlineEditor/BasicEditor.css?0" );
225224
226225 // have the different kind of editors register themselves
227226 wfRunHooks( 'InlineEditorDefineEditors', array( &$this, &$output ) );
@@ -236,20 +235,19 @@
237236 $output->addParserOutput( $parserOutput );
238237 $output->setPageTitle( $parserOutput->getTitleText() );
239238
 239+ // convert the text object into an initial state to send
240240 $initial = InlineEditorText::initialState( $text );
241241
 242+ // store the actual object in the session, as it can be quite large
242243 $objectID = (isset($_SESSION['inline-editor-id']) ? $_SESSION['inline-editor-id'] + 1 : 0);
243244 $_SESSION['inline-editor-id'] = $objectID;
244245 $_SESSION['inline-editor-object-' . $objectID] = $initial['object'];
245246 $initial['object'] = $objectID;
246 -
247 - $initialJSON = FormatJson::encode( $initial );
248247
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 );
250250 $output->addInlineScript(
251251 'jQuery( document ).ready( function() {
252 - jQuery.inlineEditor.editModes = ["' . implode( '","', array_keys( $this->editModes ) ) . '"];
253 - jQuery.inlineEditor.currentMode = "' . reset( $this->editModes ) . '";
254252 jQuery.inlineEditor.addInitialState( ' . $initialJSON . ' );
255253 jQuery.inlineEditor.init();
256254 } );'
@@ -279,19 +277,26 @@
280278 * @return string
281279 */
282280 public function preview ( $json ) {
 281+ // decode the JSON
283282 $request = FormatJson::decode( $json, true );
284283
 284+ // add the actual object from session, as it's quite big
285285 $request['object'] = $_SESSION['inline-editor-object-' . $request['object']];
286286
 287+ // load the JSON to a text object and perform the edit
287288 $text = InlineEditorText::restoreObject( $request, $this->article );
288289 $text->doEdit( $request['lastEdit']['id'], $request['lastEdit']['text'] );
289290
 291+ // get the next state
290292 $subseq = InlineEditorText::subsequentState( $text );
 293+
 294+ // save the object to a new unique key in the session
291295 $objectID = (isset($_SESSION['inline-editor-id']) ? $_SESSION['inline-editor-id'] + 1 : 0);
292296 $_SESSION['inline-editor-id'] = $objectID;
293297 $_SESSION['inline-editor-object-' . $objectID] = $subseq['object'];
294298 $subseq['object'] = $objectID;
295299
 300+ // send back the JSON
296301 return FormatJson::encode( $subseq );
297302 }
298303
@@ -300,26 +305,11 @@
301306 * @param $siteNotice string
302307 */
303308 public function siteNoticeBefore( &$siteNotice ) {
304 - $siteNotice = $this->renderEditBox() . $this->renderEditModes();
 309+ $siteNotice = $this->renderEditBox();
305310 return false;
306311 }
307312
308313 /**
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 - /**
324314 * Generates "Edit box" (the first one)
325315 * This looks like this:
326316 * <div class="editbox">
@@ -335,7 +325,9 @@
336326 * inline-editor-editbox-publish-notice
337327 * <div class="terms">inline-editor-editbox-publish-terms</div>
338328 * </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+ *
340332 * @return string HTML
341333 */
342334 private function renderEditBox() {
@@ -369,68 +361,9 @@
370362 }
371363
372364 /**
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 - /**
432365 * Make sure the entire page rerenders when rendering a reference.
433366 *
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
435368 * be included in other extensions as well. In the future, something smarter should be
436369 * implemented, to be able to only rerender the dependencies and not the entire page.
437370 *
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 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,7 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
1919 foreach ( $matches[0] as $match ) {
2020 $start = $match[1];
2121 $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 ) );
2323 }
2424
2525 return true;
2626 }
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 - }
4727 }
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 @@
1010 *
1111 * Usage: Include the following line in your LocalSettings.php
1212 * require_once( "$IP/extensions/InlineEditor/ListEditor/ListEditor.php" );
13 - *
 13+ *
1414 * @author Jan Paul Posma <jp.posma@gmail.com>
1515 * @license GPL v2 or later
1616 * @version 0.0.0
@@ -17,16 +17,6 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,7 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
2323 // do not include the trailing newline
2424 if ( substr( $match[0], -1 ) == "\n" ) $end--;
2525
26 - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'listEditorElement', false ) );
 26+ $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'listEditorElement', true, false ) );
2727 }
2828
2929 return true;
3030 }
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 - }
5131 }
Index: trunk/extensions/InlineEditor/InlineEditorText.class.php
@@ -18,7 +18,7 @@
1919 private $article; /// < article object for parsing
2020 private $markings; /// < array of InlineEditorMarking objects
2121 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
2323 private $changedNode; /// < Node which should be rendered when doing a partial rendering
2424 private $root; /// < Root of the tree where the markings are arranged in
2525
@@ -50,7 +50,7 @@
5151 * Before and after partial rendering hooks are called (InlineEditorPartialBeforeParse and
5252 * InlineEditorPartialAfterParse), to have the ability to terminate in the case something in
5353 * the partial rendering has a dependency elsewhere on the page. In this case, the entire page
54 - * is rerendered.
 54+ * is re-rendered.
5555 *
5656 * @return array An array with the id of the object to replace, and the html to replace it with
5757 */
@@ -98,7 +98,7 @@
9999 }
100100
101101 /**
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.
103103 * @param $marking InlineEditorMarking
104104 */
105105 public function addMarking( InlineEditorMarking $marking ) {
@@ -144,7 +144,7 @@
145145 }
146146
147147 // 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
149149 $editMarking->addClasses( array( 'edited', 'lastEdit' ) );
150150
151151 // store a copy of the edited marking to denote the range of changed wikitext
@@ -156,7 +156,7 @@
157157 unset( $this->markings );
158158
159159 // 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
161161 foreach( $this->previous as $marking ) {
162162 $marking->removeClass( 'lastEdit' );
163163 }
@@ -225,16 +225,16 @@
226226 * depending on the sorting conditions, which are start position (asc), length (desc)
227227 * and class names (asc).
228228 * 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
230230 * occurs, $this->editedPiece grows to include the mismatch, because it needs to be
231 - * rerendered.
 231+ * re-rendered.
232232 */
233233 protected function matchPreviousMarkings() {
234234 // abort if there is nothing to match
235235 if( empty( $this->previous ) ) return;
236236
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
239239 usort( $this->previous, 'InlineEditorText::sortByStartAndLength' );
240240
241241 // point to the start of the previous markings list
@@ -299,7 +299,7 @@
300300 $root = new InlineEditorRoot( $this->wikiOriginal );
301301
302302 // $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
304304 $workingNode = $root;
305305
306306 foreach( $markingsSorted as $marking ) {
@@ -372,6 +372,7 @@
373373 * Sort function which sorts markings - in this particular order - on:
374374 * - start position (asc)
375375 * - length (desc)
 376+ * - level (desc)
376377 * - class name (asc)
377378 * @param $a InlineEditorMarking
378379 * @param $b InlineEditorMarking
@@ -380,11 +381,11 @@
381382 private static function sortByStartAndLength( $a, $b ) {
382383 if( $a->getStart() == $b->getStart() ) {
383384 if( $a->getLength() == $b->getLength() ) {
384 - if( $a->getPriority() == $b->getPriority() ) {
 385+ if( $a->getLevel() == $b->getLevel() ) {
385386 return strcmp( $a->getClass(), $b->getClass() );
386387 }
387388 else {
388 - return ( $a->getPriority() > $b->getPriority() ? -1 : 1 );
 389+ return ( $a->getLevel() > $b->getLevel() ? -1 : 1 );
389390 }
390391 }
391392 else {
@@ -399,7 +400,7 @@
400401 /**
401402 * Serialize by doing a normal serialization of the original wikitext, the markings
402403 * 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.
404405 */
405406 public function serialize() {
406407 return base64_encode( serialize( array(
Index: trunk/extensions/InlineEditor/InlineEditorNode.class.php
@@ -12,7 +12,7 @@
1313 * @param $marking InlineEditorMarking Marking to wrap in the tree
1414 */
1515 public function __construct( &$wiki, InlineEditorMarking $marking ) {
16 - parent::__construct( $wiki );
 16+ parent::__construct( &$wiki );
1717 $this->marking = $marking;
1818 }
1919
@@ -55,7 +55,7 @@
5656 public function getParent() {
5757 return $this->parent;
5858 }
59 -
 59+
6060 /**
6161 * Render the start tag by calling the corresponding marking.
6262 * @return string HTML
Index: trunk/extensions/InlineEditor/InlineEditorPiece.class.php
@@ -1,9 +1,9 @@
22 <?php
33 /**
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
66 * getStart() and getEnd(), and then things like getLength(), equals(), etc. are provided
7 - * as a convenience.
 7+ * for your convenience.
88 */
99 abstract class InlineEditorPiece {
1010 /**
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 @@
3232 if ( $namespace == NS_FILE ) {
3333 $start = $match[1];
3434 $end = $start + strlen( $match[0] );
35 - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'mediaEditorElement', false ) );
 35+ $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'mediaEditorElement', true, false ) );
3636 }
3737 }
3838
3939 return true;
4040 }
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 - }
6141 }
Index: trunk/extensions/InlineEditor/MediaEditor/MediaEditor.php
@@ -17,16 +17,6 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,7 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
66 * and whether or not it has been matched before.
77 */
88 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
1011 protected static $lastId = 0; /// < counter which is used to generate unique ids
1112
1213 protected $start; /// < start position of the marking in the wikitext
1314 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
1618 protected $id; /// < id in the original text; this will be unique even when calculating new ids!
1719 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
1921
20 - public function setPriority( $value ) {
21 - $this->priority = $value;
22 - }
23 -
24 - public function getPriority() {
25 - return $this->priority;
26 - }
27 -
2822 /**
2923 * @param $start int Start of the marking, offset in number of characters from the begin of the wikitext
3024 * @param $end int End of the marking, offset in number of characters from the begin of the wikitext
3125 * @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
3329 */
34 - function __construct( $start, $end, $classes, $inline ) {
 30+ function __construct( $start, $end, $classes, $block, $bar, $level = 0 ) {
3531 $this->start = $start;
3632 $this->end = $end;
37 - $this->inline = $inline;
 33+ $this->block = $block;
 34+ $this->bar = $bar;
 35+ $this->level = $level;
 36+
 37+ $this->matched = true;
3838 $this->id = self::uniqueId();
39 - $this->matched = true;
4039
4140 $this->classes = array();
4241 $this->addClasses( $classes );
43 - $this->priority = 0;
 42+
4443 }
4544
4645 /**
@@ -126,6 +125,9 @@
127126 // exclude the default classes that are always included
128127 $classes = array_diff( $classes, self::getDefaultClassesArray() );
129128
 129+ // also exclude classes that are automatically included
 130+ $classes = array_diff( $classes, self::getAutoClassesArray() );
 131+
130132 // merge with the current classes and remove duplicates
131133 $this->classes = array_unique( array_merge( $this->classes, $classes ) );
132134 }
@@ -149,6 +151,9 @@
150152 // exclude the default classes that are always included
151153 $classes = array_diff( $classes, self::getDefaultClassesArray() );
152154
 155+ // also exclude classes that are automatically included
 156+ $classes = array_diff( $classes, self::getAutoClassesArray() );
 157+
153158 // save the difference between the existing classes and the classes we're removing
154159 $this->classes = array_diff( $this->classes, $classes );
155160 }
@@ -171,6 +176,22 @@
172177 }
173178
174179 /**
 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+ /**
175196 * Overrides InlineEditorPiece to be able to check for equality between markings,
176197 * where also classes are compared. This also adds the ability to ignore certain
177198 * classes when comparing (such as classes for what has been edited, etc.)
@@ -192,8 +213,8 @@
193214 }
194215
195216 /**
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.
198219 * @return string HTML
199220 */
200221 public function renderStartTag() {
@@ -202,7 +223,7 @@
203224 }
204225
205226 /**
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.
207228 * @return string HTML
208229 */
209230 public function renderEndTag() {
@@ -211,19 +232,22 @@
212233
213234 /**
214235 * 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'.
216238 * @return string Space separated classes
217239 */
218240 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' );
220244 }
221245
222246 /**
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
225249 */
226250 protected function getNewline() {
227 - return $this->inline ? '' : "\n";
 251+ return $this->block ? "\n": '';
228252 }
229253
230254 /**
@@ -233,6 +257,14 @@
234258 protected static function getDefaultClassesArray() {
235259 return explode( ' ', self::defaultClasses );
236260 }
 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+ }
237269
238270 /**
239271 * Get a unique id by using self::$lastId and incrementing it.
@@ -252,7 +284,7 @@
253285
254286 /**
255287 * 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()
257289 */
258290 public static function setUniqueIdState( $state ) {
259291 if( $state > self::$lastId ) self::$lastId = $state;
Index: trunk/extensions/InlineEditor/InlineEditor.i18n.php
@@ -22,7 +22,6 @@
2323 'inline-editor-editbox-publish-terms' => 'When you click "Publish", you agree with our copyright policy.
2424 See $1 for more information.',
2525 'inline-editor-editbox-publish-caption' => 'Publish',
26 - 'inline-editor-editmodes-caption' => 'Edit mode:',
2726 'inline-editor-redirect-browser' => 'The new editing interface is not supported by your browser.',
2827 'inline-editor-redirect-advanced' => "Editing this page is considered '''advanced''' use of {{SITENAME}}.
2928 You can only use the '''full editor''' for this page.",
@@ -30,23 +29,36 @@
3130 'inline-editor-editmodes-redo' => 'Redo',
3231 );
3332
34 -/** Dutch / Nederlands
 33+/** Language descriptions
3534 * @author Jan Paul Posma
3635 */
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.',
3964
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',
5365 );
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 @@
1919 foreach ( $matches[0] as $match ) {
2020 $start = $match[1];
2121 $end = $start + strlen( $match[0] );
22 - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'referenceEditorElement', true ) );
 22+ $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, 'referenceEditorElement', false, false ) );
2323 }
2424
2525 return true;
2626 }
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 - }
4727 }
Index: trunk/extensions/InlineEditor/ReferenceEditor/ReferenceEditor.php
@@ -17,16 +17,6 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,7 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
55 ( function( $ ) { $.inlineEditor.basicEditor = {
66
77 /**
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.
109 */
1110 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
2112 var $newField = $( '<' + $field.get(0).nodeName + '/>' );
22 - $newField.addClass( $field.attr('class' ) );
23 - $newField.removeClass( 'notEditing' );
2413 $newField.addClass( 'editing' );
25 - $newField.append( $orig );
2614
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
2922 $field.after( $newField );
30 - $field.remove();
31 -
3223 return $newField;
3324 },
3425
3526 /**
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 -/**
4827 * Adds an edit bar to the field with preview and cancel functionality.
4928 */
50 -addEditBar: function( $newSpan, width, wiki ) {
 29+addEditBar: function( $newSpan, wiki ) {
5130 // build the input field
52 - var $input = $( '<textarea style="width: ' + (width-65-65-10) + 'px;"></textarea>' );
 31+ var $input = $( '<textarea></textarea>' );
5332 $input.text( wiki );
5433
5534 // 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"/>' );
5837 $preview.click( $.inlineEditor.basicEditor.preview );
5938 $cancel.click( $.inlineEditor.basicEditor.cancel );
6039
 40+ // build a div for the buttons
 41+ var $buttons = $( '<div class="buttons"></div> ');
 42+ $buttons.append( $preview );
 43+ $buttons.append( $cancel );
 44+
6145 // 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>' );
6347 $editBar.append( $input );
64 - $editBar.append( $preview );
65 - $editBar.append( $cancel );
 48+ $editBar.append( $buttons );
6649
6750 // append the edit bar to the new span
6851 $newSpan.append( $editBar );
@@ -79,17 +62,23 @@
8063 * Default click handler for simple editors. Recommended to override.
8164 */
8265 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
8866 var $field = $(this);
89 - var wiki = $.inlineEditor.getTextById( $field.attr( 'id' ) );
90 - var width = $.inlineEditor.basicEditor.fieldWidth( $field );
9167
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+ }
9483 },
9584
9685 /**
@@ -100,24 +89,22 @@
10190 event.stopPropagation();
10291 event.preventDefault();
10392
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();
10695
10796 // find the span with the original value
108 - var $orig = $span.children('.orig');
 97+ var $orig = $span.data( 'orig' );
10998
11099 // convert the span to it's original state
111100 $orig.removeClass( 'orig' );
 101+ $orig.removeClass( 'hover' );
112102
113103 // place the original span after the current span and remove the current span
114 - // editing the current span is buggy in Webkit browsers
115104 $span.after( $orig );
116105 $span.remove();
117106
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();
122109 },
123110
124111 /**
@@ -128,8 +115,8 @@
129116 event.stopPropagation();
130117 event.preventDefault();
131118
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();
134121
135122 // the element is one level above the editbar
136123 var $element = $editbar.parent();
@@ -137,30 +124,56 @@
138125 // add a visual indicator to show the preview is loading
139126 $element.addClass( 'saving' );
140127 var $overlay = $( '<div class="overlay"><div class="alpha"></div><img class="spinner" src="' + wgScriptPath + '/extensions/InlineEditor/ajax-loader.gif"/></div>' );
 128+ $editbar.after( $overlay );
141129
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 -
150130 // get the edited text and the id to save it to
151131 text = $editbar.children( 'textarea' ).val();
152 - id = $element.children( '.orig' ).attr( 'id' );
 132+ id = $element.data( 'orig' ).attr( 'id' );
153133
154134 // let the inlineEditor framework handle the preview
155135 $.inlineEditor.previewTextById( text, id );
156136 },
157137
158138 /**
159 - * Cancel all basic editors. Recommended to call when switching edit modes.
 139+ * Cancel all basic editors.
160140 */
161141 cancelAll: function() {
162142 $('.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+ }
163178 }
164179
165180 }; } ) ( 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
129 + 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
122 + native
Index: trunk/extensions/InlineEditor/InlineEditor.php
@@ -1,19 +1,14 @@
22 <?php
33 /**
4 - * InlineEditor extension.
 4+ * InlineEditor extension, basic include file.
55 *
66 * @file
77 * @ingroup Extensions
88 *
99 * This is the include file for the InlineEditor.
1010 *
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" );
1813 *
1914 * @author Jan Paul Posma <jp.posma@gmail.com>
2015 * @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 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,9 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
2424 $end = $match[1]-1;
2525 $prevPos = $match[1];
2626
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 ) );
3028 }
3129
3230 return true;
3331 }
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 - }
5632 }
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,'&amp;').replace(/ /g,'&nbsp;').replace(/<|>/g,'&gt;').replace(/\n/g,'<br />');var twinContent=$twin.html();if(textareaContent+'&nbsp;'!=twinContent){$twin.html(textareaContent+'&nbsp;');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 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -37,10 +27,6 @@
3828
3929 // register hooks
4030 $wgHooks['InlineEditorMark'][] = 'SentenceEditor::mark';
41 -$wgHooks['InlineEditorDefineEditors'][] = 'SentenceEditor::defineEditors';
4231
43 -// i18n messages
44 -$wgExtensionMessagesFiles['SentenceEditor'] = $dir . 'SentenceEditor.i18n.php';
45 -
4632 // default settings
4733 $wgSentenceEditorDetectionDefault = 'SentenceDetectionBasic';
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/SentenceDetectionBasic.class.php
@@ -1,8 +1,9 @@
22 <?php
33
44 /**
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.
78 */
89 class SentenceDetectionBasic implements ISentenceDetection {
910 private $wikiTexts;
@@ -15,7 +16,11 @@
1617 $this->wikiTexts[] = array( 'text' => $text, 'offset' => $offset );
1718 }
1819
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 ) {
2025 foreach ( $this->wikiTexts as $wikiText ) {
2126 $sentences = preg_split( "/(?<!\..|\...|\....)([\?\!\.]+)\s(?!.\.|..\.|...\.)/u", $wikiText['text'], -1,
2227 PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_DELIM_CAPTURE );
@@ -27,7 +32,7 @@
2833 }
2934 $start = $wikiText['offset'] + $sentence[1];
3035 $end = $start + strlen( $sentence[0] );
31 - $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, $class, $inline ) );
 36+ $inlineEditorText->addMarking( new InlineEditorMarking( $start, $end, $class, $block, $bar ) );
3237 }
3338 }
3439 }
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceDetection/ISentenceDetection.class.php
@@ -18,7 +18,8 @@
1919 * All the sentences and their offsets have to be added as markings to $inlineEditorText.
2020 * @param $inlineEditorText InlineEditorText Object the markings should be added to
2121 * @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
2324 */
24 - public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $inline );
 25+ public function addMarkingsToText( InlineEditorText &$inlineEditorText, $class, $block, $bar );
2526 }
Index: trunk/extensions/InlineEditor/SentenceEditor/SentenceEditor.class.php
@@ -38,32 +38,12 @@
3939
4040 // have the detection class add the markings to the InlineEditorText object,
4141 // class 'sentenceEditorElement', inline elements
42 - $detection->addMarkingsToText( $inlineEditorText, 'sentenceEditorElement', true );
 42+ $detection->addMarkingsToText( $inlineEditorText, 'sentenceEditorElement', false, false );
4343
4444 return true;
4545 }
4646
4747 /**
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 - /**
6848 * Replaces all occurences of unsupported wikitext by spaces. This is to make sure the
6949 * positions of what's left are still the same as those in the original wikitext
7050 * @param $wikitext string
Index: trunk/extensions/InlineEditor/InlineEditor.css
@@ -180,91 +180,3 @@
181181 top: 0px;
182182 left: 0px;
183183 }
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 @@
1818
1919 if ( !defined( 'MEDIAWIKI' ) ) die();
2020
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 -
3121 // current directory including trailing slash
3222 $dir = dirname( __FILE__ ) . '/';
3323
@@ -35,9 +25,3 @@
3626
3727 // register hooks
3828 $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 @@
2323 // do not include the trailing newline
2424 if ( substr( $match[0], -1 ) == "\n" ) $end--;
2525
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 ) );
2927 }
3028
3129 return true;
3230 }
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 - }
5531 }
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
128 + native
Index: trunk/extensions/InlineEditor/jquery.inlineEditor.js
@@ -1,13 +1,10 @@
22 /**
33 * 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.
55 */
66 ( function( $ ) { $.inlineEditor = {
77 editors: {},
88
9 -editModes: [],
10 -currentMode: '',
11 -
129 states: [],
1310 currentState: 0,
1411 lastState: 0,
@@ -52,7 +49,7 @@
5350 addNewState: function( request ) {
5451 state = JSON.parse( request.responseText );
5552
56 - // restore the html to the current state, instantly remove the animations,
 53+ // restore the html to the current state, instantly remove the lastEdit,
5754 // and then add the new html
5855 $( '#editContent' ).html( $.inlineEditor.states[$.inlineEditor.currentState].html );
5956 $( '.lastEdit' ).removeClass( 'lastEdit' );
@@ -83,12 +80,19 @@
8481 * Reloads the current editor and finish some things in the HTML.
8582 */
8683 reload: function() {
87 - // reload the current editor
88 - $.inlineEditor.editors[$.inlineEditor.currentMode].reload();
 84+ $.inlineEditor.basicEditor.cancelAll();
8985
90 - // fade out all lastEdit elements
91 - $('.lastEdit').removeClass( 'lastEdit', 800 );
 86+ // bind all events of the basic editor
 87+ $.inlineEditor.basicEditor.bindEvents( $( '.inlineEditorElement' ) );
9288
 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+
9397 // make the links in the article unusable
9498 $( '#editContent a' ).click( function( event ) { event.preventDefault(); } );
9599 },
@@ -147,57 +151,6 @@
148152 },
149153
150154 /**
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 -/**
202155 * Publishes the document in its current state.
203156 */
204157 publish: function( event ) {
@@ -206,7 +159,7 @@
207160
208161 // get the wikitext from the state as it's currently on the screen
209162 var data = {
210 - 'object': $.inlineEditor.states[$.inlineEditor.currentState].object,
 163+ 'object': $.inlineEditor.states[$.inlineEditor.currentState].object
211164 };
212165 var json = JSON.stringify( data );
213166
@@ -219,22 +172,10 @@
220173 * Initializes the editor.
221174 */
222175 init : function() {
223 - // make the edit mode radiobuttons clickable
224 - $( '.optionMode' ).change( $.inlineEditor.changeMode );
225 -
226176 $( '#publish' ).click( $.inlineEditor.publish );
227 - $( '#undo' ).click( $.inlineEditor.undo );
228 - $( '#redo' ).click( $.inlineEditor.redo );
 177+ //$( '#undo' ).click( $.inlineEditor.undo );
 178+ //$( '#redo' ).click( $.inlineEditor.redo );
229179
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 -
239180 // reload the current editor
240181 $.inlineEditor.reload();
241182 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r80731Followup to r80717: fixed some browser bugs, added some nice collapsing funct...janpaul12323:48, 21 January 2011

Status & tagging log