2.3.3 • Published 3 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
3 years ago
2.3.3
3 years ago
1.3.4
4 years ago
2.0.0
4 years ago
1.3.3
4 years ago
1.3.2
4 years ago
1.3.1
4 years ago
1.3.0
4 years ago
1.2.12
4 years ago
1.2.11
4 years ago
1.2.10
4 years ago
1.2.9
4 years ago
1.2.8
4 years ago
1.2.7
4 years ago
1.2.6
4 years ago
1.2.5
4 years ago
1.2.4
4 years ago
1.2.3
4 years ago
1.2.2
4 years ago
1.2.0
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago