source: trunk/examples/XinhaConfig.js @ 962

Last change on this file since 962 was 962, checked in by ray, 11 years ago
  • #1149 [Safari] retain editing position doesn't work
  • #1148 HTML entities break when cursor is inside when switching from HTML to WYSIWYG
  • #1147 getSelectedHTML() throws error when nothing is selected
  • #1146 [ExtendedFileManager?] IE6 doesn't show images
File size: 4.4 KB
Line 
1xinha_editors = null;
2xinha_init    = null;
3xinha_config  = null;
4xinha_plugins = null;
5
6// This contains the names of textareas we will make into Xinha editors
7xinha_init = xinha_init ? xinha_init : function()
8{
9   /** STEP 1 ***************************************************************
10   * First, specify the textareas that shall be turned into Xinhas.
11   * For each one add the respective id to the xinha_editors array.
12   * I you want add more than on textarea, keep in mind that these
13   * values are comma seperated BUT there is no comma after the last value.
14   * If you are going to use this configuration on several pages with different
15   * textarea ids, you can add them all. The ones that are not found on the
16   * current page will just be skipped.
17   ************************************************************************/
18
19  xinha_editors = xinha_editors ? xinha_editors :
20  [
21    'myTextArea', 'anotherOne'
22  ];
23 
24  /** STEP 2 ***************************************************************
25   * Now, what are the plugins you will be using in the editors on this
26   * page.  List all the plugins you will need, even if not all the editors
27   * will use all the plugins.
28   *
29   * The list of plugins below is a good starting point, but if you prefer
30   * a simpler editor to start with then you can use the following
31   *
32   * xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
33   *
34   * which will load no extra plugins at all.
35   ************************************************************************/
36
37  xinha_plugins = xinha_plugins ? xinha_plugins :
38  [
39   'CharacterMap',
40   'ContextMenu',
41   'SmartReplace',
42   'Stylist',
43   'Linker',
44   'SuperClean',
45   'TableOperations'
46  ];
47 
48         // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
49         if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
50
51
52  /** STEP 3 ***************************************************************
53   * We create a default configuration to be used by all the editors.
54   * If you wish to configure some of the editors differently this will be
55   * done in step 5.
56   *
57   * If you want to modify the default config you might do something like this.
58   *
59   *   xinha_config = new Xinha.Config();
60   *   xinha_config.width  = '640px';
61   *   xinha_config.height = '420px';
62   *
63   *************************************************************************/
64
65   xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
66       
67   // To adjust the styling inside the editor, we can load an external stylesheet like this
68   // NOTE : YOU MUST GIVE AN ABSOLUTE URL
69 
70   xinha_config.pageStyleSheets = [ _editor_url + "examples/full_example.css" ];
71
72  /** STEP 4 ***************************************************************
73   * We first create editors for the textareas.
74   *
75   * You can do this in two ways, either
76   *
77   *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
78   *
79   * if you want all the editor objects to use the same set of plugins, OR;
80   *
81   *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
82   *   xinha_editors.myTextArea.registerPlugins(['Stylist']);
83   *   xinha_editors.anotherOne.registerPlugins(['CSS','SuperClean']);
84   *
85   * if you want to use a different set of plugins for one or more of the
86   * editors.
87   ************************************************************************/
88
89  xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
90
91  /** STEP 5 ***************************************************************
92   * If you want to change the configuration variables of any of the
93   * editors,  this is the place to do that, for example you might want to
94   * change the width and height of one of the editors, like this...
95   *
96   *   xinha_editors.myTextArea.config.width  = '640px';
97   *   xinha_editors.myTextArea.config.height = '480px';
98   *
99   ************************************************************************/
100
101
102  /** STEP 6 ***************************************************************
103   * Finally we "start" the editors, this turns the textareas into
104   * Xinha editors.
105   ************************************************************************/
106
107  Xinha.startEditors(xinha_editors);
108}
109
110Xinha.addOnloadHandler(xinha_init); // this executes the xinha_init function on page load
111                                     // and does not interfere with window.onload properties set by other scripts
112
Note: See TracBrowser for help on using the repository browser.