Coder Social home page Coder Social logo

hinesboy / mavoneditor Goto Github PK

View Code? Open in Web Editor NEW
6.4K 87.0 913.0 20.99 MB

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features

Home Page: http://www.mavoneditor.com/

License: MIT License

Vue 96.26% Stylus 3.74%
vue markdown editor javascript html webpack

mavoneditor's Introduction

mavonEditor

Vue2 npm
Vue3 npm

Demo for jsfiddle

example (图片展示)

PC

PC

PC

查看更多图片点击这里...

Install mavon-editor (安装)

$ npm install mavon-editor --save

Use (如何引入)

index.js:

    // 全局注册
    // import with ES6
    import Vue from 'vue'
    import mavonEditor from 'mavon-editor'
    import 'mavon-editor/dist/css/index.css'
    // use
    Vue.use(mavonEditor)
    new Vue({
        'el': '#main',
        data() {
            return { value: '' }
        }
    })

index.html

<div id="main">
    <mavon-editor v-model="value"/>
</div>

如何在nuxt.js 中使用

首先在工程目录plugins 下新建 vue-mavon-editor.js

import Vue from 'vue';
import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';

Vue.use(mavonEditor);

然后在nuxt.config.js 中添加plugins配置

  plugins: [
  ...
    { src: '@/plugins/vue-mavon-editor', ssr: false }
  ],

最后一步在页面或者组件中引入

<template>
  <div class="mavonEditor">
    <no-ssr>
      <mavon-editor :toolbars="markdownOption" v-model="handbook"/>
    </no-ssr>
  </div>
</template>
<script>
export default {
  data() {
    return {
      markdownOption: {
        bold: true, // 粗体
        ... // 更多配置
      },
      handbook: "#### how to use mavonEditor in nuxt.js"
    };
  }
};
</script>

<style scoped>
.mavonEditor {
  width: 100%;
  height: 100%;
}
</style>

更多引入方式点击这里...

如何获取并设置markdown-it对象...

API 文档

props

name 名称 type 类型 default 默认值 describe 描述
value String 初始值
language String zh-CN 语言选择,暂支持 zh-CN: 简体中文, zh-TW: 正体中文 , en: 英文 , fr: 法语, pt-BR: 葡萄牙语, ru: 俄语, de: 德语, ja: 日语
fontSize String 14px 编辑区域文字大小
scrollStyle Boolean true 开启滚动条样式(暂时仅支持chrome)
boxShadow Boolean true 开启边框阴影
boxShadowStyle String 0 2px 12px 0 rgba(0, 0, 0, 0.1) 边框阴影样式
transition Boolean true 是否开启过渡动画
toolbarsBackground String #ffffff 工具栏背景颜色
previewBackground String #fbfbfb 预览框背景颜色
subfield Boolean true true: 双栏(编辑预览同屏), false: 单栏(编辑预览分屏)
defaultOpen String 在单栏(subfield=false)时默认展示区域.
edit: 默认展示编辑区域,
preview: 默认展示预览区域
其他 = edit
placeholder String 开始编辑... 输入框为空时默认提示文本
editable Boolean true 是否允许编辑
codeStyle String code-github markdown样式: 默认github, 可选配色方案
toolbarsFlag Boolean true 工具栏是否显示
navigation Boolean false 默认展示目录
shortCut Boolean true 是否启用快捷键
autofocus Boolean true 自动聚焦到文本框
ishljs Boolean true 代码高亮
imageFilter function null 图片过滤函数,参数为一个File Object,要求返回一个Boolean, true表示文件合法,false表示文件不合法
imageClick function null 图片点击事件,默认为预览,可覆盖
tabSize Number \t tab转化为几个空格,默认为\t
html Boolean true 启用HTML标签,因为历史原因这个标记一直默认为true,但建议不使用HTML标签就关闭它,它能彻底杜绝安全问题。
xssOptions Object {} xss规则配置, 默认开启,设置false可以关闭,开启后会对HTML标签进行过滤,默认过滤所有HTML标签属性,建议按需配置白名单减少被攻击的可能。
- 自定义规则参考: https://jsxss.com/zh/options.html
- 参考DEMO: dev-demo
toolbars Object 如下例 工具栏

