Run format.

This commit is contained in:
Tom Alexander 2024-01-21 21:11:38 -05:00
parent 8c3dd2cee3
commit 0d0a99c73b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
5 changed files with 97 additions and 89 deletions

View File

@ -1,10 +1,8 @@
import React, { useState } from 'react';
import './Editor.css';
import {Highlight} from './highlight';
import React, { useState } from "react";
import "./Editor.css";
import { Highlight } from "./highlight";
function Editor({
defaultValue = "I have a text value."
}) {
function Editor({ defaultValue = "I have a text value." }) {
function handleChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
console.log(event.target.value);
setValue(event.target.value);
@ -27,13 +25,17 @@ function Editor({
}
if (highlights.length === 0) {
addHighlight(1,5);
addHighlight(1, 5);
}
return (
<div className="Editor">
<div className="Editor-textwrapper">
<textarea onChange={handleChange} className="Editor-textarea" value={value} />
<textarea
onChange={handleChange}
className="Editor-textarea"
value={value}
/>
<div className="Editor-underlay">{value}</div>
</div>
<div className="Editor-ast"></div>

View File

@ -1,9 +1,17 @@
import React from "react";
import ReactDOM from "react-dom";
import init, { parse_org } from "../../organic/target/wasm32-unknown-unknown/js/wasm";
import Editor from './Editor';
import init, {
parse_org,
} from "../../organic/target/wasm32-unknown-unknown/js/wasm";
import Editor from "./Editor";
init().then(() => {
console.log(parse_org("foo"));
ReactDOM.render(<><h1>Hello, world!</h1><Editor /></>, document.getElementById("root"));
ReactDOM.render(
<>
<h1>Hello, world!</h1>
<Editor />
</>,
document.getElementById("root"),
);
});

View File

@ -11,9 +11,7 @@
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
},
"include": [
"src"
]
"include": ["src"],
}

View File

@ -2,31 +2,31 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
const CSSModuleLoader = {
loader: 'css-loader',
loader: "css-loader",
options: {
modules: true,
importLoaders: 2,
sourceMap: true,
}
},
};
const CSSLoader = {
loader: 'css-loader',
loader: "css-loader",
options: {
modules: "global",
importLoaders: 2,
sourceMap: true,
}
},
};
const PostCSSLoader = {
loader: 'postcss-loader',
loader: "postcss-loader",
options: {
sourceMap: true,
}
},
};
const styleLoader = 'style-loader';
const styleLoader = "style-loader";
module.exports = {
entry: "./src/index.tsx",
@ -54,17 +54,17 @@ module.exports = {
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {loader: 'ts-loader'},
use: { loader: "ts-loader" },
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /\.module\.(sa|sc|c)ss$/,
use: [styleLoader, CSSLoader, PostCSSLoader]
use: [styleLoader, CSSLoader, PostCSSLoader],
},
{
test: /\.module\.(sa|sc|c)ss$/,
use: [styleLoader, CSSModuleLoader, PostCSSLoader]
}
use: [styleLoader, CSSModuleLoader, PostCSSLoader],
},
],
},
plugins: [
@ -76,9 +76,9 @@ module.exports = {
mode: "development",
devtool: "inline-source-map",
experiments: {
asyncWebAssembly: true
asyncWebAssembly: true,
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
extensions: [".tsx", ".ts", ".js"],
},
};