forked from summernote/summernote
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTODOs.txt
222 lines (203 loc) · 5.01 KB
/
TODOs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
*const defaultStyle = 'bs3';
in config/common.js
------------
...
in config/webpack.production.js
-------------
*lang changes
-------------
Check and apply summernote-bs4.js changes in history to sm.js
-------------
*Put underscore and popper in vite.config.dev
-------------
*Restore Editor.onFormatBlock
-------------
Implement "code" command
-------------
*globalinit ist raus (?)
webpack.production.js
=======================
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const ZipPlugin = require('zip-webpack-plugin');
const path = require('path');
const pkg = require('../package.json');
const { styles, languages } = require('./common');
const date = (new Date()).toISOString().replace(/:\d+\.\d+Z$/, 'Z');
const banner = `
Super simple WYSIWYG editor v${pkg.version}
https://summernote.org
Copyright 2013- Alan Hong and contributors
Summernote may be freely distributed under the MIT license.
Date: ${date}
`;
const minBanner = `Summernote v${pkg.version} | (c) 2013- Alan Hong and contributors | MIT license`;
module.exports = {
mode: 'production',
performance: {
maxEntrypointSize: 512000,
maxAssetSize: 512000,
assetFilter: (name) => {
return name.endsWith('.js');
},
},
resolve: {
roots: [path.resolve('./src')],
},
entry: Object.fromEntries([
// entries for each style
...styles.map(style =>
[`${style.target}`, `./src/styles/${style.id}/summernote-${style.id}.js`]
)>>>>>>.slice(4, 5)<<<<<<<<,
// ... and for minimized
...styles.map(style =>
[`${style.target}.min`, `./src/styles/${style.id}/summernote-${style.id}.js`]
))>>>>>>..slice(4, 5))<<<<<<<<,,
// entries for each language
...languages.map(lang =>
[`lang/${lang}`, `./src/lang/${lang}.js`]
),
// ... and for minimized
...languages.map(lang =>
[`lang/${lang}.min`, `./src/lang/${lang}.js`]
),
]),
output: {
publicPath: '/',
path: path.join(__dirname, '../dist'),
libraryTarget: 'umd',
},
externals: {
jquery: {
root: 'jquery',
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery',
},
>>>>>>underscore: {
root: '_',
commonjs: '_',
commonjs2: '_',
amd: '_',
},<<<<<<<<<<
},
module: {
rules: [
{
test: /\.js$/i,
exclude: /node_modules/,
use: [
{
loader: 'string-replace-loader',
options: {
search: '@@VERSION@@',
replace: pkg.version,
},
}, {
loader: 'babel-loader',
},
],
},
{
test: /\.(sa|sc|c)ss$/i,
exclude: /node_modules/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false, // do not handle any url in scss/css
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
require('autoprefixer'),
require('postcss-escape-generated-content-string'),
],
},
},
},
{
loader: 'sass-loader',
options: {
sassOptions: {
indentWidth: 4,
outputStyle: 'expanded',
},
},
},
],
},
{
test: /\.(woff|woff2|ttf|otf|eot)$/i,
type: 'asset/resource',
generator: {
filename: './font/[name][ext]',
},
},
],
},
optimization: {
minimizer: [
new TerserPlugin({
test: /\.min\.js$/i,
extractComments: false,
terserOptions: {
ecma: 8,
compress: {
warnings: false,
},
},
}),
new CssMinimizerPlugin({
test: /\.min\.css$/i,
minimizerOptions: {
preset: [
'default',
{
discardComments: { removeAll: true },
},
],
},
}),
],
},
plugins: [
new CleanWebpackPlugin(),
new webpack.BannerPlugin({
banner: ({filename}) => {
return filename.includes('.min.') ? minBanner : banner;
},
}),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new CopyPlugin({
patterns: [
{
from: 'plugin',
to: 'plugin',
},
{
from: 'src/font/summernote.*',
to: 'font/[base]',
},
],
}),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
exclude: /\.min\./,
}),
new ZipPlugin({
filename: `summernote-${pkg.version}-dist.zip`,
}),
],
devtool: false,
};