Overview

Parent issue #3499919: [Meta] Plan for in-browser code components
Blocked by #3499947: Managing code components in library

When a code component is selected in the library (list is added in #3499947: Managing code components in library), we need to display the UI elements that make it possible to author/edit the component.

Proposed resolution

  1. Implement the necessary routing logic for selecting and working with a code component — be aware of routing changes in #3497648: Focus mode for global regions to avoid conflicts;
  2. Create the intended layout using react-mosaic-component, just like we did in #3483267: [exploratory] PoC of Preact+Tailwind components editable via CodeMirror;
  3. Style the layout based on the design, but allow resizing the panels (the gap between them could be the area we can drag and move to resize);
  4. Don't allow splitting and dragging windows in react-mosaic-component, try its controlled mode;
  5. Add a button to implement a layout variant that expands the code editor panel to full width — the button is visible in the top-right corner of the panel on the design;
  6. Create the code editor panel using CodeMirror, just like we did in #3483267: [exploratory] PoC of Preact+Tailwind components editable via CodeMirror;
  7. Introduce three tabs inside the code editor panel: JavaScript, CSS, and Global CSS.

Be aware of #3500081: Editing components sourced as code components which will need to present almost the same UI and functionality.

Out of scope, add placeholders to the UI:

User interface changes

Code editor for code components

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

balintbrews created an issue. See original summary.

balintbrews’s picture

Issue summary: View changes
balintbrews’s picture

Assigned: Unassigned » hooroomoo

hooroomoo made their first commit to this issue’s fork.

balintbrews’s picture

Issue summary: View changes
balintbrews’s picture

Issue summary: View changes
balintbrews’s picture

hooroomoo changed the visibility of the branch 3499988-editing-code-components to hidden.

wim leers’s picture

Title: Editing code components » [PP-3] Editing code components

This is blocked on #3499947: Managing code components in library, which is blocked on #3499931: HTTP API for code component config entities, which itself is blocked on #3499927: Config entity for storing code components.

… but it looks like @hooroomoo is able to get at least UI changes in place, while awaiting an HTTP API to talk to? 😄

balintbrews’s picture

Issue summary: View changes
effulgentsia’s picture

Issue tags: +sprint

Up until now, the XB team has been following a pseudo-scrum/pseudo-kanban process, but we're now shifting into more conventional scrum. We started a new 2-week sprint last Thursday (Jan 16). I'm tagging our current sprint's issues for visibility.

hooroomoo’s picture

Issue summary: View changes
StatusFileSize
new108.38 KB

hooroomoo’s picture

Status: Active » Needs review
hooroomoo’s picture

Issue summary: View changes
StatusFileSize
new149.7 KB

balintbrews’s picture

Assigned: hooroomoo » balintbrews
balintbrews’s picture

Assigned: balintbrews » hooroomoo
Status: Needs review » Needs work
hooroomoo’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new120.15 KB

Addressed feedback

hooroomoo’s picture

Assigned: hooroomoo » Unassigned

balintbrews’s picture

Crediting @effulgentsia, who guided us towards CodeMirror after extensive research in #3483267: [exploratory] PoC of Preact+Tailwind components editable via CodeMirror, and @xinran, who first introduced react-mosaic to the codebase as part of #3483267: [exploratory] PoC of Preact+Tailwind components editable via CodeMirror.

balintbrews’s picture

Title: [PP-3] Editing code components » Editing code components
Status: Needs review » Fixed

💥 We have an in-browser code editor! Amazing work, @hooroomoo!

lauriii’s picture

Epic work here @hooroomoo on implementing this and @balintbrews on leading this effort! 👏 🚀

wim leers’s picture

🤩 EPIC!!!!!! :D Can't wait where y'all are taking this next! 😄

But what's truly shocking is how little code this required: the +903, -4 diffstat is dominated by the +448, -3 lock file update and +193, -0 for CSS 🤯

effulgentsia’s picture

Issue tags: -sprint

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

lauriii’s picture

Crediting designers on this.