Merge "Change command list from whitelist to blacklist"

This commit is contained in:
jenkins-bot 2014-11-25 00:42:48 +00:00 committed by Gerrit Code Review
commit 330a1732cb
4 changed files with 47 additions and 164 deletions

View file

@ -39,6 +39,7 @@ ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( $container, con
OO.inheritClass( ve.init.mw.MobileViewTarget, ve.init.mw.Target );
/* Static Properties */
ve.init.mw.MobileViewTarget.static.toolbarGroups = [
// Style
{ include: [ 'bold', 'italic' ] },
@ -55,11 +56,7 @@ ve.init.mw.MobileViewTarget.static.toolbarGroups = [
}
];
ve.init.mw.MobileViewTarget.static.surfaceCommands = [
'bold',
'italic',
'link'
];
ve.init.mw.MobileViewTarget.static.excludeCommands = [];
ve.init.mw.MobileViewTarget.static.name = 'mobile';

View file

@ -1359,11 +1359,10 @@ ve.init.mw.Target.prototype.setupSurface = function ( doc, callback ) {
);
setTimeout( function () {
// Create ui.Surface (also creates ce.Surface and dm.Surface and builds CE tree)
var surface = target.createSurface( dmDoc );
var surface = target.createSurface( dmDoc, { excludeCommands: target.constructor.static.excludeCommands } );
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;

View file

@ -77,84 +77,24 @@ ve.ui.MWMediaDialog.static.actions = [
ve.ui.MWMediaDialog.static.modelClasses = [ ve.dm.MWBlockImageNode, ve.dm.MWInlineImageNode ];
ve.ui.MWMediaDialog.static.toolbarGroups = [
// History
{ include: [ 'undo', 'redo' ] },
ve.ui.MWMediaDialog.static.excludeCommands = [
// No formatting
/* {
type: 'menu',
indicator: 'down',
title: OO.ui.deferMsg( 'visualeditor-toolbar-format-tooltip' ),
include: [ { group: 'format' } ],
promote: [ 'paragraph' ],
demote: [ 'preformatted', 'heading1' ]
},*/
// Style
{
type: 'list',
icon: 'text-style',
indicator: 'down',
title: OO.ui.deferMsg( 'visualeditor-toolbar-style-tooltip' ),
include: [ { group: 'textStyle' }, 'language', 'clear' ],
forceExpand: [ 'bold', 'italic', 'clear' ],
promote: [ 'bold', 'italic' ],
demote: [ 'strikethrough', 'code', 'underline', 'language', 'clear' ]
},
// Link
{ include: [ 'link' ] },
// Cite
{
type: 'list',
label: OO.ui.deferMsg( 'visualeditor-toolbar-cite-label' ),
indicator: 'down',
include: [ { group: 'cite' }, 'reference', 'reference/existing' ],
demote: [ 'reference', 'reference/existing' ]
},
'paragraph',
'heading1',
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
'preformatted',
// TODO: Decide if tables tools should be allowed
'tableCellHeader',
'tableCellData',
// No structure
/* {
type: 'list',
icon: 'bullet-list',
indicator: 'down',
include: [ { group: 'structure' } ],
demote: [ 'outdent', 'indent' ]
},*/
// Insert
{
label: OO.ui.deferMsg( 'visualeditor-toolbar-insert' ),
indicator: 'down',
include: '*',
exclude: [
{ group: 'format' },
{ group: 'structure' },
'referencesList',
'gallery'
],
forceExpand: [ 'media', 'transclusion', 'insertTable' ],
promote: [ 'media', 'transclusion' ],
demote: [ 'specialcharacter' ]
},
// Table
{
header: OO.ui.deferMsg( 'visualeditor-toolbar-table' ),
type: 'list',
icon: 'table-insert',
indicator: 'down',
include: [ { group: 'table' } ],
demote: [ 'deleteTable' ]
}
];
ve.ui.MWMediaDialog.static.surfaceCommands = [
'undo',
'redo',
'bold',
'italic',
'link',
'clear',
'underline',
'subscript',
'superscript',
'pasteSpecial'
'bullet',
'number',
'indent',
'outdent'
];
/**
@ -894,8 +834,8 @@ ve.ui.MWMediaDialog.prototype.resetCaption = function () {
captionDocument,
{
$: this.$,
tools: this.constructor.static.toolbarGroups,
commands: this.constructor.static.surfaceCommands,
tools: ve.init.target.constructor.static.toolbarGroups,
excludeCommands: this.constructor.static.excludeCommands,
pasteRules: this.constructor.static.getPasteRules()
}
);

View file

@ -68,85 +68,32 @@ ve.ui.MWReferenceDialog.static.actions = [
ve.ui.MWReferenceDialog.static.modelClasses = [ ve.dm.MWReferenceNode ];
ve.ui.MWReferenceDialog.static.toolbarGroups = [
// History
{ include: [ 'undo', 'redo' ] },
ve.ui.MWReferenceDialog.static.excludeCommands = [
// No formatting
/* {
type: 'menu',
indicator: 'down',
title: OO.ui.deferMsg( 'visualeditor-toolbar-format-tooltip' ),
include: [ { group: 'format' } ],
promote: [ 'paragraph' ],
demote: [ 'preformatted', 'heading1' ]
},*/
// Style
{
type: 'list',
icon: 'text-style',
indicator: 'down',
title: OO.ui.deferMsg( 'visualeditor-toolbar-style-tooltip' ),
include: [ { group: 'textStyle' }, 'language', 'clear' ],
forceExpand: [ 'bold', 'italic', 'clear' ],
promote: [ 'bold', 'italic' ],
demote: [ 'strikethrough', 'code', 'underline', 'language', 'clear' ]
},
// Link
{ include: [ 'link' ] },
// Cite-transclusion but not reference
{
type: 'list',
label: OO.ui.deferMsg( 'visualeditor-toolbar-cite-label' ),
indicator: 'down',
include: [ { group: 'cite-transclusion' }/*, 'reference', 'reference/existing'*/ ]
/*demote: [ 'reference', 'reference/existing' ]*/
},
'paragraph',
'heading1',
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
'preformatted',
// No tables
'insertTable',
'deleteTable',
'mergeCells',
'tableCaption',
'tableCellHeader',
'tableCellData',
// No structure
/* {
type: 'list',
icon: 'bullet-list',
indicator: 'down',
include: [ { group: 'structure' } ],
demote: [ 'outdent', 'indent' ]
},*/
// Insert
{
label: OO.ui.deferMsg( 'visualeditor-toolbar-insert' ),
indicator: 'down',
include: '*',
exclude: [
{ group: 'format' },
{ group: 'structure' },
'reference',
'referencesList',
'gallery'
],
forceExpand: [ 'media', 'transclusion', 'insertTable' ],
promote: [ 'media', 'transclusion' ],
demote: [ 'specialcharacter' ]
},
// Table
{
header: OO.ui.deferMsg( 'visualeditor-toolbar-table' ),
type: 'list',
icon: 'table-insert',
indicator: 'down',
include: [ { group: 'table' } ],
demote: [ 'deleteTable' ]
}
];
ve.ui.MWReferenceDialog.static.surfaceCommands = [
'undo',
'redo',
'bold',
'italic',
'link',
'clear',
'underline',
'subscript',
'superscript',
'pasteSpecial'
'bullet',
'number',
'indent',
'outdent',
// References
'reference',
'reference/existing',
'referencesList'
];
/**
@ -264,8 +211,8 @@ ve.ui.MWReferenceDialog.prototype.useReference = function ( ref ) {
this.referenceModel.getDocument(),
{
$: this.$,
tools: this.constructor.static.toolbarGroups,
commands: this.constructor.static.surfaceCommands,
tools: ve.init.target.constructor.static.toolbarGroups,
excludeCommands: this.constructor.static.excludeCommands,
pasteRules: this.constructor.static.getPasteRules()
}
);