You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Also remove any formats that might not be "active" but exist in the range
45
-
// by getting all format types from the formats array in the value
46
-
if(value.formats){
47
-
constformatTypes=newSet();
48
-
for(leti=value.start;i<value.end;i++){
49
-
if(value.formats[i]){
50
-
value.formats[i].forEach((format)=>{
51
-
formatTypes.add(format.type);
52
-
});
53
-
}
54
-
}
55
-
56
-
formatTypes.forEach((formatType)=>{
57
-
newValue=removeFormat(
58
-
newValue,
59
-
formatType,
60
-
value.start,
61
-
value.end
62
-
);
63
-
});
64
-
}
65
-
66
-
onChange(newValue);
67
-
}else{
68
-
// Clear formats for the entire block by creating plain text
69
-
constplainText=value.text;
70
-
constnewValue=create({text: plainText});
71
-
onChange(newValue);
72
-
}
73
-
74
-
setIsModalOpen(false);
36
+
clearFormats();
37
+
setIsModalOpen(false);
75
38
};
76
39
77
40
// Dynamic confirmation message based on selection
78
-
constconfirmationMessage=hasSelection
79
-
? __(
80
-
'Are you sure you want to remove all formatting from the selected text? This will remove bold, italic, links, and all other formats including BlaBlaBlocks formats.',
81
-
'blablablocks-formats'
82
-
)
83
-
: __(
84
-
'Are you sure you want to remove all formatting from the entire block? This will remove bold, italic, links, and all other formats including BlaBlaBlocks formats.',
85
-
'blablablocks-formats'
86
-
);
41
+
constselectionType=hasSelection
42
+
? __('text','blablablocks-formats')
43
+
: __('block','blablablocks-formats');
44
+
45
+
constconfirmationMessage=sprintf(
46
+
/* translators: %s: selection type (text/block) */
47
+
__(
48
+
'Are you sure you want to remove all formatting (bold, italic, links, etc.) from the selected %s?',
49
+
'blablablocks-formats'
50
+
),
51
+
selectionType
52
+
);
87
53
88
54
return(
89
55
<>
90
56
<RichTextToolbarButton
91
-
icon={cancelCircleFilled}
92
-
title={__('Clear All Formats','blablablocks-formats')}
0 commit comments