From 5320abcc9a9eb2f2e969ee1b9f51e140922239f5 Mon Sep 17 00:00:00 2001 From: Robert Hoff Date: Tue, 8 Oct 2024 09:41:59 -0400 Subject: [PATCH 1/5] SCLD-17783 Ignores jetbrains files --- .gitignore | 3 +- .idea/inspectionProfiles/Project_Default.xml | 6 -- .idea/misc.xml | 6 -- .idea/vcs.xml | 6 -- .idea/workspace.xml | 58 -------------------- 5 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml 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 - - - - - - - - \ No newline at end of file From 114e78a6a2cefcd0c563885405e179f23617d78e Mon Sep 17 00:00:00 2001 From: Robert Hoff Date: Tue, 8 Oct 2024 10:51:07 -0400 Subject: [PATCH 2/5] SCLD-17783 Removes deprecated prop usage --- package-lock.json | 54 +++++++++++++++++++++++++++++---------------- package.json | 1 + src/Editor/index.js | 25 +++++++++++++++++---- 3 files changed, 57 insertions(+), 23 deletions(-) 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..0c745aa65 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,6 +19,7 @@ import { extractInlineStyle, getSelectedBlocksType } from "draftjs-utils"; +import Keys from "fbjs/lib/Keys"; import classNames from "classnames"; import ModalHandler from "../event-handler/modals"; import FocusHandler from "../event-handler/focus"; @@ -37,6 +39,8 @@ import localeTranslations from "../i18n"; import "./styles.css"; import "../../css/Draft.css"; +import type {DraftEditorCommand} from 'draft-js/lib/DraftEditorCommand'; + export default class WysiwygEditor extends Component { static propTypes = { onChange: PropTypes.func, @@ -196,6 +200,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 +538,7 @@ export default class WysiwygEditor extends Component { toolbarCustomButtons.map((button, index) => React.cloneElement(button, { key: index, ...controlProps }) )} - + )}
Date: Tue, 8 Oct 2024 10:58:18 -0400 Subject: [PATCH 3/5] SCLD-17783 Fixes eslint style --- src/Editor/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Editor/index.js b/src/Editor/index.js index 0c745aa65..d355edf1a 100644 --- a/src/Editor/index.js +++ b/src/Editor/index.js @@ -21,6 +21,7 @@ import { } 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"; @@ -39,8 +40,6 @@ import localeTranslations from "../i18n"; import "./styles.css"; import "../../css/Draft.css"; -import type {DraftEditorCommand} from 'draft-js/lib/DraftEditorCommand'; - export default class WysiwygEditor extends Component { static propTypes = { onChange: PropTypes.func, From 38fae814f2ef12fbbfa3c68ff86f55f75e074d62 Mon Sep 17 00:00:00 2001 From: Robert Hoff Date: Tue, 8 Oct 2024 11:02:50 -0400 Subject: [PATCH 4/5] SCLD-17783 Adds eslint rules --- .eslintrc | 2 ++ src/Editor/index.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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/src/Editor/index.js b/src/Editor/index.js index d355edf1a..a1b981242 100644 --- a/src/Editor/index.js +++ b/src/Editor/index.js @@ -10,7 +10,7 @@ import { convertFromRaw, CompositeDecorator } from "draft-js"; -import getDefaultKeyBinding from 'draft-js/lib/getDefaultKeyBinding'; +import getDefaultKeyBinding from "draft-js/lib/getDefaultKeyBinding"; import { changeDepth, handleNewLine, @@ -21,7 +21,7 @@ import { } from "draftjs-utils"; import Keys from "fbjs/lib/Keys"; import classNames from "classnames"; -import { DraftEditorCommand } from 'draft-js/lib/DraftEditorCommand'; +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"; From 096dcbb32452c8657480f49d5d6b0487d4d74b3d Mon Sep 17 00:00:00 2001 From: Robert Hoff Date: Tue, 8 Oct 2024 11:09:52 -0400 Subject: [PATCH 5/5] SCLD-17783 Fixes typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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