📐 tinymece supports mathematical formulas

📐 tinymece supports mathematical formulas
master
就眠儀式 2021-07-11 17:15:33 +00:00 committed by Gitee
commit 32572587f8
473 changed files with 15828 additions and 2 deletions

View File

@ -112,9 +112,9 @@ layui.define(['jquery'],function (exports) {
option.quickbars_selection_toolbar = isset(option.quickbars_selection_toolbar) ? option.quickbars_selection_toolbar : 'cut copy | bold italic underline strikethrough '
option.plugins = isset(option.plugins) ? option.plugins : 'code quickbars print preview searchreplace autolink fullscreen image link media codesample table charmap hr advlist lists wordcount imagetools indent2em';
option.plugins = isset(option.plugins) ? option.plugins : 'code kityformula-editor quickbars print preview searchreplace autolink fullscreen image link media codesample table charmap hr advlist lists wordcount imagetools indent2em';
option.toolbar = isset(option.toolbar) ? option.toolbar : 'code undo redo | forecolor backcolor bold italic underline strikethrough | indent2em alignleft aligncenter alignright alignjustify outdent indent | link bullist numlist image table codesample | formatselect fontselect fontsizeselect';
option.toolbar = isset(option.toolbar) ? option.toolbar : 'code undo redo | kityformula-editor forecolor backcolor bold italic underline strikethrough | indent2em alignleft aligncenter alignright alignjustify outdent indent | link bullist numlist image table codesample | formatselect fontselect fontsizeselect';
option.resize = isset(option.resize) ? option.resize : false;

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<path d="M0.672,33.603c-0.432,0-0.648,0-0.648-0.264c0-0.024,0-0.144,0.24-0.432l12.433-14.569L0,0.96c0-0.264,0-0.72,0.024-0.792 C0.096,0.024,0.12,0,0.672,0h28.371l2.904,6.745h-0.6C30.531,4.8,28.898,3.72,28.298,3.336c-1.896-1.2-3.984-1.608-5.28-1.8 c-0.216-0.048-2.4-0.384-5.617-0.384H4.248l11.185,15.289c0.168,0.24,0.168,0.312,0.168,0.36c0,0.12-0.048,0.192-0.216,0.384 L3.168,31.515h14.474c4.608,0,6.96-0.624,7.464-0.744c2.76-0.72,5.305-2.352,6.241-4.848h0.6l-2.904,7.681H0.672z" fill="black"></path>
</svg>

After

Width:  |  Height:  |  Size: 571 B

View File

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="kityformula/assets/styles/base.css">
<link rel="stylesheet" href="kityformula/assets/styles/ui.css">
<link rel="stylesheet" href="kityformula/assets/styles/scrollbar.css">
<style>
html, body {
padding: 0;
margin: 0;
}
.kf-editor {
width: 780px;
height: 380px;
}
#loading {
height: 32px;
width: 340px;
line-height: 32px;
position: absolute;
top: 42%;
left: 50%;
margin-left: -170px;
font-family: arial, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
#loading img {
position: absolute;
}
#loading p {
display: block;
position: absolute;
left: 40px;
top: 0px;
margin: 0;
}
</style>
<title></title>
</head>
<body>
<div id="kfEditorContainer" class="kf-editor">
<div id="tips" class="tips">
sorry! Beta版本仅支持IE9及以上版本的浏览器正式版本将会支持低版本浏览器谢谢您的关注
</div>
</div>
<script src="kityformula/js/jquery-3.6.0.min.js"></script>
<script src="kityformula/js/kitygraph.all.js"></script>
<script src="kityformula/js/kity-formula-render.all.js"></script>
<script src="kityformula/js/kity-formula-parser.all.min.js"></script>
<script src="kityformula/js/kityformula-editor.all.min.js"></script>
<script>
//获取url地址栏传参
function getQueryVariable(variable){
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
//处理TinyMCE编辑器的事件
window.addEventListener('message', function (event) {
var data = event.data;
kfe.execCommand('get.image.data', function(data){
var latex = kfe.execCommand('get.source');
window.parent.postMessage({
mceAction: 'insertContent',
content: "<img src=\""+data.img+"\" data-latex=\""+latex+"\">"
}, '*');
window.parent.postMessage({
mceAction: 'close'
}, '*');
});
});
//实例化编辑器
jQuery( function ($) {
if ( document.body.addEventListener ) {
$( "#tips").html('<div id="loading"><img src="kityformula/loading.gif" alt="loading" /><p>正在加载,请耐心等待...</p></div>' );
var factory = kf.EditorFactory.create( $( "#kfEditorContainer" )[ 0 ], {
render: {
fontsize: 24
},
resource: {
path: "./kityformula/resource/"
}
} );
factory.ready( function ( KFEditor ) {
$( "#tips").remove();
//处理地址栏的参数并加载到编辑器中
var c=getQueryVariable("c")
if(c){
this.execCommand( "render",decodeURIComponent(c) );
}else{
this.execCommand( "render","\\placeholder" );
};
this.execCommand( "focus" );
window.kfe = this;
} );
} else {
$( "#tips").css( "color", "black" );
$( "#tips").css( "padding", "10px" );
}
} );
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Some files were not shown because too many files have changed in this diff Show More