From 10aa9ca9ee1f556c24b57428468529a1f9bbb311 Mon Sep 17 00:00:00 2001 From: Kukollu Date: Tue, 24 Sep 2024 23:10:15 +0530 Subject: [PATCH 1/8] lexical editor integration --- package.json | 6 +- packages/gamut/package.json | 15 ++ yarn.lock | 467 +++++++++++++++++++++++++++++++++++- 3 files changed, 481 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 990e6ad875..8a06d587ed 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@babel/core": "7.20.12", "@babel/preset-typescript": "^7.18.6", "@codecademy/eslint-config": "8.0.0", + "@codecademy/gamut-kit": "^0.6.441", "@codecademy/prettier-config": "^0.2.0", "@codecademy/tsconfig": "^0.2.0", "@emotion/babel-plugin": "11.11.0", @@ -53,6 +54,7 @@ "lerna": "7.2.0", "lint-staged": "14.0.1", "lodash": "^4.17.5", + "lodash-es": "^4.17.21", "micromatch": "^4.0.5", "mutationobserver-shim": "^0.3.3", "nx": "16.8.1", @@ -67,7 +69,9 @@ "ts-jest": "29.1.1", "ts-node": "10.9.1", "tslib": "2.4.0", - "typescript": "5.1.3" + "typescript": "5.1.3", + "y-websocket": "^2.0.4", + "yjs": "^13.6.19" }, "devDependencies": { "eslint-plugin-lodash": "^7.4.0", diff --git a/packages/gamut/package.json b/packages/gamut/package.json index 42f7d632b5..02bab3cdf8 100644 --- a/packages/gamut/package.json +++ b/packages/gamut/package.json @@ -4,6 +4,21 @@ "version": "57.2.2", "author": "Codecademy Engineering ", "dependencies": { + "@lexical/clipboard": "0.16.0", + "@lexical/code": "0.16.0", + "@lexical/file": "0.16.0", + "@lexical/hashtag": "0.16.0", + "@lexical/link": "0.16.0", + "@lexical/list": "0.16.0", + "@lexical/mark": "0.16.0", + "@lexical/overflow": "0.16.0", + "@lexical/plain-text": "0.16.0", + "@lexical/react": "0.16.0", + "@lexical/rich-text": "0.16.0", + "@lexical/selection": "0.16.0", + "@lexical/table": "0.16.0", + "@lexical/utils": "0.16.0", + "lexical": "0.16.0", "@codecademy/gamut-icons": "9.31.0", "@codecademy/gamut-illustrations": "0.48.0", "@codecademy/gamut-patterns": "0.9.14", diff --git a/yarn.lock b/yarn.lock index ceb8d079de..f567ffdc49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3490,6 +3490,214 @@ yargs "16.2.0" yargs-parser "20.2.4" +"@lexical/clipboard@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/clipboard/-/clipboard-0.16.0.tgz#3ae0d87a56bd3518de077e45b0c1bbba2f356193" + integrity sha512-eYMJ6jCXpWBVC05Mu9HLMysrBbfi++xFfsm+Yo7A6kYGrqYUhpXqjJkYnw1xdZYL3bV73Oe4ByVJuq42GU+Mqw== + dependencies: + "@lexical/html" "0.16.0" + "@lexical/list" "0.16.0" + "@lexical/selection" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/code@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/code/-/code-0.16.0.tgz#225030342e3c361e5541c750033323007a947880" + integrity sha512-1EKCBSFV745UI2zn5v75sKcvVdmd+y2JtZhw8CItiQkRnBLv4l4d/RZYy+cKOuXJGsoBrKtxXn5sl7HebwQbPw== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + prismjs "^1.27.0" + +"@lexical/devtools-core@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/devtools-core/-/devtools-core-0.16.0.tgz#326c8e2995ce6e6e9e1fc4654ee2affbecdbd46d" + integrity sha512-Jt8p0J0UoMHf3UMh3VdyrXbLLwpEZuMqihTmbPRpwo+YQ6NGQU35QgwY2K0DpPAThpxL/Cm7uaFqGOy8Kjrhqw== + dependencies: + "@lexical/html" "0.16.0" + "@lexical/link" "0.16.0" + "@lexical/mark" "0.16.0" + "@lexical/table" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/dragon@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/dragon/-/dragon-0.16.0.tgz#de083903701af2bb5264309b565d613c3eec06a0" + integrity sha512-Yr29SFZzOPs+S6UrEZaXnnso1fJGVfZOXVJQZbyzlspqJpSHXVH7InOXYHWN6JSWQ8Hs/vU3ksJXwqz+0TCp2g== + dependencies: + lexical "0.16.0" + +"@lexical/file@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/file/-/file-0.16.0.tgz#747e16b3a107b2a1e399b1c56032432314edae79" + integrity sha512-bwNNj0IRQATElfns+OmvzkcWx4nrg0HeA6W1nut+cIvZ6eECwVcsFdFyo/NDLbkiPJUippgI5B98Dl5Hk7Mizw== + dependencies: + lexical "0.16.0" + +"@lexical/hashtag@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/hashtag/-/hashtag-0.16.0.tgz#ea0187060a114678753adaf0a15aad59d4f49a71" + integrity sha512-2EdAvxYVYqb0nv6vgxCRgE8ip7yez5p0y0oeUyxmdbcfZdA+Jl90gYH3VdevmZ5Bk3wE0/fIqiLD+Bb5smqjCQ== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/history@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/history/-/history-0.16.0.tgz#f83f2e331957208c5c8186d98f2f84681d936cec" + integrity sha512-xwFxgDZGviyGEqHmgt6A6gPhsyU/yzlKRk9TBUVByba3khuTknlJ1a80H5jb+OYcrpiElml7iVuGYt+oC7atCA== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/html@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/html/-/html-0.16.0.tgz#98477ed0dee4c7d910608f4e4de3fbd5eeecdffe" + integrity sha512-okxn3q/1qkUpCZNEFRI39XeJj4YRjb6prm3WqZgP4d39DI1W24feeTZJjYRCW+dc3NInwFaolU3pNA2MGkjRtg== + dependencies: + "@lexical/selection" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/link@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/link/-/link-0.16.0.tgz#f137ab3071206ed3c3a8b8a302ed66b084399ed1" + integrity sha512-ppvJSh/XGqlzbeymOiwcXJcUcrqgQqTK2QXTBAZq7JThtb0WsJxYd2CSLSN+Ycu23prnwqOqILcU0+34+gAVFw== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/list@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/list/-/list-0.16.0.tgz#ed97733633492e89c68ad51a1d455b63ce5aa1c0" + integrity sha512-nBx/DMM7nCgnOzo1JyNnVaIrk/Xi5wIPNi8jixrEV6w9Om2K6dHutn/79Xzp2dQlNGSLHEDjky6N2RyFgmXh0g== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/mark@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/mark/-/mark-0.16.0.tgz#e87d92845c8bd231ef47106c5d44e7e10d2a3934" + integrity sha512-WMR4nqygSgIQ6Vdr5WAzohxBGjH+m44dBNTbWTGZGVlRvPzvBT6tieCoxFqpceIq/ko67HGTCNoFj2cMKVwgIA== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/markdown@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/markdown/-/markdown-0.16.0.tgz#fd2d2759d9d5554d9899c3e1fb30a868bfa162a2" + integrity sha512-7HQLFrBbpY68mcq4A6C1qIGmjgA+fAByditi2WRe7tD2eoIKb/B5baQAnDKis0J+m5kTaCBmdlT6csSzyOPzeQ== + dependencies: + "@lexical/code" "0.16.0" + "@lexical/link" "0.16.0" + "@lexical/list" "0.16.0" + "@lexical/rich-text" "0.16.0" + "@lexical/text" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/offset@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/offset/-/offset-0.16.0.tgz#bb3bc695ed403db0795f095330c68cdc5cbbec4b" + integrity sha512-4TqPEC2qA7sgO8Tm65nOWnhJ8dkl22oeuGv9sUB+nhaiRZnw3R45mDelg23r56CWE8itZnvueE7TKvV+F3OXtQ== + dependencies: + lexical "0.16.0" + +"@lexical/overflow@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/overflow/-/overflow-0.16.0.tgz#31b791f7f7005ea4b160f3ae8083a2b3de05cfdc" + integrity sha512-a7gtIRxleEuMN9dj2yO4CdezBBfIr9Mq+m7G5z62+xy7VL7cfMfF+xWjy3EmDYDXS4vOQgAXAUgO4oKz2AKGhQ== + dependencies: + lexical "0.16.0" + +"@lexical/plain-text@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/plain-text/-/plain-text-0.16.0.tgz#b903bfb59fb6629ded24194e1bef451df3383393" + integrity sha512-BK7/GSOZUHRJTbNPkpb9a/xN9z+FBCdunTsZhnOY8pQ7IKws3kuMO2Tk1zXfTd882ZNAxFdDKNdLYDSeufrKpw== + dependencies: + "@lexical/clipboard" "0.16.0" + "@lexical/selection" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/react@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/react/-/react-0.16.0.tgz#0bd3ae63ceb5ad8b77e8c0e8ba7df1a0369462f0" + integrity sha512-WKFQbI0/m1YkLjL5t90YLJwjGcl5QRe6mkfm3ljQuL7Ioj3F92ZN/J2gHFVJ9iC8/lJs6Zzw6oFjiP8hQxJf9Q== + dependencies: + "@lexical/clipboard" "0.16.0" + "@lexical/code" "0.16.0" + "@lexical/devtools-core" "0.16.0" + "@lexical/dragon" "0.16.0" + "@lexical/hashtag" "0.16.0" + "@lexical/history" "0.16.0" + "@lexical/link" "0.16.0" + "@lexical/list" "0.16.0" + "@lexical/mark" "0.16.0" + "@lexical/markdown" "0.16.0" + "@lexical/overflow" "0.16.0" + "@lexical/plain-text" "0.16.0" + "@lexical/rich-text" "0.16.0" + "@lexical/selection" "0.16.0" + "@lexical/table" "0.16.0" + "@lexical/text" "0.16.0" + "@lexical/utils" "0.16.0" + "@lexical/yjs" "0.16.0" + lexical "0.16.0" + react-error-boundary "^3.1.4" + +"@lexical/rich-text@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/rich-text/-/rich-text-0.16.0.tgz#5b9ea6ceb1ea034fa7adf1770bd7fa6af1571d1d" + integrity sha512-AGTD6yJZ+kj2TNah1r7/6vyufs6fZANeSvv9x5eG+WjV4uyUJYkd1qR8C5gFZHdkyr+bhAcsAXvS039VzAxRrQ== + dependencies: + "@lexical/clipboard" "0.16.0" + "@lexical/selection" "0.16.0" + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/selection@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/selection/-/selection-0.16.0.tgz#8e09edb1e555e79c646a0105beab58ac21fc7158" + integrity sha512-trT9gQVJ2j6AwAe7tHJ30SRuxCpV6yR9LFtggxphHsXSvJYnoHC0CXh1TF2jHl8Gd5OsdWseexGLBE4Y0V3gwQ== + dependencies: + lexical "0.16.0" + +"@lexical/table@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/table/-/table-0.16.0.tgz#68592afbb0f9c0d9bf42bebaae626b8129fc470d" + integrity sha512-A66K779kxdr0yH2RwT2itsMnkzyFLFNPXyiWGLobCH8ON4QPuBouZvjbRHBe8Pe64yJ0c1bRDxSbTqUi9Wt3Gg== + dependencies: + "@lexical/utils" "0.16.0" + lexical "0.16.0" + +"@lexical/text@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/text/-/text-0.16.0.tgz#fc4789591f8aaa4a33bc1814280bc8725fd036a9" + integrity sha512-9ilaOhuNIIGHKC8g8j3K/mEvJ09af9B6RKbm3GNoRcf/WNHD4dEFWNTEvgo/3zCzAS8EUBI6UINmfQQWlMjdIQ== + dependencies: + lexical "0.16.0" + +"@lexical/utils@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/utils/-/utils-0.16.0.tgz#6ad5785c53347aed5b39c980240c09b21c4a7469" + integrity sha512-GWmFEmd7o3GHqJBaEwzuZQbfTNI3Gg8ReGuHMHABgrkhZ8j2NggoRBlxsQLG0f7BewfTMVwbye22yBPq78775w== + dependencies: + "@lexical/list" "0.16.0" + "@lexical/selection" "0.16.0" + "@lexical/table" "0.16.0" + lexical "0.16.0" + +"@lexical/yjs@0.16.0": + version "0.16.0" + resolved "https://registry.npmjs.org/@lexical/yjs/-/yjs-0.16.0.tgz#e27bec25c12e90f7768b980da08f2d2d9919d25b" + integrity sha512-YIJr87DfAXTwoVHDjR7cci//hr4r/a61Nn95eo2JNwbTqQo65Gp8rwJivqVxNfvKZmRdwHTKgvdEDoBmI/tGog== + dependencies: + "@lexical/offset" "0.16.0" + lexical "0.16.0" + "@lit-labs/react@^1.0.2": version "1.0.4" resolved "https://registry.npmjs.org/@lit-labs/react/-/react-1.0.4.tgz#e87a620338955a4e12163b0f3bee18a99c651174" @@ -6192,6 +6400,28 @@ abbrev@1: resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abstract-leveldown@^6.2.1: + version "6.3.0" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" + integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +abstract-leveldown@~6.2.1, abstract-leveldown@~6.2.3: + version "6.2.3" + resolved "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb" + integrity sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + accepts@~1.3.5, accepts@~1.3.7: version "1.3.7" resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" @@ -6687,6 +6917,11 @@ async-each@^1.0.1: resolved "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + async@^2.6.1: version "2.6.3" resolved "https://registry.npmjs.org/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" @@ -7389,7 +7624,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^5.5.0: +buffer@^5.5.0, buffer@^5.6.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -9104,6 +9339,14 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +deferred-leveldown@~5.3.0: + version "5.3.0" + resolved "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" + integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== + dependencies: + abstract-leveldown "~6.2.1" + inherits "^2.0.3" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" @@ -9574,6 +9817,16 @@ encodeurl@~1.0.2: resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= +encoding-down@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" + integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== + dependencies: + abstract-leveldown "^6.2.1" + inherits "^2.0.3" + level-codec "^9.0.0" + level-errors "^2.0.0" + encoding@^0.1.13: version "0.1.13" resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" @@ -9661,7 +9914,7 @@ err-code@^2.0.2: resolved "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== -errno@^0.1.3, errno@~0.1.7: +errno@^0.1.3, errno@~0.1.1, errno@~0.1.7: version "0.1.8" resolved "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" integrity sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A== @@ -11880,6 +12133,11 @@ ignore@^5.1.4, ignore@^5.1.8: resolved "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz#9ec1a5cbe8e1446ec60d4420060d43aa6e7382fb" integrity sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ== +immediate@^3.2.3: + version "3.3.0" + resolved "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" + integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== + immer@8.0.1: version "8.0.1" resolved "https://registry.npmjs.org/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656" @@ -12627,6 +12885,11 @@ isobject@^4.0.0: resolved "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== +isomorphic.js@^0.2.4: + version "0.2.5" + resolved "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz#13eecf36f2dba53e85d355e11bf9d4208c6f7f88" + integrity sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw== + istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" @@ -13525,6 +13788,88 @@ lerna@7.2.0: yargs "16.2.0" yargs-parser "20.2.4" +level-codec@^9.0.0: + version "9.0.2" + resolved "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" + integrity sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ== + dependencies: + buffer "^5.6.0" + +level-concat-iterator@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" + integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== + +level-errors@^2.0.0, level-errors@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" + integrity sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw== + dependencies: + errno "~0.1.1" + +level-iterator-stream@~4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" + integrity sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q== + dependencies: + inherits "^2.0.4" + readable-stream "^3.4.0" + xtend "^4.0.2" + +level-js@^5.0.0: + version "5.0.2" + resolved "https://registry.npmjs.org/level-js/-/level-js-5.0.2.tgz#5e280b8f93abd9ef3a305b13faf0b5397c969b55" + integrity sha512-SnBIDo2pdO5VXh02ZmtAyPP6/+6YTJg2ibLtl9C34pWvmtMEmRTWpra+qO/hifkUtBTOtfx6S9vLDjBsBK4gRg== + dependencies: + abstract-leveldown "~6.2.3" + buffer "^5.5.0" + inherits "^2.0.3" + ltgt "^2.1.2" + +level-packager@^5.1.0: + version "5.1.1" + resolved "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939" + integrity sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ== + dependencies: + encoding-down "^6.3.0" + levelup "^4.3.2" + +level-supports@~1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" + integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== + dependencies: + xtend "^4.0.2" + +level@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/level/-/level-6.0.1.tgz#dc34c5edb81846a6de5079eac15706334b0d7cd6" + integrity sha512-psRSqJZCsC/irNhfHzrVZbmPYXDcEYhA5TVNwr+V92jF44rbf86hqGp8fiT702FyiArScYIlPSBTDUASCVNSpw== + dependencies: + level-js "^5.0.0" + level-packager "^5.1.0" + leveldown "^5.4.0" + +leveldown@^5.4.0: + version "5.6.0" + resolved "https://registry.npmjs.org/leveldown/-/leveldown-5.6.0.tgz#16ba937bb2991c6094e13ac5a6898ee66d3eee98" + integrity sha512-iB8O/7Db9lPaITU1aA2txU/cBEXAt4vWwKQRrrWuS6XDgbP4QZGj9BL2aNbwb002atoQ/lIotJkfyzz+ygQnUQ== + dependencies: + abstract-leveldown "~6.2.1" + napi-macros "~2.0.0" + node-gyp-build "~4.1.0" + +levelup@^4.3.2: + version "4.4.0" + resolved "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6" + integrity sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ== + dependencies: + deferred-leveldown "~5.3.0" + level-errors "~2.0.0" + level-iterator-stream "~4.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + leven@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -13546,6 +13891,18 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lexical@0.16.0: + version "0.16.0" + resolved "https://registry.npmjs.org/lexical/-/lexical-0.16.0.tgz#0515d4003cbfba5a5e0e3e50f32f65076a6b89e2" + integrity sha512-Skn45Qhriazq4fpAtwnAB11U//GKc4vjzx54xsV3TkDLDvWpbL4Z9TNRwRoN3g7w8AkWnqjeOSODKkrjgfRSrg== + +lib0@^0.2.31, lib0@^0.2.52, lib0@^0.2.85, lib0@^0.2.86: + version "0.2.97" + resolved "https://registry.npmjs.org/lib0/-/lib0-0.2.97.tgz#a68d7c88577ac1910cdbe5204bac070f07c8e0b4" + integrity sha512-Q4d1ekgvufi9FiHkkL46AhecfNjznSL9MRNoJRQ76gBHS9OqU2ArfQK0FvBpuxgWeJeNI0LVgAYMIpsGeX4gYg== + dependencies: + isomorphic.js "^0.2.4" + libnpmaccess@7.0.2: version "7.0.2" resolved "https://registry.npmjs.org/libnpmaccess/-/libnpmaccess-7.0.2.tgz#7f056c8c933dd9c8ba771fa6493556b53c5aac52" @@ -13731,6 +14088,11 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -13849,6 +14211,11 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a" integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g== +ltgt@^2.1.2: + version "2.2.1" + resolved "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== + lz-string@^1.4.4: version "1.4.4" resolved "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" @@ -14586,6 +14953,11 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +napi-macros@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" + integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== + native-url@^0.2.6: version "0.2.6" resolved "https://registry.npmjs.org/native-url/-/native-url-0.2.6.tgz#ca1258f5ace169c716ff44eccbddb674e10399ae" @@ -14660,6 +15032,11 @@ node-gyp-build@^4.3.0: resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== +node-gyp-build@~4.1.0: + version "4.1.1" + resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz#d7270b5d86717068d114cc57fff352f96d745feb" + integrity sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ== + node-gyp@^9.0.0: version "9.1.0" resolved "https://registry.npmjs.org/node-gyp/-/node-gyp-9.1.0.tgz#c8d8e590678ea1f7b8097511dedf41fc126648f8" @@ -16275,6 +16652,11 @@ prismjs@^1.21.0, prismjs@~1.23.0: optionalDependencies: clipboard "^2.0.0" +prismjs@^1.27.0: + version "1.29.0" + resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" + integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== + proc-log@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz#fb05ef83ccd64fd7b20bbe9c8c1070fc08338dd8" @@ -16658,6 +17040,13 @@ react-error-boundary@^3.1.0: dependencies: "@babel/runtime" "^7.12.5" +react-error-boundary@^3.1.4: + version "3.1.4" + resolved "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.4.tgz#255db92b23197108757a888b01e5b729919abde0" + integrity sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA== + dependencies: + "@babel/runtime" "^7.12.5" + react-error-overlay@^6.0.9: version "6.0.9" resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" @@ -18383,7 +18772,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18409,6 +18798,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" @@ -18520,7 +18918,7 @@ stringify-entities@^3.0.0: character-entities-legacy "^1.0.0" xtend "^4.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -18555,6 +18953,13 @@ strip-ansi@^5.1.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -20123,7 +20528,7 @@ worker-rpc@^0.1.0: dependencies: microevent.ts "~0.1.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20141,6 +20546,15 @@ wrap-ansi@^6.0.1: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -20211,6 +20625,13 @@ write-pkg@4.0.0: type-fest "^0.4.1" write-json-file "^3.2.0" +ws@^6.2.1: + version "6.2.3" + resolved "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz#ccc96e4add5fd6fedbc491903075c85c5a11d9ee" + integrity sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA== + dependencies: + async-limiter "~1.0.0" + ws@^8.11.0: version "8.14.0" resolved "https://registry.npmjs.org/ws/-/ws-8.14.0.tgz#6c5792c5316dc9266ba8e780433fc45e6680aecd" @@ -20236,11 +20657,38 @@ xmlchars@^2.2.0: resolved "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== -xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: +xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +y-leveldb@^0.1.0: + version "0.1.2" + resolved "https://registry.npmjs.org/y-leveldb/-/y-leveldb-0.1.2.tgz#43f6c5004b6891b57926d8a1e0eb0c883003e34b" + integrity sha512-6ulEn5AXfXJYi89rXPEg2mMHAyyw8+ZfeMMdOtBbV8FJpQ1NOrcgi6DTAcXof0dap84NjHPT2+9d0rb6cFsjEg== + dependencies: + level "^6.0.1" + lib0 "^0.2.31" + +y-protocols@^1.0.5: + version "1.0.6" + resolved "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.6.tgz#66dad8a95752623443e8e28c0e923682d2c0d495" + integrity sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q== + dependencies: + lib0 "^0.2.85" + +y-websocket@^2.0.4: + version "2.0.4" + resolved "https://registry.npmjs.org/y-websocket/-/y-websocket-2.0.4.tgz#7f4072f06229629ed625d1eb4c7cad3a559f0db4" + integrity sha512-UbrkOU4GPNFFTDlJYAxAmzZhia8EPxHkngZ6qjrxgIYCN3gI2l+zzLzA9p4LQJ0IswzpioeIgmzekWe7HoBBjg== + dependencies: + lib0 "^0.2.52" + lodash.debounce "^4.0.8" + y-protocols "^1.0.5" + optionalDependencies: + ws "^6.2.1" + y-leveldb "^0.1.0" + y18n@^4.0.0: version "4.0.3" resolved "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" @@ -20343,6 +20791,13 @@ yargs@^17.6.2: y18n "^5.0.5" yargs-parser "^21.1.1" +yjs@^13.6.19: + version "13.6.19" + resolved "https://registry.npmjs.org/yjs/-/yjs-13.6.19.tgz#66999f41254ab65be8c8e71bd767d124ad600909" + integrity sha512-GNKw4mEUn5yWU2QPHRx8jppxmCm9KzbBhB4qJLUJFiiYD0g/tDVgXQ7aPkyh01YO28kbs2J/BEbWBagjuWyejw== + dependencies: + lib0 "^0.2.86" + yn@3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" From 45fd00a843efe21b1528731403cca84c247b82ae Mon Sep 17 00:00:00 2001 From: Kukollu Date: Wed, 25 Sep 2024 00:07:34 +0530 Subject: [PATCH 2/8] lexical editor changes --- packages/gamut/src/LexicalEditor/Editor.tsx | 218 ++ .../gamut/src/LexicalEditor/LexicalEditor.tsx | 192 ++ packages/gamut/src/LexicalEditor/Settings.tsx | 168 ++ .../gamut/src/LexicalEditor/appSettings.ts | 40 + .../gamut/src/LexicalEditor/collaboration.ts | 43 + .../src/LexicalEditor/commenting/index.ts | 451 +++++ .../context/FlashMessageContext.tsx | 68 + .../LexicalEditor/context/SettingsContext.tsx | 71 + .../context/SharedAutocompleteContext.tsx | 71 + .../context/SharedHistoryContext.tsx | 35 + .../LexicalEditor/hooks/useFlashMessage.tsx | 16 + .../src/LexicalEditor/hooks/useModal.tsx | 60 + .../src/LexicalEditor/hooks/useReport.ts | 67 + .../src/LexicalEditor/images/cat-typing.gif | Bin 0 -> 1165927 bytes .../src/LexicalEditor/images/image-broken.svg | 4 + .../src/LexicalEditor/images/landscape.jpg | Bin 0 -> 429853 bytes packages/gamut/src/LexicalEditor/index.scss | 1771 +++++++++++++++++ packages/gamut/src/LexicalEditor/index.tsx | 2 + packages/gamut/src/LexicalEditor/setupEnv.ts | 34 + packages/gamut/src/index.tsx | 1 + 20 files changed, 3312 insertions(+) create mode 100644 packages/gamut/src/LexicalEditor/Editor.tsx create mode 100644 packages/gamut/src/LexicalEditor/LexicalEditor.tsx create mode 100644 packages/gamut/src/LexicalEditor/Settings.tsx create mode 100644 packages/gamut/src/LexicalEditor/appSettings.ts create mode 100644 packages/gamut/src/LexicalEditor/collaboration.ts create mode 100644 packages/gamut/src/LexicalEditor/commenting/index.ts create mode 100644 packages/gamut/src/LexicalEditor/context/FlashMessageContext.tsx create mode 100644 packages/gamut/src/LexicalEditor/context/SettingsContext.tsx create mode 100644 packages/gamut/src/LexicalEditor/context/SharedAutocompleteContext.tsx create mode 100644 packages/gamut/src/LexicalEditor/context/SharedHistoryContext.tsx create mode 100644 packages/gamut/src/LexicalEditor/hooks/useFlashMessage.tsx create mode 100644 packages/gamut/src/LexicalEditor/hooks/useModal.tsx create mode 100644 packages/gamut/src/LexicalEditor/hooks/useReport.ts create mode 100644 packages/gamut/src/LexicalEditor/images/cat-typing.gif create mode 100644 packages/gamut/src/LexicalEditor/images/image-broken.svg create mode 100644 packages/gamut/src/LexicalEditor/images/landscape.jpg create mode 100644 packages/gamut/src/LexicalEditor/index.scss create mode 100644 packages/gamut/src/LexicalEditor/index.tsx create mode 100644 packages/gamut/src/LexicalEditor/setupEnv.ts diff --git a/packages/gamut/src/LexicalEditor/Editor.tsx b/packages/gamut/src/LexicalEditor/Editor.tsx new file mode 100644 index 0000000000..920338888b --- /dev/null +++ b/packages/gamut/src/LexicalEditor/Editor.tsx @@ -0,0 +1,218 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +import {AutoFocusPlugin} from '@lexical/react/LexicalAutoFocusPlugin'; +import {CharacterLimitPlugin} from '@lexical/react/LexicalCharacterLimitPlugin'; +import {CheckListPlugin} from '@lexical/react/LexicalCheckListPlugin'; +import {ClearEditorPlugin} from '@lexical/react/LexicalClearEditorPlugin'; +import {ClickableLinkPlugin} from '@lexical/react/LexicalClickableLinkPlugin'; +// import {CollaborationPlugin} from '@lexical/react/LexicalCollaborationPlugin'; +import {LexicalErrorBoundary} from '@lexical/react/LexicalErrorBoundary'; +import {HashtagPlugin} from '@lexical/react/LexicalHashtagPlugin'; +import {HistoryPlugin} from '@lexical/react/LexicalHistoryPlugin'; +import {HorizontalRulePlugin} from '@lexical/react/LexicalHorizontalRulePlugin'; +import {ListPlugin} from '@lexical/react/LexicalListPlugin'; +import {PlainTextPlugin} from '@lexical/react/LexicalPlainTextPlugin'; +import {RichTextPlugin} from '@lexical/react/LexicalRichTextPlugin'; +import {TabIndentationPlugin} from '@lexical/react/LexicalTabIndentationPlugin'; +import {TablePlugin} from '@lexical/react/LexicalTablePlugin'; +import {useLexicalEditable} from '@lexical/react/useLexicalEditable'; +import * as React from 'react'; +import {useEffect, useState} from 'react'; +// import {CAN_USE_DOM} from './shared/canUseDOM'; + +// import {createWebsocketProvider} from './collaboration'; +import {useSettings} from './context/SettingsContext'; +import {useSharedHistoryContext} from './context/SharedHistoryContext'; +// import ActionsPlugin from './plugins/ActionsPlugin'; +import AutocompletePlugin from './plugins/AutocompletePlugin'; +// import AutoEmbedPlugin from './plugins/AutoEmbedPlugin'; +import AutoLinkPlugin from './plugins/AutoLinkPlugin'; +// import CodeActionMenuPlugin from './plugins/CodeActionMenuPlugin'; +import CodeHighlightPlugin from './plugins/CodeHighlightPlugin'; +import ComponentPickerPlugin from './plugins/ComponentPickerPlugin'; +import ContextMenuPlugin from './plugins/ContextMenuPlugin'; +import FloatingLinkEditorPlugin from './plugins/FloatingLinkEditorPlugin'; +import FloatingTextFormatToolbarPlugin from './plugins/FloatingTextFormatToolbarPlugin'; +import ImagesPlugin from './plugins/ImagesPlugin'; +import KeywordsPlugin from './plugins/KeywordsPlugin'; +import {LayoutPlugin} from './plugins/LayoutPlugin/LayoutPlugin'; +import LinkPlugin from './plugins/LinkPlugin'; +import ListMaxIndentLevelPlugin from './plugins/ListMaxIndentLevelPlugin'; +import MarkdownShortcutPlugin from './plugins/MarkdownShortcutPlugin'; +import {MaxLengthPlugin} from './plugins/MaxLengthPlugin'; +import MentionsPlugin from './plugins/MentionsPlugin'; +import TabFocusPlugin from './plugins/TabFocusPlugin'; +import TableCellActionMenuPlugin from './plugins/TableActionMenuPlugin'; +import TableCellResizer from './plugins/TableCellResizer'; +import TableOfContentsPlugin from './plugins/TableOfContentsPlugin'; +import ToolbarPlugin from './plugins/ToolbarPlugin'; +import TreeViewPlugin from './plugins/TreeViewPlugin'; +import ContentEditable from './ui/ContentEditable'; +import Placeholder from './ui/Placeholder'; + +const skipCollaborationInit = + // @ts-expect-error + window.parent != null && window.parent.frames.right === window; + +export default function Editor(): JSX.Element { + const {historyState} = useSharedHistoryContext(); + const { + settings: { + isCollab, + isAutocomplete, + isMaxLength, + isCharLimit, + isCharLimitUtf8, + isRichText, + showTreeView, + showTableOfContents, + shouldUseLexicalContextMenu, + shouldPreserveNewLinesInMarkdown, + tableCellMerge, + tableCellBackgroundColor, + }, + } = useSettings(); + const isEditable = useLexicalEditable(); + const text = isCollab + ? 'Enter some collaborative rich text...' + : isRichText + ? 'Enter some rich text...' + : 'Enter some plain text...'; + const placeholder = {text}; + const [floatingAnchorElem, setFloatingAnchorElem] = + useState(null); + const [isSmallWidthViewport, setIsSmallWidthViewport] = + useState(false); + const [isLinkEditMode, setIsLinkEditMode] = useState(false); + + const onRef = (_floatingAnchorElem: HTMLDivElement) => { + if (_floatingAnchorElem !== null) { + setFloatingAnchorElem(_floatingAnchorElem); + } + }; + + useEffect(() => { + const updateViewPortWidth = () => { + // const isNextSmallWidthViewport = + // CAN_USE_DOM && window.matchMedia('(max-width: 1025px)').matches; + + // if (isNextSmallWidthViewport !== isSmallWidthViewport) { + // setIsSmallWidthViewport(isNextSmallWidthViewport); + // } + }; + updateViewPortWidth(); + window.addEventListener('resize', updateViewPortWidth); + + return () => { + window.removeEventListener('resize', updateViewPortWidth); + }; + }, [isSmallWidthViewport]); + + return ( + <> + {isRichText && } +
+ {isMaxLength && } + + + + {/* */} + + + + + + {isRichText ? ( + <> + {/* {isCollab ? ( + // + ) : ( + + )} */} + +
+ +
+
+ } + placeholder={placeholder} + ErrorBoundary={LexicalErrorBoundary} + /> + + + + + + + + + + + + + + {floatingAnchorElem && !isSmallWidthViewport && ( + <> + {/* */} + + + + + )} + + ) : ( + <> + } + placeholder={placeholder} + ErrorBoundary={LexicalErrorBoundary} + /> + + + )} + {(isCharLimit || isCharLimitUtf8) && ( + + )} + {isAutocomplete && } +
{showTableOfContents && }
+ {shouldUseLexicalContextMenu && } + {/* */} + + {showTreeView && } + + ); +} diff --git a/packages/gamut/src/LexicalEditor/LexicalEditor.tsx b/packages/gamut/src/LexicalEditor/LexicalEditor.tsx new file mode 100644 index 0000000000..71a909e560 --- /dev/null +++ b/packages/gamut/src/LexicalEditor/LexicalEditor.tsx @@ -0,0 +1,192 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +import {$createLinkNode} from '@lexical/link'; +import {$createListItemNode, $createListNode} from '@lexical/list'; +import {LexicalComposer} from '@lexical/react/LexicalComposer'; +import {$createHeadingNode, $createQuoteNode} from '@lexical/rich-text'; +import {$createParagraphNode, $createTextNode, $getRoot} from 'lexical'; + +import {FlashMessageContext} from './context/FlashMessageContext'; +import {SettingsContext, useSettings} from './context/SettingsContext'; +import {SharedAutocompleteContext} from './context/SharedAutocompleteContext'; +import {SharedHistoryContext} from './context/SharedHistoryContext'; +import Editor from './Editor'; +import logo from './images/logo.svg'; +import PlaygroundNodes from './nodes/PlaygroundNodes'; +import {TableContext} from './plugins/TablePlugin'; +import Settings from './Settings'; +import PlaygroundEditorTheme from './themes/PlaygroundEditorTheme'; + +console.warn( + 'If you are profiling the playground app, please ensure you turn off the debug view. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.', +); + +function $prepopulatedRichText() { + const root = $getRoot(); + if (root.getFirstChild() === null) { + const heading = $createHeadingNode('h1'); + heading.append($createTextNode('Welcome to the playground')); + root.append(heading); + const quote = $createQuoteNode(); + quote.append( + $createTextNode( + `In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. ` + + `You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.`, + ), + ); + root.append(quote); + const paragraph = $createParagraphNode(); + paragraph.append( + $createTextNode('The playground is a demo environment built with '), + $createTextNode('@lexical/react').toggleFormat('code'), + $createTextNode('.'), + $createTextNode(' Try typing in '), + $createTextNode('some text').toggleFormat('bold'), + $createTextNode(' with '), + $createTextNode('different').toggleFormat('italic'), + $createTextNode(' formats.'), + ); + root.append(paragraph); + const paragraph2 = $createParagraphNode(); + paragraph2.append( + $createTextNode( + 'Make sure to check out the various plugins in the toolbar. You can also use #hashtags or @-mentions too!', + ), + ); + root.append(paragraph2); + const paragraph3 = $createParagraphNode(); + paragraph3.append( + $createTextNode(`If you'd like to find out more about Lexical, you can:`), + ); + root.append(paragraph3); + const list = $createListNode('bullet'); + list.append( + $createListItemNode().append( + $createTextNode(`Visit the `), + $createLinkNode('https://lexical.dev/').append( + $createTextNode('Lexical website'), + ), + $createTextNode(` for documentation and more information.`), + ), + $createListItemNode().append( + $createTextNode(`Check out the code on our `), + $createLinkNode('https://github.com/facebook/lexical').append( + $createTextNode('GitHub repository'), + ), + $createTextNode(`.`), + ), + $createListItemNode().append( + $createTextNode(`Playground code can be found `), + $createLinkNode( + 'https://github.com/facebook/lexical/tree/main/packages/lexical-playground', + ).append($createTextNode('here')), + $createTextNode(`.`), + ), + $createListItemNode().append( + $createTextNode(`Join our `), + $createLinkNode('https://discord.com/invite/KmG4wQnnD9').append( + $createTextNode('Discord Server'), + ), + $createTextNode(` and chat with the team.`), + ), + ); + root.append(list); + const paragraph4 = $createParagraphNode(); + paragraph4.append( + $createTextNode( + `Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance :).`, + ), + ); + root.append(paragraph4); + } +} + +function App(): JSX.Element { + const { + settings: {isCollab, emptyEditor, measureTypingPerf}, + } = useSettings(); + + const initialConfig = { + editorState: isCollab + ? null + : emptyEditor + ? undefined + : $prepopulatedRichText, + namespace: 'Playground', + nodes: [...PlaygroundNodes], + onError: (error: Error) => { + throw error; + }, + theme: PlaygroundEditorTheme, + }; + + return ( + + + + +
+ + Lexical Logo + +
+
+ +
+ +
+
+
+
+ ); +} + +export function PlaygroundApp(): JSX.Element { + return ( + + + + + + + + + ); +} \ No newline at end of file diff --git a/packages/gamut/src/LexicalEditor/Settings.tsx b/packages/gamut/src/LexicalEditor/Settings.tsx new file mode 100644 index 0000000000..a8e622dc6b --- /dev/null +++ b/packages/gamut/src/LexicalEditor/Settings.tsx @@ -0,0 +1,168 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +import {CAN_USE_BEFORE_INPUT} from '@lexical/utils'; +import {useEffect, useMemo, useState} from 'react'; + +import {INITIAL_SETTINGS, isDevPlayground} from './appSettings'; +import {useSettings} from './context/SettingsContext'; +import Switch from './ui/Switch'; + +export default function Settings(): JSX.Element { + const windowLocation = window.location; + const { + setOption, + settings: { + measureTypingPerf, + isCollab, + isRichText, + isMaxLength, + isCharLimit, + isCharLimitUtf8, + isAutocomplete, + showTreeView, + showNestedEditorTreeView, + disableBeforeInput, + showTableOfContents, + shouldUseLexicalContextMenu, + shouldPreserveNewLinesInMarkdown, + }, + } = useSettings(); + useEffect(() => { + if (INITIAL_SETTINGS.disableBeforeInput && CAN_USE_BEFORE_INPUT) { + console.error( + `Legacy events are enabled (disableBeforeInput) but CAN_USE_BEFORE_INPUT is true`, + ); + } + }, []); + const [showSettings, setShowSettings] = useState(false); + const [isSplitScreen, search] = useMemo(() => { + const parentWindow = window.parent; + const _search = windowLocation.search; + const _isSplitScreen = + parentWindow && parentWindow.location.pathname === '/split/'; + return [_isSplitScreen, _search]; + }, [windowLocation]); + + return ( + <> +