Update VE core submodule to master (155f4ab)

Use new setupToolbar and setupDebugbar methods in base target.

New changes:
7ff523d Localisation updates from https://translatewiki.net.
3815224 [BREAKING CHANGE] Debug bar refactor
155f4ab Edit HTML mode in demo

Change-Id: I554ce51eae872ab0f741a913bf10394c2a8c3e52
This commit is contained in:
Ed Sanders 2014-06-06 11:04:24 +01:00 committed by Roan Kattouw
parent e085a963ea
commit 00af43495b
9 changed files with 36 additions and 34 deletions

View file

@ -38,7 +38,6 @@
"ve.init",
"ve.init.Platform",
"ve.init.Target",
"ve.init.DebugBar",
"ve.init.sa*"
]
},
@ -99,6 +98,7 @@
"ve.ui.MobileContext",
"ve.ui.Toolbar",
"ve.ui.TargetToolbar",
"ve.ui.DebugBar",
"ve.ui.WindowSet",
"ve.ui.Action",
"ve.ui.Trigger",

View file

@ -457,7 +457,7 @@ $wgResourceModules += array(
'lib/ve/modules/ve/ui/inspectors/ve.ui.SpecialCharacterInspector.js',
),
'debugScripts' => array(
'lib/ve/modules/ve/init/ve.init.DebugBar.js',
'lib/ve/modules/ve/ui/ve.ui.DebugBar.js',
),
'styles' => array(
// ce
@ -486,7 +486,7 @@ $wgResourceModules += array(
'lib/ve/modules/ve/ui/styles/ve.ui.Toolbar.css',
// TODO: add debugStyles to ResourceLoader
'lib/ve/modules/ve/init/styles/ve.init.DebugBar.css',
'lib/ve/modules/ve/ui/styles/ve.ui.DebugBar.css',
),
'skinStyles' => array(
'default' => array(

2
lib/ve

@ -1 +1 @@
Subproject commit 89820e514d4096c4168a37a04fc25015aa23092d
Subproject commit 155f4abc8be392b231de3a3c6410b831ee1903db

View file

@ -9,7 +9,7 @@
margin: -1.25em -1.5em 1.5em -1.5em;
}
.ve-init-debugBar {
.ve-ui-debugBar {
padding: 1.5em;
margin: 1em -1.5em -1.5em -1.5em;
}

View file

@ -35,14 +35,14 @@
position: relative;
}
.ve-init-debugBar {
.ve-ui-debugBar {
padding: 1em;
margin: 1em -1em -1em -1em;
border-top: solid 1px #ccc;
box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.15) inset;
}
.ve-init-debugBar ol {
.ve-ui-debugBar ol {
margin-left: 0;
}

View file

@ -88,9 +88,9 @@ ve.init.mw.MobileViewTarget.prototype.createSurface = function ( dmDoc, config )
/**
* @inheritdoc
*/
ve.init.mw.MobileViewTarget.prototype.setUpToolbar = function () {
ve.init.mw.MobileViewTarget.prototype.setupToolbar = function () {
// Parent method
ve.init.mw.Target.prototype.setUpToolbar.call( this );
ve.init.mw.Target.prototype.setupToolbar.call( this );
this.toolbar.$element
// FIXME shouldn't be using viewPageTarget styles

View file

@ -33,20 +33,9 @@
getTargetDeferred = $.Deferred();
loadTargetDeferred = $.Deferred()
.done( function () {
var debugBar, target = new ve.init.mw.ViewPageTarget();
var target = new ve.init.mw.ViewPageTarget();
ve.init.mw.targets.push( target );
if ( ve.debug ) {
debugBar = new ve.init.DebugBar();
target.on( 'surfaceReady', function () {
$( '#content' ).append( debugBar.$element.show() );
debugBar.attachToSurface( target.surface );
target.surface.on( 'destroy', function () {
debugBar.$element.hide();
} );
} );
}
// Tee tracked events to MediaWiki firehose, if available (1.23+).
if ( mw.track ) {
ve.trackSubscribeAll( function ( topic, data ) {

View file

@ -193,10 +193,10 @@ ve.init.mw.ViewPageTarget.prototype.verifyPopState = function ( popState ) {
/**
* @inheritdoc
*/
ve.init.mw.ViewPageTarget.prototype.setUpToolbar = function () {
ve.init.mw.ViewPageTarget.prototype.setupToolbar = function () {
var $firstHeading;
// Parent method
ve.init.mw.Target.prototype.setUpToolbar.call( this );
ve.init.mw.Target.prototype.setupToolbar.call( this );
// Keep it hidden so that we can slide it down smoothly (avoids sudden
// offset flash when original content is hidden, and replaced in-place with a
@ -1069,6 +1069,7 @@ ve.init.mw.ViewPageTarget.prototype.startSanityCheck = function () {
ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
// Update UI
this.tearDownToolbar();
this.tearDownDebugBar();
this.restoreDocumentTitle();
if ( this.surface.mwTocWidget ) {
this.surface.mwTocWidget.teardown();
@ -1376,6 +1377,18 @@ ve.init.mw.ViewPageTarget.prototype.tearDownToolbar = function () {
}, this ) );
};
/**
* Hide the debug bar.
*
* @method
*/
ve.init.mw.ViewPageTarget.prototype.tearDownDebugBar = function () {
this.debugBar.$element.slideUp( 'fast', ve.bind( function () {
this.debugBar.$element.remove();
this.debugBar = null;
}, this ) );
};
/**
* Transform the page title into a VE-style title.
*

View file

@ -489,7 +489,7 @@ ve.init.mw.Target.prototype.onReady = function () {
this.onNoticesReady();
this.loading = false;
this.edited = false;
this.setUpSurface( this.doc, ve.bind( function () {
this.setupSurface( this.doc, ve.bind( function () {
this.startSanityCheck();
this.emit( 'surfaceReady' );
}, this ) );
@ -1301,7 +1301,7 @@ ve.init.mw.Target.prototype.getEditNotices = function () {
* @param {HTMLDocument} doc HTML DOM to edit
* @param {Function} [callback] Callback to call when done
*/
ve.init.mw.Target.prototype.setUpSurface = function ( doc, callback ) {
ve.init.mw.Target.prototype.setupSurface = function ( doc, callback ) {
var target = this;
setTimeout( function () {
// Build model
@ -1317,6 +1317,7 @@ ve.init.mw.Target.prototype.setUpSurface = function ( doc, callback ) {
target.surface = surface;
surface.$element.addClass( 've-init-mw-viewPageTarget-surface' )
.addClass( target.protectedClasses );
surface.addCommands( target.constructor.static.surfaceCommands );
setTimeout( function () {
var surfaceView = surface.getView(),
$documentNode = surfaceView.getDocument().getDocumentNode().$element;
@ -1324,7 +1325,10 @@ ve.init.mw.Target.prototype.setUpSurface = function ( doc, callback ) {
// Initialize surface
surface.getContext().hide();
target.$element.append( surface.$element );
target.setUpToolbar();
target.setupToolbar();
if ( ve.debug ) {
target.setupDebugBar();
}
// Apply mw-body-content to the view (ve-ce-surface).
// Not to surface (ve-ui-surface), since that contains both the view
@ -1346,15 +1350,11 @@ ve.init.mw.Target.prototype.setUpSurface = function ( doc, callback ) {
};
/**
* Set up the toolbar and insert it into the DOM.
*
* The default implementation inserts it before the surface, but subclasses can override this.
* @inheritdoc
*/
ve.init.mw.Target.prototype.setUpToolbar = function () {
this.toolbar = new ve.ui.TargetToolbar( this, this.surface, { 'shadow': true, 'actions': true } );
this.toolbar.setup( this.constructor.static.toolbarGroups );
this.surface.addCommands( this.constructor.static.surfaceCommands );
this.toolbar.$element.insertBefore( this.surface.$element );
ve.init.mw.Target.prototype.setupToolbar = function () {
// Parent method
ve.init.Target.prototype.setupToolbar.call( this, { 'shadow': true, 'actions': true } );
};
/**