@ckeditor/ckeditor5-basic-styles 45.2.1 → 46.0.0-alpha.1
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/build/basic-styles.js +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/attributecommand.d.ts +6 -6
- package/src/attributecommand.js +5 -5
- package/src/bold/boldediting.d.ts +1 -1
- package/src/bold/boldediting.js +2 -2
- package/src/bold/boldui.d.ts +1 -1
- package/src/bold/boldui.js +1 -1
- package/src/bold.d.ts +3 -3
- package/src/bold.js +3 -3
- package/src/code/codeediting.d.ts +1 -1
- package/src/code/codeediting.js +2 -2
- package/src/code/codeui.d.ts +1 -1
- package/src/code/codeui.js +1 -1
- package/src/code.d.ts +3 -3
- package/src/code.js +3 -3
- package/src/index.d.ts +23 -22
- package/src/index.js +23 -22
- package/src/italic/italicediting.d.ts +1 -1
- package/src/italic/italicediting.js +2 -2
- package/src/italic/italicui.d.ts +1 -1
- package/src/italic/italicui.js +1 -1
- package/src/italic.d.ts +3 -3
- package/src/italic.js +3 -3
- package/src/strikethrough/strikethroughediting.d.ts +1 -1
- package/src/strikethrough/strikethroughediting.js +2 -2
- package/src/strikethrough/strikethroughui.d.ts +1 -1
- package/src/strikethrough/strikethroughui.js +1 -1
- package/src/strikethrough.d.ts +3 -3
- package/src/strikethrough.js +3 -3
- package/src/subscript/subscriptediting.d.ts +1 -1
- package/src/subscript/subscriptediting.js +2 -2
- package/src/subscript/subscriptui.d.ts +1 -1
- package/src/subscript/subscriptui.js +1 -1
- package/src/subscript.d.ts +3 -3
- package/src/subscript.js +3 -3
- package/src/superscript/superscriptediting.d.ts +1 -1
- package/src/superscript/superscriptediting.js +2 -2
- package/src/superscript/superscriptui.d.ts +1 -1
- package/src/superscript/superscriptui.js +1 -1
- package/src/superscript.d.ts +3 -3
- package/src/superscript.js +3 -3
- package/src/underline/underlineediting.d.ts +1 -1
- package/src/underline/underlineediting.js +2 -2
- package/src/underline/underlineui.d.ts +1 -1
- package/src/underline/underlineui.js +1 -1
- package/src/underline.d.ts +3 -3
- package/src/underline.js +3 -3
- package/src/utils.d.ts +2 -0
- package/src/utils.js +2 -0
package/build/basic-styles.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var t={21:t=>{"use strict";t.exports=function(t,e){Object.keys(e).forEach(function(i){t.setAttribute(i,e[i])})}},51:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},128:t=>{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,i)=>{t.exports=i(237)("./src/ui.js")},355:(t,e,i)=>{t.exports=i(237)("./src/icons.js")},591:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},o=[],a=0;a<t.length;a++){var c=t[a],u=n.base?c[0]+n.base:c[0],l=s[u]||0,d="".concat(u," ").concat(l);s[u]=l+1;var g=i(d),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)e[g].references++,e[g].updater(m);else{var p=r(m,n);n.byIndex=a,e.splice(a,0,{identifier:d,updater:p,references:1})}o.push(d)}return o}function r(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,r){var s=n(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=i(s[o]);e[a].references--}for(var c=n(t,r),u=0;u<s.length;u++){var l=i(s[u]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}s=c}}},598:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(758),r=i.n(n),s=i(935),o=i.n(s)()(r());o.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}",""]);const a=o},639:t=>{"use strict";var e,i=(e=[],function(t,i){return e[t]=i,e.filter(Boolean).join("\n")});function n(t,e,n,r){var s;if(n)s="";else{s="",r.supports&&(s+="@supports (".concat(r.supports,") {")),r.media&&(s+="@media ".concat(r.media," {"));var o=void 0!==r.layer;o&&(s+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),s+=r.css,o&&(s+="}"),r.media&&(s+="}"),r.supports&&(s+="}")}if(t.styleSheet)t.styleSheet.cssText=i(e,s);else{var a=document.createTextNode(s),c=t.childNodes;c[e]&&t.removeChild(c[e]),c.length?t.insertBefore(a,c[e]):t.appendChild(a)}}var r={singleton:null,singletonCounter:0};t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=r.singletonCounter++,i=r.singleton||(r.singleton=t.insertStyleElement(t));return{update:function(t){n(i,e,!1,t)},remove:function(t){n(i,e,!0,t)}}}},758:t=>{"use strict";t.exports=function(t){return t[1]}},782:(t,e,i)=>{t.exports=i(237)("./src/core.js")},834:(t,e,i)=>{t.exports=i(237)("./src/typing.js")},935:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,n,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var u=0;u<t.length;u++){var l=[].concat(t[u]);n&&o[l[0]]||(void 0!==s&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=s),i&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=i):l[2]=i),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),e.push(l))}},e}}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={id:n,exports:{}};return t[n](s,s.exports,i),s.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{AttributeCommand:()=>e,Bold:()=>d,BoldEditing:()=>s,BoldUI:()=>l,Code:()=>O,CodeEditing:()=>p,CodeUI:()=>E,Italic:()=>U,ItalicEditing:()=>T,ItalicUI:()=>F,Strikethrough:()=>R,StrikethroughEditing:()=>L,StrikethroughUI:()=>V,Subscript:()=>H,SubscriptEditing:()=>_,SubscriptUI:()=>$,Superscript:()=>J,SuperscriptEditing:()=>X,SuperscriptUI:()=>G,Underline:()=>tt,UnderlineEditing:()=>W,UnderlineUI:()=>Z});var t=i(782);class e extends t.Command{attributeKey;constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,i=e.document.selection,n=void 0===t.forceValue?!this.value:t.forceValue;e.change(t=>{if(i.isCollapsed)n?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const r=e.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const e of r)n?t.setAttribute(this.attributeKey,n,e):t.removeAttribute(this.attributeKey,e)}})}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,i=t.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const t of i.getRanges())for(const i of t.getItems())if(e.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}const r="bold";class s extends t.Plugin{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:r}),t.model.schema.setAttributeProperties(r,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:r,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e&&("bold"==e||Number(e)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(r,new e(t,r)),t.keystrokes.set("CTRL+B",r),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Bold text"),keystroke:"CTRL+B"}]})}}var o=i(355),a=i(311);function c({editor:t,commandName:e,plugin:i,icon:n,label:r,keystroke:s}){return o=>{const c=t.commands.get(e),u=new o(t.locale);return u.set({label:r,icon:n,keystroke:s,isToggleable:!0}),u.bind("isEnabled").to(c,"isEnabled"),u.bind("isOn").to(c,"value"),u instanceof a.MenuBarMenuListItemButtonView?u.set({role:"menuitemcheckbox"}):u.set({tooltip:!0}),i.listenTo(u,"execute",()=>{t.execute(e),t.editing.view.focus()}),u}}const u="bold";class l extends t.Plugin{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:u,plugin:this,icon:o.IconBold,label:e("Bold"),keystroke:"CTRL+B"});t.ui.componentFactory.add(u,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+u,()=>i(a.MenuBarMenuListItemButtonView))}}class d extends t.Plugin{static get requires(){return[s,l]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}var g=i(834);const m="code";class p extends t.Plugin{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[g.TwoStepCaretMovement]}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:m}),t.model.schema.setAttributeProperties(m,{isFormatting:!0,copyOnEnter:!1}),t.conversion.attributeToElement({model:m,view:"code"}),t.commands.add(m,new e(t,m)),t.plugins.get(g.TwoStepCaretMovement).registerAttribute(m),(0,g.inlineHighlight)(t,m,"code","ck-code_selected"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}var h=i(591),f=i.n(h),b=i(639),y=i.n(b),v=i(128),k=i.n(v),x=i(21),I=i.n(x),w=i(51),S=i.n(w),P=i(598),B={attributes:{"data-cke":!0}};B.setAttributes=I(),B.insert=k().bind(null,"head"),B.domAPI=y(),B.insertStyleElement=S();f()(P.A,B);P.A&&P.A.locals&&P.A.locals;const A="code";class E extends t.Plugin{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:A,plugin:this,icon:o.IconCode,label:e("Code")});t.ui.componentFactory.add(A,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+A,()=>i(a.MenuBarMenuListItemButtonView))}}class O extends t.Plugin{static get requires(){return[p,E]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}const C="italic";class T extends t.Plugin{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:C}),t.model.schema.setAttributeProperties(C,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:C,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(C,new e(t,C)),t.keystrokes.set("CTRL+I",C),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Italic text"),keystroke:"CTRL+I"}]})}}const N="italic";class F extends t.Plugin{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:N,plugin:this,icon:o.IconItalic,keystroke:"CTRL+I",label:e("Italic")});t.ui.componentFactory.add(N,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+N,()=>i(a.MenuBarMenuListItemButtonView))}}class U extends t.Plugin{static get requires(){return[T,F]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}const M="strikethrough";class L extends t.Plugin{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:M}),t.model.schema.setAttributeProperties(M,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:M,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(M,new e(t,M)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const K="strikethrough";class V extends t.Plugin{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:K,plugin:this,icon:o.IconStrikethrough,keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});t.ui.componentFactory.add(K,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+K,()=>i(a.MenuBarMenuListItemButtonView))}}class R extends t.Plugin{static get requires(){return[L,V]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}const j="subscript";class _ extends t.Plugin{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:j}),t.model.schema.setAttributeProperties(j,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:j,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),t.commands.add(j,new e(t,j))}}const q="subscript";class $ extends t.Plugin{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:q,plugin:this,icon:o.IconSubscript,label:e("Subscript")});t.ui.componentFactory.add(q,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+q,()=>i(a.MenuBarMenuListItemButtonView))}}class H extends t.Plugin{static get requires(){return[_,$]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}const D="superscript";class X extends t.Plugin{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:D}),t.model.schema.setAttributeProperties(D,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:D,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(D,new e(t,D))}}const z="superscript";class G extends t.Plugin{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:z,plugin:this,icon:o.IconSuperscript,label:e("Superscript")});t.ui.componentFactory.add(z,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+z,()=>i(a.MenuBarMenuListItemButtonView))}}class J extends t.Plugin{static get requires(){return[X,G]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}const Q="underline";class W extends t.Plugin{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:Q}),t.model.schema.setAttributeProperties(Q,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Q,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(Q,new e(t,Q)),t.keystrokes.set("CTRL+U","underline"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Underline text"),keystroke:"CTRL+U"}]})}}const Y="underline";class Z extends t.Plugin{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:Y,plugin:this,icon:o.IconUnderline,label:e("Underline"),keystroke:"CTRL+U"});t.ui.componentFactory.add(Y,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+Y,()=>i(a.MenuBarMenuListItemButtonView))}}class tt extends t.Plugin{static get requires(){return[W,Z]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).basicStyles=n})();
|
|
5
|
+
*/(()=>{var t={21:t=>{"use strict";t.exports=function(t,e){Object.keys(e).forEach(function(i){t.setAttribute(i,e[i])})}},51:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},128:t=>{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,i)=>{t.exports=i(237)("./src/ui.js")},355:(t,e,i)=>{t.exports=i(237)("./src/icons.js")},591:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},o=[],a=0;a<t.length;a++){var c=t[a],u=n.base?c[0]+n.base:c[0],l=s[u]||0,d="".concat(u," ").concat(l);s[u]=l+1;var g=i(d),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==g)e[g].references++,e[g].updater(m);else{var p=r(m,n);n.byIndex=a,e.splice(a,0,{identifier:d,updater:p,references:1})}o.push(d)}return o}function r(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,r){var s=n(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=i(s[o]);e[a].references--}for(var c=n(t,r),u=0;u<s.length;u++){var l=i(s[u]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}s=c}}},598:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var n=i(758),r=i.n(n),s=i(935),o=i.n(s)()(r());o.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}",""]);const a=o},639:t=>{"use strict";var e,i=(e=[],function(t,i){return e[t]=i,e.filter(Boolean).join("\n")});function n(t,e,n,r){var s;if(n)s="";else{s="",r.supports&&(s+="@supports (".concat(r.supports,") {")),r.media&&(s+="@media ".concat(r.media," {"));var o=void 0!==r.layer;o&&(s+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),s+=r.css,o&&(s+="}"),r.media&&(s+="}"),r.supports&&(s+="}")}if(t.styleSheet)t.styleSheet.cssText=i(e,s);else{var a=document.createTextNode(s),c=t.childNodes;c[e]&&t.removeChild(c[e]),c.length?t.insertBefore(a,c[e]):t.appendChild(a)}}var r={singleton:null,singletonCounter:0};t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=r.singletonCounter++,i=r.singleton||(r.singleton=t.insertStyleElement(t));return{update:function(t){n(i,e,!1,t)},remove:function(t){n(i,e,!0,t)}}}},758:t=>{"use strict";t.exports=function(t){return t[1]}},782:(t,e,i)=>{t.exports=i(237)("./src/core.js")},834:(t,e,i)=>{t.exports=i(237)("./src/typing.js")},935:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i}).join("")},e.i=function(t,i,n,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var u=0;u<t.length;u++){var l=[].concat(t[u]);n&&o[l[0]]||(void 0!==s&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=s),i&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=i):l[2]=i),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),e.push(l))}},e}}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={id:n,exports:{}};return t[n](s,s.exports,i),s.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n),i.d(n,{AttributeCommand:()=>e,Bold:()=>d,BoldEditing:()=>s,BoldUI:()=>l,Code:()=>C,CodeEditing:()=>p,CodeUI:()=>E,Italic:()=>U,ItalicEditing:()=>T,ItalicUI:()=>F,Strikethrough:()=>R,StrikethroughEditing:()=>L,StrikethroughUI:()=>V,Subscript:()=>H,SubscriptEditing:()=>j,SubscriptUI:()=>$,Superscript:()=>J,SuperscriptEditing:()=>X,SuperscriptUI:()=>G,Underline:()=>tt,UnderlineEditing:()=>W,UnderlineUI:()=>Z,_getBasicStylesButtonCreator:()=>c});var t=i(782);class e extends t.Command{attributeKey;constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,i=e.document.selection,n=void 0===t.forceValue?!this.value:t.forceValue;e.change(t=>{if(i.isCollapsed)n?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const r=e.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const e of r)n?t.setAttribute(this.attributeKey,n,e):t.removeAttribute(this.attributeKey,e)}})}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,i=t.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const t of i.getRanges())for(const i of t.getItems())if(e.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}const r="bold";class s extends t.Plugin{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:r}),t.model.schema.setAttributeProperties(r,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:r,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e&&("bold"==e||Number(e)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(r,new e(t,r)),t.keystrokes.set("CTRL+B",r),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Bold text"),keystroke:"CTRL+B"}]})}}var o=i(355),a=i(311);function c({editor:t,commandName:e,plugin:i,icon:n,label:r,keystroke:s}){return o=>{const c=t.commands.get(e),u=new o(t.locale);return u.set({label:r,icon:n,keystroke:s,isToggleable:!0}),u.bind("isEnabled").to(c,"isEnabled"),u.bind("isOn").to(c,"value"),u instanceof a.MenuBarMenuListItemButtonView?u.set({role:"menuitemcheckbox"}):u.set({tooltip:!0}),i.listenTo(u,"execute",()=>{t.execute(e),t.editing.view.focus()}),u}}const u="bold";class l extends t.Plugin{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:u,plugin:this,icon:o.IconBold,label:e("Bold"),keystroke:"CTRL+B"});t.ui.componentFactory.add(u,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+u,()=>i(a.MenuBarMenuListItemButtonView))}}class d extends t.Plugin{static get requires(){return[s,l]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}var g=i(834);const m="code";class p extends t.Plugin{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[g.TwoStepCaretMovement]}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:m}),t.model.schema.setAttributeProperties(m,{isFormatting:!0,copyOnEnter:!1}),t.conversion.attributeToElement({model:m,view:"code"}),t.commands.add(m,new e(t,m)),t.plugins.get(g.TwoStepCaretMovement).registerAttribute(m),(0,g.inlineHighlight)(t,m,"code","ck-code_selected"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}var h=i(591),f=i.n(h),b=i(639),y=i.n(b),v=i(128),k=i.n(v),x=i(21),I=i.n(x),w=i(51),S=i.n(w),P=i(598),B={attributes:{"data-cke":!0}};B.setAttributes=I(),B.insert=k().bind(null,"head"),B.domAPI=y(),B.insertStyleElement=S();f()(P.A,B);P.A&&P.A.locals&&P.A.locals;const A="code";class E extends t.Plugin{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:A,plugin:this,icon:o.IconCode,label:e("Code")});t.ui.componentFactory.add(A,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+A,()=>i(a.MenuBarMenuListItemButtonView))}}class C extends t.Plugin{static get requires(){return[p,E]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}const O="italic";class T extends t.Plugin{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:O}),t.model.schema.setAttributeProperties(O,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:O,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(O,new e(t,O)),t.keystrokes.set("CTRL+I",O),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Italic text"),keystroke:"CTRL+I"}]})}}const N="italic";class F extends t.Plugin{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:N,plugin:this,icon:o.IconItalic,keystroke:"CTRL+I",label:e("Italic")});t.ui.componentFactory.add(N,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+N,()=>i(a.MenuBarMenuListItemButtonView))}}class U extends t.Plugin{static get requires(){return[T,F]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}const M="strikethrough";class L extends t.Plugin{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:M}),t.model.schema.setAttributeProperties(M,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:M,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(M,new e(t,M)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const K="strikethrough";class V extends t.Plugin{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:K,plugin:this,icon:o.IconStrikethrough,keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});t.ui.componentFactory.add(K,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+K,()=>i(a.MenuBarMenuListItemButtonView))}}class R extends t.Plugin{static get requires(){return[L,V]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}const _="subscript";class j extends t.Plugin{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:_}),t.model.schema.setAttributeProperties(_,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:_,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),t.commands.add(_,new e(t,_))}}const q="subscript";class $ extends t.Plugin{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:q,plugin:this,icon:o.IconSubscript,label:e("Subscript")});t.ui.componentFactory.add(q,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+q,()=>i(a.MenuBarMenuListItemButtonView))}}class H extends t.Plugin{static get requires(){return[j,$]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}const D="superscript";class X extends t.Plugin{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:D}),t.model.schema.setAttributeProperties(D,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:D,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(D,new e(t,D))}}const z="superscript";class G extends t.Plugin{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:z,plugin:this,icon:o.IconSuperscript,label:e("Superscript")});t.ui.componentFactory.add(z,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+z,()=>i(a.MenuBarMenuListItemButtonView))}}class J extends t.Plugin{static get requires(){return[X,G]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}const Q="underline";class W extends t.Plugin{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,i=this.editor.t;t.model.schema.extend("$text",{allowAttributes:Q}),t.model.schema.setAttributeProperties(Q,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Q,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(Q,new e(t,Q)),t.keystrokes.set("CTRL+U","underline"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:i("Underline text"),keystroke:"CTRL+U"}]})}}const Y="underline";class Z extends t.Plugin{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=c({editor:t,commandName:Y,plugin:this,icon:o.IconUnderline,label:e("Underline"),keystroke:"CTRL+U"});t.ui.componentFactory.add(Y,()=>i(a.ButtonView)),t.ui.componentFactory.add("menuBar:"+Y,()=>i(a.MenuBarMenuListItemButtonView))}}class tt extends t.Plugin{static get requires(){return[W,Z]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}})(),(window.CKEditor5=window.CKEditor5||{}).basicStyles=n})();
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typin
|
|
|
11
11
|
* An extension of the base {@link module:core/command~Command} class, which provides utilities for a command
|
|
12
12
|
* that toggles a single attribute on a text or an element.
|
|
13
13
|
*
|
|
14
|
-
* `AttributeCommand` uses {@link module:engine/model/document~
|
|
14
|
+
* `AttributeCommand` uses {@link module:engine/model/document~ModelDocument#selection}
|
|
15
15
|
* to decide which nodes (if any) should be changed, and applies or removes the attribute from them.
|
|
16
16
|
*
|
|
17
17
|
* The command checks the {@link module:engine/model/model~Model#schema} to decide if it can be enabled
|
|
@@ -39,12 +39,12 @@ import { TwoStepCaretMovement, inlineHighlight } from '@ckeditor/ckeditor5-typin
|
|
|
39
39
|
*
|
|
40
40
|
* If the command is active (`value == true`), it will remove attributes. Otherwise, it will set attributes.
|
|
41
41
|
*
|
|
42
|
-
* The execution result differs, depending on the {@link module:engine/model/document~
|
|
42
|
+
* The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection}:
|
|
43
43
|
*
|
|
44
44
|
* * If the selection is on a range, the command applies the attribute to all nodes in that range
|
|
45
|
-
* (if they are allowed to have this attribute by the {@link module:engine/model/schema~
|
|
45
|
+
* (if they are allowed to have this attribute by the {@link module:engine/model/schema~ModelSchema schema}).
|
|
46
46
|
* * If the selection is collapsed in a non-empty node, the command applies the attribute to the
|
|
47
|
-
* {@link module:engine/model/document~
|
|
47
|
+
* {@link module:engine/model/document~ModelDocument#selection} itself (note that typed characters copy attributes from the selection).
|
|
48
48
|
* * If the selection is collapsed in an empty node, the command applies the attribute to the parent node of the selection (note
|
|
49
49
|
* that the selection inherits all attributes from a node if it is in an empty node).
|
|
50
50
|
*
|
|
@@ -172,6 +172,8 @@ const BOLD$1 = 'bold';
|
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Returns a function that creates a (toolbar or menu bar) button for a basic style feature.
|
|
175
|
+
*
|
|
176
|
+
* @internal
|
|
175
177
|
*/ function getButtonCreator({ editor, commandName, plugin, icon, label, keystroke }) {
|
|
176
178
|
return (ButtonClass)=>{
|
|
177
179
|
const command = editor.commands.get(commandName);
|
|
@@ -961,5 +963,5 @@ const UNDERLINE = 'underline';
|
|
|
961
963
|
}
|
|
962
964
|
}
|
|
963
965
|
|
|
964
|
-
export { AttributeCommand, Bold, BoldEditing, BoldUI, Code, CodeEditing, CodeUI, Italic, ItalicEditing, ItalicUI, Strikethrough, StrikethroughEditing, StrikethroughUI, Subscript, SubscriptEditing, SubscriptUI, Superscript, SuperscriptEditing, SuperscriptUI, Underline, UnderlineEditing, UnderlineUI };
|
|
966
|
+
export { AttributeCommand, Bold, BoldEditing, BoldUI, Code, CodeEditing, CodeUI, Italic, ItalicEditing, ItalicUI, Strikethrough, StrikethroughEditing, StrikethroughUI, Subscript, SubscriptEditing, SubscriptUI, Superscript, SuperscriptEditing, SuperscriptUI, Underline, UnderlineEditing, UnderlineUI, getButtonCreator as _getBasicStylesButtonCreator };
|
|
965
967
|
//# sourceMappingURL=index.js.map
|