Posted 17 April 2025, 3:00 am EST
- Updated 17 April 2025, 3:05 am EST
Hi,
Thanks for sharing the additional details. We can replicate the behavior you mentioned on our end. However, the error message displayed while performing a clear operation from the Editing menu can be customized by customizing the designer resources. Please refer to the code snippet below that illustrates the same:
let customProtectionErrorMessage = "Custom Message!!";
var resources = GC.Spread.Sheets.Designer.getResources();
resources["protectionOptionDialog"]["errorMessage"] = customProtectionErrorMessage;
GC.Spread.Sheets.Designer.setResources(resources);
Additionally, it is possible to display only the Find dialog when the sheet is protected and the Find & Replace dialog when it is in an unprotected state. Please refer to the code snippet below that illustrates the same:
const findDialogCommand = GC.Spread.Sheets.Designer.getCommand(GC.Spread.Sheets.Designer.CommandNames.FindDialogFind);
var findDialogTemplate = GC.Spread.Sheets.Designer.getTemplate(GC.Spread.Sheets.Designer.TemplateNames.FindDialogTemplate);
const onlyFindTemplate = {
...findDialogTemplate,
content: [...findDialogTemplate.content],
buttons: [...findDialogTemplate.buttons],
};
onlyFindTemplate.content[0] = {
...findDialogTemplate.content[0],
children: [...findDialogTemplate.content[0].children],
};
onlyFindTemplate.content[0].children.splice(1, 1);
onlyFindTemplate.buttons.splice(0, 2);
onlyFindTemplate.title = "Find";
function executeFindDialogCommand() {
if(spread.getActiveSheet().options.isProtected) {
GC.Spread.Sheets.Designer.registerTemplate(GC.Spread.Sheets.Designer.TemplateNames.FindDialogTemplate, onlyFindTemplate);
}
else {
GC.Spread.Sheets.Designer.registerTemplate(GC.Spread.Sheets.Designer.TemplateNames.FindDialogTemplate, findDialogTemplate);
}
findDialogCommand.execute(designer);
}
document.addEventListener("keydown", function (event) {
if (event.ctrlKey && event.key.toLowerCase() === "f") {
event.preventDefault();
executeFindDialogCommand();
}
});
You can further refer to the attached sample: https://jscodemine.mescius.io/share/QNLHU1KIpUyWc22j8jgKow/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fsrc%2Fdata.js"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}, which uses the above code snippets and achieves the required results (see below).
GIF: 
Please feel free to reach out if you require additional guidance.
Best Regards