diff --git a/WikiEditorHooks.php b/WikiEditorHooks.php index 6e536603..cd9f36f0 100644 --- a/WikiEditorHooks.php +++ b/WikiEditorHooks.php @@ -38,39 +38,6 @@ class WikiEditorHooks { 'ext.wikiEditor.styles', ], ], - - /* Labs Features */ - - 'preview' => [ - 'preferences' => [ - 'wikieditor-preview' => [ - 'type' => 'toggle', - 'label-message' => 'wikieditor-preview-preference', - 'section' => 'editing/labs', - ], - ], - 'requirements' => [ - 'wikieditor-preview' => true, - ], - 'modules' => [ - 'ext.wikiEditor.preview', - ], - ], - 'publish' => [ - 'preferences' => [ - 'wikieditor-publish' => [ - 'type' => 'toggle', - 'label-message' => 'wikieditor-publish-preference', - 'section' => 'editing/labs', - ], - ], - 'requirements' => [ - 'wikieditor-publish' => true, - ], - 'modules' => [ - 'ext.wikiEditor.publish', - ], - ] ]; /* Static Methods */ diff --git a/extension.json b/extension.json index 62cf27b3..b7c62911 100644 --- a/extension.json +++ b/extension.json @@ -123,23 +123,6 @@ "dialogReplace.html": "templates/dialogReplace.html" } }, - "jquery.wikiEditor.preview": { - "group": "ext.wikiEditor", - "scripts": "jquery.wikiEditor.preview.js", - "styles": "jquery.wikiEditor.preview.less", - "dependencies": [ - "jquery.wikiEditor.core", - "mediawiki.api" - ] - }, - "jquery.wikiEditor.publish": { - "group": "ext.wikiEditor", - "scripts": "jquery.wikiEditor.publish.js", - "dependencies": [ - "jquery.wikiEditor.core", - "jquery.wikiEditor.dialogs" - ] - }, "jquery.wikiEditor.toolbar": { "group": "ext.wikiEditor", "scripts": "jquery.wikiEditor.toolbar.js", @@ -367,37 +350,6 @@ "jquery.wikiEditor.dialogs.config" ] }, - "ext.wikiEditor.preview": { - "group": "ext.wikiEditor", - "scripts": "ext.wikiEditor.preview.js", - "dependencies": [ - "ext.wikiEditor.core", - "jquery.wikiEditor.preview" - ], - "messages": [ - "wikieditor-preview-tab", - "wikieditor-preview-changes-tab", - "wikieditor-preview-loading" - ] - }, - "ext.wikiEditor.publish": { - "group": "ext.wikiEditor", - "scripts": "ext.wikiEditor.publish.js", - "dependencies": [ - "ext.wikiEditor.core", - "jquery.wikiEditor.publish" - ], - "messages": [ - "wikieditor-publish-button-publish", - "wikieditor-publish-button-cancel", - "wikieditor-publish-dialog-title", - "wikieditor-publish-dialog-summary", - "wikieditor-publish-dialog-minor", - "wikieditor-publish-dialog-watch", - "wikieditor-publish-dialog-publish", - "wikieditor-publish-dialog-goback" - ] - }, "ext.wikiEditor.toolbar": { "group": "ext.wikiEditor", "scripts": "ext.wikiEditor.toolbar.js", @@ -422,14 +374,6 @@ "global": false, "user": true }, - "preview": { - "global": false, - "user": true - }, - "publish": { - "global": false, - "user": true - }, "_merge_strategy": "array_plus_2d" } }, diff --git a/i18n/en.json b/i18n/en.json index ef00d574..5af04fc3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -8,19 +8,6 @@ "wikieditor-desc": "Provides an extendable wikitext editing interface and many feature-providing modules", "wikieditor-wikitext-tab": "Wikitext", "wikieditor-loading": "Loading...", - "wikieditor-preview-preference": "Enable side-by-side preview", - "wikieditor-preview-tab": "Preview", - "wikieditor-preview-changes-tab": "Changes", - "wikieditor-preview-loading": "Loading...", - "wikieditor-publish-preference": "Enable step-by-step publishing", - "wikieditor-publish-button-publish": "Publish", - "wikieditor-publish-button-cancel": "Cancel", - "wikieditor-publish-dialog-title": "Publish to {{SITENAME}}", - "wikieditor-publish-dialog-summary": "Edit summary (briefly describe the changes you have made):", - "wikieditor-publish-dialog-minor": "Minor edit", - "wikieditor-publish-dialog-watch": "Watch this page", - "wikieditor-publish-dialog-publish": "Publish", - "wikieditor-publish-dialog-goback": "Go back", "wikieditor-toolbar": "Editing toolbar", "wikieditor-toolbar-desc": "Edit page toolbar with enhanced usability", "wikieditor-toolbar-preference": "Enable enhanced editing toolbar", diff --git a/i18n/qqq.json b/i18n/qqq.json index b88e77b2..906b5e1a 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -32,19 +32,6 @@ "wikieditor-desc": "{{desc|name=Wiki Editor|url=https://www.mediawiki.org/wiki/Extension:WikiEditor}}\nI guess that \"feature-providing modules\" means the same as \"modules providing features\".", "wikieditor-wikitext-tab": "Caption of the tab containing the edit box\n{{Identical|Wikitext}}", "wikieditor-loading": "Explanatory text for the temporary cover placed over the wikieditor while it's being assembled.\n{{Identical|Loading}}", - "wikieditor-preview-preference": "Option in [[Special:Preferences]], tab ''{{int:prefs-editing}}''", - "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-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}}", - "wikieditor-publish-dialog-title": "Title of the dialog that opens when the user clicks the Publish button", - "wikieditor-publish-dialog-summary": "Label for the edit summary textbox in the dialog that opens when the user clicks the Publish button. See also {{msg-mw|Summary}}.", - "wikieditor-publish-dialog-minor": "Label for the minor edit checkbox in the dialog that opens when the user clicks the Publish button.\n\nSee also:\n* {{msg-mw|Minoredit}}\n{{Identical|Minor edit}}", - "wikieditor-publish-dialog-watch": "Label for the watch checkbox in the dialog that opens when the user clicks the Publish button\n\n{{Identical|Watch this page}}", - "wikieditor-publish-dialog-publish": "Button that saves the user's edit in the dialog that opens when the user clicks the Publish button\n\n{{Identical|Publish}}", - "wikieditor-publish-dialog-goback": "Button that closes the dialog that opens when the user clicks the Publish button.\n{{Identical|Go back}}", "wikieditor-toolbar": "A customizable toolbar for the WikiEditor.\nFor more information, see https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization", "wikieditor-toolbar-desc": "Unused at this time.", "wikieditor-toolbar-preference": "Option in [[Special:Preferences]]", diff --git a/modules/ext.wikiEditor.preview.js b/modules/ext.wikiEditor.preview.js deleted file mode 100644 index 0551e414..00000000 --- a/modules/ext.wikiEditor.preview.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * JavaScript for WikiEditor Preview module - */ -jQuery( function ( $ ) { - // Add preview module - $( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'preview' ); -} ); diff --git a/modules/ext.wikiEditor.publish.js b/modules/ext.wikiEditor.publish.js deleted file mode 100644 index 5e0b30da..00000000 --- a/modules/ext.wikiEditor.publish.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * JavaScript for WikiEditor Publish module - */ -jQuery( function ( $ ) { - // Add publish module - $( '#wpTextbox1' ).wikiEditor( 'addModule', 'publish' ); -} ); diff --git a/modules/jquery.wikiEditor.dialogs.config.less b/modules/jquery.wikiEditor.dialogs.config.less index e42025d9..f95a7c26 100644 --- a/modules/jquery.wikiEditor.dialogs.config.less +++ b/modules/jquery.wikiEditor.dialogs.config.less @@ -243,16 +243,3 @@ body.rtl { .wikiEditor-dialog-editoptions { margin-top: 15px; } - -/* Publish dialog */ -.wikiEditor-publish-dialog-copywarn { - margin-top: 0.5em; -} - -.wikiEditor-publish-dialog-summary { - margin-top: 1.5em; -} - -.wikiEditor-publish-dialog-options { - margin-top: 1.5em; -} diff --git a/modules/jquery.wikiEditor.preview.js b/modules/jquery.wikiEditor.preview.js deleted file mode 100644 index 7b672728..00000000 --- a/modules/jquery.wikiEditor.preview.js +++ /dev/null @@ -1,179 +0,0 @@ -/* Preview module for wikiEditor */ -( function ( $, mw ) { - $.wikiEditor.modules.preview = { - - /** - * Compatibility map - */ - browsers: { - // Left-to-right languages - ltr: { - msie: [ [ '>=', 9 ] ], - firefox: [ [ '>=', 4 ] ], - opera: [ [ '>=', '10.5' ] ], - safari: [ [ '>=', 5 ] ], - chrome: [ [ '>=', 5 ] ] - }, - // Right-to-left languages - rtl: { - msie: [ [ '>=', 9 ] ], - firefox: [ [ '>=', 4 ] ], - opera: [ [ '>=', '10.5' ] ], - safari: [ [ '>=', 5 ] ], - chrome: [ [ '>=', 5 ] ] - } - }, - - /** - * Internally used functions - */ - fn: { - /** - * Creates a preview module within a wikiEditor - * - * @param {Object} context Context object of editor to create module in - */ - create: function ( context ) { - var loadingMsg, - api = new mw.Api(); - - if ( 'initialized' in context.modules.preview ) { - return; - } - context.modules.preview = { - initialized: true, - previewText: null, - changesText: null - }; - context.modules.preview.$preview = context.fn.addView( { - name: 'preview', - titleMsg: 'wikieditor-preview-tab', - init: function ( context ) { - // Gets the latest copy of the wikitext - var wikitext = context.$textarea.textSelection( 'getContents' ); - // Aborts when nothing has changed since the last preview - if ( context.modules.preview.previewText === wikitext ) { - return; - } - context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ).empty(); - context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).show(); - api.post( { - formatversion: 2, - action: 'parse', - title: mw.config.get( 'wgPageName' ), - text: wikitext, - pst: '', - prop: 'text|modules|jsconfigvars', - preview: true, - disableeditsection: true, - useskin: mw.config.get( 'skin' ), - uselang: mw.config.get( 'wgUserLanguage' ) - } ).always( function () { - context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).hide(); - } ).done( function ( data ) { - var loadmodules, $content; - if ( !data.parse || !data.parse.text ) { - return; - } - - if ( data.parse.jsconfigvars ) { - mw.config.set( data.parse.jsconfigvars ); - } - loadmodules = data.parse.modules.concat( - data.parse.modulescripts, - data.parse.modulestyles - ); - mw.loader.load( loadmodules ); - - context.modules.preview.previewText = wikitext; - $content = context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ) - .detach() - .html( data.parse.text ); - $content.append( '
' ) - .find( 'a:not([href^="#"])' ) - .click( false ); - - mw.hook( 'wikipage.content' ).fire( $content ); - context.modules.preview.$preview.append( $content ); - } ); - } - } ); - - context.$changesTab = context.fn.addView( { - name: 'changes', - titleMsg: 'wikieditor-preview-changes-tab', - init: function ( context ) { - // Gets the latest copy of the wikitext - var section, postdata, postPromise, - wikitext = context.$textarea.textSelection( 'getContents' ); - // Aborts when nothing has changed since the last time - if ( context.modules.preview.changesText === wikitext ) { - return; - } - context.$changesTab.find( 'table.diff tbody' ).empty(); - context.$changesTab.find( '.wikiEditor-preview-loading' ).show(); - - section = $( '[name="wpSection"]' ).val(); - postdata = { - formatversion: 2, - action: 'query', - prop: 'revisions', - titles: mw.config.get( 'wgPageName' ), - rvdifftotext: wikitext, - rvdifftotextpst: true, - rvprop: '', - rvsection: section === '' ? undefined : section - }; - postPromise = api.post( postdata ); - - $.when( postPromise, mw.loader.using( 'mediawiki.diff.styles' ) ).always( function () { - context.$changesTab.find( '.wikiEditor-preview-loading' ).hide(); - } ).done( function ( postResult ) { - var diff; - try { - diff = postResult[ 0 ].query.pages[ 0 ] - .revisions[ 0 ].diff.body; - - context.$changesTab.find( 'table.diff tbody' ) - .html( diff ) - .append( '' ); - mw.hook( 'wikipage.diff' ) - .fire( context.$changesTab.find( 'table.diff' ) ); - context.modules.preview.changesText = wikitext; - } catch ( e ) { - // "data.blah is undefined" error, ignore - } - } ); - } - } ); - - loadingMsg = mw.msg( 'wikieditor-preview-loading' ); - context.modules.preview.$preview - .add( context.$changesTab ) - .append( $( '