0.2.4 • Published 2 years ago

quanshi-editor v0.2.4

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

使用说明

第一步:安装quanshi-editor

  npm install -d quanshi-editor --save
  或
  yarn add quanshi-editor

第二步: 代码中引入

  import React from "react"
  import RichText from "quanshi-editor"
  function App() {
      let editor1 = React.createRef();
      let editor2 = React.createRef();  
		
	  function getContent() {
          console.log(editor1.current.getContent());
          console.log(editor2.current.getContent());
      }
	  
	  function setContent(content) {
      	editor1.current.setContent(content);
      	editor2.current.setContent(content);
  	  }
	 /*
		  @params e object
		  {
			  file: object//本地上传或者黏贴的图片文件对象
			  type: string// undefiled或blob,本地上传的文件类型为空,手动黏贴的为blob类型
			  insertImage: function(url) //上传文件至服务端获取url 通过此方法插入到文本区域中
			  fail: function(errMsg) //文件上传失败,告诉组件接下来如何操作 errMsg:错误信息
		  }
     */
	  function onImageChanged(e) { 
    	  //ajax上传文件-获取文件url  
    	  e.insertImage("https://testbeefs.quanshi.com/ucfserver/hddown");
  	  }
      
	  return (<div className="App">
      <RichText ref={editor1} name="content1" onImageChanged={onImageChanged} style={{}}></RichText>
	 
	  <RichText ref={editor2} name="content2" onImageChanged={onImageChanged} style={{}}></RichText>
	  <p onClick={getContent}>获取内容</p>
      <p onClick={setContent}>设置内容</p>
	 </div>)
  }
  
  export default App;
0.2.1

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago