2024-11-27 11:57:12 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::Editing {
|
|
|
|
|
2024-12-18 12:45:02 +01:00
|
|
|
// https://w3c.github.io/editing/docs/execCommand/#properties-of-commands
|
2024-11-27 11:57:12 +01:00
|
|
|
struct CommandDefinition {
|
|
|
|
FlyString const& command;
|
2024-12-16 15:48:24 +01:00
|
|
|
Function<bool(DOM::Document&, String const&)> action {};
|
|
|
|
Function<bool(DOM::Document const&)> indeterminate {};
|
|
|
|
Function<bool(DOM::Document const&)> state {};
|
|
|
|
Function<String(DOM::Document const&)> value {};
|
2024-12-18 12:45:02 +01:00
|
|
|
Optional<CSS::PropertyID> relevant_css_property {};
|
|
|
|
|
|
|
|
// https://w3c.github.io/editing/docs/execCommand/#inline-command-activated-values
|
|
|
|
Vector<String> inline_activated_values {};
|
2024-11-27 11:57:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Optional<CommandDefinition const&> find_command_definition(FlyString const&);
|
|
|
|
|
|
|
|
// Command implementations
|
2024-11-29 11:56:28 +01:00
|
|
|
bool command_default_paragraph_separator_action(DOM::Document&, String const&);
|
|
|
|
String command_default_paragraph_separator_value(DOM::Document const&);
|
2024-11-27 11:57:12 +01:00
|
|
|
bool command_delete_action(DOM::Document&, String const&);
|
2024-12-10 16:16:56 +01:00
|
|
|
bool command_insert_linebreak_action(DOM::Document&, String const&);
|
2024-12-03 16:29:21 +01:00
|
|
|
bool command_insert_paragraph_action(DOM::Document&, String const&);
|
2024-12-03 16:28:49 +01:00
|
|
|
bool command_style_with_css_action(DOM::Document&, String const&);
|
|
|
|
bool command_style_with_css_state(DOM::Document const&);
|
2024-11-27 11:57:12 +01:00
|
|
|
|
|
|
|
}
|