1 Star 0 Fork 12

FormulaHj / Formula-Editor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

老铁,走过路过给个 ⭐️

点个 ⭐️,不迷路

MIT License Copyright (c) 2019 SugarTeam Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于百度 kityformula-editor 开发的公式编辑器,有 android 和 web 两种模式 安装 npm install npm install -g anywh 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/formula-hj/Formula-Editor.git
git@gitee.com:formula-hj/Formula-Editor.git
formula-hj
Formula-Editor
Formula-Editor
master

搜索帮助