HarmonyOS 输入框输入表情包系统键盘会被激活后又关闭

使用第三方H5直播,在聊天中使用第三方提供的表情,输入时出现异常。

HarmonyOS
2024-12-26 14:50:28
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

根据描述,是想插入图片的同时,不弹出系统键盘。这边有一份demo:

<html lang="en">
  <head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Editor with Insert Image</title>
  <style>
#editor {
  border: 1px solid #ccc;
  padding: 10px;
  width: 100%;
  height: 200px;
  overflow-y: auto;
}
#insert-image-btn {
  margin-top: 10px;
}
</style>
  </head>
  <body>
  <div id="editor" contenteditable="true">
  <p>Type your text here...</p>
  </div>
  <button id="insert-image-btn">Insert Image</button>
  <script>
  document.getElementById('insert-image-btn').addEventListener('click', function() {
    var editor = document.getElementById('editor');
    var img = document.createElement('img');
    img.src = 'https://via.placeholder.com/150'; // Placeholder image URL
    img.alt = 'Inserted Image';
    img.style.width = '150px'; // Adjust the width as needed
    img.style.height = 'auto';
    // Insert the image at the end of the editor
    editor.appendChild(img);
    // Prevent focus shift to the editor, hence no keyboard pop-up
    editor.blur();
  });
</script>
  </body>
  </html>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
分享
微博
QQ
微信
回复
2024-12-26 16:57:25
相关问题
HarmonyOS 输入框屏蔽系统键盘
692浏览 • 1回复 待解决
HarmonyOS 键盘遮挡输入框
751浏览 • 1回复 待解决
HarmonyOS 如何控制输入框弹出键盘
1031浏览 • 1回复 待解决
HarmonyOS webview里的输入框键盘覆盖
725浏览 • 1回复 待解决
HarmonyOS 输入框与软键盘问题
874浏览 • 1回复 待解决
HarmonyOS 自定义键盘不能顶起输入框
1266浏览 • 1回复 待解决
HarmonyOS web中的输入框键盘遮住
752浏览 • 1回复 待解决
HarmonyOS 密码输入框
808浏览 • 1回复 待解决
获取输入框输入的内容
514浏览 • 2回复 待解决
HarmonyOS Web输入框键盘mode模式问题
914浏览 • 1回复 待解决
HarmonyOS 输入框只能输入字母和数字
1125浏览 • 1回复 待解决
HarmonyOS 适配-输入框问题
848浏览 • 1回复 待解决