Page MenuHomeIn-Portal Phabricator

fckplugin.js
No OneTemporary

File Metadata

Created
Sun, Mar 9, 9:52 PM

fckplugin.js

var MySourceCommand = function()
{
this.Name = 'MySource' ;
}
MySourceCommand.prototype.Execute = function()
{
MySwitchEditMode() ;
// Check if the actual mode is WYSIWYG.
}
function MySwitchEditMode(A)
{
var B=(FCK.EditMode==0);
var C=FCK.IsDirty();
var D;
if (B){
FCKCommands.GetCommand('ShowBlocks').SaveState();
if (!A&&FCKBrowserInfo.IsIE) FCKUndo.SaveUndoStep();
D= FCK.GetXHTML(FCKConfig.FormatSource);
if (D==null) return false;
} else D=FCK.EditingArea.Textarea.value;
FCK.EditMode=B?1:0;
FCK.SetData(D,!C);
if (B) {
var warningElement = document.createElement('span');
warningElement.innerHTML = '<span style="font-size: 8pt; font-family: arial,verdana,sans-serif; color: #AA0000;"><span style="color: #FF0000;">You are in HTML mode. Use the [Source] button to switch back to WYSIWYG mode.</span><br>Please note that incorrect or invalid HTML may break the web site\'s layout or produce undesirable results. This mode should be utilized only by expert users. Intechnic Corporation assumes no responsibility for problems caused by incorrect modifications of the HTML code.</span><hr/>';
FCK.EditingArea.TargetElement.insertBefore(warningElement, FCK.EditingArea.Textarea);
}
FCK.Focus();
FCKTools.RunFunction(FCK.ToolbarSet.RefreshModeState,FCK.ToolbarSet);
return true;
}
MySourceCommand.prototype.GetState = function()
{
return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_ON ) ;
}
FCKCommands.RegisterCommand( 'MySource', new MySourceCommand());
FCKToolbarItems.RegisterItem( 'MySource', new FCKToolbarButton( 'MySource', FCKLang.Source, null, 2, true, true, 1) ) ;

Event Timeline