mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-05 16:41:52 +00:00
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:
parent
1c77b42a44
commit
a1467c22d3
Notes:
github-actions[bot]
2025-05-16 22:30:14 +00:00
Author: https://github.com/gmta
Commit: a1467c22d3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4779
6 changed files with 38 additions and 5 deletions
|
@ -3333,9 +3333,10 @@ Vector<RecordedNodeValue> record_the_values_of_nodes(Vector<GC::Ref<DOM::Node>>
|
|||
// 2. For each node in node list, for each command in the list "subscript", "bold", "fontName",
|
||||
// "fontSize", "foreColor", "hiliteColor", "italic", "strikethrough", and "underline" in that
|
||||
// order:
|
||||
// AD-HOC: We include "preserveWhitespace" as well.
|
||||
Array const commands = { CommandNames::subscript, CommandNames::bold, CommandNames::fontName,
|
||||
CommandNames::fontSize, CommandNames::foreColor, CommandNames::hiliteColor, CommandNames::italic,
|
||||
CommandNames::strikethrough, CommandNames::underline };
|
||||
CommandNames::strikethrough, CommandNames::underline, CommandNames::preserveWhitespace };
|
||||
for (auto node : node_list) {
|
||||
for (auto command : commands) {
|
||||
// 1. Let ancestor equal node.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue