Skip to content

Commit

Permalink
0.9.991 hot patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-cen committed Jul 15, 2024
1 parent b115f39 commit 72df223
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 98 deletions.
108 changes: 67 additions & 41 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.99",
"version": "0.9.991",
"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.99",
"version": "0.9.991",
"description": "make.md",
"main": "main.js",
"scripts": {
Expand Down
12 changes: 12 additions & 0 deletions src/adapters/obsidian/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,18 @@ containerEl.createEl("h3", { text: t.settings.sectionStickers });
})
);

new Setting(containerEl)
.setName(t.settings.inlineContextProperties.name)
.setDesc(t.settings.inlineContextProperties.desc)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.superstate.settings.inlineContextProperties)
.onChange((value) => {
this.plugin.superstate.settings.inlineContextProperties = value;
this.plugin.saveSettings();
this.plugin.reloadExtensions(false);
})
);
new Setting(containerEl)
.setName(t.settings.inlineContextExpanded.name)
.setDesc(t.settings.inlineContextExpanded.desc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,30 +279,35 @@ export const flowEditorInfo = StateField.define<FlowEditorInfo[]>({
const flowEditorRangeset = (state: EditorState, plugin: MakeMDPlugin) => {
const builder = new RangeSetBuilder<Decoration>();
const infoFields = state.field(flowEditorInfo, false);
const values = [] as { start: number; end: number; decoration: Decoration }[];
for (const info of infoFields) {
const { from, to, type, expandedState } = info;
const lineFix =
from - 3 == state.doc.lineAt(from).from &&
to + 2 == state.doc.lineAt(from).to;
if (type == FlowEditorLinkType.Link) {
builder.add(
from - 2,
from - 2,
Decoration.widget({
values.push({
start: from - 2,
end: from - 2,
decoration: Decoration.widget({
widget: new LinkSticker(info, plugin),
side: -1,
})
);
builder.add(
to + 2,
to + 2,
Decoration.widget({
}),
});
values.push({
start: to + 2,
end: to + 2,
decoration: Decoration.widget({
widget: new LinkExpand(info, plugin),
side: 0,
})
);
}),
});
if (expandedState == FlowEditorState.Open) {
builder.add(to + 2, to + 2, flowEditorDecoration(info, plugin));
values.push({
start: to + 2,
end: to + 2,
decoration: flowEditorDecoration(info, plugin),
});
}
} else if (
expandedState == FlowEditorState.Open &&
Expand All @@ -316,19 +321,31 @@ const flowEditorRangeset = (state: EditorState, plugin: MakeMDPlugin) => {
state.selection.main.to <= to + 1)
)
) {
builder.add(from - 4, from - 3, flowEditorSelector(info, plugin));
values.push({
start: from - 4,
end: from - 3,
decoration: flowEditorSelector(info, plugin),
});
if (lineFix) {
builder.add(
from - 3,
to + 2,
flowEditorWidgetDecoration(info, plugin)
);
values.push({
start: from - 3,
end: to + 2,
decoration: flowEditorWidgetDecoration(info, plugin),
});
} else {
builder.add(from - 3, to + 2, flowEditorDecoration(info, plugin));
values.push({
start: from - 3,
end: to + 2,
decoration: flowEditorDecoration(info, plugin),
});
}
}
}
}
values.sort(compareByField("start", true));
for (const value of values) {
builder.add(value.start, value.end, value.decoration);
}
const dec = builder.finish();
return dec;
};
Expand Down
4 changes: 4 additions & 0 deletions src/core/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,10 @@ class T {
name: "Inline Context",
desc: "Display the context and a banner at the top of your notes",
},
inlineContextProperties: {
name: "Inline Context Properties",
desc: "Show the properties in the inline context",
},
inlineContextExpanded: {
name: "Auto Expand Inline Context",
desc: "Expand the inline context sections when opening a note",
Expand Down
13 changes: 7 additions & 6 deletions src/core/react/components/MarkdownEditor/MarkdownHeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ export const MarkdownHeaderView = (props: {
readOnly={!props.editable}
></TitleComponent>
</div>
{props.editable && (
<HeaderPropertiesView
superstate={props.superstate}
collapseSpaces={true}
></HeaderPropertiesView>
)}
{props.editable &&
props.superstate.settings.inlineContextProperties && (
<HeaderPropertiesView
superstate={props.superstate}
collapseSpaces={true}
></HeaderPropertiesView>
)}
</div>
</>
)
Expand Down
14 changes: 8 additions & 6 deletions src/core/react/components/SpaceView/SpaceHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export const SpaceHeader = (props: { superstate: Superstate }) => {
readOnly={readMode}
></TitleComponent>
</div>
{spaceState?.type == "folder" && !readMode && (
<HeaderPropertiesView
superstate={props.superstate}
collapseSpaces={true}
></HeaderPropertiesView>
)}
{spaceState?.type == "folder" &&
!readMode &&
props.superstate.settings.inlineContextProperties && (
<HeaderPropertiesView
superstate={props.superstate}
collapseSpaces={true}
></HeaderPropertiesView>
)}
</div>
</>
);
Expand Down
32 changes: 17 additions & 15 deletions src/core/react/components/UI/Crumbs/PathCrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ export const PathCrumb = (
onClick={() => {
props.superstate.ui.openPath(cache?.path ?? path, false);
}}
onContextMenu={(e) =>
cache &&
showPathContextMenu(
props.superstate,
cache.path,
props.source,
{
x: e.clientX,
y: e.clientY,
width: 0,
height: 0,
},
windowFromDocument(e.view.document)
)
}
onContextMenu={(e) => {
if (cache) {
e.stopPropagation();
showPathContextMenu(
props.superstate,
cache.path,
props.source,
{
x: e.clientX,
y: e.clientY,
width: 0,
height: 0,
},
windowFromDocument(e.view.document)
);
}
}}
>
{cache && (
<PathStickerView superstate={props.superstate} pathState={cache} />
Expand Down
9 changes: 1 addition & 8 deletions src/core/react/context/ContextEditorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,7 @@ export const ContextEditorProvider: React.FC<
const col = (table == "" ? tableData : contextTable[table])?.cols.find(
(f) => f.name == column
);
console.log(
"updateValue",
tableData.rows[index]?.[PathPropertyName],
col,
path,
value,
column
);

if (col) {
saveProperties(
props.superstate,
Expand Down
1 change: 1 addition & 0 deletions src/core/schemas/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const DEFAULT_SETTINGS: MakeMDSettings = {
inlineContext: true,
inlineBacklinksExpanded: false,
inlineContextExpanded: true,
inlineContextProperties: true,
inlineContextSectionsExpanded: true,
dataviewInlineContext: false,
inlineContextNameLayout: "vertical",
Expand Down
1 change: 1 addition & 0 deletions src/core/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface MakeMDSettings {
newFileLocation: string;
newFileFolderPath: string;
inlineContext: boolean;
inlineContextProperties: boolean;
imageThumbnails: boolean;
inlineBacklinks: boolean;
defaultDateFormat: string;
Expand Down

0 comments on commit 72df223

Please sign in to comment.