Skip to content

Commit 5803181

Browse files
committed
change for npm release
1 parent 6ef341e commit 5803181

File tree

7 files changed

+14
-46
lines changed

7 files changed

+14
-46
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ node_modules
66
# testing
77
coverage
88

9-
# production
10-
editor-build
11-
129
# misc
1310
.DS_Store
1411
.env

config/webpack.build.js

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
const path = require('path');
22
const webpack = require('webpack');
33
const ExtractTextPlugin = require('extract-text-webpack-plugin');
4-
const autoprefixer = require('autoprefixer');
5-
const precss = require('precss');
64

75
module.exports = {
86
devtool: 'source-map',
97
entry: [
10-
'./src/lib',
8+
'./src/library/index.js',
119
],
1210
output: {
1311
path: path.join(__dirname, '../dist'),
1412
filename: 'html-to-draftjs.js',
1513
libraryTarget: 'commonjs2',
1614
},
15+
externals: {
16+
'draft-js': 'draft-js',
17+
},
1718
plugins: [
1819
new webpack.optimize.OccurenceOrderPlugin(),
1920
new webpack.DefinePlugin({
@@ -26,41 +27,14 @@ module.exports = {
2627
warnings: false,
2728
},
2829
}),
29-
new ExtractTextPlugin('authored-editor.css', {
30-
allChunks: true,
31-
}),
3230
],
3331
module: {
3432
loaders: [
3533
{
3634
test: /\.js$/, loader: 'babel-loader',
37-
}, {
38-
test: /\.css$/,
39-
loader: ExtractTextPlugin.extract(
40-
'style-loader',
41-
'css-loader?modules&importLoaders=1&localIdentName=[local]!postcss-loader'
42-
),
43-
}, {
44-
test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'
45-
}, {
46-
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
47-
loader: "url?limit=10000&mimetype=application/font-woff"
48-
}, {
49-
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
50-
loader: "url?limit=10000&mimetype=application/font-woff"
51-
}, {
52-
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
53-
loader: "url?limit=10000&mimetype=application/octet-stream"
54-
}, {
55-
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
56-
loader: "file"
57-
}, {
58-
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
59-
loader: "url?limit=10000&mimetype=image/svg+xml"
6035
},
6136
],
6237
},
63-
postcss: () => [autoprefixer, precss],
6438
resolve: {
6539
extensions: ['', '.js', '.json'],
6640
},

dist/html-to-draftjs.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/html-to-draftjs.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "html-to-draftjs",
3-
"version": "0.0.1",
4-
"main": "build/html-to-draftjs.js",
3+
"version": "0.0.1-beta",
4+
"main": "dist/html-to-draftjs.js",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/jpuri/html-to-draftjs.git"
88
},
99
"devDependencies": {
1010
"babel-preset-stage-0": "^6.16.0",
1111
"draft-js": "^0.9.1",
12-
"precss": "^1.4.0",
1312
"react": "^15.3.2",
1413
"react-dom": "^15.3.2",
1514
"react-scripts": "0.8.3",
@@ -20,9 +19,7 @@
2019
"react-draft-wysiwyg": "file:../editor-oss"
2120
},
2221
"peerDependencies": {
23-
"draft-js": "^0.9.x",
24-
"react": "0.13.x || 0.14.x || 15.x",
25-
"react-dom": "0.13.x || 0.14.x || 15.x"
22+
"draft-js": "^0.9.x"
2623
},
2724
"scripts": {
2825
"start": "react-scripts start",

src/library/chunkBuilder.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const getEmptyChunk = (): Object => {
4646
};
4747

4848
const getFirstBlockChunk = (blockType: string, data: Object): Object => {
49+
console.log('data 1', data)
4950
return {
5051
text: '',
5152
inlines: [],
@@ -59,6 +60,7 @@ const getFirstBlockChunk = (blockType: string, data: Object): Object => {
5960
};
6061

6162
const getBlockDividerChunk = (blockType: string, depth: number, data: Object): Object => {
63+
console.log('data 2', data)
6264
return {
6365
text: '\r',
6466
inlines: [],

src/library/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,7 @@ function genFragment(
112112
while (child) {
113113
const entityId = getEntityId(child);
114114
const { chunk: generatedChunk } = genFragment(child, inlineStyle, depth, lastList, (entityId || inEntity));
115-
if (nodeName.toLowerCase() === 'li' &&
116-
(child.nodeName.toLowerCase() === 'ul' || child.nodeName.toLowerCase() === 'ol')
117-
) {
118-
chunk = generatedChunk;
119-
} else {
120-
chunk = joinChunks(chunk, generatedChunk);
121-
}
115+
chunk = joinChunks(chunk, generatedChunk);
122116
const sibling = child.nextSibling;
123117
child = sibling;
124118
}

0 commit comments

Comments
 (0)