You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
4.5 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d229d67"],{dec3:function(t,e,s){"use strict";s.r(e);var o=function(){var t=this;t._self._c;return t._m(0)},a=[function(){var t=this,e=t._self._c;return e("div",[e("h1",[t._v("Formula plugin")]),e("blockquote",[e("p",[t._v("v0.7.2+")])]),e("blockquote",[e("p",[t._v("This plugin is only supported in rich text mode, so it needs to be used after registering the RichText plugin")])]),e("p",[t._v("This plugin is used to support inserting formulas into nodes.")]),e("blockquote",[e("p",[t._v("注意:公式是通过"),e("a",{attrs:{href:"https://github.com/KaTeX/KaTeX"}},[t._v("KaTeX")]),t._v("库实现的,"),e("code",[t._v("KaTeX")]),t._v("提供了一些配置,插件默认的一个配置是:")])]),e("blockquote",[e("p",[t._v("Note: The formula is implemented through the "),e("a",{attrs:{href:"https://github.com/KaTeX/KaTeX"}},[t._v("KaTeX")]),t._v(" library, and 'KaTeX' provides some configurations. The default configuration for the plugin is:")])]),e("pre",{staticClass:"hljs"},[e("code",[t._v("{\n "),e("span",{staticClass:"hljs-attr"},[t._v("output")]),t._v(": "),e("span",{staticClass:"hljs-string"},[t._v("'mathml'")]),t._v("\n}\n")])]),e("blockquote",[e("p",[t._v("This formula may not render successfully on a few browsers. If you need to be compatible with these browsers, you can consider changing the configuration to 'HTML'. For detailed documentation, please refer to "),e("a",{attrs:{href:"https://katex.org/docs/options"}},[t._v("Options")]),t._v(". Using this configuration may require the introduction of a 'KaTeX' style file, which you can test on your own.")])]),e("blockquote",[e("p",[t._v("v0.9.3+will internally determine whether the current Chrome kernel version of the browser is lower than 100, If so, it will automatically convert 'output' from 'mathml' to 'html', At this point, the style file for 'KaTeX' needs to be imported, but it is not imported within the library, so you need to manually import it in the project. If you introduced 'simple-mind-map' through the 'npm' method, you can introduce it as follows:")]),e("pre",{staticClass:"hljs"},[e("code",[e("span",{staticClass:"hljs-keyword"},[t._v("import")]),t._v(" "),e("span",{staticClass:"hljs-string"},[t._v("'simple-mind-map/node_modules/katex/dist/katex.min.css'")]),t._v("\n")])]),e("p",[t._v("If you are using packaged files such as '.umd.js' or '.esm.js', you can import them through online CDN services, such as "),e("code",[t._v("https://unpkg.com/browse/katex@0.16.9/dist/")]),t._v(", Of course, it is best to upload the 'css' file of the 'katex' and the corresponding font files in the 'fonts' directory to your own server.")])]),e("h2",[t._v("Register")]),e("pre",{staticClass:"hljs"},[e("code",[e("span",{staticClass:"hljs-keyword"},[t._v("import")]),t._v(" MindMap "),e("span",{staticClass:"hljs-keyword"},[t._v("from")]),t._v(" "),e("span",{staticClass:"hljs-string"},[t._v("'simple-mind-map'")]),t._v("\n"),e("span",{staticClass:"hljs-keyword"},[t._v("import")]),t._v(" Formula "),e("span",{staticClass:"hljs-keyword"},[t._v("from")]),t._v(" "),e("span",{staticClass:"hljs-string"},[t._v("'simple-mind-map/src/plugins/Formula.js'")]),t._v("\n\nMindMap.usePlugin(Formula)\n")])]),e("p",[t._v("After registration and instantiation of "),e("code",[t._v("MindMap")]),t._v(", the instance can be obtained through "),e("code",[t._v("mindMap.formula")]),t._v(".")]),e("h2",[t._v("Usage")]),e("p",[t._v("After registering the plugin, you can use the command 'INSERT_FORMULA' to insert the specified formula for the node:")]),e("pre",{staticClass:"hljs"},[e("code",[t._v("mindMap.execCommand("),e("span",{staticClass:"hljs-string"},[t._v("'INSERT_FORMULA'")]),t._v(", "),e("span",{staticClass:"hljs-string"},[t._v("'a^2'")]),t._v(")\n")])]),e("p",[t._v("The above command will insert the 'a^2' formula into the currently active node.")]),e("p",[t._v("If you want to assign a formula to a node or nodes, you can pass the second parameter:")]),e("pre",{staticClass:"hljs"},[e("code",[t._v("mindMap.execCommand("),e("span",{staticClass:"hljs-string"},[t._v("'INSERT_FORMULA'")]),t._v(", "),e("span",{staticClass:"hljs-string"},[t._v("'a^2'")]),t._v(", [Node])\n")])]),e("p",[t._v("Pass in the specified node instance through the second parameter.")]),e("h2",[t._v("Methods")]),e("h3",[t._v("getKatexConfig()")]),e("p",[t._v("Get the current configuration passed to "),e("code",[t._v("Katex")]),t._v(".")])])}],n={},i=n,r=s("2877"),l=Object(r["a"])(i,o,a,!1,null,null,null);e["default"]=l.exports}}]);