| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
ve.init.mw.DesktopCollabTarget = function VeInitMwDesktopCollabTarget( title, rebaserUrl, config ) { |
| 23 |
|
| 24 |
ve.init.mw.DesktopCollabTarget.super.call( this, title, rebaserUrl, config ); |
| 25 |
|
| 26 |
this.$originalContent = $( '<div>' ).addClass( 've-init-mw-desktopArticleTarget-originalContent' ); |
| 27 |
this.$editableContent = $( '#mw-content-text' ); |
| 28 |
|
| 29 |
|
| 30 |
this.$element.addClass( 've-init-mw-desktopArticleTarget' ).append( this.$originalContent ); |
| 31 |
}; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
OO.inheritClass( ve.init.mw.DesktopCollabTarget, ve.init.mw.CollabTarget ); |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
ve.init.mw.DesktopCollabTarget.prototype.transformPage = function () { |
| 43 |
this.$originalContent.append( this.$element.siblings() ); |
| 44 |
let title; |
| 45 |
if ( ( title = this.getImportTitle() ) ) { |
| 46 |
|
| 47 |
|
| 48 |
$( '#contentSub' ).html( |
| 49 |
ve.htmlMsg( |
| 50 |
'collabpad-import-subtitle', |
| 51 |
$( '<a>' ).attr( 'href', title.getUrl() ).text( title.getMainText() ) |
| 52 |
) |
| 53 |
); |
| 54 |
ve.targetLinksToNewWindow( $( '#contentSub' )[ 0 ] ); |
| 55 |
} else { |
| 56 |
$( '#contentSub' ).empty(); |
| 57 |
} |
| 58 |
}; |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
ve.init.mw.DesktopCollabTarget.prototype.restorePage = function () { |
| 64 |
this.$element.parent().append( this.$originalContent.children() ); |
| 65 |
$( '#contentSub' ).empty(); |
| 66 |
}; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
ve.init.mw.DesktopCollabTarget.prototype.attachToolbar = function () { |
| 72 |
const toolbar = this.getToolbar(); |
| 73 |
|
| 74 |
|
| 75 |
ve.init.mw.DesktopCollabTarget.super.prototype.attachToolbar.apply( this, arguments ); |
| 76 |
|
| 77 |
toolbar.$element.addClass( |
| 78 |
've-init-mw-desktopArticleTarget-toolbar ve-init-mw-desktopArticleTarget-toolbar-open' |
| 79 |
); |
| 80 |
this.$element.prepend( toolbar.$element ); |
| 81 |
}; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
ve.init.mw.DesktopCollabTarget.prototype.setSurface = function ( surface ) { |
| 87 |
if ( surface !== this.surface ) { |
| 88 |
this.$editableContent.after( surface.$element ); |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
ve.init.mw.DesktopCollabTarget.super.prototype.setSurface.apply( this, arguments ); |
| 93 |
}; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
ve.init.mw.targetFactory.register( ve.init.mw.DesktopCollabTarget ); |