annotate WebContent/jscripts/tiny_mce/themes/advanced/editor_template_src.js @ 8:11baadcdd2c8

start of new Annotator API implementation.
author casties
date Mon, 19 Mar 2012 14:50:28 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 /**
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 * editor_template_src.js
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 * Copyright 2009, Moxiecode Systems AB
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 * Released under LGPL License.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 * License: http://tinymce.moxiecode.com/license
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 * Contributing: http://tinymce.moxiecode.com/contributing
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 (function(tinymce) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 // Tell it to load theme specific language pack(s)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 tinymce.ThemeManager.requireLangPack('advanced');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 tinymce.create('tinymce.themes.AdvancedTheme', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 sizes : [8, 10, 12, 14, 18, 24, 36],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 // Control name lookup, format: title, command
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 controls : {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 bold : ['bold_desc', 'Bold'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 italic : ['italic_desc', 'Italic'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 underline : ['underline_desc', 'Underline'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 strikethrough : ['striketrough_desc', 'Strikethrough'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 justifyleft : ['justifyleft_desc', 'JustifyLeft'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 justifycenter : ['justifycenter_desc', 'JustifyCenter'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 justifyright : ['justifyright_desc', 'JustifyRight'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 justifyfull : ['justifyfull_desc', 'JustifyFull'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 bullist : ['bullist_desc', 'InsertUnorderedList'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 numlist : ['numlist_desc', 'InsertOrderedList'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 outdent : ['outdent_desc', 'Outdent'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 indent : ['indent_desc', 'Indent'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 cut : ['cut_desc', 'Cut'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 copy : ['copy_desc', 'Copy'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 paste : ['paste_desc', 'Paste'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 undo : ['undo_desc', 'Undo'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 redo : ['redo_desc', 'Redo'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 link : ['link_desc', 'mceLink'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 unlink : ['unlink_desc', 'unlink'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 image : ['image_desc', 'mceImage'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 cleanup : ['cleanup_desc', 'mceCleanup'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 help : ['help_desc', 'mceHelp'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 code : ['code_desc', 'mceCodeEditor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 hr : ['hr_desc', 'InsertHorizontalRule'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 removeformat : ['removeformat_desc', 'RemoveFormat'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47 sub : ['sub_desc', 'subscript'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 sup : ['sup_desc', 'superscript'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 forecolor : ['forecolor_desc', 'ForeColor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 forecolorpicker : ['forecolor_desc', 'mceForeColor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 backcolor : ['backcolor_desc', 'HiliteColor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 backcolorpicker : ['backcolor_desc', 'mceBackColor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53 charmap : ['charmap_desc', 'mceCharMap'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 anchor : ['anchor_desc', 'mceInsertAnchor'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 newdocument : ['newdocument_desc', 'mceNewDocument'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57 blockquote : ['blockquote_desc', 'mceBlockQuote']
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 init : function(ed, url) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 var t = this, s, v, o;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 t.editor = ed;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66 t.url = url;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 t.onResolveName = new tinymce.util.Dispatcher(this);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69 ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72 // Default settings
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 t.settings = s = extend({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 theme_advanced_path : true,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 theme_advanced_toolbar_location : 'bottom',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76 theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79 theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80 theme_advanced_toolbar_align : "center",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 theme_advanced_more_colors : 1,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 theme_advanced_row_height : 23,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84 theme_advanced_resize_horizontal : 1,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 theme_advanced_resizing_use_cookie : 1,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86 theme_advanced_font_sizes : "1,2,3,4,5,6,7",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 theme_advanced_font_selector : "span",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88 theme_advanced_show_current_color: 0,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 readonly : ed.settings.readonly
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 }, ed.settings);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 // Setup default font_size_style_values
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 if (!s.font_size_style_values)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 s.font_size_style_values = tinymce.explode(s.font_size_style_values);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 s.font_size_classes = tinymce.explode(s.font_size_classes || '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100 // Parse string value
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 o = {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103 each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 var cl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106 if (k == v && v >= 1 && v <= 7) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 k = v + ' (' + t.sizes[v - 1] + 'pt)';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 cl = s.font_size_classes[v - 1];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109 v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
112 if (/^\s*\./.test(v))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
113 cl = v.replace(/\./g, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
114
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
115 o[k] = cl ? {'class' : cl} : {fontSize : v};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
116 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
117
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
118 s.theme_advanced_font_sizes = o;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
119 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
120
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
121 if ((v = s.theme_advanced_path_location) && v != 'none')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
122 s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
123
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
124 if (s.theme_advanced_statusbar_location == 'none')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
125 s.theme_advanced_statusbar_location = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
126
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
127 if (ed.settings.content_css !== false)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
128 ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
129
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
130 // Init editor
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
131 ed.onInit.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
132 if (!ed.settings.readonly) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
133 ed.onNodeChange.add(t._nodeChanged, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
134 ed.onKeyUp.add(t._updateUndoStatus, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
135 ed.onMouseUp.add(t._updateUndoStatus, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
136 ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
137 t._updateUndoStatus(ed);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
138 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
139 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
140 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
141
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
142 ed.onSetProgressState.add(function(ed, b, ti) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
143 var co, id = ed.id, tb;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
144
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
145 if (b) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
146 t.progressTimer = setTimeout(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
147 co = ed.getContainer();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
148 co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
149 tb = DOM.get(ed.id + '_tbl');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
150
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
151 DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
152 DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
153 }, ti || 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
154 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
155 DOM.remove(id + '_blocker');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
156 DOM.remove(id + '_progress');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
157 clearTimeout(t.progressTimer);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
158 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
159 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
160
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
161 DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
162
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
163 if (s.skin_variant)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
164 DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
165 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
166
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
167 _isHighContrast : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
168 var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
169
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
170 actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
171 DOM.remove(div);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
172
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
173 return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
174 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
175
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
176 createControl : function(n, cf) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
177 var cd, c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
178
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
179 if (c = cf.createControl(n))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
180 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
181
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
182 switch (n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
183 case "styleselect":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
184 return this._createStyleSelect();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
185
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
186 case "formatselect":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
187 return this._createBlockFormats();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
188
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
189 case "fontselect":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
190 return this._createFontSelect();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
191
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
192 case "fontsizeselect":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
193 return this._createFontSizeSelect();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
194
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
195 case "forecolor":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
196 return this._createForeColorMenu();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
197
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
198 case "backcolor":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
199 return this._createBackColorMenu();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
200 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
201
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
202 if ((cd = this.controls[n]))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
203 return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
204 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
205
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
206 execCommand : function(cmd, ui, val) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
207 var f = this['_' + cmd];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
208
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
209 if (f) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
210 f.call(this, ui, val);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
211 return true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
212 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
213
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
214 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
215 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
216
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
217 _importClasses : function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
218 var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
219
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
220 if (ctrl.getLength() == 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
221 each(ed.dom.getClasses(), function(o, idx) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
222 var name = 'style_' + idx;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
223
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
224 ed.formatter.register(name, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
225 inline : 'span',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
226 attributes : {'class' : o['class']},
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
227 selector : '*'
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
228 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
229
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
230 ctrl.add(o['class'], name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
231 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
232 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
233 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
234
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
235 _createStyleSelect : function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
236 var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
237
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
238 // Setup style select box
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
239 ctrl = ctrlMan.createListBox('styleselect', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
240 title : 'advanced.style_select',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
241 onselect : function(name) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
242 var matches, formatNames = [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
243
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
244 each(ctrl.items, function(item) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
245 formatNames.push(item.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
246 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
247
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
248 ed.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
249 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
250
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
251 // Toggle off the current format
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
252 matches = ed.formatter.matchAll(formatNames);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
253 if (!name || matches[0] == name) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
254 if (matches[0])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
255 ed.formatter.remove(matches[0]);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
256 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
257 ed.formatter.apply(name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
258
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
259 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
260 ed.nodeChanged();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
261
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
262 return false; // No auto select
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
263 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
264 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
265
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
266 // Handle specified format
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
267 ed.onInit.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
268 var counter = 0, formats = ed.getParam('style_formats');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
269
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
270 if (formats) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
271 each(formats, function(fmt) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
272 var name, keys = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
273
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
274 each(fmt, function() {keys++;});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
275
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
276 if (keys > 1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
277 name = fmt.name = fmt.name || 'style_' + (counter++);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
278 ed.formatter.register(name, fmt);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
279 ctrl.add(fmt.title, name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
280 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
281 ctrl.add(fmt.title);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
282 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
283 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
284 each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
285 var name;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
286
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
287 if (val) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
288 name = 'style_' + (counter++);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
289
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
290 ed.formatter.register(name, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
291 inline : 'span',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
292 classes : val,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
293 selector : '*'
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
294 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
295
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
296 ctrl.add(t.editor.translate(key), name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
297 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
298 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
299 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
300 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
301
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
302 // Auto import classes if the ctrl box is empty
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
303 if (ctrl.getLength() == 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
304 ctrl.onPostRender.add(function(ed, n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
305 if (!ctrl.NativeListBox) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
306 Event.add(n.id + '_text', 'focus', t._importClasses, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
307 Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
308 Event.add(n.id + '_open', 'focus', t._importClasses, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
309 Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
310 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
311 Event.add(n.id, 'focus', t._importClasses, t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
312 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
313 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
314
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
315 return ctrl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
316 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
317
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
318 _createFontSelect : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
319 var c, t = this, ed = t.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
320
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
321 c = ed.controlManager.createListBox('fontselect', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
322 title : 'advanced.fontdefault',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
323 onselect : function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
324 var cur = c.items[c.selectedIndex];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
325
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
326 if (!v && cur) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
327 ed.execCommand('FontName', false, cur.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
328 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
329 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
330
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
331 ed.execCommand('FontName', false, v);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
332
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
333 // Fake selection, execCommand will fire a nodeChange and update the selection
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
334 c.select(function(sv) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
335 return v == sv;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
336 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
337
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
338 if (cur && cur.value == v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
339 c.select(null);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
340 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
341
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
342 return false; // No auto select
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
343 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
344 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
345
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
346 if (c) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
347 each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
348 c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
349 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
350 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
351
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
352 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
353 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
354
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
355 _createFontSizeSelect : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
356 var t = this, ed = t.editor, c, i = 0, cl = [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
357
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
358 c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
359 var cur = c.items[c.selectedIndex];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
360
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
361 if (!v && cur) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
362 cur = cur.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
363
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
364 if (cur['class']) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
365 ed.formatter.toggle('fontsize_class', {value : cur['class']});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
366 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
367 ed.nodeChanged();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
368 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
369 ed.execCommand('FontSize', false, cur.fontSize);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
370 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
371
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
372 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
373 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
374
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
375 if (v['class']) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
376 ed.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
377 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
378 ed.formatter.toggle('fontsize_class', {value : v['class']});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
379 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
380 ed.nodeChanged();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
381 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
382 ed.execCommand('FontSize', false, v.fontSize);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
383
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
384 // Fake selection, execCommand will fire a nodeChange and update the selection
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
385 c.select(function(sv) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
386 return v == sv;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
387 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
388
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
389 if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] == v['class'])) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
390 c.select(null);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
391 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
392
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
393 return false; // No auto select
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
394 }});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
395
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
396 if (c) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
397 each(t.settings.theme_advanced_font_sizes, function(v, k) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
398 var fz = v.fontSize;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
399
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
400 if (fz >= 1 && fz <= 7)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
401 fz = t.sizes[parseInt(fz) - 1] + 'pt';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
402
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
403 c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
404 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
405 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
406
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
407 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
408 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
409
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
410 _createBlockFormats : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
411 var c, fmts = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
412 p : 'advanced.paragraph',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
413 address : 'advanced.address',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
414 pre : 'advanced.pre',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
415 h1 : 'advanced.h1',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
416 h2 : 'advanced.h2',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
417 h3 : 'advanced.h3',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
418 h4 : 'advanced.h4',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
419 h5 : 'advanced.h5',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
420 h6 : 'advanced.h6',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
421 div : 'advanced.div',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
422 blockquote : 'advanced.blockquote',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
423 code : 'advanced.code',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
424 dt : 'advanced.dt',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
425 dd : 'advanced.dd',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
426 samp : 'advanced.samp'
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
427 }, t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
428
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
429 c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', onselect : function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
430 t.editor.execCommand('FormatBlock', false, v);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
431 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
432 }});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
433
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
434 if (c) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
435 each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
436 c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
437 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
438 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
439
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
440 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
441 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
442
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
443 _createForeColorMenu : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
444 var c, t = this, s = t.settings, o = {}, v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
445
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
446 if (s.theme_advanced_more_colors) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
447 o.more_colors_func = function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
448 t._mceColorPicker(0, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
449 color : c.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
450 func : function(co) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
451 c.setColor(co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
452 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
453 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
454 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
455 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
456
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
457 if (v = s.theme_advanced_text_colors)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
458 o.colors = v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
459
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
460 if (s.theme_advanced_default_foreground_color)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
461 o.default_color = s.theme_advanced_default_foreground_color;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
462
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
463 o.title = 'advanced.forecolor_desc';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
464 o.cmd = 'ForeColor';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
465 o.scope = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
466
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
467 c = t.editor.controlManager.createColorSplitButton('forecolor', o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
468
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
469 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
470 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
471
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
472 _createBackColorMenu : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
473 var c, t = this, s = t.settings, o = {}, v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
474
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
475 if (s.theme_advanced_more_colors) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
476 o.more_colors_func = function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
477 t._mceColorPicker(0, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
478 color : c.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
479 func : function(co) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
480 c.setColor(co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
481 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
482 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
483 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
484 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
485
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
486 if (v = s.theme_advanced_background_colors)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
487 o.colors = v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
488
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
489 if (s.theme_advanced_default_background_color)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
490 o.default_color = s.theme_advanced_default_background_color;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
491
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
492 o.title = 'advanced.backcolor_desc';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
493 o.cmd = 'HiliteColor';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
494 o.scope = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
495
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
496 c = t.editor.controlManager.createColorSplitButton('backcolor', o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
497
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
498 return c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
499 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
500
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
501 renderUI : function(o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
502 var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
503
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
504 if (ed.settings) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
505 ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
506 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
507
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
508 // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
509 // Maybe actually inherit it from the original textara?
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
510 n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
511 DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
512
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
513 if (!DOM.boxModel)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
514 n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
515
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
516 n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
517 n = tb = DOM.add(n, 'tbody');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
518
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
519 switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
520 case "rowlayout":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
521 ic = t._rowLayout(s, tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
522 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
523
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
524 case "customlayout":
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
525 ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
526 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
527
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
528 default:
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
529 ic = t._simpleLayout(s, tb, o, p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
530 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
531
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
532 n = o.targetNode;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
533
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
534 // Add classes to first and last TRs
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
535 nl = sc.rows;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
536 DOM.addClass(nl[0], 'mceFirst');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
537 DOM.addClass(nl[nl.length - 1], 'mceLast');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
538
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
539 // Add classes to first and last TDs
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
540 each(DOM.select('tr', tb), function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
541 DOM.addClass(n.firstChild, 'mceFirst');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
542 DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
543 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
544
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
545 if (DOM.get(s.theme_advanced_toolbar_container))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
546 DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
547 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
548 DOM.insertAfter(p, n);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
549
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
550 Event.add(ed.id + '_path_row', 'click', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
551 e = e.target;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
552
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
553 if (e.nodeName == 'A') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
554 t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
555
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
556 return Event.cancel(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
557 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
558 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
559 /*
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
560 if (DOM.get(ed.id + '_path_row')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
561 Event.add(ed.id + '_tbl', 'mouseover', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
562 var re;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
563
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
564 e = e.target;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
565
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
566 if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
567 re = DOM.get(ed.id + '_path_row');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
568 t.lastPath = re.innerHTML;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
569 DOM.setHTML(re, e.parentNode.title);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
570 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
571 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
572
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
573 Event.add(ed.id + '_tbl', 'mouseout', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
574 if (t.lastPath) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
575 DOM.setHTML(ed.id + '_path_row', t.lastPath);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
576 t.lastPath = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
577 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
578 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
579 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
580 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
581
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
582 if (!ed.getParam('accessibility_focus'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
583 Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
584
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
585 if (s.theme_advanced_toolbar_location == 'external')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
586 o.deltaHeight = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
587
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
588 t.deltaHeight = o.deltaHeight;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
589 o.targetNode = null;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
590
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
591 ed.onKeyDown.add(function(ed, evt) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
592 var DOM_VK_F10 = 121, DOM_VK_F11 = 122;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
593
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
594 if (evt.altKey) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
595 if (evt.keyCode === DOM_VK_F10) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
596 // Make sure focus is given to toolbar in Safari.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
597 // We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
598 if (tinymce.isWebKit) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
599 window.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
600 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
601 t.toolbarGroup.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
602 return Event.cancel(evt);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
603 } else if (evt.keyCode === DOM_VK_F11) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
604 DOM.get(ed.id + '_path_row').focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
605 return Event.cancel(evt);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
606 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
607 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
608 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
609
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
610 // alt+0 is the UK recommended shortcut for accessing the list of access controls.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
611 ed.addShortcut('alt+0', '', 'mceShortcuts', t);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
612
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
613 return {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
614 iframeContainer : ic,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
615 editorContainer : ed.id + '_parent',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
616 sizeContainer : sc,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
617 deltaHeight : o.deltaHeight
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
618 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
619 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
620
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
621 getInfo : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
622 return {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
623 longname : 'Advanced theme',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
624 author : 'Moxiecode Systems AB',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
625 authorurl : 'http://tinymce.moxiecode.com',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
626 version : tinymce.majorVersion + "." + tinymce.minorVersion
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
627 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
628 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
629
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
630 resizeBy : function(dw, dh) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
631 var e = DOM.get(this.editor.id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
632
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
633 this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
634 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
635
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
636 resizeTo : function(w, h, store) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
637 var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
638
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
639 // Boundery fix box
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
640 w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
641 h = Math.max(s.theme_advanced_resizing_min_height || 100, h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
642 w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
643 h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
644
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
645 // Resize iframe and container
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
646 DOM.setStyle(e, 'height', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
647 DOM.setStyle(ifr, 'height', h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
648
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
649 if (s.theme_advanced_resize_horizontal) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
650 DOM.setStyle(e, 'width', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
651 DOM.setStyle(ifr, 'width', w);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
652
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
653 // Make sure that the size is never smaller than the over all ui
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
654 if (w < e.clientWidth) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
655 w = e.clientWidth;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
656 DOM.setStyle(ifr, 'width', e.clientWidth);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
657 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
658 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
659
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
660 // Store away the size
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
661 if (store && s.theme_advanced_resizing_use_cookie) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
662 Cookie.setHash("TinyMCE_" + ed.id + "_size", {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
663 cw : w,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
664 ch : h
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
665 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
666 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
667 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
668
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
669 destroy : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
670 var id = this.editor.id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
671
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
672 Event.clear(id + '_resize');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
673 Event.clear(id + '_path_row');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
674 Event.clear(id + '_external_close');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
675 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
676
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
677 // Internal functions
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
678
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
679 _simpleLayout : function(s, tb, o, p) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
680 var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
681
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
682 if (s.readonly) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
683 n = DOM.add(tb, 'tr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
684 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
685 return ic;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
686 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
687
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
688 // Create toolbar container at top
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
689 if (lo == 'top')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
690 t._addToolbars(tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
691
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
692 // Create external toolbar
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
693 if (lo == 'external') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
694 n = c = DOM.create('div', {style : 'position:relative'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
695 n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
696 DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
697 n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
698 etb = DOM.add(n, 'tbody');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
699
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
700 if (p.firstChild.className == 'mceOldBoxModel')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
701 p.firstChild.appendChild(c);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
702 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
703 p.insertBefore(c, p.firstChild);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
704
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
705 t._addToolbars(etb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
706
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
707 ed.onMouseUp.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
708 var e = DOM.get(ed.id + '_external');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
709 DOM.show(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
710
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
711 DOM.hide(lastExtID);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
712
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
713 var f = Event.add(ed.id + '_external_close', 'click', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
714 DOM.hide(ed.id + '_external');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
715 Event.remove(ed.id + '_external_close', 'click', f);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
716 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
717
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
718 DOM.show(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
719 DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
720
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
721 // Fixes IE rendering bug
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
722 DOM.hide(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
723 DOM.show(e);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
724 e.style.filter = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
725
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
726 lastExtID = ed.id + '_external';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
727
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
728 e = null;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
729 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
730 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
731
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
732 if (sl == 'top')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
733 t._addStatusBar(tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
734
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
735 // Create iframe container
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
736 if (!s.theme_advanced_toolbar_container) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
737 n = DOM.add(tb, 'tr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
738 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
739 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
740
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
741 // Create toolbar container at bottom
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
742 if (lo == 'bottom')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
743 t._addToolbars(tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
744
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
745 if (sl == 'bottom')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
746 t._addStatusBar(tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
747
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
748 return ic;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
749 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
750
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
751 _rowLayout : function(s, tb, o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
752 var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
753
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
754 dc = s.theme_advanced_containers_default_class || '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
755 da = s.theme_advanced_containers_default_align || 'center';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
756
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
757 each(explode(s.theme_advanced_containers || ''), function(c, i) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
758 var v = s['theme_advanced_container_' + c] || '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
759
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
760 switch (c.toLowerCase()) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
761 case 'mceeditor':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
762 n = DOM.add(tb, 'tr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
763 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
764 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
765
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
766 case 'mceelementpath':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
767 t._addStatusBar(tb, o);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
768 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
769
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
770 default:
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
771 a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
772 a = 'mce' + t._ufirst(a);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
773
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
774 n = DOM.add(DOM.add(tb, 'tr'), 'td', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
775 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
776 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
777
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
778 to = cf.createToolbar("toolbar" + i);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
779 t._addControls(v, to);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
780 DOM.setHTML(n, to.renderHTML());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
781 o.deltaHeight -= s.theme_advanced_row_height;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
782 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
783 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
784
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
785 return ic;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
786 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
787
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
788 _addControls : function(v, tb) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
789 var t = this, s = t.settings, di, cf = t.editor.controlManager;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
790
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
791 if (s.theme_advanced_disable && !t._disabled) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
792 di = {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
793
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
794 each(explode(s.theme_advanced_disable), function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
795 di[v] = 1;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
796 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
797
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
798 t._disabled = di;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
799 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
800 di = t._disabled;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
801
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
802 each(explode(v), function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
803 var c;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
804
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
805 if (di && di[n])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
806 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
807
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
808 // Compatiblity with 2.x
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
809 if (n == 'tablecontrols') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
810 each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
811 n = t.createControl(n, cf);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
812
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
813 if (n)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
814 tb.add(n);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
815 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
816
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
817 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
818 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
819
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
820 c = t.createControl(n, cf);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
821
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
822 if (c)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
823 tb.add(c);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
824 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
825 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
826
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
827 _addToolbars : function(c, o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
828 var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
829
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
830 toolbarGroup = cf.createToolbarGroup('toolbargroup', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
831 'name': ed.getLang('advanced.toolbar'),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
832 'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
833 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
834
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
835 t.toolbarGroup = toolbarGroup;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
836
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
837 a = s.theme_advanced_toolbar_align.toLowerCase();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
838 a = 'mce' + t._ufirst(a);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
839
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
840 n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
841
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
842 // Create toolbar and add the controls
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
843 for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
844 tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
845
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
846 if (s['theme_advanced_buttons' + i + '_add'])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
847 v += ',' + s['theme_advanced_buttons' + i + '_add'];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
848
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
849 if (s['theme_advanced_buttons' + i + '_add_before'])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
850 v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
851
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
852 t._addControls(v, tb);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
853 toolbarGroup.add(tb);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
854
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
855 o.deltaHeight -= s.theme_advanced_row_height;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
856 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
857 h.push(toolbarGroup.renderHTML());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
858 h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
859 DOM.setHTML(n, h.join(''));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
860 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
861
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
862 _addStatusBar : function(tb, o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
863 var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
864
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
865 n = DOM.add(tb, 'tr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
866 n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
867 n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
868 if (s.theme_advanced_path) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
869 DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
870 DOM.add(n, 'span', {}, ': ');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
871 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
872 DOM.add(n, 'span', {}, '&#160;');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
873 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
874
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
875
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
876 if (s.theme_advanced_resizing) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
877 DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
878
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
879 if (s.theme_advanced_resizing_use_cookie) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
880 ed.onPostRender.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
881 var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
882
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
883 if (!o)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
884 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
885
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
886 t.resizeTo(o.cw, o.ch);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
887 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
888 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
889
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
890 ed.onPostRender.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
891 Event.add(ed.id + '_resize', 'click', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
892 e.preventDefault();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
893 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
894
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
895 Event.add(ed.id + '_resize', 'mousedown', function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
896 var mouseMoveHandler1, mouseMoveHandler2,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
897 mouseUpHandler1, mouseUpHandler2,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
898 startX, startY, startWidth, startHeight, width, height, ifrElm;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
899
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
900 function resizeOnMove(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
901 e.preventDefault();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
902
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
903 width = startWidth + (e.screenX - startX);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
904 height = startHeight + (e.screenY - startY);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
905
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
906 t.resizeTo(width, height);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
907 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
908
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
909 function endResize(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
910 // Stop listening
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
911 Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
912 Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
913 Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
914 Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
915
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
916 width = startWidth + (e.screenX - startX);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
917 height = startHeight + (e.screenY - startY);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
918 t.resizeTo(width, height, true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
919 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
920
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
921 e.preventDefault();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
922
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
923 // Get the current rect size
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
924 startX = e.screenX;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
925 startY = e.screenY;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
926 ifrElm = DOM.get(t.editor.id + '_ifr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
927 startWidth = width = ifrElm.clientWidth;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
928 startHeight = height = ifrElm.clientHeight;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
929
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
930 // Register envent handlers
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
931 mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
932 mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
933 mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
934 mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
935 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
936 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
937 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
938
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
939 o.deltaHeight -= 21;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
940 n = tb = null;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
941 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
942
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
943 _updateUndoStatus : function(ed) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
944 var cm = ed.controlManager, um = ed.undoManager;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
945
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
946 cm.setDisabled('undo', !um.hasUndo() && !um.typing);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
947 cm.setDisabled('redo', !um.hasRedo());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
948 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
949
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
950 _nodeChanged : function(ed, cm, n, co, ob) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
951 var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
952
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
953 tinymce.each(t.stateControls, function(c) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
954 cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
955 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
956
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
957 function getParent(name) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
958 var i, parents = ob.parents, func = name;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
959
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
960 if (typeof(name) == 'string') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
961 func = function(node) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
962 return node.nodeName == name;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
963 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
964 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
965
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
966 for (i = 0; i < parents.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
967 if (func(parents[i]))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
968 return parents[i];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
969 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
970 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
971
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
972 cm.setActive('visualaid', ed.hasVisual);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
973 t._updateUndoStatus(ed);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
974 cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
975
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
976 p = getParent('A');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
977 if (c = cm.get('link')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
978 if (!p || !p.name) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
979 c.setDisabled(!p && co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
980 c.setActive(!!p);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
981 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
982 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
983
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
984 if (c = cm.get('unlink')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
985 c.setDisabled(!p && co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
986 c.setActive(!!p && !p.name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
987 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
988
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
989 if (c = cm.get('anchor')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
990 c.setActive(!co && !!p && p.name);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
991 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
992
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
993 p = getParent('IMG');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
994 if (c = cm.get('image'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
995 c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
996
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
997 if (c = cm.get('styleselect')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
998 t._importClasses();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
999
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1000 formatNames = [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1001 each(c.items, function(item) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1002 formatNames.push(item.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1003 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1004
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1005 matches = ed.formatter.matchAll(formatNames);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1006 c.select(matches[0]);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1007 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1008
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1009 if (c = cm.get('formatselect')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1010 p = getParent(DOM.isBlock);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1011
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1012 if (p)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1013 c.select(p.nodeName.toLowerCase());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1014 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1015
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1016 // Find out current fontSize, fontFamily and fontClass
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1017 getParent(function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1018 if (n.nodeName === 'SPAN') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1019 if (!cl && n.className)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1020 cl = n.className;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1021 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1022
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1023 if (ed.dom.is(n, s.theme_advanced_font_selector)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1024 if (!fz && n.style.fontSize)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1025 fz = n.style.fontSize;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1026
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1027 if (!fn && n.style.fontFamily)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1028 fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1029
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1030 if (!fc && n.style.color)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1031 fc = n.style.color;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1032
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1033 if (!bc && n.style.backgroundColor)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1034 bc = n.style.backgroundColor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1035 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1036
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1037 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1038 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1039
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1040 if (c = cm.get('fontselect')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1041 c.select(function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1042 return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1043 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1044 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1045
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1046 // Select font size
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1047 if (c = cm.get('fontsizeselect')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1048 // Use computed style
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1049 if (s.theme_advanced_runtime_fontsize && !fz && !cl)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1050 fz = ed.dom.getStyle(n, 'fontSize', true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1051
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1052 c.select(function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1053 if (v.fontSize && v.fontSize === fz)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1054 return true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1055
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1056 if (v['class'] && v['class'] === cl)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1057 return true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1058 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1059 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1060
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1061 if (s.theme_advanced_show_current_color) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1062 function updateColor(controlId, color) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1063 if (c = cm.get(controlId)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1064 if (!color)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1065 color = c.settings.default_color;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1066 if (color !== c.value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1067 c.displayColor(color);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1068 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1069 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1070 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1071 updateColor('forecolor', fc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1072 updateColor('backcolor', bc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1073 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1074
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1075 if (s.theme_advanced_show_current_color) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1076 function updateColor(controlId, color) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1077 if (c = cm.get(controlId)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1078 if (!color)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1079 color = c.settings.default_color;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1080 if (color !== c.value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1081 c.displayColor(color);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1082 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1083 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1084 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1085
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1086 updateColor('forecolor', fc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1087 updateColor('backcolor', bc);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1088 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1089
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1090 if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1091 p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1092
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1093 if (t.statusKeyboardNavigation) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1094 t.statusKeyboardNavigation.destroy();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1095 t.statusKeyboardNavigation = null;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1096 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1097
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1098 DOM.setHTML(p, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1099
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1100 getParent(function(n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1101 var na = n.nodeName.toLowerCase(), u, pi, ti = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1102
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1103 // Ignore non element and bogus/hidden elements
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1104 if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1105 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1106
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1107 // Handle prefix
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1108 if (tinymce.isIE && n.scopeName !== 'HTML')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1109 na = n.scopeName + ':' + na;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1110
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1111 // Remove internal prefix
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1112 na = na.replace(/mce\:/g, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1113
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1114 // Handle node name
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1115 switch (na) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1116 case 'b':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1117 na = 'strong';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1118 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1119
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1120 case 'i':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1121 na = 'em';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1122 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1123
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1124 case 'img':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1125 if (v = DOM.getAttrib(n, 'src'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1126 ti += 'src: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1127
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1128 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1129
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1130 case 'a':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1131 if (v = DOM.getAttrib(n, 'name')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1132 ti += 'name: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1133 na += '#' + v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1134 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1135
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1136 if (v = DOM.getAttrib(n, 'href'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1137 ti += 'href: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1138
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1139 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1140
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1141 case 'font':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1142 if (v = DOM.getAttrib(n, 'face'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1143 ti += 'font: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1144
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1145 if (v = DOM.getAttrib(n, 'size'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1146 ti += 'size: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1147
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1148 if (v = DOM.getAttrib(n, 'color'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1149 ti += 'color: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1150
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1151 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1152
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1153 case 'span':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1154 if (v = DOM.getAttrib(n, 'style'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1155 ti += 'style: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1156
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1157 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1158 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1159
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1160 if (v = DOM.getAttrib(n, 'id'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1161 ti += 'id: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1162
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1163 if (v = n.className) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1164 v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1165
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1166 if (v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1167 ti += 'class: ' + v + ' ';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1168
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1169 if (DOM.isBlock(n) || na == 'img' || na == 'span')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1170 na += '.' + v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1171 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1172 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1173
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1174 na = na.replace(/(html:)/g, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1175 na = {name : na, node : n, title : ti};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1176 t.onResolveName.dispatch(t, na);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1177 ti = na.title;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1178 na = na.name;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1179
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1180 //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1181 pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1182
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1183 if (p.hasChildNodes()) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1184 p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1185 p.insertBefore(pi, p.firstChild);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1186 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1187 p.appendChild(pi);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1188 }, ed.getBody());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1189
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1190 if (DOM.select('a', p).length > 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1191 t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1192 root: ed.id + "_path_row",
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1193 items: DOM.select('a', p),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1194 excludeFromTabOrder: true,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1195 onCancel: function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1196 ed.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1197 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1198 }, DOM);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1199 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1200 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1201 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1202
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1203 // Commands gets called by execCommand
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1204
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1205 _sel : function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1206 this.editor.execCommand('mceSelectNodeDepth', false, v);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1207 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1208
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1209 _mceInsertAnchor : function(ui, v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1210 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1211
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1212 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1213 url : this.url + '/anchor.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1214 width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1215 height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1216 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1217 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1218 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1219 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1220 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1221
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1222 _mceCharMap : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1223 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1224
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1225 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1226 url : this.url + '/charmap.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1227 width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1228 height : 260 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1229 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1230 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1231 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1232 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1233 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1234
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1235 _mceHelp : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1236 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1237
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1238 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1239 url : this.url + '/about.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1240 width : 480,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1241 height : 380,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1242 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1243 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1244 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1245 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1246 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1247
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1248 _mceShortcuts : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1249 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1250 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1251 url: this.url + '/shortcuts.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1252 width: 480,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1253 height: 380,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1254 inline: true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1255 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1256 theme_url: this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1257 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1258 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1259
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1260 _mceColorPicker : function(u, v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1261 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1262
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1263 v = v || {};
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1264
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1265 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1266 url : this.url + '/color_picker.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1267 width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1268 height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1269 close_previous : false,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1270 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1271 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1272 input_color : v.color,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1273 func : v.func,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1274 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1275 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1276 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1277
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1278 _mceCodeEditor : function(ui, val) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1279 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1280
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1281 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1282 url : this.url + '/source_editor.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1283 width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1284 height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1285 inline : true,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1286 resizable : true,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1287 maximizable : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1288 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1289 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1290 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1291 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1292
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1293 _mceImage : function(ui, val) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1294 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1295
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1296 // Internal image object like a flash placeholder
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1297 if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1298 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1299
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1300 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1301 url : this.url + '/image.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1302 width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1303 height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1304 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1305 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1306 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1307 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1308 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1309
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1310 _mceLink : function(ui, val) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1311 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1312
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1313 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1314 url : this.url + '/link.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1315 width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1316 height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1317 inline : true
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1318 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1319 theme_url : this.url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1320 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1321 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1322
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1323 _mceNewDocument : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1324 var ed = this.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1325
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1326 ed.windowManager.confirm('advanced.newdocument', function(s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1327 if (s)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1328 ed.execCommand('mceSetContent', false, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1329 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1330 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1331
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1332 _mceForeColor : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1333 var t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1334
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1335 this._mceColorPicker(0, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1336 color: t.fgColor,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1337 func : function(co) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1338 t.fgColor = co;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1339 t.editor.execCommand('ForeColor', false, co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1340 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1341 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1342 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1343
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1344 _mceBackColor : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1345 var t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1346
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1347 this._mceColorPicker(0, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1348 color: t.bgColor,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1349 func : function(co) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1350 t.bgColor = co;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1351 t.editor.execCommand('HiliteColor', false, co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1352 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1353 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1354 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1355
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1356 _ufirst : function(s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1357 return s.substring(0, 1).toUpperCase() + s.substring(1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1358 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1359 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1360
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1361 tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1362 }(tinymce));