Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Last active September 17, 2025 14:45
Show Gist options
  • Select an option

  • Save hishaamn/c67ebc4f3281aab990818501e2bebc47 to your computer and use it in GitHub Desktop.

Select an option

Save hishaamn/c67ebc4f3281aab990818501e2bebc47 to your computer and use it in GitHub Desktop.
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Applications.ContentEditor.Pipelines.RenderContentEditor;
namespace SCXM.Panels.Pipelines.RenderContentEditor
{
public class SlidePanelInjector
{
public void Process(RenderContentEditorArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
var style = @"
<style>
#scxmPanel {
position: fixed;
top: 60px;
right: -300px;
width: 300px;
height: calc(100% - 60px);
background: #fff;
box-shadow: -2px 0 5px rgba(0,0,0,0.2);
transition: right 0.3s ease;
z-index: 9998;
}
#scxmPanel.open {
right: 0;
}
#openPanel {
position: fixed;
bottom: 4px;
right: 12px;
z-index: 9999;
background: #fff;
border-radius: 4px;
border: 1px solid #ccc;
padding: 3px 6px;
cursor: pointer;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
font-size: 10px;
}
</style>
";
var script = @"
<script>
(function(){
var btn = document.getElementById('openPanel');
var panel = document.getElementById('scxmPanel');
btn.addEventListener('click', function(){
panel.classList.toggle('open');
});
})();
</script>
";
var injectDoc = $@"
{style}
<div id='scxmPanel'>
<h3 style='margin:10px;'>Persistent Panel</h3>
<p> Your info goes here </p>
</div>
<div id='openPanel'>☰</div>
{script}
";
args.EditorFormatter.AddLiteralControl(args.Parent, injectDoc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment