🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

fc-mdeditor

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fc-mdeditor

markedown editor

latest
npmnpm
Version
0.0.3
Version published
Weekly downloads
1
-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

fc-mdEditor

简单的 markdown 编辑器,类似于 github 的 issues 评论模块。

  • 支持简单的工具栏
  • 支持粘贴上传图片
  • 支持拖拽上传文件

Install

npm i fc-mdeditor

Example

import MarkdownEditor, { marked } from '../src/index';

const Demo = React.createClass({
  render() {
    return (
      <div >
        <MarkdownEditor ref="markdownEditor" />
        <div dangerouslySetInnerHTML={{
          // 渲染html字符串需要通过这样的方式(当然我们也默认支持jquery,可以用jquery的方式渲染)
          __html: marked(this.refs.markdownEditor.getValue())
        }} />
      </div>
    );
  }
});

Props

参数说明类型默认值
value初始值String''
placeholder占位符String'Leave a comment'
uploadEnabled是否启用上传功能Booleanfalse
uploadApi上传接口String'/upload'
fileUrlPathres 中提取 fileUrl 数据的路径String'url'
fileSize上传文件大小上限(byte)Number10485760
fileTypes上传文件类型限制Array['PNG', 'GIF', 'JPG', 'DOCX', 'PPTX', 'XLSX', 'TXT', 'PDF', 'ZIP', 'MD', 'JSON']

Methods

  • getValue 获取 textarea 的 value
  • setValue(val) 设置 textarea 的 value
  • getMarkedValue 获取 marked 解析后的 value

Marked

MarkdownEditor.Marked
在组件静态方法上挂载了 Marked,用来解析 md 数据。
建议数据库存 md 数据,不要存解析后的 html 数据。

FAQs

Package last updated on 31 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts