Skip to content

Commit 89871ea

Browse files
arvinxxclaude
andauthored
🐛 fix(markdown): remove background from table body (#503)
* 🐛 fix(sortable-list): fix DragOverlay position issues and add renderOverlay prop (#420) Apply changes from PR #420 resolved against current master: - Add closestCenter collision detection and MeasuringStrategy.Always to fix overlay positioning - Add renderOverlay prop for custom drag overlay rendering - Add demo controls for custom overlay Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix(markdown): remove background from table body Drop the table-level background so tbody renders transparent. Thead keeps its own explicit background rule and is unaffected. Also replace deprecated `word-break: break-word` with `overflow-wrap: break-word` to satisfy stylelint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 49ca0c4 commit 89871ea

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

src/Markdown/markdown.style.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const styles = createStaticStyles(({ cssVar, css }) => {
1919
2020
font-size: var(--lobe-markdown-font-size);
2121
line-height: var(--lobe-markdown-line-height);
22-
word-break: break-word;
22+
overflow-wrap: break-word;
2323
`;
2424
const a = css`
2525
a {
@@ -57,7 +57,7 @@ export const styles = createStaticStyles(({ cssVar, css }) => {
5757
font-family: ${cssVar.fontFamilyCode};
5858
font-size: 0.875em;
5959
line-height: 1;
60-
word-break: break-word;
60+
overflow-wrap: break-word;
6161
white-space: break-spaces;
6262
6363
background: ${cssVar.colorFillSecondary};
@@ -301,11 +301,10 @@ export const styles = createStaticStyles(({ cssVar, css }) => {
301301
word-break: auto-phrase;
302302
overflow-wrap: break-word;
303303
304-
background: ${cssVar.colorFillQuaternary};
305304
box-shadow: 0 0 0 1px ${cssVar.colorBorderSecondary};
306305
307306
code {
308-
word-break: break-word;
307+
overflow-wrap: break-word;
309308
}
310309
311310
thead {

src/SortableList/SortableList.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import {
44
type Active,
5+
closestCenter,
56
DndContext,
67
KeyboardSensor,
8+
MeasuringStrategy,
79
PointerSensor,
810
useSensor,
911
useSensors,
@@ -25,8 +27,14 @@ import SortableOverlay from './components/SortableOverlay';
2527
import { styles } from './style';
2628
import { type SortableListItem, type SortableListProps } from './type';
2729

30+
const measuringConfig = {
31+
droppable: {
32+
strategy: MeasuringStrategy.Always,
33+
},
34+
};
35+
2836
const SortableListParent = memo<SortableListProps>(
29-
({ ref, items, onChange, renderItem, gap = 8, ...rest }) => {
37+
({ ref, items, onChange, renderItem, renderOverlay, gap = 8, ...rest }) => {
3038
const [active, setActive] = useState<Active | null>(null);
3139
const activeItem = useMemo(() => items.find((item) => item.id === active?.id), [active, items]);
3240
const sensors = useSensors(
@@ -36,8 +44,12 @@ const SortableListParent = memo<SortableListProps>(
3644
}),
3745
);
3846

47+
const overlayRenderer = renderOverlay ?? renderItem;
48+
3949
return (
4050
<DndContext
51+
collisionDetection={closestCenter}
52+
measuring={measuringConfig}
4153
modifiers={[restrictToVerticalAxis, restrictToWindowEdges]}
4254
sensors={sensors}
4355
onDragCancel={() => {
@@ -63,7 +75,7 @@ const SortableListParent = memo<SortableListProps>(
6375
))}
6476
</Flexbox>
6577
</SortableContext>
66-
<SortableOverlay>{activeItem ? renderItem(activeItem) : null}</SortableOverlay>
78+
<SortableOverlay>{activeItem ? overlayRenderer(activeItem) : null}</SortableOverlay>
6779
</DndContext>
6880
);
6981
},

src/SortableList/demos/index.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ export default () => {
2424
const [items, setItems] = useState(data);
2525

2626
const store = useCreateStore();
27-
const { gap, ...control }: any = useControls(
27+
const { gap, useCustomOverlay, ...control }: any = useControls(
2828
{
2929
gap: {
3030
max: 20,
3131
min: 0,
3232
step: 1,
3333
value: 4,
3434
},
35+
useCustomOverlay: false,
3536
variant: {
3637
options: ['borderless', 'filled', 'outlined'],
3738
value: 'borderless',
@@ -51,6 +52,24 @@ export default () => {
5152
{item.name}
5253
</SortableList.Item>
5354
)}
55+
renderOverlay={
56+
useCustomOverlay
57+
? (item) => (
58+
<div
59+
style={{
60+
background: 'rgba(0, 100, 255, 0.1)',
61+
border: '2px dashed #0064ff',
62+
borderRadius: 8,
63+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
64+
padding: '8px 12px',
65+
transform: 'rotate(2deg)',
66+
}}
67+
>
68+
📦 {item.name}
69+
</div>
70+
)
71+
: undefined
72+
}
5473
onChange={setItems}
5574
/>
5675
</StoryBook>

src/SortableList/type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ export interface SortableListProps<T extends SortableListItem = SortableListItem
1414
onChange: (items: T[]) => void;
1515
ref?: Ref<HTMLUListElement>;
1616
renderItem: (item: T) => ReactNode;
17+
/**
18+
* Custom render function for the drag overlay
19+
* If not provided, renderItem will be used
20+
*/
21+
renderOverlay?: (item: T) => ReactNode;
1722
}

0 commit comments

Comments
 (0)