@ckeditor/ckeditor5-block-quote 35.3.2 → 36.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor 5 block quote feature** – https://github.com/ckeditor/ckeditor5-block-quote <br>
5
- Copyright (c) 2003-2022, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -1,5 +1,5 @@
1
1
  !function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"Block quote":"Block quote"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
2
2
  /*!
3
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
4
4
  * For licensing, see LICENSE.md.
5
5
  */(()=>{var e={446:(e,t,o)=>{"use strict";o.d(t,{Z:()=>i});var n=o(609),r=o.n(n)()((function(e){return e[1]}));r.push([e.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}",""]);const i=r},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var o=e(t);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(e,o,n){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(n)for(var i=0;i<this.length;i++){var c=this[i][0];null!=c&&(r[c]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);n&&r[l[0]]||(o&&(l[2]?l[2]="".concat(o," and ").concat(l[2]):l[2]=o),t.push(l))}},t}},62:(e,t,o)=>{"use strict";var n,r=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},i=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),c=[];function s(e){for(var t=-1,o=0;o<c.length;o++)if(c[o].identifier===e){t=o;break}return t}function l(e,t){for(var o={},n=[],r=0;r<e.length;r++){var i=e[r],l=t.base?i[0]+t.base:i[0],a=o[l]||0,u="".concat(l," ").concat(a);o[l]=a+1;var d=s(u),f={css:i[1],media:i[2],sourceMap:i[3]};-1!==d?(c[d].references++,c[d].updater(f)):c.push({identifier:u,updater:v(f,t),references:1}),n.push(u)}return n}function a(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var r=o.nc;r&&(n.nonce=r)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var c=i(e.insert||"head");if(!c)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");c.appendChild(t)}return t}var u,d=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function f(e,t,o,n){var r=o?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,r);else{var i=document.createTextNode(r),c=e.childNodes;c[t]&&e.removeChild(c[t]),c.length?e.insertBefore(i,c[t]):e.appendChild(i)}}function p(e,t,o){var n=o.css,r=o.media,i=o.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var m=null,h=0;function v(e,t){var o,n,r;if(t.singleton){var i=h++;o=m||(m=a(t)),n=f.bind(null,o,i,!1),r=f.bind(null,o,i,!0)}else o=a(t),n=p.bind(null,o,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var o=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<o.length;n++){var r=s(o[n]);c[r].references--}for(var i=l(e,t),a=0;a<o.length;a++){var u=s(o[a]);0===c[u].references&&(c[u].updater(),c.splice(u,1))}o=i}}}},704:(e,t,o)=>{e.exports=o(79)("./src/core.js")},331:(e,t,o)=>{e.exports=o(79)("./src/enter.js")},181:(e,t,o)=>{e.exports=o(79)("./src/typing.js")},273:(e,t,o)=>{e.exports=o(79)("./src/ui.js")},209:(e,t,o)=>{e.exports=o(79)("./src/utils.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,exports:{}};return e[n](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var n={};(()=>{"use strict";o.r(n),o.d(n,{BlockQuote:()=>g,BlockQuoteEditing:()=>u,BlockQuoteUI:()=>v});var e=o(704),t=o(331),r=o(181),i=o(209);class c extends e.Command{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,n=t.document.selection,r=Array.from(n.getSelectedBlocks()),i=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(i){const t=r.filter((e=>s(e)||a(o,e)));this._applyQuote(e,t)}else this._removeQuote(e,r.filter(s))}))}_getValue(){const e=this.editor.model.document.selection,t=(0,i.first)(e.getSelectedBlocks());return!(!t||!s(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=(0,i.first)(e.getSelectedBlocks());return!!o&&a(t,o)}_removeQuote(e,t){l(e,t).reverse().forEach((t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const o=e.createPositionBefore(t.start.parent);return void e.move(t,o)}t.end.isAtEnd||e.split(t.end);const o=e.createPositionAfter(t.end.parent);e.move(t,o)}))}_applyQuote(e,t){const o=[];l(e,t).reverse().forEach((t=>{let n=s(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),o.push(n)})),o.reverse().reduce(((t,o)=>t.nextSibling==o?(e.merge(e.createPositionAfter(t)),t):o))}}function s(e){return"blockQuote"==e.parent.name?e.parent:null}function l(e,t){let o,n=0;const r=[];for(;n<t.length;){const i=t[n],c=t[n+1];o||(o=e.createPositionBefore(i)),c&&i.nextSibling==c||(r.push(e.createRange(o,e.createPositionAfter(i))),o=null),n++}return r}function a(e,t){const o=e.checkChild(t.parent,"blockQuote"),n=e.checkChild(["$root","blockQuote"],t);return o&&n}class u extends e.Plugin{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[t.Enter,r.Delete]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new c(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer((o=>{const n=e.model.document.differ.getChanges();for(const e of n)if("insert"==e.type){const n=e.position.nodeAfter;if(!n)continue;if(n.is("element","blockQuote")&&n.isEmpty)return o.remove(n),!0;if(n.is("element","blockQuote")&&!t.checkChild(e.position,n))return o.unwrap(n),!0;if(n.is("element")){const e=o.createRangeIn(n);for(const n of e.getItems())if(n.is("element","blockQuote")&&!t.checkChild(o.createPositionBefore(n),n))return o.unwrap(n),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return o.remove(t),!0}return!1}));const o=this.editor.editing.view.document,n=e.model.document.selection,r=e.commands.get("blockQuote");this.listenTo(o,"enter",((t,o)=>{if(!n.isCollapsed||!r.value)return;n.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),o.preventDefault(),t.stop())}),{context:"blockquote"}),this.listenTo(o,"delete",((t,o)=>{if("backward"!=o.direction||!n.isCollapsed||!r.value)return;const i=n.getLastPosition().parent;i.isEmpty&&!i.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),o.preventDefault(),t.stop())}),{context:"blockquote"})}}var d=o(273),f=o(62),p=o.n(f),m=o(446),h={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};p()(m.Z,h);m.Z.locals;class v extends e.Plugin{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,o=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const r=t.commands.get("blockQuote"),i=new d.ButtonView(n);return i.set({label:o("Block quote"),icon:e.icons.quote,tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),i}))}}class g extends e.Plugin{static get requires(){return[u,v]}static get pluginName(){return"BlockQuote"}}})(),(window.CKEditor5=window.CKEditor5||{}).blockQuote=n})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-block-quote",
3
- "version": "35.3.2",
3
+ "version": "36.0.0",
4
4
  "description": "Block quote feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,22 +12,23 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^35.3.2"
15
+ "ckeditor5": "^36.0.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-basic-styles": "^35.3.2",
19
- "@ckeditor/ckeditor5-core": "^35.3.2",
20
- "@ckeditor/ckeditor5-dev-utils": "^31.0.0",
21
- "@ckeditor/ckeditor5-editor-classic": "^35.3.2",
22
- "@ckeditor/ckeditor5-engine": "^35.3.2",
23
- "@ckeditor/ckeditor5-enter": "^35.3.2",
24
- "@ckeditor/ckeditor5-heading": "^35.3.2",
25
- "@ckeditor/ckeditor5-image": "^35.3.2",
26
- "@ckeditor/ckeditor5-list": "^35.3.2",
27
- "@ckeditor/ckeditor5-paragraph": "^35.3.2",
28
- "@ckeditor/ckeditor5-table": "^35.3.2",
29
- "@ckeditor/ckeditor5-theme-lark": "^35.3.2",
30
- "@ckeditor/ckeditor5-typing": "^35.3.2",
18
+ "@ckeditor/ckeditor5-basic-styles": "^36.0.0",
19
+ "@ckeditor/ckeditor5-core": "^36.0.0",
20
+ "@ckeditor/ckeditor5-dev-utils": "^32.0.0",
21
+ "@ckeditor/ckeditor5-editor-classic": "^36.0.0",
22
+ "@ckeditor/ckeditor5-engine": "^36.0.0",
23
+ "@ckeditor/ckeditor5-enter": "^36.0.0",
24
+ "@ckeditor/ckeditor5-heading": "^36.0.0",
25
+ "@ckeditor/ckeditor5-image": "^36.0.0",
26
+ "@ckeditor/ckeditor5-list": "^36.0.0",
27
+ "@ckeditor/ckeditor5-paragraph": "^36.0.0",
28
+ "@ckeditor/ckeditor5-table": "^36.0.0",
29
+ "@ckeditor/ckeditor5-theme-lark": "^36.0.0",
30
+ "@ckeditor/ckeditor5-typing": "^36.0.0",
31
+ "typescript": "^4.8.4",
31
32
  "webpack": "^5.58.1",
32
33
  "webpack-cli": "^4.9.0"
33
34
  },
@@ -46,13 +47,16 @@
46
47
  },
