diff --git a/WikiEditor.hooks.php b/WikiEditor.hooks.php index 9226baaf..71ffdaa5 100644 --- a/WikiEditor.hooks.php +++ b/WikiEditor.hooks.php @@ -84,21 +84,6 @@ class WikiEditorHooks { 'ext.wikiEditor.preview', ), ), - 'previewDialog' => array( - 'preferences' => array( - 'wikieditor-previewDialog' => array( - 'type' => 'toggle', - 'label-message' => 'wikieditor-previewDialog-preference', - 'section' => 'editing/labs', - ), - ), - 'requirements' => array( - 'wikieditor-previewDialog' => true, - ), - 'modules' => array( - 'ext.wikiEditor.previewDialog', - ), - ), 'publish' => array( 'preferences' => array( 'wikieditor-publish' => array( diff --git a/WikiEditor.php b/WikiEditor.php index df36911e..4d3afc91 100644 --- a/WikiEditor.php +++ b/WikiEditor.php @@ -30,8 +30,6 @@ $GLOBALS['wgWikiEditorFeatures'] = array( // Adds a tab for previewing in-line 'preview' => array( 'global' => false, 'user' => true ), - // Adds a button for previewing in a dialog - 'previewDialog' => array( 'global' => false, 'user' => false ), // Adds a button and dialog for step-by-step publishing 'publish' => array( 'global' => false, 'user' => true ), ); @@ -119,14 +117,6 @@ $GLOBALS['wgResourceModules'] += array( 'styles' => 'jquery.wikiEditor.preview.css', 'dependencies' => 'jquery.wikiEditor', ), - 'jquery.wikiEditor.previewDialog' => $wikiEditorTpl + array( - 'scripts' => 'jquery.wikiEditor.previewDialog.js', - 'styles' => 'jquery.wikiEditor.previewDialog.css', - 'dependencies' => array( - 'jquery.wikiEditor', - 'jquery.wikiEditor.dialogs', - ), - ), 'jquery.wikiEditor.publish' => $wikiEditorTpl + array( 'scripts' => 'jquery.wikiEditor.publish.js', 'dependencies' => array( @@ -384,18 +374,6 @@ $GLOBALS['wgResourceModules'] += array( 'wikieditor-preview-loading', ), ), - 'ext.wikiEditor.previewDialog' => $wikiEditorTpl + array( - 'scripts' => 'ext.wikiEditor.previewDialog.js', - 'dependencies' => array( - 'ext.wikiEditor', - 'jquery.wikiEditor.previewDialog', - ), - 'messages' => array( - 'wikieditor-previewDialog-preference', - 'wikieditor-previewDialog-tab', - 'wikieditor-previewDialog-loading', - ), - ), 'ext.wikiEditor.publish' => $wikiEditorTpl + array( 'scripts' => 'ext.wikiEditor.publish.js', 'dependencies' => array( diff --git a/i18n/en.json b/i18n/en.json index 5d4ae479..221bde59 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -12,9 +12,6 @@ "wikieditor-preview-tab": "Preview", "wikieditor-preview-changes-tab": "Changes", "wikieditor-preview-loading": "Loading...", - "wikieditor-previewDialog-preference": "Enable preview dialog", - "wikieditor-previewDialog-tab": "Preview", - "wikieditor-previewDialog-loading": "Loading...", "wikieditor-publish-preference": "Enable step-by-step publishing", "wikieditor-publish-button-publish": "Publish", "wikieditor-publish-button-cancel": "Cancel", diff --git a/i18n/qqq.json b/i18n/qqq.json index 0451dee8..bb4beece 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -30,8 +30,6 @@ "wikieditor-preview-tab": "Caption of the tab containing the preview\n\n{{Identical|Preview}}", "wikieditor-preview-changes-tab": "Caption of the tab containing a diff of the user's changes, à la ''{{int:Showdiff}}'' ({{msg-mw|Showdiff|notext=1}}).\n\n{{Identical|Change}}", "wikieditor-preview-loading": "Alt text for spinner displayed while preview is being loaded\n{{Identical|Loading}}", - "wikieditor-previewDialog-tab": "Caption of the tab containing the preview\n\n{{Identical|Preview}}", - "wikieditor-previewDialog-loading": "Alt text for spinner displayed while preview is being loaded\n{{Identical|Loading}}", "wikieditor-publish-preference": "Option in [[Special:Preferences]], tab ''{{int:prefs-editing}}''", "wikieditor-publish-button-publish": "Button to the right of the Edit/Preview tabs that opens a dialog window that lets the user save their edit\n\n{{Identical|Publish}}", "wikieditor-publish-button-cancel": "Button to the right of the Edit/Preview tabs that has the same effect as the {{msg-mw|Cancel}} link below the edit box.\n\n{{Identical|Cancel}}", diff --git a/modules/ext.wikiEditor.previewDialog.js b/modules/ext.wikiEditor.previewDialog.js deleted file mode 100644 index 3b1acd7c..00000000 --- a/modules/ext.wikiEditor.previewDialog.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * JavaScript for WikiEditor Preview Dialog - */ -jQuery( document ).ready( function ( $ ) { - // Add preview module - $( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'previewDialog' ); -} ); diff --git a/modules/jquery.wikiEditor.previewDialog.css b/modules/jquery.wikiEditor.previewDialog.css deleted file mode 100644 index f66773b0..00000000 --- a/modules/jquery.wikiEditor.previewDialog.css +++ /dev/null @@ -1,39 +0,0 @@ -/** - * CSS for WikiEditor Preview Dialog jQuery plugin - */ - -/* FIXME: This only works for the first wikiEditor on the page! */ -#wikiEditor-0-preview-dialog .wikiEditor-ui-loading { - background: #f3f3f3; - z-index: 10; - position: absolute; - left: 0; - text-align: center; - height: 100%; - width: 100%; - overflow: hidden; - border: none; -} - -/* FIXME: This only works for the first wikiEditor on the page! */ -#wikiEditor-0-preview-dialog .wikiEditor-ui-loading span { - display: block; - height: 24px; - width: 24px; - /* @embed */ - background: url(images/toolbar/loading.gif) 0 0 no-repeat; - text-indent: -9999px; - margin: 50px auto; -} - -.ui-dialog .ui-dialog-buttonpane { - margin: 0 !important; -} - -.wikiEditor-preview-dialog-contents { - font-size: 0.9em !important; -} - -.wikiEditor-preview-dialog-contents #firstHeading { - font-size: 2.1em; -} diff --git a/modules/jquery.wikiEditor.previewDialog.js b/modules/jquery.wikiEditor.previewDialog.js deleted file mode 100644 index 34f38e30..00000000 --- a/modules/jquery.wikiEditor.previewDialog.js +++ /dev/null @@ -1,132 +0,0 @@ -/* Publish module for wikiEditor */ -/*jshint onevar:false */ -( function ( $, mw ) { $.wikiEditor.modules.previewDialog = { - -/** - * Compatability map - */ -'browsers': { - // Left-to-right languages - 'ltr': { - 'msie': [['>=', 7]], - 'firefox': [['>=', 3]], - 'opera': [['>=', 9.6]], - 'safari': [['>=', 4]] - }, - // Right-to-left languages - 'rtl': { - 'msie': [['>=', 8]], - 'firefox': [['>=', 3]], - 'opera': [['>=', 9.6]], - 'safari': [['>=', 4]] - } -}, -/** - * Internally used functions - */ -fn: { - /** - * Creates a publish module within a wikiEditor - * @param context Context object of editor to create module in - * @param config Configuration object to create module from - */ - create: function ( context ) { - // Build the dialog behind the Publish button - var dialogID = 'wikiEditor-' + context.instance + '-preview-dialog'; - $.wikiEditor.modules.dialogs.fn.create( - context, - { - preview: { - id: dialogID, - titleMsg: 'wikieditor-preview-tab', - html: '\ -
\ -
\ - ', - init: function () { - }, - dialog: { - buttons: { - 'wikieditor-publish-dialog-publish': function () { - var minorChecked = $( '#wikiEditor-' + context.instance + - '-dialog-minor' ).is( ':checked' ) ? - 'checked' : ''; - var watchChecked = $( '#wikiEditor-' + context.instance + - '-dialog-watch' ).is( ':checked' ) ? - 'checked' : ''; - $( '#wpMinoredit' ).attr( 'checked', minorChecked ); - $( '#wpWatchthis' ).attr( 'checked', watchChecked ); - $( '#wpSummary' ).val( $( '#wikiEditor-' + context.instance + - '-dialog-summary' ).val() ); - $( '#editform' ).submit(); - }, - 'wikieditor-publish-dialog-goback': function () { - $( this ).dialog( 'close' ); - } - }, - resizable: false, - height: $( 'body' ).height() - 100, - width: $( 'body' ).width() - 300, - position: ['center', 'top'], - open: function () { - // Gets the latest copy of the wikitext - var wikitext = context.fn.getContents(); - var $dialog = $( '#' + dialogID ); - $dialog - .css( 'position', 'relative' ) - .css( 'height', $( 'body' ).height() - 200 ) - .parent() - .css( 'top', '25px' ); - // $dialog.dialog( 'option', 'width', $( 'body' ).width() - 300 ); - // Aborts when nothing has changed since the last preview - if ( context.modules.preview.previewText === wikitext ) { - return; - } - - $dialog.find( '.wikiEditor-preview-dialog-contents' ).empty(); - $dialog.find( '.wikiEditor-ui-loading' ).show(); - $.post( - mw.util.wikiScript( 'api' ), - { - 'action': 'parse', - 'title': mw.config.get( 'wgPageName' ), - 'text': wikitext, - 'prop': 'text', - 'pst': '', - 'format': 'json' - }, - function ( data ) { - if ( - typeof data.parse === 'undefined' || - typeof data.parse.text === 'undefined' || - typeof data.parse.text['*'] === 'undefined' - ) { - return; - } - context.modules.preview.previewText = wikitext; - $dialog.find( '.wikiEditor-ui-loading' ).hide(); - $dialog.find( '.wikiEditor-preview-dialog-contents' ) - .html( '

' + - mw.config.get( 'wgTitle' ) + '

' + - data.parse.text['*'] ) - .find( 'a:not([href^=#])' ).click( function () { return false; } ); - }, - 'json' - ); - } - }, - resizeme: false - } - } - ); - context.fn.addButton( { - 'captionMsg': 'wikieditor-preview-tab', - 'action': function () { - context.$textarea.wikiEditor( 'openDialog', 'preview' ); - return false; - } - } ); - } -} - -}; } )( jQuery, mediaWiki );