mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-24 00:06:49 +00:00
Remove previewDialog
This was never launched, and is no longer working either. Change-Id: Ic49e84b8a91da701673949a8d441c788a4feaa22
This commit is contained in:
parent
aacee86915
commit
360419f397
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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}}",
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
* JavaScript for WikiEditor Preview Dialog
|
||||
*/
|
||||
jQuery( document ).ready( function ( $ ) {
|
||||
// Add preview module
|
||||
$( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'previewDialog' );
|
||||
} );
|
|
@ -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;
|
||||
}
|
|
@ -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: '\
|
||||
<div class="wikiEditor-ui-loading"><span></span></div>\
|
||||
<div class="wikiEditor-preview-dialog-contents"></div>\
|
||||
',
|
||||
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( '<h1 class="firstHeading" id="firstHeading">' +
|
||||
mw.config.get( 'wgTitle' ) + '</h1>' +
|
||||
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 );
|
Loading…
Reference in a new issue