@codeages/math-editor
v1.7.0
Published
数学公式编辑器
Downloads
25
Readme
数学公式编辑器
本地开发环境
pnpm install
pnpm run dev使用
安装
pnpm install @codeages/math-editor使用例子
import {MathEditor} from "@codeages/math-editor";
const editor = new MathEditor(
document.getElementById('custom-ck-math-editor'),
'/path/to/math-editor.html',
{
defaultLateX: 'x^2',
class: ['my-editor-iframe']
}
); // 第一个参数为iframe编辑器的容器; 第二个参数为iframe的地址; 第三个参数选填,设置一些基本配置。
editor.on('ready', () => {
console.log('ready');
})
editor.on('update', (tex) => {
console.log(tex)
}) //公式编辑事件,参数为当前LaTeX格式字符串
editor.open(); //打开iframe公式编辑器
editor.set('y^2'); //设置公式(LaTeX格式)
editor.get(); // 'y^2'
editor.close(); // 关闭并销毁iframe,取消iframe和容器间的通信机制和事件监听克隆仓库。将public目录按照iframe地址,复制到项目中合适的位置。
