comparison media/js/tiny_mce/themes/advanced/editor_template_src.js @ 247:6ed2932901fa

Update tinymce to 3.3.9
author Brian Neal <bgneal@gmail.com>
date Sat, 18 Sep 2010 19:54:11 +0000
parents 237710206167
children
comparison
equal deleted inserted replaced
246:e4dc0b649fcb 247:6ed2932901fa
123 ed.onInit.add(function() { 123 ed.onInit.add(function() {
124 if (!ed.settings.readonly) 124 if (!ed.settings.readonly)
125 ed.onNodeChange.add(t._nodeChanged, t); 125 ed.onNodeChange.add(t._nodeChanged, t);
126 126
127 if (ed.settings.content_css !== false) 127 if (ed.settings.content_css !== false)
128 ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); 128 ed.dom.loadCSS(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
129 }); 129 });
130 130
131 ed.onSetProgressState.add(function(ed, b, ti) { 131 ed.onSetProgressState.add(function(ed, b, ti) {
132 var co, id = ed.id, tb; 132 var co, id = ed.id, tb;
133 133
224 each(ctrl.items, function(item) { 224 each(ctrl.items, function(item) {
225 formatNames.push(item.value); 225 formatNames.push(item.value);
226 }); 226 });
227 227
228 ed.focus(); 228 ed.focus();
229 ed.undoManager.add();
229 230
230 // Toggle off the current format 231 // Toggle off the current format
231 matches = ed.formatter.matchAll(formatNames); 232 matches = ed.formatter.matchAll(formatNames);
232 if (matches[0] == name) 233 if (!name || matches[0] == name)
233 ed.formatter.remove(name); 234 ed.formatter.remove(matches[0]);
234 else 235 else
235 ed.formatter.apply(name); 236 ed.formatter.apply(name);
237
238 ed.undoManager.add();
239 ed.nodeChanged();
236 240
237 return false; // No auto select 241 return false; // No auto select
238 } 242 }
239 }); 243 });
240 244
294 var c, t = this, ed = t.editor; 298 var c, t = this, ed = t.editor;
295 299
296 c = ed.controlManager.createListBox('fontselect', { 300 c = ed.controlManager.createListBox('fontselect', {
297 title : 'advanced.fontdefault', 301 title : 'advanced.fontdefault',
298 onselect : function(v) { 302 onselect : function(v) {
303 var cur = c.items[c.selectedIndex];
304
305 if (!v && cur) {
306 ed.execCommand('FontName', false, cur.value);
307 return;
308 }
309
299 ed.execCommand('FontName', false, v); 310 ed.execCommand('FontName', false, v);
311
312 // Fake selection, execCommand will fire a nodeChange and update the selection
313 c.select(function(sv) {
314 return v == sv;
315 });
316
300 return false; // No auto select 317 return false; // No auto select
301 } 318 }
302 }); 319 });
303 320
304 if (c) { 321 if (c) {
312 329
313 _createFontSizeSelect : function() { 330 _createFontSizeSelect : function() {
314 var t = this, ed = t.editor, c, i = 0, cl = []; 331 var t = this, ed = t.editor, c, i = 0, cl = [];
315 332
316 c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) { 333 c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
334 var cur = c.items[c.selectedIndex];
335
336 if (!v && cur) {
337 cur = cur.value;
338
339 if (cur['class']) {
340 ed.formatter.toggle('fontsize_class', {value : cur['class']});
341 ed.undoManager.add();
342 ed.nodeChanged();
343 } else {
344 ed.execCommand('FontSize', false, cur.fontSize);
345 }
346
347 return;
348 }
349
317 if (v['class']) { 350 if (v['class']) {
318 ed.focus(); 351 ed.focus();
352 ed.undoManager.add();
319 ed.formatter.toggle('fontsize_class', {value : v['class']}); 353 ed.formatter.toggle('fontsize_class', {value : v['class']});
354 ed.undoManager.add();
355 ed.nodeChanged();
320 } else 356 } else
321 ed.execCommand('FontSize', false, v.fontSize); 357 ed.execCommand('FontSize', false, v.fontSize);
358
359 // Fake selection, execCommand will fire a nodeChange and update the selection
360 c.select(function(sv) {
361 return v == sv;
362 });
322 363
323 return false; // No auto select 364 return false; // No auto select
324 }}); 365 }});
325 366
326 if (c) { 367 if (c) {
1034 1075
1035 _mceInsertAnchor : function(ui, v) { 1076 _mceInsertAnchor : function(ui, v) {
1036 var ed = this.editor; 1077 var ed = this.editor;
1037 1078
1038 ed.windowManager.open({ 1079 ed.windowManager.open({
1039 url : tinymce.baseURL + '/themes/advanced/anchor.htm', 1080 url : this.url + '/anchor.htm',
1040 width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), 1081 width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
1041 height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), 1082 height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
1042 inline : true 1083 inline : true
1043 }, { 1084 }, {
1044 theme_url : this.url 1085 theme_url : this.url
1047 1088
1048 _mceCharMap : function() { 1089 _mceCharMap : function() {
1049 var ed = this.editor; 1090 var ed = this.editor;
1050 1091
1051 ed.windowManager.open({ 1092 ed.windowManager.open({
1052 url : tinymce.baseURL + '/themes/advanced/charmap.htm', 1093 url : this.url + '/charmap.htm',
1053 width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), 1094 width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
1054 height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), 1095 height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
1055 inline : true 1096 inline : true
1056 }, { 1097 }, {
1057 theme_url : this.url 1098 theme_url : this.url
1060 1101
1061 _mceHelp : function() { 1102 _mceHelp : function() {
1062 var ed = this.editor; 1103 var ed = this.editor;
1063 1104
1064 ed.windowManager.open({ 1105 ed.windowManager.open({
1065 url : tinymce.baseURL + '/themes/advanced/about.htm', 1106 url : this.url + '/about.htm',
1066 width : 480, 1107 width : 480,
1067 height : 380, 1108 height : 380,
1068 inline : true 1109 inline : true
1069 }, { 1110 }, {
1070 theme_url : this.url 1111 theme_url : this.url
1075 var ed = this.editor; 1116 var ed = this.editor;
1076 1117
1077 v = v || {}; 1118 v = v || {};
1078 1119
1079 ed.windowManager.open({ 1120 ed.windowManager.open({
1080 url : tinymce.baseURL + '/themes/advanced/color_picker.htm', 1121 url : this.url + '/color_picker.htm',
1081 width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), 1122 width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
1082 height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), 1123 height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
1083 close_previous : false, 1124 close_previous : false,
1084 inline : true 1125 inline : true
1085 }, { 1126 }, {
1091 1132
1092 _mceCodeEditor : function(ui, val) { 1133 _mceCodeEditor : function(ui, val) {
1093 var ed = this.editor; 1134 var ed = this.editor;
1094 1135
1095 ed.windowManager.open({ 1136 ed.windowManager.open({
1096 url : tinymce.baseURL + '/themes/advanced/source_editor.htm', 1137 url : this.url + '/source_editor.htm',
1097 width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), 1138 width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
1098 height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), 1139 height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
1099 inline : true, 1140 inline : true,
1100 resizable : true, 1141 resizable : true,
1101 maximizable : true 1142 maximizable : true
1110 // Internal image object like a flash placeholder 1151 // Internal image object like a flash placeholder
1111 if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) 1152 if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
1112 return; 1153 return;
1113 1154
1114 ed.windowManager.open({ 1155 ed.windowManager.open({
1115 url : tinymce.baseURL + '/themes/advanced/image.htm', 1156 url : this.url + '/image.htm',
1116 width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), 1157 width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
1117 height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), 1158 height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
1118 inline : true 1159 inline : true
1119 }, { 1160 }, {
1120 theme_url : this.url 1161 theme_url : this.url
1123 1164
1124 _mceLink : function(ui, val) { 1165 _mceLink : function(ui, val) {
1125 var ed = this.editor; 1166 var ed = this.editor;
1126 1167
1127 ed.windowManager.open({ 1168 ed.windowManager.open({
1128 url : tinymce.baseURL + '/themes/advanced/link.htm', 1169 url : this.url + '/link.htm',
1129 width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), 1170 width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
1130 height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), 1171 height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
1131 inline : true 1172 inline : true
1132 }, { 1173 }, {
1133 theme_url : this.url 1174 theme_url : this.url