| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
ve.init.mw.CollabTarget = function VeInitMwCollabTarget( title, rebaserUrl, config ) { |
| 21 |
config = config || {}; |
| 22 |
config.toolbarConfig = ve.extendObject( { |
| 23 |
shadow: true, |
| 24 |
actions: true, |
| 25 |
floatable: true |
| 26 |
}, config.toolbarConfig ); |
| 27 |
|
| 28 |
this.title = title; |
| 29 |
this.rebaserUrl = rebaserUrl; |
| 30 |
this.importTitle = config.importTitle || null; |
| 31 |
|
| 32 |
|
| 33 |
ve.init.mw.CollabTarget.super.call( this, config ); |
| 34 |
|
| 35 |
|
| 36 |
ve.ui.commandRegistry.unregister( 'redo' ); |
| 37 |
|
| 38 |
|
| 39 |
ve.ui.commandRegistry.unregister( 'reference' ); |
| 40 |
ve.ui.commandRegistry.unregister( 'referencesList' ); |
| 41 |
ve.ui.commandRegistry.unregister( 'citoid' ); |
| 42 |
|
| 43 |
|
| 44 |
this.$editableContent = $( '#mw-content-text' ); |
| 45 |
|
| 46 |
|
| 47 |
this.$element.addClass( 've-init-mw-articleTarget ve-init-mw-collabTarget' ); |
| 48 |
}; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
OO.inheritClass( ve.init.mw.CollabTarget, ve.init.mw.Target ); |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
ve.init.mw.CollabTarget.static.name = 'collab'; |
| 57 |
|
| 58 |
ve.init.mw.CollabTarget.static.trackingName = 'collab'; |
| 59 |
|
| 60 |
ve.init.mw.CollabTarget.static.toolbarGroups = ve.copy( ve.init.mw.CollabTarget.static.toolbarGroups ); |
| 61 |
ve.init.mw.CollabTarget.static.toolbarGroups.splice( 4, 0, { |
| 62 |
name: 'commentAnnotation', |
| 63 |
include: [ 'commentAnnotation' ] |
| 64 |
} ); |
| 65 |
|
| 66 |
ve.init.mw.CollabTarget.static.toolbarGroups = ve.init.mw.CollabTarget.static.toolbarGroups.filter( ( group ) => group.name !== 'reference' ); |
| 67 |
ve.init.mw.CollabTarget.static.toolbarGroups.push( |
| 68 |
{ |
| 69 |
name: 'help', |
| 70 |
align: 'after', |
| 71 |
include: [ 'help' ] |
| 72 |
}, |
| 73 |
{ |
| 74 |
name: 'pageMenu', |
| 75 |
align: 'after', |
| 76 |
type: 'list', |
| 77 |
icon: 'menu', |
| 78 |
indicator: null, |
| 79 |
title: ve.msg( 'visualeditor-pagemenu-tooltip' ), |
| 80 |
label: ve.msg( 'visualeditor-pagemenu-tooltip' ), |
| 81 |
invisibleLabel: true, |
| 82 |
include: [ 'changeDirectionality', 'findAndReplace' ] |
| 83 |
}, |
| 84 |
{ |
| 85 |
name: 'authorList', |
| 86 |
align: 'after', |
| 87 |
include: [ 'authorList' ] |
| 88 |
}, |
| 89 |
{ |
| 90 |
name: 'export', |
| 91 |
align: 'after', |
| 92 |
include: [ 'export' ] |
| 93 |
} |
| 94 |
); |
| 95 |
|
| 96 |
ve.init.mw.CollabTarget.static.importRules = ve.copy( ve.init.mw.CollabTarget.static.importRules ); |
| 97 |
ve.init.mw.CollabTarget.static.importRules.external.blacklist[ 'link/mwExternal' ] = false; |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
ve.init.mw.CollabTarget.prototype.getSurfaceConfig = function ( config ) { |
| 105 |
return ve.init.mw.CollabTarget.super.prototype.getSurfaceConfig.call( this, ve.extendObject( { |
| 106 |
nullSelectionOnBlur: false |
| 107 |
}, config ) ); |
| 108 |
}; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
ve.init.mw.CollabTarget.prototype.getSurfaceClasses = function () { |
| 114 |
const classes = ve.init.mw.CollabTarget.super.prototype.getSurfaceClasses.call( this ); |
| 115 |
return classes.concat( [ 'mw-body-content' ] ); |
| 116 |
}; |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
ve.init.mw.CollabTarget.prototype.transformPage = function () { |
| 122 |
}; |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
ve.init.mw.CollabTarget.prototype.restorePage = function () { |
| 128 |
}; |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
ve.init.mw.CollabTarget.prototype.tryTeardown = function () { |
| 134 |
this.emit( 'close' ); |
| 135 |
}; |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
ve.init.mw.CollabTarget.prototype.getImportTitle = function () { |
| 143 |
return this.importTitle; |
| 144 |
}; |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
ve.init.mw.CollabTarget.prototype.getPageName = function () { |
| 150 |
return this.getImportTitle() || this.pageName; |
| 151 |
}; |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
ve.init.mw.targetFactory.register( ve.init.mw.CollabTarget ); |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
ve.ui.MWExportTool = function VeUiMWExportTool() { |
| 161 |
|
| 162 |
ve.ui.MWExportTool.super.apply( this, arguments ); |
| 163 |
|
| 164 |
if ( OO.ui.isMobile() ) { |
| 165 |
this.setIcon( 'upload' ); |
| 166 |
this.setTitle( null ); |
| 167 |
} |
| 168 |
}; |
| 169 |
OO.inheritClass( ve.ui.MWExportTool, ve.ui.Tool ); |
| 170 |
ve.ui.MWExportTool.static.name = 'export'; |
| 171 |
ve.ui.MWExportTool.static.displayBothIconAndLabel = !OO.ui.isMobile(); |
| 172 |
ve.ui.MWExportTool.static.group = 'export'; |
| 173 |
ve.ui.MWExportTool.static.autoAddToCatchall = false; |
| 174 |
|
| 175 |
ve.ui.MWExportTool.static.flags = [ 'progressive', 'primary' ]; |
| 176 |
ve.ui.MWExportTool.static.title = |
| 177 |
OO.ui.deferMsg( 'visualeditor-rebase-client-export-start' ); |
| 178 |
ve.ui.MWExportTool.static.commandName = 'mwExportWikitext'; |
| 179 |
ve.ui.toolFactory.register( ve.ui.MWExportTool ); |
| 180 |
|
| 181 |
ve.ui.commandRegistry.register( |
| 182 |
new ve.ui.Command( |
| 183 |
'mwExportWikitext', 'window', 'open', |
| 184 |
{ args: [ 'mwExportWikitext' ] } |
| 185 |
) |
| 186 |
); |