@ckeditor/ckeditor5-autoformat 40.2.0 → 41.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -6
- package/LICENSE.md +1 -1
- package/build/autoformat.js +1 -1
- package/package.json +3 -2
- package/src/augmentation.d.ts +2 -2
- package/src/augmentation.js +1 -1
- package/src/autoformat.d.ts +3 -3
- package/src/autoformat.js +5 -5
- package/src/blockautoformatediting.d.ts +3 -3
- package/src/blockautoformatediting.js +3 -3
- package/src/index.d.ts +3 -3
- package/src/index.js +3 -3
- package/src/inlineautoformatediting.d.ts +4 -4
- package/src/inlineautoformatediting.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,7 @@ Changes for the past releases are available below.
|
|
|
9
9
|
|
|
10
10
|
### Features
|
|
11
11
|
|
|
12
|
-
* Added
|
|
12
|
+
* Added autoformat integration with the strikethrough using `~~` string. Closes [ckeditor/ckeditor5#6412](https://github.com/ckeditor/ckeditor5/issues/6412). ([9c3fd3e](https://github.com/ckeditor/ckeditor5-autoformat/commit/9c3fd3e))
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
## [18.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
|
@@ -30,7 +30,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
30
30
|
|
|
31
31
|
### Bug fixes
|
|
32
32
|
|
|
33
|
-
* `BlockAutoformat` should not react to text typed after inline element. Closes [ckeditor/ckeditor5#5671](https://github.com/ckeditor/ckeditor5/issues/5671). ([241c294](https://github.com/ckeditor/ckeditor5-autoformat/commit/241c294))
|
|
33
|
+
* `BlockAutoformat` should not react to text typed after an inline element. Closes [ckeditor/ckeditor5#5671](https://github.com/ckeditor/ckeditor5/issues/5671). ([241c294](https://github.com/ckeditor/ckeditor5-autoformat/commit/241c294))
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
## [15.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
|
@@ -133,7 +133,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
133
133
|
### Bug fixes
|
|
134
134
|
|
|
135
135
|
* Fixed integration with undo. Closes [#53](https://github.com/ckeditor/ckeditor5-autoformat/issues/53). ([f5d68f4](https://github.com/ckeditor/ckeditor5-autoformat/commit/f5d68f4))
|
|
136
|
-
*
|
|
136
|
+
* An ordered list will now be triggered by a number and `.` or `)`. Closes [#42](https://github.com/ckeditor/ckeditor5-autoformat/issues/42). ([bcc4e3b](https://github.com/ckeditor/ckeditor5-autoformat/commit/bcc4e3b))
|
|
137
137
|
|
|
138
138
|
Thanks to [@vladikoff](https://github.com/vladikoff)!
|
|
139
139
|
|
|
@@ -166,7 +166,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
166
166
|
### Bug fixes
|
|
167
167
|
|
|
168
168
|
* The `Autoformat` plugin should not require other features. Closes [#5](https://github.com/ckeditor/ckeditor5-autoformat/issues/5) and [#17](https://github.com/ckeditor/ckeditor5-autoformat/issues/17). ([d22c5b6](https://github.com/ckeditor/ckeditor5-autoformat/commit/d22c5b6))
|
|
169
|
-
* Autoformatting will not be triggered if the batch with changes is `transparent` (
|
|
169
|
+
* Autoformatting will not be triggered if the batch with changes is `transparent` (for example, it represents other user's changes). ([f1131bc](https://github.com/ckeditor/ckeditor5-autoformat/commit/f1131bc))
|
|
170
170
|
|
|
171
171
|
### Features
|
|
172
172
|
|
|
@@ -181,9 +181,9 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
181
181
|
|
|
182
182
|
* The command API has been changed.
|
|
183
183
|
|
|
184
|
-
###
|
|
184
|
+
### Note
|
|
185
185
|
|
|
186
|
-
* The Autoformat feature does not require Bold, Italic, Heading, etc. any longer.
|
|
186
|
+
* The Autoformat feature does not require Bold, Italic, Heading, etc. any longer. To make the most of the plugin, make sure that relevant features are loaded in your editor.
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
## [0.5.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.5.0...v0.5.1) (May 7, 2017)
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 autoformat feature** – https://github.com/ckeditor/ckeditor5-autoformat <br>
|
|
5
|
-
Copyright (c) 2003–
|
|
5
|
+
Copyright (c) 2003–2024, [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
|
|
package/build/autoformat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},181:(t,e,o)=>{t.exports=o(79)("./src/typing.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(i){var s=e[i];if(void 0!==s)return s.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{Autoformat:()=>c});var t=o(704),e=o(181),s=o(492),n=o(209);function r(t,e,o,i){let r,d=null;"function"==typeof i?r=i:(d=t.commands.get(i),r=()=>{t.execute(i)}),t.model.document.on("change:data",((a,c)=>{if(d&&!d.isEnabled||!e.isEnabled)return;const l=(0,n.first)(t.model.document.selection.getRanges());if(!l.isCollapsed)return;if(c.isUndo||!c.isLocal)return;const u=Array.from(t.model.document.differ.getChanges()),h=u[0];if(1!=u.length||"insert"!==h.type||"$text"!=h.name||1!=h.length)return;const g=h.position.parent;if(g.is("element","codeBlock"))return;if(g.is("element","listItem")&&"function"!=typeof i&&!["numberedList","bulletedList","todoList"].includes(i))return;if(d&&!0===d.value)return;const m=g.getChild(0),f=t.model.createRangeOn(m);if(!f.containsRange(l)&&!l.end.isEqual(f.end))return;const p=o.exec(m.data.substr(0,l.end.offset));p&&t.model.enqueueChange((e=>{const o=e.createPositionAt(g,0),i=e.createPositionAt(g,p[0].length),n=new s.LiveRange(o,i);if(!1!==r({match:p})){e.remove(n);const o=t.model.document.selection.getFirstRange(),i=e.createRangeIn(g);!g.isEmpty||i.isEqual(o)||i.containsRange(o,!0)||e.remove(g)}n.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function d(t,e,o,i){let s,n;o instanceof RegExp?s=o:n=o,n=n||(t=>{let e;const o=[],i=[];for(;null!==(e=s.exec(t))&&!(e&&e.length<4);){let{index:t,1:s,2:n,3:r}=e;const d=s+n+r;t+=e[0].length-d.length;const a=[t,t+s.length],c=[t+s.length+n.length,t+s.length+n.length+r.length];o.push(a),o.push(c),i.push([t+s.length,t+s.length+n.length])}return{remove:o,format:i}}),t.model.document.on("change:data",((o,s)=>{if(s.isUndo||!s.isLocal||!e.isEnabled)return;const r=t.model,d=r.document.selection;if(!d.isCollapsed)return;const c=Array.from(r.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const u=d.focus,h=u.parent,{text:g,range:m}=function(t,e){let o=t.start;const i=Array.from(t.getItems()).reduce(((t,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(o=e.createPositionAfter(i),""):t+i.data),"");return{text:i,range:e.createRange(o,t.end)}}(r.createRange(r.createPositionAt(h,0),u),r),f=n(g),p=a(m.start,f.format,r),x=a(m.start,f.remove,r);p.length&&x.length&&r.enqueueChange((e=>{if(!1!==i(e,p)){for(const t of x.reverse())e.remove(t);r.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function a(t,e,o){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>o.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}class c extends t.Plugin{static get requires(){return[e.Delete]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&r(this.editor,this,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&r(this.editor,this,/^1[.|)]\s$/,"numberedList"),t.get("todoList")&&r(this.editor,this,/^\[\s?\]\s$/,"todoList"),t.get("checkTodoList")&&r(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const t=l(this.editor,"bold");d(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),d(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(t.get("italic")){const t=l(this.editor,"italic");d(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),d(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(t.get("code")){const t=l(this.editor,"code");d(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(t.get("strikethrough")){const t=l(this.editor,"strikethrough");d(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter((t=>t.match(/^heading[1-6]$/))).forEach((e=>{const o=e[7],i=new RegExp(`^(#{${o}})\\s$`);r(this.editor,this,i,(()=>{if(!t.isEnabled||t.value===e)return!1;this.editor.execute("heading",{value:e})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&r(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const t=this.editor,e=t.model.document.selection;t.commands.get("codeBlock")&&r(t,this,/^```$/,(()=>{if(e.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&r(this.editor,this,/^---$/,"horizontalLine")}}function l(t,e){return(o,i)=>{if(!t.commands.get(e).isEnabled)return!1;const s=t.model.schema.getValidRanges(i,e);for(const t of s)o.setAttribute(e,!0,t);o.removeSelectionAttribute(e)}}})(),(window.CKEditor5=window.CKEditor5||{}).autoformat=i})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-autoformat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "41.0.0",
|
|
4
4
|
"description": "Autoformatting feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
"ckeditor5-plugin",
|
|
11
11
|
"ckeditor5-dll"
|
|
12
12
|
],
|
|
13
|
+
"type": "module",
|
|
13
14
|
"main": "src/index.js",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "
|
|
16
|
+
"ckeditor5": "41.0.0"
|
|
16
17
|
},
|
|
17
18
|
"author": "CKSource (http://cksource.com/)",
|
|
18
19
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
-
import type { Autoformat } from './index';
|
|
5
|
+
import type { Autoformat } from './index.js';
|
|
6
6
|
declare module '@ckeditor/ckeditor5-core' {
|
|
7
7
|
interface PluginsMap {
|
|
8
8
|
[Autoformat.pluginName]: Autoformat;
|
package/src/augmentation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
export {};
|
package/src/autoformat.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import { Delete } from 'ckeditor5/src/typing';
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import { Delete } from 'ckeditor5/src/typing.js';
|
|
7
7
|
/**
|
|
8
8
|
* Enables a set of predefined autoformatting actions.
|
|
9
9
|
*
|
package/src/autoformat.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import { Delete } from 'ckeditor5/src/typing';
|
|
7
|
-
import blockAutoformatEditing from './blockautoformatediting';
|
|
8
|
-
import inlineAutoformatEditing from './inlineautoformatediting';
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import { Delete } from 'ckeditor5/src/typing.js';
|
|
7
|
+
import blockAutoformatEditing from './blockautoformatediting.js';
|
|
8
|
+
import inlineAutoformatEditing from './inlineautoformatediting.js';
|
|
9
9
|
/**
|
|
10
10
|
* Enables a set of predefined autoformatting actions.
|
|
11
11
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type Autoformat from './autoformat';
|
|
5
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
6
|
+
import type Autoformat from './autoformat.js';
|
|
7
7
|
/**
|
|
8
8
|
* The block autoformatting engine. It allows to format various block patterns. For example,
|
|
9
9
|
* it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
-
import { LiveRange } from 'ckeditor5/src/engine';
|
|
6
|
-
import { first } from 'ckeditor5/src/utils';
|
|
5
|
+
import { LiveRange } from 'ckeditor5/src/engine.js';
|
|
6
|
+
import { first } from 'ckeditor5/src/utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The block autoformatting engine. It allows to format various block patterns. For example,
|
|
9
9
|
* it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
/**
|
|
6
6
|
* @module autoformat
|
|
7
7
|
*/
|
|
8
|
-
export { default as Autoformat } from './autoformat';
|
|
9
|
-
import './augmentation';
|
|
8
|
+
export { default as Autoformat } from './autoformat.js';
|
|
9
|
+
import './augmentation.js';
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
/**
|
|
6
6
|
* @module autoformat
|
|
7
7
|
*/
|
|
8
|
-
export { default as Autoformat } from './autoformat';
|
|
9
|
-
import './augmentation';
|
|
8
|
+
export { default as Autoformat } from './autoformat.js';
|
|
9
|
+
import './augmentation.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
/**
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module autoformat/inlineautoformatediting
|
|
18
18
|
*/
|
|
19
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
20
|
-
import type { Range, Writer } from 'ckeditor5/src/engine';
|
|
21
|
-
import type Autoformat from './autoformat';
|
|
19
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
20
|
+
import type { Range, Writer } from 'ckeditor5/src/engine.js';
|
|
21
|
+
import type Autoformat from './autoformat.js';
|
|
22
22
|
export type TestCallback = (text: string) => {
|
|
23
23
|
remove: Array<Array<number>>;
|
|
24
24
|
format: Array<Array<number>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, 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
|
/**
|