47
48
  "files": [
48
49
  "lang",
49
- "src",
50
+ "src/**/*.js",
51
+ "src/**/*.d.ts",
50
52
  "theme",
51
53
  "build",
52
54
  "ckeditor5-metadata.json",
53
55
  "CHANGELOG.md"
54
56
  ],
55
57
  "scripts": {
56
- "dll:build": "webpack"
58
+ "dll:build": "webpack",
59
+ "build": "tsc -p ./tsconfig.release.json",
60
+ "postversion": "npm run build"
57
61
  }
58
62
  }
package/src/blockquote.js CHANGED
@@ -1,17 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module block-quote/blockquote
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
-
12
9
  import BlockQuoteEditing from './blockquoteediting';
13
10
  import BlockQuoteUI from './blockquoteui';
14
-
15
11
  /**
16
12
  * The block quote plugin.
17
13
  *
@@ -23,17 +19,16 @@ import BlockQuoteUI from './blockquoteui';
23
19
  * @extends module:core/plugin~Plugin
24
20
  */
25
21
  export default class BlockQuote extends Plugin {
26
- /**
27
- * @inheritDoc
28
- */
29
- static get requires() {
30
- return [ BlockQuoteEditing, BlockQuoteUI ];
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- static get pluginName() {
37
- return 'BlockQuote';
38
- }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires() {
26
+ return [BlockQuoteEditing, BlockQuoteUI];
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get pluginName() {
32
+ return 'BlockQuote';
33
+ }
39
34
  }
@@ -1,232 +1,172 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module block-quote/blockquotecommand
8
7
  */
9
-
10
8
  import { Command } from 'ckeditor5/src/core';
11
9
  import { first } from 'ckeditor5/src/utils';
12
-
13
10
  /**
14
11
  * The block quote command plugin.
15
12
  *
16
13
  * @extends module:core/command~Command
17
14
  */
18
15
  export default class BlockQuoteCommand extends Command {
19
- /**
20
- * Whether the selection starts in a block quote.
21
- *
22
- * @observable
23
- * @readonly
24
- * @member {Boolean} #value
25
- */
26
-
27
- /**
28
- * @inheritDoc
29
- */
30
- refresh() {
31
- this.value = this._getValue();
32
- this.isEnabled = this._checkEnabled();
33
- }
34
-
35
- /**
36
- * Executes the command. When the command {@link #value is on}, all top-most block quotes within
37
- * the selection will be removed. If it is off, all selected blocks will be wrapped with
38
- * a block quote.
39
- *
40
- * @fires execute
41
- * @param {Object} [options] Command options.
42
- * @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply a block quote,
43
- * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.
44
- */
45
- execute( options = {} ) {
46
- const model = this.editor.model;
47
- const schema = model.schema;
48
- const selection = model.document.selection;
49
-
50
- const blocks = Array.from( selection.getSelectedBlocks() );
51
-
52
- const value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;
53
-
54
- model.change( writer => {
55
- if ( !value ) {
56
- this._removeQuote( writer, blocks.filter( findQuote ) );
57
- } else {
58
- const blocksToQuote = blocks.filter( block => {
59
- // Already quoted blocks needs to be considered while quoting too
60
- // in order to reuse their <bQ> elements.
61
- return findQuote( block ) || checkCanBeQuoted( schema, block );
62
- } );
63
-
64
- this._applyQuote( writer, blocksToQuote );
65
- }
66
- } );
67
- }
68
-
69
- /**
70
- * Checks the command's {@link #value}.
71
- *
72
- * @private
73
- * @returns {Boolean} The current value.
74
- */
75
- _getValue() {
76
- const selection = this.editor.model.document.selection;
77
-
78
- const firstBlock = first( selection.getSelectedBlocks() );
79
-
80
- // In the current implementation, the block quote must be an immediate parent of a block element.
81
- return !!( firstBlock && findQuote( firstBlock ) );
82
- }
83
-
84
- /**
85
- * Checks whether the command can be enabled in the current context.
86
- *
87
- * @private
88
- * @returns {Boolean} Whether the command should be enabled.
89
- */
90
- _checkEnabled() {
91
- if ( this.value ) {
92
- return true;
93
- }
94
-
95
- const selection = this.editor.model.document.selection;
96
- const schema = this.editor.model.schema;
97
-
98
- const firstBlock = first( selection.getSelectedBlocks() );
99
-
100
- if ( !firstBlock ) {
101
- return false;
102
- }
103
-
104
- return checkCanBeQuoted( schema, firstBlock );
105
- }
106
-
107
- /**
108
- * Removes the quote from given blocks.
109
- *
110
- * If blocks which are supposed to be "unquoted" are in the middle of a quote,
111
- * start it or end it, then the quote will be split (if needed) and the blocks
112
- * will be moved out of it, so other quoted blocks remained quoted.
113
- *
114
- * @private
115
- * @param {module:engine/model/writer~Writer} writer
116
- * @param {Array.<module:engine/model/element~Element>} blocks
117
- */
118
- _removeQuote( writer, blocks ) {
119
- // Unquote all groups of block. Iterate in the reverse order to not break following ranges.
120
- getRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {
121
- if ( groupRange.start.isAtStart && groupRange.end.isAtEnd ) {
122
- writer.unwrap( groupRange.start.parent );
123
-
124
- return;
125
- }
126
-
127
- // The group of blocks are at the beginning of an <bQ> so let's move them left (out of the <bQ>).
128
- if ( groupRange.start.isAtStart ) {
129
- const positionBefore = writer.createPositionBefore( groupRange.start.parent );
130
-
131
- writer.move( groupRange, positionBefore );
132
-
133
- return;
134
- }
135
-
136
- // The blocks are in the middle of an <bQ> so we need to split the <bQ> after the last block
137
- // so we move the items there.
138
- if ( !groupRange.end.isAtEnd ) {
139
- writer.split( groupRange.end );
140
- }
141
-
142
- // Now we are sure that groupRange.end.isAtEnd is true, so let's move the blocks right.
143
-
144
- const positionAfter = writer.createPositionAfter( groupRange.end.parent );
145
-
146
- writer.move( groupRange, positionAfter );
147
- } );
148
- }
149
-
150
- /**
151
- * Applies the quote to given blocks.
152
- *
153
- * @private
154
- * @param {module:engine/model/writer~Writer} writer
155
- * @param {Array.<module:engine/model/element~Element>} blocks
156
- */
157
- _applyQuote( writer, blocks ) {
158
- const quotesToMerge = [];
159
-
160
- // Quote all groups of block. Iterate in the reverse order to not break following ranges.
161
- getRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {
162
- let quote = findQuote( groupRange.start );
163
-
164
- if ( !quote ) {
165
- quote = writer.createElement( 'blockQuote' );
166
-
167
- writer.wrap( groupRange, quote );
168
- }
169
-
170
- quotesToMerge.push( quote );
171
- } );
172
-
173
- // Merge subsequent <bQ> elements. Reverse the order again because this time we want to go through
174
- // the <bQ> elements in the source order (due to how merge works – it moves the right element's content
175
- // to the first element and removes the right one. Since we may need to merge a couple of subsequent `<bQ>` elements
176
- // we want to keep the reference to the first (furthest left) one.
177
- quotesToMerge.reverse().reduce( ( currentQuote, nextQuote ) => {
178
- if ( currentQuote.nextSibling == nextQuote ) {
179
- writer.merge( writer.createPositionAfter( currentQuote ) );
180
-
181
- return currentQuote;
182
- }
183
-
184
- return nextQuote;
185
- } );
186
- }
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ refresh() {
20
+ this.value = this._getValue();
21
+ this.isEnabled = this._checkEnabled();
22
+ }
23
+ /**
24
+ * Executes the command. When the command {@link #value is on}, all top-most block quotes within
25
+ * the selection will be removed. If it is off, all selected blocks will be wrapped with
26
+ * a block quote.
27
+ *
28
+ * @fires execute
29
+ * @param options Command options.
30
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block quote,
31
+ * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.
32
+ */
33
+ execute(options = {}) {
34
+ const model = this.editor.model;
35
+ const schema = model.schema;
36
+ const selection = model.document.selection;
37
+ const blocks = Array.from(selection.getSelectedBlocks());
38
+ const value = (options.forceValue === undefined) ? !this.value : options.forceValue;
39
+ model.change(writer => {
40
+ if (!value) {
41
+ this._removeQuote(writer, blocks.filter(findQuote));
42
+ }
43
+ else {
44
+ const blocksToQuote = blocks.filter(block => {
45
+ // Already quoted blocks needs to be considered while quoting too
46
+ // in order to reuse their <bQ> elements.
47
+ return findQuote(block) || checkCanBeQuoted(schema, block);
48
+ });
49
+ this._applyQuote(writer, blocksToQuote);
50
+ }
51
+ });
52
+ }
53
+ /**
54
+ * Checks the command's {@link #value}.
55
+ */
56
+ _getValue() {
57
+ const selection = this.editor.model.document.selection;
58
+ const firstBlock = first(selection.getSelectedBlocks());
59
+ // In the current implementation, the block quote must be an immediate parent of a block element.
60
+ return !!(firstBlock && findQuote(firstBlock));
61
+ }
62
+ /**
63
+ * Checks whether the command can be enabled in the current context.
64
+ *
65
+ * @returns Whether the command should be enabled.
66
+ */
67
+ _checkEnabled() {
68
+ if (this.value) {
69
+ return true;
70
+ }
71
+ const selection = this.editor.model.document.selection;
72
+ const schema = this.editor.model.schema;
73
+ const firstBlock = first(selection.getSelectedBlocks());
74
+ if (!firstBlock) {
75
+ return false;
76
+ }
77
+ return checkCanBeQuoted(schema, firstBlock);
78
+ }
79
+ /**
80
+ * Removes the quote from given blocks.
81
+ *
82
+ * If blocks which are supposed to be "unquoted" are in the middle of a quote,
83
+ * start it or end it, then the quote will be split (if needed) and the blocks
84
+ * will be moved out of it, so other quoted blocks remained quoted.
85
+ */
86
+ _removeQuote(writer, blocks) {
87
+ // Unquote all groups of block. Iterate in the reverse order to not break following ranges.
88
+ getRangesOfBlockGroups(writer, blocks).reverse().forEach(groupRange => {
89
+ if (groupRange.start.isAtStart && groupRange.end.isAtEnd) {
90
+ writer.unwrap(groupRange.start.parent);
91
+ return;
92
+ }
93
+ // The group of blocks are at the beginning of an <bQ> so let's move them left (out of the <bQ>).
94
+ if (groupRange.start.isAtStart) {
95
+ const positionBefore = writer.createPositionBefore(groupRange.start.parent);
96
+ writer.move(groupRange, positionBefore);
97
+ return;
98
+ }
99
+ // The blocks are in the middle of an <bQ> so we need to split the <bQ> after the last block
100
+ // so we move the items there.
101
+ if (!groupRange.end.isAtEnd) {
102
+ writer.split(groupRange.end);
103
+ }
104
+ // Now we are sure that groupRange.end.isAtEnd is true, so let's move the blocks right.
105
+ const positionAfter = writer.createPositionAfter(groupRange.end.parent);
106
+ writer.move(groupRange, positionAfter);
107
+ });
108
+ }
109
+ /**
110
+ * Applies the quote to given blocks.
111
+ */
112
+ _applyQuote(writer, blocks) {
113
+ const quotesToMerge = [];
114
+ // Quote all groups of block. Iterate in the reverse order to not break following ranges.
115
+ getRangesOfBlockGroups(writer, blocks).reverse().forEach(groupRange => {
116
+ let quote = findQuote(groupRange.start);
117
+ if (!quote) {
118
+ quote = writer.createElement('blockQuote');
119
+ writer.wrap(groupRange, quote);
120
+ }
121
+ quotesToMerge.push(quote);
122
+ });
123
+ // Merge subsequent <bQ> elements. Reverse the order again because this time we want to go through
124
+ // the <bQ> elements in the source order (due to how merge works it moves the right element's content
125
+ // to the first element and removes the right one. Since we may need to merge a couple of subsequent `<bQ>` elements
126
+ // we want to keep the reference to the first (furthest left) one.
127
+ quotesToMerge.reverse().reduce((currentQuote, nextQuote) => {
128
+ if (currentQuote.nextSibling == nextQuote) {
129
+ writer.merge(writer.createPositionAfter(currentQuote));
130
+ return currentQuote;
131
+ }
132
+ return nextQuote;
133
+ });
134
+ }
187
135
  }
