I'm creating some custom ribbon buttons for the experience editor in version 10.1. I have set them up using a combination of the below guides...
https://sitecorebaek.wordpress.com/tag/speak/
https://sbhatiablogs.wordpress.com/2019/09/02/add-a-custom-button-on-experience-editor-ribbon/
https://alan-null.github.io/2016/09/hide-experience-editor-tab
So far so good, the buttons are visible and the click event is triggered in the below using the below code:
define(["sitecore", "/-/speak/v1/ExperienceEditor/ExperienceEditor.js",
"/-/speak/v1/ExperienceEditor/ExperienceEditor.Context.js"
, "/-/speak/v1/ExperienceEditor/ExperienceEditorProxy.js"],
function (Sitecore, ExperienceEditor, ExperienceEditorContext, ExperienceEditorProxy) {
console.log("FieldEditorCommand.js loaded...");
Sitecore.Commands.LaunchFieldEditor =
{
canExecute: function (context) {
return true;
},
execute: function (context) {
try {
console.dir(context.button);
const rawString = context.button.attributes.name;
if (rawString.length) {
const fieldsString = rawString.replace("-", "|");
const itemId = context.currentContext.itemId.replace("%7b", "{").replace("%7d", "}")
ExperienceEditorProxy._pe().postRequest('webedit:fieldeditor(command = ' + itemId + ', fields = ' + fieldsString + ', id = ' + itemId + ')', null, false)
}
}
catch (err) {
console.log("FieldEditorCommandError", err);
}
}
};
});
My issue is when executing the post back to Sitecore using ExperienceEditorProxy._pe().postRequest();
, I get the following error:
Failed to call scGetFrameValue in IFrame tag. This typically happens due to a Permission Denied exception in IE9 caused by an intricate issue with Popup and ShowModalDialog calls. Blocked a frame with origin "https://cm.ljmu.localhost" from accessing a cross-origin frame.
The origin is always cm.ljmu.localhost
so that's not the problem. I also read that it could be a conflict with Jquery however removing jquery from experience editor pages does not resolve the issue.