PageRenderTime 40ms CodeModel.GetById 23ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/plugins/xhtmlxtras/editor_plugin_src.js

#
JavaScript | 132 lines | 105 code | 13 blank | 14 comment | 4 complexity | b8b8236893ef2347a46cb131fc1a8c69 MD5 | raw file
  1/**
  2 * editor_plugin_src.js
  3 *
  4 * Copyright 2009, Moxiecode Systems AB
  5 * Released under LGPL License.
  6 *
  7 * License: http://tinymce.moxiecode.com/license
  8 * Contributing: http://tinymce.moxiecode.com/contributing
  9 */
 10
 11(function() {
 12	tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {
 13		init : function(ed, url) {
 14			// Register commands
 15			ed.addCommand('mceCite', function() {
 16				ed.windowManager.open({
 17					file : url + '/cite.htm',
 18					width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
 19					height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
 20					inline : 1
 21				}, {
 22					plugin_url : url
 23				});
 24			});
 25
 26			ed.addCommand('mceAcronym', function() {
 27				ed.windowManager.open({
 28					file : url + '/acronym.htm',
 29					width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
 30					height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),
 31					inline : 1
 32				}, {
 33					plugin_url : url
 34				});
 35			});
 36
 37			ed.addCommand('mceAbbr', function() {
 38				ed.windowManager.open({
 39					file : url + '/abbr.htm',
 40					width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
 41					height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),
 42					inline : 1
 43				}, {
 44					plugin_url : url
 45				});
 46			});
 47
 48			ed.addCommand('mceDel', function() {
 49				ed.windowManager.open({
 50					file : url + '/del.htm',
 51					width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
 52					height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),
 53					inline : 1
 54				}, {
 55					plugin_url : url
 56				});
 57			});
 58
 59			ed.addCommand('mceIns', function() {
 60				ed.windowManager.open({
 61					file : url + '/ins.htm',
 62					width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
 63					height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),
 64					inline : 1
 65				}, {
 66					plugin_url : url
 67				});
 68			});
 69
 70			ed.addCommand('mceAttributes', function() {
 71				ed.windowManager.open({
 72					file : url + '/attributes.htm',
 73					width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),
 74					height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),
 75					inline : 1
 76				}, {
 77					plugin_url : url
 78				});
 79			});
 80
 81			// Register buttons
 82			ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
 83			ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
 84			ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
 85			ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
 86			ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
 87			ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
 88
 89			ed.onNodeChange.add(function(ed, cm, n, co) {
 90				n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
 91
 92				cm.setDisabled('cite', co);
 93				cm.setDisabled('acronym', co);
 94				cm.setDisabled('abbr', co);
 95				cm.setDisabled('del', co);
 96				cm.setDisabled('ins', co);
 97				cm.setDisabled('attribs', n && n.nodeName == 'BODY');
 98				cm.setActive('cite', 0);
 99				cm.setActive('acronym', 0);
100				cm.setActive('abbr', 0);
101				cm.setActive('del', 0);
102				cm.setActive('ins', 0);
103
104				// Activate all
105				if (n) {
106					do {
107						cm.setDisabled(n.nodeName.toLowerCase(), 0);
108						cm.setActive(n.nodeName.toLowerCase(), 1);
109					} while (n = n.parentNode);
110				}
111			});
112
113			ed.onPreInit.add(function() {
114				// Fixed IE issue where it can't handle these elements correctly
115				ed.dom.create('abbr');
116			});
117		},
118
119		getInfo : function() {
120			return {
121				longname : 'XHTML Xtras Plugin',
122				author : 'Moxiecode Systems AB',
123				authorurl : 'http://tinymce.moxiecode.com',
124				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
125				version : tinymce.majorVersion + "." + tinymce.minorVersion
126			};
127		}
128	});
129
130	// Register plugin
131	tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
132})();