15.08.2013 Views

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

Ektron® eWebEditPro Developer's Reference Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Viewing and Editing HTML Content<br />

The ViewAs Feature<br />

This section describes elements that let users view and edit the HTML<br />

content of their Web page.<br />

The ViewAs feature determines whether or not users can view the HTML<br />

source code. If you allow users to view source code, they do so by rightclicking<br />

the mouse while the cursor is in the editor. When they do, two menu<br />

options appear.<br />

• View HTML - lets the user view the source code<br />

• View WYSIWYG - returns the user to edit mode<br />

If you allow users to view source code, you can further specify if they can<br />

view only the body of the page or the entire page including the header.<br />

Disabling Custom Toolbar Buttons View as HTML Mode<br />

The following JavaScript is an example of how to disable (or gray-out) custom<br />

toolbar buttons when the user selects "View As HTML". And, how to reenable<br />

buttons when the user switches back to “View WYSIWYG".<br />

1. Add the following to customevents.js or the page with the editor.<br />

2. Specify the names of the commands in the myCustomCommands array.<br />

var myCustomCommands = ["jsmycommand1", "jsmycommand2",<br />

"jsmycommand3"];<br />

function myUpdateButtonStatus(sEditorName, strCmdName, strTextData,<br />

lData)<br />

{<br />

var bDisable = ("cmdviewashtml" == strCmdName);<br />

var objInstance = <strong>eWebEditPro</strong>.instances[sEditorName];<br />

var objMenu = objInstance.editor.Toolbars();<br />

var objCommand = null;<br />

for (var i = 0; i < myCustomCommands.length; i++)<br />

{<br />

objCommand = objMenu.CommandItem(myCustomCommands[i])<br />

if (objCommand)<br />

{<br />

objCommand.setProperty("CmdGray", bDisable);<br />

}<br />

}<br />

}<br />

<strong>eWebEditPro</strong>ExecCommandHandlers["cmdviewashtml"] =<br />

myUpdateButtonStatus;<br />

<strong>eWebEditPro</strong>ExecCommandHandlers["cmdviewaswysiwyg"] =<br />

myUpdateButtonStatus;<br />

<strong>Ektron®</strong> <strong>eWebEditPro</strong> Developer’s <strong>Reference</strong> <strong>Guide</strong>, Release 5.1, Revision 1 327

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!