Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// Create a new plugin which registers a custom code highlighter
2
CKEDITOR.plugins.add('customCodeHighlighter', {
3
  afterInit: function (editor) {
4
    var highlighter = new CKEDITOR.plugins.codesnippet.highlighter({
5
      languages: {
6
        apache: 'Apache',
7
        bash: 'Bash',
8
        coffeescript: 'CoffeeScript',
9
        cpp: 'C++',
10
        cs: 'C#',
11
        css: 'CSS',
12
        diff: 'Diff',
13
        html: 'HTML',
14
        http: 'HTTP',
15
        ini: 'INI',
16
        java: 'Java',
17
        javascript: 'JavaScript',
18
        json: 'JSON',
19
        makefile: 'Makefile',
20
        markdown: 'Markdown',
21
        nginx: 'Nginx',
22
        objectivec: 'Objective-C',
23
        perl: 'Perl',
24
        php: 'PHP',
25
        python: 'Python',
26
        ruby: 'Ruby',
27
        sql: 'SQL',
28
        vbscript: 'VBScript',
29
        xhtml: 'XHTML',
30
        xml: 'XML'
31
      },
32
      init: function (ready) {
33
        // Here we should load any required resources
34
        ready();
35
      },
36
      highlighter: function (code, language, callback) {
37
        // Here we are highlighting the code and returning it.
38
        /**
39
         * Note: Since we're not adding any highlighting we have to
40
         * encode the html so that the html is not being run.
41
         */
42
        callback(CKEDITOR.tools.htmlEncode(code));
43
      }
44
    });
45
    editor.plugins.codesnippet.setHighlighter(highlighter);
46
  }
47
});