<commit_before>/**
 * @author <NAME>  https://github.com/VictorCoder123
 */

define(['js/util',
	'../Libs/cm/lib/codemirror', '../Libs/cm/mode/javascript/javascript',
	//'../Libs/cm/keymap/emacs', '../Libs/cm/keymap/sublime', '../Libs/cm/keymap/vim',
	'text!./DocumentEditorDialog.html',
	'css!./DocumentEditorDialog.css',
	'css!../Libs/cm/lib/codemirror.css'],
    function(Util,
             CodeMirror,
	     CodeMirrorModeJavascript,
             DocumentEditorDialogTemplate){
        'use strict';
	
        var DocumentEditorDialog;

        /**
         * DocumentEditorDialog Constructor
         * Insert dialog modal into body and initialize editor with
         * customized options
         */
        DocumentEditorDialog = function () {
            // Get Modal Template node for Editor Dialog and append it to body
            this._dialog = $(DocumentEditorDialogTemplate);
            this._dialog.appendTo($(document.body));

            // Get element nodes
            this._el = this._dialog.find('.modal-body').first();
            this._btnSave = this._dialog.find('.btn-save').first();

	    this._title = this._dialog.find('.modal-header').first();
	    this._codearea = this._dialog.find('#codearea').first();

	    var CodeMirrorEditorOptions = {
		lineNumbers: true,
		viewPortMargin: Infinity,
		//keyMap: 'emacs',
		gutters: ['CodeMirror-linenumbers'],
		path: 'decorators/DocumentEditorDialog/Libs/cm/lib/',
		mode: {
		    name: 'javascript',
		    matchBrackets: true
		}
	    };
	    this.editor = new CodeMirror.fromTextArea(
		this._codearea.get(0),
		CodeMirrorEditorOptions
	    );

            this.text = ''; // Keep track modified text in editor
        };

        /**
         * Initialize DocumentEditorDialog by creating EpicEditor in Bootstrap modal
         * window and set event listeners on its subcomponents like save button. Notice
         * EpicEditor is created but not loaded yet. The creation and loading of editor
         * are seperated due to the reason decorator component is not appended to DOM within
         * its own domain.
         * @param  {String}     text           Text to be rendered in editor initially
         * @param  {Function}   saveCallback   Callback function after click save button
         * @return {void}<commit_msg>fixed emacs keybindings.<commit_after>/**
 * @author <NAME>  https://github.com/VictorCoder123
 */

define(['js/util',
	'../Libs/cm/lib/codemirror', '../Libs/cm/mode/javascript/javascript',
	'../Libs/cm/keymap/emacs', '../Libs/cm/keymap/sublime', '../Libs/cm/keymap/vim',
	'text!./DocumentEditorDialog.html',
	'css!./DocumentEditorDialog.css',
	'css!../Libs/cm/lib/codemirror.css'],
    function(Util,
             CodeMirror,
	     CodeMirrorModeJavascript,
	     CodeMirrorEmacsKeymap, CodeMirrorSublimeKeymap, CodeMirrorVimKeymap,
             DocumentEditorDialogTemplate){
        'use strict';
	
        var DocumentEditorDialog;

        /**
         * DocumentEditorDialog Constructor
         * Insert dialog modal into body and initialize editor with
         * customized options
         */
        DocumentEditorDialog = function () {
            // Get Modal Template node for Editor Dialog and append it to body
            this._dialog = $(DocumentEditorDialogTemplate);
            this._dialog.appendTo($(document.body));

            // Get element nodes
            this._el = this._dialog.find('.modal-body').first();
            this._btnSave = this._dialog.find('.btn-save').first();

	    this._title = this._dialog.find('.modal-header').first();
	    this._codearea = this._dialog.find('#codearea').first();

	    var CodeMirrorEditorOptions = {
		lineNumbers: true,
		viewPortMargin: Infinity,
		keyMap: "emacs",
		path: 'decorators/DocumentEditorDialog/Libs/cm/lib/',
		mode: {
		    name: 'javascript',
		    matchBrackets: true
		}
	    };
	    this.editor = new CodeMirror.fromTextArea(
		this._codearea.get(0),
		CodeMirrorEditorOptions
	    );

            this.text = ''; // Keep track modified text in editor
        };

        /**
         * Initialize DocumentEditorDialog by creating EpicEditor in Bootstrap modal
         * window and set event listeners on its subcomponents like save button. Notice
         * EpicEditor is created but not loaded yet. The creation and loading of editor
         * are seperated due to the reason decorator component is not appended to DOM within
         * its own domain.
         * @param  {String}     text           Text to be rendered in editor initially
         * @param  {Function}   saveCallback   Callback function after click save button
         * @return {void}
{'fraction_non_alphanumeric': 0.11621911922663802, 'fraction_numerical': 0.0017185821697099893, 'mean_word_length': 2.4387001477104873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '681343', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1260, 'n_words': 326}