Skip to content

Commit

Permalink
Merge pull request #1619 from oliviermgx/dev
Browse files Browse the repository at this point in the history
toggle resize project panel + contrasts improvments + npm-run-all in package.json
  • Loading branch information
lexoyo authored Dec 7, 2024
2 parents 85c8067 + 695f016 commit d673f3a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"node_modules-path": "2.0.8",
"node-fetch": "2.6.9",
"normalize.css": "8.0.1",
"npm-run-all": "^4.1.5",
"object-path": "0.11.8",
"promise-sequential": "1.1.1",
"sass": "1.77.8",
Expand All @@ -164,7 +165,6 @@
"jest-environment-jsdom": "29.7.0",
"livereload": "0.9.3",
"nodemon": "3.1.4",
"npm-run-all": "4.1.5",
"npm-watch": "0.13.0",
"pug-cli": "1.0.0-alpha6",
"style-loader": "4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ $projectBarWidth: 35px;
$projectPanelWidth: 13%;
$projectPanelMinWidth: 150px;
$viewsPanelWidth: 25%; // 15% is grapesjs default
$viewsProjectPanelWidth: 13%;
$footerHeight: 30px;
$transitionSpeedMedium: .15s;
$transitionSpeedSlow: .30s;
Expand All @@ -32,4 +33,5 @@ $fontFamily: 'Ubuntu', sans-serif;
--darkerPrimaryColor: #{$darkerPrimaryColor};
--lighterPrimaryColor: #{$lighterPrimaryColor};
--viewsPanelWidth: #{$viewsPanelWidth};
--viewsProjectPanelWidth: #{$viewsProjectPanelWidth};
}
4 changes: 4 additions & 0 deletions src/css/grapesjs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
width: var(--viewsPanelWidth);
}

.gjs-pn-project-bar-container {
width: var(--viewsProjectPanelWidth);
}

.gjs-pn-options {
right: var(--viewsPanelWidth);
}
Expand Down
14 changes: 14 additions & 0 deletions src/css/project-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
}
}

// Resize options project panel button
.viewsOptionsProjectPanel__size-btn::before {
content: '';
}
.viewsOptionsProjectPanel__size-btn {
z-index: $z-views-options-buttons;
right: auto;
left: 0;
}
// For fixed block size after project panel resizing (instead of default value 45%)
.gjs-block {
width: 84px;
}

// panels
.#{$pn-prefix}project-bar-container {
top: $topBarHeight;
Expand Down
7 changes: 7 additions & 0 deletions src/css/silex.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
font-size: 18px;
font-weight: normal;
}
//Better contrast than grapesjs default for select menu et input
select, input {
background-color: $darkerPrimaryColor;
}
.gjs-color-warn, .gjs-sm-sector .gjs-sm-field input, .gjs-clm-tags .gjs-sm-field input, .gjs-sm-sector .gjs-clm-field input, .gjs-clm-tags .gjs-clm-field input, .gjs-sm-sector .gjs-sm-field select, .gjs-clm-tags .gjs-sm-field select, .gjs-sm-sector .gjs-clm-field select, .gjs-clm-tags .gjs-clm-field select {
color: $secondaryColor;
}
}

.full-width {
Expand Down
16 changes: 16 additions & 0 deletions src/ts/client/grapesjs/project-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ export const projectBarPlugin = (editor, opts) => {
const containerPanel = editor.Panels.addPanel({
id: containerPanelId,
visible: false,
// resize project panel button
buttons: [{
id: 'resizeBlocks',
className: 'viewsOptionsProjectPanel__size-btn',
command: 'resize-ProjectPanel',
attributes: { title: 'Resize Project Panel' },
}],
})
// resize project panel command
editor.Commands.add('resize-ProjectPanel', {
run: (editor, sender) => {
document.documentElement.style.setProperty('--viewsProjectPanelWidth', '26%')
},
stop: (editor, sender) => {
document.documentElement.style.setProperty('--viewsProjectPanelWidth', '13%')
},
})
// create the project bar panel in grapesjs
editor.Panels.addPanel({
Expand Down

0 comments on commit d673f3a

Please sign in to comment.