diff --git a/src/app/components/inplace/inplace.ts b/src/app/components/inplace/inplace.ts index b6baa3b6991..ee08de5064a 100755 --- a/src/app/components/inplace/inplace.ts +++ b/src/app/components/inplace/inplace.ts @@ -38,8 +38,8 @@ export class InplaceContent {} - - + @@ -75,6 +75,11 @@ export class Inplace implements AfterContentInit { * @group Props */ @Input() preventClick: boolean | undefined; + /** + * Allows to prevent entering. + * @group Props + */ + @Input() preventEnter: boolean | undefined; /** * Inline style of the element. * @group Props @@ -142,9 +147,13 @@ export class Inplace implements AfterContentInit { if (!this.preventClick) this.activate(event); } - onDeactivateClick(event: MouseEvent) { - if (!this.preventClick) this.deactivate(event); + onDeactivateClick(event: MouseEvent | KeyboardEvent) { + if ('key' in event && event?.key === 'Enter') { + if (!this.preventEnter) this.deactivate(event); + event.preventDefault(); + } else if (!this.preventClick) this.deactivate(event); } + /** * Activates the content. * @param {Event} event - Browser event. @@ -172,7 +181,7 @@ export class Inplace implements AfterContentInit { } onKeydown(event: KeyboardEvent) { - if (event.code === 'Enter') { + if (event.code === 'Enter' && !this.preventEnter) { this.activate(event); event.preventDefault(); } diff --git a/src/app/showcase/doc/apidoc/index.json b/src/app/showcase/doc/apidoc/index.json index 5c7fc5a67b0..cd5b2319747 100644 --- a/src/app/showcase/doc/apidoc/index.json +++ b/src/app/showcase/doc/apidoc/index.json @@ -11809,6 +11809,14 @@ "default": "false", "description": "Allows to prevent clicking." }, + { + "name": "preventEnter", + "optional": false, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "Allows to prevent entering." + }, { "name": "style", "optional": false,