toolbars

默认工具栏按钮全部开启, 传入自定义对象,可以选择启用部分按钮

/*
  例如: {
      bold: true, // 粗体
      italic: true,// 斜体
      header: true,// 标题
  }
  此时, 仅仅显示此三个功能键
*/
toolbars: {
    bold: true, // 粗体
    italic: true, // 斜体
    header: true, // 标题
    underline: true, // 下划线
    strikethrough: true, // 中划线
    mark: true, // 标记
    superscript: true, // 上角标
    subscript: true, // 下角标
    quote: true, // 引用
    ol: true, // 有序列表
    ul: true, // 无序列表
    link: true, // 链接
    imagelink: true, // 图片链接
    code: true, // code
    table: true, // 表格
    fullscreen: true, // 全屏编辑
    readmodel: true, // 沉浸式阅读
    htmlcode: true, // 展示html源码
    help: true, // 帮助
    /* 1.3.5 */
    undo: true, // 上一步
    redo: true, // 下一步
    trash: true, // 清空
    save: true, // 保存(触发events中的save事件)
    /* 1.4.2 */
    navigation: true, // 导航目录
    /* 2.1.8 */
    alignleft: true, // 左对齐
    aligncenter: true, // 居中
    alignright: true, // 右对齐
    /* 2.2.1 */
    subfield: true, // 单双栏模式
    preview: true, // 预览
}

如果需要自定义添加工具栏按钮,可以通过以下方式

<mavon-editor>
  <!-- 左工具栏前加入自定义按钮 -->
  <template slot="left-toolbar-before">
    <button
      type="button"
      @click="$click('test')"
      class="op-icon fa fa-mavon-align-left"
      aria-hidden="true"
      title="自定义"
    ></button>
  </template>
  <!-- 左工具栏后加入自定义按钮  -->
  <template slot="left-toolbar-after">
    <button
      type="button"
      @click="$click('test')"
      class="op-icon fa fa-mavon-align-left"
      aria-hidden="true"
      title="自定义"
    ></button>
  </template>
  <!-- 右工具栏前加入自定义按钮  -->
  <template slot="right-toolbar-before">
    <button
      type="button"
      @click="$click('test')"
      class="op-icon fa fa-mavon-align-left"
      aria-hidden="true"
      title="自定义"
    ></button>
  </template>
  <!-- 右工具栏后加入自定义按钮  -->
  <template slot="right-toolbar-after">
    <button
      type="button"
      @click="$click('test')"
      class="op-icon fa fa-mavon-align-left"
      aria-hidden="true"
      title="自定义"
    ></button>
  </template>
</mavon-editor>

events 事件绑定

name 方法名 params 参数 describe 描述
change String: value , String: render 编辑区发生变化的回调事件(render: value 经过markdown解析后的结果)
save String: value , String: render ctrl + s 的回调事件(保存按键,同样触发该回调)
fullScreen Boolean: status , String: value 切换全屏编辑的回调事件(boolean: 全屏开启状态)
readModel Boolean: status , String: value 切换沉浸式阅读的回调事件(boolean: 阅读开启状态)
htmlCode Boolean: status , String: value 查看html源码的回调事件(boolean: 源码开启状态)
subfieldToggle Boolean: status , String: value 切换单双栏编辑的回调事件(boolean: 双栏开启状态)
previewToggle Boolean: status , String: value 切换预览编辑的回调事件(boolean: 预览开启状态)
helpToggle Boolean: status , String: value 查看帮助的回调事件(boolean: 帮助开启状态)
navigationToggle Boolean: status , String: value 切换导航目录的回调事件(boolean: 导航开启状态)
imgAdd Number: pos, File: imgfile 图片文件添加回调事件(pos: 图片在列表中的位置, File: File Object)
imgDel Array(2):[Number: pos,File:imgfile ] 图片文件删除回调事件(Array(2): 两个元素的数组,第一位是图片在列表中的位置,第二位是File对象)

代码高亮

