emoji-vue
emoji-vue copied to clipboard
emoji的位置问题
为什添加emoji的时候,会被添加到首行啊
English please?
English please?
when i insert a emoji, the emoji was insert into this first place ,why?
可以参考这个:
let tc = document.getElementById('comment_text');
tc.focus();
//开始插入
let tclen = tc.value.length;
//计算表情长度。
var emoji_length = emoji.length;
if (typeof document.selection != "undefined") {
document.selection.createRange().text = emoji;
}
else {
//记录光标的起始位置
var position = tc.selectionStart;
//计算表情长度。
var emoji_length = emoji.length;
position = position + emoji_length;
tc.value = tc.value.substr(0, tc.selectionStart) + emoji + tc.value.substring(tc.selectionStart, tclen);
this.insert_comment.comment_text = tc.value;
tc.selectionStart = tc.selectionEnd = position;
}
@koibi2 is it a solution block of code ? or a source of an issue?
@koibi2 is it a solution block of code ? or a source of an issue?
this is a solution block of code:
search where is the cursor, then let new string replace old string.
great, I'll try to apply that
I've been testing it now and can't confirm the issue
@koibi2 这段代码是添加到哪里的?我添加到源码里也不起作用啊,报错。
@koibi2 这段代码是添加到哪里的?我添加到源码里也不起作用啊,报错。
[汗]我这是其他代码片的示例。具体就是“获取光标位置”那几行代码,加进去就行了。
可以参考这个:
let tc = document.getElementById('comment_text'); tc.focus(); //开始插入 let tclen = tc.value.length; //计算表情长度。 var emoji_length = emoji.length; if (typeof document.selection != "undefined") { document.selection.createRange().text = emoji; } else { //记录光标的起始位置 var position = tc.selectionStart; //计算表情长度。 var emoji_length = emoji.length; position = position + emoji_length; tc.value = tc.value.substr(0, tc.selectionStart) + emoji + tc.value.substring(tc.selectionStart, tclen); this.insert_comment.comment_text = tc.value; tc.selectionStart = tc.selectionEnd = position; }
@koibi2 不起作用。还是会被添加到首行。
@koibi2 你好,请问一下你知道怎么在jsp中使用这个emoji组件吗?
@koibi2 你好,请问一下你知道怎么在jsp中使用这个emoji组件吗?
我放弃用这个组件了。帮不上你的忙。
@koibi2 你好,请问一下你知道怎么在jsp中使用这个emoji组件吗?
我放弃用这个组件了。帮不上你的忙。
好的,谢谢你。
@koibi2 你好,请问一下你知道怎么在jsp中使用这个emoji组件吗?
我放弃用这个组件了。帮不上你的忙。
好的,谢谢你。
为什添加emoji的时候,会被添加到首行啊
问题解决了吗?
为什添加emoji的时候,会被添加到首行啊
问题解决了吗?
虽然我后来已经用了另一个方案了,不过还是非常感谢您帮忙解答!
------------------ 原始邮件 ------------------ 发件人: "guanym"[email protected]; 发送时间: 2019年10月16日(星期三) 中午1:43 收件人: "shershen08/emoji-vue"[email protected]; 抄送: "展佳俊"[email protected];"Comment"[email protected]; 主题: Re: [shershen08/emoji-vue] emoji的位置问题 (#4)
把这个地方注释掉就可以了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
为什添加emoji的时候,会被添加到首行啊 为啥不清楚,只知道绑定了value值会出现这个情况,只需要不填:value属性就行,然后清空就调用clearTextarea()方法
作者可以再开放几个属性吗?比如点击输入框高亮得颜色,以及表情得边框颜色