editor_template_src.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * editor_template_src.js
  3. *
  4. * Copyright 2009, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://tinymce.moxiecode.com/license
  8. * Contributing: http://tinymce.moxiecode.com/contributing
  9. */
  10. (function() {
  11. var DOM = tinymce.DOM;
  12. // Tell it to load theme specific language pack(s)
  13. tinymce.ThemeManager.requireLangPack('simple');
  14. tinymce.create('tinymce.themes.SimpleTheme', {
  15. init : function(ed, url) {
  16. var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;
  17. t.editor = ed;
  18. ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");
  19. ed.onInit.add(function() {
  20. ed.onNodeChange.add(function(ed, cm) {
  21. tinymce.each(states, function(c) {
  22. cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));
  23. });
  24. });
  25. });
  26. DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");
  27. },
  28. renderUI : function(o) {
  29. var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;
  30. n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);
  31. n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});
  32. n = tb = DOM.add(n, 'tbody');
  33. // Create iframe container
  34. n = DOM.add(tb, 'tr');
  35. n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});
  36. // Create toolbar container
  37. n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});
  38. // Create toolbar
  39. tb = t.toolbar = cf.createToolbar("tools1");
  40. tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));
  41. tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));
  42. tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));
  43. tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));
  44. tb.add(cf.createSeparator());
  45. tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));
  46. tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));
  47. tb.add(cf.createSeparator());
  48. tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));
  49. tb.add(cf.createSeparator());
  50. tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));
  51. tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));
  52. tb.renderTo(n);
  53. return {
  54. iframeContainer : ic,
  55. editorContainer : ed.id + '_container',
  56. sizeContainer : sc,
  57. deltaHeight : -20
  58. };
  59. },
  60. getInfo : function() {
  61. return {
  62. longname : 'Simple theme',
  63. author : 'Moxiecode Systems AB',
  64. authorurl : 'http://tinymce.moxiecode.com',
  65. version : tinymce.majorVersion + "." + tinymce.minorVersion
  66. }
  67. }
  68. });
  69. tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);
  70. })();