Comments (7)
@devotion987
//toolbar 是小写的
let btn = mditor.toolbar.getItem('image');
from mditor.
@Houfeng 小写也不行
from mditor.
@devotion987
是否写在了 ready 中?
//获取或设置编辑器的值
mditor.on('ready', function(){
//toolbar 是小写的
let btn = mditor.toolbar.getItem('image');
console.log(btn);
});
from mditor.
我是这么写的,按照你的方式没错了,感谢!
$(document).ready(function () {
// window.mditor =
mditor = Mditor.fromTextarea(document.getElementById('md-editor'));
//更改按钮行为
//示例,更改「图片」按钮配置,其它按钮是同样的方法
let btn = mditor.toolbar.getItem('image');
//替换按钮动作
//btn.handler = function(){
//自定义处理逻辑
//this 指向当前 mditor 实例
};
});
from mditor.
@Houfeng 你好大神,想请教下点击“图片”工具条从本地选择图片然后上传到服务器,在上述代码
btn.handler == function() {}
代码块中该如何实现?谢谢!
from mditor.
@devotion987
你先去 google 一下,了解一些对应的浏览器 api,实现的过程中,有具体的问题,我会很乐意回答。
from mditor.
@Houfeng 最近在使用tale搭建博客,编辑器使用的是mditor,觉得图片上传功能使用不太方便,想到两种实现方式,第一种是上面说的,第二种是当使用截图工具截取图片时,ctrl+v直接复制将图片上传到本地或者七牛服务器,然后返回图片链接地址。由于本人主要做后端开发,对前端了解不太多,还请指点一二,功能完成也可以分享出来,不胜感激,另外,有QQ或Q群可以加下,方便交流!
from mditor.
Related Issues (20)
- 有没有相关的调试方法什么的? HOT 6
- 怎么移除编辑器? HOT 1
- npm方式下载的包,只引出了Parser方法。 HOT 2
- 如何获取完整的html(预览的html)? HOT 2
- 初始化mditor只有一种方式么? HOT 1
- 如何设置高度? HOT 1
- 可否支持 空格缩进 不然 文章 全是一堆的 不好阅读啊 HOT 2
- ready事件和change事件进不去 HOT 2
- 程序外的复制无法粘贴
- 可以es6模式引入吗
- Uncaught TypeError: Function.prototype.toString requires that 'this' be a Function
- 能不能支持mermaid
- 是否支持react HOT 2
- npm 的cdn 里面的资源不是最新的了
- react页面渲染 HOT 2
- 代码块中的语言没有高亮 HOT 1
- 有没有change方法可以调用呀
- 存在 XSS 问题,无法在追加的内容改变事件中处理
- mditor.on('ready', function () {});方法进不去 HOT 1
- 不支持ts啊
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mditor.