From 9eb81ff0dc4ae1e9e1e831ce7de1a70dc5b20ae2 Mon Sep 17 00:00:00 2001
From: Leonardo <leomilho@gmail.com>
Date: Fri, 11 Oct 2024 21:49:55 +0200
Subject: [PATCH] fix: add missing lexical dependency

---
 .../lib/components/textEditor/TextEditor.tsx  | 15 ++--
 libs/shared/package.json                      |  1 +
 pnpm-lock.yaml                                | 70 ++++++++++++++++++-
 3 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/libs/shared/lib/components/textEditor/TextEditor.tsx b/libs/shared/lib/components/textEditor/TextEditor.tsx
index 90f797e20..597bbf0bf 100644
--- a/libs/shared/lib/components/textEditor/TextEditor.tsx
+++ b/libs/shared/lib/components/textEditor/TextEditor.tsx
@@ -4,7 +4,7 @@ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
 import { ContentEditable } from '@lexical/react/LexicalContentEditable';
 import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
 import { LexicalEditor, EditorState } from 'lexical';
-import { $generateHtmlFromNodes } from "@lexical/html";
+import { $generateHtmlFromNodes } from '@lexical/html';
 import { MyOnChangePlugin } from './plugins/StateChangePlugin';
 import { ToolbarPlugin } from './plugins/ToolbarPlugin';
 import { InsertVariablesPlugin } from './plugins/InsertVariablesPlugin';
