Aucune description

TinyMCEAdmin.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. function CustomFileBrowser(field_name, url, type, win) {
  2. var cmsURL = '/admin/filebrowser/browse/?pop=2';
  3. cmsURL = cmsURL + '&type=' + type;
  4. tinyMCE.activeEditor.windowManager.open({
  5. file: cmsURL,
  6. width: 980, // Your dimensions may differ - toy around with them!
  7. height: 500,
  8. resizable: 'yes',
  9. scrollbars: 'yes',
  10. inline: 'no', // This parameter only has an effect if you use the inlinepopups plugin!
  11. close_previous: 'no'
  12. }, {
  13. window: win,
  14. input: field_name,
  15. editor_id: tinyMCE.selectedInstance.editorId
  16. });
  17. return false;
  18. }
  19. tinyMCE.init({
  20. // see
  21. // http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
  22. // Init
  23. mode: 'textareas',
  24. theme: 'advanced',
  25. skin: 'grappelli',
  26. // General
  27. //accessibility_warnings: false,
  28. browsers: 'gecko,msie,safari,opera',
  29. dialog_type: 'window',
  30. editor_deselector: 'mceNoEditor',
  31. keep_styles: false,
  32. language: 'en',
  33. object_resizing: false,
  34. media_strict: true,
  35. // Callbackss
  36. file_browser_callback: 'CustomFileBrowser',
  37. // Layout
  38. width: 758,
  39. height: 300,
  40. indentation: '10px',
  41. // Cleanup
  42. cleanup: true,
  43. cleanup_on_startup: true,
  44. element_format: 'xhtml',
  45. fix_list_elements: true,
  46. fix_table_elements: true,
  47. fix_nesting: true,
  48. forced_root_block : 'p',
  49. // URL
  50. relative_urls: false,
  51. remove_script_host: true,
  52. // Content CSS
  53. // content_css : "css/example.css",
  54. // Plugins
  55. plugins: 'advimage,advlink,fullscreen,paste,media,searchreplace,grappelli,grappelli_contextmenu,template',
  56. // Theme Advanced
  57. theme_advanced_toolbar_location: 'top',
  58. theme_advanced_toolbar_align: 'left',
  59. theme_advanced_statusbar_location: 'bottom',
  60. theme_advanced_buttons1: 'formatselect,styleselect,|,bold,italic,underline,|,bullist,numlist,blockquote,|,undo,redo,|,link,unlink,|,image,|,fullscreen,|,grappelli_adv',
  61. theme_advanced_buttons2: 'search,|,pasteword,template,media,charmap,|,code,|,table,cleanup,grappelli_documentstructure',
  62. theme_advanced_buttons3: '',
  63. theme_advanced_path: false,
  64. theme_advanced_blockformats: 'p,h2,h3,h4,pre',
  65. theme_advanced_resizing: true,
  66. theme_advanced_resize_horizontal: false,
  67. theme_advanced_resizing_use_cookie: true,
  68. theme_advanced_styles: 'Image Left=img_left;Image Right=img_right;Image Block=img_block',
  69. // Style formats
  70. // see http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/style_formats
  71. style_formats : [
  72. {title : 'Paragraph Small', block : 'p', classes: 'p_small'},
  73. {title : 'Paragraph ImageCaption', block : 'p', classes: 'p_caption'},
  74. {title : 'Clearfix', block : 'p', classes: 'clearfix'},
  75. {title : 'Code', block : 'p', classes: 'code'}
  76. ],
  77. // Templates
  78. // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template
  79. // please note that you need to add the URLs (src) to your url-patterns
  80. // with django.views.generic.simple.direct_to_template
  81. template_templates : [
  82. {
  83. title : '2 Columns',
  84. src : '/path/to/your/template/',
  85. description : '2 Columns.'
  86. },
  87. {
  88. title : '4 Columns',
  89. src : '/path/to/your/template/',
  90. description : '4 Columns.'
  91. }
  92. ],
  93. // Adv
  94. advlink_styles: 'Internal Link=internal;External Link=external',
  95. advimage_update_dimensions_onchange: true,
  96. // Grappelli
  97. grappelli_adv_hidden: false,
  98. grappelli_show_documentstructure: 'on'
  99. // Elements
  100. // valid_elements: '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|'
  101. // + 'onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|'
  102. // + 'onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|'
  103. // + 'name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,'
  104. // + '#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|'
  105. // + 'src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,'
  106. // + '-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|'
  107. // + 'height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|'
  108. // + 'height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,'
  109. // + '#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor'
  110. // + '|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,'
  111. // + '-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face'
  112. // + '|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],'
  113. // + 'object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width'
  114. // + '|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,'
  115. // + 'button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|'
  116. // + 'valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],'
  117. // + 'input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value],'
  118. // + 'kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],'
  119. // + 'q[cite],samp,select[disabled|multiple|name|size],small,'
  120. // + 'textarea[cols|rows|disabled|name|readonly],tt,var,big',
  121. // extended_valid_elements : 'embed[width|height|name|flashvars|src|bgcolor|align|play|'
  122. // + 'loop|quality|allowscriptaccess|type|pluginspage]'
  123. });