File:  [LON-CAPA] / loncom / html / adm / ckeditor / plugins / lcm / dialogs / lcm.js
Revision 1.1: download - view: text, annotated - select for diffs
Tue Mar 31 13:45:46 2015 UTC (9 years, 5 months ago) by damieng
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, HEAD
updated ckeditor to 4.4.7 with an additional plugin to handle <m> with MathJax

/**
 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or http://ckeditor.com/license
 */

'use strict';

CKEDITOR.dialog.add( 'lcm', function( editor ) {

    var preview,
        lang = editor.lang.lcm;

    return {
        title: lang.title,
        minWidth: 350,
        minHeight: 100,
        contents: [
            {
                id: 'info',
                elements: [
                    {
                        id: 'equation',
                        type: 'textarea',
                        label: lang.dialogInput,

                        onLoad: function() {
                            var that = this;

                            if ( !( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) ) {
                                this.getInputElement().on( 'keyup', function() {
                                    preview.setValue( that.getInputElement().getValue() );
                                } );
                            }
                        },

                        setup: function( widget ) {
                            this.setValue( widget.data.math );
                        },

                        commit: function( widget ) {
                            widget.setData( 'math', this.getValue() );
                        }
                    },
                    {
                        id: 'documentation',
                        type: 'html',
                        html:
                            '<div style="width:100%;text-align:right;margin:-8px 0 10px">' +
                                '<a class="cke_mathjax_doc" href="' + lang.docUrl + '" target="_black" style="cursor:pointer;color:#00B2CE;text-decoration:underline">' +
                                    lang.docLabel +
                                '</a>' +
                            '</div>'
                    },
                    ( !( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) ) && {
                        id: 'preview',
                        type: 'html',
                        html:
                            '<div style="width:100%;text-align:center;">' +
                                '<iframe style="border:0;width:0;height:0;font-size:20px" scrolling="no" frameborder="0" allowTransparency="true" src="' + CKEDITOR.plugins.lcm.fixSrc + '"></iframe>' +
                            '</div>',

                        onLoad: function() {
                            var iFrame = CKEDITOR.document.getById( this.domId ).getChild( 0 );
                            preview = new CKEDITOR.plugins.lcm.frameWrapper( iFrame, editor );
                        },

                        setup: function( widget ) {
                            preview.setValue( widget.data.math );
                        }
                    }
                ]
            }
        ]
    };
} );

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>