From ac6176ea1a03a01d81675ccaa95739702be10dbf Mon Sep 17 00:00:00 2001 From: ilyassBZ Date: Sat, 14 Sep 2024 03:19:38 +0100 Subject: [PATCH 1/7] fix:fixing mention dosnt work on chrom and on firfox when using azer keyboard --- src/Mentions.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mentions.tsx b/src/Mentions.tsx index 24f5b8e..9da0c0a 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -391,9 +391,11 @@ const InternalMentions = forwardRef( const matchOption = !!getOptions(nextMeasureText).length; if (validateMeasure) { + //adding AltGraph also fort azert kjeyboard if ( key === nextMeasurePrefix || key === 'Shift' || + key === 'AltGraph' || mergedMeasuring || (nextMeasureText !== mergedMeasureText && matchOption) ) { From 99f27f8f8480e5fdddaff69fd3d2bcfccf7de675 Mon Sep 17 00:00:00 2001 From: ilyassBZ Date: Sat, 14 Sep 2024 11:11:07 +0100 Subject: [PATCH 2/7] feat:addinf test case for azerty keys --- package.json | 2 +- tests/FullProcess.spec.tsx | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f0aa5fc..87d1312 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-mentions", - "version": "2.16.1", + "version": "2.16.2", "description": "React Mentions", "keywords": [ "react", diff --git a/tests/FullProcess.spec.tsx b/tests/FullProcess.spec.tsx index 348d082..bf24c2d 100644 --- a/tests/FullProcess.spec.tsx +++ b/tests/FullProcess.spec.tsx @@ -88,6 +88,25 @@ describe('Full Process', () => { expect(onChange).toBeCalledWith('1 @bamboo 2'); }); + it('azerty Keyboards ', () => { + const onChange = jest.fn(); + const { container } = createMentions({ onChange }); + simulateInput(container, '@'); + + //keyCode for ALTGR + fireEvent.keyUp(container.querySelector('textarea'), { + keyCode: 'AltGraph', + which: 225, + }); + expectMeasuring(container); + + fireEvent.keyDown(container.querySelector('textarea'), { + keyCode: KeyCode.ENTER, + which: KeyCode.ENTER, + }); + + expect(onChange).toBeCalledWith('@bamboo '); + }); it('reuse typed text', () => { const onChange = jest.fn(); const { container } = createMentions({ onChange }); From d1255a7a950d6d1428a9f889f32c3fe47a63325f Mon Sep 17 00:00:00 2001 From: ilyassBZ Date: Sat, 14 Sep 2024 11:26:05 +0100 Subject: [PATCH 3/7] fix:version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 87d1312..f0aa5fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-mentions", - "version": "2.16.2", + "version": "2.16.1", "description": "React Mentions", "keywords": [ "react", From d09fe09fe775203eeb2b9ecffde79c4b12d327c6 Mon Sep 17 00:00:00 2001 From: ilyass bzitar <67488922+ilyassBZ@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:01:52 +0100 Subject: [PATCH 4/7] Update src/Mentions.tsx Co-authored-by: afc163 --- src/Mentions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mentions.tsx b/src/Mentions.tsx index 22ab019..c0abe94 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -395,6 +395,7 @@ const InternalMentions = forwardRef( if ( key === nextMeasurePrefix || key === 'Shift' || + which === KeyCode.ALT || key === 'AltGraph' || mergedMeasuring || From 713706b8d84228c299c07fb427793400dde47bd7 Mon Sep 17 00:00:00 2001 From: ilyass bzitar <67488922+ilyassBZ@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:02:08 +0100 Subject: [PATCH 5/7] Update tests/FullProcess.spec.tsx Co-authored-by: afc163 --- tests/FullProcess.spec.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/FullProcess.spec.tsx b/tests/FullProcess.spec.tsx index ef4b585..b531ed9 100644 --- a/tests/FullProcess.spec.tsx +++ b/tests/FullProcess.spec.tsx @@ -107,6 +107,7 @@ describe('Full Process', () => { expect(onChange).toBeCalledWith('@bamboo '); }); + it('reuse typed text', () => { const onChange = jest.fn(); const { container } = createMentions({ onChange }); From 32714f2be34ed2ab35e401cd4ee5291b130addfd Mon Sep 17 00:00:00 2001 From: ilyass bzitar <67488922+ilyassBZ@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:02:23 +0100 Subject: [PATCH 6/7] Update tests/FullProcess.spec.tsx Co-authored-by: afc163 --- tests/FullProcess.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FullProcess.spec.tsx b/tests/FullProcess.spec.tsx index b531ed9..b202fb9 100644 --- a/tests/FullProcess.spec.tsx +++ b/tests/FullProcess.spec.tsx @@ -93,7 +93,7 @@ describe('Full Process', () => { const { container } = createMentions({ onChange }); simulateInput(container, '@'); - //keyCode for ALTGR + // keyCode for ALTGR fireEvent.keyUp(container.querySelector('textarea'), { keyCode: 'AltGraph', which: 225, From 507362d370ec2d935c4ddb1d70e08c15125fb429 Mon Sep 17 00:00:00 2001 From: ilyass bzitar <67488922+ilyassBZ@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:02:37 +0100 Subject: [PATCH 7/7] Update src/Mentions.tsx Co-authored-by: afc163 --- src/Mentions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mentions.tsx b/src/Mentions.tsx index c0abe94..668b535 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -391,7 +391,7 @@ const InternalMentions = forwardRef( const matchOption = !!getOptions(nextMeasureText).length; if (validateMeasure) { - //adding AltGraph also fort azert kjeyboard + // adding AltGraph also fort azert keyboard if ( key === nextMeasurePrefix || key === 'Shift' ||