Skip to content

Commit 75229bb

Browse files
authored
Merge pull request #151 from KevinBatdorf/fix-overflow-issue
2 parents 6692e2d + 9b023bd commit 75229bb

7 files changed

Lines changed: 34 additions & 25 deletions

File tree

pattern-css.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Lightening Fast, Safe, In-editor CSS Optimization and Minification Tool
66
* Requires at least: 6.7
77
* Requires PHP: 7.0
8-
* Version: 1.5.1
8+
* Version: 1.5.2
99
* Author: Kevin Batdorf
1010
* Author URI: https://twitter.com/kevinbatdorf
1111
* License: GPL-2.0-or-later

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: kbat82
33
Tags: block, css, styles, inline, editor
44
Tested up to: 6.8
5-
Stable tag: 1.5.1
5+
Stable tag: 1.5.2
66
License: GPL-2.0-or-later
77
License URI: https://www.gnu.org/licenses/gpl-2.0.html
88

@@ -141,6 +141,9 @@ Add this to functions.php:
141141

142142
== Changelog ==
143143

144+
= 1.5.2 - 2025-05-21 =
145+
- Fixes an overflow bug in the editor
146+
144147
= 1.5.1 - 2025-05-18 =
145148
- Retagging for release
146149

src/components/BlockControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const BlockControl = (
183183
<PopoutEditor>
184184
<>
185185
<div
186-
className="relative flex-grow"
186+
className="overfow-x-hidden relative flex-grow overflow-y-auto border border-solid border-gray-600"
187187
ref={editorWrapperRef}>
188188
<CodeEditor
189189
value={css ?? defaultCssExample}

src/components/CodeEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ export const CodeEditor = forwardRef((props: CodeEditorProps, ref) => {
3434

3535
if (loading)
3636
return (
37-
<div className="lex h-full min-h-52 items-center justify-center border border-solid border-gray-600 bg-gray-100 p-4 text-gray-900">
37+
<div className="flex h-full min-h-52 items-center justify-center p-4 text-gray-900">
3838
{'Loading...'}
3939
</div>
4040
);
4141
if (editorError) return <p>{editorError.message}</p>;
4242

4343
return (
44-
<div ref={textAreaRef} className="h-full">
44+
<div ref={textAreaRef} className="">
4545
<Editor
4646
// eslint-disable-next-line
4747
// @ts-ignore-next-line
4848
ref={ref}
4949
value={decodeEntities(value)}
50-
className="h-full border border-solid border-gray-600 font-jetbrains-mono"
50+
className="h-full font-jetbrains-mono"
5151
onValueChange={onChange}
5252
{...remainingProps}
5353
padding={{

src/components/EditorControls.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const EditorControls = ({
5656
className="lowercase hover:bg-gray-100 hover:text-gray-900">
5757
{
5858
// translators: Popout as in Popout the editor
59-
__('Global Styles', 'pattern-css')
59+
__('Global', 'pattern-css')
6060
}
6161
</Button>
6262
</Tooltip>
@@ -77,7 +77,8 @@ export const EditorControls = ({
7777
</Tooltip>
7878
)}
7979
{popoutOpen ? (
80-
<Tooltip text={__('Toggle highlight', 'pattern-css')}>
80+
<Tooltip
81+
text={__('Highlight the current block', 'pattern-css')}>
8182
<Button
8283
size="small"
8384
variant="tertiary"
@@ -90,7 +91,7 @@ export const EditorControls = ({
9091
className={`lowercase hover:bg-gray-100 hover:text-gray-900 ${
9192
isHighlighted ? 'bg-gray-100' : ''
9293
}`}>
93-
{__('Highlight Block', 'pattern-css')}
94+
{__('Highlight', 'pattern-css')}
9495
</Button>
9596
</Tooltip>
9697
) : null}

src/components/FloatingWindow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const FloatingWindow = forwardRef<HTMLDivElement, FloatingWindowProps>(
5555
style={{ top, left, width, height }}
5656
ref={ref}>
5757
<>
58-
<div className="flex items-center justify-between">
58+
<div className="flex flex-shrink-0 items-center justify-between">
5959
<div
6060
data-pcss-handle
6161
draggable
@@ -73,12 +73,12 @@ export const FloatingWindow = forwardRef<HTMLDivElement, FloatingWindowProps>(
7373
showTooltip={false}
7474
/>
7575
</div>
76-
<div className="relative z-50 flex h-full flex-col px-4 pb-4">
76+
<div className="relative z-50 flex min-h-0 flex-grow flex-col px-4 pb-4">
7777
{children}
7878
</div>
7979
<div
8080
data-pcss-resize
81-
className="absolute bottom-0 right-0 z-high h-6 w-6">
81+
className="absolute -bottom-1 -right-1 z-high h-6 w-6">
8282
<div className="h-6 w-6 cursor-se-resize border border-l-0 border-t-0 border-solid border-transparent transition-colors duration-300 hover:border-gray-600 active:border-gray-600" />
8383
</div>
8484
</>

src/components/GlobalEditor.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,30 +164,35 @@ const TheEditor = ({
164164
}, [savingState]);
165165

166166
return (
167-
<div className="relative flex-grow" ref={editorWrapperRef}>
168-
<CodeEditor
169-
value={css}
170-
onChange={handleChange}
171-
lineOptions={warnings.map(({ loc }) => ({
172-
line: loc.line,
173-
classes: ['line-error'],
174-
}))}
175-
/>
167+
<div className="relative flex min-h-0 flex-grow flex-col">
168+
<div
169+
className="min-h-0 flex-grow overflow-y-auto overflow-x-hidden border border-solid border-gray-600"
170+
ref={editorWrapperRef}>
171+
<CodeEditor
172+
value={css}
173+
onChange={handleChange}
174+
lineOptions={warnings.map(({ loc }) => ({
175+
line: loc.line,
176+
classes: ['line-error'],
177+
}))}
178+
/>
179+
</div>
176180
{savingState === 'saving' && (
177-
<div className="absolute bottom-px right-1 z-10 flex items-center justify-center bg-white/50">
178-
<span className="text-sm text-gray-700 dark:text-gray-400">
181+
<div className="absolute bottom-px right-1 z-10 flex items-center justify-center bg-white p-1">
182+
<span className="text-sm text-gray-700">
179183
{__('Saving...', 'pattern-css')}
180184
</span>
181185
</div>
182186
)}
183187
{savingState === 'saved' && (
184-
<div className="absolute bottom-px right-1 z-10 flex items-center justify-center bg-white/50">
188+
<div className="absolute bottom-px right-1 z-10 flex items-center justify-center bg-white p-1">
185189
<Icon
186190
icon={check}
191+
size={20}
187192
className="stroke-gray-700"
188193
color="currentColor"
189194
/>
190-
<span className="text-sm text-gray-700 dark:text-gray-400">
195+
<span className="text-sm text-gray-700">
191196
{__('Saved!', 'pattern-css')}
192197
</span>
193198
</div>

0 commit comments

Comments
 (0)