@@ -24,18 +24,18 @@ export function TextEditor({ editorState, setEditorState, showToolbar, placehold
   function onChange(editorState: EditorState, editor: LexicalEditor) {
     setEditorState(editorState);
     editor.read(() => {
-      const html = $generateHtmlFromNodes(editor)
+      const html = $generateHtmlFromNodes(editor as any); // any needed to avoid excessive ts error
       text.current = html;
     });
   }
 
-  const text = useRef<string>("hai");
+  const text = useRef<string>('hai');
 
   const initialConfig = {
     namespace: 'MyEditor',
     editorState: editorState,
     onError: ErrorHandler,
-    nodes: [ VariableNode ],
+    nodes: [VariableNode],
   };
 
   return (
@@ -50,10 +50,9 @@ export function TextEditor({ editorState, setEditorState, showToolbar, placehold
       </div>
       <MyOnChangePlugin onChange={onChange} />
       <InsertVariablesPlugin />
-      <br /><b>Debug:</b>
-      <div style={{fontFamily: 'monospace'}}>
-        { text.current }
-      </div>
+      <br />
+      <b>Debug:</b>
+      <div style={{ fontFamily: 'monospace' }}>{text.current}</div>
     </LexicalComposer>
   );
 }
diff --git a/libs/shared/package.json b/libs/shared/package.json
index 8be212358..6b95f6079 100644
--- a/libs/shared/package.json
+++ b/libs/shared/package.json
@@ -23,6 +23,7 @@
     "@emotion/react": "^11.11.4",
     "@emotion/styled": "^11.11.0",
     "@floating-ui/react": "^0.26.16",
+    "@lexical/html": "^0.18.0",
     "@lexical/react": "^0.17.1",
     "@pixi-essentials/cull": "^2.0.0",
     "@reactflow/node-resizer": "^2.2.9",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9b9c0e10f..3c9b3582b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -248,6 +248,9 @@ importers:
       '@floating-ui/react':
         specifier: ^0.26.16
         version: 0.26.24(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
+      '@lexical/html':
+        specifier: ^0.18.0
+        version: 0.18.0
       '@lexical/react':
         specifier: ^0.17.1
         version: 0.17.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(yjs@13.6.19)
@@ -2070,6 +2073,9 @@ packages:
   '@lexical/clipboard@0.17.1':
     resolution: {integrity: sha512-OVqnEfWX8XN5xxuMPo6BfgGKHREbz++D5V5ISOiml0Z8fV/TQkdgwqbBJcUdJHGRHWSUwdK7CWGs/VALvVvZyw==}
 
+  '@lexical/clipboard@0.18.0':
+    resolution: {integrity: sha512-ybc+hx14wj0n2ZjdOkLcZ02MRB3UprXjpLDXlByFIuVcZpUxVcp3NzA0UBPOKXYKvdt0bmgjnAsFWM5OSbwS0w==}
+
   '@lexical/code@0.17.1':
     resolution: {integrity: sha512-ZspfTm6g6dN3nAb4G5bPp3SqxzdkB/bjGfa0uRKMU6/eBKtrMUgZsGxt0a8JRZ1eq2TZrQhx+l1ceRoLXii/bQ==}
 
@@ -2091,12 +2097,18 @@ packages:
   '@lexical/html@0.17.1':
     resolution: {integrity: sha512-yGG+K2DXl7Wn2DpNuZ0Y3uCHJgfHkJN3/MmnFb4jLnH1FoJJiuy7WJb/BRRh9H+6xBJ9v70iv+kttDJ0u1xp5w==}
 
+  '@lexical/html@0.18.0':
+    resolution: {integrity: sha512-8lhba1DFnnobXgYm4Rk5Gr2tZedD4Gl6A/NKCt7whO/CET63vT3UnK2ggcVVgtIJG530Cv0bdZoJbJu5DauI5w==}
+
   '@lexical/link@0.17.1':
     resolution: {integrity: sha512-qFJEKBesZAtR8kfJfIVXRFXVw6dwcpmGCW7duJbtBRjdLjralOxrlVKyFhW9PEXGhi4Mdq2Ux16YnnDncpORdQ==}
 
   '@lexical/list@0.17.1':
     resolution: {integrity: sha512-k9ZnmQuBvW+xVUtWJZwoGtiVG2cy+hxzkLGU4jTq1sqxRIoSeGcjvhFAK8JSEj4i21SgkB1FmkWXoYK5kbwtRA==}
 
+  '@lexical/list@0.18.0':
+    resolution: {integrity: sha512-DEWs9Scbg3+STZeE2O0OoG8SWnKnxQccObBzyeHRjn4GAN6JA7lgcAzfrdgp0fNWTbMM/ku876MmXKGnqhvg9Q==}
+
   '@lexical/mark@0.17.1':
     resolution: {integrity: sha512-V82SSRjvygmV+ZMwVpy5gwgr2ZDrJpl3TvEDO+G5I4SDSjbgvua8hO4dKryqiDVlooxQq9dsou0GrZ9Qtm6rYg==}
 
@@ -2124,15 +2136,24 @@ packages:
   '@lexical/selection@0.17.1':
     resolution: {integrity: sha512-qBKVn+lMV2YIoyRELNr1/QssXx/4c0id9NCB/BOuYlG8du5IjviVJquEF56NEv2t0GedDv4BpUwkhXT2QbNAxA==}
 
+  '@lexical/selection@0.18.0':
+    resolution: {integrity: sha512-mJoMhmxeZLfM9K2JMYETs9u179IkHQUlgtYG5GZJHjKx2iUn+9KvJ9RVssq+Lusi7C/N42wWPGNHDPdUvFtxXg==}
+
   '@lexical/table@0.17.1':
     resolution: {integrity: sha512-2fUYPmxhyuMQX3MRvSsNaxbgvwGNJpHaKx1Ldc+PT2MvDZ6ALZkfsxbi0do54Q3i7dOon8/avRp4TuVaCnqvoA==}
 
+  '@lexical/table@0.18.0':
+    resolution: {integrity: sha512-TeTAnuFAAgVjm1QE8adRB3GFWN+DUUiS4vzGq+ynPRCtNdpmW27NmTkRMyxKsetUtt7nIFfj4DvLvor4RwqIpA==}
+
   '@lexical/text@0.17.1':
     resolution: {integrity: sha512-zD2pAGXaMfPpT8PeNrx3+n0+jGnQORHyn0NEBO+hnyacKfUq5z5sI6Gebsq5NwH789bRadmJM5LvX5w8fsuv6w==}
 
   '@lexical/utils@0.17.1':
     resolution: {integrity: sha512-jCQER5EsvhLNxKH3qgcpdWj/necUb82Xjp8qWQ3c0tyL07hIRm2tDRA/s9mQmvcP855HEZSmGVmR5SKtkcEAVg==}
 
+  '@lexical/utils@0.18.0':
+    resolution: {integrity: sha512-4s9dVpBZjqIaA/1q2GtfWFjKsv2Wqhjer0Zw2mcl1TIVN0zreXxcTKN316QppAWmSQJxVGvkWHjjaZJwl6/TSw==}
+
   '@lexical/yjs@0.17.1':
     resolution: {integrity: sha512-9mn5PDtaH5uLMH6hQ59EAx5FkRzmJJFcVs3E6zSIbtgkG3UASR3CFEfgsLKTjl/GC5NnTGuMck+jXaupDVBhOg==}
     peerDependencies:
@@ -5678,6 +5699,10 @@ packages:
     resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==}
     engines: {node: '>= 0.4'}
 
+  get-stream@6.0.1:
+    resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
+    engines: {node: '>=10'}
+
   get-stream@8.0.1:
     resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==}
     engines: {node: '>=16'}
@@ -6475,6 +6500,9 @@ packages:
   lexical@0.17.1:
     resolution: {integrity: sha512-72/MhR7jqmyqD10bmJw8gztlCm4KDDT+TPtU4elqXrEvHoO5XENi34YAEUD9gIkPfqSwyLa9mwAX1nKzIr5xEA==}
 
+  lexical@0.18.0:
+    resolution: {integrity: sha512-3K/B0RpzjoW+Wj2E455wWXxkqxqK8UgdIiuqkOqdOsoSSo5mCkHOU6eVw7Nlmlr1MFvAMzGmz4RPn8NZaLQ2Mw==}
+
   lib0@0.2.97:
     resolution: {integrity: sha512-Q4d1ekgvufi9FiHkkL46AhecfNjznSL9MRNoJRQ76gBHS9OqU2ArfQK0FvBpuxgWeJeNI0LVgAYMIpsGeX4gYg==}
     engines: {node: '>=16'}
@@ -10743,6 +10771,14 @@ snapshots:
       '@lexical/utils': 0.17.1
       lexical: 0.17.1
 
+  '@lexical/clipboard@0.18.0':
+    dependencies:
+      '@lexical/html': 0.18.0
+      '@lexical/list': 0.18.0
+      '@lexical/selection': 0.18.0
+      '@lexical/utils': 0.18.0
+      lexical: 0.18.0
+
   '@lexical/code@0.17.1':
     dependencies:
       '@lexical/utils': 0.17.1
@@ -10780,6 +10816,12 @@ snapshots:
       '@lexical/utils': 0.17.1
       lexical: 0.17.1
 
+  '@lexical/html@0.18.0':
+    dependencies:
+      '@lexical/selection': 0.18.0
+      '@lexical/utils': 0.18.0
+      lexical: 0.18.0
+
   '@lexical/link@0.17.1':
     dependencies:
       '@lexical/utils': 0.17.1
@@ -10790,6 +10832,11 @@ snapshots:
       '@lexical/utils': 0.17.1
       lexical: 0.17.1
 
+  '@lexical/list@0.18.0':
+    dependencies:
+      '@lexical/utils': 0.18.0
+      lexical: 0.18.0
+
   '@lexical/mark@0.17.1':
     dependencies:
       '@lexical/utils': 0.17.1
@@ -10858,11 +10905,21 @@ snapshots:
     dependencies:
       lexical: 0.17.1
 
+  '@lexical/selection@0.18.0':
+    dependencies:
+      lexical: 0.18.0
+
   '@lexical/table@0.17.1':
     dependencies:
       '@lexical/utils': 0.17.1
       lexical: 0.17.1
 
+  '@lexical/table@0.18.0':
+    dependencies:
+      '@lexical/clipboard': 0.18.0
+      '@lexical/utils': 0.18.0
+      lexical: 0.18.0
+
   '@lexical/text@0.17.1':
     dependencies:
       lexical: 0.17.1
@@ -10874,6 +10931,13 @@ snapshots:
       '@lexical/table': 0.17.1
       lexical: 0.17.1
 
+  '@lexical/utils@0.18.0':
+    dependencies:
+      '@lexical/list': 0.18.0
+      '@lexical/selection': 0.18.0
+      '@lexical/table': 0.18.0
+      lexical: 0.18.0
+
   '@lexical/yjs@0.17.1(yjs@13.6.19)':
     dependencies:
       '@lexical/offset': 0.17.1
@@ -11097,7 +11161,7 @@ snapshots:
 
   '@mapbox/geojson-rewind@0.5.2':
     dependencies:
-      get-stream: 8.0.1
+      get-stream: 6.0.1
       minimist: 1.2.8
 
   '@mapbox/geojson-types@1.0.2': {}
@@ -15495,6 +15559,8 @@ snapshots:
       has-symbols: 1.0.3
       hasown: 2.0.2
 
+  get-stream@6.0.1: {}
+
   get-stream@8.0.1: {}
 
   get-symbol-description@1.0.2:
@@ -16316,6 +16382,8 @@ snapshots:
 
   lexical@0.17.1: {}
 
+  lexical@0.18.0: {}
+
   lib0@0.2.97:
     dependencies:
       isomorphic.js: 0.2.5
-- 
GitLab