Skip to content

Commit

Permalink
Markdown links with file protocol should now work (#360). Another fix…
Browse files Browse the repository at this point in the history
… for missing scrollbar (#639).
  • Loading branch information
ransome1 committed Feb 9, 2024
1 parent 16d7b76 commit 3ed291e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion flatpak/com.github.ransome1.sleek.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<developer_name>Robin Ahle</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="2.0.9-rc.3" date="2024-02-08"/>
<release version="2.0.9-rc.4" date="2024-02-09"/>
</releases>
<url type="homepage">https://github.com/ransome1/sleek</url>
<url type="contact">https://github.com/ransome1/sleek/issues</url>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.9-rc.3",
"version": "2.0.9-rc.4",
"main": "./src/main/main.tsx",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.9-rc.3",
"version": "2.0.9-rc.4",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sleek
base: core20
version: "2.0.9-rc.3"
version: "2.0.9-rc.4"
summary: todo.txt manager for Linux, free and open-source (FOSS)
description: |
sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done.
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ body {
font-family: "Helvetica, Arial, Sans-Serif";
code {
font-size: 0.9em;

background-color: rgba(18, 18, 18, 0.15);
border-radius: 0.25em;
padding: 0.25em;
white-space: nowrap;
}
#root {
.flexContainer {
Expand Down
9 changes: 4 additions & 5 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ const App = () => {
const [triggerArchiving, setTriggerArchiving] = useState<boolean>(false);
const searchFieldRef = useRef<HTMLInputElement>(null);
const [attributeMapping] = useState<TranslatedAttributes>(translatedAttributes(i18n.t) || {});
const [visibleRowCount, setVisibleRowCount] = useState(30);
const [visibleRowCount, setVisibleRowCount] = useState(50);
const [loadMoreRows, setLoadMoreRows] = useState(true);

useEffect(() => {
setSnackBarOpen(Boolean(snackBarContent));
}, [snackBarContent]);

useEffect(() => {
setVisibleRowCount(30);
setLoadMoreRows(true);
if(settings.files?.length === 0) {
setTodoObjects(null);
}
Expand All @@ -83,8 +81,9 @@ const App = () => {

useEffect(() => {
const windowHeight = window.innerHeight;
const calculatedRowCount = Math.floor(windowHeight / 35);
setVisibleRowCount(calculatedRowCount * 1.5);
const calculatedRowCount = Math.floor(windowHeight / 35) * 2;
setVisibleRowCount(calculatedRowCount);
setLoadMoreRows(true);
ipcRenderer.send('requestData');
}, []);

Expand Down
12 changes: 5 additions & 7 deletions src/renderer/Grid/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,18 @@ const RendererComponent = ({ todoObject, filters, settings, handleButtonClick })
hidden: () => null as React.ReactNode,
};

const transformURL = (uri, children, title) => {
return uri;
};

const options = {
p: ({children}) => {
const modifiedChildren = React.Children.map(children, (child) => {

if(typeof child === 'object') return child;

let modifiedChild = child.split(/(\S+\s*)/).filter(Boolean);

expressions.forEach(({ pattern, type }) => {

modifiedChild = reactStringReplace(modifiedChild, pattern, (match, i) => {

const selected = filters && type !== null && (filters[type as keyof Filters] || []).some((filter: Filter) => filter.value === match);

return (
<span className={selected ? 'filter selected' : 'filter'} data-todotxt-attribute={type}>
{replacements[type](match, type)}
Expand All @@ -104,7 +102,7 @@ const RendererComponent = ({ todoObject, filters, settings, handleButtonClick })
},
};

return <ReactMarkdown remarkPlugins={[remarkGfm]} components={options}>{todoObject.body}</ReactMarkdown>;
return <ReactMarkdown remarkPlugins={[remarkGfm]} components={options} urlTransform={transformURL}>{todoObject.body}</ReactMarkdown>;
};

export default RendererComponent;

0 comments on commit 3ed291e

Please sign in to comment.