imageinsert.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 image/imageinsert
  7. */
  8. import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  9. import ImageUpload from './imageupload';
  10. import ImageInsertUI from './imageinsert/imageinsertui';
  11. /**
  12. * The image insert plugin.
  13. *
  14. * For a detailed overview, check the {@glink features/image-upload/image-upload Image upload feature}
  15. * and {@glink features/image#inserting-images-via-source-url Insert images via source URL} documentation.
  16. *
  17. * This plugin does not do anything directly, but it loads a set of specific plugins
  18. * to enable image uploading or inserting via implemented integrations:
  19. *
  20. * * {@link module:image/imageupload~ImageUpload}
  21. * * {@link module:image/imageinsert/imageinsertui~ImageInsertUI},
  22. *
  23. * @extends module:core/plugin~Plugin
  24. */
  25. export default class ImageInsert extends Plugin {
  26. /**
  27. * @inheritDoc
  28. */
  29. static get pluginName() {
  30. return 'ImageInsert';
  31. }
  32. /**
  33. * @inheritDoc
  34. */
  35. static get requires() {
  36. return [ ImageUpload, ImageInsertUI ];
  37. }
  38. }
  39. /**
  40. * The image insert configuration.
  41. *
  42. * @protected
  43. * @member {module:image/imageinsert~ImageInsertConfig} module:image/image~ImageConfig#insert
  44. */
  45. /**
  46. * The configuration of the image insert dropdown panel view. Used by the image insert feature in the `@ckeditor/ckeditor5-image` package.
  47. *
  48. * ClassicEditor
  49. * .create( editorElement, {
  50. * image: {
  51. * insert: {
  52. * ... // settings for "imageInsert" view goes here
  53. * }
  54. * }
  55. * } )
  56. * .then( ... )
  57. * .catch( ... );
  58. *
  59. * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  60. *
  61. * @protected
  62. * @interface module:image/imageinsert~ImageInsertConfig
  63. */
  64. /**
  65. * The image insert panel view configuration contains a list of {@link module:image/imageinsert~ImageInsert} integrations.
  66. *
  67. * The option accepts string tokens.
  68. * * for predefined integrations, we have two special strings: `insertImageViaUrl` and `openCKFinder`.
  69. * The former adds the **Insert image via URL** feature, while the latter adds the built-in **CKFinder** integration.
  70. * * for custom integrations, each string should be a name of the component registered in the
  71. * {@link module:ui/componentfactory~ComponentFactory component factory}.
  72. * If you have a plugin `PluginX` that registers `pluginXButton` component, then the integration token
  73. * in that case should be `pluginXButton`.
  74. *
  75. * // Add `insertImageViaUrl`, `openCKFinder` and custom `pluginXButton` integrations.
  76. * const imageInsertConfig = {
  77. * insert: {
  78. * integrations: [
  79. * 'insertImageViaUrl',
  80. * 'openCKFinder',
  81. * 'pluginXButton'
  82. * ]
  83. * }
  84. * };
  85. *
  86. * @member {Array.<String>} module:image/imageinsert~ImageInsertConfig#integrations
  87. * @default [ 'insertImageViaUrl' ]
  88. */