-
Notifications
You must be signed in to change notification settings - Fork 287
fix: multiple trigger support in comment component at any position 🦊 #1854
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: dev
Are you sure you want to change the base?
fix: multiple trigger support in comment component at any position 🦊 #1854
Conversation
针对此问题修改的: |
c980a23
to
482beff
Compare
问题原因mention组件之前的代码实现是只选取了整个输入区域的第一个字符进行判断: if(props.trigger.includes(val[0])) 解决思路根据 #1762 中的描述,在文本输入区域的任意位置插入多个提及标识字符(默认为@),同时多个提及部分之间用空格隔开这样的交互更为合理,于是便按照这个思路进行修改。 const wordsWithoutSpace = val.split(' '); // 空格划分取出每个词
const lastWordIndex = wordsWithoutSpace.length - 1;
const lastWord = wordsWithoutSpace[lastWordIndex]; // 取出输入的最后一个词 如果最后一个词以 验证在mention组件的 demo 中体现的核心功能均无误,实现了用空格隔开便能在任意位置插入多个标识,自定义标识,异步加载列表,按下enter或点击选择列表项进行补全等功能,如下图所示i: |
* fix(build): fix error in typescript ast parsing * fix(build): fix path error in recent pnpm * chore(package): use `pnpm --filter` instead of `pnpm scripts` * chore(pnpm): bump lock file to v9 * chore(deps): remove 3 deprecated dependencies
* feat(ActionTimeline): ActionTimeline组件新增自定义icon位置的内容插槽,未传入时默认使用原方式,对现有使用不影响。DevCloudFE#1846 * feat(ActionTimeline): 删除多余的console DevCloudFE#1846
* 组件易用性优化,category-search组件唤出textInput时,input框自动聚焦 (DevCloudFE#1842) * fix(inputNumber): DevCloudFE#1843,支持inputNumber可以允许输入空串值,即用户删除掉所有值之后有效 * feat(inputNumber): 为允许输入空值(返回null 同ag版本)提供开关参数:allowEmpty。 修复历史代码中为通过语法校验的语法错误。(formContext存在未被定义的情况无法通过ts语法校验) * fix(lint): 预处理函数getPropsSlot无法通过ts校验,实际上这个函数无需校验。建议跳过校验或者定义成any类型 * feat: 新增允许为空验证的测试用例
…penSource/vue-devui into fix/mention-filter-trigger
@GreatZPP 同时这里建议使用原始的
由于无法简单的提取出原始 textarea 的 Dom 元素(因为 |
@CoderSerio 翻阅了一下 issue 列表,此 PR 同时解决了 #1304,可以将此 issue 也加入到 Fix 清单中 |
@CoderSerio 刚才翻阅 issue 的时候,发现此 PR 还解决了 #1611 ,可以把 #1611 也加入 Fix 清单😅😅 |
get,已经加上了 😂 |
fix #1762, fix #1304, fix #1611
另外,也修改了对应的mdx文档,因为在我本地环境下,原本mdx中组合式API的写法貌似并不能够正确绑定数据(数据总是undefined),而修改为选项式API后就没有这个问题了。
所以保险起见,对mdx文档进行了修改,现在comment组件文档统一使用选项式API了。