5 Star 30 Fork 12

Gitee 极速下载 / Formula-Editor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/SugarTurboS/Formula-Editor
克隆/下载
README.md 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
Demian1996 提交于 2020-09-24 12:19 . [feature][what]更新readme

Welcome to formula-editor 👋

基于百度 kityformula-editor 开发的公式编辑器,有 android 和 web 两种模式

安装依赖

npm install
npm install -g anywhere // 随启随用的静态服务器

使用

grunt build
anywhere -p {port} // 这里anywhere是为了开静态服务器,预览index.html

以 web 为例,url 中传入?device=pc&protocol=documentEvent,然后运行项目。点击键盘中的字符,即可生成对应 latex 公式,点击”确定“按钮导出公式,控制台可以通过以下代码拿到最终的 latex 值和相应的 base64 图片。

document.addEventListener('documentMessage', (e) => {
  const { type } = e?.detail;
  const msg = e?.detail?.data?.body;
  if (type !== 'common.setFormula') return;
  console.log('msg', msg.formula, msg.formulaSrc); // msg 123 data:image/png;......
});

其他信令请参照下方的信令详情

信令

公式编辑器支持 webview, iframe, documentEvent3 种通信方式,详细信令参照: 信令详情

特性

设备类型:device - pc/android

{ip地址}:{port}?device=android

协议类型:protocol - iframe/webview/documentEvent

{ip地址}:{port}?protocol=webview

设备宽度:width

{ip地址}:{port}?width=1920

样式

安卓:

{ip地址}:{port}?device=android&protocol=webview&width=1920

android

web:

{ip地址}:{port}?device=pc&protocol=documentEvent&width=1920

web

老铁,走过路过给个 ⭐️

点个 ⭐️,不迷路

JavaScript
1
https://gitee.com/mirrors/Formula-Editor.git
git@gitee.com:mirrors/Formula-Editor.git
mirrors
Formula-Editor
Formula-Editor
master

搜索帮助