includes/clientside/tinymce/themes/advanced/editor_template_src.js
changeset 395 fa4c5ecb7c9a
parent 335 67bd3121a12e
child 459 31c23016ab62
equal deleted inserted replaced
394:fbfdcea634a7 395:fa4c5ecb7c9a
     1 /**
     1 /**
     2  * $Id: editor_template_src.js 492 2007-12-13 14:11:51Z spocke $
     2  * $Id: editor_template_src.js 555 2008-01-19 19:08:37Z spocke $
     3  *
     3  *
     4  * @author Moxiecode
     4  * @author Moxiecode
     5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
     5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
     6  */
     6  */
     7 
     7 
     8 (function() {
     8 (function() {
     9 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID;
     9 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID;
    10 
    10 
    76 				theme_advanced_row_height : 23,
    76 				theme_advanced_row_height : 23,
    77 				theme_advanced_resize_horizontal : 1,
    77 				theme_advanced_resize_horizontal : 1,
    78 				theme_advanced_resizing_use_cookie : 1
    78 				theme_advanced_resizing_use_cookie : 1
    79 			}, ed.settings);
    79 			}, ed.settings);
    80 
    80 
       
    81 			if (s.theme_advanced_path_location)
       
    82 				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
       
    83 
       
    84 			if (s.theme_advanced_statusbar_location == 'none')
       
    85 				s.theme_advanced_statusbar_location = 0;
       
    86 
    81 			// Init editor
    87 			// Init editor
    82 			ed.onInit.add(function() {
    88 			ed.onInit.add(function() {
    83 				ed.onNodeChange.add(t._nodeChanged, t);
    89 				ed.onNodeChange.add(t._nodeChanged, t);
    84 				ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
    90 				ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
    85 			});
    91 			});
   373 						t.lastPath = 0;
   379 						t.lastPath = 0;
   374 					}
   380 					}
   375 				});
   381 				});
   376 			}
   382 			}
   377 */
   383 */
       
   384 
       
   385 			if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
       
   386 				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
       
   387 
   378 			if (s.theme_advanced_toolbar_location == 'external')
   388 			if (s.theme_advanced_toolbar_location == 'external')
   379 				o.deltaHeight = 0;
   389 				o.deltaHeight = 0;
   380 
   390 
   381 			t.deltaHeight = o.deltaHeight;
   391 			t.deltaHeight = o.deltaHeight;
   382 			o.targetNode = null;
   392 			o.targetNode = null;
   469 
   479 
   470 			dc = s.theme_advanced_containers_default_class || '';
   480 			dc = s.theme_advanced_containers_default_class || '';
   471 			da = s.theme_advanced_containers_default_align || 'center';
   481 			da = s.theme_advanced_containers_default_align || 'center';
   472 
   482 
   473 			each((s.theme_advanced_containers || '').split(','), function(c, i) {
   483 			each((s.theme_advanced_containers || '').split(','), function(c, i) {
   474 				var v = s['theme_advanced_container_' + c].toLowerCase();
   484 				var v = s['theme_advanced_container_' + c] || '';
   475 
   485 
   476 				switch (v) {
   486 				switch (c.toLowerCase()) {
   477 					case 'mceeditor':
   487 					case 'mceeditor':
   478 						n = DOM.add(tb, 'tr');
   488 						n = DOM.add(tb, 'tr');
   479 						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
   489 						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
   480 						break;
   490 						break;
   481 
   491 
   489 							align : s['theme_advanced_container_' + c + '_align'] || da
   499 							align : s['theme_advanced_container_' + c + '_align'] || da
   490 						});
   500 						});
   491 
   501 
   492 						to = cf.createToolbar("toolbar" + i);
   502 						to = cf.createToolbar("toolbar" + i);
   493 						t._addControls(v, to);
   503 						t._addControls(v, to);
   494 						n.innerHTML = to.renderHTML();
   504 						DOM.setHTML(n, to.renderHTML());
   495 						o.deltaHeight -= s.theme_advanced_row_height;
   505 						o.deltaHeight -= s.theme_advanced_row_height;
   496 				}
   506 				}
   497 			});
   507 			});
   498 
   508 
   499 			return ic;
   509 			return ic;
   548 
   558 
   549 			h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
   559 			h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
   550 
   560 
   551 			// Create toolbar and add the controls
   561 			// Create toolbar and add the controls
   552 			for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
   562 			for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
   553 				tb = cf.createToolbar("toolbar" + i);
   563 				tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
   554 
   564 
   555 				if (s['theme_advanced_buttons' + i + '_add'])
   565 				if (s['theme_advanced_buttons' + i + '_add'])
   556 					v += ',' + s['theme_advanced_buttons' + i + '_add'];
   566 					v += ',' + s['theme_advanced_buttons' + i + '_add'];
   557 
   567 
   558 				if (s['theme_advanced_buttons' + i + '_add_before'])
   568 				if (s['theme_advanced_buttons' + i + '_add_before'])
   559 					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
   569 					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
   560 
   570 
   561 				t._addControls(v, tb, di);
   571 				t._addControls(v, tb);
   562 
   572 
   563 				//n.appendChild(n = tb.render());
   573 				//n.appendChild(n = tb.render());
   564 				h.push(tb.renderHTML());
   574 				h.push(tb.renderHTML());
   565 
   575 
   566 				o.deltaHeight -= s.theme_advanced_row_height;
   576 				o.deltaHeight -= s.theme_advanced_row_height;
   567 			}
   577 			}
   568 
   578 
   569 			h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
   579 			h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
   570 
   580 			DOM.setHTML(n, h.join(''));
   571 			n.innerHTML = h.join('');
       
   572 		},
   581 		},
   573 
   582 
   574 		_addStatusBar : function(tb, o) {
   583 		_addStatusBar : function(tb, o) {
   575 			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
   584 			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
   576 
   585 
   749 			if (c = cm.get('fontsizeselect'))
   758 			if (c = cm.get('fontsizeselect'))
   750 				c.select(ed.queryCommandValue('FontSize'));
   759 				c.select(ed.queryCommandValue('FontSize'));
   751 
   760 
   752 			if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
   761 			if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
   753 				p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
   762 				p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
   754 				p.innerHTML = '';
   763 				DOM.setHTML(p, '');
   755 
   764 
   756 				ed.dom.getParent(n, function(n) {
   765 				ed.dom.getParent(n, function(n) {
   757 					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
   766 					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
   758 
   767 
   759 					// Ignore non element and hidden elements
   768 					// Ignore non element and hidden elements
   861 		_mceInsertAnchor : function(ui, v) {
   870 		_mceInsertAnchor : function(ui, v) {
   862 			var ed = this.editor;
   871 			var ed = this.editor;
   863 
   872 
   864 			ed.windowManager.open({
   873 			ed.windowManager.open({
   865 				url : tinymce.baseURL + '/themes/advanced/anchor.htm',
   874 				url : tinymce.baseURL + '/themes/advanced/anchor.htm',
   866 				width : 320 + Number(ed.getLang('advanced.anchor_delta_width', 0)),
   875 				width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
   867 				height : 90 + Number(ed.getLang('advanced.anchor_delta_height', 0)),
   876 				height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
   868 				inline : true
   877 				inline : true
   869 			}, {
   878 			}, {
   870 				theme_url : this.url
   879 				theme_url : this.url
   871 			});
   880 			});
   872 		},
   881 		},
   874 		_mceCharMap : function() {
   883 		_mceCharMap : function() {
   875 			var ed = this.editor;
   884 			var ed = this.editor;
   876 
   885 
   877 			ed.windowManager.open({
   886 			ed.windowManager.open({
   878 				url : tinymce.baseURL + '/themes/advanced/charmap.htm',
   887 				url : tinymce.baseURL + '/themes/advanced/charmap.htm',
   879 				width : 550 + Number(ed.getLang('advanced.charmap_delta_width', 0)),
   888 				width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
   880 				height : 250 + Number(ed.getLang('advanced.charmap_delta_height', 0)),
   889 				height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
   881 				inline : true
   890 				inline : true
   882 			}, {
   891 			}, {
   883 				theme_url : this.url
   892 				theme_url : this.url
   884 			});
   893 			});
   885 		},
   894 		},
   902 
   911 
   903 			v = v || {};
   912 			v = v || {};
   904 
   913 
   905 			ed.windowManager.open({
   914 			ed.windowManager.open({
   906 				url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
   915 				url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
   907 				width : 375 + Number(ed.getLang('advanced.colorpicker_delta_width', 0)),
   916 				width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
   908 				height : 250 + Number(ed.getLang('advanced.colorpicker_delta_height', 0)),
   917 				height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
   909 				close_previous : false,
   918 				close_previous : false,
   910 				inline : true
   919 				inline : true
   911 			}, {
   920 			}, {
   912 				input_color : v.color,
   921 				input_color : v.color,
   913 				func : v.func,
   922 				func : v.func,
   933 		_mceImage : function(ui, val) {
   942 		_mceImage : function(ui, val) {
   934 			var ed = this.editor;
   943 			var ed = this.editor;
   935 
   944 
   936 			ed.windowManager.open({
   945 			ed.windowManager.open({
   937 				url : tinymce.baseURL + '/themes/advanced/image.htm',
   946 				url : tinymce.baseURL + '/themes/advanced/image.htm',
   938 				width : 355 + Number(ed.getLang('advanced.image_delta_width', 0)),
   947 				width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
   939 				height : 275 + Number(ed.getLang('advanced.image_delta_height', 0)),
   948 				height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
   940 				inline : true
   949 				inline : true
   941 			}, {
   950 			}, {
   942 				theme_url : this.url
   951 				theme_url : this.url
   943 			});
   952 			});
   944 		},
   953 		},
   946 		_mceLink : function(ui, val) {
   955 		_mceLink : function(ui, val) {
   947 			var ed = this.editor;
   956 			var ed = this.editor;
   948 
   957 
   949 			ed.windowManager.open({
   958 			ed.windowManager.open({
   950 				url : tinymce.baseURL + '/themes/advanced/link.htm',
   959 				url : tinymce.baseURL + '/themes/advanced/link.htm',
   951 				width : 310 + Number(ed.getLang('advanced.link_delta_width', 0)),
   960 				width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
   952 				height : 200 + Number(ed.getLang('advanced.link_delta_height', 0)),
   961 				height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
   953 				inline : true
   962 				inline : true
   954 			}, {
   963 			}, {
   955 				theme_url : this.url
   964 				theme_url : this.url
   956 			});
   965 			});
   957 		},
   966 		},