188
-
189
- function findQuote( elementOrPosition ) {
190
- return elementOrPosition.parent.name == 'blockQuote' ? elementOrPosition.parent : null;
136
+ function findQuote(elementOrPosition) {
137
+ return elementOrPosition.parent.name == 'blockQuote' ? elementOrPosition.parent : null;
191
138
  }
192
-
193
- // Returns a minimal array of ranges containing groups of subsequent blocks.
194
- //
195
- // content: abcdefgh
196
- // blocks: [ a, b, d, f, g, h ]
197
- // output ranges: [ab]c[d]e[fgh]
198
- //
199
- // @param {Array.<module:engine/model/element~Element>} blocks
200
- // @returns {Array.<module:engine/model/range~Range>}
201
- function getRangesOfBlockGroups( writer, blocks ) {
202
- let startPosition;
203
- let i = 0;
204
- const ranges = [];
205
-
206
- while ( i < blocks.length ) {
207
- const block = blocks[ i ];
208
- const nextBlock = blocks[ i + 1 ];
209
-
210
- if ( !startPosition ) {
211
- startPosition = writer.createPositionBefore( block );
212
- }
213
-
214
- if ( !nextBlock || block.nextSibling != nextBlock ) {
215
- ranges.push( writer.createRange( startPosition, writer.createPositionAfter( block ) ) );
216
- startPosition = null;
217
- }
218
-
219
- i++;
220
- }
221
-
222
- return ranges;
139
+ /**
140
+ * Returns a minimal array of ranges containing groups of subsequent blocks.
141
+ *
142
+ * content: abcdefgh
143
+ * blocks: [ a, b, d, f, g, h ]
144
+ * output ranges: [ab]c[d]e[fgh]
145
+ */
146
+ function getRangesOfBlockGroups(writer, blocks) {
147
+ let startPosition;
148
+ let i = 0;
149
+ const ranges = [];
150
+ while (i < blocks.length) {
151
+ const block = blocks[i];
152
+ const nextBlock = blocks[i + 1];
153
+ if (!startPosition) {
154
+ startPosition = writer.createPositionBefore(block);
155
+ }
156
+ if (!nextBlock || block.nextSibling != nextBlock) {
157
+ ranges.push(writer.createRange(startPosition, writer.createPositionAfter(block)));
158
+ startPosition = null;
159
+ }
160
+ i++;
161
+ }
162
+ return ranges;
223
163
  }
224
-
225
- // Checks whether <bQ> can wrap the block.
226
- function checkCanBeQuoted( schema, block ) {
227
- // TMP will be replaced with schema.checkWrap().
228
- const isBQAllowed = schema.checkChild( block.parent, 'blockQuote' );
229
- const isBlockAllowedInBQ = schema.checkChild( [ '$root', 'blockQuote' ], block );
230
-
231
- return isBQAllowed && isBlockAllowedInBQ;
164
+ /**
165
+ * Checks whether <bQ> can wrap the block.
166
+ */
167
+ function checkCanBeQuoted(schema, block) {
168
+ // TMP will be replaced with schema.checkWrap().
169
+ const isBQAllowed = schema.checkChild(block.parent, 'blockQuote');
170
+ const isBlockAllowedInBQ = schema.checkChild(['$root', 'blockQuote'], block);
171
+ return isBQAllowed && isBlockAllowedInBQ;
232
172
  }
@@ -1,18 +1,14 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module block-quote/blockquoteediting
8
7
  */
9
-
10
8
  import { Plugin } from 'ckeditor5/src/core';
11
9
  import { Enter } from 'ckeditor5/src/enter';
12
10
  import { Delete } from 'ckeditor5/src/typing';
13
-
14
11
  import BlockQuoteCommand from './blockquotecommand';
15
-
16
12
  /**
17
13
  * The block quote editing.
18
14
  *
@@ -21,126 +17,102 @@ import BlockQuoteCommand from './blockquotecommand';
21
17
  * @extends module:core/plugin~Plugin
22
18
  */
23
19
  export default class BlockQuoteEditing extends Plugin {
24
- /**
25
- * @inheritDoc
26
- */
27
- static get pluginName() {
28
- return 'BlockQuoteEditing';
29
- }
30
-
31
- /**
32
- * @inheritDoc
33
- */
34
- static get requires() {
35
- return [ Enter, Delete ];
36
- }
37
-
38
- /**
39
- * @inheritDoc
40
- */
41
- init() {
42
- const editor = this.editor;
43
- const schema = editor.model.schema;
44
-
45
- editor.commands.add( 'blockQuote', new BlockQuoteCommand( editor ) );
46
-
47
- schema.register( 'blockQuote', {
48
- inheritAllFrom: '$container'
49
- } );
50
-
51
- editor.conversion.elementToElement( { model: 'blockQuote', view: 'blockquote' } );
52
-
53
- // Postfixer which cleans incorrect model states connected with block quotes.
54
- editor.model.document.registerPostFixer( writer => {
55
- const changes = editor.model.document.differ.getChanges();
56
-
57
- for ( const entry of changes ) {
58
- if ( entry.type == 'insert' ) {
59
- const element = entry.position.nodeAfter;
60
-
61
- if ( !element ) {
62
- // We are inside a text node.
63
- continue;
64
- }
65
-
66
- if ( element.is( 'element', 'blockQuote' ) && element.isEmpty ) {
67
- // Added an empty blockQuote - remove it.
68
- writer.remove( element );
69
-
70
- return true;
71
- } else if ( element.is( 'element', 'blockQuote' ) && !schema.checkChild( entry.position, element ) ) {
72
- // Added a blockQuote in incorrect place. Unwrap it so the content inside is not lost.
73
- writer.unwrap( element );
74
-
75
- return true;
76
- } else if ( element.is( 'element' ) ) {
77
- // Just added an element. Check that all children meet the scheme rules.
78
- const range = writer.createRangeIn( element );
79
-
80
- for ( const child of range.getItems() ) {
81
- if (
82
- child.is( 'element', 'blockQuote' ) &&
83
- !schema.checkChild( writer.createPositionBefore( child ), child )
84
- ) {
85
- writer.unwrap( child );
86
-
87
- return true;
88
- }
89
- }
90
- }
91
- } else if ( entry.type == 'remove' ) {
92
- const parent = entry.position.parent;
93
-
94
- if ( parent.is( 'element', 'blockQuote' ) && parent.isEmpty ) {
95
- // Something got removed and now blockQuote is empty. Remove the blockQuote as well.
96
- writer.remove( parent );
97
-
98
- return true;
99
- }
100
- }
101
- }
102
-
103
- return false;
104
- } );
105
-
106
- const viewDocument = this.editor.editing.view.document;
107
- const selection = editor.model.document.selection;
108
- const blockQuoteCommand = editor.commands.get( 'blockQuote' );
109
-
110
- // Overwrite default Enter key behavior.
111
- // If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.
112
- this.listenTo( viewDocument, 'enter', ( evt, data ) => {
113
- if ( !selection.isCollapsed || !blockQuoteCommand.value ) {
114
- return;
115
- }
116
-
117
- const positionParent = selection.getLastPosition().parent;
118
-
119
- if ( positionParent.isEmpty ) {
120
- editor.execute( 'blockQuote' );
121
- editor.editing.view.scrollToTheSelection();
122
-
123
- data.preventDefault();
124
- evt.stop();
125
- }
126
- }, { context: 'blockquote' } );
127
-
128
- // Overwrite default Backspace key behavior.
129
- // If Backspace key is pressed with selection collapsed in first empty block inside a quote, break the quote.
130
- this.listenTo( viewDocument, 'delete', ( evt, data ) => {
131
- if ( data.direction != 'backward' || !selection.isCollapsed || !blockQuoteCommand.value ) {
132
- return;
133
- }
134
-
135
- const positionParent = selection.getLastPosition().parent;
136
-
137
- if ( positionParent.isEmpty && !positionParent.previousSibling ) {
138
- editor.execute( 'blockQuote' );
139
- editor.editing.view.scrollToTheSelection();
140
-
141
- data.preventDefault();
142
- evt.stop();
143
- }
144
- }, { context: 'blockquote' } );
145
- }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName() {
24
+ return 'BlockQuoteEditing';
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [Enter, Delete];
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init() {
36
+ const editor = this.editor;
37
+ const schema = editor.model.schema;
38
+ editor.commands.add('blockQuote', new BlockQuoteCommand(editor));
39
+ schema.register('blockQuote', {
40
+ inheritAllFrom: '$container'
41
+ });
42
+ editor.conversion.elementToElement({ model: 'blockQuote', view: 'blockquote' });
43
+ // Postfixer which cleans incorrect model states connected with block quotes.
44
+ editor.model.document.registerPostFixer(writer => {
45
+ const changes = editor.model.document.differ.getChanges();
46
+ for (const entry of changes) {
47
+ if (entry.type == 'insert') {
48
+ const element = entry.position.nodeAfter;
49
+ if (!element) {
50
+ // We are inside a text node.
51
+ continue;
52
+ }
53
+ if (element.is('element', 'blockQuote') && element.isEmpty) {
54
+ // Added an empty blockQuote - remove it.
55
+ writer.remove(element);
56
+ return true;
57
+ }
58
+ else if (element.is('element', 'blockQuote') && !schema.checkChild(entry.position, element)) {
59
+ // Added a blockQuote in incorrect place. Unwrap it so the content inside is not lost.
60
+ writer.unwrap(element);
61
+ return true;
62
+ }
63
+ else if (element.is('element')) {
64
+ // Just added an element. Check that all children meet the scheme rules.
65
+ const range = writer.createRangeIn(element);
66
+ for (const child of range.getItems()) {
67
+ if (child.is('element', 'blockQuote') &&
68
+ !schema.checkChild(writer.createPositionBefore(child), child)) {
69
+ writer.unwrap(child);
70
+ return true;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ else if (entry.type == 'remove') {
76
+ const parent = entry.position.parent;
77
+ if (parent.is('element', 'blockQuote') && parent.isEmpty) {
78
+ // Something got removed and now blockQuote is empty. Remove the blockQuote as well.
79
+ writer.remove(parent);
80
+ return true;
81
+ }
82
+ }
83
+ }
84
+ return false;
85
+ });
86
+ const viewDocument = this.editor.editing.view.document;
87
+ const selection = editor.model.document.selection;
88
+ const blockQuoteCommand = editor.commands.get('blockQuote');
89
+ // Overwrite default Enter key behavior.
90
+ // If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.
91
+ this.listenTo(viewDocument, 'enter', (evt, data) => {
92
+ if (!selection.isCollapsed || !blockQuoteCommand.value) {
93
+ return;
94
+ }
95
+ const positionParent = selection.getLastPosition().parent;
96
+ if (positionParent.isEmpty) {
97
+ editor.execute('blockQuote');
98
+ editor.editing.view.scrollToTheSelection();
99
+ data.preventDefault();
100
+ evt.stop();
101
+ }
102
+ }, { context: 'blockquote' });
103
+ // Overwrite default Backspace key behavior.
104
+ // If Backspace key is pressed with selection collapsed in first empty block inside a quote, break the quote.
105
+ this.listenTo(viewDocument, 'delete', (evt, data) => {
106
+ if (data.direction != 'backward' || !selection.isCollapsed || !blockQuoteCommand.value) {
107
+ return;
108
+ }
109
+ const positionParent = selection.getLastPosition().parent;
110
+ if (positionParent.isEmpty && !positionParent.previousSibling) {
111
+ editor.execute('blockQuote');
112
+ editor.editing.view.scrollToTheSelection();
113
+ data.preventDefault();
114
+ evt.stop();
115
+ }
116
+ }, { context: 'blockquote' });
117
+ }
146
118
  }
@@ -1,17 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module block-quote/blockquoteui
8
7
  */
9
-
10
8
  import { Plugin, icons } from 'ckeditor5/src/core';
11
9
  import { ButtonView } from 'ckeditor5/src/ui';
12
-
13
10
  import '../theme/blockquote.css';
14
-
15
11
  /**
16
12
  * The block quote UI plugin.
17
13
  *
@@ -20,41 +16,35 @@ import '../theme/blockquote.css';
20
16
  * @extends module:core/plugin~Plugin
21
17
  */
22
18
  export default class BlockQuoteUI extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName() {
27
- return 'BlockQuoteUI';
28
- }
29
-
30
- /**
31
- * @inheritDoc
32
- */
33
- init() {
34
- const editor = this.editor;
35
- const t = editor.t;
36
-
37
- editor.ui.componentFactory.add( 'blockQuote', locale => {
38
- const command = editor.commands.get( 'blockQuote' );
39
- const buttonView = new ButtonView( locale );
40
-
41
- buttonView.set( {
42
- label: t( 'Block quote' ),
43
- icon: icons.quote,
44
- tooltip: true,
45
- isToggleable: true
46
- } );
47
-
48
- // Bind button model to command.
49
- buttonView.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
50
-
51
- // Execute command.
52
- this.listenTo( buttonView, 'execute', () => {
53
- editor.execute( 'blockQuote' );
54
- editor.editing.view.focus();
55
- } );
56
-
57
- return buttonView;
58
- } );
59
- }
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName() {
23
+ return 'BlockQuoteUI';
24
+ }
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ init() {
29
+ const editor = this.editor;
30
+ const t = editor.t;
31
+ editor.ui.componentFactory.add('blockQuote', locale => {
32
+ const command = editor.commands.get('blockQuote');
33
+ const buttonView = new ButtonView(locale);
34
+ buttonView.set({
35
+ label: t('Block quote'),
36
+ icon: icons.quote,
37
+ tooltip: true,
38
+ isToggleable: true
39
+ });
40
+ // Bind button model to command.
41
+ buttonView.bind('isOn', 'isEnabled').to(command, 'value', 'isEnabled');
42
+ // Execute command.
43
+ this.listenTo(buttonView, 'execute', () => {
44
+ editor.execute('blockQuote');
45
+ editor.editing.view.focus();
46
+ });
47
+ return buttonView;
48
+ });
49
+ }
60
50
  }
package/src/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module block-quote
8
7
  */
9
-
10
8
  export { default as BlockQuote } from './blockquote';
11
9
  export { default as BlockQuoteEditing } from './blockquoteediting';
12
10
  export { default as BlockQuoteUI } from './blockquoteui';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack://CKEditor5.blockQuote/./theme/blockquote.css","webpack://CKEditor5.blockQuote/../node_modules/css-loader/dist/runtime/api.js","webpack://CKEditor5.blockQuote/../node_modules/css-loader/dist/runtime/cssWithMappingToString.js","webpack://CKEditor5.blockQuote/./theme/blockquote.css?f62a","webpack://CKEditor5.blockQuote/../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js","webpack://CKEditor5.blockQuote/./src/blockquote.js","webpack://CKEditor5.blockQuote/./src/blockquotecommand.js","webpack://CKEditor5.blockQuote/./src/blockquoteediting.js","webpack://CKEditor5.blockQuote/./src/blockquoteui.js","webpack://CKEditor5.blockQuote/delegated \"./src/core.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.blockQuote/delegated \"./src/enter.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.blockQuote/delegated \"./src/typing.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.blockQuote/delegated \"./src/ui.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.blockQuote/delegated \"./src/utils.js\" from dll-reference CKEditor5.dll","webpack://CKEditor5.blockQuote/external var \"CKEditor5.dll\"","webpack://CKEditor5.blockQuote/webpack/bootstrap","webpack://CKEditor5.blockQuote/webpack/runtime/compat get default export","webpack://CKEditor5.blockQuote/webpack/runtime/define property getters","webpack://CKEditor5.blockQuote/webpack/runtime/hasOwnProperty shorthand","webpack://CKEditor5.blockQuote/webpack/runtime/make namespace object","webpack://CKEditor5.blockQuote/webpack/runtime/nonce","webpack://CKEditor5.blockQuote/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAC4H;AAC7B;AAC/F,8BAA8B,mFAA2B,CAAC,wGAAqC;AAC/F;AACA,iEAAiE,2BAA2B,kBAAkB,cAAc,eAAe,gBAAgB,mBAAmB,oBAAoB,gCAAgC,cAAc,4BAA4B,OAAO,+ZAA+Z,sCAAsC,gGAAgG,wBAAwB,qBAAqB,oBAAoB,uBAAuB,2CAA2C,GAAG,yCAAyC,mBAAmB,4CAA4C,GAAG,qBAAqB;AAC9jC;AACA,iEAAe,uBAAuB,EAAC;;;;;;;;;;;;ACP1B;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA,4CAA4C,qBAAqB;AACjE;;AAEA;AACA,KAAK;AACL,KAAK;AACL;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,iBAAiB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,qBAAqB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACjEa;;AAEb,kCAAkC;;AAElC,8BAA8B;;AAE9B,kDAAkD,gBAAgB,gEAAgE,wDAAwD,6DAA6D,sDAAsD;;AAE7S,uCAAuC,uDAAuD,uCAAuC,SAAS,OAAO,oBAAoB;;AAEzK,yCAAyC,8FAA8F,wBAAwB,eAAe,eAAe,gBAAgB,YAAY,MAAM,wBAAwB,+BAA+B,aAAa,qBAAqB,uCAAuC,cAAc,WAAW,YAAY,UAAU,MAAM,mDAAmD,UAAU,sBAAsB;;AAEve,gCAAgC;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;ACnC+F;AAC/F,YAA+K;;AAE/K,eAAe,+CAA+C;;AAE9D;AACA;;AAEA,aAAa,0GAAG,CAAC,2JAAO;;;;AAIxB,iEAAe,kKAAc,MAAM;;;;;;;;;;;ACZtB;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;;AAEA,kBAAkB,wBAAwB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,KAAwC,GAAG,sBAAiB,GAAG,CAAI;;AAEnF;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,qEAAqE,qBAAqB,cAAc;;AAExG;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA,yDAAyD;AACzD,IAAI;;AAEJ;;;AAGA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,4BAA4B;AAChD;AACA;AACA;AACA;;AAEA;;AAEA,qBAAqB,6BAA6B;AAClD;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;AC5QA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;;AAEQ;AACV;;AAE1C;AACA;AACA;AACA,sDAAsD,oCAAoC;AAC1F;AACA,4CAA4C;AAC5C,QAAQ,0EAA0E;AAClF;AACA;AACA;AACe,yBAAyB,sDAAM;AAC9C;AACA;AACA;AACA;AACA,WAAW,0DAAiB,EAAE,qDAAY;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACtCA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE6C;AACD;;AAE5C;AACA;AACA;AACA;AACA;AACe,gCAAgC,uDAAO;AACtD;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,SAAS;AACrB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA,IAAI;AACJ;;AAEA;AACA,0BAA0B,aAAa;AACvC;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;;AAEA,qBAAqB,0DAAK;;AAE1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qBAAqB,0DAAK;;AAE1B;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;AACA,YAAY,mCAAmC;AAC/C,YAAY,6CAA6C;AACzD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,6CAA6C;AACxD,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;ACvOA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAE4C;AACA;AACE;;AAEM;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACe,gCAAgC,sDAAM;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,sDAAK,EAAE,wDAAM;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,yCAAyC,0DAAiB;;AAE1D;AACA;AACA,IAAI;;AAEJ,wCAAwC,0CAA0C;;AAElF;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA;;AAEA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,IAAI;;AAEJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG,IAAI,wBAAwB;;AAE/B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG,IAAI,wBAAwB;AAC/B;AACA;;;;;;;;;;;;;;;;;;;ACjJA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEmD;AACL;;AAEb;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,2BAA2B,sDAAM;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,wDAAU;;AAEpC;AACA;AACA,UAAU,2DAAW;AACrB;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,IAAI;AACJ;AACA;;;;;;;;;;;AC3DA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEqD;AACc;AACV","file":"block-quote.js","sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}\", \"\",{\"version\":3,\"sources\":[\"webpack://./theme/blockquote.css\"],\"names\":[],\"mappings\":\"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD\",\"sourcesContent\":[\"/*\\n * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\\n */\\n\\n.ck-content blockquote {\\n\\t/* See #12 */\\n\\toverflow: hidden;\\n\\n\\t/* https://github.com/ckeditor/ckeditor5-block-quote/issues/15 */\\n\\tpadding-right: 1.5em;\\n\\tpadding-left: 1.5em;\\n\\n\\tmargin-left: 0;\\n\\tmargin-right: 0;\\n\\tfont-style: italic;\\n\\tborder-left: solid 5px hsl(0, 0%, 80%);\\n}\\n\\n.ck-content[dir=\\\"rtl\\\"] blockquote {\\n\\tborder-left: 0;\\n\\tborder-right: solid 5px hsl(0, 0%, 80%);\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","import api from \"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./blockquote.css\";\n\nvar options = {\"injectType\":\"singletonStyleTag\",\"attributes\":{\"data-cke\":true}};\n\noptions.insert = \"head\";\noptions.singleton = true;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n // tags it will allow on a page\n\n if (!options.singleton && typeof options.singleton !== 'boolean') {\n options.singleton = isOldIE();\n }\n\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n\n if (Object.prototype.toString.call(newList) !== '[object Array]') {\n return;\n }\n\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDom[index].references--;\n }\n\n var newLastIdentifiers = modulesToDom(newList, options);\n\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n\n var _index = getIndexByIdentifier(_identifier);\n\n if (stylesInDom[_index].references === 0) {\n stylesInDom[_index].updater();\n\n stylesInDom.splice(_index, 1);\n }\n }\n\n lastIdentifiers = newLastIdentifiers;\n };\n};","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module block-quote/blockquote\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\n\nimport BlockQuoteEditing from './blockquoteediting';\nimport BlockQuoteUI from './blockquoteui';\n\n/**\n * The block quote plugin.\n *\n * For more information about this feature check the {@glink api/block-quote package page}.\n *\n * This is a \"glue\" plugin which loads the {@link module:block-quote/blockquoteediting~BlockQuoteEditing block quote editing feature}\n * and {@link module:block-quote/blockquoteui~BlockQuoteUI block quote UI feature}.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class BlockQuote extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ BlockQuoteEditing, BlockQuoteUI ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'BlockQuote';\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module block-quote/blockquotecommand\n */\n\nimport { Command } from 'ckeditor5/src/core';\nimport { first } from 'ckeditor5/src/utils';\n\n/**\n * The block quote command plugin.\n *\n * @extends module:core/command~Command\n */\nexport default class BlockQuoteCommand extends Command {\n\t/**\n\t * Whether the selection starts in a block quote.\n\t *\n\t * @observable\n\t * @readonly\n\t * @member {Boolean} #value\n\t */\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\tthis.value = this._getValue();\n\t\tthis.isEnabled = this._checkEnabled();\n\t}\n\n\t/**\n\t * Executes the command. When the command {@link #value is on}, all top-most block quotes within\n\t * the selection will be removed. If it is off, all selected blocks will be wrapped with\n\t * a block quote.\n\t *\n\t * @fires execute\n\t * @param {Object} [options] Command options.\n\t * @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply a block quote,\n\t * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.\n\t */\n\texecute( options = {} ) {\n\t\tconst model = this.editor.model;\n\t\tconst schema = model.schema;\n\t\tconst selection = model.document.selection;\n\n\t\tconst blocks = Array.from( selection.getSelectedBlocks() );\n\n\t\tconst value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;\n\n\t\tmodel.change( writer => {\n\t\t\tif ( !value ) {\n\t\t\t\tthis._removeQuote( writer, blocks.filter( findQuote ) );\n\t\t\t} else {\n\t\t\t\tconst blocksToQuote = blocks.filter( block => {\n\t\t\t\t\t// Already quoted blocks needs to be considered while quoting too\n\t\t\t\t\t// in order to reuse their <bQ> elements.\n\t\t\t\t\treturn findQuote( block ) || checkCanBeQuoted( schema, block );\n\t\t\t\t} );\n\n\t\t\t\tthis._applyQuote( writer, blocksToQuote );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Checks the command's {@link #value}.\n\t *\n\t * @private\n\t * @returns {Boolean} The current value.\n\t */\n\t_getValue() {\n\t\tconst selection = this.editor.model.document.selection;\n\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\t\t// In the current implementation, the block quote must be an immediate parent of a block element.\n\t\treturn !!( firstBlock && findQuote( firstBlock ) );\n\t}\n\n\t/**\n\t * Checks whether the command can be enabled in the current context.\n\t *\n\t * @private\n\t * @returns {Boolean} Whether the command should be enabled.\n\t */\n\t_checkEnabled() {\n\t\tif ( this.value ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst selection = this.editor.model.document.selection;\n\t\tconst schema = this.editor.model.schema;\n\n\t\tconst firstBlock = first( selection.getSelectedBlocks() );\n\n\t\tif ( !firstBlock ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn checkCanBeQuoted( schema, firstBlock );\n\t}\n\n\t/**\n\t * Removes the quote from given blocks.\n\t *\n\t * If blocks which are supposed to be \"unquoted\" are in the middle of a quote,\n\t * start it or end it, then the quote will be split (if needed) and the blocks\n\t * will be moved out of it, so other quoted blocks remained quoted.\n\t *\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t */\n\t_removeQuote( writer, blocks ) {\n\t\t// Unquote all groups of block. Iterate in the reverse order to not break following ranges.\n\t\tgetRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {\n\t\t\tif ( groupRange.start.isAtStart && groupRange.end.isAtEnd ) {\n\t\t\t\twriter.unwrap( groupRange.start.parent );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The group of blocks are at the beginning of an <bQ> so let's move them left (out of the <bQ>).\n\t\t\tif ( groupRange.start.isAtStart ) {\n\t\t\t\tconst positionBefore = writer.createPositionBefore( groupRange.start.parent );\n\n\t\t\t\twriter.move( groupRange, positionBefore );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The blocks are in the middle of an <bQ> so we need to split the <bQ> after the last block\n\t\t\t// so we move the items there.\n\t\t\tif ( !groupRange.end.isAtEnd ) {\n\t\t\t\twriter.split( groupRange.end );\n\t\t\t}\n\n\t\t\t// Now we are sure that groupRange.end.isAtEnd is true, so let's move the blocks right.\n\n\t\t\tconst positionAfter = writer.createPositionAfter( groupRange.end.parent );\n\n\t\t\twriter.move( groupRange, positionAfter );\n\t\t} );\n\t}\n\n\t/**\n\t * Applies the quote to given blocks.\n\t *\n\t * @private\n\t * @param {module:engine/model/writer~Writer} writer\n\t * @param {Array.<module:engine/model/element~Element>} blocks\n\t */\n\t_applyQuote( writer, blocks ) {\n\t\tconst quotesToMerge = [];\n\n\t\t// Quote all groups of block. Iterate in the reverse order to not break following ranges.\n\t\tgetRangesOfBlockGroups( writer, blocks ).reverse().forEach( groupRange => {\n\t\t\tlet quote = findQuote( groupRange.start );\n\n\t\t\tif ( !quote ) {\n\t\t\t\tquote = writer.createElement( 'blockQuote' );\n\n\t\t\t\twriter.wrap( groupRange, quote );\n\t\t\t}\n\n\t\t\tquotesToMerge.push( quote );\n\t\t} );\n\n\t\t// Merge subsequent <bQ> elements. Reverse the order again because this time we want to go through\n\t\t// the <bQ> elements in the source order (due to how merge works – it moves the right element's content\n\t\t// to the first element and removes the right one. Since we may need to merge a couple of subsequent `<bQ>` elements\n\t\t// we want to keep the reference to the first (furthest left) one.\n\t\tquotesToMerge.reverse().reduce( ( currentQuote, nextQuote ) => {\n\t\t\tif ( currentQuote.nextSibling == nextQuote ) {\n\t\t\t\twriter.merge( writer.createPositionAfter( currentQuote ) );\n\n\t\t\t\treturn currentQuote;\n\t\t\t}\n\n\t\t\treturn nextQuote;\n\t\t} );\n\t}\n}\n\nfunction findQuote( elementOrPosition ) {\n\treturn elementOrPosition.parent.name == 'blockQuote' ? elementOrPosition.parent : null;\n}\n\n// Returns a minimal array of ranges containing groups of subsequent blocks.\n//\n// content: abcdefgh\n// blocks: [ a, b, d, f, g, h ]\n// output ranges: [ab]c[d]e[fgh]\n//\n// @param {Array.<module:engine/model/element~Element>} blocks\n// @returns {Array.<module:engine/model/range~Range>}\nfunction getRangesOfBlockGroups( writer, blocks ) {\n\tlet startPosition;\n\tlet i = 0;\n\tconst ranges = [];\n\n\twhile ( i < blocks.length ) {\n\t\tconst block = blocks[ i ];\n\t\tconst nextBlock = blocks[ i + 1 ];\n\n\t\tif ( !startPosition ) {\n\t\t\tstartPosition = writer.createPositionBefore( block );\n\t\t}\n\n\t\tif ( !nextBlock || block.nextSibling != nextBlock ) {\n\t\t\tranges.push( writer.createRange( startPosition, writer.createPositionAfter( block ) ) );\n\t\t\tstartPosition = null;\n\t\t}\n\n\t\ti++;\n\t}\n\n\treturn ranges;\n}\n\n// Checks whether <bQ> can wrap the block.\nfunction checkCanBeQuoted( schema, block ) {\n\t// TMP will be replaced with schema.checkWrap().\n\tconst isBQAllowed = schema.checkChild( block.parent, 'blockQuote' );\n\tconst isBlockAllowedInBQ = schema.checkChild( [ '$root', 'blockQuote' ], block );\n\n\treturn isBQAllowed && isBlockAllowedInBQ;\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module block-quote/blockquoteediting\n */\n\nimport { Plugin } from 'ckeditor5/src/core';\nimport { Enter } from 'ckeditor5/src/enter';\nimport { Delete } from 'ckeditor5/src/typing';\n\nimport BlockQuoteCommand from './blockquotecommand';\n\n/**\n * The block quote editing.\n *\n * Introduces the `'blockQuote'` command and the `'blockQuote'` model element.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class BlockQuoteEditing extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'BlockQuoteEditing';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get requires() {\n\t\treturn [ Enter, Delete ];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst schema = editor.model.schema;\n\n\t\teditor.commands.add( 'blockQuote', new BlockQuoteCommand( editor ) );\n\n\t\tschema.register( 'blockQuote', {\n\t\t\tinheritAllFrom: '$container'\n\t\t} );\n\n\t\teditor.conversion.elementToElement( { model: 'blockQuote', view: 'blockquote' } );\n\n\t\t// Postfixer which cleans incorrect model states connected with block quotes.\n\t\teditor.model.document.registerPostFixer( writer => {\n\t\t\tconst changes = editor.model.document.differ.getChanges();\n\n\t\t\tfor ( const entry of changes ) {\n\t\t\t\tif ( entry.type == 'insert' ) {\n\t\t\t\t\tconst element = entry.position.nodeAfter;\n\n\t\t\t\t\tif ( !element ) {\n\t\t\t\t\t\t// We are inside a text node.\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( element.is( 'element', 'blockQuote' ) && element.isEmpty ) {\n\t\t\t\t\t\t// Added an empty blockQuote - remove it.\n\t\t\t\t\t\twriter.remove( element );\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else if ( element.is( 'element', 'blockQuote' ) && !schema.checkChild( entry.position, element ) ) {\n\t\t\t\t\t\t// Added a blockQuote in incorrect place. Unwrap it so the content inside is not lost.\n\t\t\t\t\t\twriter.unwrap( element );\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else if ( element.is( 'element' ) ) {\n\t\t\t\t\t\t// Just added an element. Check that all children meet the scheme rules.\n\t\t\t\t\t\tconst range = writer.createRangeIn( element );\n\n\t\t\t\t\t\tfor ( const child of range.getItems() ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tchild.is( 'element', 'blockQuote' ) &&\n\t\t\t\t\t\t\t\t!schema.checkChild( writer.createPositionBefore( child ), child )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\twriter.unwrap( child );\n\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if ( entry.type == 'remove' ) {\n\t\t\t\t\tconst parent = entry.position.parent;\n\n\t\t\t\t\tif ( parent.is( 'element', 'blockQuote' ) && parent.isEmpty ) {\n\t\t\t\t\t\t// Something got removed and now blockQuote is empty. Remove the blockQuote as well.\n\t\t\t\t\t\twriter.remove( parent );\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t} );\n\n\t\tconst viewDocument = this.editor.editing.view.document;\n\t\tconst selection = editor.model.document.selection;\n\t\tconst blockQuoteCommand = editor.commands.get( 'blockQuote' );\n\n\t\t// Overwrite default Enter key behavior.\n\t\t// If Enter key is pressed with selection collapsed in empty block inside a quote, break the quote.\n\t\tthis.listenTo( viewDocument, 'enter', ( evt, data ) => {\n\t\t\tif ( !selection.isCollapsed || !blockQuoteCommand.value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst positionParent = selection.getLastPosition().parent;\n\n\t\t\tif ( positionParent.isEmpty ) {\n\t\t\t\teditor.execute( 'blockQuote' );\n\t\t\t\teditor.editing.view.scrollToTheSelection();\n\n\t\t\t\tdata.preventDefault();\n\t\t\t\tevt.stop();\n\t\t\t}\n\t\t}, { context: 'blockquote' } );\n\n\t\t// Overwrite default Backspace key behavior.\n\t\t// If Backspace key is pressed with selection collapsed in first empty block inside a quote, break the quote.\n\t\tthis.listenTo( viewDocument, 'delete', ( evt, data ) => {\n\t\t\tif ( data.direction != 'backward' || !selection.isCollapsed || !blockQuoteCommand.value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst positionParent = selection.getLastPosition().parent;\n\n\t\t\tif ( positionParent.isEmpty && !positionParent.previousSibling ) {\n\t\t\t\teditor.execute( 'blockQuote' );\n\t\t\t\teditor.editing.view.scrollToTheSelection();\n\n\t\t\t\tdata.preventDefault();\n\t\t\t\tevt.stop();\n\t\t\t}\n\t\t}, { context: 'blockquote' } );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module block-quote/blockquoteui\n */\n\nimport { Plugin, icons } from 'ckeditor5/src/core';\nimport { ButtonView } from 'ckeditor5/src/ui';\n\nimport '../theme/blockquote.css';\n\n/**\n * The block quote UI plugin.\n *\n * It introduces the `'blockQuote'` button.\n *\n * @extends module:core/plugin~Plugin\n */\nexport default class BlockQuoteUI extends Plugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'BlockQuoteUI';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\n\t\teditor.ui.componentFactory.add( 'blockQuote', locale => {\n\t\t\tconst command = editor.commands.get( 'blockQuote' );\n\t\t\tconst buttonView = new ButtonView( locale );\n\n\t\t\tbuttonView.set( {\n\t\t\t\tlabel: t( 'Block quote' ),\n\t\t\t\ticon: icons.quote,\n\t\t\t\ttooltip: true,\n\t\t\t\tisToggleable: true\n\t\t\t} );\n\n\t\t\t// Bind button model to command.\n\t\t\tbuttonView.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );\n\n\t\t\t// Execute command.\n\t\t\tthis.listenTo( buttonView, 'execute', () => {\n\t\t\t\teditor.execute( 'blockQuote' );\n\t\t\t\teditor.editing.view.focus();\n\t\t\t} );\n\n\t\t\treturn buttonView;\n\t\t} );\n\t}\n}\n","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/core.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/enter.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/typing.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/ui.js\");","module.exports = (__webpack_require__(/*! dll-reference CKEditor5.dll */ \"dll-reference CKEditor5.dll\"))(\"./src/utils.js\");","module.exports = CKEditor5.dll;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nc = undefined;","/**\n * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module block-quote\n */\n\nexport { default as BlockQuote } from './blockquote';\nexport { default as BlockQuoteEditing } from './blockquoteediting';\nexport { default as BlockQuoteUI } from './blockquoteui';\n"],"sourceRoot":""}