itutor-mathlive
Version:
Beautifully typeset math made easy
483 lines (425 loc) • 64.3 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"><title>editor/editor-shortcuts.js - MathLive Docs</title><meta name="description" content="Beautifully typeset math made easy"><meta name="keywords" content="latex, tex, math, typesetting, documentation, docs">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Source+Sans+Pro:400,400i,700,900" rel="stylesheet">
<style>pre.prettyprint{background: #35434e;}</style>
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow-night.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
<link type="text/css" rel="stylesheet" href="styles/custom.css">
</head>
<body>
<div class="forkme"><a href="https://github.com/arnog/mathlive"><img style="position: absolute; top: 0; right: 0; border: 0; z-index:1;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a></div>
<section role="navigation">
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav id="nav">
<h3 class="group-title home"><a href="index.html">MathLive Docs</a></h3><input class="search" placeholder="Search" type="text"><div class="list"><h3 class="group-title">Tutorials</h3><ul><li><a href="tutorial-CONTRIBUTOR_GUIDE.html">Contributor Guide</a></li><li><a href="tutorial-MASTON.html">MASTON</a></li><li><a href="tutorial-USAGE_GUIDE.html">Usage Guide</a></li></ul><h3 class="group-title">Classes</h3><ul><li class="private"><a href="Context.html" class="className">Context</a><ul class='methods private'><li data-type='method' class='private'><a href="Context.html#clone" class="methodName">clone</a></li><li data-type='method' class='private'><a href="Context.html#cloneWith" class="methodName">cloneWith</a></li><li data-type='method' class='private'><a href="Context.html#getBackgroundColor" class="methodName">getBackgroundColor</a></li><li data-type='method' class='private'><a href="Context.html#getColor" class="methodName">getColor</a></li><li data-type='method' class='private'><a href="Context.html#setMathstyle" class="methodName">setMathstyle</a></li><li data-type='method' class='private'><a href="Context.html#withMathstyle" class="methodName">withMathstyle</a></li></ul></li><li><a href="EditableMathlist.html" class="className">EditableMathlist</a><ul class='methods'><li data-type='method'><a href="EditableMathlist.html#_addCell" class="methodName">_addCell</a></li><li data-type='method'><a href="EditableMathlist.html#_deleteAtoms" class="methodName">_deleteAtoms</a></li><li data-type='method'><a href="EditableMathlist.html#addColumnAfter_" class="methodName">addColumnAfter_</a></li><li data-type='method'><a href="EditableMathlist.html#addColumnBefore_" class="methodName">addColumnBefore_</a></li><li data-type='method'><a href="EditableMathlist.html#addRowAfter_" class="methodName">addRowAfter_</a></li><li data-type='method'><a href="EditableMathlist.html#addRowBefore_" class="methodName">addRowBefore_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#ancestor" class="methodName">ancestor</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#anchor" class="methodName">anchor</a></li><li data-type='method'><a href="EditableMathlist.html#applyStyle" class="methodName">applyStyle</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#commandOffsets" class="methodName">commandOffsets</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#commitCommandStringBeforeInsertionPoint" class="methodName">commitCommandStringBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#contains" class="methodName">contains</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#decorateCommandStringAroundInsertionPoint" class="methodName">decorateCommandStringAroundInsertionPoint</a></li><li data-type='method'><a href="EditableMathlist.html#delete" class="methodName">delete</a></li><li data-type='method'><a href="EditableMathlist.html#delete_" class="methodName">delete_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteAll_" class="methodName">deleteAll_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteNextChar_" class="methodName">deleteNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteNextWord_" class="methodName">deleteNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#deletePreviousChar_" class="methodName">deletePreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#deletePreviousWord_" class="methodName">deletePreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToGroupEnd_" class="methodName">deleteToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToGroupStart_" class="methodName">deleteToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToMathFieldEnd_" class="methodName">deleteToMathFieldEnd_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#endOffset" class="methodName">endOffset</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extend" class="methodName">extend</a></li><li data-type='method'><a href="EditableMathlist.html#extendDown_" class="methodName">extendDown_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToGroupEnd_" class="methodName">extendToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToGroupStart_" class="methodName">extendToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToMathFieldEnd_" class="methodName">extendToMathFieldEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToMathFieldStart_" class="methodName">extendToMathFieldStart_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextBoundary_" class="methodName">extendToNextBoundary_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextChar_" class="methodName">extendToNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextWord_" class="methodName">extendToNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousBoundary_" class="methodName">extendToPreviousBoundary_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousChar_" class="methodName">extendToPreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousWord_" class="methodName">extendToPreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#extendUp_" class="methodName">extendUp_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractCharactersBeforeInsertionPoint" class="methodName">extractCharactersBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractCommandStringAroundInsertionPoint" class="methodName">extractCommandStringAroundInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractContents" class="methodName">extractContents</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractContentsOrdInGroupBeforeInsertionPoint" class="methodName">extractContentsOrdInGroupBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#filter" class="methodName">filter</a></li><li data-type='method'><a href="EditableMathlist.html#insert" class="methodName">insert</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#insertFirstAtom" class="methodName">insertFirstAtom</a></li><li data-type='method'><a href="EditableMathlist.html#isCollapsed" class="methodName">isCollapsed</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#jump" class="methodName">jump</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#leap" class="methodName">leap</a></li><li data-type='method'><a href="EditableMathlist.html#moveAfterParent_" class="methodName">moveAfterParent_</a></li><li data-type='method'><a href="EditableMathlist.html#moveBeforeParent_" class="methodName">moveBeforeParent_</a></li><li data-type='method'><a href="EditableMathlist.html#moveDown_" class="methodName">moveDown_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToGroupEnd_" class="methodName">moveToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToGroupStart_" class="methodName">moveToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToMathFieldEnd_" class="methodName">moveToMathFieldEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToMathFieldStart_" class="methodName">moveToMathFieldStart_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextChar_" class="methodName">moveToNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextPlaceholder_" class="methodName">moveToNextPlaceholder_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextWord_" class="methodName">moveToNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToOpposite_" class="methodName">moveToOpposite_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousChar_" class="methodName">moveToPreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousPlaceholder_" class="methodName">moveToPreviousPlaceholder_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousWord_" class="methodName">moveToPreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToSubscript_" class="methodName">moveToSubscript_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToSuperscript_" class="methodName">moveToSuperscript_</a></li><li data-type='method'><a href="EditableMathlist.html#moveUp_" class="methodName">moveUp_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#next" class="methodName">next</a></li><li data-type='method'><a href="EditableMathlist.html#selectAll_" class="methodName">selectAll_</a></li><li data-type='method'><a href="EditableMathlist.html#selectGroup_" class="methodName">selectGroup_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setExtent" class="methodName">setExtent</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setRange" class="methodName">setRange</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setSelection" class="methodName">setSelection</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#sibling" class="methodName">sibling</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#siblings" class="methodName">siblings</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#skip" class="methodName">skip</a></li><li data-type='method'><a href="EditableMathlist.html#speakAll_" class="methodName">speakAll_</a></li><li data-type='method'><a href="EditableMathlist.html#speakAllWithSynchronizedHighlighting_" class="methodName">speakAllWithSynchronizedHighlighting_</a></li><li data-type='method'><a href="EditableMathlist.html#speakGroup_" class="methodName">speakGroup_</a></li><li data-type='method'><a href="EditableMathlist.html#speakLeftSibling_" class="methodName">speakLeftSibling_</a></li><li data-type='method'><a href="EditableMathlist.html#speakParent_" class="methodName">speakParent_</a></li><li data-type='method'><a href="EditableMathlist.html#speakRightSibling_" class="methodName">speakRightSibling_</a></li><li data-type='method'><a href="EditableMathlist.html#speakSelection_" class="methodName">speakSelection_</a></li><li data-type='method'><a href="EditableMathlist.html#speakSelectionWithSynchronizedHighlighting_" class="methodName">speakSelectionWithSynchronizedHighlighting_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#startOffset" class="methodName">startOffset</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#toString" class="methodName">toString</a></li><li data-type='method'><a href="EditableMathlist.html#transpose_" class="methodName">transpose_</a></li></ul></li><li class="private"><a href="Lexer.html" class="className">Lexer</a><ul class='methods private'><li data-type='method' class='private'><a href="Lexer.html#end" class="methodName">end</a></li><li data-type='method' class='private'><a href="Lexer.html#get" class="methodName">get</a></li><li data-type='method' class='private'><a href="Lexer.html#isWhiteSpace" class="methodName">isWhiteSpace</a></li><li data-type='method' class='private'><a href="Lexer.html#makeToken" class="methodName">makeToken</a></li><li data-type='method' class='private'><a href="Lexer.html#peek" class="methodName">peek</a></li><li data-type='method' class='private'><a href="Lexer.html#scan" class="methodName">scan</a></li></ul></li><li class="private"><a href="MathAtom.html" class="className">MathAtom</a><ul class='methods private'><li data-type='method' class='private'><a href="MathAtom.html#.toSpeakableText" class="methodName">toSpeakableText</a></li><li data-type='method' class='private'><a href="MathAtom.html#bind" class="methodName">bind</a></li><li data-type='method' class='private'><a href="MathAtom.html#decompose" class="methodName">decompose</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeGenfrac" class="methodName">decomposeGenfrac</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeLeftright" class="methodName">decomposeLeftright</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeLine" class="methodName">decomposeLine</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeRule" class="methodName">decomposeRule</a></li><li data-type='method' class='private'><a href="MathAtom.html#filter" class="methodName">filter</a></li><li data-type='method' class='private'><a href="MathAtom.html#makeSpan" class="methodName">makeSpan</a></li></ul></li><li><a href="MathField.html" class="className">MathField</a><ul class='methods'><li data-type='method' class='private'><a href="MathField.html#_getCaretPosition" class="methodName">_getCaretPosition</a></li><li data-type='method' class='private'><a href="MathField.html#_onKeystroke" class="methodName">_onKeystroke</a></li><li data-type='method' class='private'><a href="MathField.html#complete_" class="methodName">complete_</a></li><li data-type='method'><a href="MathField.html#el" class="methodName">el</a></li><li data-type='method' class='private'><a href="MathField.html#enterCommandMode_" class="methodName">enterCommandMode_</a></li><li data-type='method'><a href="MathField.html#insert" class="methodName">insert</a></li><li data-type='method'><a href="MathField.html#keystroke" class="methodName">keystroke</a></li><li data-type='method'><a href="MathField.html#latex" class="methodName">latex</a></li><li data-type='method'><a href="MathField.html#perform" class="methodName">perform</a></li><li data-type='method'><a href="MathField.html#perform" class="methodName">perform</a></li><li data-type='method' class='private'><a href="MathField.html#render" class="methodName">render</a></li><li data-type='method'><a href="MathField.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li><li data-type='method'><a href="MathField.html#selectedText" class="methodName">selectedText</a></li><li data-type='method'><a href="MathField.html#selectionAtEnd" class="methodName">selectionAtEnd</a></li><li data-type='method'><a href="MathField.html#selectionAtStart" class="methodName">selectionAtStart</a></li><li data-type='method'><a href="MathField.html#selectionDepth" class="methodName">selectionDepth</a></li><li data-type='method'><a href="MathField.html#selectionIsCollapsed" class="methodName">selectionIsCollapsed</a></li><li data-type='method'><a href="MathField.html#setConfig" class="methodName">setConfig</a></li><li data-type='method'><a href="MathField.html#text" class="methodName">text</a></li><li data-type='method'><a href="MathField.html#typedText" class="methodName">typedText</a></li></ul></li><li class="private"><a href="module-mathstyle.Mathstyle.html" class="className">Mathstyle</a></li><li class="private"><a href="Parser.html" class="className">Parser</a><ul class='methods private'><li data-type='method' class='private'><a href="Parser.html#end" class="methodName">end</a></li><li data-type='method' class='private'><a href="Parser.html#hasLiteral" class="methodName">hasLiteral</a></li><li data-type='method' class='private'><a href="Parser.html#hasLiteralPattern" class="methodName">hasLiteralPattern</a></li><li data-type='method' class='private'><a href="Parser.html#hasToken" class="methodName">hasToken</a></li><li data-type='method' class='private'><a href="Parser.html#lastMathAtom" class="methodName">lastMathAtom</a></li><li data-type='method' class='private'><a href="Parser.html#parseAtom" class="methodName">parseAtom</a></li><li data-type='method' class='private'><a href="Parser.html#parseKeyword" class="methodName">parseKeyword</a></li><li data-type='method' class='private'><a href="Parser.html#parseLimits" class="methodName">parseLimits</a></li><li data-type='method' class='private'><a href="Parser.html#parseSupSub" class="methodName">parseSupSub</a></li><li data-type='method' class='private'><a href="Parser.html#parseToken" class="methodName">parseToken</a></li><li data-type='method' class='private'><a href="Parser.html#scanArg" class="methodName">scanArg</a></li><li data-type='method' class='private'><a href="Parser.html#scanColor" class="methodName">scanColor</a></li><li data-type='method' class='private'><a href="Parser.html#scanDelim" class="methodName">scanDelim</a></li><li data-type='method' class='private'><a href="Parser.html#scanDimen" class="methodName">scanDimen</a></li><li data-type='method' class='private'><a href="Parser.html#scanEnvironment" class="methodName">scanEnvironment</a></li><li data-type='method' class='private'><a href="Parser.html#scanGroup" class="methodName">scanGroup</a></li><li data-type='method' class='private'><a href="Parser.html#scanImplicitGroup" class="methodName">scanImplicitGroup</a></li><li data-type='method' class='private'><a href="Parser.html#scanLeftRight" class="methodName">scanLeftRight</a></li><li data-type='method' class='private'><a href="Parser.html#scanModeSet" class="methodName">scanModeSet</a></li><li data-type='method' class='private'><a href="Parser.html#scanModeShift" class="methodName">scanModeShift</a></li><li data-type='method' class='private'><a href="Parser.html#scanNumber" class="methodName">scanNumber</a></li><li data-type='method' class='private'><a href="Parser.html#scanString" class="methodName">scanString</a></li><li data-type='method' class='private'><a href="Parser.html#scanToken" class="methodName">scanToken</a></li></ul></li><li class="private"><a href="Span.html" class="className">Span</a></li><li class="private"><a href="Token.html" class="className">Token</a></li><li class="private"><a href="UndoManager.html" class="className">UndoManager</a><ul class='methods private'><li data-type='method' class='private'><a href="UndoManager.html#canRedo" class="methodName">canRedo</a></li><li data-type='method' class='private'><a href="UndoManager.html#canUndo" class="methodName">canUndo</a></li><li data-type='method' class='private'><a href="UndoManager.html#redo" class="methodName">redo</a></li><li data-type='method' class='private'><a href="UndoManager.html#snapshot" class="methodName">snapshot</a></li><li data-type='method' class='private'><a href="UndoManager.html#undo" class="methodName">undo</a></li></ul></li></ul><h3 class="group-title">Modules</h3><ul><li class="private"><a href="module-color.html" class="className">color</a><ul class='methods private'><li data-type='method' class='private'><a href="module-color.html#.stringToColor" class="methodName">stringToColor</a></li></ul></li><li class="private"><a href="module-definitions.html" class="className">definitions</a><ul class='methods private'><li data-type='method' class='private'><a href="module-definitions.html#.defineEnvironment" class="methodName">defineEnvironment</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineFunction" class="methodName">defineFunction</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbol" class="methodName">defineSymbol</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbolRange" class="methodName">defineSymbolRange</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbols" class="methodName">defineSymbols</a></li><li data-type='method' class='private'><a href="module-definitions.html#.frequency" class="methodName">frequency</a></li><li data-type='method' class='private'><a href="module-definitions.html#.getInfo" class="methodName">getInfo</a></li><li data-type='method' class='private'><a href="module-definitions.html#.matchCodepoint" class="methodName">matchCodepoint</a></li><li data-type='method' class='private'><a href="module-definitions.html#.matchFunction" class="methodName">matchFunction</a></li><li data-type='method' class='private'><a href="module-definitions.html#.parseParamTemplateArgument" class="methodName">parseParamTemplateArgument</a></li><li data-type='method' class='private'><a href="module-definitions.html#.suggest" class="methodName">suggest</a></li></ul></li><li class="private"><a href="module-delimiters.html" class="className">delimiters</a><ul class='methods private'><li data-type='method' class='private'><a href="module-delimiters.html#.makeCustomSizedDelim" class="methodName">makeCustomSizedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeInner" class="methodName">makeInner</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeLargeDelim" class="methodName">makeLargeDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeLeftRightDelim" class="methodName">makeLeftRightDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeNullFence" class="methodName">makeNullFence</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeSizedDelim" class="methodName">makeSizedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeSmallDelim" class="methodName">makeSmallDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeStackedDelim" class="methodName">makeStackedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.traverseSequence" class="methodName">traverseSequence</a></li></ul></li><li class="private"><a href="module-editor_editableMathlist.html" class="className">editor/editableMathlist</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_editableMathlist.html#~atomContains" class="methodName">atomContains</a></li></ul></li><li class="private"><a href="module-editor_keyboard.html" class="className">editor/keyboard</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_keyboard.html#.delegateKeyboardEvents" class="methodName">delegateKeyboardEvents</a></li><li data-type='method' class='private'><a href="module-editor_keyboard.html#.keyboardEventToString" class="methodName">keyboardEventToString</a></li></ul></li><li class="private"><a href="module-editor_mathfield.html" class="className">editor/mathfield</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_mathfield.html#nearestElementFromPoint" class="methodName">nearestElementFromPoint</a></li></ul></li><li class="private"><a href="module-editor_mathpath.html" class="className">editor/mathpath</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathCommonAncestor" class="methodName">pathCommonAncestor</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathDistance" class="methodName">pathDistance</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathFromString" class="methodName">pathFromString</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathToString" class="methodName">pathToString</a></li></ul></li><li class="private"><a href="module-editor_shortcuts.html" class="className">editor/shortcuts</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.match" class="methodName">match</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.matchKeystroke" class="methodName">matchKeystroke</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.platform" class="methodName">platform</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.stringify" class="methodName">stringify</a></li></ul></li><li class="private"><a href="module-fontMetrics.html" class="className">fontMetrics</a><ul class='methods private'><li data-type='method' class='private'><a href="module-fontMetrics.html#.getCharacterMetrics" class="methodName">getCharacterMetrics</a></li></ul></li><li class="private"><a href="module-lexer.html" class="className">lexer</a><ul class='methods private'><li data-type='method' class='private'><a href="module-lexer.html#.tokenize" class="methodName">tokenize</a></li></ul></li><li class="private"><a href="module-mathAtom.html" class="className">mathAtom</a><ul class='methods private'><li data-type='method' class='private'><a href="module-mathAtom.html#.decompose" class="methodName">decompose</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.getFontName" class="methodName">getFontName</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeColGap" class="methodName">makeColGap</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeColOfRepeatingElements" class="methodName">makeColOfRepeatingElements</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeStack" class="methodName">makeStack</a></li></ul></li><li><a href="module-mathlive.html" class="className">mathlive</a><ul class='methods'><li data-type='method'><a href="module-mathlive.html#latexToAST" class="methodName">latexToAST</a></li><li data-type='method'><a href="module-mathlive.html#latexToMarkup" class="methodName">latexToMarkup</a></li><li data-type='method'><a href="module-mathlive.html#latexToMathML" class="methodName">latexToMathML</a></li><li data-type='method'><a href="module-mathlive.html#latexToSpeakableText" class="methodName">latexToSpeakableText</a></li><li data-type='method'><a href="module-mathlive.html#makeMathField" class="methodName">makeMathField</a></li><li data-type='method'><a href="module-mathlive.html#pauseReadAloud" class="methodName">pauseReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#playReadAloud" class="methodName">playReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#readAloud" class="methodName">readAloud</a></li><li data-type='method'><a href="module-mathlive.html#readAloudStatus" class="methodName">readAloudStatus</a></li><li data-type='method'><a href="module-mathlive.html#renderMathInDocument" class="methodName">renderMathInDocument</a></li><li data-type='method'><a href="module-mathlive.html#renderMathInElement" class="methodName">renderMathInElement</a></li><li data-type='method'><a href="module-mathlive.html#resumeReadAloud" class="methodName">resumeReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li><li data-type='method'><a href="module-mathlive.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li></ul></li><li class="private"><a href="module-mathstyle.html" class="className">mathstyle</a><ul class='methods private'><li data-type='method' class='private'><a href="module-mathstyle.html#.toMathstyle" class="methodName">toMathstyle</a></li></ul></li><li class="private"><a href="module-span.html" class="className">span</a><ul class='methods private'><li data-type='method' class='private'><a href="module-span.html#.coalesce" class="methodName">coalesce</a></li><li data-type='method' class='private'><a href="module-span.html#.makeFontSizer" class="methodName">makeFontSizer</a></li><li data-type='method' class='private'><a href="module-span.html#.makeHlist" class="methodName">makeHlist</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSpan" class="methodName">makeSpan</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSpanOfType" class="methodName">makeSpanOfType</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSymbol" class="methodName">makeSymbol</a></li><li data-type='method' class='private'><a href="module-span.html#.makeVlist" class="methodName">makeVlist</a></li><li data-type='method' class='private'><a href="module-span.html#.toString" class="methodName">toString</a></li></ul></li></ul><label class="checkbox"><input id="toggle-private" type="checkbox" onclick="
if (!document.getElementById('toggle-private').checked) {
document.documentElement.classList.add('no-private')
writeCookie('symbol-access', 'no-private')
} else {
document.documentElement.classList.remove('no-private')
writeCookie('symbol-access', 'private')
}
">Include Private Symbols</input></label></div>
<footer role="contentInfo">
Made with <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>.
</footer>
</nav>
</section>
<main id="main">
<h1 class="page-title">editor/editor-shortcuts.js</h1>
<section>
<article>
<pre class="prettyprint source linenums">
<code>
/**
* @module editor/shortcuts
* @private
*/
define([], function() {
/**
* The index of this array is a keystroke combination as returned by the key
* field of a Javascript keyboard event as documented here:
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
* except for:
* - `Escape` → `Esc`
* - `LeftArrow`... → `Left/Right/Up/Down`
* - `Delete` → `Del`
* - `Escape` → `Esc`
* - ' ' → `Spacebar`
*
* The modifiers are specified before the main key, in the following order:
* 1. `Ctrl`
* 2. `Meta`: Command key on Mac OS. On Windows this is the Windows key,
* but the system intercepts those key combinations so they are never received
* 3. `Alt`: Option key on Mac OS
* 4. `Shift`
*
* The keys can be preceded by a context to restrict when the shortcut is
* applicable. For example, "math:Ctrl-KeyA" will restrict this shortcut
* to only apply in the "math" context (parseMode). Other valid context include
* "text" and "command".
*
* The value of the entries represent the command to perform.
* This can be either a single selector, or an array of a selector followed
* by its arguments.
* Selectors uses the following naming conventions:
* - a 'char' is a math atom (a letter, digit, symbol or compound atom)
* - a 'word' is a sequence of math atoms of the same type
* - a 'group' is a sequence of sibling atoms, for example a numerator or
* a superscript
* - the 'MathField' is the entire expression being edited
* - a 'placeholder' is either an actual placeholder atom or an empty child
* list, for example an empty numerator
* - 'move' changes the position of the insertion point (and collapses the
* selection range if necessary)
* - 'extend' keeps the anchor of the selection, but moves the focus (extends,
* or shrinks, the range of selected items)
*
* @memberof module:editor/shortcuts
* @type {Object<string,string>}
*/
const KEYBOARD_SHORTCUTS = {
'Backspace': 'deletePreviousChar',
'Alt-Backspace': 'deleteNextChar',
'Del': 'deleteNextChar',
'Alt-Del': 'deletePreviousChar',
'Left': 'moveToPreviousChar',
'Shift-Left': 'extendToPreviousChar',
'Ctrl-Left': 'moveToGroupStart',
'Ctrl-Shift-Left': 'extendToGroupStart',
'Alt-Left': 'moveToPreviousWord',
'Alt-Shift-Left': 'extendToPreviousWord',
'Right': 'moveToNextChar',
'Ctrl-Right': 'moveToGroupEnd',
'Ctrl-Shift-Right': 'extendToGroupEnd',
'Shift-Right': 'extendToNextChar',
'Alt-Right': 'moveToNextWord',
'Alt-Shift-Right': 'extendToNextWord',
'Home': 'moveToMathFieldStart',
'mac:Meta-Left': 'moveToMathFieldStart',
'Shift-Home': 'extendToMathFieldStart',
'mac:Meta-Shift-Left': 'extendToMathFieldStart',
'End': 'moveToMathFieldEnd',
'mac:Meta-Right': 'moveToMathFieldEnd',
'Shift-End': 'extendToMathFieldEnd',
'mac:Meta-Shift-Right': 'extendToMathFieldEnd',
'Up': 'moveUp',
'Shift-Up': 'extendUp',
'Down': 'moveDown',
'Shift-Down': 'extendDown',
'Shift-Spacebar': 'moveBeforeParent',
'Spacebar': 'moveAfterParent',
'PageUp': 'moveToGroupStart',
'PageDown': 'moveToGroupEnd',
'math:Tab': 'moveToNextPlaceholder',
'math:F8': 'moveToNextPlaceholder', // Visual Studio
'math:Shift-Tab': 'moveToPreviousPlaceholder',
'math:Shift-F8': 'moveToPreviousPlaceholder', // Visual Studio
'math:Esc': 'enterCommandMode',
'math:Backslash': 'enterCommandMode',
'command:Spacebar': 'complete',
'command:Esc': 'complete',
'command:Tab': 'complete',
'ios:command:Tab': 'nextSuggestion',
'command:Return': 'complete',
'command:Enter': 'complete',
'command:Shift-Esc': 'complete', // Some keyboards can't generate
// this combination, for example in 60% keyboards it is mapped to ~
'command:Down': 'nextSuggestion',
'command:Up': 'previousSuggestion',
'!mac:math:Ctrl-KeyA': 'selectAll',
'mac:math:Meta-KeyA': 'selectAll',
'!mac:Ctrl-KeyZ': 'undo',
'mac:Meta-KeyZ': 'undo',
'!mac:Ctrl-KeyY': 'redo', // ARIA recommendation
'mac:Meta-Shift-KeyY': 'redo',
'!mac:Ctrl-Shift-KeyZ': 'redo',
'mac:Meta-Shift-KeyZ': 'redo',
// Rare keys on some extended keyboards
'Cut': 'cut',
'Copy': 'copy',
'Paste': 'paste',
'Undo': 'undo',
'Redo': 'redo',
'Clear': 'delete',
'EraseEof': 'deleteToGroupEnd',
// EMACS/MACOS BINDINGS
'mac:Ctrl-KeyB': 'moveToPreviousChar',
'mac:Ctrl-Shift-KeyB': 'extendToPreviousChar',
'mac:Ctrl-KeyF': 'moveToNextChar',
'mac:Ctrl-Shift-KeyF': 'extendToNextChar',
'mac:Ctrl-Alt-KeyB': 'moveToPreviousWord',
'mac:Ctrl-Shift-Alt-KeyB': 'extendToPreviousWord',
'mac:Ctrl-Alt-KeyF': 'moveToNextWord',
'mac:Ctrl-Shift-Alt-KeyF': 'extendToNextWord',
'mac:Ctrl-KeyA': 'moveToMathFieldStart',
'mac:Ctrl-Shift-KeyA': 'extendToMathFieldStart',
'mac:Ctrl-KeyE': 'moveToMathFieldEnd',
'mac:Ctrl-Shift-KeyE': 'extendToMathFieldEnd',
'mac:Ctrl-KeyP': 'moveUp',
'mac:Ctrl-Shift-KeyP': 'extendUp',
'mac:Ctrl-KeyN': 'extendDown',
'mac:Ctrl-KeyH': 'deletePreviousChar',
'mac:Ctrl-KeyD': 'deleteNextChar',
'mac:Ctrl-KeyL': 'scrollIntoView',
'mac:Ctrl-KeyT': 'transpose',
// WOLFRAM MATHEMATICA BINDINGS
'math:Ctrl-Digit2': ['insert', '\\sqrt{#0}'],
'math:Ctrl-Digit5': 'moveToOpposite',
'math:Ctrl-Digit6': 'moveToSuperscript',
'math:Ctrl-Minus': 'moveToSubscript',
'math:Alt-BracketLeft': ['insert', '\\left[ #0 \\right]'],
'math:Alt-Shift-BracketLeft': ['insert', '\\left{ #0 \\right}'],
'math:Ctrl-Enter': 'addRowAfter',
'math:Ctrl-Comma': 'addColumnAfter',
// MATHLIVE BINDINGS
'math:Alt-KeyQ': ['insert', '\\theta'],
'math:Alt-KeyV': ['insert', '\\sqrt{#0}'],
'math:Alt-KeyP': ['insert', '\\pi'],
'math:Alt-Shift-KeyP': ['insert', '\\prod_{i=#?}^{#?}'],
'math:Alt-KeyW': ['insert', '\\sum_{i=#?}^{#?}'],
'math:Alt-KeyB': ['insert', '\\int_{#?}^{#?}'],
'math:Alt-KeyU': ['insert', '\\cup'],
'math:Alt-KeyN': ['insert', '\\cap'],
'math:Alt-Shift-KeyU': ['insert', '\\bigcup'],
'math:Alt-Shift-KeyN': ['insert', '\\bigcap'],
'math:Alt-Shift-KeyA': ['insert', '\\forall'],
'math:Alt-Shift-KeyE': ['insert', '\\exists'],
'math:Alt-Digit5': ['insert', '\\infty'], // "%" key
'math:Alt-Digit6': ['insert', '\\wedge'], // "^" key
'math:Alt-Shift-Digit6': ['insert', '\\vee'], // "^" key
'math:Alt-Digit9': ['insert', '('], // "(" key, override smartFence
'math:Alt-Digit0': ['insert', ')'], // ")" key, override smartFence
'math:Alt-keyD': ['insert', '\\differentialD'],
'math:Alt-Shift-KeyD': ['insert', '\\partial'],
'math:Slash': ['insert', '\\frac{#@}{#?}'],
'math:Alt-Slash': ['insert', '\\frac{#?}{#@}'],
'math:Alt-KeyO': ['insert', '\\emptyset'],
'math:Alt-Shift-KeyO': ['insert', '\\varnothing'],
// Accessibility
'Alt-Shift-KeyK': 'toggleKeystrokeCaption',
'Alt-Space': 'toggleVirtualKeyboard',
// Note: On Mac OS (as of 10.12), there is a bug/behavior that causes
// a beep to be generated with certain command+control key combinations.
// The workaround is to create a default binding file to silence them.
// In ~/Library/KeyBindings/DefaultKeyBinding.dict add these entries:
/*
{
"^@\UF701" = "noop:";
"^@\UF702" = "noop:";
"^@\UF703" = "noop:";
}
*/
'mac:Ctrl-Meta-Up': 'speakParent',
'!mac:Ctrl-Alt-Up': 'speakParent',
'mac:Ctrl-Meta-Down': 'speakGroup',
'!mac:Ctrl-Alt-Down': 'speakGroup',
'mac:Ctrl-Meta-Left': 'speakLeftSibling',
'!mac:Ctrl-Alt-Left': 'speakLeftSibling',
'mac:Ctrl-Meta-Right': 'speakRightSibling',
'!mac:Ctrl-Alt-Right': 'speakRightSibling',
'mac:Ctrl-Meta-Shift-Down': 'speakAllWithSynchronizedHighlighting',
'!mac:Ctrl-Alt-Shift-Down': 'speakAllWithSynchronizedHighlighting',
}
/**
* Most commands can be associated to their keyboard shortcuts from the
* KEYBOARD_SHORTCUTS table above, for example 'speakSelection' -> 'Ctrl-KeyR'
* However, those that contain complex commands are more ambiguous.
* For example, '\sqrt' -> 'math-Alt-KeyV'. This table provides the reverse
* mapping for those more complex commands. It is used when displaying
* keyboard shortcuts for specific commands in the popover.
* @memberof module:editor/shortcuts
* @type {Object<string,string>}
*/
const REVERSE_KEYBOARD_SHORTCUTS = {
'\\theta': 'Alt-KeyQ',
'\\sqrt': ['Alt-KeyV', 'Ctrl-Digit2'],
'\\pi': 'Alt-KeyP',
'\\prod': 'Alt-Shift-KeyP',
'\\sum': 'Alt-KeyW',
'\\int': 'Alt-KeyB',
'\\cup': 'Alt-KeyU',
'\\cap': 'Alt-KeyN',
'\\bigcup': 'Alt-Shift-KeyU',
'\\bigcap': 'Alt-Shift-KeyN',
'\\forall': 'Alt-Shift-KeyA',
'\\exists': 'Alt-Shift-KeyE',
'\\infty': 'Alt-Digit5',
'\\wedge': 'Alt-Digit5',
'\\vee': 'Alt-Shift-Digit6',
'\\differentialD': 'Alt-keyD',
'\\partial': 'Alt-Shift-KeyD',
'\\frac': 'Slash',
'\\emptyset': 'Alt-KeyO',
'\\varnothing': 'Alt-Shift-KeyO'
}
/**
* These shortcut strings are replaced with the corresponding LaTeX expression
* without requiring an escape sequence or command.
*
* @type {Object.<string,string>}
* @memberof module:editor/shortcuts
*/
const INLINE_SHORTCUTS = {
'>=': '\\ge', //ASCIIMath
'<=': '\\le', //ASCIIMath
'!=': '\\ne',
'?=': '\\questeq',
'≈': '\\approx',
'~~': '\\approx', // ASCIIMath
'÷': '\\div',
'-:': '\\div', // ASCIIMath
'¬': '\\neg',
'+-': '\\pm', // ASCIIMath
'-=': '\\equiv', // ASCIIMath
'~=': '\\cong', // ASCIIMath
':=': '\\coloneq',
'::': '\\Colon',
'(:': '\\langle',
':)': '\\rangle',
'-<': '\\prec', // ASCIIMath
'-<=': '\\preceq', // ASCIIMath
// '>-': '\\succ', // ASCIIMath
'>-=': '\\succeq', // ASCIIMath
'prop': '\\propto', // ASCIIMath
':.': '\\therefore', // ASCIIMath
'**': '\\star', // ASCIIMath
'xx': '\\times', // ASCIIMath
'@': '\\circ', // ASCIIMath
'diamond': '\\diamond', // ASCIIMath
'square': '\\square', // ASCIIMath
'iff': '\\iff', // ASCIIMath
'alpha': '\\alpha', // ASCIIMath
'beta': '\\beta', // ASCIIMath
'gamma': '\\gamma', // ASCIIMath
'Gamma': '\\Gamma', // ASCIIMath
'delta': '\\delta', // ASCIIMath
'Delta': '\\Delta', // ASCIIMath
'chi': '\\chi', // ASCIIMath
'epsilon': '\\epsilon', // ASCIIMath
'varepsilon': '\\varepsilon', // ASCIIMath
'eta': '\\eta', // ASCIIMath
'iota': '\\iota', // ASCIIMath
'kappa': '\\kappa', // ASCIIMath
'lambda': '\\lambda', // ASCIIMath
'Lambda': '\\Lambda', // ASCIIMath
'mu': '\\mu', // ASCIIMath
'µ': '\\mu', // @TODO: or micro?
// 'nu': '\\nu', // ASCIIMath
'pi': '\\pi',
'π': '\\pi',
'Pi': '\\Pi',
'phi': '\\phi',
'Phi': '\\Phi',
'varphi': '\\varphi',
'psi': '\\psi',
'Psi': '\\Psi',
'rho': '\\rho',
'tau': '\\tau',
'sigma': '\\sigma',
'Sigma': '\\Sigma',
'theta': '\\theta',
'Theta': '\\Theta',
'vartheta': '\\vartheta',
'upsilon': '\\upsilon',
// 'xi': '\\xi',
'Xi': '\\Xi',
'zeta': '\\zeta',
'omega': '\\omega',
'Ω': '\\omega', // @TODO: or ohm?
'ii': '\\imaginaryI',
'jj': '\\imaginaryJ',
'ee': '\\exponentialE',
'nabla': '\\nabla',
'oo': '\\infty', // ASCIIMath
'\u221e': '\\infty', // @TODO: doesn't work
// '&infin;': '\\infty',
// '&#8734;': '\\infty',
'∑': '\\sum',
'sum': '\\sum_{#?}^{#?}', // ASCIIMath
'prod': '\\prod_{#?}^{#?}', // ASCIIMath
'∆': '\\diffd', // @TODO: most common?
'grad': '\\nabla', // ASCIIMath
'∂': '\\differentialD',
'del': '\\partial', // ASCIIMath
'√': '\\sqrt',
'sqrt': '\\sqrt',
'∫': '\\int',
'aleph': '\\aleph', // ASCIIMath
'nn': '\\cap', // ASCIIMath
'nnn': '\\bigcap', // ASCIIMath
'uu': '\\cup', // ASCIIMath
'uuu': '\\bigcup', // ASCIIMath
// 'arg': '\\arg',
'sin': '\\sin',
'cos': '\\cos',
'tan': '\\tan',
'tanh': '\\tanh',
'log': '\\log',
'ln': '\\ln',
'exp': '\\exp',
'lim': '\\lim_{#?}',
'liminf': '\\mathop{lim~inf}\\limits_{#?}',
'limsup': '\\mathop{lim~sup}\\limits_{#?}',
'argmin': '\\mathop{arg~min}\\limits_{#?}',
'argmax': '\\mathop{arg~max}\\limits_{#?}',
'det': '\\det',
'mod': '\\mod',
'max': '\\max',
'min': '\\min',
'erf': '\\mathop{erf}',
'erfc': '\\mathop{erfc}',
'bessel': '\\mathop{bessel}',
'mean': '\\mathop{mean}',
'median': '\\mathop{median}',
'fft': '\\mathop{fft}',
'lcm': '\\mathop{lcm}',
'gcd': '\\mathop{gcd}',
'randomReal': '\\mathop{randomReal}',
'randomInteger': '\\mathop{randomInteger}',
'km': '\\mathop{km}', // Unit: kilometer
'NN': '\\N', // Natural numbers
'ZZ': '\\Z', // Integers
'QQ': '\\Q', // Rational numbers
'RR': '\\R', // Real numbers
'CC': '\\C', // Complex numbers
'PP': '\\P', // Prime numbers
'forall': '\\forall',
'AA': '\\forall',
'!exists': '\\nexists', // TODO: conflicts with 'exists'
'exists': '\\exists',
'EE': '\\exists',
'!EE': '\\nexists',
// 'in': '\\in',
'!in': '\\notin',
'sub': '\\subset', // ASCIIMath
'sup': '\\supset', // ASCIIMath
'sube': '\\subseteq', // ASCIIMath
'supe': '\\supseteq', // ASCIIMath
'&&': '\\land',
// '||': '\\lor',
'...': '\\ldots', // In general, use \ldots
'+...': '+\\cdots', // ... but use \cdots after + ...
'-...': '-\\cdots', // ... - and ...
'->...': '\to\\cdots', // ->
'->': '\\to',
'∣−>': '\\mapsto',
'-->': '\\longrightarrow',
// '<-': '\\leftarrow',
'<--': '\\longleftarrow',
'=>': '\\Rightarrow',
'==>': '\\Longrightarrow',
// '<=': '\\Leftarrow', // CONFLICTS WITH LESS THAN OR EQUAL
'<=>': '\\Le