diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5aec7271..a9672493 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### 2.26.3 + +- `Fix` — *Paste Module* — fix for a problem with specifying of `pasteConfig().tags` in upper case [#2208](https://github.com/codex-team/editor.js/issues/2208). ### 2.26.2 diff --git a/package.json b/package.json index dc197cc8..286d9036 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/editorjs", - "version": "2.26.2", + "version": "2.26.3", "description": "Editor.js — Native JS, based on API and Open Source", "main": "dist/editor.js", "types": "./types/index.d.ts", diff --git a/src/components/modules/paste.ts b/src/components/modules/paste.ts index bc568169..c626b789 100644 --- a/src/components/modules/paste.ts +++ b/src/components/modules/paste.ts @@ -639,7 +639,7 @@ export default class Paste extends Module { tags.forEach((tag) => { const sanitizationConfig = _.isObject(tagOrSanitizeConfig) ? tagOrSanitizeConfig[tag] : null; - result[tag] = sanitizationConfig || {}; + result[tag.toLowerCase()] = sanitizationConfig || {}; }); return result; diff --git a/test/cypress/tests/api/tools.spec.ts b/test/cypress/tests/api/tools.spec.ts index e29ad7ef..85ec28ae 100644 --- a/test/cypress/tests/api/tools.spec.ts +++ b/test/cypress/tests/api/tools.spec.ts @@ -213,12 +213,12 @@ describe('Editor Tools Api', () => { icon: ICON, name: 'testToolTune', - onActivate: (): void => {}, + onActivate: (): void => { }, }; } /** Save method stub */ - public save(): void {} + public save(): void { } /** Renders a block */ public render(): HTMLElement { @@ -283,20 +283,20 @@ describe('Editor Tools Api', () => { icon: ICON, name: 'testToolTune1', - onActivate: (): void => {}, + onActivate: (): void => { }, }, { label: 'Test tool tune 2', icon: ICON, name: 'testToolTune2', - onActivate: (): void => {}, + onActivate: (): void => { }, }, ]; } /** Save method stub */ - public save(): void {} + public save(): void { } /** Renders a block */ public render(): HTMLElement { @@ -366,7 +366,7 @@ describe('Editor Tools Api', () => { } /** Save method stub */ - public save(): void {} + public save(): void { } /** Renders a block */ public render(): HTMLElement { @@ -431,15 +431,15 @@ describe('Editor Tools Api', () => { /** config specified handled tag */ public static get pasteConfig(): PasteConfig { return { - tags: [ 'img' ], // only tag name specified. Attributes should be sanitized + tags: ['img'], // only tag name specified. Attributes should be sanitized }; } /** onPaste callback will be stubbed below */ - public onPaste(): void {} + public onPaste(): void { } /** save is required for correct implementation of the BlockTool class */ - public save(): void {} + public save(): void { } /** render is required for correct implementation of the BlockTool class */ public render(): HTMLElement { @@ -483,15 +483,15 @@ describe('Editor Tools Api', () => { /** config specified handled tag */ public static get pasteConfig(): PasteConfig { return { - tags: [ 'img' ], // only tag name specified. Attributes should be sanitized + tags: ['img'], // only tag name specified. Attributes should be sanitized }; } /** onPaste callback will be stubbed below */ - public onPaste(): void {} + public onPaste(): void { } /** save is required for correct implementation of the BlockTool class */ - public save(): void {} + public save(): void { } /** render is required for correct implementation of the BlockTool class */ public render(): HTMLElement { @@ -526,6 +526,79 @@ describe('Editor Tools Api', () => { }); }); + /** + * tags: ['OL','LI',] + * ->