Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyUp/keyDown event dispatch and textarea style support #4

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

dbFlower
Copy link

feat: dispatch keyUp/keyDown event
feat: support textAreaStyle

feat: support textAreaStyle
@vercel
Copy link

vercel bot commented May 29, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://rc-mentions-git-fork-dbflower-feature-keyboard-events-dispatch.react-component.now.sh

@dbFlower
Copy link
Author

master 上的 test 一样跑不过去,吐血。

@dbFlower
Copy link
Author

@zombieJ master上的ci一样跑不过去,而且本次提交不影响ci测试的部分

@zombieJ
Copy link
Member

zombieJ commented Jun 12, 2019

能举个例子什么情况需要这几个属性?

@dbFlower
Copy link
Author

dbFlower commented Jun 12, 2019

keyUp/keyDown -> 监听回车发送。
textAreaStyle -> 文本域自动高度设置(参考antd input内的 textarea)

@zombieJ
Copy link
Member

zombieJ commented Jun 12, 2019

拆成 2 个吧,先把 onKeyDownonKeyUp 弄了。

@zombieJ
Copy link
Member

zombieJ commented Jun 12, 2019

传递 measuring 的目的是什么?

@dbFlower
Copy link
Author

传递 measuring 的目的是什么?

  handleKeyDown: HoneyMentionsProps['onKeyDown'] = (e, measuring) => {
    if (measuring) {
      return;
    }
    // do something
 }

@dbFlower
Copy link
Author

拆成 2 个吧,先把 onKeyDownonKeyUp 弄了。

我先提交一个新的commit把textAreaStyle拔掉咯?

@zombieJ
Copy link
Member

zombieJ commented Jun 12, 2019

感觉需要包一下 (event, { measuring }),免得以后变成 (event, measuring, someState2, someState3, ...)

@dbFlower
Copy link
Author

关于textAreaStyle这个,其实不止缺少这一个,在实际使用中还缺少点其他的,我会新开一个issue讨论。 我现在先提交一个新的事件派发处理了

feat: use an object to wrap related states in  keyUp/keyDown event handler
@dbFlower
Copy link
Author

@zombieJ committed

src/Mentions.tsx Outdated
@@ -24,6 +24,15 @@ type BaseTextareaAttrs = Omit<

export type Placement = 'top' | 'bottom';

export interface MentionKeyBoardEventPayload {
measuring: MentionsState['measuring'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean

src/Mentions.tsx Outdated

export type MentionKeyBoardEventHandler = (
event: React.KeyboardEvent<HTMLTextAreaElement>,
payload?: MentionKeyBoardEventPayload,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

payload? => payload

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
此处不为可选的话过不了类型验证

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit 掉再自定义就行了。

@zombieJ
Copy link
Member

zombieJ commented Jun 12, 2019

还需要加对应的测试用例

@afc163
Copy link
Member

afc163 commented Dec 21, 2020

  • Please add test case.
  • Resolve conflicts

FlowerDb added 3 commits December 21, 2020 20:39
feat: support textAreaStyle
feat: use an object to wrap related states in  keyUp/keyDown event handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants