/public/assets/ckeditor/config-6728244dac0c5efcd52dd3415680536b746da4ebc863f0d7322891e465c36303.js

https://gitlab.com/slice-group/paraguana-mall-w · JavaScript · 131 lines · 85 code · 25 blank · 21 comment · 13 complexity · c16a73b98abf9b00fd8b426bfcfed123 MD5 · raw file

  1. /*
  2. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  3. For licensing, see LICENSE.html or http://ckeditor.com/license
  4. */
  5. CKEDITOR.editorConfig = function( config )
  6. {
  7. // Define changes to default configuration here. For example:
  8. // config.language = 'fr';
  9. // config.uiColor = '#AADC6E';
  10. /* Filebrowser routes */
  11. // The location of an external file browser, that should be launched when "Browse Server" button is pressed.
  12. config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
  13. // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
  14. config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
  15. // The location of a script that handles file uploads in the Flash dialog.
  16. config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
  17. // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
  18. config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
  19. // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
  20. config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
  21. // The location of a script that handles file uploads in the Image dialog.
  22. config.filebrowserImageUploadUrl = "/ckeditor/pictures";
  23. // The location of a script that handles file uploads.
  24. config.filebrowserUploadUrl = "/ckeditor/attachment_files";
  25. config.allowedContent = true;
  26. // Rails CSRF token
  27. config.filebrowserParams = function(){
  28. var csrf_token, csrf_param, meta,
  29. metas = document.getElementsByTagName('meta'),
  30. params = new Object();
  31. for ( var i = 0 ; i < metas.length ; i++ ){
  32. meta = metas[i];
  33. switch(meta.name) {
  34. case "csrf-token":
  35. csrf_token = meta.content;
  36. break;
  37. case "csrf-param":
  38. csrf_param = meta.content;
  39. break;
  40. default:
  41. continue;
  42. }
  43. }
  44. if (csrf_param !== undefined && csrf_token !== undefined) {
  45. params[csrf_param] = csrf_token;
  46. }
  47. return params;
  48. };
  49. config.addQueryString = function( url, params ){
  50. var queryString = [];
  51. if ( !params ) {
  52. return url;
  53. } else {
  54. for ( var i in params )
  55. queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
  56. }
  57. return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
  58. };
  59. // Integrate Rails CSRF token into file upload dialogs (link, image, attachment and flash)
  60. CKEDITOR.on( 'dialogDefinition', function( ev ){
  61. // Take the dialog name and its definition from the event data.
  62. var dialogName = ev.data.name;
  63. var dialogDefinition = ev.data.definition;
  64. var content, upload;
  65. if (CKEDITOR.tools.indexOf(['link', 'image', 'attachment', 'flash'], dialogName) > -1) {
  66. content = (dialogDefinition.getContents('Upload') || dialogDefinition.getContents('upload'));
  67. upload = (content == null ? null : content.get('upload'));
  68. if (upload && upload.filebrowser && upload.filebrowser['params'] === undefined) {
  69. upload.filebrowser['params'] = config.filebrowserParams();
  70. upload.action = config.addQueryString(upload.action, upload.filebrowser['params']);
  71. }
  72. }
  73. });
  74. // Toolbar groups configuration.
  75. config.toolbar = [
  76. { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source'] },
  77. { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
  78. // { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
  79. // { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
  80. { name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
  81. { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar' ] },
  82. { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
  83. '/',
  84. { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
  85. { name: 'colors', items: [ 'TextColor', 'BGColor', "Maximize" ] },
  86. { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] }
  87. ];
  88. config.toolbar_mini = [
  89. { name: 'document', items: [ 'Source', '-', 'Preview' ]},
  90. { name: 'clipboard', groups: [ 'undo' ], items: [ 'Undo', 'Redo' ] },
  91. { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
  92. { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
  93. { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] },
  94. { name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', "Maximize" ] },
  95. { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] }
  96. ];
  97. config.toolbar_short = [
  98. { name: 'document', items: [ 'Source', '-', 'Preview' ]},
  99. { name: 'clipboard', groups: [ 'undo' ], items: [ 'Undo', 'Redo' ] },
  100. { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
  101. { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
  102. { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] },
  103. { name: 'insert', items: [ 'HorizontalRule', "Maximize" ] },
  104. { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] }
  105. ];
  106. };