Skip to content

Commit

Permalink
Merge pull request #1 from SparkleIdeas/dev
Browse files Browse the repository at this point in the history
Update Obsidian Leaf view
  • Loading branch information
Quorafind authored Nov 23, 2022
2 parents 1892aaa + 8a3f3f4 commit 328cea6
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 250 deletions.
28 changes: 1 addition & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
# obsidian-react-starter

Code From Original Template: [React Starter](https://github.com/obsidian-community/obsidian-react-starter)

A starter template for creating an [Obsidian](https://obsidian.md/) plugin with [ReactJS](https://reactjs.org/).

## Features

This project comes preconfigured with [Typescript](https://www.typescriptlang.org/), [Vite](https://vitejs.dev/) And [Less](https://lesscss.org/).

## Getting Started

Click "use this template" to create your own fork of this repo. Make sure to reference [the official sample plugin](https://github.com/obsidianmd/obsidian-sample-plugin) for information about how to get started with the Obsidian API and how to submit your plugin to the Community Plugin Gallery.

```bash
# for local development
yarn install
yarn dev

# for a production bundle
yarn install
yarn build
```

## Stats

The production output of this sample plugin is **~50 KB**.
Not Yet Usable
1 change: 0 additions & 1 deletion src/component/CompleteHiddenBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const CompleteHiddenBtn: React.FC<Props> = () => {

const handleClick = () => {
changeHiddenComplete();
renderAll();
};

return (
Expand Down
1 change: 0 additions & 1 deletion src/component/ResetBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const ResetBtn: React.FC<Props> = () => {

const handleClick = () => {
setGlobalTree(TreeNS.makeDefaultTree());
renderAll();
};

return (
Expand Down
5 changes: 3 additions & 2 deletions src/component/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const SearchBox: React.FC<Props> = () => {
const setGlobalTree = useBaseStore((state) => state.setGlobalTree);
const setGlobalTreeBak = useBaseStore((state) => state.setGlobalTreeBak);
const setSelected = useBaseStore((state) => state.setSelected);
const setGlobalRenderAllNoUndo = useBaseStore((state) => state.setGlobalRenderAllNoUndo);

const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
if (value?.length > 0) {
Expand All @@ -23,7 +24,7 @@ const SearchBox: React.FC<Props> = () => {
if (event.currentTarget.value.length === 0) {
setGlobalTree(globalTreeBak);
setGlobalTreeBak(null);
renderAllNoUndo();
setGlobalRenderAllNoUndo();
return;
}
if (!globalTreeBak) {
Expand All @@ -32,7 +33,7 @@ const SearchBox: React.FC<Props> = () => {
} else {
setGlobalTree(TreeNS.search(globalTree, event.currentTarget.value));
}
renderAllNoUndo();
setGlobalRenderAllNoUndo();
};

const handleFocus = () => {
Expand Down
26 changes: 26 additions & 0 deletions src/component/tree/TreeChildren.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import TreeNode from "./TreeNode";
import { Tree } from "../../types/tree";

interface Props {
style?: React.CSSProperties;
childNodes: Tree[];
}

const TreeChildren: React.FC<Props> = (props) => {
const { childNodes, style } = props;
let childNodeJSX;
if (childNodes != null) {
childNodeJSX = childNodes.map((node) => {
return (
<li key={ node.uuid }>
<TreeNode topBullet={ false } node={ node }/>
</li>
);
});
}

return (<ul style={ style }>{ childNodeJSX }</ul>);
};

export default TreeChildren;
Loading

0 comments on commit 328cea6

Please sign in to comment.