如不需要hightlight代码高亮显示,你应该设置ishljs为false

开启代码高亮props

<!-- ishljs默认为true -->
<mavon-editor :ishljs="true"></mavon-editor>

为优化插件体积,从v2.4.2起以下文件将默认使用cdnjs外链:

  • highlight.js
  • github-markdown-css
  • katex(v2.4.7)

代码高亮highlight.js中的语言解析文件和代码高亮样式将在使用时按需加载. github-markdown-csskatex仅会在mounted时加载

Notice: 可选配色方案支持的语言 是从 highlight.js/9.12.0 导出的

不使用cdn,本地按需加载点击这里...

图片上传

<template>
    <mavon-editor ref=md @imgAdd="$imgAdd" @imgDel="$imgDel"></mavon-editor>
</template>
<script>
export default {
    methods: {
        // 绑定@imgAdd event
        $imgAdd(pos, $file){
            // 第一步.将图片上传到服务器.
           var formdata = new FormData();
           formdata.append('image', $file);
           axios({
               url: 'server url',
               method: 'post',
               data: formdata,
               headers: { 'Content-Type': 'multipart/form-data' },
           }).then((url) => {
               // 第二步.将返回的url替换到文本原位置![...](0) -> ![...](url)
               /**
               * $vm 指为mavonEditor实例,可以通过如下两种方式获取
               * 1. 通过引入对象获取: `import {mavonEditor} from ...` 等方式引入后,`$vm`为`mavonEditor`
               * 2. 通过$refs获取: html声明ref : `<mavon-editor ref=md ></mavon-editor>,`$vm`为 `this.$refs.md`
               */
               $vm.$img2Url(pos, url);
           })
        }
    }
}
</script>

图片上传详情点击这里...

  • 默认大小样式为 min-height: 300px , min-width: 300px 可自行覆盖
  • 基础z-index: 1500
  • 仅用作展示可以设置props: toolbarsFlag: false , subfield: false, defaultOpen: "preview"

快捷键

