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

Add Text devtool to CodeMirror example #646

Merged
merged 5 commits into from
Sep 16, 2023
Merged

Add Text devtool to CodeMirror example #646

merged 5 commits into from
Sep 16, 2023

Conversation

chacha912
Copy link
Contributor

@chacha912 chacha912 commented Sep 15, 2023

What this PR does / why we need it?

I added a devtool to the CodeMirror example that allows monitoring of CRDT Text. This devtool is an adaptation of the text editor devtool work done by @easylogic, modified to align with the current Yorkie version.

How to Run:

$ npm run dev

Visit the URL: http://localhost:9000/codemirror-devtool.html

image

Features

  • CodeMirror Editor
  • Peer List Display
devtool1.mov
  • View Mode
    • Offers 5 different views for text type:
      • Block View: text, structure data, structure text
      • Tree View: SplayTree, LLRBTree
    • Provides panzoom in the tree view.
    • Toggle the view on and off.
    • Option to hide deleted nodes.
dev1.mov
  • Select Node
    • Selecting a node in text, structure data, or tree view highlights and focuses on the respective node.
    • Displays SplayTree information for the selected node.
devtool2.mov

In the previous PR, it included information to monitor how skewed the splay tree was. However, in this PR, I have removed this feature to prioritize the most basic functionality. We can consider adding it back when needed.

image

Any background context you want to provide?

The previous work by @easylogic in this PR: #467
Thanks to the devtool, CRDT Text has become much more user-friendly to understand and easier to debug. This is amazing and incredibly helpful! Thank you, @easylogic.

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.04% 🎉

Comparison is base (1594345) 88.83% compared to head (c4e40ae) 88.88%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #646      +/-   ##
==========================================
+ Coverage   88.83%   88.88%   +0.04%     
==========================================
  Files          80       80              
  Lines        8942     8958      +16     
  Branches      823      825       +2     
==========================================
+ Hits         7944     7962      +18     
+ Misses        689      688       -1     
+ Partials      309      308       -1     

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hackerwins hackerwins changed the title Add codemirror devtool example Add Text devtool to CodeMirror example Sep 15, 2023
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

devtools seems useful for understanding the state of data structure and this is a good start to implement internal devtool. I left a suggestion.

It appears that the styles and functions defined in devtools/text.js and devtools/text.css are globally defined. This could potentially lead to conflicts when adding other data structures. How about bundling them into a module like devtools.text to avoid potential conflicts?

@hackerwins hackerwins self-requested a review September 16, 2023 01:22
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 52ffdbd into main Sep 16, 2023
2 checks passed
@hackerwins hackerwins deleted the cm-devtool branch September 16, 2023 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants