Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@lexical/devtools): Added TreeView rendering instead of a simple textarea #5830

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

StyleT
Copy link
Contributor

@StyleT StyleT commented Apr 4, 2024

List of changes:

  • Added @lexical/devtools-core that will contain all UIs for Lexical debugging. As we may want to use them outside of the extension (like now TreeView is a part of the @lexical/react)
  • Added TreeView rendering instead of a simple textarea within extension
  • Module resolution config for Vite now is shared between playground and extension
  • Exported EditorSetOptions type from lexical package

Feature demo in Chrome:

Screen.Recording.2024-04-04.at.6.38.48.PM.mov

Feature demo in Firefox:

Screen.Recording.2024-04-04.at.6.46.13.PM.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 4, 2024
Copy link

vercel bot commented Apr 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 5:21pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 5:21pm

Copy link

github-actions bot commented Apr 4, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 26.95 KB (0%) 539 ms (0%) 89 ms (+667.11% 🔺) 628 ms
packages/lexical-rich-text/dist/LexicalRichText.js 39.37 KB (0%) 788 ms (0%) 120 ms (+316.63% 🔺) 908 ms
packages/lexical-plain-text/dist/LexicalPlainText.js 39.34 KB (0%) 787 ms (0%) 142 ms (+441.91% 🔺) 929 ms


return false;
},
COMMAND_PRIORITY_HIGH,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want this to be the highest priority (CRITICAL) to have higher confidence it'll be executed. On a related note, there're some changes commands won't be logged if any plugin is added dynamically and extension (extension is initialized before plugin is enabled). Although I'd argue it should be very rare scenario

Copy link
Contributor Author

@StyleT StyleT Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shall add your 2nd concern to the refresh procedure (I'll create issue)

Regarding criticality - I just moved this code from existing TreeView, but your point sounds right, will update it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

const newState = [...state];
newState.push({
payload,
type: command.type ? command.type : 'UNKNOWN',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: command.type ?? 'UNKNOWN'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change causes error in WWW build, so leaving as is:

node scripts/build.js --www --prod
/home/runner/work/lexical/lexical/node_modules/@ampproject/rollup-plugin-closure-compiler/dist/index.js:1571
[33](https://github.com/facebook/lexical/actions/runs/8604009341/job/23577172760?pr=5830#step:9:34)
                reject(new Error(`Google Closure Compiler exit ${exitCode}: ${stdErr}`));

ERROR - [JSC_LANGUAGE_FEATURE] This language feature is only supported for ECMASCRIPT_***0***0 mode or better: Nullish coalescing.

onMessage('generateTreeViewContent', (message) => {
const editor = queryLexicalEditorByKey(message.data.key);
if (editor == null) {
throw new Error(`Can't find editor with key: ${message.data.key}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: what happens when extension throws?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error will be passed to the caller side (devtools tab) and there we show message to the used at the top of the page now.

It's lame, so better error/log system shall be in place, but not in this PR :P I'll create issue for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the plan here: #5675 (comment)

@StyleT StyleT requested a review from fantactuka April 8, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants