script/dom/execcommand/commands/
bold.rs1use js::context::JSContext;
6
7use crate::dom::document::Document;
8use crate::dom::execcommand::basecommand::CommandName;
9use crate::dom::execcommand::execcommands::DocumentExecCommandSupport;
10use crate::dom::selection::Selection;
11
12pub(crate) fn execute_bold_command(
14 cx: &mut JSContext,
15 document: &Document,
16 selection: &Selection,
17) -> bool {
18 let value = if document.command_state_for_command(cx, "bold".into()) {
21 Some("normal".into())
22 } else {
23 Some("bold".into())
24 };
25 selection.set_the_selection_value(cx, value, CommandName::Bold, document);
26
27 true
28}