2.3.3 • Published 4 years ago
inline-edit-react v2.3.3
inline-edit-react
Simple react inline title editor
Demo:
Features:
- Highlight editable area;
- Enabling editing mode by clicking;
- Saving changes by Enter;
- Success and error handlers;
- Choose of text alignment in the container.
Props list
Prop | Required | Type | Default | Note |
---|---|---|---|---|
align | No | string | 'center' | CSS justify-content property for .wrapper container: 'left', 'center', 'right' |
initTitle | Yes | string | ' ' | |
onEdit | Yes | function | Will be called when Enter clicked | |
onFail | No | function | () => {return true} | Handles an error: (error) => {alert(error)} |
onSuccess | No | function | () => {return true} | Handles an success: () => {alert('Success!')} |
Browser Support:
- Firefox - 79+;
- Chrome - 84+;
- Safari - 13.1+;
- IE - 11 (Partial support);
- Edge - 84;
Installing as a package:
npm i inline-edit-react
Usage:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import InlineEdit from "inline-edit-react";
const Title = ({title, asyncEditHandler}) => {
onSuccess = () => {
alert('ok');
};
onFail = (err) => {
alert(`error: ${err}`);
}
onEdit = (newTitle) => {
asyncEditHandler(newTitle)
}
return (
<InlineEdit
initTitle = {title}
onEdit = {asyncEditHandler}
onSuccess = {onSuccess}
onFail = {onFail}
align = 'left' // ['left', 'center', 'right']
</InlineEdit>
)
}
2.3.2
4 years ago
2.3.3
4 years ago
1.3.4
5 years ago
2.0.0
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.12
5 years ago
1.2.11
5 years ago
1.2.10
5 years ago
1.2.9
5 years ago
1.2.8
5 years ago
1.2.7
5 years ago
1.2.6
5 years ago
1.2.5
5 years ago
1.2.4
5 years ago
1.2.3
5 years ago
1.2.2
5 years ago
1.2.0
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago