LibWeb: Add new whitespace-preserving editing command

Major browsers seem to preserve `white-space: pre/pre-wrap` styles in a
`<div>` when deleting the current selection through an editing command.
The idiomatic way to support this is to have a command with a "relevant
CSS property" to make sure the value is recorded and restored where
appropriate, however, no such command exists.

Create a custom command (internal to Ladybird) that implements this
behavior.
This commit is contained in:
Jelle Raaijmakers 2025-05-16 15:22:34 +02:00 committed by Andreas Kling
commit a1467c22d3
Notes: github-actions[bot] 2025-05-16 22:30:14 +00:00
6 changed files with 38 additions and 5 deletions

View file

@ -40,6 +40,7 @@ namespace Web::Editing::CommandNames {
__ENUMERATE_COMMAND_NAME(justifyRight, "justifyRight") \
__ENUMERATE_COMMAND_NAME(outdent, "outdent") \
__ENUMERATE_COMMAND_NAME(paste, "paste") \
__ENUMERATE_COMMAND_NAME(preserveWhitespace, "preserveWhitespace") \
__ENUMERATE_COMMAND_NAME(redo, "redo") \
__ENUMERATE_COMMAND_NAME(removeFormat, "removeFormat") \
__ENUMERATE_COMMAND_NAME(selectAll, "selectAll") \