diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c811125d0c0..4bb42d6c6e34 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -352,14 +352,14 @@ importers: specifier: ^0.26.9 version: 0.26.9(react-dom@18.2.0)(react@18.2.0) '@lexical/code': - specifier: ^0.13.1 - version: 0.13.1(lexical@0.13.1) + specifier: ^0.15.0 + version: 0.15.0 '@lexical/html': - specifier: ^0.13.1 - version: 0.13.1(lexical@0.13.1) + specifier: ^0.15.0 + version: 0.15.0 '@lexical/react': - specifier: ^0.13.1 - version: 0.13.1(lexical@0.13.1)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.15) + specifier: ^0.15.0 + version: 0.15.0(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.15) '@mdi/js': specifier: ^7.2.96 version: 7.2.96 @@ -484,8 +484,8 @@ importers: specifier: ^1.1.6 version: 1.1.6 lexical: - specifier: ^0.13.1 - version: 0.13.1 + specifier: ^0.15.0 + version: 0.15.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -2880,163 +2880,147 @@ packages: - supports-color dev: true - /@lexical/clipboard@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-gMSbVeqb7S+XAi/EMMlwl+FCurLPugN2jAXcp5k5ZaUd7be8B+iupbYdoKkjt4qBhxmvmfe9k46GoC0QOPl/nw==} - peerDependencies: - lexical: 0.13.1 + /@lexical/clipboard@0.15.0: + resolution: {integrity: sha512-binCltK7KiURQJFogvueYfmDNEKynN/lmZrCLFp2xBjEIajqw4WtOVLJZ33engdqNlvj0JqrxrWxbKG+yvUwrg==} dependencies: - '@lexical/html': 0.13.1(lexical@0.13.1) - '@lexical/list': 0.13.1(lexical@0.13.1) - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/html': 0.15.0 + '@lexical/list': 0.15.0 + '@lexical/selection': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/code@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-QK77r3QgEtJy96ahYXNgpve8EY64BQgBSnPDOuqVrLdl92nPzjqzlsko2OZldlrt7gjXcfl9nqfhZ/CAhStfOg==} - peerDependencies: - lexical: 0.13.1 + /@lexical/code@0.15.0: + resolution: {integrity: sha512-n185gjinGhz/M4BW1ayNPYAEgwW4T/NEFl2Wey/O+07W3zvh9k9ai7RjWd0c8Qzqc4DLlqvibvWPebWObQHA4w==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 prismjs: 1.29.0 dev: false - /@lexical/dragon@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-aNlqfif4//jW7gOxbBgdrbDovU6m3EwQrUw+Y/vqRkY+sWmloyAUeNwCPH1QP3Q5cvfolzOeN5igfBljsFr+1g==} + /@lexical/devtools-core@0.15.0(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-kK/IVEiQyqs2DsY4QRYFaFiKQMpaAukAl8PXmNeGTZ7cfFVsP29E4n0/pjY+oxmiRvxbO1s2i14q58nfuhj4VQ==} peerDependencies: - lexical: 0.13.1 + react: '>=17.x' + react-dom: '>=17.x' dependencies: - lexical: 0.13.1 + '@lexical/html': 0.15.0 + '@lexical/link': 0.15.0 + '@lexical/mark': 0.15.0 + '@lexical/table': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) dev: false - /@lexical/hashtag@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-Dl0dUG4ZXNjYYuAUR0GMGpLGsA+cps2/ln3xEmy28bZR0sKkjXugsu2QOIxZjYIPBewDrXzPcvK8md45cMYoSg==} - peerDependencies: - lexical: 0.13.1 + /@lexical/dragon@0.15.0: + resolution: {integrity: sha512-hg2rGmxVJF7wmN6psuKw3EyhcNF7DtOYwUCBpjFZVshzAjsNEBfEnqhiMkSVSlN4+WOfM7LS+B88PTKPcnFGbQ==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + lexical: 0.15.0 dev: false - /@lexical/history@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-cZXt30MalEEiRaflE9tHeGYnwT1xSDjXLsf9M409DSU9POJyZ1fsULJrG1tWv2uFQOhwal33rve9+MatUlITrg==} - peerDependencies: - lexical: 0.13.1 + /@lexical/hashtag@0.15.0: + resolution: {integrity: sha512-EP6KKvS6BY/8Vh1MLQYeOcYaxnvrLsUkvXXr+Fg8N477Us54Ju69pPO563mbWt7/bpnL9Sh0fbk82JtxqPWpSg==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/html@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-XkZrnCSHIUavtpMol6aG8YsJ5KqC9hMxEhAENf3HTGi3ocysCByyXOyt1EhEYpjJvgDG4wRqt25xGDbLjj1/sA==} - peerDependencies: - lexical: 0.13.1 + /@lexical/history@0.15.0: + resolution: {integrity: sha512-r+pzR2k/51AL6l8UfXeVe/GWPIeWY1kEOuKx9nsYB9tmAkTF66tTFz33DJIMWBVtAHWN7Dcdv0/yy6q8R6CAUQ==} dependencies: - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/link@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-7E3B2juL2UoMj2n+CiyFZ7tlpsdViAoIE7MpegXwfe/VQ66wFwk/VxGTa/69ng2EoF7E0kh+SldvGQDrWAWb1g==} - peerDependencies: - lexical: 0.13.1 + /@lexical/html@0.15.0: + resolution: {integrity: sha512-x/sfGvibwo8b5Vso4ppqNyS/fVve6Rn+TmvP/0eWOaa0I3aOQ57ulfcK6p/GTe+ZaEi8vW64oZPdi8XDgwSRaA==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/selection': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/list@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-6U1pmNZcKLuOWiWRML8Raf9zSEuUCMlsOye82niyF6I0rpPgYo5UFghAAbGISDsyqzM1B2L4BgJ6XrCk/dJptg==} - peerDependencies: - lexical: 0.13.1 + /@lexical/link@0.15.0: + resolution: {integrity: sha512-KBV/zWk5FxqZGNcq3IKGBDCcS4t0uteU1osAIG+pefo4waTkOOgibxxEJDop2QR5wtjkYva3Qp0D8ZyJDMMMlw==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/mark@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-dW27PW8wWDOKFqXTBUuUfV+umU0KfwvXGkPUAxRJrvwUWk5RKaS48LhgbNlQ5BfT84Q8dSiQzvbaa6T40t9a3A==} - peerDependencies: - lexical: 0.13.1 + /@lexical/list@0.15.0: + resolution: {integrity: sha512-JuF4k7uo4rZFOSZGrmkxo1+sUrwTKNBhhJAiCgtM+6TO90jppxzCFNKur81yPzF1+g4GWLC9gbjzKb52QPb6cQ==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/markdown@0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(lexical@0.13.1): - resolution: {integrity: sha512-6tbdme2h5Zy/M88loVQVH5G0Nt7VMR9UUkyiSaicyBRDOU2OHacaXEp+KSS/XuF+d7TA+v/SzyDq8HS77cO1wA==} - peerDependencies: - lexical: 0.13.1 + /@lexical/mark@0.15.0: + resolution: {integrity: sha512-cdePA98sOJRc4/HHqcOcPBFq4UDwzaFJOK1N1E6XUGcXH1GU8zHtV1ElTgmbsGkyjBRwhR+OqKm9eso1PBOUkg==} dependencies: - '@lexical/code': 0.13.1(lexical@0.13.1) - '@lexical/link': 0.13.1(lexical@0.13.1) - '@lexical/list': 0.13.1(lexical@0.13.1) - '@lexical/rich-text': 0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(@lexical/utils@0.13.1)(lexical@0.13.1) - '@lexical/text': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 - transitivePeerDependencies: - - '@lexical/clipboard' - - '@lexical/selection' + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/offset@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-j/RZcztJ7dyTrfA2+C3yXDzWDXV+XmMpD5BYeQCEApaHvlo20PHt1BISk7RcrnQW8PdzGvpKblRWf//c08LS9w==} - peerDependencies: - lexical: 0.13.1 + /@lexical/markdown@0.15.0: + resolution: {integrity: sha512-wu1EP758l452BovDa7i9ZAeWuFj+YY0bc2mNc08nfZ9GqdGMej1JIguY4CwIROCYVizprL9Ocn0avH1uv9b8fA==} dependencies: - lexical: 0.13.1 + '@lexical/code': 0.15.0 + '@lexical/link': 0.15.0 + '@lexical/list': 0.15.0 + '@lexical/rich-text': 0.15.0 + '@lexical/text': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/overflow@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-Uw34j+qG2UJRCIR+bykfFMduFk7Pc4r/kNt8N1rjxGuGXAsreTVch1iOhu7Ev6tJgkURsduKuaJCAi7iHnKl7g==} - peerDependencies: - lexical: 0.13.1 + /@lexical/offset@0.15.0: + resolution: {integrity: sha512-VO1f3m8+RRdRjuXMtCBhi1COVKRC2LhP8AFYxnFlvbV+Waz9R5xB9pqFFUe4RtyqyTLmOUj6+LtsUFhq+23voQ==} dependencies: - lexical: 0.13.1 + lexical: 0.15.0 dev: false - /@lexical/plain-text@0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(@lexical/utils@0.13.1)(lexical@0.13.1): - resolution: {integrity: sha512-4j5KAsMKUvJ8LhVDSS4zczbYXzdfmgYSAVhmqpSnJtud425Nk0TAfpUBLFoivxZB7KMoT1LGWQZvd47IvJPvtA==} - peerDependencies: - '@lexical/clipboard': 0.13.1 - '@lexical/selection': 0.13.1 - '@lexical/utils': 0.13.1 - lexical: 0.13.1 + /@lexical/overflow@0.15.0: + resolution: {integrity: sha512-9qKVCvh9Oka+bzR3th+UWdTEeMZXYy1ZxWbjSxefRMgQxzCvqSuVioK/065gPbvGga9EfvgLLLBDXZm8ISbJQA==} + dependencies: + lexical: 0.15.0 + dev: false + + /@lexical/plain-text@0.15.0: + resolution: {integrity: sha512-yeK466mXb4xaCCJouGzEHQs59fScHxF8Asq0azNyJmkhQWYrU7WdckHf2xj8ItZFFPyj7lvwKRDYnoy4HQD7Mg==} dependencies: - '@lexical/clipboard': 0.13.1(lexical@0.13.1) - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/clipboard': 0.15.0 + '@lexical/selection': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/react@0.13.1(lexical@0.13.1)(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.15): - resolution: {integrity: sha512-Sy6EL230KAb0RZsZf1dZrRrc3+rvCDQWltcd8C/cqBUYlxsLYCW9s4f3RB2werngD/PtLYbBB48SYXNkIALITA==} + /@lexical/react@0.15.0(react-dom@18.2.0)(react@18.2.0)(yjs@13.6.15): + resolution: {integrity: sha512-TWDp/F9cKwjGreLzIdHKlPUeTn275rR6j1VXrBffNwC5ovxWcKLVRg502eY5xvRQH3lkKQpFgIFbJW4KTvhFsQ==} peerDependencies: - lexical: 0.13.1 react: '>=17.x' react-dom: '>=17.x' dependencies: - '@lexical/clipboard': 0.13.1(lexical@0.13.1) - '@lexical/code': 0.13.1(lexical@0.13.1) - '@lexical/dragon': 0.13.1(lexical@0.13.1) - '@lexical/hashtag': 0.13.1(lexical@0.13.1) - '@lexical/history': 0.13.1(lexical@0.13.1) - '@lexical/link': 0.13.1(lexical@0.13.1) - '@lexical/list': 0.13.1(lexical@0.13.1) - '@lexical/mark': 0.13.1(lexical@0.13.1) - '@lexical/markdown': 0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(lexical@0.13.1) - '@lexical/overflow': 0.13.1(lexical@0.13.1) - '@lexical/plain-text': 0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(@lexical/utils@0.13.1)(lexical@0.13.1) - '@lexical/rich-text': 0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(@lexical/utils@0.13.1)(lexical@0.13.1) - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/table': 0.13.1(lexical@0.13.1) - '@lexical/text': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - '@lexical/yjs': 0.13.1(lexical@0.13.1)(yjs@13.6.15) - lexical: 0.13.1 + '@lexical/clipboard': 0.15.0 + '@lexical/code': 0.15.0 + '@lexical/devtools-core': 0.15.0(react-dom@18.2.0)(react@18.2.0) + '@lexical/dragon': 0.15.0 + '@lexical/hashtag': 0.15.0 + '@lexical/history': 0.15.0 + '@lexical/link': 0.15.0 + '@lexical/list': 0.15.0 + '@lexical/mark': 0.15.0 + '@lexical/markdown': 0.15.0 + '@lexical/overflow': 0.15.0 + '@lexical/plain-text': 0.15.0 + '@lexical/rich-text': 0.15.0 + '@lexical/selection': 0.15.0 + '@lexical/table': 0.15.0 + '@lexical/text': 0.15.0 + '@lexical/utils': 0.15.0 + '@lexical/yjs': 0.15.0(yjs@13.6.15) + lexical: 0.15.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-error-boundary: 3.1.4(react@18.2.0) @@ -3044,64 +3028,50 @@ packages: - yjs dev: false - /@lexical/rich-text@0.13.1(@lexical/clipboard@0.13.1)(@lexical/selection@0.13.1)(@lexical/utils@0.13.1)(lexical@0.13.1): - resolution: {integrity: sha512-HliB9Ync06mv9DBg/5j0lIsTJp+exLHlaLJe+n8Zq1QNTzZzu2LsIT/Crquk50In7K/cjtlaQ/d5RB0LkjMHYg==} - peerDependencies: - '@lexical/clipboard': 0.13.1 - '@lexical/selection': 0.13.1 - '@lexical/utils': 0.13.1 - lexical: 0.13.1 + /@lexical/rich-text@0.15.0: + resolution: {integrity: sha512-76tXh/eeEOHl91HpFEXCc/tUiLrsa9RcSyvCzRZahk5zqYvQPXma/AUfRzuSMf2kLwDEoauKAVqNFQcbPhqwpQ==} dependencies: - '@lexical/clipboard': 0.13.1(lexical@0.13.1) - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/clipboard': 0.15.0 + '@lexical/selection': 0.15.0 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/selection@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-Kt9eSwjxPznj7yzIYipu9yYEgmRJhHiq3DNxHRxInYcZJWWNNHum2xKyxwwcN8QYBBzgfPegfM/geqQEJSV1lQ==} - peerDependencies: - lexical: 0.13.1 + /@lexical/selection@0.15.0: + resolution: {integrity: sha512-S+AQC6eJiQYSa5zOPuecN85prCT0Bcb8miOdJaE17Zh+vgdUH5gk9I0tEBeG5T7tkSpq6lFiEqs2FZSfaHflbQ==} dependencies: - lexical: 0.13.1 + lexical: 0.15.0 dev: false - /@lexical/table@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-VQzgkfkEmnvn6C64O/kvl0HI3bFoBh3WA/U67ALw+DS11Mb5CKjbt0Gzm/258/reIxNMpshjjicpWMv9Miwauw==} - peerDependencies: - lexical: 0.13.1 + /@lexical/table@0.15.0: + resolution: {integrity: sha512-3IRBg8IoIHetqKozRQbJQ2aPyG0ziXZ+lc8TOIAGs6METW/wxntaV+rTNrODanKAgvk2iJTIyfFkYjsqS9+VFg==} dependencies: - '@lexical/utils': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/utils': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/text@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-NYy3TZKt3qzReDwN2Rr5RxyFlg84JjXP2JQGMrXSSN7wYe73ysQIU6PqdVrz4iZkP+w34F3pl55dJ24ei3An9w==} - peerDependencies: - lexical: 0.13.1 + /@lexical/text@0.15.0: + resolution: {integrity: sha512-WsAkAt9T1RH1iDrVuWeoRUeMCOAWar5oSFtnQ4m9vhT/zuf5b8efK87GiqCH00ZAn4DGzOuAfyXlMFqBVCQdkQ==} dependencies: - lexical: 0.13.1 + lexical: 0.15.0 dev: false - /@lexical/utils@0.13.1(lexical@0.13.1): - resolution: {integrity: sha512-AtQQKzYymkbOaQxaBXjRBS8IPxF9zWQnqwHTUTrJqJ4hX71aIQd/thqZbfQETAFJfC8pNBZw5zpxN6yPHk23dQ==} - peerDependencies: - lexical: 0.13.1 + /@lexical/utils@0.15.0: + resolution: {integrity: sha512-/6954LDmTcVFgexhy5WOZDa4TxNQOEZNrf8z7TRAFiAQkihcME/GRoq1en5cbXoVNF8jv5AvNyyc7x0MByRJ6A==} dependencies: - '@lexical/list': 0.13.1(lexical@0.13.1) - '@lexical/selection': 0.13.1(lexical@0.13.1) - '@lexical/table': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/list': 0.15.0 + '@lexical/selection': 0.15.0 + '@lexical/table': 0.15.0 + lexical: 0.15.0 dev: false - /@lexical/yjs@0.13.1(lexical@0.13.1)(yjs@13.6.15): - resolution: {integrity: sha512-4GbqQM+PwNTV59AZoNrfTe/0rLjs+cX6Y6yAdZSRPBwr5L3JzYeU1TTcFCVQTtsE7KF8ddVP8sD7w9pi8rOWLA==} + /@lexical/yjs@0.15.0(yjs@13.6.15): + resolution: {integrity: sha512-Rf4AIu620Cq90li6GU58gkzlGRdntHP4ZeZrbJ3ToW7vEEnkW6Wl9/HhO647GG4OL5w46M0iWvx1b1b8xjYT1w==} peerDependencies: - lexical: 0.13.1 yjs: '>=13.5.22' dependencies: - '@lexical/offset': 0.13.1(lexical@0.13.1) - lexical: 0.13.1 + '@lexical/offset': 0.15.0 + lexical: 0.15.0 yjs: 13.6.15 dev: false @@ -10524,8 +10494,8 @@ packages: type-check: 0.3.2 dev: true - /lexical@0.13.1: - resolution: {integrity: sha512-jaqRYzVEfBKbX4FwYpd/g+MyOjRaraAel0iQsTrwvx3hyN0bswUZuzb6H6nGlFSjcdrc77wKpyKwoWj4aUd+Bw==} + /lexical@0.15.0: + resolution: {integrity: sha512-/7HrPAmtgsc1F+qpv5bFwoQZ6CbH/w3mPPL2AW5P75/QYrqKz4bhvJrc2jozIX0GxtuT/YUYT7w+1sZMtUWbOg==} dev: false /lib0@0.2.94: diff --git a/vscode/package.json b/vscode/package.json index b3273043969f..1b9481bffab9 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -1390,9 +1390,9 @@ "dependencies": { "@anthropic-ai/sdk": "^0.4.2", "@floating-ui/react": "^0.26.9", - "@lexical/code": "^0.13.1", - "@lexical/html": "^0.13.1", - "@lexical/react": "^0.13.1", + "@lexical/code": "^0.15.0", + "@lexical/html": "^0.15.0", + "@lexical/react": "^0.15.0", "@mdi/js": "^7.2.96", "@openctx/vscode-lib": "^0.0.5", "@opentelemetry/api": "^1.7.0", @@ -1434,7 +1434,7 @@ "ini": "^4.1.2", "isomorphic-fetch": "^3.0.0", "js-levenshtein": "^1.1.6", - "lexical": "^0.13.1", + "lexical": "^0.15.0", "lodash": "^4.17.21", "lowlight": "^3.1.0", "lru-cache": "^10.0.0", diff --git a/vscode/webviews/promptEditor/BaseEditor.tsx b/vscode/webviews/promptEditor/BaseEditor.tsx index 1640c5748a5c..c77c1978f4f9 100644 --- a/vscode/webviews/promptEditor/BaseEditor.tsx +++ b/vscode/webviews/promptEditor/BaseEditor.tsx @@ -12,6 +12,7 @@ import styles from './BaseEditor.module.css' import { RICH_EDITOR_NODES } from './nodes' import MentionsPlugin from './plugins/atMentions/atMentions' import CodeHighlightPlugin from './plugins/codeHighlight' +import { DisableEscapeKeyBlursPlugin } from './plugins/disableEscapeKeyBlurs' import { KeyboardEventPlugin, type KeyboardEventPluginProps } from './plugins/keyboardEvent' import { OnFocusChangePlugin } from './plugins/onFocus' @@ -86,6 +87,7 @@ export const BaseEditor: FunctionComponent = ({ {onFocusChange && } {editorRef && } + diff --git a/vscode/webviews/promptEditor/plugins/disableEscapeKeyBlurs.tsx b/vscode/webviews/promptEditor/plugins/disableEscapeKeyBlurs.tsx new file mode 100644 index 000000000000..60c6f579ee65 --- /dev/null +++ b/vscode/webviews/promptEditor/plugins/disableEscapeKeyBlurs.tsx @@ -0,0 +1,40 @@ +import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext' +import { COMMAND_PRIORITY_EDITOR, KEY_ESCAPE_COMMAND } from 'lexical' +import { type FunctionComponent, useEffect } from 'react' + +/** + * Lexical's default behavior is for the Escape key to blur the editor. This does not make sense for + * our purposes. + */ +export const DisableEscapeKeyBlursPlugin: FunctionComponent = () => { + const [editor] = useLexicalComposerContext() + + useEffect(() => { + // HACK(sqs): Disable the Escape-key-blurs-editor functionality. See + // https://github.com/facebook/lexical/pull/5991#issuecomment-2132094564. editor._commands. + // + // If any of these `console.log` messages are printed, then check if Lexical editor behavior + // has changed, and if so, you can probably remove this plugin. + const escListeners = editor._commands.get(KEY_ESCAPE_COMMAND) + if (!escListeners) { + console.log('DisableEscapeKeyBlursPlugin: no listeners registered for Escape key.') + return + } + const editorEscListener = escListeners.at(COMMAND_PRIORITY_EDITOR) + if (!editorEscListener) { + console.log( + 'DisableEscapeKeyBlursPlugin: no COMMAND_PRIORITY_EDITOR listener registered for Escape key.' + ) + return + } + if (editorEscListener.size !== 1) { + console.log( + 'DisableEscapeKeyBlursPlugin: unexpectedly more than one listener registered for Escape key.' + ) + return + } + editorEscListener.clear() + }, [editor]) + + return null +}