Version 1 (modified by gogo, 2 years ago) (diff)


Core Configuration Options

The following options can be specified to control the core features of Xinha.

See the NewbieGuide for how to set configuration values in general.

Set the width of the editor, allowed values 'auto', 'toolbar' or a CSS length specification (123px).
Set the height of the editor, allowed values 'auto' or a CSS length specification (123px).
Boolean. Allow the user to drag-resize the editor. This only works reliably in Chrome, other browsers have various issues.
Boolean. include the toolbars in the size specified. Default true.
Boolean. Include the panels in the size specified. Default true.
Object. Specify the panel dimensions for left/right/top/bottom, pixel widths only.
  xinha_config.panel_dimensions =
    left:   '200px', // Width
    right:  '200px',
    top:    '100px', // Height
    bottom: '100px'
Integer. If you want the iframe to be narrower than toolbar, set this to a number of pixels. Eg if you are editing a very narrow column of text and want to maintain that narrowness in the editor.
Boolean. Enable the status bar at the bottom of the editor. Default true.
Boolean. Intercept CTRL-V and do paste through Xinha's processes. This probably doesn't work at least in Gecko. Default false.
String 'built-in' or 'best'. For browsers that use Xinha's Gecko engine (primarily, Firefox and IE11), determine how the return key is handled. Default 'best'.
String 'DOMwalk' or 'TransformInnerHTML'. Determines the algorithm for generating the HTML from the WYWISYG view. 'DOMwalk' may be more reliable, 'TransformInnerHTML' may be faster (but in modern times this is not so certain I suspect). Default 'DOMwalk'.
Integer. Number of undos available. Default 20.
Integer milliseconds. Interval that undo snapshots are saved. Default 500.
Boolean. When changing to right-to-left, select right justification. Default false.
Boolean. If true then Xinha will retrieve the full HTML, starting with the <HTML> tag. Not well tested, see also FullPage? plugin.
String. CSS definitions to apply to the edited document. See also pageStyleSheets below, and Stylist? plugin.
 xinha_config.pageStyle = '  p { color:red;  }  \n' 
                        + ' li { color:blue; }';
Array of string. An array of external stylesheets to apply to the edited document.
 xinha_config.pageStyleSheets = [ "/css/myPagesStyleSheet.css","/css/anotherOne.css" ];
String. Base href to apply to relative links. This is probably buggy. You shouldn't need to use it.
Boolean. Relative URLs will be made absolute. This is usually a good thing due to browser behaviours with regard editing images etc. Default true.
Boolean. Remove the baseHref (above if set) from urls in the edited content. Default true (if baseHref is set).
Boolean. Remove the url part from any anchors which have ourself as an anchor. Typically a good thing (editing index.html, index.html#top becomes #top). Default true.
Boolean. In URLs all characters above ASCII value 127 have to be encoded using % codes. Default true.
Boolean. If you are putting the HTML written in Xinha into an email you might want it to be 7-bit characters only. This config option will convert all characters consuming more than 7bits into UNICODE decimal entity references (actually it will convert anything below <space> (chr 20) except cr, lf and tab and above <tilde> (~, chr 7E)). Default: false.

Object. Display one thing in the WYSIWYG view and translate it to a different thing in the HTML view. Potential use as showing some example text in the WYSIWYG view but using a "replacement code" in the HTML generated. Default empty.

 xinha_config.specialReplacements = 
   'in_html' : 'in_wysiwyg',
   '{$Name}' : 'John Smith',
String. When the user presses the tab key in the editor, Xinha will insert a span with this class and the below contents. Default 'xinha-tab'
String. When the user presses the tab key, Xinha will insert a span with the above class and this contents. Default '&nbsp;&nbsp;&nbsp;&nbsp;'.
Function accepting parameter html and returning html to use in the editor. This is called with the contents of the textarea and the result is what is inserted into the Xinha editor for editing. Default, null function.
  xinha_config.inwardHtml = function(html) { return html.replace(/how now brown cow/, 'how now yellow camel'); }

Makes <textarea>how now brown cow</textarea> edit a Xinha document with the text "how now yellow camel" instead.

Function accepting parameter html and returning html to return to the textarea. This is called before putting the edited html back into the textarea.
  xinha_config.inwardHtml = function(html) { return html.replace(/how now yellow camel/, 'how now brown cow'); }

Makes the Xinha edited content "how now yellow camel" be written into the textarea as "how now brown cow".