Skip to content

Commit

Permalink
Use static renderer for table cell lane titles
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Apr 15, 2024
1 parent 0a040d4 commit d121ce1
Show file tree
Hide file tree
Showing 4 changed files with 2,649 additions and 15 deletions.
19 changes: 11 additions & 8 deletions src/components/MarkdownRenderer/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ export const StaticMarkdownRenderer = memo(function StaticMarkdownRenderer({
}, [searchQuery]);

return (
<div
ref={(node) => {
wrapperRef.current = node;
appendOrReplaceFirstChild(node, contentRef.current);
}}
className={classcat(['markdown-preview-view', c('markdown-preview-view'), className])}
{...divProps}
/>
<div className={classcat([c('markdown-preview-wrapper'), className])} {...divProps}>
<div>
<div
className={classcat(['markdown-preview-view', c('markdown-preview-view')])}
ref={(node) => {
wrapperRef.current = node;
appendOrReplaceFirstChild(node, contentRef.current);
}}
></div>
</div>
</div>
);
});

Expand Down
8 changes: 2 additions & 6 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { ItemCheckbox } from '../Item/ItemCheckbox';
import { ItemContent, Tags, useDatePickers } from '../Item/ItemContent';
import { useItemMenu } from '../Item/ItemMenu';
import { MetadataValue, anyToString } from '../Item/MetadataTable';
import { MarkdownPreviewRenderer } from '../MarkdownRenderer/MarkdownRenderer';
import { StaticMarkdownRenderer } from '../MarkdownRenderer/MarkdownRenderer';
import { KanbanContext, SearchContext } from '../context';
import { c } from '../helpers';
import { Board, Item, Lane } from '../types';
Expand Down Expand Up @@ -215,11 +215,7 @@ function LaneCell({ lane, path }: { lane: Lane; path: number[] }) {
const search = useContext(SearchContext);
return (
<div className={c('cell-flex-wrapper')}>
<MarkdownPreviewRenderer
entityId={lane.id}
searchQuery={search?.query}
markdownString={lane.data.title}
/>
<StaticMarkdownRenderer searchQuery={search?.query} markdownString={lane.data.title} />
<div
onClick={(e) => {
const menu = new Menu();
Expand Down
10 changes: 10 additions & 0 deletions src/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,16 @@ button.kanban-plugin__new-item-button {
--p-spacing: var(--size-4-2);
--list-indent: 1.75em;

.kanban-plugin__markdown-preview-view {
> div > *:first-child {
margin-block-start: 0;
}

> div > *:last-child {
margin-block-end: 0;
}
}

> div > .markdown-preview-view {
width: unset;
height: unset;
Expand Down
2,627 changes: 2,626 additions & 1 deletion styles.css

Large diffs are not rendered by default.

0 comments on commit d121ce1

Please sign in to comment.