-
Notifications
You must be signed in to change notification settings - Fork 2
BP-1293: Add theming support to new rich-text editor for basic redactor configuration #240
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
Open
jovana-marceta
wants to merge
28
commits into
master
Choose a base branch
from
features/BP-1293-Add-theming-support-to-rich-text-editor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
94a3604
BP-1293: Adding Redactor overrides in entry
jovana-marceta 19895ee
BP-1293: Extending redactor generator mixins
jovana-marceta 1196aa4
BP-1293: Add redactor generators for buttons and table styles
jovana-marceta 162bab4
BP-1293: Adding redactor checkboxes generator
jovana-marceta 0444e4e
BP-1293: Refactoring redactor styles
jovana-marceta 71f0a1c
Use mixin for row coloring from foundation
jovana-marceta 6f32991
BP-1293: Inherit angular material checkbox background and change alia…
d58d056
Rename redactor lib
jovana-marceta 22133a9
Move non-theming related variables outside of redactor mixins
jovana-marceta dead72d
BP-1293: Add redactor layout generator and clean up generator file
jovana-marceta 6768b1a
BP-1293: Inherit table even background from angular material
jovana-marceta 80792fb
BP-1293: Inherit material body text color
jovana-marceta f4151f9
BP-1293: Make redactor typography generator more redeable
jovana-marceta b9f241c
BP-1293: Rename folder
jovana-marceta 8d2d02d
BP-1293: Resolve review suggestions
jovana-marceta 5a54b11
BP-1293: Get rid of variables
jovana-marceta 194e84e
rename checkbox variables
jovana-marceta 2bdd9ea
rename toolbar generator
jovana-marceta 6977b0b
BP-1293: Add missing sign on buttons generator variable
jovana-marceta d4dda13
BP-1293: Get rid of checkboxes duplicated extraction
jovana-marceta 0789b8f
Get rid of toolbar generator duplicated extraction retrieval
jovana-marceta 608e968
Additional buttons and checkboxes file refactoring
jovana-marceta b4ea198
Make buttons generator more redeable
jovana-marceta 2bb570a
Refactoring checkbox and toolbar generator
jovana-marceta 2102dcc
Fixed indentation for buttons generator
jovana-marceta 4380c1b
Merge branch 'master' of https://github.com/enigmatry/entry-angular-b…
Cvetanovic 5adf203
stylelint fixes
Cvetanovic 1243f87
comment fixes
Cvetanovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
libs/entry-components/styles/modules/vendors/rich-text/_generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| @use 'sass:map'; | ||
| @use 'necessary-mix/tables-generator' as tables; | ||
| @use 'necessary-mix/buttons-generator' as buttons; | ||
| @use 'necessary-mix/typography-generator' as typography; | ||
| @use 'necessary-mix/checkboxes-generator' as checkboxes; | ||
| @use 'necessary-mix/toolbar-generator' as toolbar; | ||
|
|
||
| @mixin generate-from($theme) { | ||
| @include typography.generate-from($theme); | ||
| @include tables.generate-from($theme); | ||
| @include buttons.generate-from($theme); | ||
| @include checkboxes.generate-from($theme); | ||
| @include toolbar.generate-from($theme); | ||
| } |
34 changes: 34 additions & 0 deletions
34
libs/entry-components/styles/modules/vendors/rich-text/necessary-mix/_buttons-generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| @use 'sass:map'; | ||
| @use '@angular/material' as mat; | ||
|
|
||
| $default-material-button: map.get(mat.define-typography-config(), 'button'); | ||
|
|
||
| @mixin generate-from($theme) { | ||
| $theming-primary: map.get($theme, 'general', 'colors', 'primary'); | ||
| $theming-button-fonts: map.get($theme, 'general', 'fonts', 'buttons'); | ||
| $theming-font-family: map.get($theming-button-fonts, 'family'); | ||
| $theming-font-weight: map.get($theming-button-fonts, 'weight'); | ||
| $theming-font-size: map.get($theming-button-fonts, 'size'); | ||
|
|
||
| $primary-color: if($theming-primary == '' or $theming-primary == null, mat.get-color-from-palette(mat.$primary-palette, 500), $theming-primary); | ||
| $font-family: if($theming-font-family == '' or $theming-font-family == null, map.get($default-material-button, 'font-family'), $theming-font-family); | ||
| $font-weight: if($theming-font-weight == '' or $theming-font-weight == null, map.get($default-material-button, 'font-weight'), $theming-font-weight); | ||
| $font-size: if($theming-font-size == '' or $theming-font-size == null, map.get($default-material-button, 'font-size'), $theming-font-size); | ||
|
|
||
| .enigmatry-redactor-content { | ||
| button, .rx-content button { | ||
| background-color: $primary-color; | ||
| font: { | ||
| family: $font-family; | ||
| weight: $font-weight; | ||
| size: $font-size; | ||
| } | ||
| } | ||
|
|
||
| .rx-toolbar-buttons .rx-button { | ||
| &.active, &:hover { | ||
| background: $primary-color; | ||
| } | ||
| } | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
...ntry-components/styles/modules/vendors/rich-text/necessary-mix/_checkboxes-generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| @use 'sass:map'; | ||
| @use '@angular/material' as mat; | ||
|
|
||
| $redactor-checkboxes-selector: '[data-rx-type = 'todoitem'] '; | ||
|
|
||
| @mixin generate-from($theme) { | ||
| $theming-accent-color: map.get($theme, 'general', 'colors', 'accent'); | ||
|
|
||
| .enigmatry-redactor-content { | ||
|
|
||
| $checkbox-color: if($theming-accent-color == '' or $theming-accent-color == null, mat.get-color-from-palette(mat.$primary-palette, 500), $theming-accent-color); | ||
|
|
||
| .rx-editor #{$redactor-checkboxes-selector} input:checked::before { | ||
| border-color: $checkbox-color; | ||
| background-color: $checkbox-color; | ||
| } | ||
|
|
||
| @if map.get($theme, 'general', 'checkboxes') { | ||
| .rx-editor #{$redactor-checkboxes-selector} input::before { | ||
| background-color: map.get($theme, 'general', 'checkboxes', 'background'); | ||
| } | ||
| } | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
libs/entry-components/styles/modules/vendors/rich-text/necessary-mix/_tables-generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| @use 'sass:map'; | ||
| @use '@angular/material' as mat; | ||
| @use 'scss-foundation/src/modules/lists/row-coloring' as list; | ||
|
|
||
| $redactor-th-selector: 'thead th'; | ||
| $body-typography: map.get(mat.define-typography-config(), 'body-1'); | ||
| $caption-typography: map.get(mat.define-typography-config(), 'caption'); | ||
|
|
||
| @mixin generate-from($theme) { | ||
| $theming-table: map.get($theme, 'tables', 'rows', 'odd-even-background'); | ||
| $theming-table-header: map.get($theme, 'tables', 'header', 'font-size'); | ||
| $theming-fonts: map.get($theme, 'general', 'fonts'); | ||
| $body-font-family: map.get($theme, 'general', 'fonts', 'body', 'family'); | ||
|
|
||
| .enigmatry-redactor-content { | ||
| table { | ||
| @if $theming-table { | ||
| tr { | ||
| @include list.odd-row-coloring(map.get($theming-table, 'odd')); | ||
| @include list.even-row-coloring(map.get($theming-table, 'even')); | ||
| } | ||
| } | ||
| @else { | ||
| tr { | ||
| @include list.even-row-coloring(mat.get-color-from-palette(mat.$grey-palette, 100)); | ||
typhoon41 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @include list.odd-row-coloring(mat.get-color-from-palette(mat.$grey-palette, 50)); | ||
| } | ||
| } | ||
|
|
||
| @if $theming-table-header { | ||
| th { | ||
| font-family: $body-font-family; | ||
| font-size: $theming-table-header; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| table, table td { | ||
| $body-size: if($theming-fonts != null, map.get($theming-fonts, 'body', 'size'), null); | ||
|
|
||
| @if $body-size { | ||
| font-size: $body-size; | ||
| } | ||
| @else { | ||
| font-size: map.get($body-typography, 'font-size'); | ||
| } | ||
|
|
||
| #{$redactor-th-selector} { | ||
| $header-font-size: map.get($theme, 'tables', 'header', 'font-size'); | ||
|
|
||
| @if $header-font-size { | ||
| font-size: $header-font-size; | ||
| } | ||
| @else { | ||
| font-size: map.get($caption-typography, 'font-size'); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
12 changes: 12 additions & 0 deletions
12
libs/entry-components/styles/modules/vendors/rich-text/necessary-mix/_toolbar-generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @use 'sass:map'; | ||
|
|
||
| @mixin generate-from($theme) { | ||
| $input-background: map.get($theme, 'general', 'inputs', 'background'); | ||
| $input-background: if($input-background == null, transparent, $input-background); | ||
|
|
||
| .enigmatry-redactor-content { | ||
| .rx-main-container, .rx-toolbox-container { | ||
| background: $input-background; | ||
| } | ||
| } | ||
| } |
58 changes: 58 additions & 0 deletions
58
...ntry-components/styles/modules/vendors/rich-text/necessary-mix/_typography-generator.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* stylelint-disable selector-max-compound-selectors, scss/at-if-no-null */ | ||
| @use 'sass:map'; | ||
| @use '@angular/material' as mat; | ||
|
|
||
| $body-typography: map.get(mat.define-typography-config(), 'body-1'); | ||
| $hero-typography: map.get(mat.define-typography-config(), 'headline-1'); | ||
| $title-typography: map.get(mat.define-typography-config(), 'subtitle-1'); | ||
| $caption-typography: map.get(mat.define-typography-config(), 'caption'); | ||
|
|
||
| @function get-typography($theme, $key, $default-config) { | ||
| $theming-fonts: map.get($theme, 'general', 'fonts'); | ||
| $font-config: map.get($theming-fonts, $key); | ||
|
|
||
| @if $font-config != null and $font-config != '' { | ||
| @return $font-config; | ||
| } | ||
| @else { | ||
| @return $default-config; | ||
| } | ||
| } | ||
|
|
||
| @function get-font-property($config, $property, $default-value) { | ||
| $value: map.get($config, $property); | ||
|
|
||
Cvetanovic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @if $value != null and $value != '' { | ||
| @return $value; | ||
| } | ||
| @else { | ||
| @return $default-value; | ||
| } | ||
| } | ||
|
|
||
| @mixin generate-from($theme) { | ||
| $body-config: get-typography($theme, 'body', $body-typography); | ||
| $hero-config: get-typography($theme, 'hero-titles', $hero-typography); | ||
| $title-config: get-typography($theme, 'titles', $title-typography); | ||
|
|
||
| .enigmatry-redactor-content { | ||
| .rx-editor, .rx-content, .rx-content p { | ||
| color: get-font-property($body-config, 'color', map.get($body-typography, 'color')); | ||
| font-family: get-font-property($body-config, 'family', map.get($body-typography, 'font-family')); | ||
| font-size: get-font-property($body-config, 'size', map.get($body-typography, 'font-size')); | ||
| letter-spacing: get-font-property($body-config, 'letter-spacing', map.get($body-typography, 'letter-spacing')); | ||
| } | ||
|
|
||
| .rx-editor, .rx-content, .rx-content { | ||
| h1, h2, h3, h4 { | ||
| font-family: get-font-property($hero-config, 'family', map.get($hero-typography, 'font-family')); | ||
| letter-spacing: get-font-property($hero-config, 'letter-spacing', map.get($hero-typography, 'letter-spacing')); | ||
| } | ||
|
|
||
| h5, h6 { | ||
| font-family: get-font-property($title-config, 'family', map.get($title-typography, 'font-family')); | ||
| letter-spacing: get-font-property($title-config, 'letter-spacing', map.get($title-typography, 'letter-spacing')); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| @use 'core/components'; | ||
| @use 'vendors/overrides'; | ||
jovana-marceta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @use 'overrides/rich-text'; |
1 change: 1 addition & 0 deletions
1
libs/entry-components/styles/partials/vendors/overrides/_index.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @use 'rich-text'; |
36 changes: 36 additions & 0 deletions
36
libs/entry-components/styles/partials/vendors/overrides/rich-text/_buttons.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| @use 'scss-foundation/src/modules/display/items'; | ||
| @use '@angular/material' as mat; | ||
|
|
||
| $redactor-link-selectors: 'a, a:visited, a:focus, a:hover'; | ||
|
|
||
| .enigmatry-redactor-content .rx-content { | ||
| #{$redactor-link-selectors} { | ||
| @include items.fully-align(center, center); | ||
| display: inline-flex; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| button, #{$redactor-link-selectors} { | ||
| @include items.fully-align(center, flex-start); | ||
| height: 36px; | ||
| margin: 8px 8px 8px 0; | ||
| padding: 0 16px; | ||
| border: none; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| a:hover { | ||
| background-color: mat.get-color-from-palette(mat.$grey-palette, 100); | ||
| } | ||
|
|
||
| button { | ||
| @include mat.elevation(4); | ||
jovana-marceta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| height: 36px; | ||
| border-radius: 4px; | ||
| color: #FFF; | ||
|
|
||
| &:hover { | ||
| @include mat.elevation(8); | ||
| } | ||
| } | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
libs/entry-components/styles/partials/vendors/overrides/rich-text/_forms.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| @use '@angular/material' as mat; | ||
|
|
||
| $checkbox-width: 18px; | ||
jovana-marceta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $checkbox-height: 18px; | ||
| $border-radius: 2px; | ||
|
|
||
| $redactor-todoitem-selector: '.rx-editor [data-rx-type = 'todoitem']'; | ||
|
|
||
| .enigmatry-redactor-content #{$redactor-todoitem-selector} { | ||
| input { | ||
| width: $checkbox-width; | ||
| height: $checkbox-height; | ||
| } | ||
|
|
||
| input::before, input:checked::before { | ||
| width: $checkbox-width; | ||
| height: $checkbox-height; | ||
| border-width: 2px; | ||
| border-radius: $border-radius; | ||
| border-color: rgb(0 0 0 / .54); | ||
| } | ||
| } | ||
12 changes: 12 additions & 0 deletions
12
libs/entry-components/styles/partials/vendors/overrides/rich-text/_general.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @use 'sass:map'; | ||
| @use '@angular/material' as mat; | ||
|
|
||
| .enigmatry-redactor-content { | ||
| .rx-button-icon svg { | ||
| fill: rgb(0 0 0 / .54); | ||
| } | ||
|
|
||
| .rx-main-container { | ||
| border-color: rgb(0 0 0 / .38); | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
4
libs/entry-components/styles/partials/vendors/overrides/rich-text/_index.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| @use 'general'; | ||
| @use 'tables'; | ||
| @use 'buttons'; | ||
| @use 'forms'; |
31 changes: 31 additions & 0 deletions
31
libs/entry-components/styles/partials/vendors/overrides/rich-text/_tables.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* stylelint-disable selector-max-compound-selectors, selector-max-type, selector-max-combinators */ | ||
| .enigmatry-redactor-content table { | ||
| th { | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| p { | ||
| margin: 0; | ||
| } | ||
|
|
||
| td { | ||
| border: 1px solid rgb(0 0 0 / .12); | ||
| } | ||
|
|
||
| tr:first-child { | ||
| th, td { | ||
| border-top: none; | ||
| } | ||
| } | ||
|
|
||
| tr:last-child td { | ||
| border-bottom: none; | ||
| } | ||
|
|
||
| th, td { | ||
| border: { | ||
| right: none; | ||
| left: none; | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cvetanovic please communicate with @jovana-marceta where she has found this shorter IF syntax for Scss because I was not able to find it the latest official docs (which doesn't mean it's not working).