Skip to content

Commit f665822

Browse files
committed
Merge branch 'release/v1.3.1'
2 parents 5108813 + 1a1fb7b commit f665822

File tree

7 files changed

+443
-591
lines changed

7 files changed

+443
-591
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [freder]
2+
custom: https://www.buymeacoffee.com/freder

changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.3.1
4+
### Added
5+
- Show notification when current page is not supported (e.g. `Journals`)
6+
- Ignore horizonal lines (`---`)
7+
38

49
## 1.3.0
510
### Added

package-lock.json

+412-572
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logseq-plugin-jump-to-block",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"main": "dist/index.html",
55
"logseq": {
66
"id": "logseq-plugin-jump-to-block"
@@ -34,7 +34,7 @@
3434
"eslint-plugin-functional": "^5.0.6",
3535
"eslint-plugin-react": "^7.32.2",
3636
"eslint-plugin-react-hooks": "^4.6.0",
37-
"typescript": "^4.9.3",
37+
"typescript": "^5.0.3",
3838
"vite": "^4.2.0"
3939
}
4040
}

src/components/App.tsx

+9-15
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import type { BlockEntity } from '@logseq/libs/dist/LSPlugin.user';
33

44
import React, { useEffect, useState, Fragment } from 'react';
55
import CommandPalette, { Command } from 'react-command-palette';
6-
import markdownToTxt from 'markdown-to-txt';
76
import * as R from 'ramda';
87
import { Global, css } from '@emotion/react';
98

9+
import { prepareLabel } from '../utils';
10+
1011
// @ts-ignore
1112
import theme from '../../node_modules/react-command-palette/dist/themes/sublime-theme';
1213
import '../../node_modules/react-command-palette/dist/themes/sublime.css';
@@ -54,17 +55,6 @@ const selectionHandler = async (
5455
};
5556

5657

57-
const prepareLabel = (blockContent: string) => {
58-
return markdownToTxt(blockContent)
59-
// ::collapsed true
60-
.replaceAll(/[^\W\n]+::\W[^\W]+/gmi, '')
61-
// {:width 400}
62-
.replaceAll(/\{:.*\}/gmi, '')
63-
.replaceAll(/^(TODO|DOING|DONE) /gmi, '')
64-
.trim();
65-
};
66-
67-
6858
const makeCommands = (
6959
blocks: BlockEntity[],
7060
maxDepth = Infinity
@@ -79,10 +69,13 @@ const makeCommands = (
7969
return;
8070
}
8171
const blockContent = (block.content || '').trim();
72+
8273
// ignore empty blocks
83-
if (blockContent === '') {
84-
return;
85-
}
74+
if (blockContent === '') { return; }
75+
76+
// ignore horizontal lines
77+
if (blockContent === '---') { return; }
78+
8679
const cmd: Command = {
8780
// @ts-expect-error
8881
id: block.uuid,
@@ -127,6 +120,7 @@ function App() {
127120
if (visible) {
128121
const pageOrBlock = await logseq.Editor.getCurrentPage();
129122
if (!pageOrBlock) {
123+
logseq.UI.showMsg('This page is not supported', 'warning');
130124
return closeHandler();
131125
}
132126

src/main.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const settings: SettingSchemaDesc[] = [
2626
{
2727
key: 'autoOpen',
2828
title: 'Auto-open palette',
29-
description: 'Autmatically open the palette on opening a page',
29+
description: 'Automatically open the palette on opening a page',
3030
default: false,
3131
type: 'boolean',
3232
},
@@ -69,7 +69,6 @@ const main = async () => {
6969
'toolbar',
7070
{
7171
key: 'jump-to-block',
72-
// TODO: add icon
7372
template: `${makeToolbarIcon(cmdLabel)}\n`,
7473
}
7574
);

src/utils/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import markdownToTxt from 'markdown-to-txt';
2+
3+
4+
export const prepareLabel = (blockContent: string) => {
5+
return markdownToTxt(blockContent)
6+
// ::collapsed true
7+
.replaceAll(/[^\W\n]+::\W[^\W]+/gmi, '')
8+
// {:width 400}
9+
.replaceAll(/\{:.*\}/gmi, '')
10+
.replaceAll(/^(TODO|DOING|DONE) /gmi, '')
11+
.trim();
12+
};

0 commit comments

Comments
 (0)