Add command to insert non-breaking space

Triggered by Ctrl+Shift+Space on PC.

On Mac, there is no trigger, we rely on the built-in OS shortcut.

Bug: T53045
Change-Id: I9630804c833d755910589022b0ca78208337d804
This commit is contained in:
Bartosz Dziewoński 2015-11-29 18:37:10 +01:00
parent bc5a2846d9
commit 1abb5a5786
2 changed files with 35 additions and 0 deletions

View file

@ -22,3 +22,25 @@ ve.ui.commandRegistry.register(
}
)
);
ve.ui.commandRegistry.register(
new ve.ui.Command( 'mwNonBreakingSpace', 'content', 'insert', {
args: [
[
{ type: 'mwEntity', attributes: { character: '\u00a0' } },
{ type: '/mwEntity' }
],
// annotate
true,
// collapseToEnd
true
],
supportedSelections: [ 'linear' ]
} )
);
ve.ui.triggerRegistry.register(
'mwNonBreakingSpace', {
mac: [],
pc: new ve.ui.Trigger( 'ctrl+shift+space' )
}
);

View file

@ -246,3 +246,16 @@ ve.ui.wikitextCommandRegistry.register(
}
)
);
ve.ui.wikitextCommandRegistry.register(
new ve.ui.Command( 'mwNonBreakingSpace', 'content', 'insert', {
args: [
' ',
// annotate
true,
// collapseToEnd
true
],
supportedSelections: [ 'linear' ]
} )
);