We have a few custom tools added into the editor that we've decided need to be enabled while in preview mode.
Using the steps here, we've had that working for a while now. Recently though we updated to version 2018.2.516.45, and while the buttons still enable they no longer function while in preview mode. They work fine in both other modes, and they're not disabled (at least their state is set to 0).
We're setting a timeout to make the tools available after the page finishes initializing:
function
OnClientModeChange(sender, args) {
setTimeout(
function
() { MakeToolsAvailable(sender) }, 500);
};
And in the timeout we set the state of each of the tools to 0:
function
MakeToolsAvailable(sender) {
var
editor = sender;
editor.getToolByName(
'example'
).setState(0);
// etc
}
Both of these are working fine as evidenced by the buttons looking available and the sanity check test I ran by putting console.logs in them. This last bit is the part that breaks.
Telerik.Web.UI.Editor.CommandList[
"example"
] =
function
(commandName, editor, args) {
// Everything here runs fine in design mode, but not in preview mode
};