So it appears that the root of the issue is that Edit Frame uses a different Chrome Type than a rendering and the Edit Frame Chrome Type does not implement chrome:rendering:properties
or any other relevant command.
Rendering Chrome Type: shell\Applications\Page Modes\ChromeTypes\RenderingChromeType.js
Edit Frame Chrome Type: shell\Applications\Page Modes\ChromeTypes\EditFrameChromeType.js
EditFrameChromeType only handles 2 messages for edit frame. I was able to adjust the handlers from RenderingChromeType to work on the EditFrameChromeType. Here's the updated EditFrameChromeType.js I used that allows me to use the default button for Edit Component Properties on an edit frame.
Sitecore.PageModes.ChromeTypes.EditFrame = Sitecore.PageModes.ChromeTypes.ChromeType.extend({
constructor: function() {
this.base();
this._editFrameUpdating = false;
this.fieldsChangedDuringFrameUpdate = false;
},
handleMessage: function(message, params) {
switch (message) {
case "chrome:editframe:updatestart":
this.updateStart();
break;
case "chrome:editframe:updateend":
this.updateEnd();
if (Sitecore.WebEditSettings.autoSaveOnEditFrame) {
ExperienceEditor.ribbonDocument().querySelector('[data-sc-id="QuickSave"]').click();
}
break;
case "chrome:rendering:properties":
this.editProperties();
break;
case "chrome:rendering:propertiescompleted":
this.editPropertiesCompleted();
break;
}
},
isEnabled: function() {
return $sc.inArray(Sitecore.PageModes.Capabilities.edit, Sitecore.PageModes.PageEditor.getCapabilities()) > -1 && this.base();
},
key: function() {
return "editframe";
},
load: function() {
},
updateStart: function() {
this._editFrameUpdating = true;
this.fieldsChangedDuringFrameUpdate = false;
},
updateEnd: function() {
if (this.fieldsChangedDuringFrameUpdate) {
this.chrome.element.addClass("scWebEditFrameModified");
}
this._editFrameUpdating = false;
this.fieldsChangedDuringFrameUpdate = false;
},
editProperties: function() {
var placeholder = this.getPlaceholder();
var rendering = this.getRendering();
if (placeholder && rendering) {
placeholder.type.editProperties(rendering);
}
},
editPropertiesCompleted: function() {
var placeholder = this.getPlaceholder();
var rendering = this.getRendering();
if (placeholder && rendering) {
placeholder.type.editPropertiesResponse(rendering);
}
},
uniqueId: function() {
var rendering = this.getRendering();
if(!rendering){
throw "Unable to find rendering for edit frame!";
}
return rendering.openingMarker().attr("id").substring(2);
},
getPlaceholder: function() {
var placeholder = this.getContainerByType('placeholder', null, 1, 4);
return placeholder;
},
getRendering: function() {
var rendering = this.getContainerByType('rendering', null, 1, 4);
return rendering;
},
getContainerByType: function (typeKey, itm, iteration, maxIterations) {
itm = itm || this.chrome.parent(false, false);
if (!itm) {
return null;
}
if(itm.type.key() == typeKey){
return itm;
}
var parentElement = itm.parent();
if (!parentElement || parentElement.type.key() != typeKey) {
if(iteration > maxIterations) {
console.warn(itm.element);
throw "EditFrame must have " + typeKey + " chrome as its parent. Got '" + itm.type.key() + "' instead";
}
return this.getContainerByType(typeKey, parentElement, iteration + 1, maxIterations);
}
return parentElement;
}
});
I basically just extended the getPlaceholder logic that checks the parent to crawl recursively and get renderings and placeholders. That let me access the methods I needed and emulate the context of the rendering.
Fields
where we need to add the Template Field ID.