Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright MacEditingCommands

From Leeroopedia
Revision as of 11:37, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_Playwright_MacEditingCommands.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Implementation Page

Overview

MacEditingCommands defines a mapping from keyboard shortcuts to macOS editing commands, used by the WebKit input implementation to translate key combinations into native editing actions.

Description

This module exports a single constant object macEditingCommands that maps keyboard shortcut strings (e.g., 'Control+KeyA') to macOS NSResponder editing command selectors (e.g., 'moveToBeginningOfParagraph:'). The mapping covers standard editing commands including cursor movement, text selection, deletion, clipboard operations, and text formatting.

Key categories include:

  • Basic navigation: arrow keys, home/end, page up/down
  • Shift+key combinations for selection modification
  • Control+key combinations for paragraph-level editing
  • Meta (Command) key combinations for document-level operations and clipboard
  • Combined modifier shortcuts

Usage

Referenced by the WebKit keyboard input implementation to determine which editing commands to send along with key events on macOS.

Code Reference

Source Location

packages/playwright-core/src/server/macEditingCommands.ts (134 lines)

Export Signature

export const macEditingCommands: { [key: string]: string | string[] };

Import

import { macEditingCommands } from './server/macEditingCommands';

I/O Contract

Inputs

  • Key combination strings in format 'Modifier+KeyCode' (e.g., 'Meta+KeyC')

Outputs

  • macOS editing command strings (e.g., 'copy:', 'moveToBeginningOfDocument:')
  • Some entries return arrays for multiple commands

Usage Examples

Looking Up a Command

const command = macEditingCommands['Meta+KeyC']; // 'copy:'
const commands = macEditingCommands['Meta+Shift+ArrowUp']; // selection command

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment