Skip to content

Commit adb522d

Browse files
committed
init files
0 parents  commit adb522d

28 files changed

+17811
-0
lines changed

.eslintrc

Whitespace-only changes.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations":[{
7+
"type": "node",
8+
"request": "launch",
9+
"name": "Mocha All",
10+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
11+
"args": [
12+
"--no-timeouts",
13+
"--colors",
14+
"${workspaceFolder}/tests/**/*.test.ts",
15+
"--require",
16+
"ts-node/register"
17+
],
18+
"console": "integratedTerminal",
19+
"internalConsoleOptions": "neverOpen"
20+
}
21+
]
22+
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## React Editor Wrapper ##
2+
Built and written by Typesript and supported by
3+
1. Draft js [https://draftjs.org/](https://draftjs.org/)
4+
2. Draft js plugins [https://www.draft-js-plugins.com/](https://www.draft-js-plugins.com/)
5+
3. Styled components [https://styled-components.com/](https://styled-components.com/)
6+
7+
## How to contribute
8+
Please fork or Pull Request

babel.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const removeLinariaImport = () => ({
2+
name: 'remove-linaria-import',
3+
visitor: {
4+
ImportDeclaration(path) {
5+
if (path.node.source && path.node.source.value === 'linaria') {
6+
path.remove();
7+
}
8+
},
9+
},
10+
});
11+
12+
module.exports = {
13+
presets: [
14+
//using loose true because of this issue: https://github.com/storybookjs/storybook/issues/12093
15+
['@babel/preset-env', { loose: true }],
16+
'@babel/react',
17+
'@babel/flow',
18+
'@babel/typescript'
19+
],
20+
plugins: [
21+
['@babel/plugin-proposal-class-properties', { loose: true }],
22+
removeLinariaImport,
23+
],
24+
};

example/components/App.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import Editor from "../../lib/index"
3+
import "./style.css"
4+
5+
const App = () => (
6+
<div className="page">
7+
<main className="page__wrapper">
8+
<div className="page__main" style={{margin:'0 auto',width:1024}}>
9+
<h2 style={{margin:"20px",textAlign:"center"}}>Editor Draft JS React Sample</h2>
10+
<Editor />
11+
</div>
12+
</main>
13+
</div>
14+
);
15+
16+
export default App;

example/components/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Editor JS Sample</title>
6+
<meta name="description" content="">
7+
<meta name="viewport" content="width=device-width">
8+
<link rel="preconnect" href="https://fonts.gstatic.com">
9+
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400&display=swap" rel="stylesheet">
10+
<style>
11+
body{
12+
font-family: "Lato", "Georgia", sans-serif;
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
<div id="app">
18+
<div class="pre-render">
19+
<div class="spinner"></div>
20+
</div>
21+
</div>
22+
</body>
23+
</html>
24+
© 2021 GitHub, Inc.

example/components/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.page__main {
2+
margin:0 auto;
3+
width:1024px;
4+
}

example/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './components/App';
4+
5+
const run = () => {
6+
ReactDOM.render(<App/>, document.getElementById('app'));
7+
};
8+
9+
window.addEventListener('DOMContentLoaded', run);

example/webpack.config.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import webpack from 'webpack'
2+
import path from 'path'
3+
import HtmlWebpackPlugin from 'html-webpack-plugin'
4+
import LiveReloadPlugin from 'webpack-livereload-plugin'
5+
6+
const ENV = process.env.NODE_ENV || 'development'
7+
const DEV = ENV === 'development'
8+
const PROD = ENV === 'production'
9+
const SOURCE_DIR = 'src'
10+
const DEST_DIR = 'dist'
11+
const PUBLIC_PATH = '/'
12+
13+
export default {
14+
mode: ENV,
15+
entry: path.join(__dirname, "index.js"),
16+
output: {
17+
path: path.join(__dirname, DEST_DIR),
18+
filename: '[name].js'
19+
},
20+
module: {
21+
rules: [
22+
{
23+
use: [
24+
{ loader: 'babel-loader'},
25+
{
26+
loader: '@linaria/webpack-loader',
27+
options: {
28+
sourceMap: process.env.NODE_ENV !== 'production',
29+
cacheDirectory: '.linaria-cache',
30+
},
31+
}
32+
],
33+
test: /\.js$/,
34+
exclude: /node_modules/
35+
},
36+
{
37+
use: ['style-loader', 'css-loader'],
38+
test: /\.css$/
39+
},
40+
{
41+
test: /\.scss$/,
42+
use: [
43+
{
44+
loader: "style-loader"
45+
}, {
46+
loader: "css-loader", options: {
47+
sourceMap: true
48+
}
49+
}, {
50+
loader: "sass-loader", options: {
51+
sourceMap: true
52+
}
53+
}
54+
]
55+
},
56+
{
57+
test: /\.(png|jpg|gif|swf)$/,
58+
use: 'file-loader'
59+
},
60+
{
61+
test: /\.(ttf|eot|svg|woff(2)?)(\S+)?$/,
62+
use: 'file-loader'
63+
}
64+
]
65+
},
66+
plugins: [
67+
new HtmlWebpackPlugin({
68+
template: './example/components/index.html'
69+
}),
70+
new LiveReloadPlugin()
71+
]
72+
};

0 commit comments

Comments
 (0)