Skip to content

Commit

Permalink
Merge codex v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jcv8000 authored Nov 8, 2023
2 parents cebcced + a81f838 commit 83f7117
Show file tree
Hide file tree
Showing 5 changed files with 649 additions and 812 deletions.
48 changes: 22 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codex",
"private": true,
"version": "2.0.1",
"version": "2.0.2",
"description": "Note-taking app for programmers and CS students",
"author": {
"name": "Josh Vickery",
Expand All @@ -18,11 +18,11 @@
"dir": "pnpm run build && electron-builder -c electron-builder.config.js --dir --publish=never",
"clean": "rimraf dist/ .vite/",
"test": "pnpm run typecheck && pnpm run lint",
"lint": "pnpm exec eslint . --max-warnings 0",
"lint": "pnpm exec eslint --ignore-path .gitignore . --max-warnings 0",
"typecheck": "tsc && tsc -p packages/renderer/tsconfig.json"
},
"dependencies": {
"@electron/remote": "^2.0.12",
"@electron/remote": "^2.1.0",
"@emotion/react": "^11.11.1",
"@lukeed/uuid": "^2.0.1",
"@mantine/core": "^6.0.21",
Expand All @@ -31,8 +31,8 @@
"@mantine/hooks": "^6.0.21",
"@mantine/modals": "^6.0.21",
"@mantine/notifications": "^6.0.21",
"@tabler/icons": "^2.39.0",
"@tabler/icons-webfont": "^2.39.0",
"@tabler/icons": "^2.40.0",
"@tabler/icons-webfont": "^2.40.0",
"@tiptap/core": "^2.1.12",
"@tiptap/extension-code": "^2.1.12",
"@tiptap/extension-code-block": "^2.1.12",
Expand Down Expand Up @@ -75,43 +75,39 @@
"react-lowlight": "^3.0.0",
"sanitize-filename": "^1.6.3",
"semver": "^7.5.4",
"tiptap-markdown": "^0.8.2",
"tiptap-markdown": "0.8.2",
"validator": "^13.11.0"
},
"devDependencies": {
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@preact/compat": "^17.1.2",
"@preact/preset-vite": "^2.6.0",
"@types/color": "^3.0.5",
"@types/d3": "^7.4.2",
"@types/katex": "^0.16.5",
"@types/node": "^16.18.59",
"@types/node-fetch": "^2.6.7",
"@types/react": "^18.2.29",
"@types/react-dom": "^18.2.14",
"@types/semver": "^7.5.4",
"@types/validator": "^13.11.5",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@vitejs/plugin-react": "^4.1.0",
"@types/color": "^3.0.6",
"@types/d3": "^7.4.3",
"@types/katex": "^0.16.6",
"@types/node": "^16.18.61",
"@types/node-fetch": "^2.6.9",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/semver": "^7.5.5",
"@types/validator": "^13.11.6",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitejs/plugin-react": "^4.1.1",
"electron": "^22.3.27",
"electron-builder": "^24.6.4",
"eslint": "^8.51.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-react-refresh": "^0.4.4",
"node-fetch": "^2.7.0",
"preact": "10.17.1",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.5",
"sass": "^1.69.4",
"sass": "^1.69.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite-plugin-static-copy": "^0.17.0",
"vite-tsconfig-paths": "^4.2.1",
"wait-on": "^7.0.1"
"wait-on": "^7.1.0"
}
}
46 changes: 13 additions & 33 deletions packages/renderer/src/components/Modals/WhatsNewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,31 @@ export function WhatsNewModal(props: { state: { opened: boolean }; onClose: () =
<Modal
opened={props.state.opened}
onClose={props.onClose}
title={<Title order={3}>What&apos;s New in 2.0.1</Title>}
title={<Title order={3}>What&apos;s New in 2.0.2</Title>}
size="lg"
>
<Tabs orientation="vertical" placement="right" defaultValue="improvements">
<Tabs orientation="vertical" placement="right" defaultValue="v202">
<Tabs.List>
<Tabs.Tab value="improvements">Improvements</Tabs.Tab>
<Tabs.Tab value="bugfixes">Bug Fixes</Tabs.Tab>
<Tabs.Tab value="v202">2.0.2 Changelog</Tabs.Tab>
<Tabs.Tab value="bugs">Bug Reports</Tabs.Tab>
<Tabs.Tab value="v2release">2.0 Changelog</Tabs.Tab>
</Tabs.List>

<Tabs.Panel value="improvements" px="xs">
<Tabs.Panel value="v202" px="xs">
<ul style={{ paddingLeft: "16px" }}>
<li>
Added <b>single-line and multi-line indenting and un-indenting</b> (Tab
/ Shift-Tab) in code blocks
<b>
Fixed an issue where the Editor was reloading its content and
extensions while typing
</b>
</li>
<li>
<b>Added a Tab Size setting</b> for how many spaces to add/remove when
pressing Tab/Shift-Tab in code blocks
<b>
Switched back to React instead of Preact in builds, the React build
doesn&apos;t seem to lag while typing as much as Preact did
</b>
</li>
<li>Added a setting for word-wrap in code blocks (disabled by default)</li>
<li>Icon Selector:</li>
<ul>
<li>
Now shows the name of the selected icon below the icon in Edit menus
</li>
<li>The Icon Selector popup highlights the currently-selected icon</li>
<li>
Improved how icons are searched for, finding them by name should be
easier
</li>
</ul>
<li>Custom scrollbars for code blocks</li>
</ul>
</Tabs.Panel>

<Tabs.Panel value="bugfixes" px="xs">
<ul style={{ paddingLeft: "16px" }}>
<li>
Fixed not being able to tab/shift-tab in code blocks that are inside a
table
</li>
<li>Fixed tab/shift-tab not working to sink/lift list items</li>
<li>Localized the &quot;Collapse&quot; tooltip in code blocks</li>
<li>18 new icons from Tabler Icons 2.40</li>
</ul>
</Tabs.Panel>

Expand Down
18 changes: 13 additions & 5 deletions packages/renderer/src/components/Views/Editor/EditorView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./styles.scss";
import { Container, Paper } from "@mantine/core";
import { Page } from "common/Save";
import { useContext, useEffect } from "react";
import { useContext, useEffect, useMemo } from "react";
import { AppContext } from "types/AppStore";
import { Editor, EditorContent, useEditor } from "@tiptap/react";
import Toolbar from "./Toolbar/Toolbar";
Expand All @@ -17,14 +17,22 @@ type Props = {
export function EditorView({ page, setEditorRef }: Props) {
const appContext = useContext(AppContext);

const editor = useEditor(
{
extensions: extensions({
const _extensions = useMemo(
() =>
extensions({
useTypography: appContext.prefs.editor.useTypographyExtension,
tabSize: appContext.prefs.editor.tabSize
}),
[appContext.prefs.editor.tabSize, appContext.prefs.editor.useTypographyExtension]
);

const content = useMemo(() => JSON.parse(window.api.loadPage(page.fileName)), [page.fileName]);

const editor = useEditor(
{
extensions: _extensions,
autofocus: true,
content: JSON.parse(window.api.loadPage(page.fileName))
content: content
},
[page.id]
);
Expand Down
101 changes: 39 additions & 62 deletions packages/renderer/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { resolve } from "path";
import { defineConfig, PluginOption, UserConfig } from "vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import react from "@vitejs/plugin-react";
import preact from "@preact/preset-vite";
import { viteStaticCopy } from "vite-plugin-static-copy";
import nodeFetch from "node-fetch";
import pkg from "../../package.json";
Expand Down Expand Up @@ -37,39 +36,7 @@ const getVersions = async () => {
}
};

const common: Partial<UserConfig> = {
root: __dirname,
clearScreen: false,
base: "./",
build: {
outDir: resolve(PROJECT_ROOT, ".vite/renderer/"),
emptyOutDir: false,
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
about: resolve(__dirname, "about/about.html")
}
}
},
appType: "mpa"
};

const plugins: PluginOption[] = [
tsconfigPaths({ root: __dirname }),
viteStaticCopy({
targets: [
{
src: "../../node_modules/highlight.js/styles/*.css",
dest: "assets/hljs"
},
{
src: "../../node_modules/highlight.js/styles/base16/*.css",
dest: "assets/hljs/base16"
}
]
})
];

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default defineConfig(async (mode) => {
process.env.VITE_APP_VERSION = process.env.npm_package_version;

Expand All @@ -78,32 +45,42 @@ export default defineConfig(async (mode) => {
process.env.VITE_NODE_VERSION = versions.node;
process.env.VITE_CHROMIUM_VERSION = versions.chromium;

if (mode.command == "serve") {
console.log("Serving app with \x1b[96mReact\x1b[0m");
return {
...common,
server: {
host: "127.0.0.1",
port: 5173
},
build: {
minify: false,
sourcemap: "inline"
},
plugins: [...plugins, react()]
};
} else {
console.log("Building app with \x1b[35mPreact\x1b[0m");
return {
...common,
plugins: [
...plugins,
preact({
babel: {
cwd: __dirname
console.log("Building app with \x1b[96mReact\x1b[0m");

return {
root: __dirname,
clearScreen: false,
server: {
host: "127.0.0.1",
port: 5173
},
base: "./",
build: {
outDir: resolve(PROJECT_ROOT, ".vite/renderer/"),
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
about: resolve(__dirname, "about/about.html")
}
}
},
appType: "mpa",
plugins: [
tsconfigPaths({ root: __dirname }),
viteStaticCopy({
targets: [
{
src: "../../node_modules/highlight.js/styles/*.css",
dest: "assets/hljs"
},
{
src: "../../node_modules/highlight.js/styles/base16/*.css",
dest: "assets/hljs/base16"
}
})
]
};
}
]
}),
react()
]
};
});
Loading

0 comments on commit 83f7117

Please sign in to comment.