key keycode 功能
F8 119 开启/关闭导航
F9 120 预览/编辑切换
F10 121 开启/关闭全屏
F11 122 开启/关闭阅读模式
F12 123 单栏/双栏切换
TAB 9 缩进
CTRL + S 17 + 83 触发保存
CTRL + D 17 + 68 删除选中行
CTRL + Z 17 + 90 上一步
CTRL + Y 17 + 89 下一步
CTRL + BreakSpace 17 + 8 清空编辑
CTRL + B 17 + 66 **加粗**
CTRL + I 17 + 73 *斜体*
CTRL + H 17 + 72 # 标题
CTRL + 1 17 + 97 or 49 # 标题
CTRL + 2 17 + 98 or 50 ## 标题
CTRL + 3 17 + 99 or 51 ### 标题
CTRL + 4 17 + 100 or 52 #### 标题
CTRL + 5 17 + 101 or 53 ##### 标题
CTRL + 6 17 + 102 or 54 ###### 标题
CTRL + U 17 + 85 ++下划线++
CTRL + M 17 + 77 ==标记==
CTRL + Q 17 + 81 > 引用
CTRL + O 17 + 79 1. 有序列表
CTRL + L 17 + 76 [链接标题](链接地址)
CTRL + ALT + S 17 + 18 + 83 ^上角标^
CTRL + ALT + U 17 + 18 + 85 - 无序列表
CTRL + ALT + C 17 + 18 + 67 ``` 代码块
CTRL + ALT + L 17 + 18 + 76 ![图片标题](图片链接)
CTRL + ALT + T 17 + 18 + 84 表格
CTRL + SHIFT + S 17 + 16 + 83 下角标
CTRL + SHIFT + D 17 + 16 + 68 ~~中划线~~
CTRL + SHIFT + C 17 + 16 + 67 居中
CTRL + SHIFT + L 17 + 16 + 76 居左
CTRL + SHIFT + R 17 + 16 + 82 居右
SHIFT + TAB 16 + 9 取消缩进

Dependencies (依赖)

Markdown 语法拓展

可通过获取markdown-it对象引入其他语法插件 可通过获取markdown-it对象引入其他语法插件

update(更新内容)

Collaborators(合作者)

License (证书)

mavonEditor is open source and released under the MIT License.

Copyright (c) 2017 hinesboy

mavoneditor's People

Contributors

abbychau avatar andrerieckguj avatar cheney925 avatar chenxchen avatar clarifysky avatar dependabot[bot] avatar haixuxu avatar hhui64 avatar hinesboy avatar hongfs avatar huntr-helper avatar icepear-jzx avatar jiawulin001 avatar jjjachyty avatar klgd avatar leftstick avatar masterhiei avatar medz avatar p1ass avatar rikusen0335 avatar ryicoh avatar sequoya42 avatar ta-kiyama avatar tauleos avatar u-sho avatar wangsongc avatar welcomeli avatar wenli09876545321 avatar xlcyun avatar ygj6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mavoneditor's Issues

V-model write html

Hello.
How to print html in v-model?

<mavonEditor id="v-note-wrapper" placehold="Conteudo" v-model="var" class="full-width editor-html" /> ... this.var === 'HTML' ...

我又来了~ 使用中碰到一个问题

我是把用户编辑好的内容以html格式保存, 然后我直接在编辑器里写html代码 包括一些css样式也会直接保存 展示的时候会造成布局混乱 不知道有没有什么办法能解决掉这个问题?

qiu优化build的js打包

看了gh-pages的demo,webpack.prod.conf.js这个文件是这样打包的,结果就是js文件独立于static文件夹,这样子实在是不美观,demo是吧所有资源文件都放到根目录了,我想这个资源文件仍然保持vue-cli的目录结构应该怎么做
image

发现不修改这个output会报下面的错

GET http://192.168.50.234/js/hljs.cpp.js
Error: Loading chunk 145 failed.

图片上传

请问下大概什么时候能支持图片上传呢?

delete img

工具栏中,图片上传按钮点击之后,下拉菜单打开,点击下拉菜单中的 删除图片 按钮,编辑区的内容没有更新 (例: 工具栏中删除 ./0 这张图片, 但是编辑区中 ! [图片] (./0) 没有消失)

Multiple editors

Hi! First thanks for your great work!

I want to to have multiple editors using bootstrap tabs, how can achieve it?

The first editor is working fine, but when I go to the second tab the double panel is not visible, just the first one.

captura de pantalla 2017-06-15 a las 14 02 15

captura de pantalla 2017-06-15 a las 14 01 12

As you can see in the second editor the preview div is not visible.

Thanks

几点建议

1.推荐是代码高亮采用GoogleCodePrettify,这个是主流的代码高亮,包括wordpress等很多网站都用的GoogleCodePrettify,而且或许可以解决作者js和webpack打包的问题#42
2.获取的render并不推荐就是预览的代码,我看到<pre>代码已经被hljs被处理过了,正确的应该是只生成<pre>保留原生的样子,处理应该是交给前端展示的时候进行处理
3.应该把前端部分的样式抽出来,比如一个博客分为后端编辑和前端展示,前端展示其实只是右侧预览的那部分样式,这样可以减小前端加载样式的体积

如何直接获内容的纯文本和html格式的内容

如何直接获内容的纯文本和html格式的内容。
我是做一博客的,列表页想显示部分的纯文本,详情页才显示markdow格式。

文档好像没有这两个接口,这两个接口还是挺需要的,有空加上谢谢

上传图片能否支持ie9?

我看你们给出的例子:

var formdata = new FormData();
for(var _img in this.img_file){
    formdata.append('file', this.img_file[_img]);
}
axios({
    url: '/material/add',
    method: 'post',
    data: formdata,
    headers: { 'Content-Type': 'multipart/form-data' },
}).then((res) => {
	this.$refs.mavonEditor.$imglst2Url([['./0', res.data.url]])
    console.log(res);
})

但是FormData ie9是不生效的,有没有其他的上传办法,或者能否支持嵌入webuploader上传插件:

import WebUploader from 'webuploader';
import 'webuploader/dist/webuploader.css';

admin.js:1153 [Vue warn]: Failed to mount component: template or render function not defined.

按照正常的引入1.5.4

//方法一
// import with ES6
import Vue from 'vue'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// use
Vue.use(mavonEditor)

并在页面中注册了组件

components: {
mavonEditor
}

在html中引入:

mavonEditor v-model="value"
但是还是报了标题这个错误,请作者帮助解答一下,万分感谢。

可以选择是否异步加载 highlight.js 以及 katex 吗 ?

项目用到的脚手架是基于 vue-cli 的多次修改版
而且对 webpack 不熟悉 , 已经不知道要怎么改配置文件了.
按照 readme 修改直接会报错:

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^
TypeError: Path must be a string. Received [ 'vue' ]
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:184:7)

后来改成这个样子:

var lang = require('highlight.js-async-webpack/src/file.lang.hljs.js');
entries.back_end= './src/back-end/index.js'; // highlit原始入口
entries.vue='vue';
for (var i = 0; i < lang.length; i++) {
    entries[lang[i]] = 'mavon-editor/dist/js/' + lang[i] + '.js'
}
return entries;

好不容易 run dev 成功了, 页面也不显示 , 还有报错

This relative module was not found:
* ./src/back-end/index.js in multi ./build/dev-client ./src/back-end/index.js

如果可以不用配 webpack 安装好就能直接用就好了, 不是异步加载也没关系

vue-cli怎么用啊

这个readme写的很模糊啊,vue-cli是既需要配置上面的webpack.config.base.js还是只配置下面的chunks

怎么修改z-index

你好,默认的z-index 1500 太大了,有办法能修改吗。我希望有属性能控制他。

想了解整个保存流程

编辑前:
主要是图片替换和获取内容
1.我上传图片
然后用$vm.$imgUpdateByUrl替换网址
然后我要立即保存内容
你会发现因为上传图片是异步的,change获取的渲染内容里是没替换图片的(就是说这个内容毫无用处,除非你在编辑下内容)
2.必须点文字,点空白地方根本不能编辑(要光标默认到文末)
3.我展示这个内容的话,我得保存图片列表this.img_file,然后用php去替换md源代码里的图片部分是吧,好麻烦
4.上传图片file的name是./0,服务器接受会变成_/0,用./0作为键名总归不合适,有点
建议:增加一个提交是获取编辑器内容的方法,chang有图片异步问题,还要替换md里图片代码

重新编辑,就是我要编辑我保存的文档
1.md源代码我保存了,但是图片因为机制没替换,这时候图片没了
按你的逻辑我推测应该要增加一个this.img_file,把保存的图片列表页赋值进去。然后关键是,还得把this.img_file插入的到编辑器里,你只有$vm.$refs.toolbar_left.$imgAddByFilename(这个是文件吧)
总之,重新编辑逻辑根本没有,你没法重新编辑内容

$vm.$refs.toolbar_left.$imgAddByFilename
这个怎么获取的
console.log(this.$refs.toolbar_left)=》undefined
console.log(this.$refs.mavonEditor.toolbar_left)=》undefined
得this.$refs.mavonEditor.$refs.toolbar_left.这个说明最好改改

建议:1.图片就直接把md源代码里的替换了(最好有可选项,因为我也可以不替换)
例如github的:![2](https://user-images.githubusercontent.com/5392211/28344083-fc72f416-6c53-11e7-89da-f88ca1cdb94a.jpg)
2.增加$vm.$refs.toolbar_left.$imgAddByFilename这个类似的url方法,可以插入URL、图片列表

我可能推测的不对,那应该说下这个编辑器是如何保存和重新编辑器的,目前我无法使用

hightligh.js 相關 js 的路徑

mavonEditor 會在我設定 :ishljs="true" 去找需要的 js
請問怎麼修改路徑呢
例如說我在的頁面是 /threads/1
會去這邊 /threads/1/js/hljs.cpp.js 要檔案
但我的檔案位置是在 /js/hljs.cpp.js

應該是絕對路徑的問題,但我不清楚問題來源是哪邊,麻煩了

subfield在最新版本2.1.12无效

刚看到有新版本,所以将2.1.6升级为2.1.12,发现初始化subfield分屏参数无效,不能实现编辑和预览同屏,只能实现编辑预览分屏,当全屏输入点击沉浸式阅读后再次点击预览又可以变成编辑预览分屏显示,是最新版本的分屏参数改了但是文档没有改变吗?

文件上传问题

我想问一下:
uploadimg($e){
// upload files in one request.
console.log(this.img_file);
var formdata = new FormData();
for(var _img in this.img_file){
formdata.append(_img, this.img_file[_img]);
}
axios({
url: 'http://127.0.0.1/index.php',
method: 'post',
data: formdata,
headers: { 'Content-Type': 'multipart/form-data' },
}).then((res) => {
console.log(res);
})
通过触发这个方法上传的文件怎么替换文本中base64字符串,没办法一一对应上base64的路径

缺少响应式的获取render的方法

很多时候不只是有编辑器的save方法来保存,用户可能还有其他表单来填写,最后通过一个按钮来进行提交,这就需要实时获取markdown内容和html内容,v-model只提供了markdown,其实可以v-model返回一个对象,包含markdown和html代码

Unknown custom element: <mavonEditor>

Demo is very nice but I can't setup it.

vue.esm.js?65d7:558 [Vue warn]: Unknown custom element: <mavonEditor> 
- did you register the component correctly? 
For recursive components, make sure to provide the "name" option. 
(found in <App> at D:\DEV\Git\vue2-in-yii2\vue2\src\pages\PersonalCenter.vue)

3 pictures, 1 is main.js, 2 is PersonalCenter.vue ,3 is the console of browser.
version is ^1.5.7
Is my setup right ?

请问有没有解析函数?

抱歉我是第一次使用,虽知道markdown的存在但平常并没有时间研究它,现在使用Vue做项目看到这个挺不错的,只是翻看了很久也没找到想要的解析函数,能够把md格式转为html格式,所以想问问直接方便的解析函数是什么?如果我不小心看漏了请见谅,对了还有内容的获取与上传,抱歉真的是新手,新到不行的那种。谢谢

如何使用异步组件来加载 mavonEditor 呢?

根据 vue 的文档,可以通过下面这种方式实现异步加载

Vue.component('async-webpack-example', function (resolve) {
  // 这个特殊的 require 语法告诉 webpack
  // 自动将编译后的代码分割成不同的块,
  // 这些块将通过 Ajax 请求自动下载。
  require(['./my-async-component'], resolve)
})
```
这里的 ./my-async-component 是一个 vue 组件。
可是直接 require('mavon-editor') 得到的并不是 vue 组件
这里要如何处理呢?

