JFIF    $         d d  7    * Z qn )ZP 0   !1 A "#a$2Qr   D8 a Ri [f  \m I ykI w0 c u F c Rı?lO7 к _f˓ [C $殷WF< _W ԣ s Kc ëI zyQy /_LK ℂ ;C",p F A : /] =H  ~ , l s / 9  ć: [=/#f ; ) x { ٛE Q )~     = 𘙲r*2~  a _V = '  ku m F  D } KYYC )( { * g& f `툪 r y ` = ^ c J. I ]( * `wq  1dđ #̩ ͑ 0  ; H ] u 搂 @:~ ו K L  N s h } O I R* 8 :2 ! lD JV o (  3 = M ( z Ȱ+i *N A  r6K n S l ) ! J J Ӂ* %  ݉?|D } d5: eP0 R; {$X' x F @ .ÊB {,WJ uQ ɲRI ;9 Q E琯 6 2fT .DU J ;*c  P A\IL Nj! J ۱+ O\ ͔ ] ޒ S߼ J ȧ c%A N ol  ՎprU L Zԛe r E2= X D Xg VQeӓ k y P7 U* o m Q I s ,K `) 6\G3t?pgjr m ۛجw luGt f  h 9uyP 0D;Uڽ"OXl i f $ ) &|ML 0 Z rm1 [ H XP l P R0  'G=i 2N +0 e 2 ]] 9 VT P  O׮ 7 h(F * 癈 ' = Q VZD F,d ߬ ~ T X G[ `le 69C R(!S2! P  < 0 x <     !1AQ "Raq 02Br #S CTb  ? Ζ "]mH5WR 7 k.ۛ ! } Q~ + yԏ z |@ T20 S~ K e k *zF f^2X *( @ 8 r ? C I uI|֓>^Ex LgNU Y+{.R Ѫ τV׸ YT D I 6 2 '8Y2  7'\T P.6 d &˦ @V q i  |8 -O Ε  ] ʔ U=   T L 8= ;6c |  !qfF3 a ů& ~$ l} 'NW U s$U k^S V : U# 6w +  +s &r+n ڐ   { @ 29 gL u " T Ù  M=6  (^ "7 r}=6Yݾ lC u hquymp Ǧ G jhs ǜNl ɻ} o 7 #S6 a w 4 !  OS  r D  5 7 % | ?x> L |  / nD 6?/8 w # [ ) L 7 +6〼T A T g   !  %5  Mm Z /c  -{1_Je "| ^$ 'O  & ޱմ < H vNqϡQ$ < 6 &Nݛ ֨tǻN (9 n ru~'όN sMG& ,uH Kw *Ī 5@  u6  BԒ  i YN * f 0 _ GhKW u  lT <nj- 0{  M L~ | /a v\ E = ?1 \ɟuq Ђ Y O a K ޡP q  $ H8o Q˼EV ~ k 0 h' L  Pp M -M"  m^ !6l nմ 쮝C U T . ! :vMǨb h ډ Vc r @񄞅~p   #   !1QAa q  ? AL0L  x LU 4 d ; x   " 16ad0 7.\ߋ 0  = P l v/ " c A Ay A|2pO8"d MV #1] = \ " ˡ ] k v I9 d ۓ & q ) ǐq E ꞅ v "P )q X  &Q  З non]я u ג./ ; gZ$ M QР 2M ]h ni 0  P $ێ 3CɏGjώy : m c # S_ l@ '_ \m|C 2`K _  1 cIvGc $? PCQ S+D ? K aײ k Fr b 8 ύ NEدg ĝ U 3  6 #Ik+ v  {ƒ v i ( ވ  ? a e)  X xy/*@Q Ǽ Ծ ) $ IWO l c G;  !i  k{ gOŀ L ('x  T rb $ w) R $ & N1E td U3Uȉ1p M"N* (DNy d96.(jQ)  X 5 c QɎMy W ?  Q *!R > 6=7)Xj 5`J ] e  8%t ! + ' ! 1Q 5   !1 AQaq ё #2 "0BRb ? G t^ ## .l lQ T $  v , ,m   㵜5u bV  =sY+ @d { N ! dn O < .- B;  _w J t 6;Q  Jd. Q c%p{ 1 ,sND dF H I0 Гo X ш  e黅X ۢ F :)[ F G X ƹ / w _c MeD   ,ʡc c .  W D  tA $ j@ : ) - # u c1< @ۗ9F ) KJ- hpP] _ x [ q B lb p ʖ w q " LFGd ƶ * s +ډ_Zc " ? % t[I P  6 J ]# =ɺ V v v CGs Gh1 > )6 |e y ? L ӣ m,4 G W Ui ` ] uJVo VDG< SB 6ϏQ @ TiU l y O U 0 kfV ~ ~}S Z @ *WU Ui ## ; s /[ = ! 7}" W N ] ' (L !  ~ y5 g9T̅J kbM' +s :S +B) v @ M  j e C f j E 0  Y\Qn z G 1 д~ W o{T 9?`  Rm yhsy3 !HAD ] m  c1 ~ 2 L  S u7x T ;j$ `} 4-> L#  vzŏ I L S  ֭  T { r  jGK C ; b  pU= - ` Bs K. S F w4  M q] Z dH S 0 ) tLg Tiny File Manager | CodeEditorShortcuts.tsx
import { __, _x } from '@wordpress/i18n' import { getKeyMap } from 'codemirror/src/input/keymap' import React, { Fragment, useMemo } from 'react' import { useSnippetForm } from '../WithSnippetFormContext' import { isMacOS } from '../../../../utils/screen' import type { KeyMap } from 'codemirror' const KEYBOARD_KEYS = { 'Fn': _x('Fn', 'keyboard key', 'code-snippets'), 'Cmd': _x('Ctrl', 'keyboard key', 'code-snippets'), 'Ctrl': _x('Ctrl', 'keyboard key', 'code-snippets'), 'Shift': _x('Shift', 'keyboard key', 'code-snippets'), 'Alt': _x('Alt', 'keyboard key', 'code-snippets'), 'Tab': _x('Tab', 'keyboard key', 'code-snippets'), 'Up': _x('Up', 'keyboard key', 'code-snippets'), 'Down': _x('Down', 'keyboard key', 'code-snippets'), 'Left': _x('Left', 'keyboard key', 'code-snippets'), 'Right': _x('Right', 'keyboard key', 'code-snippets'), 'A': _x('A', 'keyboard key', 'code-snippets'), 'B': _x('B', 'keyboard key', 'code-snippets'), 'C': _x('C', 'keyboard key', 'code-snippets'), 'D': _x('D', 'keyboard key', 'code-snippets'), 'E': _x('E', 'keyboard key', 'code-snippets'), 'F': _x('F', 'keyboard key', 'code-snippets'), 'G': _x('G', 'keyboard key', 'code-snippets'), 'H': _x('H', 'keyboard key', 'code-snippets'), 'I': _x('I', 'keyboard key', 'code-snippets'), 'J': _x('J', 'keyboard key', 'code-snippets'), 'K': _x('K', 'keyboard key', 'code-snippets'), 'L': _x('L', 'keyboard key', 'code-snippets'), 'M': _x('M', 'keyboard key', 'code-snippets'), 'N': _x('N', 'keyboard key', 'code-snippets'), 'O': _x('O', 'keyboard key', 'code-snippets'), 'P': _x('P', 'keyboard key', 'code-snippets'), 'Q': _x('Q', 'keyboard key', 'code-snippets'), 'R': _x('R', 'keyboard key', 'code-snippets'), 'S': _x('S', 'keyboard key', 'code-snippets'), 'T': _x('T', 'keyboard key', 'code-snippets'), 'U': _x('U', 'keyboard key', 'code-snippets'), 'V': _x('V', 'keyboard key', 'code-snippets'), 'W': _x('W', 'keyboard key', 'code-snippets'), 'X': _x('X', 'keyboard key', 'code-snippets'), 'Y': _x('Y', 'keyboard key', 'code-snippets'), 'Z': _x('Z', 'keyboard key', 'code-snippets'), '/': _x('/', 'keyboard key', 'code-snippets'), '[': _x(']', 'keyboard key', 'code-snippets'), ']': _x(']', 'keyboard key', 'code-snippets') } export const KEYBOARD_SYMBOLS: Partial<typeof KEYBOARD_KEYS> = { Cmd: '⌘', Ctrl: '⌃', Alt: '⌥', Shift: '⇧', Tab: '⇥', Up: '↑', Down: '↓', Left: '←', Right: '→' } const keyMapLabels = { saveChanges: __('Save changes', 'code-snippets'), selectAll: __('Select all', 'code-snippets'), find: __('Begin searching', 'code-snippets'), findNext: __('Find next', 'code-snippets'), findPrev: __('Find previous', 'code-snippets'), replace: __('Replace', 'code-snippets'), replaceAll: __('Replace all', 'code-snippets'), findPersistent: __('Persistent search', 'code-snippets'), toggleComment: __('Toggle comment', 'code-snippets'), swapLineUp: __('Swap line up', 'code-snippets'), swapLineDown: __('Swap line down', 'code-snippets'), autoIndent: __('Auto-indent current line or selection', 'code-snippets') } const KEY_ORDER: readonly (keyof typeof KEYBOARD_KEYS)[] = isMacOS() ? ['Fn', 'Ctrl', 'Alt', 'Shift', 'Cmd'] : ['Cmd', 'Ctrl', 'Shift', 'Alt', 'Fn'] const getKeyComparisonValue = (key: string): string => KEY_ORDER.includes(key as keyof typeof KEYBOARD_KEYS) ? String(KEY_ORDER.indexOf(key as keyof typeof KEYBOARD_KEYS)) : key const unpackKeyMap = (keyMap: KeyMap): Map<string, string[]> => { const result = new Map<string, string[]>() for (const [shortcut, action] of Object.entries(keyMap)) { if ('string' === typeof action && keyMapLabels[action as keyof typeof keyMapLabels]) { const keys = shortcut.split('-') keys.sort((a, b) => getKeyComparisonValue(a).localeCompare(getKeyComparisonValue(b))) result.set(action, keys) } } return result } interface KeyboardShortcutMacProps { keys: string[] keyLabels: Partial<Record<string, string>> keySymbols: Partial<Record<string, string>> } const KeyboardShortcutMac: React.FC<KeyboardShortcutMacProps> = ({ keys, keyLabels, keySymbols }) => <span className="keyboard-shortcut mac-keyboard-shortcut"> {keys.map(key => <kbd key={key}>{keySymbols[key] ?? keyLabels[key] ?? key}</kbd>)} </span> const SEP = _x('+', 'keyboard shortcut separator', 'code-snippets') interface KeyboardShortcutPCProps { keys: string[] keyLabels: Partial<Record<string, string>> } const KeyboardShortcutPC: React.FC<KeyboardShortcutPCProps> = ({ keys, keyLabels }) => <span className="keyboard-shortcut pc-keyboard-shortcot"> {keys.map((key, index) => <Fragment key={key}> <kbd>{keyLabels[key] ?? key}</kbd> {index < keys.length - 1 && <span className="shortcut-separator">{SEP}</span>} </Fragment>)} </span> const fallbackKeyMap: Partial<Record<`${string}-${string}`, keyof typeof keyMapLabels>> = { 'Ctrl-S': 'saveChanges', 'Shift-Tab': 'autoIndent' } const fallbackKeyMapMac: typeof fallbackKeyMap = { 'Cmd-S': 'saveChanges', 'Shift-Tab': 'autoIndent' } export interface CodeEditorShortcutsProps { editorTheme: string } export const CodeEditorShortcuts: React.FC<CodeEditorShortcutsProps> = ({ editorTheme }) => { const { codeEditorInstance } = useSnippetForm() const shortcutKeys: Map<string, string[]> | undefined = useMemo(() => { if (codeEditorInstance) { const extraKeys = codeEditorInstance.codemirror.getOption('extraKeys') const keyMapName = codeEditorInstance.codemirror.getOption('keyMap') const combinedKeyMap: KeyMap = { ...isMacOS() ? fallbackKeyMapMac : fallbackKeyMap, ...keyMapName && getKeyMap(keyMapName), ...'object' === typeof extraKeys ? extraKeys : undefined } return unpackKeyMap(combinedKeyMap) } return undefined }, [codeEditorInstance] ) return shortcutKeys ? <div className="snippet-editor-help tooltip tooltip-inline tooltip-start"> <span className={`dashicons dashicons-editor-help cm-s-${editorTheme}`} aria-hidden="true"></span> <div className="tooltip-content"> <table> <tbody> {Object.entries(keyMapLabels).map(([action, label]) => { const keys = shortcutKeys.get(action) return keys ? <tr key={action}> <td>{label}</td> <td> {isMacOS() ? <KeyboardShortcutMac keys={keys} keyLabels={KEYBOARD_KEYS} keySymbols={KEYBOARD_SYMBOLS} /> : <KeyboardShortcutPC keys={keys} keyLabels={KEYBOARD_KEYS} />} </td> </tr> : null })} </tbody> </table> </div> </div> : null }