@3yaa3yaa/markdowntextbox 中文文档教程
MarkdownTextBox
这是降价文本框的反应组件。 该软件根据 MIT 许可证发布,请参阅 LICENSE.txt。
How to use
import { MarkdownTextBox } from '@3yaa3yaa/markdowntextbox';
...
render()
{
return <MarkdownTextBox value={textdata}
reservedItems={ArrayOfAnyReservedCharacter}
onChange={(e)=>this.onChangeHandler(e)}
focus=true //or false
textAreaStyle={{height:"500px",fontFamily:"sans-serif", fontSize:"100%"}} //Custom style for textarea
/>
}
What's "Reserved" items?
您可以为某个保留字符添加自定义行为。 创建一个包含以下元素的对象数组并将其传递给
class Reserved
{
constructor(keyword, stopwords, behaviour, description)
{
this.keyword = keyword; //string
this.stopwords = stopwords; //string array
this.behaviour = behaviour; //callback that receives an item that is surrounded by keyword and stopword
this.description = description; //breaf explanation of this item
}
}
您可以通过如下导入该库来获取上述类。
import { Reserved } from '@3yaa3yaa/markdowntextbox'
例如,
- keyword :
#
- stopwords :
["", "\n"]
- behaviour :
(node)=>{return <strong>{node}</strong>}
您收到一条文本“aaa #bbb ccc” 然后你会得到 "aaa bbb ccc"
Available Scripts
在项目目录中,你可以运行:
npm test
在交互式观察模式下启动测试运行器。
有关详细信息,请参阅有关运行测试 的部分。
npm run build
将用于生产的应用构建到 build
文件夹。
它在生产模式下正确地捆绑了 React,并优化了构建以获得最佳性能。
构建被缩小并且文件名包含哈希值。
您的应用程序已准备好部署!
有关详细信息,请参阅有关部署 的部分。
MarkdownTextBox
This is a react component of markdown text box. This software is released under the MIT License, see LICENSE.txt.
How to use
import { MarkdownTextBox } from '@3yaa3yaa/markdowntextbox';
...
render()
{
return <MarkdownTextBox value={textdata}
reservedItems={ArrayOfAnyReservedCharacter}
onChange={(e)=>this.onChangeHandler(e)}
focus=true //or false
textAreaStyle={{height:"500px",fontFamily:"sans-serif", fontSize:"100%"}} //Custom style for textarea
/>
}
What's "Reserved" items?
You can add custom behaviour to a certain reserved character. Create an array of objects that has following elements and pass it to <MarkDownTextBox reservedItems={here}/>
class Reserved
{
constructor(keyword, stopwords, behaviour, description)
{
this.keyword = keyword; //string
this.stopwords = stopwords; //string array
this.behaviour = behaviour; //callback that receives an item that is surrounded by keyword and stopword
this.description = description; //breaf explanation of this item
}
}
You can get the above class by importing this library as below.
import { Reserved } from '@3yaa3yaa/markdowntextbox'
For example,
- keyword :
#
- stopwords :
["", "\n"]
- behaviour :
(node)=>{return <strong>{node}</strong>}
and you got a text "aaa #bbb ccc" Then you will get "aaa bbb ccc"
Available Scripts
In the project directory, you can run:
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.