Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | 1x 1x 1x 1x 1x 38x 38x 38x 27x 26x 1x 11x 37x 47x 47x 47x 47x 37x 1x 1x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /*! * VisualEditor UserInterface TriggerRegistry class. * * @copyright See AUTHORS.txt */ /** * Trigger registry. * * @class * @extends OO.Registry * @constructor */ ve.ui.TriggerRegistry = function VeUiTriggerRegistry() { // Parent constructor ve.ui.TriggerRegistry.super.call( this ); this.triggersByString = {}; }; /* Inheritance */ OO.inheritClass( ve.ui.TriggerRegistry, OO.Registry ); /* Methods */ /** * Register a constructor with the factory. * * The only supported platforms are 'mac' and 'pc'. All platforms not identified as 'mac' will be * considered to be 'pc', including 'win', 'linux', 'solaris', etc. * * @param {string|string[]} name Symbolic name or list of symbolic names. Will trigger a command with * the same name. * @param {ve.ui.Trigger[]|Object} triggers Trigger object(s) or map of trigger object(s) keyed by * platform name e.g. 'mac' or 'pc' * @throws {Error} Trigger must be an instance of ve.ui.Trigger * @throws {Error} Incomplete trigger */ ve.ui.TriggerRegistry.prototype.register = function ( name, triggers ) { const platform = ve.getSystemPlatform(), platformKey = platform === 'mac' ? 'mac' : 'pc'; let triggerList; if ( ve.isPlainObject( triggers ) ) { if ( Object.prototype.hasOwnProperty.call( triggers, platformKey ) ) { triggerList = Array.isArray( triggers[ platformKey ] ) ? triggers[ platformKey ] : [ triggers[ platformKey ] ]; } else { return; } } else { triggerList = Array.isArray( triggers ) ? triggers : [ triggers ]; } // Validate arguments for ( let i = 0, l = triggerList.length; i < l; i++ ) { const trigger = triggerList[ i ]; Iif ( !( triggerList[ i ] instanceof ve.ui.Trigger ) ) { throw new Error( 'Trigger must be an instance of ve.ui.Trigger' ); } Iif ( !triggerList[ i ].isComplete() ) { throw new Error( 'Incomplete trigger' ); } this.triggersByString[ trigger.toString() ] = name; } ve.ui.TriggerRegistry.super.prototype.register.call( this, name, triggerList ); }; /** * Get trigger name from its string representation * * @param {string} triggerString Normalized trigger string (generated by Trigger.toString) * @return {string|undefined} Trigger name, if found */ ve.ui.TriggerRegistry.prototype.getNameByTrigger = function ( triggerString ) { return this.triggersByString[ triggerString ]; }; /** * Get trigger messages for a trigger by name * * @param {string} name Symbolic name * @return {string[]} List of trigger messages */ ve.ui.TriggerRegistry.prototype.getMessages = function ( name ) { return ( this.lookup( name ) || [] ).map( ( trigger ) => trigger.getMessage() ); }; /* Initialization */ ve.ui.triggerRegistry = new ve.ui.TriggerRegistry(); /* Registrations */ ve.ui.triggerRegistry.register( 'undo', { mac: new ve.ui.Trigger( 'cmd+z' ), pc: new ve.ui.Trigger( 'ctrl+z' ) } ); ve.ui.triggerRegistry.register( 'redo', { mac: [ new ve.ui.Trigger( 'cmd+shift+z' ), new ve.ui.Trigger( 'cmd+y' ) ], pc: [ new ve.ui.Trigger( 'ctrl+shift+z' ), new ve.ui.Trigger( 'ctrl+y' ) ] } ); ve.ui.triggerRegistry.register( 'bold', { mac: new ve.ui.Trigger( 'cmd+b' ), pc: new ve.ui.Trigger( 'ctrl+b' ) } ); ve.ui.triggerRegistry.register( 'italic', { mac: new ve.ui.Trigger( 'cmd+i' ), pc: new ve.ui.Trigger( 'ctrl+i' ) } ); ve.ui.triggerRegistry.register( 'link', { mac: new ve.ui.Trigger( 'cmd+k' ), pc: new ve.ui.Trigger( 'ctrl+k' ) } ); ve.ui.triggerRegistry.register( 'clear', { mac: [ new ve.ui.Trigger( 'cmd+\\' ) ], pc: [ new ve.ui.Trigger( 'ctrl+\\' ), new ve.ui.Trigger( 'ctrl+m' ) ] } ); ve.ui.triggerRegistry.register( 'underline', { mac: new ve.ui.Trigger( 'cmd+u' ), pc: new ve.ui.Trigger( 'ctrl+u' ) } ); ve.ui.triggerRegistry.register( 'code', { mac: new ve.ui.Trigger( 'cmd+shift+6' ), pc: new ve.ui.Trigger( 'ctrl+shift+6' ) } ); ve.ui.triggerRegistry.register( 'strikethrough', { mac: new ve.ui.Trigger( 'cmd+shift+5' ), pc: new ve.ui.Trigger( 'ctrl+shift+5' ) } ); ve.ui.triggerRegistry.register( 'subscript', { mac: new ve.ui.Trigger( 'cmd+,' ), pc: new ve.ui.Trigger( 'ctrl+,' ) } ); ve.ui.triggerRegistry.register( 'superscript', { mac: new ve.ui.Trigger( 'cmd+.' ), pc: new ve.ui.Trigger( 'ctrl+.' ) } ); ve.ui.triggerRegistry.register( 'indent', { mac: [ new ve.ui.Trigger( 'tab' ), new ve.ui.Trigger( 'cmd+]' ) ], pc: [ new ve.ui.Trigger( 'tab' ), new ve.ui.Trigger( 'ctrl+]' ) ] } ); ve.ui.triggerRegistry.register( 'outdent', { mac: [ new ve.ui.Trigger( 'shift+tab' ), new ve.ui.Trigger( 'cmd+[' ) ], pc: [ new ve.ui.Trigger( 'shift+tab' ), new ve.ui.Trigger( 'ctrl+[' ) ] } ); ve.ui.triggerRegistry.register( 'commandHelp', { mac: [ new ve.ui.Trigger( 'cmd+/' ), new ve.ui.Trigger( 'cmd+shift+/' ) // =cmd+? on most systems, but not all ], pc: [ new ve.ui.Trigger( 'ctrl+/' ), new ve.ui.Trigger( 'ctrl+shift+/' ) // =ctrl+? on most systems, but not all ] } ); // Ctrl+0-7 below are not mapped to Cmd+0-7 on Mac because Chrome reserves those for switching tabs ve.ui.triggerRegistry.register( 'paragraph', new ve.ui.Trigger( 'ctrl+0' ) ); ve.ui.triggerRegistry.register( 'heading1', new ve.ui.Trigger( 'ctrl+1' ) ); ve.ui.triggerRegistry.register( 'heading2', new ve.ui.Trigger( 'ctrl+2' ) ); ve.ui.triggerRegistry.register( 'heading3', new ve.ui.Trigger( 'ctrl+3' ) ); ve.ui.triggerRegistry.register( 'heading4', new ve.ui.Trigger( 'ctrl+4' ) ); ve.ui.triggerRegistry.register( 'heading5', new ve.ui.Trigger( 'ctrl+5' ) ); ve.ui.triggerRegistry.register( 'heading6', new ve.ui.Trigger( 'ctrl+6' ) ); ve.ui.triggerRegistry.register( 'preformatted', new ve.ui.Trigger( 'ctrl+7' ) ); ve.ui.triggerRegistry.register( 'blockquote', new ve.ui.Trigger( 'ctrl+8' ) ); ve.ui.triggerRegistry.register( 'selectAll', { mac: new ve.ui.Trigger( 'cmd+a' ), pc: new ve.ui.Trigger( 'ctrl+a' ) } ); ve.ui.triggerRegistry.register( 'delete', { mac: new ve.ui.Trigger( 'ctrl+d' ) } ); ve.ui.triggerRegistry.register( 'pasteSpecial', { mac: new ve.ui.Trigger( 'cmd+option+shift+v' ), pc: new ve.ui.Trigger( 'ctrl+shift+v' ) } ); // Clipboard triggers are registered for use by the commandHelpRegistry. // Cut/copy/paste are handled by native events. ve.ui.triggerRegistry.register( 'cut', { mac: new ve.ui.Trigger( 'cmd+x' ), pc: new ve.ui.Trigger( 'ctrl+x' ) } ); ve.ui.triggerRegistry.register( 'copy', { mac: new ve.ui.Trigger( 'cmd+c' ), pc: new ve.ui.Trigger( 'ctrl+c' ) } ); ve.ui.triggerRegistry.register( 'paste', { mac: new ve.ui.Trigger( 'cmd+v' ), pc: new ve.ui.Trigger( 'ctrl+v' ) } ); ve.ui.triggerRegistry.register( 'findAndReplace', { mac: new ve.ui.Trigger( 'cmd+f' ), pc: new ve.ui.Trigger( 'ctrl+f' ) } ); ve.ui.triggerRegistry.register( 'changeDirectionality', { mac: new ve.ui.Trigger( 'cmd+shift+x' ), pc: new ve.ui.Trigger( 'ctrl+shift+x' ) } ); ve.ui.triggerRegistry.register( 'findNext', { mac: new ve.ui.Trigger( 'cmd+g' ), pc: [ new ve.ui.Trigger( 'ctrl+g' ), new ve.ui.Trigger( 'f3' ) ] } ); ve.ui.triggerRegistry.register( 'findPrevious', { mac: new ve.ui.Trigger( 'cmd+shift+g' ), pc: [ new ve.ui.Trigger( 'shift+ctrl+g' ), new ve.ui.Trigger( 'shift+f3' ) ] } ); ve.ui.triggerRegistry.register( 'enterTableCell', [ new ve.ui.Trigger( 'enter' ), new ve.ui.Trigger( 'shift+enter' ), new ve.ui.Trigger( 'f2' ) ] ); ve.ui.triggerRegistry.register( 'submit', { mac: new ve.ui.Trigger( 'cmd+enter' ), pc: new ve.ui.Trigger( 'ctrl+enter' ) } ); ve.ui.triggerRegistry.register( 'cancel', new ve.ui.Trigger( 'escape' ) ); ve.ui.triggerRegistry.register( 'focusContext', { mac: new ve.ui.Trigger( 'cmd+shift+enter' ), pc: new ve.ui.Trigger( 'ctrl+shift+enter' ) } ); |