Blame view

mobile/source/tmpl/default/js/editor/CKEditor.js 2.19 KB
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  
  CKEditor = {
   
    'toolbar' : {
        'basic' :[
  	              ['Source','Preview','Maximize'],
  	              ['Cut','Copy','Paste','PasteWord','Undo','Redo'],
  	              ['Image','Link','Unlink'],
  	              ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
  
  	              ['Bold','Italic','Underline','StrikeThrough',],
  	              ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'],
  
                ]
    }
  
  
  }
  
  CKEditor.create = function( name,module ){
    if ( false==module ){
      module = '';
    }
    var hEd = CKEDITOR.instances[name];
    if (hEd) {
      CKEDITOR.remove(hEd);
    }
  
    hEd = CKEDITOR.replace(name,{
      'AutoDetectLanguage':false,
      'toolbar' : CKEditor.toolbar.basic,
      'DefaultLanguage' : 'ru',
      'theme' : 'default',
      'skin' : 'v2',
      'filebrowserImageUploadUrl' : '/?p_name=admin_images&act=editor_upload&module='+module,
      'removePlugins' : 'elementspath',
      'entities' : false,
      'height':400
    });
    	
  	
  	 	
      CKEDITOR.on( 'dialogDefinition', function( ev ){
      var dialogName = ev.data.name;
     
     		//CKEDITOR.dialog.dialogDefinitionObject
      var dialogDefinition = ev.data.definition;
      if ( dialogName == 'image' ){
      	dialogDefinition.removeContents( 'advanced' );
      	dialogDefinition.removeContents( 'Link' );
      	var content = dialogDefinition.getContents( 'info' );
      	content.remove( 'txtVSpace' );
      	content.remove( 'txtHSpace' );
      	content.remove( 'txtBorder' );
      	content.remove( 'txtHeight' );
      	content.remove( 'txtWidth' );
      	content.remove( 'txtAlt' );
      	//alert( content.elements[0].type )
      }
      
      if ( dialogName == 'link' ){
      	dialogDefinition.removeContents( 'advanced' );
     		dialogDefinition.removeContents( 'target' );
     	}
     	
      if ( dialogName == 'flash' ){
      	dialogDefinition.removeContents( 'advanced' );
      }
    })
    
    return hEd;
  } //  end create
  
  CKEditor.remove = function( element ){
    editor_id = element.attr('link_editor');
    HL.editor.get(editor_id).destroy();
  }
  
  CKEditor.getText = function( element  ){
    editor_id = element.attr('link_editor');
    return HL.editor.get(editor_id) .getData()
   
  }
  
    //  регистрируем
  HL.editor.register('CKEditor',CKEditor);