| 
									
										
										
										
											2024-11-27 11:57:12 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-12-22 21:34:50 +01:00
										 |  |  |  * Copyright (c) 2024-2025, Jelle Raaijmakers <jelle@ladybird.org> | 
					
						
							| 
									
										
										
										
											2024-11-27 11:57:12 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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 {}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-22 21:34:50 +01:00
										 |  |  |     // https://w3c.github.io/editing/docs/execCommand/#preserves-overrides
 | 
					
						
							|  |  |  |     bool preserves_overrides { false }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-18 12:45:02 +01:00
										 |  |  |     // https://w3c.github.io/editing/docs/execCommand/#inline-command-activated-values
 | 
					
						
							| 
									
										
										
										
											2025-01-07 14:15:09 +01:00
										 |  |  |     Vector<StringView> inline_activated_values {}; | 
					
						
							| 
									
										
										
										
											2024-11-27 11:57:12 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Optional<CommandDefinition const&> find_command_definition(FlyString const&); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Command implementations
 | 
					
						
							| 
									
										
										
										
											2025-01-07 14:15:09 +01:00
										 |  |  | bool command_bold_action(DOM::Document&, String const&); | 
					
						
							| 
									
										
										
										
											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&); | 
					
						
							| 
									
										
										
										
											2025-01-07 16:51:16 +01:00
										 |  |  | bool command_forward_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
										 |  |  | 
 | 
					
						
							|  |  |  | } |