react-contenteditable 3.3.4 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/react-contenteditable.d.ts +3 -3
- package/lib/react-contenteditable.js +21 -8
- package/package.json +4 -4
package/README.md
CHANGED
@@ -52,6 +52,7 @@ class MyComponent extends React.Component {
|
|
52
52
|
|disabled|use true to disable editing|Boolean|
|
53
53
|
|onChange|called whenever `innerHTML` changes|Function|
|
54
54
|
|onBlur|called whenever the html element is [blurred](https://developer.mozilla.org/en-US/docs/Web/Events/blur)|Function|
|
55
|
+
|onFocus|event fires when an element has received [focus](https://developer.mozilla.org/en-US/docs/Web/API/Element/focus_event)|Function|
|
55
56
|
|onKeyUp|called whenever a key is released|Function|
|
56
57
|
|onKeyDown|called whenever a key is pressed |Function|
|
57
58
|
|className|the element's [CSS class](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class)|String|
|
@@ -25,10 +25,10 @@ export default class ContentEditable extends React.Component<Props> {
|
|
25
25
|
slot?: string | undefined;
|
26
26
|
title?: string | undefined;
|
27
27
|
color?: string | undefined;
|
28
|
-
key?: string | number | undefined;
|
29
28
|
children?: React.ReactNode;
|
29
|
+
key?: string | number | undefined;
|
30
30
|
defaultChecked?: boolean | undefined;
|
31
|
-
defaultValue?: string | number | string[] | undefined;
|
31
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
32
32
|
suppressContentEditableWarning?: boolean | undefined;
|
33
33
|
suppressHydrationWarning?: boolean | undefined;
|
34
34
|
accessKey?: string | undefined;
|
@@ -270,7 +270,7 @@ export default class ContentEditable extends React.Component<Props> {
|
|
270
270
|
}, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
271
271
|
shouldComponentUpdate(nextProps: Props): boolean;
|
272
272
|
componentDidUpdate(): void;
|
273
|
-
emitChange: (originalEvt: React.SyntheticEvent<any
|
273
|
+
emitChange: (originalEvt: React.SyntheticEvent<any>) => void;
|
274
274
|
static propTypes: {
|
275
275
|
html: PropTypes.Validator<string>;
|
276
276
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
@@ -23,6 +23,25 @@ var __assign = (this && this.__assign) || function () {
|
|
23
23
|
};
|
24
24
|
return __assign.apply(this, arguments);
|
25
25
|
};
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
27
|
+
if (k2 === undefined) k2 = k;
|
28
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
29
|
+
}) : (function(o, m, k, k2) {
|
30
|
+
if (k2 === undefined) k2 = k;
|
31
|
+
o[k2] = m[k];
|
32
|
+
}));
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
35
|
+
}) : function(o, v) {
|
36
|
+
o["default"] = v;
|
37
|
+
});
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
39
|
+
if (mod && mod.__esModule) return mod;
|
40
|
+
var result = {};
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
42
|
+
__setModuleDefault(result, mod);
|
43
|
+
return result;
|
44
|
+
};
|
26
45
|
var __rest = (this && this.__rest) || function (s, e) {
|
27
46
|
var t = {};
|
28
47
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -34,13 +53,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
34
53
|
}
|
35
54
|
return t;
|
36
55
|
};
|
37
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
38
|
-
if (mod && mod.__esModule) return mod;
|
39
|
-
var result = {};
|
40
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
41
|
-
result["default"] = mod;
|
42
|
-
return result;
|
43
|
-
};
|
44
56
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
45
57
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
46
58
|
};
|
@@ -133,8 +145,9 @@ var ContentEditable = /** @class */ (function (_super) {
|
|
133
145
|
// Perhaps React (whose VDOM gets outdated because we often prevent
|
134
146
|
// rerendering) did not update the DOM. So we update it manually now.
|
135
147
|
if (this.props.html !== el.innerHTML) {
|
136
|
-
el.innerHTML = this.
|
148
|
+
el.innerHTML = this.props.html;
|
137
149
|
}
|
150
|
+
this.lastHtml = this.props.html;
|
138
151
|
replaceCaret(el);
|
139
152
|
};
|
140
153
|
ContentEditable.propTypes = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-contenteditable",
|
3
|
-
"version": "3.3.
|
3
|
+
"version": "3.3.5",
|
4
4
|
"description": "React component representing an element with editable contents",
|
5
5
|
"main": "./lib/react-contenteditable.js",
|
6
6
|
"types": "./lib/react-contenteditable.d.ts",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"react": ">=16.3"
|
9
9
|
},
|
10
10
|
"author": "Ophir LOJKINE (original code posted by Sebastien Lorber on stackoverflow)",
|
11
|
-
"license": "
|
11
|
+
"license": "Apache-2.0",
|
12
12
|
"keywords": [
|
13
13
|
"react-component",
|
14
14
|
"contenteditable",
|
@@ -21,9 +21,9 @@
|
|
21
21
|
"url": "https://github.com/lovasoa/react-contenteditable.git"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"@types/react": "^16.9.
|
24
|
+
"@types/react": "^16.9.37",
|
25
25
|
"react": "^16.13.1",
|
26
|
-
"typescript": "^3.
|
26
|
+
"typescript": "^3.9.5"
|
27
27
|
},
|
28
28
|
"scripts": {
|
29
29
|
"compile": "tsc",
|