一、tinymce+kityformula-editor
-
官网:http://tinymce.ax-z.cn/
-
安装tinymce
https://www.jianshu.com/p/aa01ba44ce99
安装tinymce
npm install tinymce -S
安装tinymce-vue
npm install @tinymce/tinymce-vue -S
安装mathjax-full
npm install mathjax-full
index.html中引入 tinymce js
-
vue安装tinymce参考链接
在vue2.0+,vuecli3.0+中使用tinymce及实现多图上传,文件上传,公式编辑等功能 - huihuihero - 博客园
-
tinymce安装后遇见的问题
1、报错failed to fetch dynamically imported module
最后没有按照安装官网步骤在main文件注册,而是直接在使用的地方引用就不会报错
2、报错failed to resolve import 'tinymce/plugins/fullpage' from 'src\components\TEditor.vue'
发现如下插件都会报错
简单粗暴的将这些都注释了
3、报错/models/dom/model.js nre::ERR_ABORTED 404 (NOT FOUND) tinymce.js:4947
解决办法:
在TEditor.vue文件添加如下代码:
import 'tinymce/models/dom/model.js'
4、报错failed to load plugin:template from url plugins/template/plugin.js
因为上面已经注释了相关import文件引入,但是下面plugins没有删除掉
解决办法:将文件中这两个里面,相关注释掉的都删除
5、报错/skins/content/default/content.css 404
修改TEditor.vue如下代码:
-
引入kityformula-editor实现公式
安装步骤,参考链接:kityformula-editor 数学公式 | TinyMCE中文文档中文手册
下载好压缩包
在node_modules目录中将timymce下plugins文件夹复制粘贴到public->tinymce下
将解压后的 kityformula-editor 包放到里面
TEditor.vue文件调整代码
-
引入kityformula-editor后出现的问题
1、没有显示公式两字
在index.html中加入如下代码
2、点击公式,打开弹窗报错/plugins/kityformula-editor/kityformula.html 404
修改kityformula-editor文件下的plugin.js和plugin.min.js文件的这行代码
-
插入的公式会被识别成图片
在kityformula-editor的包里面有个plugin.js、plugin.min.js,他的代码第10行对base64图片双击时进行了字符串格式判断,他判断的是整个字符串是一个img标签,然而我们最终得到的是p标签包裹的img以及其他的元素,所以我们直接把这个if判断去掉就可以了。
-
复制进去的latex公式无法在编辑框中正确回显为公式
主要代码如下:
<template>
<div>
<editor
api-key="your-api-key"
v-model="content"
:init="editorInit"
@paste="handlePaste"
/>
</div>
</template>
<script>
import Editor from '@tinymce/tinmime-vue';
export default {
components: {
editor: Editor,
},
data() {
return {
content: '',
editorInit: {
height: 500,
menubar: false,
plugins: 'paste',
toolbar: 'undo redo | bold italic | alignleft aligncenter alignright',
paste_preprocess: this.pastePreprocess,
},
};
},
methods: {
handlePaste(e) {
// 处理粘贴事件,这里可以做一些预处理
console.log('粘贴事件触发', e);
},
async pastePreprocess(plugin, args) {
const content = args.content;
if (content.includes('$')) { // 假设使用 $ 符号包围数学公式
const formulaImages = await this.convertFormulasToBase64(content);
args.content = this.replaceFormulasWithImages(formulaImages, content);
}
},
async convertFormulasToBase64(content) {
const formulas = content.match(/\$.*?\$/g); // 匹配所有的数学公式
const formulaImages = {};
for (const formula of formulas) {
const cleanFormula = formula.slice(1, -1); // 去掉公式的包围符号
const imageUrl = await this.renderLaTeX(cleanFormula);
const base64Image = await this.fetchBase64(imageUrl);
formulaImages[formula] = base64Image;
}
return formulaImages;
},
async renderLaTeX(formula) {
// 使用一个在线的 LaTeX 渲染服务来获取公式的图片链接
const response = await fetch(`https://latex.codecogs.com/png.latex?${encodeURIComponent(formula)}`);
const url = response.url;
return url;
},
async fetchBase64(url) {
const response = await fetch(url);
const blob = await response.blob();
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.onerror = reject;
reader.readAsDataURL(blob);
});
},
replaceFormulasWithImages(formulaImages, content) {
let result = content;
for (const [formula, base64Image] of Object.entries(formulaImages)) {
result = result.replace(formula, `<img src="${base64Image}" alt="${formula}">`);
}
return result;
},
},
};
</script>
-
公式创建完成以后保存下来的字符串,回显时无法正确回显(研究发现是data-latex中的\被误认为是转义字符了)
我们在拿到最终生成的字符串值以后,需要对这个字符串处理一下,将字符串中的\都替换为\\以后再上传给服务器。以下两种方案都可以的:
假设最终拿到的公式字符串存为content,
content.split('\\').join('\\\\')
content.replace(/\\/g,'\\\\')
-
图片不上传,直接使用base64会提示图片上传失败
将init中加入automatic_uploads: false,禁止图片自动上传我们只使用base64记录图片,我们也尝试过万一其他图片需要上传怎么办,后来发现这个base64图片的配置确实会影响到其他正常上传的图片。也就是说要么都用base64,要么都上传到服务器,不过我们肯定是不希望数学公式上传到服务器的,因为我并不需要记录他。
-
实际效果图
-
去除菜单栏-Upgrade
-
去除菜单栏全部
menubar: false
-
去除公式插入的图片padding白边
找到该js文件,全局搜索padding,将所有padding值改为0,部分padding是数组,则改为[0,0]
-
离开页面出现提示弹窗
第一种方法:init内加上
autosave_ask_before_unload:false
第二种方法
去除插件:autosave
-
插入公式后,重复操作保存按钮,公式会丢失
正在找办法
-
自定义上传图片插件
注意:必须用new Promise包裹,否则tinymce上传图片报错:图像上传失败:Cannot read properties of undefined (reading 'then')
-
修改上传图片插件,默认展示上传
注意:必须用new Promise包裹,否则tinymce上传图片报错:图像上传失败:Cannot read properties of undefined (reading 'then')
1、首先在node_modules
里找到tinymce图片插件源码,并将image文件拷贝到public
2、修改plugin.js
1474行代码
//原本
tabs: flatten([
[MainTab.makeTab(info)],
info.hasAdvTab ? [AdvTab.makeTab(info)] : [],
info.hasUploadTab && (info.hasUploadUrl || info.hasUploadHandler) ? [UploadTab.makeTab(info)] : []
])
//修改为
tabs: flatten([
info.hasUploadTab && (info.hasUploadUrl || info.hasUploadHandler) ? [UploadTab.makeTab(info)] : [],
[MainTab.makeTab(info)],
info.hasAdvTab ? [AdvTab.makeTab(info)] : []
])
3、将plugin.js
文件压缩后替换plugin.min.js
文件;或者修改index.js
引入为import './plugin.js'
4、引入本地修改后的image插件
二、tinymce+kityformula-editortinymce+mathtype
-
官网:MathType for TinyMCE
-
下载
npm install @wiris/mathtype-tinymce6(根据tinymce的版本确定数字)
-
实际代码
init: {
...同组件代码一言,不在展示
external_plugins: {'tiny_mce_wiris': '/node_modules/@wiris/mathtype-tinymce6/plugin.min.js',},//node_modules前必须加/
extended_valid_elements: '*[.*]',
toolbar: ['...tiny_mce_wiris_formulaEditor...',
'...',//工具栏配置
],
}
三、tinymce+mathlive
npm install mathlive
tinymce+mathlive
use跨域
参考链接:use标签的跨域问题到iconfont的基本原理 - 哔哩哔哩
MathFieldComponents.vue
<template>
<el-dialog title="公式编辑" custom-class="math-field-dialog" v-model="showMathField" width="888px" :show-close="false" :close-on-click-modal="false" draggable>
<el-row :gutter="8">
<el-col :span="3" v-for="(item, index) in formulateArray" :key="item.id" style="margin-bottom: 8px">
<el-popover
placement="bottom"
:title="item.name"
:width="202"
trigger="hover"
:ref="
el => {
if (el) popoverRefs[index] = el
}
"
:show-after="400"
>
<template #reference>
<div class="formula-button" @mouseenter="item.expandStatus = true" @mouseleave="item.expandStatus = false">
<svg class="use-button" aria-hidden="true">
<use crossorigin="anonymous" :href="svgBasePath + item.id"></use>
</svg>
<img class="dowm-icon" src="/mathlive-icon/up-icon.png" alt="" v-if="item.expandStatus" />
<img class="dowm-icon" src="/mathlive-icon/dowm-icon.png" alt="" v-else />
</div>
</template>
<template #default>
<div class="math-field-conent" style="display: flex; gap: 6px; flex-wrap: wrap">
<template v-for="equtaion in item.equtaions" :key="equtaion.id">
<div class="math-field-conent-item" @click="clickFormula(equtaion.latex, index)" v-if="equtaion.id && equtaion.latex && !equtaion.disabled && !equtaion.matrixType">
<svg class="use-latex" aria-hidden="true">
<use crossorigin="anonymous" :href="svgBasePath + equtaion.id"></use>
</svg>
</div>
<el-tooltip class="box-item" effect="dark" placement="bottom" v-if="equtaion.id && equtaion.latex && equtaion.disabled">
<template #content>该公式暂不支持可视化编辑</template>
<div class="math-field-conent-item" style="filter: invert(0.7); background-color: transparent !important">
<svg class="use-latex" aria-hidden="true">
<use crossorigin="anonymous" :href="svgBasePath + equtaion.id" style="fill: #e5e5e5"></use>
</svg>
</div>
</el-tooltip>
</template>
</div>
</template>
</el-popover>
</el-col>
</el-row>
<div class="math-field-control-wrap" @click.stop>
<el-switch v-model="switchValue" />
<div class="math-field-control-label">LaTex</div>
<el-tooltip class="box-item" effect="dark" placement="bottom-start">
<template #content>
在LaTex模式下,点击公式按钮,在相应{}中输入内容即可;
<br />
预览位置报错,可尝试在符号的LaTex后边输入空格。
</template>
<icon-park type="help" size="16" theme="outline" fill="#e5e5e5"></icon-park>
</el-tooltip>
</div>
<div class="math-field-wrap math-field-wrap-input" v-if="switchValue" style="z-index: 999">
<el-input v-model="latestFormula" style="width: 100%" type="textarea" :autosize="{ minRows: 3, maxRows: 3 }" resize="none" clearable @change="changeInput" />
</div>
<div @click.stop :class="['math-field-wrap', switchValue ? 'math-field-wrap-math' : '']" ref="mathField" style="width: 100%; overflow-x: auto"></div>
<template #footer>
<icon-park @click.stop="resetHandle" type="close" size="24" theme="outline" style="margin-right: 40px; cursor: pointer"></icon-park>
<icon-park @click.stop="submitHandle" type="check" size="24" theme="outline" fill="#1979FF" style="margin-right: 16px; cursor: pointer"></icon-park>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="MathFieldComponents">
import { onMounted, ref, watch, computed } from 'vue'
import { MathfieldElement } from 'mathlive'
import _ from 'lodash'
import { formulateArray, formulateReplace } from '@/assets/mathlive-icon/mathEditor.js'
import { relationshipTransformation } from '@/utils/tool'
// // 引用 DOM 元素
const latestFormula = ref('')
const mathField = ref(null)
const popoverRefs = ref([])
const showMathField = ref<boolean>(false)
const switchValue = ref<boolean>(false)
const domain = window.location.hostname === 'localhost' ? '' : window.location.protocol + '//' + window.location.hostname
const svgBasePath = domain + '/mathlive-icon/mathlive.svg#icon-'
MathfieldElement.fontsDirectory = '/fonts/'
MathfieldElement.soundsDirectory = '/sounds/'
const mfe: any = new MathfieldElement()
const emit = defineEmits(['handleBlur', 'input', 'resetHandle'])
const props = defineProps({
value: {
type: String,
default: ''
},
hasBlur: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
})
// watch(
// () => props.value,
// newVal => {
// latestFormula.value = newVal
//mfe.insert(newVal)
// }
// )
onMounted(() => {
// if (mathField.value) {
// const mfe: any = new MathfieldElement()
// // 添加输入监听
// mfe.addEventListener('input', () => {
// console.log('==========mfe.value', mfe.value)
// latestFormula.value = mfe.value
// })
// mathField.value.appendChild(mfe)
// }
})
const formulaShowHandle = (e: any) => {
console.log('===============formulaShowHandle e', e)
showMathField.value = true
setTimeout(() => {
if (mathField.value) {
// 添加输入监听
mfe.addEventListener('input', () => {
latestFormula.value = mfe.value
})
mathField.value.appendChild(mfe)
let newVal = relationshipTransformation(e)
mfe.setValue(newVal)
latestFormula.value = newVal
}
}, 0)
}
defineExpose({ getFormula: () => latestFormula.value, formulaShowHandle })
const resetHandle = () => {
showMathField.value = false
switchValue.value = false
latestFormula.value = ''
mathField.value = null
emit('resetHandle')
}
const clickFormula = (str: string, index: number) => {
formulateArray[index].expandStatus = false
popoverRefs.value[index].hide()
let newStr = str
const keys = Object.keys(formulateReplace)
let findIn = keys?.findIndex((item: any) => newStr.indexOf(item) >= 0)
if (findIn > -1) {
const key = keys[findIn]
newStr = newStr.replace(key, formulateReplace[key])
}
latestFormula.value = latestFormula.value + newStr
if (mathField.value) {
mfe.insert(newStr)
}
}
const submitHandle = () => {
emit('handleBlur', latestFormula.value)
setTimeout(() => {
resetHandle()
}, 0)
}
const changeInput = (val: string) => {
latestFormula.value = val
mfe.setValue(latestFormula.value)
}
</script>
<style lang="scss">
.math-field-dialog {
.ep-dialog__header{
border: 1px solid #e5e5e5;
}
math-field {
min-height: 80px;
padding: 6px;
width: calc(100% - 0px);
box-sizing: border-box;
border: 1px solid #e5e5e5;
border-radius: 0 0 4px 4px;
overflow-x: auto;
//隐藏键盘图标
&::part(virtual-keyboard-toggle) {
display: none !important;
}
//隐藏键盘图标
&::part(menu-toggle) {
display: none !important;
}
//输入框增加滚动条
&::part(container) {
// overflow-x: auto !important;
// display: inline;
// pointer-events: auto !important;
// touch-action: all !important;
}
&::part(content) {
// overflow: auto !important;
overflow-x: auto !important;
display: inline !important;
font-size: 20px !important;
}
/* 新版选择器 */
.MLK__toggle {
opacity: 0 !important;
pointer-events: none !important;
}
//隐藏键盘图标
}
}
.math-field-dialog {
// .ep-dialog__header {
// display: none !important;
// }
.math-field-wrap-input {
.ep-textarea,
.ep-textarea__inner {
height: 80px !important;
min-height: 80px !important;
font-size: 14px;
}
.ep-textarea__inner {
padding: 16px 11px !important;
}
}
}
</style>
<style lang="scss" scoped>
.math-field-dialog {
position: relative;
width: 100%;
padding: 24px;
box-sizing: border-box;
height: 300px;
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.1019607843);
border: 1px solid #e5e5e5;
border-radius: 16px;
z-index: 9999;
background-color: #fff;
position: absolute;
left: 0;
.formula-button {
position: relative;
cursor: pointer;
height: 16px;
padding: 6px 8px;
background-color: #f0f2f5;
border-radius: 2px;
margin-right: 8px;
text-align: center;
display: flex;
align-items: center;
.dowm-icon {
position: absolute;
top: 12px;
right: 8px;
width: 8px;
height: 8px;
}
}
.math-field-control-wrap {
display: flex;
justify-content: flex-end;
align-items: center;
height: 40px;
background: #fff;
border-radius: 4px 4px 0 0;
border: 1px solid #e5e5e5;
border-bottom: none;
padding: 0 12px;
.math-field-control-label {
margin: 0 4px 0 8px;
font-size: 14px;
color: #212329;
}
}
.math-field-wrap-input {
position: absolute;
width: calc(100% - 32px - 32px - 40px);
height: 80px;
z-index: 999;
}
.math-field-wrap-math {
opacity: 0;
}
}
.math-field-conent-item {
cursor: pointer;
padding: 2px;
border-radius: 2px;
flex-wrap: wrap;
}
.math-field-conent-item:hover {
background-color: #f0f2f5;
}
.use-button {
width: 48px;
height: 16px;
}
.use-latex {
width: 20px;
height: 20px;
}
</style>
TEditor.vue
<template>
<div class="tinymce-box">
<Editor ref="editorRef" v-model="contentValue" :init="init" :disabled="disabled" @onClick="onClick" @blur="handleBlur" @init="onInit" />
<!-- <Editor ref="editorRef" v-model="contentValue" :init="init" :disabled="disabled" @onClick="onClick" @paste="handlePaste" @blur="handleBlur" @init="onInit" /> -->
<math-field-components ref="MathfieldRef" @handleBlur="changeFieldBlur" @resetHandle="ifOPenDialog = false" />
</div>
</template>
<script>
// import api from '@/services/rootapi/api.js'
//这里的api是我定义的接口文件(一般情况下你只需要引入你的接口配置文件就可以了)
//如果不懂看下面代码,我附上了我的api文件
//引入tinymce编辑器
import Editor from '@tinymce/tinymce-vue'
import _ from 'lodash'
import { mathjax } from 'mathjax-full/js/mathjax.js'
import { TeX } from 'mathjax-full/js/input/tex.js'
import { SVG } from 'mathjax-full/js/output/svg.js'
import { liteAdaptor } from 'mathjax-full/js/adaptors/liteAdaptor.js'
import { RegisterHTMLHandler } from 'mathjax-full/js/handlers/html.js'
import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages.js'
//引入node_modules里的tinymce相关文件文件
import tinymce from 'tinymce/tinymce' //tinymce默认hidden,不引入则不显示编辑器
import 'tinymce/themes/silver' //编辑器主题,不引入则报错
import 'tinymce/icons/default' //引入编辑器图标icon,不引入则不显示对应图标
import 'tinymce/models/dom/model.js'
// 引入编辑器插件(基本免费插件都在这儿了)
import 'tinymce/plugins/advlist' //高级列表
import 'tinymce/plugins/anchor' //锚点
import 'tinymce/plugins/autolink' //自动链接
import 'tinymce/plugins/autoresize' //编辑器高度自适应,注:plugins里引入此插件时,Init里设置的height将失效
import 'tinymce/plugins/autosave' //自动存稿
import 'tinymce/plugins/charmap' //特殊字符
import 'tinymce/plugins/code' //编辑源码
import 'tinymce/plugins/codesample' //代码示例
import 'tinymce/plugins/directionality' //文字方向
import 'tinymce/plugins/emoticons' //表情
// import 'tinymce/plugins/fullpage' //文档属性
import 'tinymce/plugins/fullscreen' //全屏
import 'tinymce/plugins/help' //帮助
// import 'tinymce/plugins/hr' //水平分割线
import '/public/tinymce/plugins/image/index' //插入编辑图片
import 'tinymce/plugins/importcss' //引入css
import 'tinymce/plugins/insertdatetime' //插入日期时间
import 'tinymce/plugins/link' //超链接
import 'tinymce/plugins/lists' //列表插件
import 'tinymce/plugins/media' //插入编辑媒体
import 'tinymce/plugins/nonbreaking' //插入不间断空格
import 'tinymce/plugins/pagebreak' //插入分页符
// import 'tinymce/plugins/paste' //粘贴插件
import 'tinymce/plugins/preview' //预览
// import 'tinymce/plugins/print' //打印
import 'tinymce/plugins/quickbars' //快速工具栏
import 'tinymce/plugins/save' //保存
import 'tinymce/plugins/searchreplace' //查找替换
// // import 'tinymce/plugins/spellchecker' //拼写检查,暂未加入汉化,不建议使用
// import 'tinymce/plugins/tabfocus' //切入切出,按tab键切出编辑器,切入页面其他输入框中
import 'tinymce/plugins/table' //表格
// import 'tinymce/plugins/template' //内容模板
// import 'tinymce/plugins/textcolor' //文字颜色
// import 'tinymce/plugins/textpattern' //快速排版
// import 'tinymce/plugins/toc' //目录生成器
import 'tinymce/plugins/visualblocks' //显示元素范围
import 'tinymce/plugins/visualchars' //显示不可见字符
import 'tinymce/plugins/wordcount' //字数统计
import { imgToLatex, removePTagsFromRichText, handleSymbol, replaceImageLinksToImgTags } from '@/utils/tool'
import { simpleSystemUpload } from '@/api/common'
import MathFieldComponents from './MathFieldComponents.vue'
var env = import.meta.env
var base = env.VITE_BASE_NODE_ENV === 'development' ? 'http://localhost:8081/' : env.VITE_BASE_NODE_ENV === 'test' ? 'https://ai-qusetionbanktest.jtyjy.com/' : 'https://ai-qusetionbank.jtyjy.com/'
const adaptor = liteAdaptor()
export default {
name: 'TEditor',
components: {
Editor,
MathFieldComponents
},
props: {
placeholder: {
type: String,
default: ''
},
value: {
type: String,
default: ''
},
hasBlur: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
plugins: {
type: [String, Array],
default:
'preview autoresize searchreplace autolink directionality visualblocks visualchars fullscreen image link media code codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount autosave '
// default:
// 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern autosave '
},
toolbar: {
type: [String, Array],
default: 'fullscreen myCustomButton image'
// default:
// 'fullscreen undo redo restoredraft | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | \
// styleselect formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
// table image media charmap hr pagebreak insertdatetime print preview | code selectall searchreplace visualblocks | indent2em lineheight formatpainter axupimgs'
}
},
data() {
const that = this
return {
ifOPenDialog: false,
cursorPosition: 0,
init: {
promotion: false, //去除upgrade
menubar: false, //去除工具栏
language_url: base + 'tinymce/langs/zh_CN.js', //引入语言包文件
language: 'zh_CN', //语言类型
skin_url: base + 'tinymce/skins/ui/oxide', //皮肤:浅色
// skin_url: '/tinymce/skins/ui/oxide-dark',//皮肤:暗色
plugins: this.plugins, //插件配置
toolbar: this.toolbar, //工具栏配置,设为false则隐藏
license_key: 'gpl', // 添加这一行
// menubar: 'file edit', //菜单栏配置,设为false则隐藏,不配置则默认显示全部菜单,也可自定义配置--查看 http://tinymce.ax-zcn/configure/editor-appearance.php --搜索“自定义菜单”
fontsize_formats: '14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', //字体大小
font_formats: 'PingFang SC, Helvetica Neue, Helvetica, microsoft yahei, arial, STHeiTi, sans-serif', //字体样式
//自带默认字体:'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats'
lineheight_formats: '0.5 0.8 1 1.2 1.5 1.75 2 2.5 3 4 5', //行高配置,也可配置成"12px 14px 16px 20px"这种形式
// 自适应高度配置
min_height: 170,
max_height: 1000, // 设置较大的最大高度以允许内容增长
autoresize_min_height: 100,
autoresize_max_height: 1000,
autoresize_bottom_margin: 5,
autoresize_on_init: true,
autoresize_overflow_padding: 5,
// 移除可能影响自适应的配置
height: undefined, // 移除固定高度
resize: false,
placeholder: this.placeholder,
branding: false, //tiny技术支持信息是否显示
elementpath: false, //元素路径是否显示
// relative_urls: false, //false: tinymce将不再自动将文件路径由绝对转为相对
// convert_urls: false, //false: tinymce将不再自动处理文件路径
content_style: `
body {
line-height: 1.5;
font-size: 14px;
}
p {
margin: 8px 0;
line-height: 24px;
}
img {
max-width: 100%;
vertical-align: middle;
margin: 0 2px;
}
`,
content_css: base + 'tinymce/skins/content/default/content.css', //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入
// content_css: '/tinycontent.css', //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入
// images_upload_url: base + 'storage/content-file/simpleSystemUpload', //后端处理程序的url,建议直接自定义上传函数images_upload_handler,这个就可以不用了
// images_upload_base_path: '/demo', //相对基本路径--关于图片上传建议查看--http://tinymce.ax-zcn/configure/file-image-upload.php,设置自定义上传函数images_upload_handler,这个就可以不用了
paste_data_images: false, //图片是否可粘贴
automatic_uploads: true, //这个必须为true,否则images_upload_handler函数不会被调用
images_upload_handler: (blobInfo, successFun, failureFun) =>
new Promise((resolve, reject) => {
let file = blobInfo.blob() //转化为易于理解的file对象
if (!file.name) {
return false
}
if (file.size && file.size > 2000 * 1024) {
onceMessage.warning('图片大小不能大于2M')
return false
}
if (file.name.indexOf('.jpeg') === -1 && file.name.indexOf('.jpg') === -1 && file.name.indexOf('.png') === -1 && file.name.indexOf('.gif') === -1) {
onceMessage.warning('图片类型必须是jpeg,jpg,png,gif')
return false
}
let formdata = new FormData()
formdata.append('file', file)
formdata.append('systemKey', 'question-bank')
formdata.append('folderld', '')
simpleSystemUpload(formdata)
.then(res => {
successFun(res.data)
resolve(res.data)
})
.catch(e => {
failureFun('上传出错,服务器开小差了呢')
reject()
return
})
}),
setup: function (editor) {
editor.on('init', function () {
// 让编辑器获得焦点
editor.focus()
})
editor.on('copy', function (e) {
let selectedContent = editor.selection.getContent()
selectedContent = imgToLatex(selectedContent)
selectedContent = removePTagsFromRichText(selectedContent)
selectedContent = handleSymbol(selectedContent)
console.log('=========selectedContent', selectedContent)
e.clipboardData.setData('text/plain', selectedContent)
e.preventDefault()
})
// 监听光标改变事件
editor.on('focus', () => {
console.log('Editor focused')
// 可以在这里获取光标位置
})
editor.on('blur', () => {
console.log('Editor blurred')
// 可以在这里获取光标位置
})
editor.on('NodeChange', e => {
const range = editor.selection.getRng() // 获取选区范围
this.cursorPosition = range.startOffset // 获取光标的偏移位置
// console.log('Cursor position changed:', this.cursorPosition)
})
editor.ui.registry.addButton('myCustomButton', {
text: '公式',
onAction: function () {
if (that.$refs.MathfieldRef) {
that.$refs.MathfieldRef.formulaShowHandle('')
that.ifOPenDialog = true
} else {
console.log('暂无加载')
}
}
})
// 监听双击事件
editor.on('DblClick', function () {
var sel = editor.selection.getContent()
var path2 = /data-latex="(.*?)"/g
console.log('双击事件 2', sel)
sel.replace(path2, function ($0, $1) {
if ($1 && that.$refs.MathfieldRef) {
that.$refs.MathfieldRef.formulaShowHandle($1)
that.ifOPenDialog = true
}
})
})
// editor.on('paste', async event => {
// event.preventDefault() // Prevent default paste behavior
// const clipboardData = event.clipboardData || window.clipboardData
// const pastedData = clipboardData.getData('Text')
// const latexRegex = /\\$$([\s\S]*?)\\$$|\\$([\s\S]*?)\\$|\$\$([\s\S]*?)\$\$|\$(.*?)(?=\$)\$/g
// let newVal = _.cloneDeep(pastedData)
// let match
// while ((match = latexRegex.exec(pastedData)) !== null) {
// const fullMatch = match[0]
// let formula = match[1] || match[2] || match[3] || match[4] // 获取公式内容
// if (formula.includes('\[<br>')) {
// formula = formula.replace(/\\\[<br>/g, '')
// formula = formula.replace(/<br>\\\]/g, '')
// } else if (formula.includes('<br>')) {
// formula = formula.replace(/<br>/g, '')
// } else if (formula.includes('<br>')) {
// formula = formula.replace(/<br>/g, '')
// } else if (formula.includes('\(')) {
// formula = formula.replace(/\\\(/g, '')
// formula = formula.replace(/\\\)/g, '')
// } else if (formula.includes('$$')) {
// // formula = formula.replace(/^\$\$|\$\$$/g, '')
// } else if (formula.includes('$')) {
// formula = formula.replace(/^\$+|\$+$/g, '')
// }
// // console.log('======fullMatch paste======', JSON.stringify(fullMatch))
// console.log('======fullMatch paste======', fullMatch)
// console.log('======formula paste======', formula)
// const formulaImages = await that.convertFormulasToBase64(fullMatch, formula)
// let all = await that.replaceFormulasWithImages(formulaImages, fullMatch, formula)
// newVal = newVal.replace(fullMatch, all)
// }
// // // 在光标位置插入新内容
// editor.insertContent(newVal) // 在光标位置插入内容
// // // 确保更新 contentValue
// that.contentValue = editor.getContent() // 更新 contentValue
// })
}
},
contentValue: this.value,
inputValue: '',
processedFormulas: {}
}
},
watch: {
async value(newValue) {
console.log('======newValue watch======', JSON.stringify(newValue))
// 正则表达式匹配 LaTeX 公式,包括 $...$, \[...\], \(...\) 形式
// const latexRegex = /\\\[([^\[\]]*?)\\\]|\\\((.*?)\\\)|\$(.*?)\$/g
// 正则表达式匹配 LaTeX 公式,包括 $...$, \[...\], \(...\), $$...$$ 形式
const latexRegex = /\\$$([\s\S]*?)\\$$|\\$([\s\S]*?)\\$|\$\$([\s\S]*?)\$\$|\$(.*?)(?=\$)\$/g
let match
let processedText = newValue
while ((match = latexRegex.exec(newValue)) !== null) {
const fullMatch = match[0]
// console.log('======fullMatch watch======', fullMatch)
let formula = match[1] || match[2] || match[3] || match[4] // 获取公式内容
if (formula.includes('\[<br>')) {
formula = formula.replace(/\\\[<br>/g, '')
formula = formula.replace(/<br>\\\]/g, '')
} else if (formula.includes('<br>')) {
formula = formula.replace(/<br>/g, '')
} else if (formula.includes('<br>')) {
formula = formula.replace(/<br>/g, '')
} else if (formula.includes('\(')) {
formula = formula.replace(/\\\(/g, '')
formula = formula.replace(/\\\)/g, '')
} else if (formula.includes('$$')) {
formula = formula.replace(/^\$\$|\$\$$/g, '')
} else if (formula.includes('$')) {
formula = formula.replace(/^\$+|\$+$/g, '')
}
// console.log('======fullMatch watch======', fullMatch)
const result = this.findOccurrencesAndPositions(processedText, fullMatch)
console.log('Positions:', result) // 输出: Positions: [7, 29]
// console.log('======stringify formula======', formula)
// console.log('======processedText watch 0======', JSON.stringify(processedText))
// 检查是否已转换过该公式
if (!processedText.includes(`data-latex="${formula}"`)) {
const formulaImages = await this.convertFormulasToBase64(fullMatch, formula)
// console.log('======formulaImages======', formulaImages)
let all = this.replaceFormulasWithImages(formulaImages, fullMatch, formula)
// console.log('======all======', all)
processedText = processedText.replace(fullMatch, all)
// console.log('======processedText watch 1======', processedText)
this.processedFormulas[formula] = all
} else {
if (result.count >= 2) {
for (let i = 1; i < result.count; i++) {
let result2 = this.findOccurrencesAndPositions(processedText, fullMatch)
const extractedTexts = processedText.substring(result2.positions[i] - 5, result2.positions[i])
if (!extractedTexts.includes('alt')) {
processedText = this.replaceAt(processedText, result2.positions[i], fullMatch, this.processedFormulas[formula])
}
}
}
}
}
// console.log('======processedText watch 1======', processedText)
this.contentValue = processedText
// this.contentValue = replaceImageLinksToImgTags(processedText)
},
contentValue(newValue) {
// console.log('=========contentValue newValue stringify', JSON.stringify(newValue))
// console.log('=========contentValue newValue', newValue)
// if (!this.hasBlur) {
this.$emit('input', newValue)
// }
}
},
created() {},
async mounted() {
tinymce.init({})
// 初始化 MathJax
RegisterHTMLHandler(adaptor)
console.log('=========进入contentValue', this.contentValue)
if (this.hasBlur) {
// console.log('=========进入value mounted', JSON.stringify(this.value))
// const latexRegex = /\\\[([^\[\]]*?)\\\]|\\\((.*?)\\\)|\$(.*?)\$/g
const latexRegex = /\\$$([\s\S]*?)\\$$|\\$([\s\S]*?)\\$|\$\$([\s\S]*?)\$\$|\$(.*?)(?=\$)\$/g
let match
let processedText = this.value.replace(/\n/g, '<br>')
// console.log('======processedText mounted======', processedText)
while ((match = latexRegex.exec(this.value)) !== null) {
// console.log('======match mounted======', match)
const fullMatch = match[0]
// console.log('======fullMatch mounted======', fullMatch)
let formula = match[1] || match[2] || match[3] || match[4] // 获取公式内容
if (formula.includes('\[<br>')) {
formula = formula.replace(/\\\[<br>/g, '')
formula = formula.replace(/<br>\\\]/g, '')
} else if (formula.includes('<br>')) {
formula = formula.replace(/<br>/g, '')
} else if (formula.includes('<br>')) {
formula = formula.replace(/<br>/g, '')
} else if (formula.includes('\(')) {
formula = formula.replace(/\\\(/g, '')
formula = formula.replace(/\\\)/g, '')
} else if (formula.includes('$$')) {
formula = formula.replace(/^\$\$|\$\$$/g, '')
} else if (formula.includes('$')) {
formula = formula.replace(/^\$+|\$+$/g, '')
}
const result = this.findOccurrencesAndPositions(processedText, fullMatch)
// console.log('mounted Positions:', result) // 输出: Positions: [7, 29]
// console.log('======formula mounted======', formula)
// console.log('======stringify formula======', JSON.stringify(formula))
// 检查是否已转换过该公式
// console.log('======processedText mounted 2======', processedText)
// console.log('======formula mounted ======', formula)
if (!processedText.includes(`data-latex="${formula}"`)) {
const formulaImages = await this.convertFormulasToBase64(fullMatch, formula)
let all = this.replaceFormulasWithImages(formulaImages, fullMatch, formula)
// console.log('======all======', all)
processedText = processedText.replace(fullMatch, all)
this.processedFormulas[formula] = all
} else {
if (result.count >= 2) {
for (let i = 1; i < result.count; i++) {
let result2 = this.findOccurrencesAndPositions(processedText, fullMatch)
const extractedTexts = processedText.substring(result2.positions[i] - 5, result2.positions[i])
if (!extractedTexts.includes('alt')) {
processedText = this.replaceAt(processedText, result2.positions[i], fullMatch, this.processedFormulas[formula])
}
}
}
}
}
// console.log('======processedText mounted======', JSON.stringify(processedText))
// this.contentValue = processedText
this.contentValue = replaceImageLinksToImgTags(processedText)
// console.log('======this.contentValue mounted======', JSON.stringify(this.contentValue))
}
},
methods: {
onInit(editor) {
console.log('TinyMCE 初始化完成')
// 其他初始化逻辑...
},
findOccurrencesAndPositions(htmlString, target) {
let positions = []
let count = 0
let pos = htmlString.indexOf(target)
while (pos !== -1) {
positions.push(pos)
count++
pos = htmlString.indexOf(target, pos + 1)
}
return {
count: count,
positions: positions
}
},
replaceAt(str, startIndex, oldContent, newContent) {
return str.slice(0, startIndex) + newContent + str.slice(startIndex + oldContent.length)
},
parseHtml(html) {
const parser = new DOMParser()
return parser.parseFromString(html, 'text/html').body
},
findLastLatexImgAndExtractContent(body) {
let lastLatexImg = null
// 查找所有带有 data-latex 属性的 img 标签
const latexImgs = body.querySelectorAll('img[data-latex]')
if (latexImgs.length > 0) {
lastLatexImg = latexImgs[latexImgs.length - 1]
}
if (lastLatexImg) {
// 创建一个新的 div 来存放提取的内容
const containerBefore = document.createElement('div')
const containerAfter = document.createElement('div')
// 遍历最后一个 img 标签之前的节点
let currentNode = body.firstChild
while (currentNode && currentNode !== lastLatexImg) {
const nextSibling = currentNode.nextSibling // 先保存下一个节点
containerBefore.appendChild(currentNode) // 将当前节点移动到新容器中
currentNode = nextSibling // 移动到下一个节点
}
// 将最后一个 img 标签也添加到前面的内容中
containerBefore.appendChild(lastLatexImg)
// 遍历最后一个 img 标签之后的所有节点
currentNode = lastLatexImg.nextSibling
while (currentNode) {
const nextSibling = currentNode.nextSibling // 先保存下一个节点
containerAfter.appendChild(currentNode) // 将当前节点移动到新容器中
currentNode = nextSibling // 移动到下一个节点
}
// 返回提取的内容
return {
before: containerBefore.innerHTML,
after: containerAfter.innerHTML
}
} else {
// 如果没有找到带有 data-latex 属性的 img 标签,则返回空字符串或其他默认值
return {
before: '',
after: body.innerHTML
}
}
},
// async handlePaste(event) {
// // 阻止默认粘贴行为
// event.preventDefault();
// // // 处理粘贴事件,这里可以做一些预处理
// const clipboardData = event.clipboardData || window.clipboardData
// const pastedData = clipboardData.getData('Text')
// console.log('======handlePaste pastedData==', pastedData)
// const latexRegex = /\\$$([\s\S]*?)\\$$|\\$([\s\S]*?)\\$|\$\$([\s\S]*?)\$\$|\$(.*?)(?=\$)\$/g
// let newVal = _.cloneDeep(pastedData)
// let match
// while ((match = latexRegex.exec(pastedData)) !== null) {
// const fullMatch = match[0]
// console.log('======handlePaste fullMatch watch======', fullMatch)
// let formula = match[1] || match[2] || match[3] || match[4] // 获取公式内容
// if (formula.includes('\[<br>')) {
// formula = formula.replace(/\\\[<br>/g, '')
// formula = formula.replace(/<br>\\\]/g, '')
// } else if (formula.includes('<br>')) {
// formula = formula.replace(/<br>/g, '')
// } else if (formula.includes('<br>')) {
// formula = formula.replace(/<br>/g, '')
// } else if (formula.includes('\(')) {
// formula = formula.replace(/\\\(/g, '')
// formula = formula.replace(/\\\)/g, '')
// } else if (formula.includes('$$')) {
// formula = formula.replace(/^\$\$|\$\$$/g, '')
// } else if (formula.includes('$')) {
// formula = formula.replace(/^\$+|\$+$/g, '')
// }
// const formulaImages = await this.convertFormulasToBase64(fullMatch, formula)
// console.log('======handlePaste formulaImages======', formulaImages)
// let all = await this.replaceFormulasWithImages(formulaImages, fullMatch, formula)
// console.log('======handlePaste all======', all)
// newVal = newVal.replace(fullMatch, all)
// console.log('======handlePaste newVal======', newVal)
// }
// // 获取 TinyMCE 实例
// const editor = this.$refs.editorRef.getEditor() // 使用 getEditor 方法获取实例
// // // 在光标位置插入新内容
// editor.insertContent(newVal) // 在光标位置插入内容
// console.log('======handlePaste editor.getContent() ======', editor.getContent() )
// // // 确保更新 contentValue
// this.contentValue = editor.getContent() // 更新 contentValue
// },
async changeFieldBlur(newValue) {
// 获取 TinyMCE 实例
const editor = this.$refs.editorRef.getEditor() // 使用 getEditor 方法获取实例
const formulaImages = await this.convertFormulasToBase64('$' + newValue + '$', newValue)
let newFor = this.replaceFormulasWithImages(formulaImages, '$' + newValue + '$', newValue)
// 在光标位置插入新内容
editor.insertContent(newFor) // 在光标位置插入内容
// 确保更新 contentValue
this.contentValue = editor.getContent() // 更新 contentValue
this.ifOPenDialog = false
},
async handleBlur() {
if (!this.ifOPenDialog) {
if (this.hasBlur) {
this.$emit('handleBlur', this.contentValue)
this.$emit('input', this.contentValue)
} else {
this.$emit('input', this.contentValue)
}
}
},
async convertFormulasToBase64(content, latex) {
// const formulas = content.match(/\$.*?\$/g) // 匹配所有的数学公式
// const formulas = content.match(/(\$\$.*?\$\$|\\\[(.*?)\\\]|\$.*?\$)/g)
const formulas = content.match(/\\$$([\s\S]*?)\\$$|\\$([\s\S]*?)\\$|\$\$([\s\S]*?)\$\$|\$(.*?)(?=\$)\$/g)
// console.log('======convertFormulasToBase64 formulas==', formulas)
const formulaImages = {}
for (const formula of formulas) {
// let cleanFormula = formula // 去掉公式的包围符号
// // console.log('====123', JSON.stringify(cleanFormula))
// if (cleanFormula.includes('\[<br>')) {
// cleanFormula = cleanFormula.replace(/\\\[<br>/g, '')
// cleanFormula = cleanFormula.replace(/<br>\\\]/g, '')
// } else if (cleanFormula.includes('\(')) {
// cleanFormula = cleanFormula.replace(/\\\(/g, '')
// cleanFormula = cleanFormula.replace(/\\\)/g, '')
// } else if (cleanFormula.includes('$')) {
// cleanFormula = cleanFormula.replace(/^\$+|\$+$/g, '')
// }
let imageUrl = ''
// const imageUrl = await this.renderLaTeX(cleanFormula)
// console.log('============imageUrl', imageUrl)
// await setTimeout(async () => {
try {
imageUrl = await this.renderLaTeX(latex)
// console.log('============imageUrl', imageUrl)
} catch (error) {
imageUrl = ''
console.error(`Error fetching image for formula: ${latex}`)
return (formulaImages[formula] = '')
} finally {
if (imageUrl) {
const base64Image = await this.fetchBase64(imageUrl)
// console.log('============base64Image', base64Image)
formulaImages[formula] = base64Image
} else {
formulaImages[formula] = ''
}
}
// }, 1000)
}
// console.log('============formulaImages', formulaImages)
return formulaImages
},
// async renderLaTeX(formula) {
// // 使用一个在线的 LaTeX 渲染服务来获取公式的图片链接
// const response = await fetch(`https://latex.codecogs.com/png.latex?${encodeURIComponent(formula)}`)
// const url = response?.url || ''
// return url
// },
renderLaTeX(formula) {
return new Promise((resolve, reject) => {
// console.log('===========renderLaTeX formula', JSON.stringify(formula))
// 使用一个在线的 LaTeX 渲染服务来获取公式的图片链接
// const response = await fetch(`https://latex.codecogs.com/png.latex?${encodeURIComponent(formula)}`)
// const url = response?.url || ''
// return url
const tex = new TeX({ packages: AllPackages })
const svg = new SVG({ fontCache: 'none' })
const mathDocument = mathjax.document('', { InputJax: tex, OutputJax: svg })
const node = mathDocument.convert(formula, {
display: true
})
const svgString = adaptor.innerHTML(node)
// 创建 Blob 对象
const svgBlob = new Blob([svgString], { type: 'image/svg+xml;charset=utf-8' })
const url = URL.createObjectURL(svgBlob)
// 创建 Image 对象
const img = new Image()
img.onload = () => {
// 创建 Canvas
const canvas = document.createElement('canvas')
const scale = 0.85 // 缩放倍数,提升清晰度
canvas.width = img.width * scale
canvas.height = img.height * scale
const context = canvas.getContext('2d')
context.scale(scale, scale)
context.font = '16px PingFang SC' // 设置字体大小和类型
context.textBaseline = 'middle' // 设置文本基线
context.drawImage(img, 0, 0)
// 获取 PNG 数据
let imageData = canvas.toDataURL('image/png')
// console.log('=============imageData', imageData)
// if (imageData) {
// return imageData
// }
resolve(imageData)
// 清理
URL.revokeObjectURL(url)
}
img.onerror = err => {
console.log('图片生成失败')
reject(new Error('Image failed to load'))
}
img.src = url
})
},
async fetchBase64(url) {
const response = await fetch(url)
const blob = await response.blob()
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => resolve(reader.result)
reader.onerror = reject
reader.readAsDataURL(blob)
})
},
replaceFormulasWithImages(formulaImages, content, latex) {
let result = content
for (const [formula, base64Image] of Object.entries(formulaImages)) {
let newLatex = _.cloneDeep(formula)
// if (newLatex.includes('\[<br>')) {
// newLatex = newLatex.replace(/\\\[<br>/g, '')
// newLatex = newLatex.replace(/<br>\\\]/g, '')
// } else if (newLatex.includes('<br>')) {
// newLatex = newLatex.replace(/<br>/g, '')
// } else if (newLatex.includes('\(')) {
// newLatex = newLatex.replace(/\\\(/g, '')
// newLatex = newLatex.replace(/\\\)/g, '')
// } else if (newLatex.includes('$')) {
// newLatex = newLatex.replace(/^\$+|\$+$/g, '')
// }
// if (newLatex.includes('\[<br>')) {
// newLatex = newLatex.replace(/\\\[<br>/g, '')
// newLatex = newLatex.replace(/<br>\\\]/g, '')
// } else if (newLatex.includes('<br>')) {
// newLatex = newLatex.replace(/<br>/g, '')
// } else if (newLatex.includes('<br>')) {
// newLatex = newLatex.replace(/<br>/g, '')
// } else if (newLatex.includes('\(')) {
// newLatex = formula.replace(/\\\(/g, '')
// newLatex = newLatex.replace(/\\\)/g, '')
// } else if (newLatex.includes('$$')) {
// newLatex = newLatex.replace(/^\$\$|\$\$$/g, '')
// } else if (newLatex.includes('$')) {
// newLatex = newLatex.replace(/^\$+|\$+$/g, '')
// }
// console.log('============formula', formula)
// console.log('============newLatex', newLatex)
if (base64Image) {
if (formula.startsWith('$$') && formula.endsWith('$$')) {
// console.log('========formula 1',formula)
result = result.replace(formula, `<img src="${base64Image}" data-latex="${latex}" alt="${formula}" style="display: block;margin: 0 auto; "/>`)
// console.log('========result 1',result)
} else {
result = result.replace(formula, `<img src="${base64Image}" data-latex="${latex}" alt="${formula}"/>`)
// console.log('========result 2',result)
}
// result = result.replace(formula, `<img src="${base64Image}" data-latex="${latex}" alt="${formula}"/>`)
// result = result.replace(formula, `<img src="${base64Image}" data-latex="${latex}" alt="${formula}"/>`)
} else {
result = result
}
}
return result
},
// 添加相关的事件,可用的事件参照文档=> https://github.com/tinymce/tinymce-vue => All available events
onClick(e) {
console.log('==========e, tinymce', e, tinymce)
this.$emit('onClick', e, tinymce)
},
//清空内容
clear() {
this.contentValue = ''
}
}
}
</script>
<style lang="less">
.tinymce-box {
width: 100%;
display: flex;
flex-direction: column;
:deep(.tox-tinymce) {
transition: height 0.3s ease;
min-height: 100px !important;
height: auto !important;
}
:deep(.tox-edit-area__iframe) {
background: #fff;
}
:deep(.mce-content-body) {
padding: 0 8px;
p {
margin: 8px 0;
line-height: 24px;
}
img {
vertical-align: middle;
width: auto;
}
}
}
</style>
mathEditor.js
export const formulateArray = [
{
id: 'group_1',
name: '基础运算符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_1_15', type: 'write', latex: '+', label: '加号', text: '+' },
{ id: 'group_1_16', type: 'write', latex: '-', label: '减号', text: '-' },
{ id: 'group_1_17', type: 'write', latex: '=', label: '等号', text: '=' },
{ id: 'group_1_1', type: 'write', latex: '\\pm', label: '加减号', text: '±' },
{ id: 'group_1_2', type: 'write', latex: '\\mp', label: '减加号', text: '∓' },
{ id: 'group_1_3', type: 'write', latex: '\\times', label: '乘', text: '×' },
{ id: 'group_1_4', type: 'write', latex: '*', text: '*' },
{ id: 'group_1_5', type: 'write', latex: '\\div', label: '除', text: '÷' },
{ id: 'group_1_6', type: 'write', latex: '\\oplus', label: '异或', text: '⊕' },
{ id: 'group_1_7', type: 'write', latex: '\\otimes', text: '⊗' },
{ id: 'group_1_8', type: 'write', latex: '\\odot', label: '圆', text: '⊙' },
{ id: 'group_1_9', type: 'write', latex: '\\cdot', label: '点', text: '·' },
{ id: 'group_1_10', type: 'write', latex: '\\centerdot', text: '.' },
{ id: 'group_1_11', type: 'write', latex: '\\bullet', text: '∙' },
{ id: 'group_1_12', type: 'write', latex: '\\circ', text: '∘' },
{ id: 'group_1_13', type: 'write', latex: '⟨', text: '⟨' },
{ id: 'group_1_14', type: 'write', latex: '⟩', text: '⟩' }
]
},
{
id: 'group_2',
name: '关系符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_2_1', type: 'write', latex: '\\leqslant', text: '⩽' },
{ id: 'group_2_2', type: 'write', latex: '\\geqslant', text: '⩾' },
{ id: 'group_2_3', type: 'write', latex: '\\ll', text: '≪' },
{ id: 'group_2_4', type: 'write', latex: '\\gg', text: '≫' },
{ id: 'group_2_5', type: 'write', latex: '\\prec', text: '≺' },
{ id: 'group_2_6', type: 'write', latex: '\\succ', text: '≻' },
{ id: 'group_2_7', type: 'write', latex: '\\triangleleft', text: '◁' },
{ id: 'group_2_8', type: 'write', latex: '\\triangleright', text: '▷' },
{ id: 'group_2_9', type: 'write', latex: '\\sim', text: '~' },
{ id: 'group_2_10', type: 'write', latex: '\\approx', text: '≈' },
{ id: 'group_2_11', type: 'write', latex: '\\simeq', text: '≃' },
{ id: 'group_2_12', type: 'write', latex: 'backsimeqs', text: '≌', custom: !0 },
{ id: 'group_2_13', type: 'write', latex: '\\neq', text: '≠' },
{ id: 'group_2_14', type: 'write', latex: '\\equiv', text: '≡' },
{ id: 'group_2_15', type: 'write', latex: '\\triangleq', text: '≜' },
{ id: 'group_2_16', type: 'write', latex: 'wedgeeq', text: '≙', custom: !0 },
{ id: 'group_2_17', type: 'write', latex: '\\doteq', text: '≐' },
{ id: 'group_2_18', type: 'write', latex: '\\propto', text: '∝' },
{ id: 'group_2_19', type: 'write', latex: '\\backsim', text: '∽' },
{ id: 'group_2_20', type: 'write', latex: '\\lt' },
{ id: 'group_2_21', type: 'write', latex: '\\gt' }
]
},
{
id: 'group_3',
name: '离散数学符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_3_1', type: 'write', latex: '\\because', text: '∵', label: '因为' },
{ id: 'group_3_2', type: 'write', latex: '\\therefore', text: '∴', label: '所以' },
{ id: 'group_3_3', type: 'write', latex: '∍', text: '∍' },
{ id: 'group_3_4', type: 'write', latex: '\\exists', text: '∃', label: '存在量词' },
{ id: 'group_3_5', type: 'write', latex: '\\forall', text: '∀', label: '全称量词' },
{ id: 'group_3_6', type: 'write', latex: '\\neg', text: '¬', label: '非' },
{ id: 'group_3_7', type: 'write', latex: '\\wedge', text: '∧', label: '与' },
{ id: 'group_3_8', type: 'write', latex: '\\vee', text: '∨', label: '或' }
]
},
{
id: 'group_4',
name: '集合符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_4_1', type: 'write', latex: '\\in', text: '∈', label: '属于' },
{ id: 'group_4_2', type: 'write', latex: '\\notin', text: '∉', label: '不属于' },
{ id: 'group_4_3', type: 'write', latex: '\\cup', text: '∪', label: '并集' },
{ id: 'group_4_4', type: 'write', latex: '\\cap', text: '∩', label: '交集' },
{ id: 'group_4_5', type: 'write', latex: '\\bigcup' },
{ id: 'group_4_6', type: 'write', latex: '\\bigcap', text: '⋂' },
{ id: 'group_4_7', type: 'write', latex: '\\subset', text: '⊂' },
{ id: 'group_4_8', type: 'write', latex: '\\supset', text: '⊃' },
{ id: 'group_4_9', type: 'write', latex: '\\subseteq', text: '⊆', label: '包含' },
{ id: 'group_4_10', type: 'write', latex: '\\supseteq', text: '⊇' },
{ id: 'group_4_11', type: 'write', latex: '\\nsubset', text: '⊄', custom: !0 },
{ id: '', type: 'write', latex: '\\supset', text: '⊅', label: '', hide: !0 },
{ id: 'group_4_12', type: 'write', latex: '\\varnothing', text: '∅', label: '空集' },
{ id: 'group_4_13', type: 'write', latex: '\\subsetneqq', text: '⫋', label: '真包含' },
{ id: '', type: 'write', latex: '\\supsetneqq', text: '', label: '', disabled: !0, hide: !0 },
{ id: '', type: 'write', latex: '\\subsetneq', text: '', label: '', disabled: !0, hide: !0 },
{ id: '', type: 'write', latex: '\\supsetneq', text: '', label: '', disabled: !0, hide: !0 },
{ id: 'group_4_14', type: 'write', latex: '\\complement', text: '∁', label: '补集' },
{ id: 'group_4_15', type: 'write', latex: '\\complement_{U}A' }
]
},
{
id: 'group_5',
name: '修饰符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_5_1', type: 'write', latex: 'overcirc{}', label: '度数', posFix: -1, custom: !0 },
{ id: 'group_5_2', type: 'write', latex: 'overprime{}', label: '分', posFix: -1, custom: !0 },
{ id: 'group_5_3', type: 'write', latex: 'overpprime{}', label: '秒', posFix: -1, custom: !0 },
{ id: 'group_5_4', type: 'write', latex: 'overppprime{}', posFix: -1, custom: !0 },
{ id: 'group_5_5', type: 'write', latex: 'overbackprime{}', posFix: -1, custom: !0 },
{ id: 'group_5_6', type: 'write', latex: '\\not{\\placeholder}', posFix: -1 },
{ id: 'group_5_7', type: 'write', latex: '\\dot{#1}', posFix: -1 },
{ id: 'group_5_8', type: 'write', latex: '\\ddot{#1}', posFix: -1 },
{ id: 'group_5_9', type: 'write', latex: '\\dddot{#1}', posFix: -1 },
{ id: 'group_5_10', type: 'write', latex: 'underdot{}', posFix: -1, custom: !0 },
{ id: 'group_5_11', type: 'write', latex: 'underddot{}', posFix: -1, custom: !0 },
{ id: 'group_5_12', type: 'write', latex: 'underdddot{}', posFix: -1, custom: !0 },
{ id: 'group_5_13', type: 'write', latex: '\\bar{#1}', label: '平均数', posFix: -1 },
{ id: 'group_5_14', type: 'write', latex: '\\tilde{#1}', posFix: -1 },
{ id: 'group_5_15', type: 'write', latex: 'overfrown{}', posFix: -1 },
{ id: 'group_5_16', type: 'write', latex: 'oversmile{}', posFix: -1, custom: !0 },
{ id: 'group_5_17', type: 'write', latex: 'overrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_18', type: 'write', latex: 'overlarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_19', type: 'write', latex: 'overlrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_20', type: 'write', latex: 'overrharpoonup{}', posFix: -1, custom: !0 },
{ id: 'group_5_21', type: 'write', latex: 'overlharpoonup{}', posFix: -1, custom: !0 },
{ id: 'group_5_22', type: 'write', latex: 'underrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_23', type: 'write', latex: 'underlarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_24', type: 'write', latex: 'underlrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_5_25', type: 'write', latex: 'underrharpoonup{}', posFix: -1, custom: !0 },
{ id: 'group_5_26', type: 'write', latex: 'underlharpoonup{}', posFix: -1, custom: !0 }
]
},
{
id: 'group_6',
name: '箭头符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_6_1', type: 'write', latex: '\\leftrightarrow', text: '↔' },
{ id: 'group_6_2', type: 'write', latex: '\\rightarrow', text: '→' },
{ id: 'group_6_3', type: 'write', latex: '\\leftarrow', text: '←' },
{ id: 'group_6_4', type: 'write', latex: '\\updownarrow', text: '↕' },
{ id: 'group_6_5', type: 'write', latex: '\\uparrow', text: '↑' },
{ id: 'group_6_6', type: 'write', latex: '\\downarrow', text: '↓' },
{ id: 'group_6_7', type: 'write', latex: '\\Leftrightarrow', text: '⇔' },
{ id: 'group_6_8', type: 'write', latex: '\\Rightarrow', text: '⇒' },
{ id: 'group_6_9', type: 'write', latex: '\\Leftarrow', text: '⇐' },
{ id: 'group_6_10', type: 'write', latex: '\\Updownarrow', text: '⇕' },
{ id: 'group_6_11', type: 'write', latex: '\\Uparrow', text: '⇑' },
{ id: 'group_6_12', type: 'write', latex: '\\Downarrow', text: '⇓' },
{ id: 'group_6_13', type: 'write', latex: '\\neswarrow', text: '⤢', custom: !0 },
{ id: 'group_6_14', type: 'write', latex: '\\nearrow', text: '↗' },
{ id: 'group_6_15', type: 'write', latex: '\\swarrow', text: '↙' },
{ id: 'group_6_16', type: 'write', latex: '\\nwsearrow', text: '⤡', custom: !0 },
{ id: 'group_6_17', type: 'write', latex: '\\searrow', text: '↘' },
{ id: 'group_6_18', type: 'write', latex: '\\nwarrow', text: '↖' },
{ id: 'group_6_19', type: 'write', latex: '\\rightleftarrows', text: '⇄' },
{ id: 'group_6_20', type: 'write', latex: '\\leftrightsmall', text: '⥂', custom: !0 },
{ id: 'group_6_21', type: 'write', latex: '\\smallleftright', text: '⥄', custom: !0 },
{ id: 'group_6_22', type: 'write', latex: '\\rightleftharpoons', text: '⇌' },
{ id: 'group_6_23', type: 'write', latex: '\\rlsharpoons', disabled: !0, custom: !0 },
{ id: 'group_6_24', type: 'write', latex: '\\srlharpoons', disabled: !0, custom: !0 },
{ id: 'group_6_25', type: 'write', latex: '\\mapsto' },
{ id: 'group_6_26', type: 'write', latex: '\\enter', text: '↲', custom: !0 }
]
},
{
id: 'group_7',
name: '分隔符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_7_1', type: 'write', latex: '\\left(\\placeholder{}\\right)', posFix: -1 },
{ id: 'group_7_2', type: 'write', latex: '\\left[\\placeholder\\right]', posFix: -1 },
{ id: 'group_7_3', type: 'write', latex: '\\left\\{\\placeholder\\right\\}', posFix: -1 },
{ id: 'group_7_4', type: 'write', latex: '\\left\\langle {}\\placeholder \\right\\rangle', posFix: -1 },
{ id: 'group_7_5', type: 'write', latex: '\\left|{}\\placeholder\\right|', label: '绝对值', posFix: -1 },
{ id: 'group_7_6', type: 'write', latex: 'LineLine{}', posFix: -1, custom: !0 },
{ id: 'group_7_7', type: 'write', latex: '\\left\\lfloor {}\\placeholder \\right\\rfloor', disabled: !0 },
{ id: 'group_7_8', type: 'write', latex: '\\left\\lceil {}\\placeholder \\right\\rceil', disabled: !0 },
{ id: 'group_7_9', type: 'write', latex: '\\left\\lfloor {}\\placeholder \\right\\rceil', disabled: !0 },
{ id: 'group_7_10', type: 'write', latex: 'Bracket{}', posFix: -1, custom: !0 },
{ id: 'group_7_11', type: 'write', latex: '\\left[\\placeholder{}\\right[', posFix: -1 },
{ id: 'group_7_12', type: 'write', latex: '\\left]\\placeholder{}\\right]', posFix: -1 },
{ id: 'group_7_13', type: 'write', latex: '\\left]\\placeholder{}\\right[', posFix: -1 },
{ id: 'group_7_14', type: 'write', latex: '\\left( \\placeholder{} \\right]', posFix: -1 },
{ id: 'group_7_15', type: 'write', latex: '\\left[ \\placeholder{} \\right)', posFix: -1 },
{ id: 'group_7_16', type: 'write', latex: '\\left\\langle\\placeholder{}\\right|', posFix: -1 },
{ id: 'group_7_17', type: 'write', latex: '\\left|\\placeholder{}\\right\\rangle', posFix: -1 },
{ id: 'group_7_18', type: 'write', latex: '\\left({}\\right.\\placeholder', posFix: -1 },
{ id: 'group_7_19', type: 'write', latex: '\\left.\\placeholder{}\\right)', posFix: -1 },
{ id: 'group_7_20', type: 'write', latex: '\\left[\\placeholder{}\\right.', posFix: -1 },
{ id: 'group_7_21', type: 'write', latex: '\\left.\\placeholder{}\\right]', posFix: -1 },
{ id: 'group_7_22', type: 'write', latex: '\\left\\{{}\\right.\\placeholder', posFix: -1 },
{ id: 'group_7_23', type: 'write', latex: '\\left.\\placeholder{}\\right\\}', posFix: -1 },
{ id: 'group_7_24', type: 'write', latex: '\\left\\langle\\placeholder{}\\right.', posFix: -1 },
{ id: 'group_7_25', type: 'write', latex: '\\left.\\placeholder{}\\right\\rangle', posFix: -1 },
{ id: 'group_7_26', type: 'write', latex: '\\left|\\placeholder{}\\right.', posFix: -1 },
{ id: 'group_7_27', type: 'write', latex: '\\left.\\placeholder{}\\right|', posFix: -1 },
{ id: 'group_7_28', type: 'write', latex: 'leftlineline{}', posFix: -1, custom: !0 },
{ id: 'group_7_29', type: 'write', latex: 'rightlineline{}', posFix: -1, custom: !0 },
{ id: 'group_7_30', type: 'write', latex: 'llbracket{}', posFix: -1, custom: !0 },
{ id: 'group_7_31', type: 'write', latex: 'rrbracket{}', posFix: -1, custom: !0 },
{ id: 'group_7_32', type: 'write', latex: '\\left\\langle \\placeholder{} | \\placeholder{} \\right\\rangle', posFix: -2 },
{ id: 'group_7_33', type: 'write', latex: '\\overbrace{\\placeholder{}}^{{\\placeholder}}', posFix: -1 },
{ id: 'group_7_34', type: 'write', latex: '\\underbrace{\\placeholder{}}_{{\\placeholder{}}}', posFix: -1 },
{ id: 'group_7_35', type: 'write', latex: '', hide: !0 },
{ id: 'group_7_36', type: 'write', latex: '', hide: !0 },
{ id: 'group_7_37', type: 'write', latex: '\\left( \\placeholder{} | \\placeholder{} \\right)', posFix: -2 },
{ id: 'group_7_38', type: 'write', latex: '\\left[ \\placeholder{} | \\placeholder{} \\right]', posFix: -2 },
{ id: 'group_7_39', type: 'write', latex: '\\left\\langle \\placeholder{} | \\placeholder{} \\right\\rangle', posFix: -2 },
{ id: 'group_7_40', type: 'write', latex: '\\left\\{ \\placeholder{} | \\placeholder{} \\right\\}', posFix: -2 },
{ id: 'group_7_41', type: 'write', latex: '\\left\\{ \\begin{array}{l} \\placeholder{}\\\\\\placeholder{} \\end{array}\\right.', posFix: -3 },
{ id: 'group_7_42', type: 'write', latex: '\\left\\{ \\begin{array}{l} \\placeholder{}\\\\\\placeholder{}\\\\\\placeholder{} \\end{array}\\right.', posFix: -4 },
{ id: 'group_7_43', type: 'write', latex: '\\left( \\begin{matrix}\\placeholder{}\\\\\\placeholder{}\\end{matrix}\\right)', posFix: -3 }
]
},
{
id: 'group_8',
name: '分数根号符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_8_1', type: 'write', latex: '\\dfrac{\\placeholder{} }{\\placeholder{} }', label: '分数', posFix: -1 },
{ id: 'group_8_2', type: 'write', latex: '\\tfrac{\\placeholder{}}{\\placeholder{}}', posFix: -1, posFiy: -1 },
{ id: 'group_8_3', type: 'write', latex: '^{\\placeholder}/_{\\placeholder}', posFix: -1 },
{ id: 'group_8_4', type: 'write', latex: '{\\scriptstyle{}^{\\placeholder}/{\\placeholder}_{\\placeholder}}', disabled: !0 },
{ id: 'group_8_5', type: 'write', latex: '{\\placeholder{}}/{\\placeholder{}}', posFix: 0 },
{ id: 'group_8_6', type: 'write', latex: '\\sqrt{\\placeholder{}}', label: '根式', posFix: -1 },
{ id: 'group_8_7', type: 'write', latex: '\\sqrt[\\placeholder{}]{\\placeholder{}}', posFix: -1, posFiy: 1 },
{ id: 'group_8_8', type: 'write', latex: 'vertical{}', posFix: -1, custom: !0 },
{ id: 'group_8_9', type: 'write', latex: '\\overset{\\placeholder{} }{\\overline{\\left) \\right. \\placeholder}}', posFix: -2, custom: !0 }
]
},
{
id: 'group_9',
name: '上下标符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_9_1', type: 'write', latex: '\\placeholder{}start^', label: '上标', posFix: -1, custom: !0 },
{ id: 'group_9_2', type: 'write', latex: '{\\placeholder}_{\\placeholder{}}^', label: '下标', posFix: -1 },
{ id: 'group_9_3', type: 'write', latex: '\\placeholder{}_{\\placeholder{}}^{\\placeholder}', posFix: -1, posFiy: -1 },
{ id: 'group_9_4', type: 'write', latex: '^{\\placeholder{}}\\placeholder', label: '上标', posFix: -1, custom: !0 },
{ id: 'group_9_5', type: 'write', latex: '^\\placeholder{}\\placeholder{}', label: '下标', posFix: -1 },
{ id: 'group_9_6', type: 'write', latex: '_{\\placeholder{}}^{\\placeholder{}}\\placeholder', posFix: -1, posFiy: -1 },
{ id: 'group_9_7', type: 'write', latex: '\\left.{\\placeholder{}}\\right.^{\\placeholder}', posFix: -3 },
{ id: 'group_9_8', type: 'write', latex: '\\placeholder{}\\left. \\right. _{\\placeholder{}', posFix: -1 },
{ id: 'group_9_9', type: 'write', latex: '\\placeholder{}\\left. \\right. _\\placeholder{}^{\\placeholder}', posFix: -4 },
{ id: 'group_9_10', type: 'write', latex: '\\overset{\\placeholder{}}{\\placeholder}', posFix: -1, posFiy: -1 }, //
{ id: 'group_9_11', type: 'write', latex: '\\underset{\\placeholder{} }{\\placeholder }', posFix: -1, posFiy: -1 },
{ id: 'group_9_12', type: 'write', latex: '\\underset{\\placeholder{}}{\\overset{\\placeholder{}}{\\placeholder{}}} ', posFix: -2, posFiy: -2 },
{ id: 'group_9_13', type: 'write', latex: '\\left.{\\Large{}}\\right.^{}', disabled: !0 },
{ id: 'group_9_14', type: 'write', latex: '\\left.{\\Large{}}\\right._{}', disabled: !0 },
{ id: 'group_9_15', type: 'write', latex: '\\left.{\\Large{}}\\right._{}^{}', disabled: !0 },
{ id: 'group_9_16', type: 'write', latex: '\\overset{}{\\Large{}}', disabled: !0 },
{ id: 'group_9_17', type: 'write', latex: '\\underset{}{\\Large{}}', disabled: !0 },
{ id: 'group_9_18', type: 'write', latex: '\\underset{}{\\overset{}{\\Large{}}}', disabled: !0 }
]
},
{
id: 'group_10',
name: '省略号符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_10_1', type: 'write', latex: '\\ ' },
{ id: 'group_10_2', type: 'write', latex: '\\ \\ ' },
{ id: 'group_10_3', type: 'write', latex: '\\ \\ \\ ' },
{ id: 'group_10_4', type: 'write', latex: '\\ldots', text: '…' },
{ id: 'group_10_5', type: 'write', latex: '\\cdots', text: '…' },
{ id: 'group_10_6', type: 'write', latex: '\\vdots', text: '⋮' },
{ id: 'group_10_7', type: 'write', latex: '\\iddots', text: '⋰', custom: !0 },
{ id: 'group_10_8', type: 'write', latex: '\\ddots', text: '⋱' }
]
},
{
id: 'group_11',
name: '杂项符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_11_1', type: 'write', latex: '\\partial', text: '∂' },
{ id: 'group_11_2', type: 'write', latex: '\\wp', text: '℘' },
{ id: 'group_11_3', type: 'write', latex: '\\Im', text: 'I' },
{ id: 'group_11_4', type: 'write', latex: '\\Re', text: 'R' },
{ id: 'group_11_5', type: 'write', latex: '\\aleph', text: 'ℵ' },
{ id: 'group_11_6', type: 'write', latex: 'ℝ', text: '花ℝ' },
{ id: 'group_11_7', type: 'write', latex: 'ℤ', text: '花ℤ' },
{ id: 'group_11_8', type: 'write', latex: 'ℂ', text: '花ℂ' },
{ id: 'group_11_9', type: 'write', latex: 'ℚ', text: '花ℚ' },
{ id: 'group_11_10', type: 'write', latex: 'ℕ', text: '花ℕ' },
{ id: 'group_11_11', type: 'write', latex: '\\infty', text: '∞', label: '无穷' },
{ id: 'group_11_12', type: 'write', latex: '\\hbar', text: 'ℏ' },
{ id: 'group_11_13', type: 'write', latex: '\\ell', text: 'ℓ' },
{ id: 'group_11_14', type: 'write', latex: '\\dagger', text: '†' },
{ id: 'group_11_15', type: 'write', latex: '\\Delta', text: 'Δ' },
{ id: 'group_11_16', type: 'write', latex: '\\nabla', text: '∇' },
{ id: 'group_11_17', type: 'write', latex: '\\Omega', label: 'omega', text: 'Ω' },
{ id: 'group_11_18', type: 'write', latex: '℧', text: '℧' },
{ id: 'group_11_19', type: 'write', latex: '◊', text: '◊' },
{ id: 'group_11_20', type: 'write', latex: '\\sum' },
{ id: 'group_11_21', type: 'write', latex: '\\prod' },
{ id: 'group_11_22', type: 'write', latex: '\\coprod' },
{ id: 'group_11_23', type: 'write', latex: '\\int' },
{ id: 'group_11_24', type: 'write', latex: '^{\\circ}', label: '度' },
{ id: 'group_11_25', type: 'write', latex: '\\angle', text: '∠', label: '角' },
{ id: 'group_11_26', type: 'write', latex: '∡', text: '∡' },
{ id: 'group_11_27', type: 'write', latex: '∢', text: '∢' },
{ id: 'group_11_28', type: 'write', latex: '\\bot', text: '⊥', label: '垂直' },
{ id: 'group_11_29', type: 'write', latex: '//', text: '∥' },
{ id: 'group_11_30', type: 'write', latex: '\\triangle', text: '△', label: '三角形' },
{ id: 'group_11_31', type: 'write', latex: '\\bigcirc', text: '◯' },
{ id: 'group_11_32', type: 'write', latex: '\\square', text: '□', label: '正方形' },
{ id: 'group_11_33', type: 'write', latex: '\\bigstar ', text: '★', label: '五角星' }
]
},
{
id: 'group_12',
name: '希腊字母小写',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_12_1', type: 'write', latex: '\\alpha', label: 'alpha', text: 'α' },
{ id: 'group_12_2', type: 'write', latex: '\\beta', label: 'beta', text: 'β' },
{ id: 'group_12_3', type: 'write', latex: '\\chi', label: 'chi', text: 'χ' },
{ id: 'group_12_4', type: 'write', latex: '\\delta', label: 'delta', text: 'δ' },
{ id: 'group_12_5', type: 'write', latex: '\\varepsilon', label: 'epsilon', text: 'ε' },
{ id: 'group_12_6', type: 'write', latex: '\\phi' },
{ id: 'group_12_7', type: 'write', latex: '\\varphi' },
{ id: 'group_12_8', type: 'write', latex: '\\gamma', label: 'gamma', text: 'γ' },
{ id: 'group_12_9', type: 'write', latex: '\\eta', label: 'eta', text: 'η' },
{ id: 'group_12_10', type: 'write', latex: '\\iota', label: 'iota', text: 'ι' },
{ id: 'group_12_11', type: 'write', latex: '\\kappa', label: 'kappa', text: 'κ' },
{ id: 'group_12_12', type: 'write', latex: '\\lambda', label: 'lambda', text: 'λ' },
{ id: 'group_12_13', type: 'write', latex: '\\mu', label: 'mu', text: 'μ' },
{ id: 'group_12_14', type: 'write', latex: '\\nu', label: 'nu', text: 'ν' },
{ id: 'group_12_15', type: 'write', latex: '\\omicron', label: 'omicron', text: 'ο' },
{ id: 'group_12_16', type: 'write', latex: '\\pi', text: 'π', label: 'π' },
{ id: 'group_12_17', type: 'write', latex: '\\varpi', text: 'ϖ', label: 'ϖ' },
{ id: 'group_12_18', type: 'write', latex: '\\theta', label: 'theta', text: 'θ' },
{ id: 'group_12_19', type: 'write', latex: '\\vartheta', label: 'ϑ', text: 'ϑ' },
{ id: 'group_12_20', type: 'write', latex: '\\rho', label: 'rho', text: 'ρ' },
{ id: 'group_12_21', type: 'write', latex: '\\sigma', label: 'sigma', text: 'σ' },
{ id: 'group_12_22', type: 'write', latex: '\\varsigma', label: 'ς', text: 'ς' },
{ id: 'group_12_23', type: 'write', latex: '\\tau', label: 'tau', text: 'τ' },
{ id: 'group_12_24', type: 'write', latex: '\\upsilon', label: 'upsilon', text: 'υ' },
{ id: 'group_12_25', type: 'write', latex: '\\omega', label: 'omega', text: 'ω' },
{ id: 'group_12_26', type: 'write', latex: '\\xi', label: 'xi', text: 'ξ' },
{ id: 'group_12_27', type: 'write', latex: '\\psi', label: 'psi', text: 'ψ' },
{ id: 'group_12_28', type: 'write', latex: '\\zeta', label: 'zeta', text: 'ζ' }
]
},
{
id: 'group_13',
name: '希腊字母大写',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_13_1', type: 'write', latex: '\\text{A}', label: 'A', text: 'A' },
{ id: 'group_13_2', type: 'write', latex: '\\text{B}', label: 'B', text: 'B' },
{ id: 'group_13_3', type: 'write', latex: '\\text{X}', label: 'X', text: 'X' },
{ id: 'group_13_4', type: 'write', latex: '\\Delta', text: 'Δ' },
{ id: 'group_13_5', type: 'write', latex: '\\text{E}', label: 'E', text: 'E' },
{ id: 'group_13_6', type: 'write', latex: '\\Phi', label: 'phi', text: 'Φ' },
{ id: 'group_13_7', type: 'write', latex: '\\Gamma', label: 'gamma', text: 'Γ' },
{ id: 'group_13_8', type: 'write', latex: '\\text{H}', label: 'H', text: 'H' },
{ id: 'group_13_9', type: 'write', latex: '\\text{I}', label: 'I', text: 'I' },
{ id: 'group_13_10', type: 'write', latex: '\\text{K}', label: 'K', text: 'K' },
{ id: 'group_13_11', type: 'write', latex: '\\Lambda', label: 'lambda', text: 'Λ' },
{ id: 'group_13_12', type: 'write', latex: '\\text{M}', label: 'M', text: 'M' },
{ id: 'group_13_13', type: 'write', latex: '\\text{N}', label: 'N', text: 'N' },
{ id: 'group_13_14', type: 'write', latex: '\\text{O}', label: 'O', text: 'O' },
{ id: 'group_13_15', type: 'write', latex: '\\Pi', label: 'pi', text: 'Π' },
{ id: 'group_13_16', type: 'write', latex: '\\Theta', label: 'theta', text: 'Θ' },
{ id: 'group_13_17', type: 'write', latex: '\\text{P}', label: 'P', text: 'P' },
{ id: 'group_13_18', type: 'write', latex: 'Σ', label: 'sigma', text: 'Σ' },
{ id: 'group_13_19', type: 'write', latex: '\\text{T}', label: 'T', text: 'T' },
{ id: 'group_13_20', type: 'write', latex: '\\text{Y}', label: 'Y', text: 'Y' },
{ id: 'group_13_21', type: 'write', latex: '\\Omega', label: 'omega', text: 'Ω' },
{ id: 'group_13_22', type: 'write', latex: '\\Xi', label: 'xi', text: 'Ξ' },
{ id: 'group_13_23', type: 'write', latex: '\\Psi', label: 'psi', text: 'Ψ' },
{ id: 'group_13_24', type: 'write', latex: '\\text{Z}', label: 'Z', text: 'Z' }
]
},
{
id: 'group_14',
name: '求和符号',
visible: !1,
col: 4,
equtaions: [
{ id: 'group_14_1', type: 'write', latex: '\\sum{\\placeholder}' },
{ id: 'group_14_4', type: 'write', latex: '\\sum\\nolimits_{\\placeholder{}}\\placeholder', posFix: -1 },
{ id: 'group_14_5', type: 'write', latex: '\\sum\\nolimits_{\\placeholder{}}^{\\placeholder{}}\\placeholder', posFix: -2 },
{ id: 'group_14_3', type: 'write', latex: '\\sum\\limits_{ \\placeholder{}}^{ \\placeholder{}}\\placeholder' }
]
},
{
id: 'group_15',
name: '集合符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_15_1', type: 'write', latex: '\\prod{\\placeholder}' },
{ id: 'group_15_2', type: 'write', latex: '\\prod\\limits_{ \\placeholder{}}^{ \\placeholder}' },
{ id: 'group_15_3', type: 'write', latex: '\\prod\\limits_{ \\placeholder{}}^{ \\placeholder}' },
{ id: 'group_15_4', type: 'write', latex: '\\prod\\nolimits_{\\placeholder}{}', posFix: -1 },
{ id: 'group_15_5', type: 'write', latex: '\\prod\\nolimits_{\\placeholder{}}^{\\placeholder}', posFix: -2 },
{ id: 'group_15_6', type: 'write', latex: '\\coprod\\placeholder{}' },
{ id: 'group_15_7', type: 'write', latex: '\\coprod\\limits_{\\placeholder{} }^{ \\placeholder}' },
{ id: 'group_15_8', type: 'write', latex: '\\coprod\\nolimits_{\\placeholder{}}^{\\placeholder}' },
{ id: 'group_15_9', type: 'write', latex: '\\coprod\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_15_10', type: 'write', latex: '\\coprod\\nolimits_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}', posFix: -2 },
{ id: 'group_15_11', type: 'write', latex: '\\bigcap{\\placeholder}' },
{ id: 'group_15_12', type: 'write', latex: '\\bigcap_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_15_13', type: 'write', latex: '\\bigcap_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}' },
{ id: 'group_15_14', type: 'write', latex: '\\bigcap\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_15_15', type: 'write', latex: '\\bigcap\\nolimits_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}', posFix: -2 },
{ id: 'group_15_16', type: 'write', latex: '\\bigcup{\\placeholder}' },
{ id: 'group_15_17', type: 'write', latex: '\\bigcup_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_15_18', type: 'write', latex: '\\bigcup_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}' },
{ id: 'group_15_19', type: 'write', latex: '\\bigcup\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_15_20', type: 'write', latex: '\\bigcup\\nolimits_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}', posFix: -2 }
]
},
{
id: 'group_16',
name: '积分符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_16_1', type: 'write', latex: '\\int{\\placeholder}', posFix: 0 },
{ id: 'group_16_2', type: 'write', latex: '\\int_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}' },
{ id: 'group_16_3', type: 'write', latex: '\\int_{\\placeholder{}}^{\\placeholder{}}{\\placeholder}', posFix: -2 },
{ id: 'group_16_4', type: 'write', latex: '\\int_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_16_5', type: 'write', latex: '\\int\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_16_6', type: 'write', latex: '\\iint{\\placeholder}' },
{ id: 'group_16_7', type: 'write', latex: '\\iint_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_16_8', type: 'write', latex: '\\iint\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_16_9', type: 'write', latex: '\\iiint{\\placeholder}' },
{ id: 'group_16_10', type: 'write', latex: '\\iiint_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_16_11', type: 'write', latex: '\\iiint\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 },
{ id: 'group_16_12', type: 'write', latex: '\\oint{\\placeholder}' },
{ id: 'group_16_13', type: 'write', latex: '\\oint_{\\placeholder{}}{\\placeholder}' },
{ id: 'group_16_14', type: 'write', latex: '\\oint\\nolimits_{\\placeholder{}}{\\placeholder}', posFix: -1 }
]
},
{
id: 'group_17',
name: '底线和顶线符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_17_1', type: 'write', latex: '\\widetilde{\\placeholder}', posFix: -1 },
{ id: 'group_17_2', type: 'write', latex: '\\widehat{\\placeholder}', posFix: -1 },
{ id: 'group_17_3', type: 'write', latex: 'overfrown{}', posFix: -1, custom: !0 },
{ id: 'group_17_4', type: 'write', latex: '\\overline{\\placeholder}', posFix: -1 },
{ id: 'group_17_5', type: 'write', latex: '\\overline{\\overline{\\placeholder}}', posFix: -2 },
{ id: 'group_17_6', type: 'write', latex: '\\underline{\\placeholder}', posFix: -1 },
{ id: 'group_17_7', type: 'write', latex: '\\underline{\\underline{\\placeholder}}', posFix: -2 },
{ id: 'group_17_8', type: 'write', latex: '\\overrightarrow{\\placeholder}', posFix: -1 },
{ id: 'group_17_9', type: 'write', latex: '\\overleftarrow{\\placeholder}', posFix: -1 },
{ id: 'group_17_10', type: 'write', latex: '\\overleftrightarrow{\\placeholder}', posFix: -1 },
{ id: 'group_17_11', type: 'write', latex: '\\underrightarrow{\\placeholder}', posFix: -1 },
{ id: 'group_17_12', type: 'write', latex: '\\underleftarrow{\\placeholder}', posFix: -1 },
{ id: 'group_17_13', type: 'write', latex: '\\underleftrightarrow{\\placeholder}', posFix: -1 }
]
},
{
id: 'group_18',
name: '标签箭头符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_18_1', type: 'write', latex: '\\xrightarrow{\\placeholder}', posFix: -1 },
{ id: 'group_18_2', type: 'write', latex: 'overxrightarrow{}', posFix: -1, custom: !0 },
{ id: 'group_18_3', type: 'write', latex: '\\xrightarrow[\\placeholder{}]{\\placeholder{}}', posFix: -1 },
{ id: 'group_18_4', type: 'write', latex: '\\xleftarrow{\\placeholder}', posFix: -1 },
{ id: 'group_18_5', type: 'write', latex: 'underxleftarrow{}', posFix: -1, custom: !0 },
{ id: 'group_18_6', type: 'write', latex: '\\xleftarrow[\\placeholder{}]{\\placeholder}', posFix: -1 },
{ id: 'group_18_7', type: 'write', latex: 'overllrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_18_8', type: 'write', latex: 'underllrarrow{}', posFix: -1, custom: !0 },
{ id: 'group_18_9', type: 'write', latex: '\\underset{\\placeholder{}}{overllrarrow{}}', posFix: -1, posFiy: -1, custom: !0 },
{ id: 'group_18_10', type: 'write', latex: 'overrightleftarrows{}', posFix: -1, custom: !0 },
{ id: 'group_18_11', type: 'write', latex: 'underrightleftarrows{}', posFix: -1, custom: !0 },
{ id: 'group_18_12', type: 'write', latex: '\\underset{\\placeholder{}}{overrightleftarrows{}}' },
{ id: 'group_18_13', type: 'write', latex: 'overrightleftharpoons{}', posFix: -1, custom: !0 },
{ id: 'group_18_14', type: 'write', latex: 'underrightleftharpoons{}', posFix: -1, custom: !0 },
{ id: 'group_18_15', type: 'write', latex: '\\underset{\\placeholder{}}{overrightleftharpoons{}}', posFix: -1, posFiy: -1 }
]
},
{
id: 'group_19',
name: '矩形模板符号',
visible: !1,
col: 6,
equtaions: [
{ id: 'group_19_1', type: 'write', latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{}\\end{pmatrix}', posFix: -2 },
{ id: 'group_19_2', type: 'write', latex: '\\begin{pmatrix}\\placeholder{}\\\\ \\placeholder{}\\end{pmatrix}', posFix: -2 },
{ id: 'group_19_3', type: 'write', latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{}\\end{pmatrix}', posFix: -4 },
{ id: 'group_19_4', type: 'write', latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{} & \\placeholder{}\\end{pmatrix}', posFix: -3 },
{ id: 'group_19_5', type: 'write', latex: '\\begin{pmatrix}\\placeholder{}\\\\ \\placeholder{}\\\\ \\placeholder{}\\end{pmatrix}', posFix: -3 },
{
id: 'group_19_6',
type: 'write',
latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{} & \\placeholder{}\\end{pmatrix}',
posFix: -9
},
{ id: 'group_19_7', type: 'write', latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{} & \\placeholder{} & \\placeholder{}\\end{pmatrix}', posFix: -4 },
{ id: 'group_19_8', type: 'write', latex: '\\begin{pmatrix}\\placeholder{}\\\\ \\placeholder{}\\\\ \\placeholder{}\\\\ \\placeholder{}\\end{pmatrix}', posFix: -4 },
{
id: 'group_19_9',
type: 'write',
latex: '\\begin{pmatrix}\\placeholder{} & \\placeholder{} & \\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{} & \\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{} & \\placeholder{} & \\placeholder{}\\\\ \\placeholder{} & \\placeholder{} & \\placeholder{} & \\placeholder{}\\end{pmatrix}',
posFix: -16
},
{ id: 'group_19_10', type: 'write', latex: '\\begin{array}{l} {} & {} & {} & {} & {}\\end{array}', matrixType: !0, posFix: -5, row: 1, col: 5 },
{ id: 'group_19_11', type: 'write', latex: '\\begin{array}{l} {} \\\\ {} \\\\ {} \\\\ {} \\\\ {} \\end{array}', matrixType: !0, posFix: -5, row: 5, col: 1 },
{
id: 'group_19_12',
type: 'write',
latex: '\\begin{array}{l} {}&{}&{}&{}&{}\\\\{}&{}&{}&{}&{}\\\\{}&{}&{}&{}&{}\\\\{}&{}&{}&{}&{}\\\\{}&{}&{}&{}&{} \\end{array}',
matrixType: !0,
posFix: -25,
row: 5,
col: 5
}
]
},
{
id: 'group_20',
name: '底线和顶线符号',
visible: !1,
col: 5,
equtaions: [
{ id: 'group_20_1', type: 'write', latex: 'lefttopbox{}', posFix: -1, custom: !0 },
{ id: 'group_20_2', type: 'write', latex: '\\toprightbox{}', posFix: -1, custom: !0 },
{ id: 'group_20_3', type: 'write', latex: '\\leftbottombox{}', posFix: -1, custom: !0 },
{ id: 'group_20_4', type: 'write', latex: '\\rightbottombox{}', posFix: -1, custom: !0 },
{ id: 'group_20_5', type: 'write', latex: '\\boxed{\\placeholder}', posFix: -1 }
]
}
]
export const formulateReplace = {
iddots: '{\\kern3mu\\raise1mu{.}\\kern3mu\\raise6mu{.}\\kern3mu\\raise12mu{.}}',
wedgeeq: '\\overset{\\lower.2em\\wedge}{=}',
backsimeqs: '\\stackrel{\\Large\\lower.2em\\backsim}{\\lower.1em=}',
leftrightsmall: '{\\lower.2em\\small\\overrightarrow{\\leftarrow\\:}}',
smallleftright: '{\\raise6mu\\small\\underleftarrow{\\:\\rightarrow}}',
rlsharpoons: '\\stackrel{\\large\\rightharpoonup}{\\small\\leftharpoondown}',
srlharpoons: '\\stackrel{\\small\\rightharpoonup}{\\large\\leftharpoondown}',
neswarrow: '\\unicode{x2922}',
nwsearrow: '\\unicode{x2921}',
nsubset: '⊄',
nsupset: '⊅',
overrightleftarrows: '\\overset{#1}{\\rightleftarrows}',
underrightleftarrows: '\\underset{#1}{\\rightleftarrows}',
overrightleftharpoons: '\\overset{#1}{\\rightleftharpoons}',
underrightleftharpoons: '\\underset{#1}{\\rightleftharpoons}',
leftlineline: '\\left| \\left|{#1}\\right.\\right.',
rightlineline: '\\left.\\left.{#1}\\right|\\right|',
LineLine: '\\left| \\left|{#1} \\right|\\right|',
llbracket: '\\left[\\left[{#1}\\right.\\right.',
rrbracket: '\\left.\\left.{#1}\\right]\\right]',
Bracket: '\\left[\\left[{#1}\\right]\\right]',
overfrown: '\\overset{\\style{font-size: 2em}{\\frown}}{#1}',
overrarrow: '\\overset{\\rightarrow}{#1}',
overlarrow: '\\overset{\\leftarrow}{#1}',
overlrarrow: '\\overset{\\leftrightarrow}{#1}',
overrharpoonup: '\\overset{\\rightharpoonup}{#1}',
overlharpoonup: '\\overset{\\leftharpoonup}{#1}',
underrarrow: '\\underset{\\rightarrow}{#1}',
underlarrow: '\\underset{\\leftarrow}{#1}',
underlrarrow: '\\underset{\\leftrightarrow}{#1}',
underrharpoonup: '\\underset{\\rightharpoonup}{#1}',
underlharpoonup: '\\underset{\\leftharpoonup}{#1}',
underdot: '\\underset{\\cdot}{#1}',
underddot: '\\underset{\\cdot\\cdot}{#1}',
underdddot: '\\underset{\\cdot\\cdot\\cdot}{#1}',
overllrarrow: '\\overset{#1}{\\longleftrightarrow}',
underllrarrow: '\\underset{#1}{\\longleftrightarrow}',
enter: '\\text{↲}',
lefttopbox: '\\left|{\\overline{#1}}\\right.',
toprightbox: 'left.{\\overline {#1}}\\right|',
leftbottombox: 'left|{\\underline {#1}} \\right.',
rightbottombox: 'left. {\\underline {#1}} \\right|',
overxrightarrow: '\\xrightarrow[#1]{}',
underxleftarrow: '\\xleftarrow[#1]{}',
overcirc: '{#1}^{\\circ}',
overprime: '{#1}^{\\prime}',
overpprime: '{#1}^{\\prime\\prime}',
overppprime: '{#1}^{\\prime\\prime\\prime}',
overbackprime: '{}^{\\backprime}{#1}',
start: '^{#1}',
vertical: '\\overline{\\left){#1}\\right.}',
oversmile: '\\overset{\\style{font-size: 2em}{\\smile}}{#1}'
}
export const u = [
{ id: 'group_12_16', type: 'write', latex: '\\pi', text: 'π', label: 'π' },
{ id: 'group_1_3', type: 'write', latex: '\\times', label: '乘', text: '×' },
{ id: 'group_1_5', type: 'write', latex: '\\div', label: '除', text: '÷' },
{ id: 'group_8_1', type: 'write', latex: '\\dfrac{}{}', label: '分数', posFix: -1 },
{ id: 'group_8_6', type: 'write', latex: '\\sqrt{}', label: '根式', posFix: -1 },
{ id: 'group_9_1', type: 'write', latex: '^{}', label: '上标', posFix: -1 },
{ id: 'group_9_2', type: 'write', latex: '_{}', label: '下标', posFix: -1 },
{ id: 'group_9_3', type: 'write', latex: '{}_{}^{}', posFix: -1 },
{ id: 'group_7_1', type: 'write', latex: '\\left(\\right)', posFix: -1 },
{ id: 'group_7_2', type: 'write', latex: '\\left[\\right]', posFix: -1 }
]
export const c = [
{ name: '\\pm', replaceWith: '\\pm', id: 'group_1_1' },
{ id: 'group_1_2', name: '\\mp', replaceWith: '\\mp' },
{ name: '\\times', replaceWith: '\\times', id: 'group_1_3' },
{ name: '\\div', replaceWith: '\\div', id: 'group_1_5' },
{ name: '\\cdot', replaceWith: '\\cdot', id: 'group_1_9' },
{ name: '\\cdots', replaceWith: '\\cdots', id: 'group_10_5' },
{ name: '\\infty', replaceWith: '\\infty', id: 'group_11_11' },
{ name: '\\leqslant', replaceWith: '\\leqslant', id: 'group_2_1' },
{ name: '\\geqslant', replaceWith: '\\geqslant', id: 'group_2_2' },
{ name: '\\neq', replaceWith: '\\neq', id: 'group_2_13' },
{ name: '\\approx', replaceWith: '\\approx', id: 'group_2_10' },
{ name: '\\because', replaceWith: '\\because', id: 'group_3_1' },
{ name: '\\therefore', replaceWith: '\\therefore', id: 'group_3_2' },
{ name: '\\angle', replaceWith: '\\angle', id: 'group_11_25' },
{ name: '/', replaceWith: '/', dom: '<span>/</span>' },
{ name: '\\bot', replaceWith: '\\bot', id: 'group_11_28' },
{ name: '\\circ', replaceWith: '^{\\circ}', id: 'group_1_12', positionFix: 1 },
{ name: '\\prime', replaceWith: '^{\\prime}', id: 'group_5_2', positionFix: 1 },
{ name: '\\dprime', replaceWith: '^{\\dprime}', id: 'group_5_3', positionFix: 1 },
{ name: '\\triangle', replaceWith: '\\triangle', id: 'group_11_30' },
{ name: '\\odot', replaceWith: '\\odot', id: 'group_1_8' },
{ name: '\\backsim', replaceWith: '\\backsim', id: 'group_2_19' },
{ name: '\\Delta', replaceWith: '\\Delta', id: 'group_11_15' },
{ id: 'group_8_1', name: '\\dfrac', replaceWith: '\\dfrac{}{}', positionFix: -1 },
{ id: 'group_8_6', name: '\\sqrt', replaceWith: '\\sqrt{}', posFix: -1 },
{ id: 'group_17_4', name: '\\overline', replaceWith: '\\overline{}' },
{ id: 'group_9_1', name: '\\power', replaceWith: '^{}', positionFix: -1 },
{ id: 'group_9_2', name: '\\index', replaceWith: '_{}', positionFix: -1 },
{ id: 'group_7_5', name: '\\left\\right', replaceWith: '\\left|{}\\right|', positionFix: -1 },
{ id: 'group_14_3', name: '\\sum', replaceWith: '\\sum _{i =1}^{n}' },
{ id: 'group_17_8', name: '\\overrightarrow', replaceWith: '\\overrightarrow{}', positionFix: -1 },
{ id: 'group_12_16', name: '\\pi', replaceWith: '\\pi' },
{ id: 'group_12_1', name: '\\alpha', replaceWith: '\\alpha' },
{ id: 'group_12_2', name: '\\beta', replaceWith: '\\beta' },
{ id: 'group_12_8', name: '\\gamma', replaceWith: '\\gamma' },
{ id: 'group_12_18', name: '\\theta', replaceWith: '\\theta' },
{ id: 'group_12_25', name: '\\omega', replaceWith: '\\omega' },
{ id: 'group_4_1', name: '\\in', replaceWith: '\\in' },
{ id: 'group_4_9', name: '\\subseteq', replaceWith: '\\subseteq' },
{ id: 'group_4_3', name: '\\cup', replaceWith: '\\cup' },
{ id: 'group_4_4', name: '\\cap', replaceWith: '\\cap' },
{ id: 'group_4_12', name: '\\varnothing', replaceWith: '\\varnothing' },
{ id: 'group_4_14', name: '\\complement', replaceWith: '\\complement' },
{ id: 'group_13_13', name: '\\upNu', replaceWith: '\\mathbf{N}' },
{ id: 'group_13_24', name: '\\upZeta', replaceWith: '\\mathbf{Z}' },
{ id: 'group_6_8', name: '\\Rightarrow', replaceWith: '\\Rightarrow' },
{ id: 'group_6_7', name: '\\Leftrightarrow', replaceWith: '\\Leftrightarrow' },
{ id: 'group_3_4', name: '\\exists', replaceWith: '\\exists' },
{ id: 'group_3_5', name: '\\forall', replaceWith: '\\forall' },
{ id: 'group_3_6', name: '\\neg', replaceWith: '\\neg' },
{ id: 'group_3_7', name: '\\wedge', replaceWith: '\\wedge' },
{ id: 'group_3_8', name: '\\vee', replaceWith: '\\vee' },
{ id: '', name: '\\lt', replaceWith: '<', dom: '<span><</span>' },
{ id: '', name: '\\gt', replaceWith: '>', dom: '<span>></span>' },
{ id: 'group_12_3', name: 'chi', replaceWith: '\\chi ' },
{ id: 'group_12_12', name: 'lambda', replaceWith: '\\lambda ' },
{ id: 'group_12_7', name: 'varphi', replaceWith: '\\varphi' },
{ id: 'group_13_21', name: 'Omega', replaceWith: '\\Omega' },
{ id: 'group_12_13', name: 'mu', replaceWith: '\\mu ' },
{ id: 'group_12_20', name: 'rho', replaceWith: '\\rho' },
{ id: 'group_12_26', name: 'xi', replaceWith: '\\xi' },
{ id: 'group_12_9', name: 'eta', replaceWith: '\\eta' },
{ id: 'group_12_21', name: 'sigma', replaceWith: '\\sigma' },
{ id: 'group_12_5', name: 'varepsilon', replaceWith: '\\varepsilon' },
{ id: 'group_6_2', name: '\\to', replaceWith: '\\to' },
{ id: 'group_6_3', name: '\\leftarrow', replaceWith: '\\leftarrow' },
{ id: 'group_6_1', name: '\\leftrightarrow', replaceWith: '\\leftrightarrow' },
{ id: 'group_6_8', name: '\\Rightarrow', replaceWith: '\\Rightarrow' },
{ id: 'group_6_9', name: '\\Leftarrow', replaceWith: '\\Leftarrow' }
]
export const p = { class: 'keyboard' }
export const g = { class: 'button-group' }
export const d = { class: 'button' }
export const _ = { class: 'group-icon' }
export const C = { class: 'group-name' }
export const w = ['onClick', 'onMouseover']
export const templateArray = [
{
id: 'template_1',
name: '代数',
visible: !1,
col: 6,
equtaions: [
{ id: 'template_1_1', type: 'write', latex: '\\left(x-1\\right)\\left(x+3\\right) ', label: '', text: '' },
{ id: 'template_1_2', type: 'write', latex: '\\sqrt{a^2+b^2}', label: '', text: '' },
{ id: 'template_1_3', type: 'write', latex: '\\left ( \\frac{a}{b}\\right )^{n}= \\frac{a^{n}}{b^{n}}', label: '', text: '' },
{ id: 'template_1_4', type: 'write', latex: '\\frac{a}{b}\\pm \\frac{c}{d}= \\frac{ad \\pm bc}{bd}', label: '', text: '' },
{ id: 'template_1_5', type: 'write', latex: '\\frac{x^{2}}{a^{2}}-\\frac{y^{2}}{b^{2}}=1', label: '', text: '' },
{ id: 'template_1_6', type: 'write', latex: '\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0', label: '', text: '' },
{ id: 'template_1_7', type: 'write', latex: '\\sqrt[n]{a^{n}}=\\left ( \\sqrt[n]{a}\\right )^{n}', label: '', text: '' },
{ id: 'template_1_8', type: 'write', latex: 'x ={-b \\pm \\sqrt{b^2-4ac}\\over 2a}', label: '', text: '' },
{ id: 'template_1_9', type: 'write', latex: 'y-y_{1}=k \\left( x-x_{1}\\right)', label: '', text: '' },
{
id: 'template_1_10',
type: 'write',
latex: `\\left\\{\\begin{matrix}
x=a + r\\text{cos}\\theta \\\\
y=b + r\\text{sin}\\theta
\\end{matrix}\\right.`,
label: '',
text: ''
},
{
id: 'template_1_11',
type: 'write',
latex: `
\\begin{array}{l}
\\text{对于方程形如:}x^{3}-1=0 \\\\
\\text{设}\\text{:}\\omega =\\frac{-1+\\sqrt{3}i}{2} \\\\
x_{1}=1,x_{2}= \\omega =\\frac{-1+\\sqrt{3}i}{2} \\\\
x_{3}= \\omega ^{2}=\\frac{-1-\\sqrt{3}i}{2}
\\end{array}
`,
label: '',
text: ''
},
{
id: 'template_1_12',
type: 'write',
latex: `
\\begin{array}{l}
a\\mathop{{x}}\\nolimits^{{2}}+bx+c=0 \\\\
\\Delta =\\mathop{{b}}\\nolimits^{{2}}-4ac \\\\
\\left\\{\\begin{matrix}
\\Delta \\gt 0\\text{方程有两个不相等的实根} \\\\
\\Delta = 0\\text{方程有两个相等的实根} \\\\
\\Delta \\lt 0\\text{方程无实根}
\\end{matrix}\\right.
\\end{array}
`,
label: '',
text: ''
},
{
id: 'template_1_13',
type: 'write',
latex: `
\\begin{array}{l}
a\\mathop{{x}}\\nolimits^{{2}}+bx+c=0 \\\\
\\Delta =\\mathop{{b}}\\nolimits^{{2}}-4ac \\\\
\\mathop{{x}}\\nolimits_{{1,2}}=\\frac{{-b \\pm
\\sqrt{{\\mathop{{b}}\\nolimits^{{2}}-4ac}}}}{{2a}} \\\\
\\mathop{{x}}\\nolimits_{{1}}+\\mathop{{x}}\\nolimits_{{2}}=-\\frac{{b}}{{a}} \\\\
\\mathop{{x}}\\nolimits_{{1}}\\mathop{{x}}\\nolimits_{{2}}=\\frac{{c}}{{a}}
\\end{array}
`,
label: '',
text: ''
}
]
},
{
id: 'template_2',
name: '几何',
visible: !1,
col: 6,
equtaions: [
{ id: 'template_2_1', type: 'write', latex: '\\Delta A B C', text: '' },
{ id: 'template_2_2', type: 'write', latex: 'a \\parallel c,b \\parallel c \\Rightarrow a \\parallel b', text: '' },
{ id: 'template_2_3', type: 'write', latex: 'l \\perp \\beta ,l \\subset \\alpha \\Rightarrow \\alpha \\perp \\beta', text: '' },
{
id: 'template_2_4',
type: 'write',
latex: `
\\left.\\begin{matrix}
a \\perp \\alpha \\\\
b \\perp \\alpha
\\end{matrix}\\right\}\\Rightarrow a \\parallel b
`,
text: ''
},
{ id: 'template_2_5', type: 'write', latex: 'P \\in \\alpha ,P \\in \\beta , \\alpha \\cap \\beta =l \\Rightarrow P \\in l', text: '' },
{
id: 'template_2_6',
type: 'write',
latex: `
\\alpha \\perp \\beta , \\alpha \\cap \\beta =l,a \\subset \\alpha ,a \\perp l
\\Rightarrow a \\perp \\beta
`,
text: ''
},
{
id: 'template_2_7',
type: 'write',
latex: `
\\left.\\begin{matrix}
a \\subset \\beta ,b \\subset \\beta ,a \\cap b=P \\\\
a \\parallel \\partial ,b \\parallel \\partial
\\end{matrix}\\right\\}\\Rightarrow \\beta \\parallel \\alpha
`,
text: ''
},
{ id: 'template_2_8', type: 'write', latex: '\\alpha \\parallel \\beta , \\gamma \\cap \\alpha =a, \\gamma \\cap \\beta =b \\Rightarrow a \\parallel b', text: '' },
{ id: 'template_2_9', type: 'write', latex: 'A \\in l,B \\in l,A \\in \\alpha ,B \\in \\alpha \\Rightarrow l \\subset \\alpha', text: '' },
{
id: 'template_2_10',
type: 'write',
latex: `
\\left.\\begin{matrix}
m \\subset \\alpha ,n \\subset \\alpha ,m \\cap n=P \\\\
a \\perp m,a \\perp n
\\end{matrix}\\right\\}\\Rightarrow a \\perp \\alpha
`,
text: ''
},
{
id: 'template_2_11',
type: 'write',
latex: `
\\begin{array}{c}
\\text{直角三角形中,直角边长a,b,斜边边长c} \\\\
a^{2}+b^{2}=c^{2}
\\end{array}
`,
text: ''
}
]
},
{
id: 'template_3',
name: '不等式',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_3_1',
type: 'write',
latex: 'a > b,b > c \\Rightarrow a > c',
text: ''
},
{
id: 'template_3_2',
type: 'write',
latex: 'a > b,c > d \\Rightarrow a+c > b+d',
text: ''
},
{
id: 'template_3_3',
type: 'write',
latex: 'a > b > 0,c > d > 0 \\Rightarrow ac bd',
text: ''
},
{
id: 'template_3_4',
type: 'write',
latex: `
\\begin{array}{c}
a \\gt b,c \\gt 0 \\Rightarrow ac \\gt bc \\\\
a \\gt b,c \\lt 0 \\Rightarrow ac \\lt bc
\\end{array}
`,
text: ''
},
{
id: 'template_3_5',
type: 'write',
latex: '\\left | a-b \\right | \\geqslant \\left | a \\right | -\\left | b \\right |',
text: ''
},
{
id: 'template_3_6',
type: 'write',
latex: '-\\left | a \\right |\\leq a\\leqslant \\left | a \\right |',
text: ''
},
{
id: 'template_3_7',
type: 'write',
latex: '\\left | a \\right |\\leqslant b \\Rightarrow -b \\leqslant a \\leqslant \\left | b \\right |',
text: ''
},
{
id: 'template_3_8',
type: 'write',
latex: '\\left | a+b \\right | \\leqslant \\left | a \\right | + \\left | b \\right |',
text: ''
},
{
id: 'template_3_9',
type: 'write',
latex: `
\\begin{array}{c}
a \\gt b \\gt 0,n \\in N^{\\ast},n \\gt 1 \\\\
\\Rightarrow a^{n}\\gt b^{n}, \\sqrt[n]{a}\\gt \\sqrt[n]{b}
\\end{array}
`,
text: ''
},
{
id: 'template_3_10',
type: 'write',
latex: `
\\left( \\sum_{k=1}^n a_k b_k \\right)^{\\!\\!2}\\leq
\\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)
`,
text: ''
},
{
id: 'template_3_11',
type: 'write',
latex: `
\\begin{array}{c}
a,b \\in R^{+} \\\\
\\Rightarrow \\frac{a+b}{{2}}\\ge \\sqrt{ab} \\\\
\\left( \\text{当且仅当}a=b\\text{时取“}=\\text{”号}\\right)
\\end{array}
`,
text: ''
},
{
id: 'template_3_12',
type: 'write',
latex: `
\\begin{array}{c}
a,b \\in R \\\\
\\Rightarrow a^{2}+b^{2}\\gt 2ab \\\\
\\left( \\text{当且仅当}a=b\\text{时取“}=\\text{”号}\\right)
\\end{array}
`,
text: ''
},
{
id: 'template_3_13',
type: 'write',
latex: `
\\begin{array}{c}
H_{n}=\\frac{n}{\\sum \\limits_{i=1}^{n}\\frac{1}{x_{i}}}= \\frac{n}{\\frac{1}{x_{1}}+ \\frac{1}{x_{2}}+ \\cdots + \\frac{1}{x_{n}}} \\\\ G_{n}=\\sqrt[n]{\\prod \\limits_{i=1}^{n}x_{i}}= \\sqrt[n]{x_{1}x_{2}\\cdots x_{n}} \\\\ A_{n}=\\frac{1}{n}\\sum \\limits_{i=1}^{n}x_{i}=\\frac{x_{1}+ x_{2}+ \\cdots + x_{n}}{n} \\\\ Q_{n}=\\sqrt{\\sum \\limits_{i=1}^{n}x_{i}^{2}}= \\sqrt{\\frac{x_{1}^{2}+ x_{2}^{2}+ \\cdots + x_{n}^{2}}{n}} \\\\ H_{n}\\leq G_{n}\\leq A_{n}\\leq Q_{n}
\\end{array}
`,
text: ''
}
]
},
{
id: 'template_4',
name: '积分',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_4_1',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}x^n=nx^{n-1}',
text: ''
},
{
id: 'template_4_2',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}e^{ax}=a\\,e^{ax}',
text: ''
},
{
id: 'template_4_3',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}\\ln(x)=\\frac{1}{x}',
text: ''
},
{
id: 'template_4_4',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}\\sin x=\\cos x',
text: ''
},
{
id: 'template_4_5',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}\\cos x=-\\sin x',
text: ''
},
{
id: 'template_4_6',
type: 'write',
latex: '\\int k\\mathrm{d}x = kx+C',
text: ''
},
{
id: 'template_4_7',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}\\tan x=\\sec^2 x',
text: ''
},
{
id: 'template_4_8',
type: 'write',
latex: '\\frac{\\mathrm{d}}{\\mathrm{d}x}\\cot x=-\\csc^2 x',
text: ''
},
{
id: 'template_4_9',
type: 'write',
latex: '\\int \\frac{1}{x}\\mathrm{d}x= \\ln \\left| x \\right| +C',
text: ''
},
{
id: 'template_4_10',
type: 'write',
latex: '\\int \\frac{1}{\\sqrt{1-x^{2}}}\\mathrm{d}x= \\arcsin x +C',
text: ''
},
{
id: 'template_4_11',
type: 'write',
latex: '\\int \\frac{1}{1+x^{2}}\\mathrm{d}x= \\arctan x +C',
text: ''
},
{
id: 'template_4_12',
type: 'write',
latex: '\\int u \\frac{\\mathrm{d}v}{\\mathrm{d}x}\\,\\mathrm{d}x=uv-\\int \\frac{\\mathrm{d}u}{\\mathrm{d}x}v\\,\\mathrm{d}x ',
text: ''
},
{
id: 'template_4_13',
type: 'write',
latex: 'f(x) = \\int_{-\\infty}^\\infty \\hat f(x)\\xi\\,e^{2 \\pi i \\xi x} \\,\\mathrm{d}\\xi',
text: ''
},
{
id: 'template_4_14',
type: 'write',
latex: '\\int x^{\\mu}\\mathrm{d}x=\\frac{x^{\\mu +1}}{\\mu +1}+C, \\left({\\mu \\neq -1}\\right)',
text: ''
}
]
},
{
id: 'template_5',
name: '矩阵',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_5_1',
type: 'write',
latex: `
\\begin{pmatrix}
1 & 0 \\\\
0 & 1
\\end{pmatrix}
`,
text: ''
},
{
id: 'template_5_2',
type: 'write',
latex: `
\\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\\\
a_{21} & a_{22} & a_{23} \\\\
a_{31} & a_{32} & a_{33}
\\end{pmatrix}
`,
text: ''
},
{
id: 'template_5_3',
type: 'write',
latex: `
\\begin{pmatrix}
a_{11} & \\cdots & a_{1n} \\\\
\\vdots & \\ddots & \\vdots \\\\
a_{m1} & \\cdots & a_{mn}
\\end{pmatrix}
`,
text: ''
},
{
id: 'template_5_4',
type: 'write',
latex: `
\\begin{array}{c}
A=A^{T} \\\\
A=-A^{T}
\\end{array}
`,
text: ''
},
{
id: 'template_5_5',
type: 'write',
latex: `
O = \\begin{bmatrix}
0 & 0 & \\cdots & 0 \\\\
0 & 0 & \\cdots & 0 \\\\
\\vdots & \\vdots & \\ddots & \\vdots \\\\
0 & 0 & \\cdots & 0
\\end{bmatrix}
`,
text: ''
},
{
id: 'template_5_6',
type: 'write',
latex: `
A_{m\\times n}=
\\begin{bmatrix}
a_{11}& a_{12}& \\cdots & a_{1n} \\\\
a_{21}& a_{22}& \\cdots & a_{2n} \\\\
\\vdots & \\vdots & \\ddots & \\vdots \\\\
a_{m1}& a_{m2}& \\cdots & a_{mn}
\\end{bmatrix}
=\\left [ a_{ij}\\right ]
`,
text: ''
},
{
id: 'template_5_7',
type: 'write',
latex: `
\\begin{array}{c}
A={\\left[ a_{ij}\\right]_{m \\times n}},B={\\left[ b_{ij}\\right]_{n \\times s}} \\\\
c_{ij}= \\sum \\limits_{k=1}^{{n}}a_{ik}b_{kj} \\\\
C=AB=\\left[ c_{ij}\\right]_{m \\times s}
= \\left[ \\sum \\limits_{k=1}^{n}a_{ik}b_{kj}\\right]_{m \\times s}
\\end{array}
`,
text: ''
},
{
id: 'template_5_8',
type: 'write',
latex: `
\\mathbf{V}_1 \\times \\mathbf{V}_2 =
\\begin{vmatrix}
\\mathbf{i}& \\mathbf{j}& \\mathbf{k} \\\\
\\frac{\\partial X}{\\partial u}& \\frac{\\partial Y}{\\partial u}& 0 \\\\
\\frac{\\partial X}{\\partial v}& \\frac{\\partial Y}{\\partial v}& 0 \\\\
\\end{vmatrix}
`,
text: ''
}
]
},
{
id: 'template_6',
name: '三角',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_6_1',
type: 'write',
latex: 'e^{i \\theta}',
text: ''
},
{
id: 'template_6_2',
type: 'write',
latex: '\\left(\\frac{\\pi}{2}-\\theta \\right )',
text: ''
},
{
id: 'template_6_3',
type: 'write',
latex: '\\text{sin}^{2}\\frac{\\alpha}{2}=\\frac{1- \\text{cos}\\alpha}{2}',
text: ''
},
{
id: 'template_6_4',
type: 'write',
latex: '\\text{cos}^{2}\\frac{\\alpha}{2}=\\frac{1+ \\text{cos}\\alpha}{2}',
text: ''
},
{
id: 'template_6_5',
type: 'write',
latex: '\\text{tan}\\frac{\\alpha}{2}=\\frac{\\text{sin}\\alpha}{1+ \\text{cos}\\alpha}',
text: ''
},
{
id: 'template_6_6',
type: 'write',
latex: '\\sin \\alpha + \\sin \\beta =2 \\sin \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2}',
text: ''
},
{
id: 'template_6_7',
type: 'write',
latex: '\\sin \\alpha - \\sin \\beta =2 \\cos \\frac{\\alpha + \\beta}{2}\\sin \\frac{\\alpha - \\beta}{2}',
text: ''
},
{
id: 'template_6_8',
type: 'write',
latex: '\\cos \\alpha + \\cos \\beta =2 \\cos \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2}',
text: ''
},
{
id: 'template_6_9',
type: 'write',
latex: '\\cos \\alpha - \\cos \\beta =-2\\sin \\frac{\\alpha + \\beta}{2}\\sin \\frac{\\alpha - \\beta}{2}',
text: ''
},
{
id: 'template_6_10',
type: 'write',
latex: 'a^{2}=b^{2}+c^{2}-2bc\\cos A',
text: ''
},
{
id: 'template_6_11',
type: 'write',
latex: '\\frac{\\sin A}{a}=\\frac{\\sin B}{b}=\\frac{\\sin C}{c}=\\frac{1}{2R}',
text: ''
},
{
id: 'template_6_12',
type: 'write',
latex: '\\sin \\left ( \\frac{\\pi}{2}-\\alpha \\right ) = \\cos \\alpha',
text: ''
},
{
id: 'template_6_13',
type: 'write',
latex: '\\sin \\left ( \\frac{\\pi}{2}+\\alpha \\right ) = \\cos \\alpha',
text: ''
}
]
},
{
id: 'template_7',
name: '统计',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_7_1',
type: 'write',
latex: 'C_{r}^{n}',
text: ''
},
{
id: 'template_7_2',
type: 'write',
latex: '\\frac{n!}{r!(n-r)!}',
text: ''
},
{
id: 'template_7_3',
type: 'write',
latex: '\\sum_{i=1}^{n}{X_i}',
text: ''
},
{
id: 'template_7_4',
type: 'write',
latex: '\\sum_{i=1}^{n}{X_i^2}',
text: ''
},
{
id: 'template_7_5',
type: 'write',
latex: 'X_1, \\cdots,X_n',
text: ''
},
{
id: 'template_7_6',
type: 'write',
latex: '\\frac{x-\\mu}{\\sigma}',
text: ''
},
{
id: 'template_7_7',
type: 'write',
latex: '\\sum_{i=1}^{n}{(X_i - \\overline{X})^2}',
text: ''
},
{
id: 'template_7_8',
type: 'write',
latex: `
\\begin{array}{c}
\\text{若}P \\left( AB \\right) =P \\left( A \\right) P \\left( B \\right) \\\\
\\text{则}P \\left( A \\left| B\\right. \\right) =P \\left({B}\\right)
\\end{array}
`,
text: ''
},
{
id: 'template_7_9',
type: 'write',
latex: 'P(E) ={n \\choose k}p^k (1-p)^{n-k}',
text: ''
},
{
id: 'template_7_10',
type: 'write',
latex: 'P \\left( A \\right) = \\lim \\limits_{n \\to \\infty}f_{n}\\left ( A \\right )',
text: ''
},
{
id: 'template_7_11',
type: 'write',
latex: 'P \\left( \\bigcup \\limits_{i=1}^{+ \\infty}A_{i}\\right) = \\prod \\limits_{i=1}^{+ \\infty}P{\\left( A_{i}\\right)}',
text: ''
},
{
id: 'template_7_12',
type: 'write',
latex: `
\\begin{array}{c}
P \\left( \\emptyset \\right) =0 \\\\
P \\left( S \\right) =1
\\end{array}
`,
text: ''
},
{
id: 'template_7_13',
type: 'write',
latex: `
\\begin{array}{c}
\\forall A \\in S \\\\
P \\left( A \\right) \\ge 0
\\end{array}
`,
text: ''
},
{
id: 'template_7_14',
type: 'write',
latex: 'P \\left( \\bigcup \\limits_{i=1}^{n}A_{i}\\right) = \\prod \\limits_{i=1}^{n}P \\left( A_{i}\\right)',
text: ''
},
{
id: 'template_7_15',
type: 'write',
latex: `
\\begin{array}{c}
S= \\binom{N}{n},A_{k}=\\binom{M}{k}\\cdot \\binom{N-M}{n-k} \\\\
P\\left ( A_{k}\\right ) = \\frac{\\binom{M}{k}\\cdot \\binom{N-M}{n-k}}{\\binom{N}{n}}
\\end{array}
`,
text: ''
},
{
id: 'template_7_16',
type: 'write',
latex: `
\\begin{array}{c}
P_{n}=n! \\\\
A_{n}^{k}=\\frac{n!}{\\left( n-k \\left) !\\right. \\right.}
\\end{array}
`,
text: ''
}
]
},
{
id: 'template_8',
name: '数列',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_8_1',
type: 'write',
latex: 'a_{n}=a_{1}q^{n-1} ',
text: ''
},
{
id: 'template_8_2',
type: 'write',
latex: 'a_{n}=a_{1}+ \\left( n-1 \\left) d\\right. \\right.',
text: ''
},
{
id: 'template_8_3',
type: 'write',
latex: 'S_{n}=na_{1}+\\frac{n \\left( n-1 \\right)}{{2}}d',
text: ''
},
{
id: 'template_8_4',
type: 'write',
latex: 'S_{n}=\\frac{n \\left( a_{1}+a_{n}\\right)}{2}',
text: ''
},
{
id: 'template_8_5',
type: 'write',
latex: '\\frac{1}{n \\left( n+k \\right)}= \\frac{1}{k}\\left( \\frac{1}{n}-\\frac{1}{n+k}\\right)',
text: ''
},
{
id: 'template_8_6',
type: 'write',
latex: '\\frac{1}{n^{2}-1}= \\frac{1}{2}\\left( \\frac{1}{n-1}-\\frac{1}{n+1}\\right)',
text: ''
},
{
id: 'template_8_7',
type: 'write',
latex: '\\frac{1}{4n^{2}-1}=\\frac{1}{2}\\left( \\frac{1}{2n-1}-\\frac{1}{2n+1}\\right)',
text: ''
},
{
id: 'template_8_8',
type: 'write',
latex: '\\frac{n+1}{n \\left( n-1 \\left) \\cdot 2^{n}\\right. \\right.}= \\frac{1}{\\left( n-1 \\left) \\cdot 2^{n-1}\\right. \\right.}-\\frac{1}{n \\cdot 2^{n}}',
text: ''
},
{
id: 'template_8_9',
type: 'write',
latex: `
\\begin{array}{c}
\\text{若}\\left \\{a_{n}\\right \\}、\\left \\{b_{n}\\right \\}\\text{为等差数列}, \\\\
\\text{则}\\left \\{a_{n}+ b_{n}\\right \\}\\text{为等差数列}
\\end{array}
`,
text: ''
},
{
id: 'template_8_10',
type: 'write',
latex: '(1+x)^{n} =1 + \\frac{nx}{1!} + \\frac{n(n-1)x^{2}}{2!} + \\cdots',
text: ''
}
]
},
{
id: 'template_9',
name: '物理',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_9_1',
type: 'write',
latex: '\\sum \\vec{F}_i = \\frac{d\\vec{v}}{dt} = 0',
text: ''
},
{
id: 'template_9_2',
type: 'write',
latex: '\\vec{F} = m\\vec{a} = m\\frac{d^{2}\\vec{r}}{dt^{2}}',
text: ''
},
{
id: 'template_9_3',
type: 'write',
latex: '\\vec{F}_{12} = -\\vec{F}_{21}',
text: ''
},
{
id: 'template_9_4',
type: 'write',
latex: '{E_p} = -\\frac{{GMm}}{r}',
text: ''
},
{
id: 'template_9_5',
type: 'write',
latex: '\\vec{F} = k\\frac{Qq}{r^{2}}\\hat{r}',
text: ''
},
{
id: 'template_9_6',
type: 'write',
latex: '\\oint_{L} \\vec{E} \\cdot d\\vec{l} = 0',
text: ''
},
{
id: 'template_9_7',
type: 'write',
latex: 'd\\vec{B} = \\frac{\\mu_0}{4\\pi} \\frac{Idl \\times \\vec{r}}{r^{3}} = \\frac{\\mu_0}{4\\pi} \\frac{Idl\\sin\\theta}{r^{2}}',
text: ''
},
{
id: 'template_9_8',
type: 'write',
latex: 'd \\vec{F}= Id \\vec{l} \\times \\vec{B}',
text: ''
},
{
id: 'template_9_9',
type: 'write',
latex: 'E = n{{ \\Delta \\Phi } \\over {\\Delta {t} }}',
text: ''
},
{
id: 'template_9_10',
type: 'write',
latex: '\\varPhi_{e} = \\oint \\vec{E} \\cdot d\\vec{S} = \\frac{1}{\\varepsilon_{0}} \\sum q',
text: ''
},
{
id: 'template_9_11',
type: 'write',
latex: '\\oint \\vec{E} \\cdot d\\vec{l} = -\\frac{d\\varphi_{B}}{dt}',
text: ''
},
{
id: 'template_9_12',
type: 'write',
latex: '\\oint \\vec{B} \\cdot d\\vec{l} = \\mu_0 I + \\mu_0 I_d',
text: ''
},
{
id: 'template_9_13',
type: 'write',
latex: 'Q = I ^ { 2 } R \\mathrm { t }',
text: ''
},
{
id: 'template_9_14',
type: 'write',
latex: 'F = G{{Mm} \\over {{r^2}}}',
text: ''
},
{
id: 'template_9_15',
type: 'write',
latex: '{E_k} = hv - {W_0}',
text: ''
},
{
id: 'template_9_16',
type: 'write',
latex: '\\lambda = \\frac{{ \\frac{{{c^2}}}{v}}}{{ \\frac{{m{c^2}}}{h}}} = \\frac{h}{{mv}} = \\frac{h}{p}',
text: ''
},
{
id: 'template_9_17',
type: 'write',
latex: '\\Delta {x} \\Delta {p} \\ge \\frac{h}{{4 \\pi }}',
text: ''
},
{
id: 'template_9_18',
type: 'write',
latex: 'l = {l_0} \\sqrt {1 - {{( \\frac{v}{c})}^2}}',
text: ''
},
{
id: 'template_9_19',
type: 'write',
latex: '{y_0} = A \\cos ( \\omega {t} + { \\varphi _0})',
text: ''
},
{
id: 'template_9_20',
type: 'write',
latex: 'y(t) = A \\cos ( \\frac{{2 \\pi {x}}}{ \\lambda } + \\varphi )',
text: ''
},
{
id: 'template_9_21',
type: 'write',
latex: `
\\begin{array}{l}
\\nabla \\cdot \\mathbf{E} =\\cfrac{\\rho}{\\varepsilon _0} \\\\
\\nabla \\cdot \\mathbf{B} = 0 \\\\
\\nabla \\times \\mathbf{E} = -\\cfrac{\\partial \\mathbf{B}}{\\partial t } \\\\
\\nabla \\times \\mathbf{B} = \\mu _0\\mathbf{J} + \\mu _0\\varepsilon_0 \\cfrac{\\partial \\mathbf{E}}{\\partial t }
\\end{array}
`,
text: ''
},
{
id: 'template_9_22',
type: 'write',
latex: `
\\begin{array}{l}
{\\huge \\unicode{8751}}_\\mathbb{S} \\mathbf{E} \\cdot\\mathrm{d}s= \\cfrac{Q}{\\varepsilon_0} \\\\
{\\huge \\unicode{8751}}_\\mathbb{S} \\mathbf{B} \\cdot\\mathrm{d}s= 0 \\\\
{\\huge \\oint}_{\\mathbb{L}}^{} \\mathbf{E} \\cdot \\mathrm{d}l=-\\cfrac{\\mathrm{d}\\Phi _{\\mathbf{B}}}{\\mathrm{d}t } \\\\
{\\huge \\oint}_{\\mathbb{L}}^{} \\mathbf{B} \\cdot \\mathrm{d}l=\\mu_0I+ \\mu_0 \\varepsilon_0\\cfrac{\\mathrm{d}\\Phi _{\\mathbf{E}}}{\\mathrm{d}t }
\\end{array}
`,
text: ''
},
{
id: 'template_9_23',
type: 'write',
latex: `
\\begin{array}{l}
\\nabla \\cdot \\mathbf{D} =\\rho _f \\\\
\\nabla \\cdot \\mathbf{B} = 0 \\\\
\\nabla \\times \\mathbf{E} = -\\cfrac{\\partial \\mathbf{B}}{\\partial t } \\\\
\\nabla \\times \\mathbf{H} = \\mathbf{J}_f + \\cfrac{\\partial \\mathbf{D}}{\\partial t }
\\end{array}
`,
text: ''
},
{
id: 'template_9_24',
type: 'write',
latex: `
\\begin{array}{l}
{\\huge \\unicode{8751}}_\\mathbb{S} \\mathbf{D} \\cdot\\mathrm{d}s= Q_f \\\\
{\\huge \\unicode{8751}}_\\mathbb{S} \\mathbf{B} \\cdot\\mathrm{d}s= 0 \\\\
{\\huge \\oint}_{\\mathbb{L}}^{} \\mathbf{E} \\cdot \\mathrm{d}l=-\\cfrac{\\mathrm{d}\\Phi _{\\mathbf{B}}}{\\mathrm{d}t } \\\\
{\\huge \\oint}_{\\mathbb{L}}^{} \\mathbf{H} \\cdot \\mathrm{d}l=I_f+\\cfrac{\\mathrm{d}\\Phi _{\\mathbf{D}}}{\\mathrm{d}t }
\\end{array}
`,
text: ''
}
]
},
{
id: 'template_10',
name: '化学',
visible: !1,
col: 6,
equtaions: [
{
id: 'template_10_1',
type: 'write',
latex: `
\\ce{SO4^2- + Ba^2+ -> BaSO4 v}
`,
text: ''
},
{
id: 'template_10_2',
type: 'write',
latex: `
\\ce{A v B (v) -> B ^ B (^)}
`,
text: ''
},
{
id: 'template_10_3',
type: 'write',
latex: `
\\ce{Hg^2+ ->[I-] $\\underset{\\mathrm{red}}{\\ce{HgI2}}$ ->[I-] $\\underset{\\mathrm{red}}{\\ce{[Hg^{II}I4]^2-}}$}
`,
text: ''
},
{
id: 'template_10_4',
type: 'write',
latex: `
\\ce{Zn^2+ <=>[+ 2OH-][+ 2H+] $\\underset{\\text{amphoteres Hydroxid}}{\\ce{Zn(OH)2 v}}$ <=>[+ 2OH-][+ 2H+] $\\underset{\\text{Hydroxozikat}}{\\ce{[Zn(OH)4]^2-}}$}
`,
text: ''
}
]
}
]
tool.js
import dayjs from 'dayjs'
import _ from 'lodash'
import { globalUrl } from './global'
const env = import.meta.env
//将公式图片转为数学latex
export const imgToLatex = content => {
// console.log('=========content 0', content)
const imgRegex = /<img\s+[^>]*>/gi
const matches = content.match(imgRegex)
if (matches) {
matches.forEach(match => {
// 检查是否存在 data-latex 属性
const hasDataLatex = /data-latex=["'][^"']*["']/i.test(match)
// 检查是否存在 alt 属性
const hasAlt = /alt=["'][^"']*["']/i.test(match)
// 检查是否存在 style 属性且值为 display: block; margin: 0 auto;
const styleRegex = /style=["'](display: block; margin: 0 auto;)["']/i
const hasStyle = styleRegex.test(match)
if (hasDataLatex && hasAlt) {
// 提取 alt 属性值
const altRegex = /alt=["]([^"]*)["]/i
const altMatch = match.match(altRegex)
// console.log('=========altMatch', altMatch)
if ((altMatch && altMatch[1] === 'initial-img') || (altMatch && altMatch[1].indexOf('FounderCES') >= 0)) {
// 提取 src 属性值
const srcRegex = /src=["]([^"]*)["]/i
const srcMatch = match.match(srcRegex)
if (srcMatch && srcMatch[1]) {
const srcLink = srcMatch[1]
content = content.replace(match, ``)
}
} else {
if (hasStyle) {
const altText = altMatch[1].replace(/</g, '<').replace(/>/g, '>')
let newText = '$$' + altText + '$$'
content = content.replace(match, newText)
} else {
const altText = altMatch[1].replace(/</g, '<').replace(/>/g, '>')
content = content.replace(match, altText)
}
}
} else if (hasAlt) {
// 提取 alt 属性值
const altRegex = /alt=["]([^"]*)["]/i
const altMatch = match.match(altRegex)
// 正则表达式匹配 width 或 height 属性
const hasWidthOrHeight = /width=["'][^"']*["']|height=["'][^"']*["']/i.test(match);
if ((altMatch && altMatch[1] === 'initial-img') || (altMatch && altMatch[1].indexOf('FounderCES') >= 0) || (altMatch && hasWidthOrHeight)) {
// 提取 src 属性值
const srcRegex = /src=["]([^"]*)["]/i
const srcMatch = match.match(srcRegex)
if (srcMatch && srcMatch[1]) {
const srcLink = srcMatch[1]
content = content.replace(match, ``)
}
}
} else if (hasDataLatex) {
console.log('=========content 222 ===', content)
console.log('=========match 222 ===', match)
// 提取 data-latex 属性值
const dataLatexRegex = /data-latex=["']([^"']+)["']/i
const dataLatexMatch = match.match(dataLatexRegex)
if (dataLatexMatch && dataLatexMatch[1]) {
console.log(`Data-latex attribute value: ${dataLatexMatch[1]}`)
console.log(`Data-latex attribute match: ${match}`)
content = content.replace(match, '$' + dataLatexMatch[1] + '$')
console.log(`Data-latex attribute content: ${content}`)
}
}
})
}
return content
}
export const removePTagsFromRichText = input => {
// 匹配开头和结尾的p标签
const regex = /^<p>([\s\S]*)<\/p>$/
// 循环匹配直到找不到匹配项
while (regex.test(input)) {
// 去掉开头和结尾的p标签
input = input.replace(regex, '$1')
}
return input
}
export const handleSymbol = str => {
let newStr = _.cloneDeep(str)
newStr = newStr.replace(/\s*\$<br>\s*/g, '$$<br>')
newStr = newStr.replace(/<br>/g, '\n')
newStr = newStr.replace(/<\/p>/g, '\n')
newStr = newStr.replace(/<p>/g, '')
// newStr = newStr.replace(/\n\n/g, '\n')
return newStr
}
export const setToken = data => {
localStorage.setItem('pc/ErpUserInfo', JSON.stringify(data))
}
export const getToken = () => {
const token = localStorage.getItem('pc/ErpUserInfo')
if (token && token !== 'undefined') return JSON.parse(token)
else return false
}
// export const replaceImageLinksToImgTags = (text) => {
// // 正则表达式匹配常见的图片链接格式(例如:http://example.com/image.png)
// const imgRegex = /https?:\/\/[\w.-\/]+(?:jpe?g|gif|png|bmp|webp)(?:\?\S*)?(?=\s|$)/gi;
// // 替换函数,用于生成<img>标签
// function createImgTag(url) {
// return `<img src="${url}" alt="Embedded Image" />`;
// }
// console.log('===========text.replace(imgRegex, createImgTag)',text.replace(imgRegex, createImgTag))
// // 使用replace方法和正则表达式进行替换
// return text.replace(imgRegex, createImgTag);
// }
export const replaceImageLinksToImgTags = text => {
// 处理 Markdown 格式的图片和其他格式的图片链接
return text.replace(/!\[(.*?)\]\((.*?)\)|!$$(.*?)$$$(.*?)$|http[s]?:\/\/\S+\.(?:jpg|jpeg|png|gif)/g, function (match, alt, url, p1, p2) {
if (alt !== undefined && url) {
// Markdown 格式的图片
return `<img src="${url}" alt="${alt || 'initial-img'}"/>`
} else if (p1 && p2) {
// !$$...$$$ 格式的图片
return '<img src="' + p2 + '" alt="initial-img"/>'
} else {
// 直接的图片 URL
return '<img src="' + match + '" alt="initial-img"/>'
}
})
}
export const relationshipTransformation = text => {
let newText = _.cloneDeep(text)
if (text.includes('<')) {
newText = newText.replace(/</g, '\\lt')
}
if (text.includes('>')) {
newText = newText.replace(/>/g, '\\gt')
}
if (text.includes('≥')) {
newText = newText.replace(/≥/g, '\\geqslant')
}
if (text.includes('≤')) {
newText = newText.replace(/≤/g, '\\leqslant')
}
return newText
}