Run format.
This commit is contained in:
parent
8c3dd2cee3
commit
0d0a99c73b
@ -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>
|
||||
|
@ -1,11 +1,11 @@
|
||||
class Highlight {
|
||||
start: number;
|
||||
end: number;
|
||||
start: number;
|
||||
end: number;
|
||||
|
||||
constructor(start: number, end: number) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
constructor(start: number, end: number) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
}
|
||||
}
|
||||
|
||||
export { Highlight };
|
||||
|
@ -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"),
|
||||
);
|
||||
});
|
||||
|
@ -11,9 +11,7 @@
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
"allowSyntheticDefaultImports": true,
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
"include": ["src"],
|
||||
}
|
||||
|
@ -2,83 +2,83 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const path = require("path");
|
||||
|
||||
const CSSModuleLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
modules: true,
|
||||
importLoaders: 2,
|
||||
sourceMap: true,
|
||||
}
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
modules: true,
|
||||
importLoaders: 2,
|
||||
sourceMap: true,
|
||||
},
|
||||
};
|
||||
|
||||
const CSSLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
modules: "global",
|
||||
importLoaders: 2,
|
||||
sourceMap: true,
|
||||
}
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
modules: "global",
|
||||
importLoaders: 2,
|
||||
sourceMap: true,
|
||||
},
|
||||
};
|
||||
|
||||
const PostCSSLoader = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
}
|
||||
loader: "postcss-loader",
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
};
|
||||
|
||||
const styleLoader = 'style-loader';
|
||||
const styleLoader = "style-loader";
|
||||
|
||||
module.exports = {
|
||||
entry: "./src/index.tsx",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "bundle.[hash].js",
|
||||
},
|
||||
devServer: {
|
||||
compress: true,
|
||||
port: 8080,
|
||||
hot: true,
|
||||
static: "./dist",
|
||||
historyApiFallback: true,
|
||||
open: true,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
exclude: /node_modules/,
|
||||
use: {loader: 'ts-loader'},
|
||||
},
|
||||
{
|
||||
test: /\.(sa|sc|c)ss$/,
|
||||
exclude: /\.module\.(sa|sc|c)ss$/,
|
||||
use: [styleLoader, CSSLoader, PostCSSLoader]
|
||||
},
|
||||
{
|
||||
test: /\.module\.(sa|sc|c)ss$/,
|
||||
use: [styleLoader, CSSModuleLoader, PostCSSLoader]
|
||||
}
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: __dirname + "/public/index.html",
|
||||
filename: "index.html",
|
||||
}),
|
||||
entry: "./src/index.tsx",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "bundle.[hash].js",
|
||||
},
|
||||
devServer: {
|
||||
compress: true,
|
||||
port: 8080,
|
||||
hot: true,
|
||||
static: "./dist",
|
||||
historyApiFallback: true,
|
||||
open: true,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
exclude: /node_modules/,
|
||||
use: { loader: "ts-loader" },
|
||||
},
|
||||
{
|
||||
test: /\.(sa|sc|c)ss$/,
|
||||
exclude: /\.module\.(sa|sc|c)ss$/,
|
||||
use: [styleLoader, CSSLoader, PostCSSLoader],
|
||||
},
|
||||
{
|
||||
test: /\.module\.(sa|sc|c)ss$/,
|
||||
use: [styleLoader, CSSModuleLoader, PostCSSLoader],
|
||||
},
|
||||
],
|
||||
mode: "development",
|
||||
devtool: "inline-source-map",
|
||||
experiments: {
|
||||
asyncWebAssembly: true
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: __dirname + "/public/index.html",
|
||||
filename: "index.html",
|
||||
}),
|
||||
],
|
||||
mode: "development",
|
||||
devtool: "inline-source-map",
|
||||
experiments: {
|
||||
asyncWebAssembly: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".tsx", ".ts", ".js"],
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user