ckfinder.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /**
  6. * @module ckfinder/ckfinder
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import CKFinderUI from './ckfinderui';
  10. import CKFinderEditing from './ckfinderediting';
  11. import CKFinderUploadAdapter from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter';
  12. /**
  13. * The CKFinder feature, a bridge between the CKEditor 5 WYSIWYG editor and the
  14. * [CKFinder](https://ckeditor.com/ckfinder) file manager and uploader.
  15. *
  16. * This is a "glue" plugin which enables:
  17. *
  18. * * {@link module:ckfinder/ckfinderediting~CKFinderEditing},
  19. * * {@link module:ckfinder/ckfinderui~CKFinderUI},
  20. * * {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter}.
  21. *
  22. * See the {@glink features/image-upload/ckfinder "CKFinder integration" guide} to learn how to configure
  23. * and use this feature.
  24. *
  25. * Check out the {@glink features/image-upload/image-upload comprehensive "Image upload" guide} to learn about
  26. * other ways to upload images into CKEditor 5.
  27. *
  28. * @extends module:core/plugin~Plugin
  29. */
  30. export default class CKFinder extends Plugin {
  31. /**
  32. * @inheritDoc
  33. */
  34. static get pluginName() {
  35. return 'CKFinder';
  36. }
  37. /**
  38. * @inheritDoc
  39. */
  40. static get requires() {
  41. return [ CKFinderEditing, CKFinderUI, CKFinderUploadAdapter ];
  42. }
  43. }
  44. /**
  45. * The configuration of the {@link module:ckfinder/ckfinder~CKFinder CKFinder feature}.
  46. *
  47. * Read more in {@link module:ckfinder/ckfinder~CKFinderConfig}.
  48. *
  49. * @member {module:ckfinder/ckfinder~CKFinderConfig} module:core/editor/editorconfig~EditorConfig#ckfinder
  50. */
  51. /**
  52. * The configuration of the {@link module:ckfinder/ckfinder~CKFinder CKFinder feature}
  53. * and its {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter upload adapter}.
  54. *
  55. * ClassicEditor
  56. * .create( editorElement, {
  57. * ckfinder: {
  58. * options: {
  59. * resourceType: 'Images'
  60. * }
  61. * }
  62. * } )
  63. * .then( ... )
  64. * .catch( ... );
  65. *
  66. * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  67. *
  68. * @interface CKFinderConfig
  69. */
  70. /**
  71. * The configuration options passed to the CKFinder file manager instance.
  72. *
  73. * Check the file manager [documentation](https://ckeditor.com/docs/ckfinder/ckfinder3/#!/api/CKFinder.Config-cfg-language)
  74. * for the complete list of options.
  75. *
  76. * @member {Object} module:ckfinder/ckfinder~CKFinderConfig#options
  77. */
  78. /**
  79. * The type of the CKFinder opener method.
  80. *
  81. * Supported types are:
  82. *
  83. * * `'modal'` – Opens CKFinder in a modal,
  84. * * `'popup'` – Opens CKFinder in a new "pop-up" window.
  85. *
  86. * Defaults to `'modal'`.
  87. *
  88. * @member {String} module:ckfinder/ckfinder~CKFinderConfig#openerMethod
  89. */
  90. /**
  91. * The path (URL) to the connector which handles the file upload in CKFinder file manager.
  92. * When specified, it enables the automatic upload of resources such as images inserted into the content.
  93. *
  94. * For instance, to use CKFinder's
  95. * [quick upload](https://ckeditor.com/docs/ckfinder/ckfinder3-php/commands.html#command_quick_upload)
  96. * command, your can use the following (or similar) path:
  97. *
  98. * ClassicEditor
  99. * .create( editorElement, {
  100. * ckfinder: {
  101. * uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'
  102. * }
  103. * } )
  104. * .then( ... )
  105. * .catch( ... );
  106. *
  107. * Used by the {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter upload adapter}.
  108. *
  109. * @member {String} module:ckfinder/ckfinder~CKFinderConfig#uploadUrl
  110. */