LibWeb: Expose HTMLElement's content editable state

This commit is contained in:
Jelle Raaijmakers
2024-12-02 11:51:55 +01:00
committed by Andreas Kling
parent c9a6bac57f
commit 6a85677f70
3 changed files with 13 additions and 8 deletions

View File

@@ -819,7 +819,9 @@ bool is_editing_host(GC::Ref<DOM::Node> node)
if (!is<HTML::HTMLElement>(*node))
return false;
auto const& html_element = static_cast<HTML::HTMLElement&>(*node);
return html_element.content_editable().is_one_of("true"sv, "plaintext-only"sv) || node->document().design_mode_enabled_state();
return html_element.content_editable_state() == HTML::ContentEditableState::True
|| html_element.content_editable_state() == HTML::ContentEditableState::PlaintextOnly
|| node->document().design_mode_enabled_state();
}
// https://w3c.github.io/editing/docs/execCommand/#element-with-inline-contents