$vm.$img2Url和$vm.$imglst2Url不生效

<button @click="uploadimg">upload</button>
<mavon-editor ref="mavonEditor" v-model="formValidate.content" @imgAdd="$imgAdd" @imgDel="$imgDel" />
uploadimg($e){
    var formdata = new FormData();
    for(var _img in this.img_file){
        formdata.append('file', this.img_file[_img]);
    }
    axios({
        url: '/material/add',
        method: 'post',
        data: formdata,
        headers: { 'Content-Type': 'multipart/form-data' },
    }).then((res) => {
    	this.$refs.mavonEditor.$imgAddByUrl('./0', res.data.url)// 这个生效
    	this.$refs.mavonEditor.$img2Url('![图片](./0)', '![图片]('+ res.data.url +')')// 不生效
    	this.$refs.mavonEditor.$imglst2Url(['./0', res.data.url])// 不生效
        console.log(res);
    })
},

是不是我用的不对啊,我感觉![图片](./0)没有被改变成![图片](http://xxx)

建议希望控件能直接读取rander

case: 我把render 存进数据库,然后第二次读取的 时候 重新把 数据库里的render 给控件 的v-model 会显示不出来
我必须 自己在下面 写一个 dev v-html来做 此控件的显示控件如图 希望 能不用自己在v-html
image

上传图片

请问下我要上传图片到服务器,然后编辑器里的img不用base64,用服务器返回回来的url,应该怎么写呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.