Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions src/RichTextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,26 @@ export default class RichTextEditor extends Component {
hiddenTitle: PropTypes.bool,
enableOnChange: PropTypes.bool,
footerHeight: PropTypes.number,
contentInset: PropTypes.object
contentInset: PropTypes.object,

//customize link modal
linkTitleText: PropTypes.string,
linkURLText: PropTypes.string,
linkCancelText: PropTypes.string,
linkInsertText: PropTypes.string,
linkUpdateText: PropTypes.string,
};

static defaultProps = {
contentInset: {},
style: {}
style: {},

//customize link modal
linkTitleText: 'Title',
linkURLText: 'URL',
linkCancelText: 'Cancel',
linkInsertText: 'Insert',
linkUpdateText: 'Update',
};

constructor(props) {
Expand Down Expand Up @@ -92,7 +106,7 @@ export default class RichTextEditor extends Component {
const editorAvailableHeight = Dimensions.get('window').height - keyboardHeight - spacing;
this.setEditorHeight(editorAvailableHeight);
}

onBridgeMessage(str){
try {
const message = JSON.parse(str);
Expand Down Expand Up @@ -209,15 +223,15 @@ export default class RichTextEditor extends Component {
>
<View style={styles.modal}>
<View style={[styles.innerModal, {marginBottom: PlatformIOS ? this.state.keyboardHeight : 0}]}>
<Text style={styles.inputTitle}>Title</Text>
<Text style={styles.inputTitle}>{this.props.linkTitleText}</Text>
<View style={styles.inputWrapper}>
<TextInput
style={styles.input}
onChangeText={(text) => this.setState({linkTitle: text})}
value={this.state.linkTitle}
/>
</View>
<Text style={[styles.inputTitle ,{marginTop: 10}]}>URL</Text>
<Text style={[styles.inputTitle ,{marginTop: 10}]}>{this.props.linkURLText}</Text>
<View style={styles.inputWrapper}>
<TextInput
style={styles.input}
Expand Down Expand Up @@ -257,7 +271,7 @@ export default class RichTextEditor extends Component {
style={buttonPlatformStyle}
>
<Text style={[styles.button, {paddingRight: 10}]}>
{this._upperCaseButtonTextIfNeeded('Cancel')}
{this._upperCaseButtonTextIfNeeded(this.props.linkCancelText)}
</Text>
</TouchableOpacity>
<TouchableOpacity
Expand All @@ -273,7 +287,7 @@ export default class RichTextEditor extends Component {
style={buttonPlatformStyle}
>
<Text style={[styles.button, {opacity: insertUpdateDisabled ? 0.5 : 1}]}>
{this._upperCaseButtonTextIfNeeded(this._linkIsNew() ? 'Insert' : 'Update')}
{this._upperCaseButtonTextIfNeeded(this._linkIsNew() ? this.props.linkInsertText : this.props.linkUpdateText)}
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -352,7 +366,7 @@ export default class RichTextEditor extends Component {
selectionChangeListeners: [...this.state.selectionChangeListeners, listener]
});
}

enableOnChange() {
this._sendAction(actions.enableOnChange);
}
Expand Down