• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

react-umeditor: React Editor like Umeditor

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

react-umeditor

开源软件地址:

https://gitee.com/liuhong1happy/react-umeditor

开源软件介绍:

react-umeditor

VersionDownloads

React Editor like Umeditor

Install

npm install react-umeditor --save

Use

javascript

var React = require('react');var Editor = require('react-umeditor');class App extends React.Component {	constructor(props){		super(props);		this.state = {			content: ""		}	}	handleChange(content){		this.setState({			content: content		})	}	getIcons(){		var icons = [			"source | undo redo | bold italic underline strikethrough fontborder emphasis | ",			"paragraph fontfamily fontsize | superscript subscript | ",			"forecolor backcolor | removeformat | insertorderedlist insertunorderedlist | selectall | ",			"cleardoc  | indent outdent | justifyleft justifycenter justifyright | touppercase tolowercase | ",			"horizontal date time  | image emotion spechars | inserttable"		]		return icons;	}	getPlugins(){		return {			"image": { 				"uploader": { 					"name":"file", 					"url": "/api/upload" 				} 			} 		}	}	render(){	    var icons = this.getIcons();		var plugins = this.getPlugins();		return (<Editor ref="editor" 			icons={icons} 			value={this.state.content} defaultValue="<p>React Umeditor</p>" 			onChange={this.handleChange.bind(this)} 			plugins={plugins} />)	}}

html

<!DOCTYPE html><html lang="en"><head>	<meta charset="UTF-8">	<title>Editor Demo</title>		<!-- mathquill & umeditor stylesheet & if you have the formula icon -->	<link rel="stylesheet" href="../../dist/third-part/mathquill/mathquill.css"/>		<link rel="stylesheet" href="app.css" type="text/css" /></head><body>	<div id="react-container"></div>		<!-- jquery & mathquill javascript & if you have the formula icon -->	<script src="../../dist/third-part/jquery.min.js"></script>	<script src="../../dist/third-part/mathquill/mathquill.js"></script>		<!-- your react script -->	<script src="bundle.js"></script>	<script src="app.js"></script></body></html>

Example

Ref Functions

You can this.refs.editor.xxx()! The xxx maybe is as follows:

  • findDOMNode: find refs by ref name "root","editarea","toolbar","color"
  • setContent: set html of editor
  • getContent: get html of editor
  • focusEditor: focus the editor

Props

You can set the props!The props maybe is as follows:

  • onFocus: the focus event
  • onChange: the text change event { content: string }
  • defaultValue: default value of editor
  • value: value of editor
  • icons: icons of toolbar
  • plugins: settings of plugins
    • toolbar: settings of toolbar
      • icons: custom icons
        • name: name of icon
        • title: title of icon
        • onIconClick: handle event
        • mapRangeState: filter rangeState
        • props: props of icon & component
        • component: custom component, eg. dialog
    • image: settings of image dialog
      • uploader: settings of image uploader
        • name: form name of xhr
        • url: url of server
        • data: other formData of xhr
        • filter: filter json style body
      • customUploader: custom file uploader(see FileUploader)

Icons

Support icons, As fllow:

source undo redo bold italic underline strikethrough fontborder emphasis paragraph fontfamily fontsize superscript subscript forecolor backcolor removeformat insertorderedlist insertunorderedlist  selectall cleardoc  indent outdent justifyleft justifycenter justifyright  touppercase tolowercase horizontal date time  image emotion spechars inserttable formula

Snapshot

snapshot

Develop

// clone codegit clone https://github.com/liuhong1happy/react-umeditorcd react-umeditor// install requirenpm install// buildnpm run build// run example servercd examplenpm run example

Todo - Version 1.0

  • 1. Custom Image Uploader Props
  • 2. Custom Toolbar Icon
  • 3. ES6 Style
  • 4. React16
  • 5. Tests (Toolbar & Example & New Feature)
  • 6. Docs (README.md & Docs & Example Docs)

Contribute

Changes and improvements are more than welcome! Feel free to fork and open a pull request. Please make your changes in a specific branch and request to pull into master! If you can, please make sure the editor fully works before sending the PR, as that will help speed up the process.

See more document

Concat

Email: [email protected]

QQ Group: 247978846


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
截屏软件: Qt,C++写的linux下的截屏软件.发布时间:2022-03-25
下一篇:
UniversalPlayer: 基于Vitamio框架实现的视频播放器发布时间:2022-03-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap