Skip to content

Commit

Permalink
0.9.999
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-cen committed Aug 7, 2024
1 parent 5fc0d69 commit 17954f6
Show file tree
Hide file tree
Showing 21 changed files with 130 additions and 96 deletions.
148 changes: 74 additions & 74 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.998",
"version": "0.9.999",
"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 src/adapters/obsidian/SpaceViewContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class SpaceViewContainer extends ItemView {
this.root = this.ui.createRoot(this.contentEl);
if (this.root) {
this.root.render(
<div className="mk-space-view">
<div className="mk-space-view" data-path={path}>
{path == "spaces://$settings" ? (
<SystemSettings superstate={this.superstate}></SystemSettings>
) : (
Expand Down
5 changes: 5 additions & 0 deletions src/adapters/obsidian/filesystem/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ export class ObsidianFileSystem implements FileSystemAdapter {
}
public resolvePath (path: string, source: string) {
if (!source || !path) return path;

if (path.includes("#")) {
const [basePath, fragment] = path.split('#');
return this.plugin.app.metadataCache.getFirstLinkpathDest(basePath, source)?.path+'#'+fragment ?? path
}
return this.plugin.app.metadataCache.getFirstLinkpathDest(path, source)?.path ?? path
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import MakeMDPlugin from "main";
import { i18n } from "makemd-core";

import { FlowEditorHover } from "adapters/obsidian/ui/editors/markdownView/FlowEditorHover";
import { getLineRangeFromRef } from "adapters/obsidian/utils/flow/flowEditor";
import { PathStickerContainer } from "core/react/components/UI/Stickers/PathSticker/PathSticker";
import { CollapseToggle } from "core/react/components/UI/Toggles/CollapseToggle";
import { compareByField } from "core/utils/tree";
Expand Down Expand Up @@ -388,7 +389,16 @@ class FlowEditorWidget extends WidgetType {
this.info.link,
file?.path
);
this.plugin.superstate.ui.openPath(uri.fullPath, false, div);
const selectiveRange = getLineRangeFromRef(
uri.basePath,
uri.refStr,
this.plugin
);

this.plugin.superstate.ui.openPath(uri.basePath, false, div, {
from: selectiveRange[0],
to: selectiveRange[1],
});
}
// loadFlowEditorByDOM(this.plugin, div, view, this.info.id);
return div;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const FocusEditor = (props: {
BlinkMode.Open,
windowFromDocument(e.view.document),
(link) => {
const isNew = !props.superstate.spacesIndex.has(link);
const isNew = !props.superstate.pathsIndex.has(link);
if (isNew) {
createSpace(props.superstate, link, {}).then((f) => {
saveActiveSpace(link);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const ActionEditor = (props: {
fields={props.fields}
values={props.value}
saveTree={(tree) => {
console.log("saving tree", tree);
props.saveFormula(JSON.stringify(tree));
setActionTree(tree);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ export const TableView = (props: { superstate: Superstate }) => {
const [selectedColumn, setSelectedColumn] = useState<string>(null);
const [currentEdit, setCurrentEdit] = useState<[string, string]>(null);
const [overId, setOverId] = useState(null);
const [openFlows, setOpenFlows] = useState([]);
const [colsSize, setColsSize] = useState<ColumnSizingState>({});
const ref = useRef(null);
const primaryCol = cols.find((f) => f.primary == "true");
Expand Down Expand Up @@ -510,13 +509,13 @@ export const TableView = (props: { superstate: Superstate }) => {
Object.keys(predicate.colsCalc).forEach((f) => {
result[f] = calculateAggregate(
props.superstate,
tableData.rows.map((r) => r[f]),
data.map((r) => r[f]),
predicate.colsCalc[f],
cols.find((c) => c.name == f)
);
});
return result;
}, [cols, tableData, predicate.colsCalc]);
}, [cols, data, predicate.colsCalc]);

const selectCell = (e: React.MouseEvent, index: number, column: string) => {
if (isTouchScreen(props.superstate.ui) || column == "+") return;
Expand Down
8 changes: 4 additions & 4 deletions src/core/react/components/UI/Modals/HiddenFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export const HiddenPaths = (props: {
<div className="mk-modal-description">
{i18n.descriptions.hiddenFileOptions}
</div>
<div>
<div className="mk-modal-items">
{hiddenExtensions.map((f, index) => (
<div key={index} className="mk-modal-items">
<span className="mk-modal-item">{f}</span>
<div key={index} className="mk-modal-item">
<span>{f}</span>
<div
className="mk-modal-item-button"
aria-label={i18n.buttons.delete}
Expand All @@ -132,7 +132,7 @@ export const HiddenPaths = (props: {
<div className="mk-modal-description">
{i18n.labels.hiddenFileSpecific}
</div>
<div>
<div className="mk-modal-items">
{hiddenPaths.map((f, index) => (
<div key={index} className="mk-modal-item">
<span className="mk-modal-item-name">{f}</span>
Expand Down
1 change: 1 addition & 0 deletions src/core/react/context/SpaceContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const SpaceProvider: React.FC<
const spaceInfo: SpaceInfo = useMemo(() => {
return props.superstate.spacesIndex.get(pathState.path)?.space;
}, [pathState]);

const readMode = spaceInfo?.readOnly;
const [spaceState, setSpaceState] = useState<SpaceState>(null);

Expand Down
2 changes: 2 additions & 0 deletions src/core/schemas/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,6 @@ export const DEFAULT_SETTINGS: MakeMDSettings = {
actionMaxSteps: 100,
contextPagination: 25,
searchWorker: true,
skipFolderNames: [],
skipFolders: [],
};
4 changes: 2 additions & 2 deletions src/core/spaceManager/filesystemAdapter/filesystemAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Kit } from "types/kits";
import { DBTables, SpaceInfo, SpaceProperty, SpaceTable, SpaceTables, SpaceTableSchema } from "types/mdb";
import { MDBFrame, MDBFrames } from "types/mframe";
import { uniqueNameFromString } from "utils/array";
import { excludePathPredicate } from "utils/hide";
import { excludeSpacesPredicate } from "utils/hide";
import { safelyParseJSON } from "utils/parsers";
import { tagPathToTag } from "utils/tags";
import { SpaceAdapter, SpaceManager } from "../spaceManager";
Expand Down Expand Up @@ -766,7 +766,7 @@ const defaultSpaceTemplate = this.defaultFrame(path);
const getAllTagContextFiles = () : SpaceInfo[] => this.readTags().map(f => fileSystemSpaceInfoFromTag(this.spaceManager, tagPathToTag(f))) as SpaceInfo[] ?? [];

const getAllFolderContextFiles = () => {
const folders = this.allPaths(['folder']).filter(f => !excludePathPredicate(this.spaceManager.superstate.settings, f) && !f.startsWith(this.spaceManager.superstate.settings.spacesFolder+'/#'))
const folders = this.allPaths(['folder']).filter(f => !excludeSpacesPredicate(this.spaceManager.superstate.settings, f) && !f.startsWith(this.spaceManager.superstate.settings.spacesFolder+'/#'))

return folders.map(f => fileSystemSpaceInfoFromFolder(this.spaceManager, f));
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/spaceManager/filesystemAdapter/spaceInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const fileSystemSpaceInfoByPath = (
}
}
const uri = manager.uriByString(contextPath);
if (!uri) return null;
const pathType = manager.spaceTypeByString(uri);

if (pathType == "folder") {
Expand Down Expand Up @@ -94,7 +95,7 @@ export const fileSystemSpaceInfoFromFolder = (
folderPath: folder,
defPath: `${manager.superstate.settings.spaceSubFolder}/def.json`,
notePath: vaultName + ".md",
dbPath: spaceFolderPathFromSpace(folder, manager) + + "context.mdb",
dbPath: spaceFolderPathFromSpace(folder, manager) + "context.mdb",
framePath: spaceFolderPathFromSpace(folder, manager) + "views.mdb",
commandsPath: spaceFolderPathFromSpace(folder, manager) + "commands.mdb",
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/spaceManager/spaceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export class SpaceManager {
}
return [...sourceParts, ...pathParts].join('/');
}
if (this.superstate.spacesIndex.has(path)) return path;
if (this.superstate.pathsIndex.has(path)) return path;
return this.primarySpaceAdapter.resolvePath(path, source) ?? path;
}
Expand All @@ -253,6 +252,7 @@ export class SpaceManager {
}

public spaceTypeByString = (uri: URI): SpaceType => {

if (uri.fullPath.startsWith(builtinSpacePathPrefix)) {
return 'default';
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/superstate/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class SpacesCommandsAdapter implements CLIAdapter {
public runCommand (action: string, instance: ActionInstance) {

const command = this.commandForAction(action);
console.log(command)

let result;
let error
try {
Expand Down
4 changes: 3 additions & 1 deletion src/core/superstate/superstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ public async updateSpaceMetadata (spacePath: string, metadata: SpaceDefinition)
const metadata = spaceMetadata ?? await this.spaceManager.spaceDefForSpace(space.path);

let pathState = this.pathsIndex.get(space.path);
const type : SpaceType = this.spaceManager.spaceTypeByString(this.spaceManager.uriByString(space.path))
const uri = this.spaceManager.uriByString(space.path)
if (!uri) return null;
const type : SpaceType = this.spaceManager.spaceTypeByString(uri)
if (type == 'default' || type == 'tag') {
metadata.filters = [];
metadata.links = [];
Expand Down
2 changes: 1 addition & 1 deletion src/core/superstate/workers/search/impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function fastSearch (payload: { query: string, pathsIndex: Map<string, Pa
// fieldNormWeight: 1,
keys: ["name", "path", 'label.preview'],
};
const fuse = new Fuse([...pathsIndex.values()], fuseOptions);
const fuse = new Fuse([...pathsIndex.values()].filter(f => f.hidden == false), fuseOptions);
return fuse.search(query).map((result) => result.item).slice(0, count);

}
Expand Down
2 changes: 2 additions & 0 deletions src/core/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export interface MakeMDSettings {
emojiTriggerChar: string;
makerMode: boolean;
hiddenFiles: string[];
skipFolders: string[];
skipFolderNames: string[];
hiddenExtensions: string[];
newFileLocation: string;
newFileFolderPath: string;
Expand Down
5 changes: 5 additions & 0 deletions src/css/Modal/Modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
gap: 8px;
}

.mk-modal-item {
display: flex;
gap: 8px;
}

.mk-tab-group {
display: flex;
gap: 4px;
Expand Down
12 changes: 10 additions & 2 deletions src/utils/hide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ export const excludePathPredicate =
(settings: MakeMDSettings, path: string) =>
(
settings.hiddenExtensions.some((e) => path.endsWith(e))
|| path.endsWith('/'+settings.spaceSubFolder) || path == settings.spaceSubFolder
|| path.endsWith('/'+settings.spaceSubFolder) || path == settings.spaceSubFolder || path.split('/').pop() == settings.spaceSubFolder
) || path.startsWith(settings.spacesFolder+'/#') ||
settings.hiddenFiles.some((e) => e == path)
settings.hiddenFiles.some((e) => e == path)

export const excludeSpacesPredicate =
(settings: MakeMDSettings, path: string) =>
(
settings.skipFolderNames.some((e) => path.endsWith(e))
|| path.endsWith('/'+settings.spaceSubFolder) || path == settings.spaceSubFolder || path.split('/').pop() == settings.spaceSubFolder
) || path.startsWith(settings.spacesFolder+'/#') ||
settings.skipFolders.some((e) => e == path)
2 changes: 1 addition & 1 deletion styles.css

Large diffs are not rendered by default.

0 comments on commit 17954f6

Please sign in to comment.