diff --git a/CHANGELOG.md b/CHANGELOG.md index ab08d0e4d..99588d199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,13 @@ ### Web Components - drag-resize-rotate: v2.2.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/webcomponents/drag-resize-rotate/CHANGELOG.md)) +- highlight-code: v3.4.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/webcomponents/highlight-code/CHANGELOG.md)) - inline-editor: v4.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/webcomponents/inline-editor/CHANGELOG.md) ### Others - deck-utils: v4.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/utils/deck/CHANGELOG.md)) -- utils: v2.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/utils/utils/CHANGELOG.md)) +- utils: v2.3.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/main/utils/utils/CHANGELOG.md)) diff --git a/package-lock.json b/package-lock.json index 204632060..9792777bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9631,7 +9631,7 @@ }, "utils/utils": { "name": "@deckdeckgo/utils", - "version": "2.2.0", + "version": "2.3.0", "license": "MIT", "devDependencies": { "@types/node": "^16.9.0" @@ -9696,7 +9696,7 @@ }, "webcomponents/drag-resize-rotate": { "name": "@deckdeckgo/drag-resize-rotate", - "version": "2.2.0", + "version": "2.2.1", "license": "MIT", "dependencies": { "@deckdeckgo/utils": "^2.2.0" @@ -9707,7 +9707,7 @@ "version": "3.4.0", "license": "MIT", "dependencies": { - "@deckdeckgo/utils": "2.0.1", + "@deckdeckgo/utils": "^2.3.0", "prismjs": "^1.24.1" }, "devDependencies": { @@ -9716,11 +9716,6 @@ "node-fetch": "^2.6.1" } }, - "webcomponents/highlight-code/node_modules/@deckdeckgo/utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.0.1.tgz", - "integrity": "sha512-wS6KqJZYOB5V6lIYauv4ij5Q2S0e9BAHw+786FsFZ0UZ22GOxBHvG3Cq7kIxRs8Zr3wAw2eTvcSOZ0TIj/tfSQ==" - }, "webcomponents/inline-editor": { "name": "@deckdeckgo/inline-editor", "version": "4.1.1", @@ -10350,7 +10345,7 @@ "@deckdeckgo/drag-resize-rotate": { "version": "file:webcomponents/drag-resize-rotate", "requires": { - "@deckdeckgo/utils": "*" + "@deckdeckgo/utils": "^2.2.0" } }, "@deckdeckgo/editor": { @@ -10376,17 +10371,10 @@ "version": "file:webcomponents/highlight-code", "requires": { "@deckdeckgo/slide-utils": "^4.0.3", - "@deckdeckgo/utils": "2.0.1", + "@deckdeckgo/utils": "*", "@types/prismjs": "^1.16.6", "node-fetch": "^2.6.1", "prismjs": "^1.24.1" - }, - "dependencies": { - "@deckdeckgo/utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.0.1.tgz", - "integrity": "sha512-wS6KqJZYOB5V6lIYauv4ij5Q2S0e9BAHw+786FsFZ0UZ22GOxBHvG3Cq7kIxRs8Zr3wAw2eTvcSOZ0TIj/tfSQ==" - } } }, "@deckdeckgo/ic": { diff --git a/studio/package-lock.json b/studio/package-lock.json index 77c6b3b1e..b0f3e11f6 100644 --- a/studio/package-lock.json +++ b/studio/package-lock.json @@ -14,9 +14,9 @@ "@deckdeckgo/core": "^8.4.0", "@deckdeckgo/deck-utils": "^4.1.1", "@deckdeckgo/demo": "^2.1.0", - "@deckdeckgo/drag-resize-rotate": "^2.2.0", - "@deckdeckgo/highlight-code": "^3.4.0", - "@deckdeckgo/inline-editor": "^4.1.0", + "@deckdeckgo/drag-resize-rotate": "^2.2.1", + "@deckdeckgo/highlight-code": "^3.4.1", + "@deckdeckgo/inline-editor": "^4.1.1", "@deckdeckgo/laser-pointer": "^1.1.0", "@deckdeckgo/lazy-img": "^3.2.0", "@deckdeckgo/markdown": "^2.1.0", @@ -37,7 +37,7 @@ "@deckdeckgo/slide-utils": "^4.0.3", "@deckdeckgo/slide-youtube": "^2.4.0", "@deckdeckgo/social": "^4.1.0", - "@deckdeckgo/utils": "^2.1.0", + "@deckdeckgo/utils": "^2.3.0", "@deckdeckgo/word-cloud": "^1.2.0", "@deckdeckgo/youtube": "^2.1.0", "@ionic/core": "^5.8.4", @@ -1731,11 +1731,11 @@ } }, "node_modules/@deckdeckgo/drag-resize-rotate": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/drag-resize-rotate/-/drag-resize-rotate-2.2.0.tgz", - "integrity": "sha512-+9WfYB2mJaPWnsGubqqE3h7mW7CuXXJ5CpGeDPWuZQ0hxONkPlnYxQM+y0Hxu6yQbj98nGm76dPUOksi6ZVRfQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/drag-resize-rotate/-/drag-resize-rotate-2.2.1.tgz", + "integrity": "sha512-rSBtao8J8XK0/Nva46oLIxqUQRTuBAQbDXla0UXWkr5c0sbtAy+mflga2JycTMh4SyiglKYdIGv/tMUplPYozw==", "dependencies": { - "@deckdeckgo/utils": "^2.0.1" + "@deckdeckgo/utils": "^2.2.0" } }, "node_modules/@deckdeckgo/editor": { @@ -1745,26 +1745,21 @@ "dev": true }, "node_modules/@deckdeckgo/highlight-code": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/highlight-code/-/highlight-code-3.4.0.tgz", - "integrity": "sha512-13jWsjoNzFW1t6yGnCUSKdku19EH3ZIYgaCOyR2AVlP9yeNlXTfKarhM/2FkLPgSXsENkMPFpw3tQTO418MEiw==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/highlight-code/-/highlight-code-3.4.1.tgz", + "integrity": "sha512-6LUM4QU6ntpbhLAAF57E1ix5fZf39tvisgxqLFVAyc1uV4s3YA3iJOXelhwhZ+9mAMZtRWlVXOfJn7I/fbCOPg==", "dependencies": { - "@deckdeckgo/utils": "2.0.1", + "@deckdeckgo/utils": "^2.3.0", "prismjs": "^1.24.1" } }, - "node_modules/@deckdeckgo/highlight-code/node_modules/@deckdeckgo/utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.0.1.tgz", - "integrity": "sha512-wS6KqJZYOB5V6lIYauv4ij5Q2S0e9BAHw+786FsFZ0UZ22GOxBHvG3Cq7kIxRs8Zr3wAw2eTvcSOZ0TIj/tfSQ==" - }, "node_modules/@deckdeckgo/inline-editor": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/inline-editor/-/inline-editor-4.1.0.tgz", - "integrity": "sha512-cQCAdYGLtTXzFpSgneO1FDyKoFJnil+qriG+kvm9l+NwhUW+nmuK5RAVqBKY3hSK+9cPA24c/jS7UEiRWkTSrg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/inline-editor/-/inline-editor-4.1.1.tgz", + "integrity": "sha512-2dZpcSyQ+x2aTRdajJ4lOx1HVEEvgMik1ABBI5x4BrHtxoANNLm7hyvJaNWpilIKlwTAD5cwkf7HFcsPic6n+A==", "dependencies": { - "@deckdeckgo/color": "^4.0.2", - "@deckdeckgo/utils": "^2.0.1" + "@deckdeckgo/color": "^4.1.0", + "@deckdeckgo/utils": "^2.2.0" } }, "node_modules/@deckdeckgo/laser-pointer": { @@ -2006,9 +2001,9 @@ "dev": true }, "node_modules/@deckdeckgo/utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.1.0.tgz", - "integrity": "sha512-QUZMc6a4AMz+2tCtf87CDFHy6BR5tTW2CX+/NTdPdfw7HDiONTLTxkmGDdxBOt+1TJft08aughqI/5AFBH5pxQ==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-ahvUG7JzXXYni/tWskhJtm/o+2LX+3gtigd21XqGoP69D6lgVHnPy/qMTyINuhRmStEWn7HGBFqBMu5l9yC1Kg==" }, "node_modules/@deckdeckgo/word-cloud": { "version": "1.2.0", @@ -5475,11 +5470,11 @@ } }, "@deckdeckgo/drag-resize-rotate": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/drag-resize-rotate/-/drag-resize-rotate-2.2.0.tgz", - "integrity": "sha512-+9WfYB2mJaPWnsGubqqE3h7mW7CuXXJ5CpGeDPWuZQ0hxONkPlnYxQM+y0Hxu6yQbj98nGm76dPUOksi6ZVRfQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/drag-resize-rotate/-/drag-resize-rotate-2.2.1.tgz", + "integrity": "sha512-rSBtao8J8XK0/Nva46oLIxqUQRTuBAQbDXla0UXWkr5c0sbtAy+mflga2JycTMh4SyiglKYdIGv/tMUplPYozw==", "requires": { - "@deckdeckgo/utils": "^2.0.1" + "@deckdeckgo/utils": "^2.2.0" } }, "@deckdeckgo/editor": { @@ -5489,28 +5484,21 @@ "dev": true }, "@deckdeckgo/highlight-code": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/highlight-code/-/highlight-code-3.4.0.tgz", - "integrity": "sha512-13jWsjoNzFW1t6yGnCUSKdku19EH3ZIYgaCOyR2AVlP9yeNlXTfKarhM/2FkLPgSXsENkMPFpw3tQTO418MEiw==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/highlight-code/-/highlight-code-3.4.1.tgz", + "integrity": "sha512-6LUM4QU6ntpbhLAAF57E1ix5fZf39tvisgxqLFVAyc1uV4s3YA3iJOXelhwhZ+9mAMZtRWlVXOfJn7I/fbCOPg==", "requires": { - "@deckdeckgo/utils": "2.0.1", + "@deckdeckgo/utils": "^2.3.0", "prismjs": "^1.24.1" - }, - "dependencies": { - "@deckdeckgo/utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.0.1.tgz", - "integrity": "sha512-wS6KqJZYOB5V6lIYauv4ij5Q2S0e9BAHw+786FsFZ0UZ22GOxBHvG3Cq7kIxRs8Zr3wAw2eTvcSOZ0TIj/tfSQ==" - } } }, "@deckdeckgo/inline-editor": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/inline-editor/-/inline-editor-4.1.0.tgz", - "integrity": "sha512-cQCAdYGLtTXzFpSgneO1FDyKoFJnil+qriG+kvm9l+NwhUW+nmuK5RAVqBKY3hSK+9cPA24c/jS7UEiRWkTSrg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/inline-editor/-/inline-editor-4.1.1.tgz", + "integrity": "sha512-2dZpcSyQ+x2aTRdajJ4lOx1HVEEvgMik1ABBI5x4BrHtxoANNLm7hyvJaNWpilIKlwTAD5cwkf7HFcsPic6n+A==", "requires": { - "@deckdeckgo/color": "^4.0.2", - "@deckdeckgo/utils": "^2.0.1" + "@deckdeckgo/color": "^4.1.0", + "@deckdeckgo/utils": "^2.2.0" } }, "@deckdeckgo/laser-pointer": { @@ -5746,9 +5734,9 @@ "dev": true }, "@deckdeckgo/utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.1.0.tgz", - "integrity": "sha512-QUZMc6a4AMz+2tCtf87CDFHy6BR5tTW2CX+/NTdPdfw7HDiONTLTxkmGDdxBOt+1TJft08aughqI/5AFBH5pxQ==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-ahvUG7JzXXYni/tWskhJtm/o+2LX+3gtigd21XqGoP69D6lgVHnPy/qMTyINuhRmStEWn7HGBFqBMu5l9yC1Kg==" }, "@deckdeckgo/word-cloud": { "version": "1.2.0", diff --git a/studio/package.json b/studio/package.json index 0f8ccebd1..4d534370b 100644 --- a/studio/package.json +++ b/studio/package.json @@ -27,9 +27,9 @@ "@deckdeckgo/core": "^8.4.0", "@deckdeckgo/deck-utils": "^4.1.1", "@deckdeckgo/demo": "^2.1.0", - "@deckdeckgo/drag-resize-rotate": "^2.2.0", - "@deckdeckgo/highlight-code": "^3.4.0", - "@deckdeckgo/inline-editor": "^4.1.0", + "@deckdeckgo/drag-resize-rotate": "^2.2.1", + "@deckdeckgo/highlight-code": "^3.4.1", + "@deckdeckgo/inline-editor": "^4.1.1", "@deckdeckgo/laser-pointer": "^1.1.0", "@deckdeckgo/lazy-img": "^3.2.0", "@deckdeckgo/markdown": "^2.1.0", @@ -50,7 +50,7 @@ "@deckdeckgo/slide-utils": "^4.0.3", "@deckdeckgo/slide-youtube": "^2.4.0", "@deckdeckgo/social": "^4.1.0", - "@deckdeckgo/utils": "^2.1.0", + "@deckdeckgo/utils": "^2.3.0", "@deckdeckgo/word-cloud": "^1.2.0", "@deckdeckgo/youtube": "^2.1.0", "@ionic/core": "^5.8.4", diff --git a/utils/utils/CHANGELOG.md b/utils/utils/CHANGELOG.md index e3095ce86..90380f6a1 100644 --- a/utils/utils/CHANGELOG.md +++ b/utils/utils/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2.3.0 (2021-10-29) + +### Features + +- content editable function to catch and insert tabs + # 2.2.0 (2021-10-27) ### Features diff --git a/utils/utils/package.json b/utils/utils/package.json index 0fb87e0c0..863455941 100644 --- a/utils/utils/package.json +++ b/utils/utils/package.json @@ -1,6 +1,6 @@ { "name": "@deckdeckgo/utils", - "version": "2.2.0", + "version": "2.3.0", "author": "David Dal Busco", "description": "A collection of utils methods and functions developed for DeckDeckGo", "license": "MIT", diff --git a/utils/utils/src/index.ts b/utils/utils/src/index.ts index 92db4e1c4..dd960ee53 100644 --- a/utils/utils/src/index.ts +++ b/utils/utils/src/index.ts @@ -1,5 +1,6 @@ export * from './utils/utils'; -export * from './utils/image-utils'; -export * from './utils/inject-utils'; -export * from './utils/color-utils'; +export * from './utils/image.utils'; +export * from './utils/inject.utils'; +export * from './utils/color.utils'; export * from './utils/selection.utils'; +export * from './utils/editable.utils'; diff --git a/utils/utils/src/utils/color-utils.ts b/utils/utils/src/utils/color.utils.ts similarity index 100% rename from utils/utils/src/utils/color-utils.ts rename to utils/utils/src/utils/color.utils.ts diff --git a/utils/utils/src/utils/editable.utils.ts b/utils/utils/src/utils/editable.utils.ts new file mode 100644 index 000000000..a036b49b4 --- /dev/null +++ b/utils/utils/src/utils/editable.utils.ts @@ -0,0 +1,7 @@ +export const catchTab = ($event: KeyboardEvent) => { + if ($event?.key === 'Tab') { + $event.preventDefault(); + + document.execCommand('insertHTML', false, ' '); + } +}; diff --git a/utils/utils/src/utils/image-utils.ts b/utils/utils/src/utils/image.utils.ts similarity index 100% rename from utils/utils/src/utils/image-utils.ts rename to utils/utils/src/utils/image.utils.ts diff --git a/utils/utils/src/utils/inject-utils.ts b/utils/utils/src/utils/inject.utils.ts similarity index 100% rename from utils/utils/src/utils/inject-utils.ts rename to utils/utils/src/utils/inject.utils.ts diff --git a/webcomponents/highlight-code/CHANGELOG.md b/webcomponents/highlight-code/CHANGELOG.md index 18c7d416b..6e6732856 100644 --- a/webcomponents/highlight-code/CHANGELOG.md +++ b/webcomponents/highlight-code/CHANGELOG.md @@ -1,3 +1,9 @@ +# 3.4.1 (2021-10-29) + +### Refactor + +- move `catchTab` function to utils + # 3.4.0 (2021-10-15) ### Features diff --git a/webcomponents/highlight-code/package.json b/webcomponents/highlight-code/package.json index 9d98c8ac0..67e3ba6ea 100644 --- a/webcomponents/highlight-code/package.json +++ b/webcomponents/highlight-code/package.json @@ -1,6 +1,6 @@ { "name": "@deckdeckgo/highlight-code", - "version": "3.4.0", + "version": "3.4.1", "description": "A Web Component to highlight your code", "main": "dist/index.cjs.js", "module": "dist/index.js", @@ -24,7 +24,7 @@ "test.watch": "npm run config && stencil test --spec --e2e --watchAll" }, "dependencies": { - "@deckdeckgo/utils": "2.0.1", + "@deckdeckgo/utils": "^2.3.0", "prismjs": "^1.24.1" }, "devDependencies": { diff --git a/webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx b/webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx index f242e1cdd..1f224a134 100644 --- a/webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx +++ b/webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx @@ -1,6 +1,6 @@ import {Component, Prop, Watch, Element, Method, EventEmitter, Event, Listen, State, h, Host} from '@stencil/core'; -import {debounce} from '@deckdeckgo/utils'; +import {catchTab, debounce} from '@deckdeckgo/utils'; import {DeckDeckGoRevealComponent} from '@deckdeckgo/slide-utils'; import {loadTheme} from '../../utils/themes-loader.utils'; @@ -385,14 +385,6 @@ export class DeckdeckgoHighlightCode implements DeckDeckGoRevealComponent { this.refCode?.focus(); } - private catchTab = async ($event: KeyboardEvent) => { - if ($event && $event.key === 'Tab') { - $event.preventDefault(); - - document.execCommand('insertHTML', false, ' '); - } - }; - /** * @internal Used when integrated in DeckDeckGo presentations. Call `nextHighlight()`. */ @@ -507,7 +499,7 @@ export class DeckdeckgoHighlightCode implements DeckDeckGoRevealComponent { contentEditable={this.editable} onBlur={async () => await this.applyCode()} onInput={() => this.inputCode()} - onKeyDown={($event: KeyboardEvent) => this.catchTab($event)} + onKeyDown={($event: KeyboardEvent) => catchTab($event)} ref={(el: HTMLElement | null) => (this.refCode = el as HTMLElement)}>