config_js.tpl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* Ckeditor global configuration file */
  2. CKEDITOR.editorConfig = function (config) {
  3. // Define changes to default configuration here.
  4. // For complete reference see:
  5. // http://docs.ckeditor.com/#!/api/CKEDITOR.config
  6. // Remove some buttons provided by the standard plugins, which are
  7. // not needed in the Standard(s) toolbar.
  8. //config.removeButtons = 'Underline,Subscript,Superscript';
  9. // Set the most common block elements.
  10. config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre';
  11. // Simplify the dialog windows.
  12. config.removeDialogTabs = 'image:advanced;link:advanced';
  13. config.templates_files = [
  14. '{{ _p.web_main ~ 'inc/lib/elfinder/templates.php'}}'
  15. ];
  16. //Style for default CKEditor Chamilo LMS
  17. config.stylesSet = [
  18. {
  19. name : 'Titre',
  20. element : 'h2',
  21. attributes : { 'class': 'ck ck-titre' }
  22. },
  23. {
  24. name : 'Parcours',
  25. element : 'h4',
  26. attributes : { 'class': 'ck ck-parcours' }
  27. },
  28. {
  29. name : 'Etape',
  30. element : 'h5',
  31. attributes : { 'class': 'ck ck-etape' }
  32. },
  33. {
  34. name : 'Texte',
  35. element : 'p',
  36. attributes : { 'class': 'ck ck-texte' }
  37. },
  38. {
  39. name : 'Source',
  40. element : 'p',
  41. attributes : { 'class': 'ck ck-source' }
  42. },
  43. {
  44. name : 'Consignes',
  45. element : 'p',
  46. attributes : { 'class': 'ck ck-consignes' }
  47. },
  48. {
  49. name : 'Title 1',
  50. element : 'h1',
  51. attributes : { 'class': 'ck ck-title' }
  52. },
  53. {
  54. name : 'Title 2',
  55. element : 'h2',
  56. attributes : { 'class': 'ck ck-title2' }
  57. },
  58. {
  59. name : 'Alert Success',
  60. element : 'div',
  61. attributes : { 'class': 'alert alert-success' }
  62. },
  63. {
  64. name : 'Alert Info',
  65. element : 'div',
  66. attributes : { 'class': 'alert alert-info' }
  67. },
  68. {
  69. name : 'Alert Warning',
  70. element : 'div',
  71. attributes : { 'class': 'alert alert-warning' }
  72. },
  73. {
  74. name : 'Alert Danger',
  75. element : 'div',
  76. attributes : { 'class': 'alert alert-danger' }
  77. },
  78. {
  79. name : 'Section Article' ,
  80. element : 'h3' ,
  81. attributes : { 'class': 'ck ck-article' }
  82. }, {
  83. name : 'Paragraph box' ,
  84. element : 'p' ,
  85. attributes: { 'class': 'ck-paragraph-box' }
  86. }, {
  87. name : 'Superscript' ,
  88. element : 'sup'
  89. },
  90. {
  91. name : 'Subscript' ,
  92. element : 'sub'
  93. },
  94. {
  95. name : 'Strikethrough' ,
  96. element : 'del'
  97. },
  98. {
  99. name : 'Underlined' ,
  100. element : 'ins'
  101. },
  102. {
  103. name : 'Stand Out' ,
  104. element : 'span',
  105. attributes: { 'class':'ck-stand-out'}
  106. },
  107. {
  108. name : 'Separate Style 1' ,
  109. element : 'hr',
  110. attributes: { 'class':'ck-style1'}
  111. },
  112. {
  113. name : 'Separate Style 2' ,
  114. element : 'hr',
  115. attributes: { 'class':'ck-style2'}
  116. },
  117. {
  118. name : 'Separate Style 3' ,
  119. element : 'hr',
  120. attributes: { 'class':'ck-style3'}
  121. }
  122. ];
  123. {% if moreButtonsInMaximizedMode %}
  124. config.toolbar = 'minToolbar';
  125. config.smallToolbar = 'minToolbar';
  126. config.maximizedToolbar = 'maxToolbar';
  127. {% endif %}
  128. // File manager (elFinder)
  129. config.filebrowserBrowseUrl = '{{ _p.web_lib ~ 'elfinder/filemanager.php?' }}{{ course_condition }}';
  130. config.videobrowserBrowseUrl = '{{ _p.web_lib ~ 'elfinder/filemanager.php?' }}{{ course_condition }}';
  131. config.enterMode = CKEDITOR.ENTER_BR;
  132. // Allows to use "class" attribute inside divs and spans.
  133. config.allowedContent = true;
  134. // Option to set the "styles" menu
  135. config.contentsCss = [
  136. '{{ bootstrap_css }}',
  137. '{{ font_awesome_css }}',
  138. '{{ css_editor }}',
  139. ];
  140. config.language_list = ['{{ language_list }}'];
  141. config.qMarkersRollsUrl = '{{ _p.web_ajax }}exercise.ajax.php?a=get_quiz_embeddable';
  142. };
  143. // Sets default target to "_blank" in link plugin
  144. CKEDITOR.on('dialogDefinition', function (ev) {
  145. if (ev.data.name == 'link'){
  146. ev.data.definition.getContents('target').get('linkTargetType')['default']='_blank';
  147. }
  148. });