LibWeb: Implement "plaintext-only" state for contenteditable

This commit is contained in:
Jelle Raaijmakers 2024-12-01 23:40:08 +01:00 committed by Andreas Kling
parent 7e406ac668
commit 217567981a
Notes: github-actions[bot] 2024-12-02 23:21:14 +00:00
5 changed files with 104 additions and 14 deletions

View file

@ -816,11 +816,10 @@ bool is_editing_host(GC::Ref<DOM::Node> node)
// An editing host is either an HTML element with its contenteditable attribute in the true
// state or plaintext-only state, or a child HTML element of a Document whose design mode
// enabled is true.
// FIXME: check contenteditable "plaintext-only"
if (!is<HTML::HTMLElement>(*node))
return false;
auto const& html_element = static_cast<HTML::HTMLElement&>(*node);
return html_element.content_editable() == "true"sv || node->document().design_mode_enabled_state();
return html_element.content_editable().is_one_of("true"sv, "plaintext-only"sv) || node->document().design_mode_enabled_state();
}
// https://w3c.github.io/editing/docs/execCommand/#element-with-inline-contents