Skip to content

Commit 17b8e68

Browse files
committed
fix: add Prop-type
1 parent fa26da8 commit 17b8e68

File tree

3 files changed

+68
-8
lines changed

3 files changed

+68
-8
lines changed

src/components/TuiEditor/TuiEditor.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
list-style: none;
3636
}
3737

38-
// hide 'wysiwyg' and 'markdown' bottom selection
39-
.tui-editor-defaultUI .te-mode-switch-section {
40-
display: none !important
41-
}
42-
4338
// hide uplodd file
4439
.tui-editor-popup{
4540
box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.26);

src/components/TuiEditor/index.jsx

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,76 @@ class TuiEditor extends React.Component {
7979
}
8080

8181

82+
TuiEditor.defaultProps = {
83+
height: '300px',
84+
minHeight: '300px',
85+
initialValue: '',
86+
previewStyle: '',
87+
initialEditType: 'wysiwyg',
88+
language: 'en-US',
89+
useCommandShortcut: true,
90+
customHTMLSanitizer: null,
91+
frontMatter: false,
92+
hideModeSwitch: false,
93+
referenceDefinition:false,
94+
usageStatistics: false,
95+
useDefaultHTMLSanitizer: true
96+
}
97+
8298
TuiEditor.propTypes = {
83-
onChange: PropTypes.func.isRequired,
99+
className: PropTypes.string,
100+
// Markdown editor's preview style (tab, vertical)
84101
previewStyle: PropTypes.string.isRequired,
85-
height: PropTypes.string.isRequired,
86-
initialEditType: PropTypes.string.isRequired,
102+
// Editor's height style value. Height is applied as border-box ex) '300px', '100%', 'auto'
103+
height: PropTypes.string,
104+
// Initial editor type (markdown, wysiwyg)
105+
initialEditType: PropTypes.string,
106+
// Editor's initial value
87107
initialValue: PropTypes.string,
108+
// Editor's min-height style value in pixel ex) '300px'
109+
minHeight: PropTypes.string,
110+
// The placeholder text of the editable element.
111+
placeholder: PropTypes.string,
112+
// hide mode switch tab bar
113+
hideModeSwitch: PropTypes.bool,
114+
// language, 'en-US'
115+
language: PropTypes.string,
116+
// whether use keyboard shortcuts to perform commands
117+
useCommandShortcut: PropTypes.bool,
118+
// It would be emitted when editor fully load1
119+
onLoad: PropTypes.func,
120+
// It would be emitted when content changed
121+
onChange: PropTypes.func,
122+
// It would be emitted when format change by cursor position
123+
onStateChange: PropTypes.func,
124+
// It would be emitted when editor get focus
125+
onFocus: PropTypes.func,
126+
// It would be emitted when editor loose focus
127+
onBlur: PropTypes.func,
128+
// hooks
129+
hooks: PropTypes.arrayOf(PropTypes.object),
130+
// send hostname to google analytics
131+
usageStatistics: PropTypes.bool,
132+
// use default htmlSanitizer
133+
useDefaultHTMLSanitizer: PropTypes.bool,
134+
// toolbar items.
135+
toolbarItems: PropTypes.arrayOf(PropTypes.object),
136+
// Array of plugins. A plugin can be either a function or an array in the form of [function, options].
137+
plugins: PropTypes.arrayOf(PropTypes.object),
138+
// Using extended Autolinks specified in GFM spec
139+
extendedAutolinks: PropTypes.object,
140+
// convertor extention
141+
customConvertor: PropTypes.object,
142+
// Attributes of anchor element that should be rel, target, contenteditable, hreflang, type
143+
linkAttribute: PropTypes.object,
144+
// Object containing custom renderer functions correspond to markdown node
145+
customHTMLRenderer: PropTypes.object,
146+
// whether use the specification of link reference definition
147+
referenceDefinition: PropTypes.bool,
148+
// custom HTML sanitizer
149+
customHTMLSanitizer: PropTypes.func,
150+
// whether use the front matter
151+
frontMatter: PropTypes.bool
88152
}
89153

90154
export default TuiEditor

src/projects/detail/components/DescriptionField/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const DescriptionField = (props) => (
1212
{...props}
1313
previewStyle="vertical"
1414
height="400px"
15+
hideModeSwitch
1516
initialEditType="wysiwyg"
1617
initialValue={props.value}
1718
/>

0 commit comments

Comments
 (0)