Skip to content

Commit

Permalink
Merge branch 'release/v1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
freder committed Apr 2, 2023
2 parents 5108813 + 1a1fb7b commit f665822
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 591 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [freder]
custom: https://www.buymeacoffee.com/freder
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.3.1
### Added
- Show notification when current page is not supported (e.g. `Journals`)
- Ignore horizonal lines (`---`)


## 1.3.0
### Added
Expand Down
984 changes: 412 additions & 572 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logseq-plugin-jump-to-block",
"version": "1.3.0",
"version": "1.3.1",
"main": "dist/index.html",
"logseq": {
"id": "logseq-plugin-jump-to-block"
Expand Down Expand Up @@ -34,7 +34,7 @@
"eslint-plugin-functional": "^5.0.6",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"typescript": "^4.9.3",
"typescript": "^5.0.3",
"vite": "^4.2.0"
}
}
24 changes: 9 additions & 15 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import type { BlockEntity } from '@logseq/libs/dist/LSPlugin.user';

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

import { prepareLabel } from '../utils';

// @ts-ignore
import theme from '../../node_modules/react-command-palette/dist/themes/sublime-theme';
import '../../node_modules/react-command-palette/dist/themes/sublime.css';
Expand Down Expand Up @@ -54,17 +55,6 @@ const selectionHandler = async (
};


const prepareLabel = (blockContent: string) => {
return markdownToTxt(blockContent)
// ::collapsed true
.replaceAll(/[^\W\n]+::\W[^\W]+/gmi, '')
// {:width 400}
.replaceAll(/\{:.*\}/gmi, '')
.replaceAll(/^(TODO|DOING|DONE) /gmi, '')
.trim();
};


const makeCommands = (
blocks: BlockEntity[],
maxDepth = Infinity
Expand All @@ -79,10 +69,13 @@ const makeCommands = (
return;
}
const blockContent = (block.content || '').trim();

// ignore empty blocks
if (blockContent === '') {
return;
}
if (blockContent === '') { return; }

// ignore horizontal lines
if (blockContent === '---') { return; }

const cmd: Command = {
// @ts-expect-error
id: block.uuid,
Expand Down Expand Up @@ -127,6 +120,7 @@ function App() {
if (visible) {
const pageOrBlock = await logseq.Editor.getCurrentPage();
if (!pageOrBlock) {
logseq.UI.showMsg('This page is not supported', 'warning');
return closeHandler();
}

Expand Down
3 changes: 1 addition & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const settings: SettingSchemaDesc[] = [
{
key: 'autoOpen',
title: 'Auto-open palette',
description: 'Autmatically open the palette on opening a page',
description: 'Automatically open the palette on opening a page',
default: false,
type: 'boolean',
},
Expand Down Expand Up @@ -69,7 +69,6 @@ const main = async () => {
'toolbar',
{
key: 'jump-to-block',
// TODO: add icon
template: `${makeToolbarIcon(cmdLabel)}\n`,
}
);
Expand Down
12 changes: 12 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import markdownToTxt from 'markdown-to-txt';


export const prepareLabel = (blockContent: string) => {
return markdownToTxt(blockContent)
// ::collapsed true
.replaceAll(/[^\W\n]+::\W[^\W]+/gmi, '')
// {:width 400}
.replaceAll(/\{:.*\}/gmi, '')
.replaceAll(/^(TODO|DOING|DONE) /gmi, '')
.trim();
};

0 comments on commit f665822

Please sign in to comment.