The code framework is vue webpack node
I want to introduce a markdown plug-in editor.md https://github.com/pandao/edi... as a module into the page written by Vue
But editor.md cannot be installed through npm
The html code of the editor.md plug-in:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Editor</title>
</head>
<body>
<p id="editormd">
<textarea style="display:none;">### Hello Editor.md !</textarea>
</p>
<link rel="stylesheet" href="css/editormd.min.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/zepto.min.js"></script>
<script src="js/editormd.min.js"></script>
<script type="text/javascript">
/* eslint-disable */
$(function () {
editormd("editormd", {
width: "98%",
height: 730,
path: "lib/", // Autoload modules mode, codemirror, marked... dependents libs path
codeFold: true,
saveHTMLToTextarea: true,
searchReplace: true,
htmlDecode: "style,script,iframe|on*",
emoji: true,
taskList: true,
tocm: true, // Using [TOCM]
tex: true, // 开启科学公式TeX语言支持,默认关闭
flowChart: true, // 开启流程图支持,默认关闭
sequenceDiagram: true, // 开启时序/序列图支持,默认关闭,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL: "examples/php/upload.php",
onload: function () {
console.log('onload', this);
}
});
});
</script>
</body>
</html>
The effect is as follows:
I want to put this as a module into the vue implementation page, but I don’t know how to do it
Similar third-party plug-ins can be organized into a vue component in this way:
After instantiation, listen to the methods provided by the instance; then
$emit
to the user, and then provide some get methods to obtain internal properties, etc.For specific implementation, please refer to
vue-ueditor
,vue-echarts
and similar ones.How to use:
My specific implementation:
First put the dependencies required by editor.md (available on github) in the /static/editor.md/ directory
MainEditor.vue component code:
/static/editor.md/css/editormd.min.css
needs to be introduced separately in htmlvue component address (imitating vue-ueditor): https://github.com/LaveyD/vue...