Sha256: b35b74b453e930c0c2b3bf4d5c5db13362cd52fe067eb50e8a3d282c7e7664ca

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

/**
 * plugin.js
 *
 * Released under LGPL License.
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

/*global tinymce:true */

tinymce.PluginManager.add('code', function(editor) {
	function showDialog() {
		var win = editor.windowManager.open({
			title: "Source code",
			body: {
				type: 'textbox',
				name: 'code',
				multiline: true,
				minWidth: editor.getParam("code_dialog_width", 600),
				minHeight: editor.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),
				spellcheck: false,
				style: 'direction: ltr; text-align: left'
			},
			onSubmit: function(e) {
				// We get a lovely "Wrong document" error in IE 11 if we
				// don't move the focus to the editor before creating an undo
				// transation since it tries to make a bookmark for the current selection
				editor.focus();

				editor.undoManager.transact(function() {
					editor.setContent(e.data.code);
				});

				editor.selection.setCursorLocation();
				editor.nodeChanged();
			}
		});

		// Gecko has a major performance issue with textarea
		// contents so we need to set it when all reflows are done
		win.find('#code').value(editor.getContent({source_view: true}));
	}

	editor.addCommand("mceCodeEditor", showDialog);

	editor.addButton('code', {
		icon: 'code',
		tooltip: 'Source code',
		onclick: showDialog
	});

	editor.addMenuItem('code', {
		icon: 'code',
		text: 'Source code',
		context: 'tools',
		onclick: showDialog
	});
});

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
mosaico-2.0.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
mosaico-1.1.1 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
mosaico-1.1.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
mosaico-1.0.2 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
mosaico-1.0.1 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
goldencobra-2.3.4 app/assets/javascripts/goldencobra/html_editors/tinymce_v4/plugins/code/plugin.js
goldencobra-2.3.3 app/assets/javascripts/goldencobra/html_editors/tinymce_v4/plugins/code/plugin.js
mosaico-1.0.0 vendor/assets/mosaico-0.16.0/mosaico/dist/vendor/plugins/code/plugin.js
jinda_bsb-0.0.1 lib/generators/jinda_bsb/templates/app/assets/jinda_assets/plugins/tinymce/plugins/code/plugin.js
spiderfw-1.0.1 apps/core/components/public/js/tinymce/plugins/code/plugin.js
spiderfw-1.0.0 apps/core/components/public/js/tinymce/plugins/code/plugin.js
spiderfw-0.6.39 apps/core/components/public/js/tinymce/plugins/code/plugin.js