initial import
[roojs1] / examples / form / fck.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11  
12 var fck = false;
13 Roo.onReady(function(){
14
15     Roo.QuickTips.init();
16
17     // turn on validation errors beside the field globally
18     Roo.form.Field.prototype.msgTarget = 'side';
19  
20     /*
21      * ================  Form 2  =======================
22      */
23     var top = new Roo.form.Form({
24         labelAlign: 'top'
25     });
26
27     fck = new Roo.form.FCKeditor({
28             id:'bio',
29             fieldLabel:'Biography',
30             
31             fckconfig : {
32                 CustomConfigurationsPath : '/roojs1/examples/form/fckconfig.js'
33             },
34             
35             toolbarSet : 'Roo',
36             width:750,
37             value : '<blockquote>aaa<br/></blockquote>',
38             
39             height:300,
40             listeners : {
41                 editorinit : function(ed, f) {
42                     var de = f.EnterKeyHandler.DoEnter;
43                     f.EnterKeyHandler.constructor.prototype.DoEnter =
44                     f.EnterKeyHandler.DoEnter = function(m,h) {
45                         //console.log(this); 
46                         try { de(m,h); } catch(e) {  }
47                         //..console.log(this); 
48                         
49                         window.setTimeout( function() {
50                             try { 
51                                 f.EditorDocument.execCommand('outdent', false, null);
52                                 f.EditorDocument.execCommand('outdent', false, null);
53                                 f.EditorDocument.execCommand('outdent', false, null);
54                                 f.EditorDocument.execCommand('outdent', false, null);
55                             } catch(e) {  console.log(e)}
56                         }, 100);
57                             
58                         
59                        // this._OutdentWithSelection( currentBlock, range )
60                         
61                     };
62                     //f.EnterKeyHandler.DoEnter = function(m, hs) {
63                     //    eh(m,hs);
64                      //   console.log(this);
65                     //}
66                     
67
68                 }
69             }
70         });
71
72     top.container({},
73         fck
74     );
75
76     top.addButton('Save', function(){
77         top.doAction('submit', {
78             url: './fck.js',
79             method: 'POST'
80             
81         });
82        });
83     top.addButton('Cancel');
84
85     top.render('form-ct2');
86  
87 });