Problem/Motivation

JS part of the module is outdated. Isn't working correctly and should be rewritten.

1) Need to remove static code for UI creation. It should be more dynamic and use breakpoints instead hard coded.
2) Need to implement an easy way to set inline classes for paragraphs.
3) Refactor shitcode.

Remaining tasks

1) Gristack management buttons should be moved to the backend
2) Refactor JS code

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

Panchuk created an issue. See original summary.

smovs’s picture

Assigned: Unassigned » smovs

smovs’s picture

Hi Panchuk, Could you please review my MR?
There are some updates:
1. I removed the creation of the breakpoints buttons from the JS file and moved that to GridstackContainer.php. The buttons will be created dynamically by breakpoint quantity (a button for each breakpoint). Also, I added some common styles for these buttons and for textarea inputs. These styles will be used in JS.
2. I updated the JS code in the module. I used drupalSettings with breakpoints for the breakpoint buttons click event and updated click events for the Restore settings and Set by template buttons.
3. I have found that the gridstack.js library is changed its own repositories. Attaching the gridstack.js library by composer is not working correctly at this moment. The folder 'dist' will not be installed by this method. Also, the file "gridstack-h5.js" exists in gristack v.5.1.1 and doesn't exist in v.1.2.1. I installed gridstack.js library by yarn (yarn add gridstack@5.1.1) and moved the folder with gridstack manually to libraries folder. After that, I updated the path to the file, and scripts from the library are available in the file paragraphs_gridstack.js.

My next steps will be refactoring the JS file and using dynamically created breakpoint buttons for rendering the related Gridctack area.

panchuk’s picture

Issue tags: +LutskGCW23
smovs’s picture

Hi @Panchuk.
I have a bit refactored the GridstackContainer.php. I added the usage of a dynamic breakpoint label instead hardcoded.
Could you please look at my last MR? Thanks.

smovs’s picture

Assigned: smovs » Unassigned
Status: Active » Needs review
panchuk’s picture

Status: Needs review » Needs work

Cannot merge MR due to conflicts, please, solve them before

smovs’s picture

Status: Needs work » Needs review

  • Panchuk committed 2f64d2e3 on 1.0.x authored by SmovS
    Issue #3319561: Refactor paragraphs_gridstack.js behaviors
    
panchuk’s picture

Title: Refactor paragraphs_gridstack.js behaviors » Gristack management buttons should be moved to backend
Issue summary: View changes
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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