Skip to content

Commit

Permalink
Insert borrow/share commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Oct 29, 2023
1 parent 7343f3e commit 456ed47
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/components/editor/util/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
TABLE_OPEN_SYMBOL,
TABLE_CLOSE_SYMBOL,
EDIT_SYMBOL,
BORROW_SYMBOL,
SHARE_SYMBOL,
} from '@parser/Symbols';

import Source from '@nodes/Source';
Expand Down Expand Up @@ -896,6 +898,36 @@ const Commands: Command[] = [
return caret.insert(TABLE_CLOSE_SYMBOL) ?? false;
},
},
{
symbol: BORROW_SYMBOL,
description: (l) => l.ui.source.cursor.insertBorrow,
visible: Visibility.Visible,
category: Category.Insert,
alt: true,
shift: false,
control: true,
key: 'ArrowDown',
keySymbol: '↓',
execute: ({ caret }) => {
if (caret === undefined) return false;
return caret.insert(BORROW_SYMBOL) ?? false;
},
},
{
symbol: SHARE_SYMBOL,
description: (l) => l.ui.source.cursor.insertShare,
visible: Visibility.Visible,
category: Category.Insert,
alt: true,
shift: false,
control: true,
key: 'ArrowUp',
keySymbol: '↑',
execute: ({ caret }) => {
if (caret === undefined) return false;
return caret.insert(SHARE_SYMBOL) ?? false;
},
},

// EVALUATE
StepBackNode,
Expand Down
4 changes: 4 additions & 0 deletions src/locale/UITexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ type UITexts = {
insertTable: string;
/** Insert table close symbol */
insertTableClose: string;
/** Insert borrow symbol */
insertBorrow: string;
/** Insert share symbol */
insertShare: string;
/** Insert new line */
insertLine: string;
/** Delete previous symbol */
Expand Down
2 changes: 2 additions & 0 deletions src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3867,6 +3867,8 @@
"insertPrevious": "insert previous symbol",
"insertTable": "insert table open symbol",
"insertTableClose": "insert table close symbol",
"insertBorrow": "insert borrow",
"insertShare": "insert share",
"insertLine": "insert line break",
"backspace": "delete selection or prior character",
"cut": "cut selection",
Expand Down
2 changes: 2 additions & 0 deletions static/locales/es-MX/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,8 @@
"insertType": "insertar símbolo de tipo",
"insertTable": "insertar símbolo de tabla",
"insertTableClose": "$?",
"insertBorrow": "$?",
"insertShare": "$?",
"insertLine": "insertar salto de línea",
"backspace": "borrar selección o carácter anterior",
"cut": "corte lo que esté seleccionado",
Expand Down
2 changes: 2 additions & 0 deletions static/locales/example/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,8 @@
"insertType": "$?",
"insertTable": "$?",
"insertTableClose": "$?",
"insertBorrow": "$?",
"insertShare": "$?",
"insertLine": "$?",
"backspace": "$?",
"cut": "$?",
Expand Down
2 changes: 2 additions & 0 deletions static/locales/zh-CN/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,8 @@
"insertType": "$?",
"insertTable": "$?",
"insertTableClose": "$?",
"insertBorrow": "$?",
"insertShare": "$?",
"insertLine": "$?",
"backspace": "$?",
"cut": "$?",
Expand Down
10 changes: 10 additions & 0 deletions static/schemas/Locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -9636,6 +9636,10 @@
"description": "Increment the literal at the cursor",
"type": "string"
},
"insertBorrow": {
"description": "Insert borrow symbol",
"type": "string"
},
"insertConvert": {
"description": "Insert → symbol",
"type": "string"
Expand Down Expand Up @@ -9684,6 +9688,10 @@
"description": "Insert ÷ symbol",
"type": "string"
},
"insertShare": {
"description": "Insert share symbol",
"type": "string"
},
"insertStream": {
"description": "Insert … symbol",
"type": "string"
Expand Down Expand Up @@ -9807,6 +9815,8 @@
"insertConvert",
"insertTable",
"insertTableClose",
"insertBorrow",
"insertShare",
"insertLine",
"backspace",
"copy",
Expand Down

0 comments on commit 456ed47

Please sign in to comment.