Skip to content

Commit

Permalink
0.9.1006
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-cen committed Aug 18, 2024
1 parent 103d465 commit cca91a7
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 20 deletions.
14 changes: 7 additions & 7 deletions main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "make-md",
"name": "MAKE.md",
"version": "0.9.1005",
"version": "0.9.1006",
"minAppVersion": "0.16.0",
"description": "Make.md brings powerful and modern note-taking features to Obsidian. Capture, organize and connect information with more flexibility without any code.",
"author": "MAKE.md",
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": "make-md",
"version": "0.9.997",
"version": "0.9.1006",
"description": "make.md",
"main": "main.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { CollapseToggle } from "core/react/components/UI/Toggles/CollapseToggle"
import { compareByField } from "core/utils/tree";
import { genId } from "core/utils/uuid";
import { editorInfoField } from "obsidian";
import { Root } from "react-dom/client";

//flow editor
export enum FlowEditorState {
Expand Down Expand Up @@ -363,6 +364,7 @@ export const flowEditorField = (plugin: MakeMDPlugin) =>
});

class FlowEditorWidget extends WidgetType {
public root: Root;
constructor(
private readonly info: FlowEditorInfo,
public plugin: MakeMDPlugin
Expand All @@ -384,16 +386,15 @@ class FlowEditorWidget extends WidgetType {
const infoField = view.state.field(editorInfoField, false);
const file = infoField.file;

this.plugin.superstate.ui
.createRoot(div)
.render(
<NoteView
load={true}
superstate={this.plugin.superstate}
path={this.info.link}
source={file.path}
></NoteView>
);
this.root = this.plugin.superstate.ui.createRoot(div);
this.root.render(
<NoteView
load={true}
superstate={this.plugin.superstate}
path={this.info.link}
source={file.path}
></NoteView>
);
// this.plugin.superstate.ui.openPath(uri, false, div);
}
// loadFlowEditorByDOM(this.plugin, div, view, this.info.id);
Expand All @@ -402,6 +403,9 @@ class FlowEditorWidget extends WidgetType {
get estimatedHeight(): number {
return this.info.height;
}
destroy(dom: HTMLElement): void {
if (this.root) this.root.unmount();
}
}

class LinkSticker extends WidgetType {
Expand Down
4 changes: 4 additions & 0 deletions src/adapters/obsidian/ui/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class ObsidianUI implements UIAdapter {
this.root.render(<WindowManager ui={this}></WindowManager>);
}

public destroy = () => {
this.root.unmount();
};

public createRoot: typeof createRoot;
public getRoot: (container: Container) => Root;

Expand Down
1 change: 1 addition & 0 deletions src/core/react/components/PathView/NoteView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const NoteView = forwardRef((props: NoteViewProps, ref) => {
);

return () => {
flowRef.current = null;
props.superstate.ui.eventsDispatch.removeListener(
"activeStateChanged",
reloadFlow
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/formula/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export const runFormulaWithContext = (runContext: math.MathJsInstance, paths: Ma
} catch (e) {
value = ""
if (emitError) throw(e)
console.log(path, formula, e);
console.log(formula, e);
}
return value
}
Expand Down
4 changes: 4 additions & 0 deletions src/utils/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const parseParameters = (fieldValues: Record<string, string>, fields: Spa
};

export const parsePropertyValue = (value: any, type: string): any => {
if (!type) return value;
if (type == "number") {
return parseFloat(value);
} else if (type == "boolean") {
Expand All @@ -116,6 +117,9 @@ export const parsePropertyValue = (value: any, type: string): any => {
}

export const parseMDBStringValue = (type: string, value: string, frontmatter?: boolean): any => {
if (!type) {
return value;
}
if (type == "object") {
return JSON.parse(value);
} else if (type == 'object-multi') {
Expand Down

0 comments on commit cca91a7

Please sign in to comment.