@ckeditor/ckeditor5-ckfinder 40.1.0 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,31 +5,31 @@ All changes in the package are documented in the main repository. See: https://g
5
5
 
6
6
  Changes for the past releases are available below.
7
7
 
8
- ## [19.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v18.0.0...v19.0.0) (2020-04-29)
8
+ ## [19.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v18.0.0...v19.0.0) (April 29, 2020)
9
9
 
10
10
  Internal changes only (updated dependencies, documentation, etc.).
11
11
 
12
12
 
13
- ## [18.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v17.0.0...v18.0.0) (2020-03-19)
13
+ ## [18.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v17.0.0...v18.0.0) (March 19, 2020)
14
14
 
15
15
  Internal changes only (updated dependencies, documentation, etc.).
16
16
 
17
17
 
18
- ## [17.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v16.0.0...v17.0.0) (2020-02-19)
18
+ ## [17.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v16.0.0...v17.0.0) (February 19, 2020)
19
19
 
20
20
  ### Other changes
21
21
 
22
22
  * Updated translations. ([2660bf3](https://github.com/ckeditor/ckeditor5-ckfinder/commit/2660bf3))
23
23
 
24
24
 
25
- ## [16.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v15.0.0...v16.0.0) (2019-12-04)
25
+ ## [16.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v15.0.0...v16.0.0) (December 4, 2019)
26
26
 
27
27
  ### Other changes
28
28
 
29
29
  * Updated translations. ([ff9da0b](https://github.com/ckeditor/ckeditor5-ckfinder/commit/ff9da0b))
30
30
 
31
31
 
32
- ## [15.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.5...v15.0.0) (2019-10-23)
32
+ ## [15.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.5...v15.0.0) (October 23, 2019)
33
33
 
34
34
  ### Bug fixes
35
35
 
@@ -40,7 +40,7 @@ Internal changes only (updated dependencies, documentation, etc.).
40
40
  * Updated translations. ([8e44572](https://github.com/ckeditor/ckeditor5-ckfinder/commit/8e44572))
41
41
 
42
42
 
43
- ## [11.0.5](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.4...v11.0.5) (2019-08-26)
43
+ ## [11.0.5](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.4...v11.0.5) (August 26, 2019)
44
44
 
45
45
  ### Bug fixes
46
46
 
@@ -52,26 +52,26 @@ Internal changes only (updated dependencies, documentation, etc.).
52
52
  * Updated translations. ([3c3e350](https://github.com/ckeditor/ckeditor5-ckfinder/commit/3c3e350))
53
53
 
54
54
 
55
- ## [11.0.4](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.3...v11.0.4) (2019-07-10)
55
+ ## [11.0.4](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.3...v11.0.4) (July 10, 2019)
56
56
 
57
57
  Internal changes only (updated dependencies, documentation, etc.).
58
58
 
59
59
 
60
- ## [11.0.3](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.2...v11.0.3) (2019-07-04)
60
+ ## [11.0.3](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.2...v11.0.3) (July 4, 2019)
61
61
 
62
62
  ### Other changes
63
63
 
64
64
  * Updated translations. ([e681af2](https://github.com/ckeditor/ckeditor5-ckfinder/commit/e681af2))
65
65
 
66
66
 
67
- ## [11.0.2](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.1...v11.0.2) (2019-06-05)
67
+ ## [11.0.2](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.1...v11.0.2) (June 6, 2019)
68
68
 
69
69
  ### Other changes
70
70
 
71
71
  * Updated translations. ([27f6f8b](https://github.com/ckeditor/ckeditor5-ckfinder/commit/27f6f8b))
72
72
 
73
73
 
74
- ## [11.0.1](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.0...v11.0.1) (2019-04-10)
74
+ ## [11.0.1](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v11.0.0...v11.0.1) (April 4, 2019)
75
75
 
76
76
  ### Other changes
77
77
 
@@ -79,7 +79,7 @@ Internal changes only (updated dependencies, documentation, etc.).
79
79
  * Updated translations. ([5b26349](https://github.com/ckeditor/ckeditor5-ckfinder/commit/5b26349))
80
80
 
81
81
 
82
- ## [11.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v10.0.0...v11.0.0) (2019-02-28)
82
+ ## [11.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/compare/v10.0.0...v11.0.0) (February 28, 2019)
83
83
 
84
84
  ### Other changes
85
85
 
@@ -90,6 +90,6 @@ Internal changes only (updated dependencies, documentation, etc.).
90
90
  * Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
91
91
 
92
92
 
93
- ## [10.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/tree/v10.0.0) (2018-12-05)
93
+ ## [10.0.0](https://github.com/ckeditor/ckeditor5-ckfinder/tree/v10.0.0) (December 5, 2018)
94
94
 
95
95
  Initial implementation of the CKFinder file manager integration feature.
package/build/ckfinder.js CHANGED
@@ -1,5 +1,5 @@
1
- !function(e){const i=e.en=e.en||{};i.dictionary=Object.assign(i.dictionary||{},{"Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.","Insert image or file":"Insert image or file","Inserting image failed":"Inserting image failed","Selecting resized image failed":"Selecting resized image failed"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
1
+ !function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.","Insert image or file":"Insert image or file","Inserting image failed":"Inserting image failed","Selecting resized image failed":"Selecting resized image failed"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
2
2
  /*!
3
3
  * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
- */(()=>{var e={704:(e,i,t)=>{e.exports=t(79)("./src/core.js")},273:(e,i,t)=>{e.exports=t(79)("./src/ui.js")},209:(e,i,t)=>{e.exports=t(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},i={};function t(n){var o=i[n];if(void 0!==o)return o.exports;var r=i[n]={exports:{}};return e[n](r,r.exports,t),r.exports}t.d=(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},t.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";t.r(n),t.d(n,{CKFinder:()=>c,CKFinderEditing:()=>d,CKFinderUI:()=>o});var e=t(704),i=t(273);class o extends e.Plugin{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,t=e.ui.componentFactory,n=e.t;t.add("ckfinder",(t=>{const o=e.commands.get("ckfinder"),r=new i.ButtonView(t);return r.set({label:n("Insert image or file"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',tooltip:!0}),r.bind("isEnabled").to(o),r.on("execute",(()=>{e.execute("ckfinder"),e.editing.view.focus()})),r}))}}var r=t(209);class s extends e.Command{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const e=this.editor.commands.get("insertImage"),i=this.editor.commands.get("link");this.isEnabled=e.isEnabled||i.isEnabled}execute(){const e=this.editor,i=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=i&&"modal"!=i)throw new r.CKEditorError("ckfinder-unknown-openermethod",e);const t=this.editor.config.get("ckfinder.options")||{};t.chooseFiles=!0;const n=t.onInit;t.language||(t.language=e.locale.uiLanguage),t.onInit=i=>{n&&n(i),i.on("files:choose",(t=>{const n=t.data.files.toArray(),o=n.filter((e=>!e.isImage())),r=n.filter((e=>e.isImage()));for(const i of o)e.execute("link",i.getUrl());const s=[];for(const e of r){const t=e.getUrl();s.push(t||i.request("file:getProxyUrl",{file:e}))}s.length&&a(e,s)})),i.on("file:choose:resizedImage",(i=>{const t=i.data.resizedUrl;if(t)a(e,[t]);else{const i=e.plugins.get("Notification"),t=e.locale.t;i.showWarning(t("Could not obtain resized image URL."),{title:t("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[i](t)}}function a(e,i){if(e.commands.get("insertImage").isEnabled)e.execute("insertImage",{source:i});else{const i=e.plugins.get("Notification"),t=e.locale.t;i.showWarning(t("Could not insert image at the current position."),{title:t("Inserting image failed"),namespace:"ckfinder"})}}class d extends e.Plugin{static get pluginName(){return"CKFinderEditing"}static get requires(){return[i.Notification,"LinkEditing"]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new r.CKEditorError("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new s(e))}}class c extends e.Plugin{static get pluginName(){return"CKFinder"}static get requires(){return["Link","CKFinderUploadAdapter",d,o]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckfinder=n})();
5
+ */(()=>{var e={704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{CKFinder:()=>c,CKFinderEditing:()=>d,CKFinderUI:()=>o});var e=i(704),t=i(273);class o extends e.Plugin{static get pluginName(){return"CKFinderUI"}init(){const i=this.editor,n=i.ui.componentFactory,o=i.t;if(n.add("ckfinder",(e=>{const n=i.commands.get("ckfinder"),r=new t.ButtonView(e);return r.set({label:o("Insert image or file"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',tooltip:!0}),r.bind("isEnabled").to(n),r.on("execute",(()=>{i.execute("ckfinder"),i.editing.view.focus()})),r})),i.plugins.has("ImageInsertUI")){const t=i.plugins.get("ImageInsertUI"),n=i.commands.get("ckfinder");t.registerIntegration({name:"assetManager",observable:n,buttonViewCreator:()=>{const i=this.editor.ui.componentFactory.create("ckfinder");return i.icon=e.icons.imageAssetManager,i.bind("label").to(t,"isImageSelected",(e=>o(e?"Replace image with file manager":"Insert image with file manager"))),i},formViewCreator:()=>{const i=this.editor.ui.componentFactory.create("ckfinder");return i.icon=e.icons.imageAssetManager,i.withText=!0,i.bind("label").to(t,"isImageSelected",(e=>o(e?"Replace with file manager":"Insert with file manager"))),i.on("execute",(()=>{t.dropdownView.isOpen=!1})),i}})}}}var r=i(209);class s extends e.Command{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",(()=>this.refresh()),{priority:"low"})}refresh(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=t&&"modal"!=t)throw new r.CKEditorError("ckfinder-unknown-openermethod",e);const i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=!0;const n=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=t=>{n&&n(t),t.on("files:choose",(i=>{const n=i.data.files.toArray(),o=n.filter((e=>!e.isImage())),r=n.filter((e=>e.isImage()));for(const t of o)e.execute("link",t.getUrl());const s=[];for(const e of r){const i=e.getUrl();s.push(i||t.request("file:getProxyUrl",{file:e}))}s.length&&a(e,s)})),t.on("file:choose:resizedImage",(t=>{const i=t.data.resizedUrl;if(i)a(e,[i]);else{const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("Could not obtain resized image URL."),{title:i("Selecting resized image failed"),namespace:"ckfinder"})}}))},window.CKFinder[t](i)}}function a(e,t){if(e.commands.get("insertImage").isEnabled)e.execute("insertImage",{source:t});else{const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("Could not insert image at the current position."),{title:i("Inserting image failed"),namespace:"ckfinder"})}}class d extends e.Plugin{static get pluginName(){return"CKFinderEditing"}static get requires(){return[t.Notification,"LinkEditing"]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new r.CKEditorError("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new s(e))}}class c extends e.Plugin{static get pluginName(){return"CKFinder"}static get requires(){return["Link","CKFinderUploadAdapter",d,o]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckfinder=n})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ckfinder",
3
- "version": "40.1.0",
3
+ "version": "40.2.0",
4
4
  "description": "CKFinder integration for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "40.1.0"
15
+ "ckeditor5": "40.2.0"
16
16
  },
17
17
  "author": "CKSource (http://cksource.com/)",
18
18
  "license": "GPL-2.0-or-later",
package/src/ckfinderui.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module ckfinder/ckfinderui
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core';
8
+ import { icons, Plugin } from 'ckeditor5/src/core';
9
9
  import { ButtonView } from 'ckeditor5/src/ui';
10
10
  import browseFilesIcon from '../theme/icons/browse-files.svg';
11
11
  /**
@@ -40,5 +40,33 @@ export default class CKFinderUI extends Plugin {
40
40
  });
41
41
  return button;
42
42
  });
43
+ if (editor.plugins.has('ImageInsertUI')) {
44
+ const imageInsertUI = editor.plugins.get('ImageInsertUI');
45
+ const command = editor.commands.get('ckfinder');
46
+ imageInsertUI.registerIntegration({
47
+ name: 'assetManager',
48
+ observable: command,
49
+ buttonViewCreator: () => {
50
+ const button = this.editor.ui.componentFactory.create('ckfinder');
51
+ button.icon = icons.imageAssetManager;
52
+ button.bind('label').to(imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ?
53
+ t('Replace image with file manager') :
54
+ t('Insert image with file manager'));
55
+ return button;
56
+ },
57
+ formViewCreator: () => {
58
+ const button = this.editor.ui.componentFactory.create('ckfinder');
59
+ button.icon = icons.imageAssetManager;
60
+ button.withText = true;
61
+ button.bind('label').to(imageInsertUI, 'isImageSelected', isImageSelected => isImageSelected ?
62
+ t('Replace with file manager') :
63
+ t('Insert with file manager'));
64
+ button.on('execute', () => {
65
+ imageInsertUI.dropdownView.isOpen = false;
66
+ });
67
+ return button;
68
+ }
69
+ });
70
+ }
43
71
  }
44
72
  }