@ckeditor/ckeditor5-ckbox 0.0.0-nightly-20230829.0 → 0.0.0-nightly-20230831.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/build/ckbox.js +1 -1
  2. package/build/translations/fa.js +1 -1
  3. package/build/translations/gl.js +1 -1
  4. package/lang/translations/ar.po +1 -0
  5. package/lang/translations/az.po +1 -0
  6. package/lang/translations/bg.po +1 -0
  7. package/lang/translations/bn.po +1 -0
  8. package/lang/translations/ca.po +1 -0
  9. package/lang/translations/cs.po +1 -0
  10. package/lang/translations/da.po +1 -0
  11. package/lang/translations/de.po +1 -0
  12. package/lang/translations/el.po +1 -0
  13. package/lang/translations/en-au.po +1 -0
  14. package/lang/translations/en.po +1 -0
  15. package/lang/translations/es-co.po +1 -0
  16. package/lang/translations/es.po +1 -0
  17. package/lang/translations/et.po +1 -0
  18. package/lang/translations/fa.po +2 -1
  19. package/lang/translations/fi.po +1 -0
  20. package/lang/translations/fr.po +1 -0
  21. package/lang/translations/gl.po +3 -2
  22. package/lang/translations/he.po +1 -0
  23. package/lang/translations/hi.po +1 -0
  24. package/lang/translations/hr.po +1 -0
  25. package/lang/translations/hu.po +1 -0
  26. package/lang/translations/id.po +1 -0
  27. package/lang/translations/it.po +1 -0
  28. package/lang/translations/ja.po +1 -0
  29. package/lang/translations/ko.po +1 -0
  30. package/lang/translations/lt.po +1 -0
  31. package/lang/translations/lv.po +1 -0
  32. package/lang/translations/ms.po +1 -0
  33. package/lang/translations/nl.po +1 -0
  34. package/lang/translations/no.po +1 -0
  35. package/lang/translations/pl.po +1 -0
  36. package/lang/translations/pt-br.po +1 -0
  37. package/lang/translations/pt.po +1 -0
  38. package/lang/translations/ro.po +1 -0
  39. package/lang/translations/ru.po +1 -0
  40. package/lang/translations/sk.po +1 -0
  41. package/lang/translations/sq.po +1 -0
  42. package/lang/translations/sr-latn.po +1 -0
  43. package/lang/translations/sr.po +1 -0
  44. package/lang/translations/sv.po +1 -0
  45. package/lang/translations/th.po +1 -0
  46. package/lang/translations/tr.po +1 -0
  47. package/lang/translations/ug.po +1 -0
  48. package/lang/translations/uk.po +1 -0
  49. package/lang/translations/ur.po +1 -0
  50. package/lang/translations/uz.po +1 -0
  51. package/lang/translations/vi.po +1 -0
  52. package/lang/translations/zh-cn.po +1 -0
  53. package/lang/translations/zh.po +1 -0
  54. package/package.json +2 -2
  55. package/src/ckboxcommand.js +31 -0
package/build/ckbox.js CHANGED
@@ -2,4 +2,4 @@
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,t,i)=>{e.exports=i(79)("./src/core.js")},492:(e,t,i)=>{e.exports=i(79)("./src/engine.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},448:(e,t,i)=>{e.exports=i(79)("./src/upload.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(o){var n=t[o];if(void 0!==n)return n.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};(()=>{"use strict";i.r(o),i.d(o,{CKBox:()=>x,CKBoxEditing:()=>b,CKBoxUI:()=>n});var e=i(704),t=i(273);class n extends e.Plugin{static get pluginName(){return"CKBoxUI"}afterInit(){const e=this.editor,i=e.commands.get("ckbox");if(!i)return;const o=e.t;e.ui.componentFactory.add("ckbox",(n=>{const r=new t.ButtonView(n);return r.set({label:o("Open file manager"),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("isOn","isEnabled").to(i,"value","isEnabled"),r.on("execute",(()=>{e.execute("ckbox")})),r}))}}var r=i(492),s=i(209);function a(e){const t=[];let i=0;for(const o in e){const n=parseInt(o,10);isNaN(n)||(n>i&&(i=n),t.push(`${e[o]} ${o}w`))}const o=[{srcset:t.join(","),sizes:`(max-width: ${i}px) 100vw, ${i}px`,type:"image/webp"}];return{imageFallbackUrl:e.default,imageSources:o}}class c extends e.Command{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return null!==this._wrapper}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox");return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,dialog:{onClose:()=>this.fire("ckbox:close")},assets:{onChoose:e=>this.fire("ckbox:choose",e)}}}_initListeners(){const e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId");this.on("ckbox",(()=>{this.refresh()}),{priority:"low"}),this.on("ckbox:open",(()=>{this.isEnabled&&!this.value&&(this._wrapper=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))})),this.on("ckbox:close",(()=>{this.value&&(this._wrapper.remove(),this._wrapper=null)})),this.on("ckbox:choose",((o,n)=>{if(!this.isEnabled)return;const r=e.commands.get("insertImage"),s=e.commands.get("link"),a=function({assets:e,isImageAllowed:t,isLinkAllowed:i}){return e.map((e=>function(e){const t=e.data.metadata;if(!t)return!1;return t.width&&t.height}(e)?{id:e.data.id,type:"image",attributes:l(e)}:{id:e.data.id,type:"link",attributes:d(e)})).filter((e=>"image"===e.type?t:i))}({assets:n,isImageAllowed:r.isEnabled,isLinkAllowed:s.isEnabled});0!==a.length&&t.change((e=>{for(const t of a){const o=t===a[a.length-1];this._insertAsset(t,o,e),i&&(setTimeout((()=>this._chosenAssets.delete(t)),1e3),this._chosenAssets.add(t))}}))})),this.listenTo(e,"destroy",(()=>{this.fire("ckbox:close"),this._chosenAssets.clear()}))}_insertAsset(e,t,i){const o=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),"image"===e.type?this._insertImage(e):this._insertLink(e,i),t||i.setSelection(o.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:i,imageSources:o,imageTextAlternative:n}=e.attributes;t.execute("insertImage",{source:{src:i,sources:o,alt:n}})}_insertLink(e,t){const i=this.editor,o=i.model,n=o.document.selection,{linkName:r,linkHref:a}=e.attributes;if(n.isCollapsed){const e=(0,s.toMap)(n.getAttributes()),i=t.createText(r,e),a=o.insertContent(i);t.setSelection(a)}i.execute("link",a)}}function l(e){const{imageFallbackUrl:t,imageSources:i}=a(e.data.imageUrls);return{imageFallbackUrl:t,imageSources:i,imageTextAlternative:e.data.metadata.description||""}}function d(e){return{linkName:e.data.name,linkHref:u(e)}}function u(e){const t=new URL(e.data.url);return t.searchParams.set("download","true"),t.toString()}var g=i(448);class m extends e.Plugin{static get requires(){return["ImageUploadEditing","ImageUploadProgress",g.FileRepository,b]}static get pluginName(){return"CKBoxUploadAdapter"}async afterInit(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;const o=e.plugins.get(g.FileRepository),n=e.plugins.get(b);o.createUploadAdapter=t=>new h(t,n.getToken(),e);const r=!e.config.get("ckbox.ignoreDataId"),s=e.plugins.get("ImageUploadEditing");r&&s.on("uploadComplete",((t,{imageElement:i,data:o})=>{e.model.change((e=>{e.setAttribute("ckboxImageId",o.ckboxImageId,i)}))}))}}class h{constructor(e,t,i){this.loader=e,this.token=t,this.editor=i,this.controller=new AbortController,this.serviceOrigin=i.config.get("ckbox.serviceOrigin")}getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),i=function(e,t){const[,i]=e.value.split("."),o=JSON.parse(atob(i)),n=o.auth&&o.auth.ckbox&&o.auth.ckbox.workspaces||[o.aud];return t?"superadmin"==(o.auth&&o.auth.ckbox&&o.auth.ckbox.role)||n.includes(t)?t:null:n[0]}(this.token,t);if(null==i)throw(0,s.logError)("ckbox-access-default-workspace-error"),e;return i}async getAvailableCategories(e=0){const t=new URL("categories",this.serviceOrigin);return t.searchParams.set("limit",50..toString()),t.searchParams.set("offset",e.toString()),t.searchParams.set("workspaceId",this.getWorkspaceId()),this._sendHttpRequest({url:t}).then((async t=>{if(t.totalCount-(e+50)>0){const i=await this.getAvailableCategories(e+50);return[...t.items,...i]}return t.items})).catch((()=>{this.controller.signal.throwIfAborted(),(0,s.logError)("ckbox-fetch-category-http-error")}))}async getCategoryIdForFile(e){const t=function(e){const t=/\.(?<ext>[^.]+)$/;return e.match(t).groups.ext.toLowerCase()}(e.name),i=await this.getAvailableCategories();if(!i)return null;const o=this.editor.config.get("ckbox.defaultUploadCategories");if(o){const e=Object.keys(o).find((e=>o[e].find((e=>e.toLowerCase()==t))));if(e){const t=i.find((t=>t.id===e||t.name===e));return t?t.id:null}}const n=i.find((e=>e.extensions.find((e=>e.toLowerCase()==t))));return n?n.id:null}async upload(){const e=this.editor.t,t=e("Cannot determine a category for the uploaded file."),i=await this.loader.file,o=await this.getCategoryIdForFile(i);if(!o)return Promise.reject(t);const n=new URL("assets",this.serviceOrigin),r=new FormData;n.searchParams.set("workspaceId",this.getWorkspaceId()),r.append("categoryId",o),r.append("file",i);const s={method:"POST",url:n,data:r,onUploadProgress:e=>{e.lengthComputable&&(this.loader.uploadTotal=e.total,this.loader.uploaded=e.loaded)}};return this._sendHttpRequest(s).then((async e=>{const t=a(e.imageUrls);return{ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}})).catch((()=>{const t=e("Cannot upload file:")+` ${i.name}.`;return Promise.reject(t)}))}abort(){this.controller.abort()}_sendHttpRequest({url:e,method:t="GET",data:i,onUploadProgress:o}){const n=this.controller.signal,r=new XMLHttpRequest;r.open(t,e.toString(),!0),r.setRequestHeader("Authorization",this.token.value),r.setRequestHeader("CKBox-Version","CKEditor 5"),r.responseType="json";const s=()=>{r.abort()};return new Promise(((e,t)=>{n.addEventListener("abort",s),r.addEventListener("loadstart",(()=>{n.addEventListener("abort",s)})),r.addEventListener("loadend",(()=>{n.removeEventListener("abort",s)})),r.addEventListener("error",(()=>{t()})),r.addEventListener("abort",(()=>{t()})),r.addEventListener("load",(async()=>{const i=r.response;return!i||i.statusCode>=400?t(i&&i.message):e(i)})),o&&r.upload.addEventListener("progress",(e=>{o(e)})),r.send(i)}))}}class b extends e.Plugin{static get pluginName(){return"CKBoxEditing"}static get requires(){return["CloudServices","LinkEditing","PictureEditing",m]}async init(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;this._initConfig();const o=e.plugins.get("CloudServicesCore"),n=e.config.get("ckbox.tokenUrl");if(n===e.config.get("cloudServices.tokenUrl")){const t=e.plugins.get("CloudServices");this._token=t.token}else this._token=await o.createToken(n).init();e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()),i&&e.commands.add("ckbox",new c(e))}getToken(){return this._token}_initConfig(){const e=this.editor;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"default",tokenUrl:e.config.get("cloudServices.tokenUrl")});if(!e.config.get("ckbox.tokenUrl"))throw new s.CKEditorError("ckbox-plugin-missing-token-url",this);e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,s.logError)("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck(((e,t)=>{if(!!!e.last.getAttribute("linkHref")&&"ckboxLinkId"===t)return!1}))}_initConversion(){const e=this.editor;e.conversion.for("downcast").add((e=>{e.on("attribute:ckboxLinkId:imageBlock",((e,t,i)=>{const{writer:o,mapper:n,consumable:r}=i;if(!r.consume(t.item,e.name))return;const s=[...n.toViewElement(t.item).getChildren()].find((e=>"a"===e.name));s&&(t.item.hasAttribute("ckboxLinkId")?o.setAttribute("data-ckbox-resource-id",t.item.getAttribute("ckboxLinkId"),s):o.removeAttribute("data-ckbox-resource-id",s))}),{priority:"low"}),e.on("attribute:ckboxLinkId",((e,t,i)=>{const{writer:o,mapper:n,consumable:r}=i;if(r.consume(t.item,e.name)){if(t.attributeOldValue){const e=k(o,t.attributeOldValue);o.unwrap(n.toViewRange(t.range),e)}if(t.attributeNewValue){const e=k(o,t.attributeNewValue);if(t.item.is("selection")){const t=o.document.selection;o.wrap(t.getFirstRange(),e)}else o.wrap(n.toViewRange(t.range),e)}}}),{priority:"low"})})),e.conversion.for("upcast").add((e=>{e.on("element:a",((e,t,i)=>{const{writer:o,consumable:n}=i;if(!t.viewItem.getAttribute("href"))return;if(!n.consume(t.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const r=t.viewItem.getAttribute("data-ckbox-resource-id");if(r)if(t.modelRange)for(let e of t.modelRange.getItems())e.is("$textProxy")&&(e=e.textNode),f(e)&&o.setAttribute("ckboxLinkId",r,e);else{const e=t.modelCursor.nodeBefore||t.modelCursor.parent;o.setAttribute("ckboxLinkId",r,e)}}),{priority:"low"})})),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:e=>e.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}})}_initFixers(){const e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(function(e){return t=>{let i=!1;const o=e.model,n=e.commands.get("ckbox");if(!n)return i;for(const e of o.document.differ.getChanges()){if("insert"!==e.type&&"attribute"!==e.type)continue;const o="insert"===e.type?new r.Range(e.position,e.position.getShiftedBy(e.length)):e.range,s="attribute"===e.type&&"linkHref"===e.attributeKey&&null===e.attributeNewValue;for(const e of o.getItems()){if(s&&e.hasAttribute("ckboxLinkId")){t.removeAttribute("ckboxLinkId",e),i=!0;continue}const o=p(e,n._chosenAssets);for(const n of o){const o="image"===n.type?"ckboxImageId":"ckboxLinkId";n.id!==e.getAttribute(o)&&(t.setAttribute(o,n.id,e),i=!0)}}}return i}}(e)),t.document.registerPostFixer(function(e){return t=>!(e.hasAttribute("linkHref")||!e.hasAttribute("ckboxLinkId"))&&(t.removeSelectionAttribute("ckboxLinkId"),!0)}(i))}}function p(e,t){const i=e.is("element","imageInline")||e.is("element","imageBlock"),o=e.hasAttribute("linkHref");return[...t].filter((t=>"image"===t.type&&i?t.attributes.imageFallbackUrl===e.getAttribute("src"):"link"===t.type&&o?t.attributes.linkHref===e.getAttribute("linkHref"):void 0))}function k(e,t){const i=e.createAttributeElement("a",{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty("link",!0,i),i}function f(e){return!!e.is("$text")||!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))}class x extends e.Plugin{static get pluginName(){return"CKBox"}static get requires(){return[b,n]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckbox=o})();
5
+ */(()=>{var e={704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},492:(e,t,i)=>{e.exports=i(79)("./src/engine.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},448:(e,t,i)=>{e.exports=i(79)("./src/upload.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(o){var n=t[o];if(void 0!==n)return n.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};(()=>{"use strict";i.r(o),i.d(o,{CKBox:()=>w,CKBoxEditing:()=>p,CKBoxUI:()=>n});var e=i(704),t=i(273);class n extends e.Plugin{static get pluginName(){return"CKBoxUI"}afterInit(){const e=this.editor,i=e.commands.get("ckbox");if(!i)return;const o=e.t;e.ui.componentFactory.add("ckbox",(n=>{const r=new t.ButtonView(n);return r.set({label:o("Open file manager"),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("isOn","isEnabled").to(i,"value","isEnabled"),r.on("execute",(()=>{e.execute("ckbox")})),r}))}}var r=i(492),s=i(209);function a(e){const t=[];let i=0;for(const o in e){const n=parseInt(o,10);isNaN(n)||(n>i&&(i=n),t.push(`${e[o]} ${o}w`))}const o=[{srcset:t.join(","),sizes:`(max-width: ${i}px) 100vw, ${i}px`,type:"image/webp"}];return{imageFallbackUrl:e.default,imageSources:o}}class c extends e.Command{constructor(e){super(e),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return null!==this._wrapper}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox");return{theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,dialog:{onClose:()=>this.fire("ckbox:close")},assets:{onChoose:e=>this.fire("ckbox:choose",e)}}}_initListeners(){const e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId");this.on("ckbox",(()=>{this.refresh()}),{priority:"low"}),this.on("ckbox:open",(()=>{if(!this.isEnabled||this.value)return;this._wrapper=(0,s.createElement)(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions());g(50)})),this.on("ckbox:close",(()=>{this.value&&(this._wrapper.remove(),this._wrapper=null)})),this.on("ckbox:choose",((o,n)=>{if(!this.isEnabled)return;const r=e.commands.get("insertImage"),s=e.commands.get("link"),a=function({assets:e,isImageAllowed:t,isLinkAllowed:i}){return e.map((e=>function(e){const t=e.data.metadata;if(!t)return!1;return t.width&&t.height}(e)?{id:e.data.id,type:"image",attributes:l(e)}:{id:e.data.id,type:"link",attributes:d(e)})).filter((e=>"image"===e.type?t:i))}({assets:n,isImageAllowed:r.isEnabled,isLinkAllowed:s.isEnabled});0!==a.length&&t.change((e=>{for(const t of a){const o=t===a[a.length-1];this._insertAsset(t,o,e),i&&(setTimeout((()=>this._chosenAssets.delete(t)),1e3),this._chosenAssets.add(t))}}))})),this.listenTo(e,"destroy",(()=>{this.fire("ckbox:close"),this._chosenAssets.clear()}))}_insertAsset(e,t,i){const o=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),"image"===e.type?this._insertImage(e):this._insertLink(e,i),t||i.setSelection(o.getLastPosition())}_insertImage(e){const t=this.editor,{imageFallbackUrl:i,imageSources:o,imageTextAlternative:n}=e.attributes;t.execute("insertImage",{source:{src:i,sources:o,alt:n}})}_insertLink(e,t){const i=this.editor,o=i.model,n=o.document.selection,{linkName:r,linkHref:a}=e.attributes;if(n.isCollapsed){const e=(0,s.toMap)(n.getAttributes()),i=t.createText(r,e),a=o.insertContent(i);t.setSelection(a)}i.execute("link",a)}}function l(e){const{imageFallbackUrl:t,imageSources:i}=a(e.data.imageUrls);return{imageFallbackUrl:t,imageSources:i,imageTextAlternative:e.data.metadata.description||""}}function d(e){return{linkName:e.data.name,linkHref:u(e)}}function u(e){const t=new URL(e.data.url);return t.searchParams.set("download","true"),t.toString()}function g(e){setTimeout((()=>{if(0===e)return;const t=document.querySelector(".ckbox-gallery .ckbox-gallery-item"),i=document.querySelector(".ckbox-empty-view .ckbox-btn");i&&i instanceof HTMLElement?i.focus():t&&t instanceof HTMLElement?t.focus():g(e-1)}),100)}var m=i(448);class b extends e.Plugin{static get requires(){return["ImageUploadEditing","ImageUploadProgress",m.FileRepository,p]}static get pluginName(){return"CKBoxUploadAdapter"}async afterInit(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;const o=e.plugins.get(m.FileRepository),n=e.plugins.get(p);o.createUploadAdapter=t=>new h(t,n.getToken(),e);const r=!e.config.get("ckbox.ignoreDataId"),s=e.plugins.get("ImageUploadEditing");r&&s.on("uploadComplete",((t,{imageElement:i,data:o})=>{e.model.change((e=>{e.setAttribute("ckboxImageId",o.ckboxImageId,i)}))}))}}class h{constructor(e,t,i){this.loader=e,this.token=t,this.editor=i,this.controller=new AbortController,this.serviceOrigin=i.config.get("ckbox.serviceOrigin")}getWorkspaceId(){const e=(0,this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),i=function(e,t){const[,i]=e.value.split("."),o=JSON.parse(atob(i)),n=o.auth&&o.auth.ckbox&&o.auth.ckbox.workspaces||[o.aud];return t?"superadmin"==(o.auth&&o.auth.ckbox&&o.auth.ckbox.role)||n.includes(t)?t:null:n[0]}(this.token,t);if(null==i)throw(0,s.logError)("ckbox-access-default-workspace-error"),e;return i}async getAvailableCategories(e=0){const t=new URL("categories",this.serviceOrigin);return t.searchParams.set("limit",50..toString()),t.searchParams.set("offset",e.toString()),t.searchParams.set("workspaceId",this.getWorkspaceId()),this._sendHttpRequest({url:t}).then((async t=>{if(t.totalCount-(e+50)>0){const i=await this.getAvailableCategories(e+50);return[...t.items,...i]}return t.items})).catch((()=>{this.controller.signal.throwIfAborted(),(0,s.logError)("ckbox-fetch-category-http-error")}))}async getCategoryIdForFile(e){const t=function(e){const t=/\.(?<ext>[^.]+)$/;return e.match(t).groups.ext.toLowerCase()}(e.name),i=await this.getAvailableCategories();if(!i)return null;const o=this.editor.config.get("ckbox.defaultUploadCategories");if(o){const e=Object.keys(o).find((e=>o[e].find((e=>e.toLowerCase()==t))));if(e){const t=i.find((t=>t.id===e||t.name===e));return t?t.id:null}}const n=i.find((e=>e.extensions.find((e=>e.toLowerCase()==t))));return n?n.id:null}async upload(){const e=this.editor.t,t=e("Cannot determine a category for the uploaded file."),i=await this.loader.file,o=await this.getCategoryIdForFile(i);if(!o)return Promise.reject(t);const n=new URL("assets",this.serviceOrigin),r=new FormData;n.searchParams.set("workspaceId",this.getWorkspaceId()),r.append("categoryId",o),r.append("file",i);const s={method:"POST",url:n,data:r,onUploadProgress:e=>{e.lengthComputable&&(this.loader.uploadTotal=e.total,this.loader.uploaded=e.loaded)}};return this._sendHttpRequest(s).then((async e=>{const t=a(e.imageUrls);return{ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}})).catch((()=>{const t=e("Cannot upload file:")+` ${i.name}.`;return Promise.reject(t)}))}abort(){this.controller.abort()}_sendHttpRequest({url:e,method:t="GET",data:i,onUploadProgress:o}){const n=this.controller.signal,r=new XMLHttpRequest;r.open(t,e.toString(),!0),r.setRequestHeader("Authorization",this.token.value),r.setRequestHeader("CKBox-Version","CKEditor 5"),r.responseType="json";const s=()=>{r.abort()};return new Promise(((e,t)=>{n.addEventListener("abort",s),r.addEventListener("loadstart",(()=>{n.addEventListener("abort",s)})),r.addEventListener("loadend",(()=>{n.removeEventListener("abort",s)})),r.addEventListener("error",(()=>{t()})),r.addEventListener("abort",(()=>{t()})),r.addEventListener("load",(async()=>{const i=r.response;return!i||i.statusCode>=400?t(i&&i.message):e(i)})),o&&r.upload.addEventListener("progress",(e=>{o(e)})),r.send(i)}))}}class p extends e.Plugin{static get pluginName(){return"CKBoxEditing"}static get requires(){return["CloudServices","LinkEditing","PictureEditing",b]}async init(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;this._initConfig();const o=e.plugins.get("CloudServicesCore"),n=e.config.get("ckbox.tokenUrl");if(n===e.config.get("cloudServices.tokenUrl")){const t=e.plugins.get("CloudServices");this._token=t.token}else this._token=await o.createToken(n).init();e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()),i&&e.commands.add("ckbox",new c(e))}getToken(){return this._token}_initConfig(){const e=this.editor;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:"default",tokenUrl:e.config.get("cloudServices.tokenUrl")});if(!e.config.get("ckbox.tokenUrl"))throw new s.CKEditorError("ckbox-plugin-missing-token-url",this);e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||(0,s.logError)("ckbox-plugin-image-feature-missing",e)}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck(((e,t)=>{if(!!!e.last.getAttribute("linkHref")&&"ckboxLinkId"===t)return!1}))}_initConversion(){const e=this.editor;e.conversion.for("downcast").add((e=>{e.on("attribute:ckboxLinkId:imageBlock",((e,t,i)=>{const{writer:o,mapper:n,consumable:r}=i;if(!r.consume(t.item,e.name))return;const s=[...n.toViewElement(t.item).getChildren()].find((e=>"a"===e.name));s&&(t.item.hasAttribute("ckboxLinkId")?o.setAttribute("data-ckbox-resource-id",t.item.getAttribute("ckboxLinkId"),s):o.removeAttribute("data-ckbox-resource-id",s))}),{priority:"low"}),e.on("attribute:ckboxLinkId",((e,t,i)=>{const{writer:o,mapper:n,consumable:r}=i;if(r.consume(t.item,e.name)){if(t.attributeOldValue){const e=f(o,t.attributeOldValue);o.unwrap(n.toViewRange(t.range),e)}if(t.attributeNewValue){const e=f(o,t.attributeNewValue);if(t.item.is("selection")){const t=o.document.selection;o.wrap(t.getFirstRange(),e)}else o.wrap(n.toViewRange(t.range),e)}}}),{priority:"low"})})),e.conversion.for("upcast").add((e=>{e.on("element:a",((e,t,i)=>{const{writer:o,consumable:n}=i;if(!t.viewItem.getAttribute("href"))return;if(!n.consume(t.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const r=t.viewItem.getAttribute("data-ckbox-resource-id");if(r)if(t.modelRange)for(let e of t.modelRange.getItems())e.is("$textProxy")&&(e=e.textNode),x(e)&&o.setAttribute("ckboxLinkId",r,e);else{const e=t.modelCursor.nodeBefore||t.modelCursor.parent;o.setAttribute("ckboxLinkId",r,e)}}),{priority:"low"})})),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:e=>e.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}})}_initFixers(){const e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(function(e){return t=>{let i=!1;const o=e.model,n=e.commands.get("ckbox");if(!n)return i;for(const e of o.document.differ.getChanges()){if("insert"!==e.type&&"attribute"!==e.type)continue;const o="insert"===e.type?new r.Range(e.position,e.position.getShiftedBy(e.length)):e.range,s="attribute"===e.type&&"linkHref"===e.attributeKey&&null===e.attributeNewValue;for(const e of o.getItems()){if(s&&e.hasAttribute("ckboxLinkId")){t.removeAttribute("ckboxLinkId",e),i=!0;continue}const o=k(e,n._chosenAssets);for(const n of o){const o="image"===n.type?"ckboxImageId":"ckboxLinkId";n.id!==e.getAttribute(o)&&(t.setAttribute(o,n.id,e),i=!0)}}}return i}}(e)),t.document.registerPostFixer(function(e){return t=>!(e.hasAttribute("linkHref")||!e.hasAttribute("ckboxLinkId"))&&(t.removeSelectionAttribute("ckboxLinkId"),!0)}(i))}}function k(e,t){const i=e.is("element","imageInline")||e.is("element","imageBlock"),o=e.hasAttribute("linkHref");return[...t].filter((t=>"image"===t.type&&i?t.attributes.imageFallbackUrl===e.getAttribute("src"):"link"===t.type&&o?t.attributes.linkHref===e.getAttribute("linkHref"):void 0))}function f(e,t){const i=e.createAttributeElement("a",{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty("link",!0,i),i}function x(e){return!!e.is("$text")||!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))}class w extends e.Plugin{static get pluginName(){return"CKBox"}static get requires(){return[p,n]}}})(),(window.CKEditor5=window.CKEditor5||{}).ckbox=o})();
@@ -1 +1 @@
1
- !function(a){const n=a.fa=a.fa||{};n.dictionary=Object.assign(n.dictionary||{},{"Cannot access default workspace.":"","Cannot determine a category for the uploaded file.":"نمی توان یک دسته برای فایل آپلود شده تعیین کرد","Open file manager":"مدیریت فایل را باز کنید"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
1
+ !function(a){const n=a.fa=a.fa||{};n.dictionary=Object.assign(n.dictionary||{},{"Cannot access default workspace.":"فضای کاری پیش فرض قابل دسترس نیست.","Cannot determine a category for the uploaded file.":"نمی توان یک دسته برای فایل آپلود شده تعیین کرد","Open file manager":"مدیریت فایل را باز کنید"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -1 +1 @@
1
- !function(e){const a=e.gl=e.gl||{};a.dictionary=Object.assign(a.dictionary||{},{"Cannot access default workspace.":"","Cannot determine a category for the uploaded file.":"Non é posíbel determinar unha categoría para o ficheiro cargado.","Open file manager":"Abrir o xestor de ficheiros"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
1
+ !function(e){const o=e.gl=e.gl||{};o.dictionary=Object.assign(o.dictionary||{},{"Cannot access default workspace.":"Non é posíbel acceder ao espazo de traballo predeterminado.","Cannot determine a category for the uploaded file.":"Non é posíbel determinar unha categoría para o ficheiro enviado.","Open file manager":"Abrir o xestor de ficheiros"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Arabic (https://app.transifex.com/ckeditor/teams/11143/ar/)\n"
16
16
  "Language: ar\n"
17
17
  "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Azerbaijani (https://app.transifex.com/ckeditor/teams/11143/az/)\n"
16
16
  "Language: az\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Bulgarian (https://app.transifex.com/ckeditor/teams/11143/bg/)\n"
16
16
  "Language: bg\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Bengali (https://app.transifex.com/ckeditor/teams/11143/bn/)\n"
16
16
  "Language: bn\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Catalan (https://app.transifex.com/ckeditor/teams/11143/ca/)\n"
16
16
  "Language: ca\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Czech (https://app.transifex.com/ckeditor/teams/11143/cs/)\n"
16
16
  "Language: cs\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Danish (https://app.transifex.com/ckeditor/teams/11143/da/)\n"
16
16
  "Language: da\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: German (https://app.transifex.com/ckeditor/teams/11143/de/)\n"
16
16
  "Language: de\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Greek (https://app.transifex.com/ckeditor/teams/11143/el/)\n"
16
16
  "Language: el\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: English (Australia) (https://app.transifex.com/ckeditor/teams/11143/en_AU/)\n"
16
16
  "Language: en_AU\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language: \n"
16
16
  "Language-Team: \n"
17
17
  "Plural-Forms: \n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Spanish (Colombia) (https://app.transifex.com/ckeditor/teams/11143/es_CO/)\n"
16
16
  "Language: es_CO\n"
17
17
  "Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Spanish (https://app.transifex.com/ckeditor/teams/11143/es/)\n"
16
16
  "Language: es\n"
17
17
  "Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Estonian (https://app.transifex.com/ckeditor/teams/11143/et/)\n"
16
16
  "Language: et\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Persian (https://app.transifex.com/ckeditor/teams/11143/fa/)\n"
16
16
  "Language: fa\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -26,4 +27,4 @@ msgstr "نمی توان یک دسته برای فایل آپلود شده تعی
26
27
 
27
28
  msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
29
  msgid "Cannot access default workspace."
29
- msgstr ""
30
+ msgstr "فضای کاری پیش فرض قابل دسترس نیست."
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Finnish (https://app.transifex.com/ckeditor/teams/11143/fi/)\n"
16
16
  "Language: fi\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: French (https://app.transifex.com/ckeditor/teams/11143/fr/)\n"
16
16
  "Language: fr\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Galician (https://app.transifex.com/ckeditor/teams/11143/gl/)\n"
16
16
  "Language: gl\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -22,8 +23,8 @@ msgstr "Abrir o xestor de ficheiros"
22
23
 
23
24
  msgctxt "A message is displayed when CKEditor 5 cannot associate an image with any of the categories defined in CKBox while uploading an asset."
24
25
  msgid "Cannot determine a category for the uploaded file."
25
- msgstr "Non é posíbel determinar unha categoría para o ficheiro cargado."
26
+ msgstr "Non é posíbel determinar unha categoría para o ficheiro enviado."
26
27
 
27
28
  msgctxt "A message is displayed when the user is not authorised to access CKBox workspace configured as default one."
28
29
  msgid "Cannot access default workspace."
29
- msgstr ""
30
+ msgstr "Non é posíbel acceder ao espazo de traballo predeterminado."
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Hebrew (https://app.transifex.com/ckeditor/teams/11143/he/)\n"
16
16
  "Language: he\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Hindi (https://app.transifex.com/ckeditor/teams/11143/hi/)\n"
16
16
  "Language: hi\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Croatian (https://app.transifex.com/ckeditor/teams/11143/hr/)\n"
16
16
  "Language: hr\n"
17
17
  "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Hungarian (https://app.transifex.com/ckeditor/teams/11143/hu/)\n"
16
16
  "Language: hu\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Indonesian (https://app.transifex.com/ckeditor/teams/11143/id/)\n"
16
16
  "Language: id\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Italian (https://app.transifex.com/ckeditor/teams/11143/it/)\n"
16
16
  "Language: it\n"
17
17
  "Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Japanese (https://app.transifex.com/ckeditor/teams/11143/ja/)\n"
16
16
  "Language: ja\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Korean (https://app.transifex.com/ckeditor/teams/11143/ko/)\n"
16
16
  "Language: ko\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Lithuanian (https://app.transifex.com/ckeditor/teams/11143/lt/)\n"
16
16
  "Language: lt\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Latvian (https://app.transifex.com/ckeditor/teams/11143/lv/)\n"
16
16
  "Language: lv\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Malay (https://app.transifex.com/ckeditor/teams/11143/ms/)\n"
16
16
  "Language: ms\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Dutch (https://app.transifex.com/ckeditor/teams/11143/nl/)\n"
16
16
  "Language: nl\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Norwegian (https://app.transifex.com/ckeditor/teams/11143/no/)\n"
16
16
  "Language: no\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Polish (https://app.transifex.com/ckeditor/teams/11143/pl/)\n"
16
16
  "Language: pl\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Portuguese (Brazil) (https://app.transifex.com/ckeditor/teams/11143/pt_BR/)\n"
16
16
  "Language: pt_BR\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Portuguese (https://app.transifex.com/ckeditor/teams/11143/pt/)\n"
16
16
  "Language: pt\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Romanian (https://app.transifex.com/ckeditor/teams/11143/ro/)\n"
16
16
  "Language: ro\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Russian (https://app.transifex.com/ckeditor/teams/11143/ru/)\n"
16
16
  "Language: ru\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Slovak (https://app.transifex.com/ckeditor/teams/11143/sk/)\n"
16
16
  "Language: sk\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Albanian (https://app.transifex.com/ckeditor/teams/11143/sq/)\n"
16
16
  "Language: sq\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Serbian (Latin) (https://app.transifex.com/ckeditor/teams/11143/sr@latin/)\n"
16
16
  "Language: sr@latin\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Serbian (https://app.transifex.com/ckeditor/teams/11143/sr/)\n"
16
16
  "Language: sr\n"
17
17
  "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Swedish (https://app.transifex.com/ckeditor/teams/11143/sv/)\n"
16
16
  "Language: sv\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Thai (https://app.transifex.com/ckeditor/teams/11143/th/)\n"
16
16
  "Language: th\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Turkish (https://app.transifex.com/ckeditor/teams/11143/tr/)\n"
16
16
  "Language: tr\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Uyghur (https://app.transifex.com/ckeditor/teams/11143/ug/)\n"
16
16
  "Language: ug\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Ukrainian (https://app.transifex.com/ckeditor/teams/11143/uk/)\n"
16
16
  "Language: uk\n"
17
17
  "Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Urdu (https://app.transifex.com/ckeditor/teams/11143/ur/)\n"
16
16
  "Language: ur\n"
17
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Uzbek (https://app.transifex.com/ckeditor/teams/11143/uz/)\n"
16
16
  "Language: uz\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Vietnamese (https://app.transifex.com/ckeditor/teams/11143/vi/)\n"
16
16
  "Language: vi\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Chinese (China) (https://app.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
16
16
  "Language: zh_CN\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
@@ -15,6 +15,7 @@ msgstr ""
15
15
  "Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
16
16
  "Language: zh_TW\n"
17
17
  "Plural-Forms: nplurals=1; plural=0;\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
18
19
 
19
20
  msgctxt "Toolbar button tooltip for opening a file browser that allows inserting an image or a file to the editor."
20
21
  msgid "Open file manager"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ckbox",
3
- "version": "0.0.0-nightly-20230829.0",
3
+ "version": "0.0.0-nightly-20230831.0",
4
4
  "description": "CKBox 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": "0.0.0-nightly-20230829.0"
15
+ "ckeditor5": "0.0.0-nightly-20230831.0"
16
16
  },
17
17
  "author": "CKSource (http://cksource.com/)",
18
18
  "license": "GPL-2.0-or-later",
@@ -132,6 +132,8 @@ export default class CKBoxCommand extends Command {
132
132
  this._wrapper = createElement(document, 'div', { class: 'ck ckbox-wrapper' });
133
133
  document.body.appendChild(this._wrapper);
134
134
  window.CKBox.mount(this._wrapper, this._prepareOptions());
135
+ const MAX_NUMBER_OF_ATTEMPTS_TO_FOCUS = 50;
136
+ focusCKBoxItem(MAX_NUMBER_OF_ATTEMPTS_TO_FOCUS);
135
137
  });
136
138
  // Handle closing of the CKBox dialog.
137
139
  this.on('ckbox:close', () => {
@@ -300,3 +302,32 @@ function getAssetUrl(asset) {
300
302
  url.searchParams.set('download', 'true');
301
303
  return url.toString();
302
304
  }
305
+ /**
306
+ * Focuses the CKBox first item in gallery.
307
+ * This is a temporary fix. A permanent solution to this issue will be provided soon.
308
+ *
309
+ * @param limiter Max number of attempts to focus the ckbox item.
310
+ */
311
+ function focusCKBoxItem(limiter) {
312
+ // Trying every 100 ms get access to the CKBox component until component will be loaded.
313
+ setTimeout(() => {
314
+ if (limiter === 0) {
315
+ return;
316
+ }
317
+ const ckboxGalleryFirstItem = document.querySelector('.ckbox-gallery .ckbox-gallery-item');
318
+ // In case there is no items, "upload button" will be appeared in "div" with
319
+ // classname ".ckbox-empty-view".
320
+ const uploadButton = document.querySelector('.ckbox-empty-view .ckbox-btn');
321
+ // In case "upload button" is loaded in ".ckbox-empty-view" we focus actual button.
322
+ if (uploadButton && uploadButton instanceof HTMLElement) {
323
+ uploadButton.focus();
324
+ return;
325
+ }
326
+ if (ckboxGalleryFirstItem && ckboxGalleryFirstItem instanceof HTMLElement) {
327
+ ckboxGalleryFirstItem.focus();
328
+ }
329
+ else {
330
+ focusCKBoxItem(limiter - 1);
331
+ }
332
+ }, 100);
333
+ }