mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
New wikitext editor: unwrap lists when changing style
Bug: T147227 Change-Id: I1a7f86e2a97855be5c44671d8f5918fb87bc70d0
This commit is contained in:
parent
88a44f3fe0
commit
69c332d1ad
|
@ -120,18 +120,6 @@ ve.ui.wikitextCommandRegistry.register(
|
|||
{ args: [ '<sup>', '</sup>', OO.ui.deferMsg( 'visualeditor-annotationbutton-superscript-tooltip' ) ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
ve.ui.wikitextCommandRegistry.register(
|
||||
new ve.ui.Command(
|
||||
'number', 'mwWikitext', 'wrapLine',
|
||||
{ args: [ '# ', '', OO.ui.deferMsg( 'visualeditor-listbutton-number-tooltip' ) ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
ve.ui.wikitextCommandRegistry.register(
|
||||
new ve.ui.Command(
|
||||
'bullet', 'mwWikitext', 'wrapLine',
|
||||
{ args: [ '* ', '', OO.ui.deferMsg( 'visualeditor-listbutton-bullet-tooltip' ) ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
|
||||
( function () {
|
||||
var i, heading = '';
|
||||
|
@ -186,6 +174,27 @@ ve.ui.wikitextCommandRegistry.register(
|
|||
{ args: [ '<blockquote>', '</blockquote>', OO.ui.deferMsg( 'visualeditor-formatdropdown-format-blockquote' ), unformat ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
|
||||
function unlist( keepType, text ) {
|
||||
var matches;
|
||||
if ( ( matches = text.match( /^[*#] */ ) ) && text.slice( 0, 1 ) !== keepType ) {
|
||||
return [ matches[ 0 ].length, 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
ve.ui.wikitextCommandRegistry.register(
|
||||
new ve.ui.Command(
|
||||
'number', 'mwWikitext', 'wrapLine',
|
||||
{ args: [ '# ', '', OO.ui.deferMsg( 'visualeditor-listbutton-number-tooltip' ), unlist.bind( this, '#' ) ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
ve.ui.wikitextCommandRegistry.register(
|
||||
new ve.ui.Command(
|
||||
'bullet', 'mwWikitext', 'wrapLine',
|
||||
{ args: [ '* ', '', OO.ui.deferMsg( 'visualeditor-listbutton-bullet-tooltip' ), unlist.bind( this, '*' ) ], supportedSelections: [ 'linear' ] }
|
||||
)
|
||||
);
|
||||
|
||||
} )();
|
||||
|
||||
ve.ui.wikitextCommandRegistry.register(
|
||||
|
|
Loading…
Reference in a new issue