@ckeditor/ckeditor5-language
Advanced tools
Comparing version 27.1.0 to 28.0.0
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.language=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){e.exports=n(3)("./src/core.js")},function(e,t,n){e.exports=n(3)("./src/ui.js")},function(e,t,n){e.exports=n(3)("./src/utils.js")},function(e,t){e.exports=CKEditor5.dll},function(e,t,n){var r=n(5),o=n(6);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var a={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};r(o,a);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function u(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},r=[],o=0;o<e.length;o++){var a=e[o],s=t.base?a[0]+t.base:a[0],l=n[s]||0,c="".concat(s," ").concat(l);n[s]=l+1;var d=u(c),g={css:a[1],media:a[2],sourceMap:a[3]};-1!==d?(i[d].references++,i[d].updater(g)):i.push({identifier:c,updater:b(g,t),references:1}),r.push(c)}return r}function l(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var o=n.nc;o&&(r.nonce=o)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function g(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,n){var r=n.css,o=n.media,a=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var p=null,m=0;function b(e,t){var n,r,o;if(t.singleton){var a=m++;n=p||(p=l(t)),r=g.bind(null,n,a,!1),o=g.bind(null,n,a,!0)}else n=l(t),r=f.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=u(n[r]);i[o].references--}for(var a=s(e,t),l=0;l<n.length;l++){var c=u(n[l]);0===i[c].references&&(i[c].updater(),i.splice(c,1))}n=a}}}},function(e,t){e.exports=".ck-content span[lang]{font-style:italic}"},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(2);function a(e,t){return`${e}:${t=t||Object(o.getLanguageDirection)(e)}`}class i extends r.Command{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const n=this.editor.model,r=n.document.selection,o=!!e&&a(e,t);n.change(e=>{if(r.isCollapsed)o?e.setSelectionAttribute("language",o):e.removeSelectionAttribute("language");else{const t=n.schema.getValidRanges(r.getRanges(),"language");for(const n of t)o?e.setAttribute("language",o,n):e.removeAttribute("language",n)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.getAttribute("language")||!1;for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,"language"))return n.getAttribute("language")||!1;return!1}}class u extends r.Plugin{static get pluginName(){return"TextPartLanguageEditing"}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new i(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>a(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t})=>{if(!e)return;const{languageCode:n,textDirection:r}=function(e){const[t,n]=e.split(":");return{languageCode:t,textDirection:n}}(e);return t.createAttributeElement("span",{lang:n,dir:r})}})}}var s=n(1);n(4);class l extends r.Plugin{static get pluginName(){return"TextPartLanguageUI"}init(){const e=this.editor,t=e.t,n=e.config.get("language.textPartLanguage"),r=t("Choose language"),i=t("Remove language"),u=t("Language");e.ui.componentFactory.add("textPartLanguage",t=>{const l=new o.Collection,c={},d=e.commands.get("textPartLanguage");for(const e of n){const t={type:"button",model:new s.Model({label:e.title,languageCode:e.languageCode,textDirection:e.textDirection,withText:!0})},n=a(e.languageCode,e.textDirection);t.model.bind("isOn").to(d,"value",e=>e===n),l.add(t),c[n]=e.title}l.add({type:"separator"}),l.add({type:"button",model:new s.Model({label:i,languageCode:!1,withText:!0})});const g=Object(s.createDropdown)(t);return Object(s.addListToDropdown)(g,l),g.buttonView.set({isOn:!1,withText:!0,tooltip:u}),g.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),g.bind("isEnabled").to(d,"isEnabled"),g.buttonView.bind("label").to(d,"value",e=>c[e]||r),this.listenTo(g,"execute",t=>{d.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()}),g})}}class c extends r.Plugin{static get requires(){return[u,l]}static get pluginName(){return"TextPartLanguage"}}t.default={TextPartLanguage:c,TextPartLanguageEditing:u,TextPartLanguageUI:l}}]).default; | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.language=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){e.exports=n(3)("./src/core.js")},function(e,t,n){e.exports=n(3)("./src/ui.js")},function(e,t,n){e.exports=n(3)("./src/utils.js")},function(e,t){e.exports=CKEditor5.dll},function(e,t,n){var r=n(5),o=n(6);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[e.i,o,""]]);var a={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};r(o,a);e.exports=o.locals||{}},function(e,t,n){"use strict";var r,o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function u(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function s(e,t){for(var n={},r=[],o=0;o<e.length;o++){var a=e[o],s=t.base?a[0]+t.base:a[0],l=n[s]||0,c="".concat(s," ").concat(l);n[s]=l+1;var d=u(c),g={css:a[1],media:a[2],sourceMap:a[3]};-1!==d?(i[d].references++,i[d].updater(g)):i.push({identifier:c,updater:b(g,t),references:1}),r.push(c)}return r}function l(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var o=n.nc;o&&(r.nonce=o)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function g(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,n){var r=n.css,o=n.media,a=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var p=null,m=0;function b(e,t){var n,r,o;if(t.singleton){var a=m++;n=p||(p=l(t)),r=g.bind(null,n,a,!1),o=g.bind(null,n,a,!0)}else n=l(t),r=f.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var n=s(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=u(n[r]);i[o].references--}for(var a=s(e,t),l=0;l<n.length;l++){var c=u(n[l]);0===i[c].references&&(i[c].updater(),i.splice(c,1))}n=a}}}},function(e,t){e.exports=".ck-content span[lang]{font-style:italic}"},function(e,t,n){"use strict";n.r(t),n.d(t,"TextPartLanguage",(function(){return c})),n.d(t,"TextPartLanguageEditing",(function(){return u})),n.d(t,"TextPartLanguageUI",(function(){return l}));var r=n(0),o=n(2);function a(e,t){return`${e}:${t=t||Object(o.getLanguageDirection)(e)}`}class i extends r.Command{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const n=this.editor.model,r=n.document.selection,o=!!e&&a(e,t);n.change(e=>{if(r.isCollapsed)o?e.setSelectionAttribute("language",o):e.removeSelectionAttribute("language");else{const t=n.schema.getValidRanges(r.getRanges(),"language");for(const n of t)o?e.setAttribute("language",o,n):e.removeAttribute("language",n)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.getAttribute("language")||!1;for(const e of n.getRanges())for(const n of e.getItems())if(t.checkAttribute(n,"language"))return n.getAttribute("language")||!1;return!1}}class u extends r.Plugin{static get pluginName(){return"TextPartLanguageEditing"}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new i(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>a(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t})=>{if(!e)return;const{languageCode:n,textDirection:r}=function(e){const[t,n]=e.split(":");return{languageCode:t,textDirection:n}}(e);return t.createAttributeElement("span",{lang:n,dir:r})}})}}var s=n(1);n(4);class l extends r.Plugin{static get pluginName(){return"TextPartLanguageUI"}init(){const e=this.editor,t=e.t,n=e.config.get("language.textPartLanguage"),r=t("Choose language"),i=t("Remove language"),u=t("Language");e.ui.componentFactory.add("textPartLanguage",t=>{const l=new o.Collection,c={},d=e.commands.get("textPartLanguage");for(const e of n){const t={type:"button",model:new s.Model({label:e.title,languageCode:e.languageCode,textDirection:e.textDirection,withText:!0})},n=a(e.languageCode,e.textDirection);t.model.bind("isOn").to(d,"value",e=>e===n),l.add(t),c[n]=e.title}l.add({type:"separator"}),l.add({type:"button",model:new s.Model({label:i,languageCode:!1,withText:!0})});const g=Object(s.createDropdown)(t);return Object(s.addListToDropdown)(g,l),g.buttonView.set({isOn:!1,withText:!0,tooltip:u}),g.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),g.bind("isEnabled").to(d,"isEnabled"),g.buttonView.bind("label").to(d,"value",e=>c[e]||r),this.listenTo(g,"execute",t=>{d.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()}),g})}}class c extends r.Plugin{static get requires(){return[u,l]}static get pluginName(){return"TextPartLanguage"}}}]); |
{ | ||
"name": "@ckeditor/ckeditor5-language", | ||
"version": "27.1.0", | ||
"version": "28.0.0", | ||
"description": "Text part language feature for CKEditor 5.", | ||
@@ -14,12 +14,12 @@ "keywords": [ | ||
"dependencies": { | ||
"ckeditor5": "^27.1.0" | ||
"ckeditor5": "^28.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-core": "^27.1.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^24.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^27.1.0", | ||
"@ckeditor/ckeditor5-engine": "^27.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^27.1.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^27.1.0", | ||
"@ckeditor/ckeditor5-ui": "^27.1.0", | ||
"@ckeditor/ckeditor5-core": "^28.0.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^25.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^28.0.0", | ||
"@ckeditor/ckeditor5-engine": "^28.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^28.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^28.0.0", | ||
"@ckeditor/ckeditor5-ui": "^28.0.0", | ||
"webpack": "^4.43.0", | ||
@@ -26,0 +26,0 @@ "webpack-cli": "^3.3.11" |
@@ -10,10 +10,4 @@ /** | ||
import TextPartLanguage from './textpartlanguage'; | ||
import TextPartLanguageEditing from './textpartlanguageediting'; | ||
import TextPartLanguageUI from './textpartlanguageui'; | ||
export default { | ||
TextPartLanguage, | ||
TextPartLanguageEditing, | ||
TextPartLanguageUI | ||
}; | ||
export { default as TextPartLanguage } from './textpartlanguage'; | ||
export { default as TextPartLanguageEditing } from './textpartlanguageediting'; | ||
export { default as TextPartLanguageUI } from './textpartlanguageui'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41908
26
438
+ Added@ckeditor/ckeditor5-clipboard@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-core@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-engine@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-enter@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-paragraph@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-select-all@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-typing@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-undo@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-upload@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@28.0.0(transitive)
+ Added@ckeditor/ckeditor5-widget@28.0.0(transitive)
+ Addedckeditor5@28.0.0(transitive)
- Removed@ckeditor/ckeditor5-clipboard@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-core@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-engine@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-enter@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-paragraph@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-select-all@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-typing@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-ui@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-undo@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-upload@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-utils@27.1.0(transitive)
- Removed@ckeditor/ckeditor5-widget@27.1.0(transitive)
- Removedckeditor5@27.1.0(transitive)
Updatedckeditor5@^28.0.0