Created
April 8, 2019 11:37
-
-
Save MartinMiles/9f162db4aa03677c30e292a24c55f78e to your computer and use it in GitHub Desktop.
Adding Expand / Collapse buttons to Experience Editor (Sitecore 9)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Adds Expand all and Collapse all buttons to Content Editor */ | |
scContentEditor.prototype.onDomReady = function (evt) { | |
this.addCollapser(window.jQuery || window.$sc); | |
}; | |
scContentEditor.prototype.addCollapser = function ($) { | |
$ = $ || window.jQuery || window.$sc; | |
if (!$) { return; } | |
$('#EditorTabs').append("<style>.toggler { border: 1px solid #bdbdbd; box-shadow: 0 1px #ffffff inset; cursor: pointer; height: 35px; margin: 16px 1px 0; }</style>"); | |
$('#EditorTabs').append("<button id='expander' class='toggler'>Expand all</button><button id='collapser' class='toggler'>Collapse all</button>"); | |
$('#EditorTabs').on("click", "#collapser", function () { | |
$('.scEditorSectionCaptionExpanded').each(function () { | |
var script = $(this).attr("onclick"); | |
eval(script); | |
}); | |
return false; | |
}); | |
$('#EditorTabs').on("click", "#expander", function () { | |
$('.scEditorSectionCaptionCollapsed').each(function () { | |
var script = $(this).attr("onclick"); | |
eval(script); | |
}); | |
return false; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file2 = Get-Content "ExpanderCollapser.js" | |
Add-Content "C:\inetpub\wwwroot\Platform.dev.local\sitecore\shell\Applications\Content Manager\Content Editor.js" $file2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment