Gathering detailed insights and metrics for react-steno
Gathering detailed insights and metrics for react-steno
Gathering detailed insights and metrics for react-steno
Gathering detailed insights and metrics for react-steno
npm install react-steno
Typescript
Module System
Node Version
NPM Version
3.7
Supply Chain
6.3
Quality
66.3
Maintenance
50
Vulnerability
92.1
License
Total Downloads
7,136
Last Day
1
Last Week
4
Last Month
69
Last Year
1,822
Minified
Minified + Gzipped
Latest Version
1.3.7
Package Id
react-steno@1.3.7
Unpacked Size
177.02 kB
Size
48.37 kB
File Count
8
NPM Version
10.2.4
Node Version
18.17.1
Published on
Apr 01, 2025
Cumulative downloads
Total Downloads
Last Day
-50%
1
Compared to previous day
Last Week
-42.9%
4
Compared to previous week
Last Month
-80.1%
69
Compared to previous month
Last Year
-45.4%
1,822
Compared to previous year
react-steno is a React library for WYSIWYG editor.
Use the package manager [npm] to install react-steno.
1npm install react-steno
Steno is the main component and consists of Tool bar options and the WYSIWYG editor.
1import Steno from "react-steno"; 2 3//props used by Steno. 4<Steno 5 html={html} 6 disabled={false} //indicate that the editor has to be in edit mode 7 onChange={(val) => {setHtml(val)}} 8 innerRef={editorRef} //ref attached to the editor 9 backgroundColor={bgColor} 10 onChangeBackgroundColor={(newColor) => setBgColor(newColor)} 11 fontColor={textColor} 12 onChangeFontColor={(newColor) => setTextColor(newColor)} 13 functionRef={fnRef} //Ref which let parent component to access the methods inside of editor component 14 isToolBarVisible={true} //to show/hide the toolbar options 15 toolbarPosition={"bottom"} //to place the toolbar either at top or at bottom 16 formatStyle={false} //If true will let user to keep the style while pasting the content inside of editor 17 onChangeOfKeepStyle={() => setFormatStyle(!formatStyle)} //handle to change the format style variable 18 fileList={files} //List of file object to track the files selected by user 19 onFileChange={handleFileChange} //handler to update the filelist array, This function will receive a file event object as an argument, when user add a new file/files to the list. 20 removeTheFile={removeTheFile} //handler to delete the file from the filelist array, This function will receive a file name to be deleted as an argument. 21 sendMsgOnEnter={false} //This will be used in case of chat application, where user wants to send msg on enter click. 22 onEnterClickLogic={handleOnEnterClick} //If user selects sendMsgOnEnter as true, then he/she has to provide the onEnter logic 23 autoHeight={true} //If autoHeight is true, then the editor area will grow from minEditorHeight to maxEditorHeight 24 minEditorHeight='200px' // Default will be 100px 25 maxEditorHeight="300px" // Default maxHeight will be 250px 26 placeHolder="Type here..." // Default will be an empty string "" 27 onClick={onClickOfEditor} // onClickOfEditor is a handler which handles the logic for on click of the editor 28 toolbarChildVisibility={{ // toolbar object to manage the visibility of each toolbar option 29 fontSize: true, 30 textTransform: false, 31 bold: true, 32 italic: true, 33 underline: true, 34 makeLink: true, 35 orderedList: false, 36 unOrderedList: true, 37 fontColor: false, 38 backgroundColor: false, 39 removeTextFormat: true, 40 keepStyle: false, 41 addFiles: true 42 }} 43 borderType={editorBorderType} 44 onChangeOfBorderType={(val) => setEditorBorderType(val)} 45 borderColor={editorBorderColor} 46 onChangeOfBorderColor={(val) => setEditorBorderColor(val)} 47 fontSize={fontSize} 48 borderWidth={borderWidth} 49 onChangeOfBorderWidth={(val) => setBorderWidth(val)} 50 onChangeOfFontSize={(val) => setFontSize(val)} 51 borderTypeConfig={{ 52 'solid': false, 53 'dashed': true, 54 }} 55 enableResize={true} 56 resizeConfig={{ 57 topLeft: true, 58 topRight: true, 59 bottomLeft: true, 60 bottomRight: true 61 }} 62 applyFormatGlobally={false} 63 verticalAlignment={'top' || 'center' || 'bottom'} 64 horizontalAlignment={'left' || 'center' || 'right' || 'justify'} 65/> 66
Parameter | Type | Description |
---|---|---|
html | string | Required. variable to store the html in text format which is coming from WYSIWYG editor. |
disabled | boolean | Required. variable to denote whether the editor has to be in edit mode or not. |
onChange | function | Required. handler to update the html variable. the updated string from the editor will be passed to this function and write your logic inside this function to update the html. |
innerRef | Ref | Required. Reference attached to the editor to control the focus and blur of the editor. |
backgroundColor | string | Required. denotes the back ground color applied to the editor. |
onChangeBackgroundColor | function | Required. handler to update the back ground color applied to the editor. |
fontColor | string | Required. denotes the font color applied to the editor. |
onChangeFontColor | function | Required. handler to update the font color applied to the editor. |
functionRef | Ref | Required. This reference will be attached to a custom objects which will have methods to toggle bold, underline and italic. This Reference will let the parent compoenent to execute the functions which are inside of editor component. Please refer the Notes section to see all the methods which will be attached to this Ref. |
isToolBarVisible | boolean | Default : true. show/hide the toolbar options |
formatStyle | boolean | Default : false. If true will let user to keep the style while pasting the content inside of editor. |
onChangeOfKeepStyle | function | handler to toggle the format style option. |
toolbarPosition | string | Default : top denotes the position to place the toolbar at top or at bottom. |
onFocus | function | Optional function to provide the custom logic when the editor is focused. |
onBlur | function | Optional function to provide the custom logic when the editor is blurred. |
fileList | Array of file object | Required If toolbarChildVisibility['addFiles'] !== false List of file object to track the files selected by user |
onFileChange | function | Required If toolbarChildVisibility['addFiles'] !== false handler to update the filelist array, This function will receive a file event object as an argument. |
removeTheFile | function | Required If toolbarChildVisibility['addFiles'] !== false handler to delete the file from the filelist array, This function will receive a file name to be deleted as an argument. |
sendMsgOnEnter | boolean | Optional, Default is false This will be used in case of chat application, where user wants to send msg on enter click. when this is true, then user can get to the new line by using shift + enter, ctrl + enter or alt + enter(in windows) and option + enter (in mac). |
onEnterClickLogic | function | Required, If sendMsgOnEnter is true Handler to handle the on enter logic provided by user. This function will receive the updated html text from the editor and user has to use this value inside the given function |
autoHeight | boolean | Optional, Default : 'false' If autoHeight is true then the editor height will grow from minEditorHeight to maxEditorHeight. |
minEditorHeight | String | Optional, Default : '100px' If autoHeight is true, then this minEditorHeight will be treated as css minHeight property on editor and if the autoHeight is false then minEditorHeight will be treated as css height property on editor. |
maxEditorHeight | String | Optional, Default : '250px' If autoHeight is true, then this maxEditorHeight will be treated as css maxHeight property on editor. |
placeHolder | string | Optional, Default : "" Place holder string will be shown inside of an editor when there no text typed. Default value will be an empty string. |
onClick | function | Optional handler function which will holds the logic for on click of the editor. |
toolbarChildVisibility | object | Optional Default will be true for each toolbar option toolbar object to manage the visibility of each toolbar option. each property name should match with the above given demo. In case if the object is not provided or the property is not mentioned then the particular toolbar option will be visible. |
borderColor | string | Optonal. denotes the border color applied to the editor. |
onChangeOfBorderColor | function | Required if borderColor is not undefined. handler to update the border color applied to the editor. |
fontSize | number | Optional, Default : 16 It is the font size of the entire text editor. |
onChangeOfFontSize | function | Optional. handler to update the font size applied to the editor. |
borderWidth | number | Optional, Default : 1 It is the border width of the text editor area. |
onChangeOfBorderWidth | function | Optional. handler to update the border width applied to the text editor area. |
borderTypeConfig | Object | Optional. We have many different types of border and by default all if the borders type will be shown in the dropdown and if user wants to display only few of the border types then they can take the help of this prop and pass the key value property in which key denotes the border type name and value is a boolean true and false (denoting whether to display this border type in dropdown or not) |
enableResize | boolean | Optional, Default : false enabling the resize will let the user to resize the text editor from 4 corners. The Resize on height will only work if the autoHeight prop is true. |
resizeConfig | Object | Optional, Default : All 4 corners will be resizable if enableresize is true User can disable the resize from any of the corner. This prop will take key value property in which key is the corner name ('topLeft', 'bottomLeft', 'topRight', 'bottomRight') and value will be boolean value either true or false. false denoting the disabling of the particular corner resize. |
verticalAlignment | String | Optional, Default : 'top' It will be used align the editor content vertically. |
horizontalAlignment | String | Optional, Default : 'left' It will be used align the editor content horizontally. |
applyFormatGlobally | Boolean | Optional, Default : false When applying the format like bold, italic, underline and strike through and user has not selected text, then enabling this prop will apply the format to the entire content in the editor. |
padding | Number | Optional, Default : 5 It will set the padding for the editor area and the unit will be pixel. |
toggleStyle
- This function is used to toggle the style of the selected text.
handleHeadingChange
- This function is used to change the type of the HTML element for the sentence where the mouse cursor is currenlty present.
removeFormatting
- This function is used to remove the formatting of the selected text.
toggleOrderedList
- This function is used to create ordered list and unordered list at the given mouse cursor position.
setTheColorForSelectedText
- This function is used to set the color for the selected text.
applyTextTransform
- This function is used to apply the text transform on the selected text and if no text is selected then the text transform will be applied globally to the entire editor.
Component | Description |
---|---|
ToolBar | It will consiste of list of all the formatting options which will be used by editor. |
Editor | The Editor component is an engine of our machine. The Editor component will have all the methods to format the selected text. |
No vulnerabilities found.
No security vulnerabilities found.