<commit_before>// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

CKEDITOR.plugins.add( 'autosave',
{
	// declare property to hold the state
	ajaxAutoSaveIsDirty: false,
	// declare a counter to give us a few keystrokes leeway
	ajaxAutoSaveCounter: 0,
	// declare a status flag so we know if a draft has been saved
	ajaxAutoSaveDraftSaved: false,
	// shortcut to my button
	button: null,
	editor: null,

	init: function( editor ) {

		var asplugin = this;	// for closure references later
		this.editor = editor;
	
		editor.ui.addButton( 'autosave', {
				label: 'Auto Save',
				command: 'autosave',
				icon: editor.config._TikiRoot + 'img/ckeditor/ajaxSaveClean.gif'

			} );

		editor.addCommand('autosave', new CKEDITOR.command(editor,
			{
				modes: {wysiwyg: 1, source: 1},
				canUndo: false
			})
		);

		// button clicked or timer
		editor.commands.autosave.exec = function () {
			asplugin.ajaxAutoSaveIsDirty = true;	// force
			return asplugin.doAjaxSave(editor);
		};

		
		// preload toolbar loading image
		var tempNode = new Image();
		tempNode.src = editor.config._TikiRoot + 'img/icons/loadingSmall.gif';
		
		editor.element.$.form.onsubmit = function() {
			asplugin.onSave( editor );
		};
		
		//var plugs = this.plugin;
		editor.on( 'contentDom', function() {
			this.document.on('keydown', function(event) {
				// Do not capture CTRL hotkeys.
				if (!event.data.$.ctrlKey && !event.data.$.metaKey) {
					asplugin.onSelectionChange(editor);
				}
			});
			// Also chgeck for autosave changes after toolbar commands.
			editor.on( 'afterCommandExec', function(event) {asplugin.onSelectionChange(editor);} );

		});
	
		editor.on('blur', function(event) {
			asplugin.doAjaxSave(editor);
		});
	},	// end init

	doAjaxSave: function (editor) {<commit_msg>[FIX] ckeditor: Image was moved in r60325<commit_after>// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

CKEDITOR.plugins.add( 'autosave',
{
	// declare property to hold the state
	ajaxAutoSaveIsDirty: false,
	// declare a counter to give us a few keystrokes leeway
	ajaxAutoSaveCounter: 0,
	// declare a status flag so we know if a draft has been saved
	ajaxAutoSaveDraftSaved: false,
	// shortcut to my button
	button: null,
	editor: null,

	init: function( editor ) {

		var asplugin = this;	// for closure references later
		this.editor = editor;
	
		editor.ui.addButton( 'autosave', {
				label: 'Auto Save',
				command: 'autosave',
				icon: editor.config._TikiRoot + 'img/ckeditor/ajaxSaveClean.gif'

			} );

		editor.addCommand('autosave', new CKEDITOR.command(editor,
			{
				modes: {wysiwyg: 1, source: 1},
				canUndo: false
			})
		);

		// button clicked or timer
		editor.commands.autosave.exec = function () {
			asplugin.ajaxAutoSaveIsDirty = true;	// force
			return asplugin.doAjaxSave(editor);
		};

		
		// preload toolbar loading image
		var tempNode = new Image();
		tempNode.src = editor.config._TikiRoot + 'img/ckeditor/loadingSmall.gif';
		
		editor.element.$.form.onsubmit = function() {
			asplugin.onSave( editor );
		};
		
		//var plugs = this.plugin;
		editor.on( 'contentDom', function() {
			this.document.on('keydown', function(event) {
				// Do not capture CTRL hotkeys.
				if (!event.data.$.ctrlKey && !event.data.$.metaKey) {
					asplugin.onSelectionChange(editor);
				}
			});
			// Also chgeck for autosave changes after toolbar commands.
			editor.on( 'afterCommandExec', function(event) {asplugin.onSelectionChange(editor);} );

		});
	
		editor.on('blur', function(event) {
			asplugin.doAjaxSave(editor);
		});
	},	// end init

	doAjaxSave: function (editor) {
{'fraction_non_alphanumeric': 0.12640239341810022, 'fraction_numerical': 0.006731488406881077, 'mean_word_length': 3.3561346362649296, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6977053', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1291, 'n_words': 364}