LibWeb: Implement the "fontName" editing command

This commit is contained in:
Jelle Raaijmakers 2025-01-08 14:39:31 +01:00 committed by Andreas Kling
commit 9366a50dd3
Notes: github-actions[bot] 2025-01-10 22:37:01 +00:00
4 changed files with 39 additions and 0 deletions

View file

@ -492,6 +492,14 @@ bool command_delete_action(DOM::Document& document, String const&)
return true;
}
// https://w3c.github.io/editing/docs/execCommand/#the-fontname-command
bool command_font_name_action(DOM::Document& document, String const& value)
{
// Set the selection's value to value, then return true.
set_the_selections_value(document, CommandNames::fontName, value);
return true;
}
// https://w3c.github.io/editing/docs/execCommand/#the-forwarddelete-command
bool command_forward_delete_action(DOM::Document& document, String const&)
{
@ -1115,6 +1123,12 @@ static Array const commands {
.action = command_default_paragraph_separator_action,
.value = command_default_paragraph_separator_value,
},
// https://w3c.github.io/editing/docs/execCommand/#the-fontname-command
CommandDefinition {
.command = CommandNames::fontName,
.action = command_font_name_action,
.relevant_css_property = CSS::PropertyID::FontFamily,
},
// https://w3c.github.io/editing/docs/execCommand/#the-forwarddelete-command
CommandDefinition {
.command = CommandNames::forwardDelete,