npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cordova-ohos/cordova-plugin-keyboard

v1.3.0

Published

Cordova keyboard Plugin

Readme

cordova-plugin-keyboard

插件简介

cordova-plugin-keyboard 是一款Cordova 键盘控制插件,专为混合移动应用设计,提供跨平台、精细化的键盘操作与适配解决方案。插件封装了 Android/iOS/OHOS 原生键盘 API,支持键盘显示 / 隐藏控制等核心功能,解决混合应用中键盘遮挡输入框、页面布局错乱、键盘操作无响应等常见问题,适用于表单填写、聊天输入、搜索框交互等各类场景。

插件核心优势:

重要提示: 在HamronyOS系统中,设置键盘模式在OHOS cordova的mainPage组件中,有参数设置webKeyboardAvoidMode设置键盘的避让方式,该插件主要为兼容原Android项目移植使用。框架库链接

  • 跨平台兼容:统一 Android/iOS/OHOS 键盘控制逻辑,API 调用无需区分平台

  • 精细化控制:支持手动显示 / 隐藏键盘、禁用键盘、调整键盘行为(如回车按钮样式)

  • 丰富事件监听:提供键盘显示 / 隐藏、高度变化、输入完成等完整事件回调

  • 轻量无依赖:不依赖第三方库,插件体积<50KB,集成成本低

  • 原生体验优化:适配平台特有键盘特性

安装与卸载

安装步骤

在 Cordova 项目根目录执行以下命令:

# 安装hcordova
npm install -g hcordova

# 基础安装
hcordova plugin add cordova-plugin-keyboard

# 从 GitCode 安装(获取最新开发版)
hcordova plugin add https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-keyboard.git --platform ohos

# 安装指定版本
hcordova plugin add [email protected]  --platform ohos

卸载步骤

如需移除插件,执行以下命令:

# 全平台卸载
hcordova plugin remove cordova-plugin-keyboard

# 指定ohos卸载
hcordova plugin remove cordova-plugin-keyboard  --platform ohos

API说明

1. 显示键盘,并监听获取到高度

function showKeyboard() {
    Keyboard.show();
    //输入库获取到焦点,也会自动显示键盘
    document.getElementById("inputId").focus();

}

2. 隐藏键盘

function hideKeyboard() {
    Keyboard.hide();
}

3. 键盘的显示说明

在OHOS Codova框架中,mainPage组件有设置键盘的弹窗方式参数,请参考框架库的说明

许可证

本插件基于 Apache License 开源,详见 LICENSE 文件。

联系方式

OHOS Cordova https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-keyboard

Android/iOS:https://npmjs.com/cordova-plugin-keyboard/issues