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>
分享
微博
QQ
微信
回复
2024-12-26 16:57:25
相关问题
HarmonyOS 输入框屏蔽系统键盘
243浏览 • 1回复 待解决
HarmonyOS 键盘遮挡输入框
274浏览 • 1回复 待解决
HarmonyOS 如何控制输入框弹出键盘
471浏览 • 1回复 待解决
HarmonyOS Web输入框键盘mode模式问题
441浏览 • 1回复 待解决
HarmonyOS webview里的输入框键盘覆盖
364浏览 • 1回复 待解决
HarmonyOS 输入框与软键盘问题
360浏览 • 1回复 待解决
HarmonyOS web中的输入框键盘遮住
383浏览 • 1回复 待解决
HarmonyOS 自定义键盘不能顶起输入框
776浏览 • 1回复 待解决
HarmonyOS 密码输入框
369浏览 • 1回复 待解决
HarmonyOS 输入框只能输入字母和数字
487浏览 • 1回复 待解决
HarmonyOS 自定义键盘输入框焦点问题
477浏览 • 1回复 待解决
HarmonyOS 修改输入框焦点
288浏览 • 1回复 待解决