Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"packageManager": "yarn@4.9.3"
"packageManager": "yarn@4.10.3"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{#> code-editor}}
{{#> code-editor-header}}
{{> code-editor-header-main}}
{{#> code-editor-tab}}
{{#> code-editor-tab-icon}}
<i class="fas fa-code" aria-hidden="true"></i>
Expand Down
22 changes: 20 additions & 2 deletions src/patternfly/components/CodeEditor/code-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

// tab
--#{$code-editor}__tab--BackgroundColor: var(--pf-t--global--background--color--primary--default);
--#{$code-editor}--m-read-only__tab--BackgroundColor: var(--#{$code-editor}--m-read-only__main--BackgroundColor);
--#{$code-editor}__tab--Color: var(--pf-t--global--text--color--subtle);
--#{$code-editor}__tab--PaddingBlockStart: var(--pf-t--global--spacer--sm);
--#{$code-editor}__tab--PaddingInlineEnd: var( --pf-t--global--spacer--sm);
Expand All @@ -79,6 +80,7 @@
flex-direction: column;

&.pf-m-read-only {
--#{$code-editor}__tab--BackgroundColor: var(--#{$code-editor}--m-read-only__tab--BackgroundColor);
--#{$code-editor}__main--BackgroundColor: var(--#{$code-editor}--m-read-only__main--BackgroundColor);
}

Expand All @@ -97,18 +99,33 @@
position: relative;
display: flex;

&::before {
&::before,
&::after {
position: absolute;
pointer-events: none;
content: "";
}

&::after {
position: absolute;
inset: 0;
pointer-events: none;
content: "";
border: var(--#{$code-editor}__header--BorderWidth) solid var(--#{$code-editor}__header--BorderColor);
border-block-end: var(--#{$code-editor}__header--before--BorderBlockEndWidth) solid var(--#{$code-editor}__header--before--BorderBlockEndColor); // TODO - remove in breaking change
border-block-end-width: 0;
border-start-start-radius: var(--#{$code-editor}__header--BorderStartStartRadius);
border-start-end-radius: var(--#{$code-editor}__header--BorderStartEndRadius);
}

&::before {
inset-block-end: 0;
inset-inline-start: 0;
inset-inline-end: 0;
border-block-end: var(--#{$code-editor}__header--before--BorderBlockEndWidth) solid var(--#{$code-editor}__header--before--BorderBlockEndColor);
}

&.pf-m-plain {
--#{$code-editor}__header--BorderWidth: 0;
--#{$code-editor}__header-content--BackgroundColor: var(--#{$code-editor}__header-content--m-plain--BackgroundColor);
}
}
Expand Down Expand Up @@ -212,6 +229,7 @@
padding-block-end: var(--#{$code-editor}__tab--PaddingBlockEnd);
padding-inline-start: var(--#{$code-editor}__tab--PaddingInlineStart);
padding-inline-end: var(--#{$code-editor}__tab--PaddingInlineEnd);
margin-inline-start: auto;
color: var(--#{$code-editor}__tab--Color);
background-color: var(--#{$code-editor}__tab--BackgroundColor);
border-color: var(--#{$code-editor}__tab--BorderColor);
Expand Down
18 changes: 17 additions & 1 deletion src/patternfly/components/CodeEditor/examples/CodeEditor.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ import './CodeEditor.css';
{{> code-editor-template-no-actions}}
```

### Without language tab

```hbs
{{#> code-editor}}
{{#> code-editor-header}}
{{/code-editor-header}}
{{#> code-editor-main}}
{{#> code-editor-code}}
{{#> code-editor-code-pre}}
code goes here
{{/code-editor-code-pre}}
{{/code-editor-code}}
{{/code-editor-main}}
{{/code-editor}}
```

### Drag file and hover over component

```hbs
Expand Down Expand Up @@ -215,7 +231,7 @@ This is an extra container used in React to prevent event propagation if upload
| Class | Applied to | Outcome |
| ------------------------------------------ | ---------- | --------------------------------------------------------------------------------------------- |
| `.pf-v6-c-code-editor` | `<div>` | Initiates the code editor component. **Required** |
| `.pf-v6-c-code-editor__header` | `<div>` | Initiates the code editor header used for the controls and tab elements. **Required** |
| `.pf-v6-c-code-editor__header` | `<div>` | Initiates the code editor header used for the controls and tab elements. |
| `.pf-v6-c-code-editor__header-content` | `<div>` | Initiates the code editor header content used for the controls and tab elements. **Required** |
| `.pf-v6-c-code-editor__main` | `<div>` | Initiates the main container for a code editor e.g. Monaco **Required** |
| `.pf-v6-c-code-editor__code` | `<div>` | Initiates the container for code without a JS code editor. Comes with PatternFly styling. |
Expand Down