diff --git a/.eslintrc b/.eslintrc
index 899f38f14..11c9ee084 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -9,6 +9,8 @@
"it": true
},
"rules": {
+ "comma-dangle": "off",
+ "quotes": ["error", "double"],
"react/jsx-filename-extension": 0,
"react/forbid-prop-types": 0,
"react/no-array-index-key": 0,
diff --git a/.gitignore b/.gitignore
index 2c82905e2..c0191523b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ dist
docs/.yalc/
docs/yalc.lock
stats.json
-report.html
\ No newline at end of file
+report.html
+.idea/
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 03d9549ea..000000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 3668dc8ca..000000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1ddfb..000000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 8c267c5dc..000000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1691586357656
-
-
- 1691586357656
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index a789c5e85..3e4aea69a 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,4 @@ This is a fork of https://github.com/jpuri/react-draft-wysiwyg used to get a wor
We reverted to an earlier version due to a problem with a bugfix on v1.15.0 and the forked bugfix breaking ui unit tests
-More details on problems with various verisons of the source repo: https://blinemedical.atlassian.net/browse/SCLD-10296
\ No newline at end of file
+More details on problems with various versions of the source repo: https://blinemedical.atlassian.net/browse/SCLD-10296
diff --git a/package-lock.json b/package-lock.json
index 4f7ee3303..2a2245312 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
- "name": "react-draft-wysiwyg",
- "version": "1.13.4",
+ "name": "@blinemedical/react-draft-wysiwyg",
+ "version": "1.14.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -6628,8 +6628,7 @@
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
- "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
- "dev": true
+ "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
},
"asn1": {
"version": "0.2.6",
@@ -11699,7 +11698,6 @@
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
- "dev": true,
"requires": {
"iconv-lite": "~0.4.13"
}
@@ -14280,11 +14278,32 @@
"websocket-driver": ">=0.5.1"
}
},
+ "fbjs": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-1.0.0.tgz",
+ "integrity": "sha512-MUgcMEJaFhCaF1QtWGnmq9ZDRAzECTCRAF7O6UZIlAlkTs1SasiX9aP0Iw7wfD2mJ7wDTNfg2w7u5fSCwJk1OA==",
+ "requires": {
+ "core-js": "^2.4.1",
+ "fbjs-css-vars": "^1.0.0",
+ "isomorphic-fetch": "^2.1.1",
+ "loose-envify": "^1.0.0",
+ "object-assign": "^4.1.0",
+ "promise": "^7.1.1",
+ "setimmediate": "^1.0.5",
+ "ua-parser-js": "^0.7.18"
+ },
+ "dependencies": {
+ "core-js": {
+ "version": "2.6.12",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
+ "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
+ }
+ }
+ },
"fbjs-css-vars": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz",
- "integrity": "sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ==",
- "dev": true
+ "integrity": "sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ=="
},
"fetch-ponyfill": {
"version": "4.1.0",
@@ -17126,8 +17145,7 @@
"iconv-lite": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
- "integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs=",
- "dev": true
+ "integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs="
},
"icss-replace-symbols": {
"version": "1.1.0",
@@ -17757,8 +17775,7 @@
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
- "dev": true
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"is-string": {
"version": "1.0.4",
@@ -17845,7 +17862,6 @@
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
"integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=",
- "dev": true,
"requires": {
"node-fetch": "^1.0.1",
"whatwg-fetch": ">=0.10.0"
@@ -18595,7 +18611,6 @@
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz",
"integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=",
- "dev": true,
"requires": {
"js-tokens": "^3.0.0"
}
@@ -19545,7 +19560,6 @@
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
"integrity": "sha1-mA9vcthSEaU0fGsrwYxbhMPrR+8=",
- "dev": true,
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
@@ -23774,7 +23788,6 @@
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
"integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=",
- "dev": true,
"requires": {
"asap": "~2.0.3"
}
@@ -25952,8 +25965,7 @@
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
- "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=",
- "dev": true
+ "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"setprototypeof": {
"version": "1.1.0",
@@ -28673,6 +28685,11 @@
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
"dev": true
},
+ "ua-parser-js": {
+ "version": "0.7.39",
+ "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.39.tgz",
+ "integrity": "sha512-IZ6acm6RhQHNibSt7+c09hhvsKy9WUr4DVbeq9U8o71qxyYtJpQeDxQnMrVqnIFMLcQjHO0I9wgfO2vIahht4w=="
+ },
"uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
@@ -29909,8 +29926,7 @@
"whatwg-fetch": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz",
- "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=",
- "dev": true
+ "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ="
},
"whatwg-mimetype": {
"version": "2.3.0",
diff --git a/package.json b/package.json
index 00f0a70b4..5b1caa876 100644
--- a/package.json
+++ b/package.json
@@ -58,6 +58,7 @@
"dependencies": {
"classnames": "^2.2.6",
"draftjs-utils": "^0.10.2",
+ "fbjs": "^1.0.0",
"html-to-draftjs": "^1.5.0",
"linkify-it": "^2.2.0",
"prop-types": "^15.7.2"
diff --git a/src/Editor/index.js b/src/Editor/index.js
index c5919a427..a1b981242 100644
--- a/src/Editor/index.js
+++ b/src/Editor/index.js
@@ -10,6 +10,7 @@ import {
convertFromRaw,
CompositeDecorator
} from "draft-js";
+import getDefaultKeyBinding from "draft-js/lib/getDefaultKeyBinding";
import {
changeDepth,
handleNewLine,
@@ -18,7 +19,9 @@ import {
extractInlineStyle,
getSelectedBlocksType
} from "draftjs-utils";
+import Keys from "fbjs/lib/Keys";
import classNames from "classnames";
+import { DraftEditorCommand } from "draft-js/lib/DraftEditorCommand";
import ModalHandler from "../event-handler/modals";
import FocusHandler from "../event-handler/focus";
import KeyDownHandler from "../event-handler/keyDown";
@@ -196,6 +199,21 @@ export default class WysiwygEditor extends Component {
this.focusHandler.onEditorMouseDown();
};
+ keyBindingFn: Function = (e): ?DraftEditorCommand => {
+ // eslint-disable-next-line default-case
+ switch (e.keyCode) {
+ case Keys.TAB:
+ this.onTab(e);
+ break;
+ case Keys.UP:
+ case Keys.DOWN:
+ this.onUpDownArrow(e);
+ break;
+ }
+
+ return getDefaultKeyBinding(e);
+ }
+
onTab: Function = (event): boolean => {
const { onTab } = this.props;
if (!onTab || !onTab(event)) {
@@ -519,7 +537,7 @@ export default class WysiwygEditor extends Component {
toolbarCustomButtons.map((button, index) =>
React.cloneElement(button, { key: index, ...controlProps })
)}
-
+
)}