Skip to content

Commit 25f1647

Browse files
committed
Fix Browse button text clipped in image popup and make form inputs full-width
The CSS rule .jodit-tab.jodit-tab_empty { min-width: 220px } never matched because tabs.ts created a child div with class jodit-tab_empty instead of adding the class to the .jodit-tab element itself. This caused the popup to remain too narrow (193px), clipping the Browse button text. Also added flex: 1 to inputs/selects inside UIBlock so form fields stretch to full width in link popup and other forms. Fixes #1318
1 parent ec123cd commit 25f1647

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#### :bug: Bug Fix
1515

1616
- Fix table column operations (insert before/after, delete) affecting wrong column when cells are merged [#1334](https://github.com/xdan/jodit/issues/1334)
17+
- Fix Browse button text clipped in image popup when filebrowser is configured [#1318](https://github.com/xdan/jodit/issues/1318)
18+
19+
#### :nail_care: Polish
20+
21+
- Make form inputs stretch to full width inside UIBlock (link popup, image popup)
1722

1823
## 4.9.17
1924

src/core/ui/form/block/block.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
justify-content: stretch;
55
margin-bottom: var(--padding-default);
66

7+
> .jodit-ui-input,
8+
> .jodit-ui-select {
9+
flex: 1;
10+
}
11+
712
&_width {
813
&_full {
914
width: 100%;

src/modules/widget/tabs/tabs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const TabsWidget = (
128128
: content
129129
);
130130
} else {
131-
tab.appendChild(jodit.c.div('jodit-tab_empty'));
131+
tab.classList.add('jodit-tab_empty');
132132
}
133133

134134
tabBox.appendChild(tab);

src/plugins/image/image.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,43 @@
55
*/
66
describe('Process Images plugins', function () {
77
describe('Toolbar', function () {
8+
describe('Click on Image button with filebrowser', function () {
9+
it('Should show Browse tab button without text clipping', function () {
10+
const editor = getJodit({
11+
filebrowser: {
12+
ajax: {
13+
url: 'https://example.com/filebrowser'
14+
}
15+
}
16+
});
17+
18+
clickButton('image', editor);
19+
const popup = getOpenedPopup(editor);
20+
expect(popup).is.not.null;
21+
22+
const tabButtons = popup.querySelectorAll(
23+
'.jodit-tabs__button'
24+
);
25+
expect(tabButtons.length).to.be.at.least(2);
26+
27+
const browseBtn = Array.from(tabButtons).find(
28+
btn => btn.textContent.trim() === 'Browse'
29+
);
30+
expect(browseBtn).is.not.undefined;
31+
32+
const textEl = browseBtn.querySelector(
33+
'.jodit-ui-button__text'
34+
);
35+
expect(textEl).is.not.null;
36+
37+
// The text element should not clip its content
38+
expect(textEl.scrollWidth).to.be.at.most(
39+
textEl.clientWidth,
40+
'Browse button text is clipped (scrollWidth > clientWidth)'
41+
);
42+
});
43+
});
44+
845
describe('Click on Image button', function () {
946
it('Should open image dialog and insert image by url.', function () {
1047
const editor = getJodit();

0 commit comments

Comments
 (0)