Skip to content

Commit 6e6f070

Browse files
v3 初始化框架 part1
1 parent dd729d6 commit 6e6f070

22 files changed

Lines changed: 889 additions & 53 deletions

‎.eslintignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
src/js/util/ierange.js
2+
src/js/util/poly-fill.js

‎ISSUE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 当前遗留的一些问题
22

33
- 删除掉`./release`之后,执行`npm run release`会报错,原因是`fonts`文件没拷贝全,就要去替换`css`中的字体文件为`base64`格式,导致找不到文件。
4-
4+
- `Object.assign` 未被 rollup 编译
55

‎README.md‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11

22
# wangEditor
33

4-
**wangEditor**——轻量级 web 富文本编辑器,配置方便,使用简单。
4+
v3 - 正在开发中,放在`v3`分支中
55

6+
下载源码 `git clone git@github.com:wangfupeng1988/wangEditor.git -b v3`
67

8+
进入目录,安装依赖 `cd wangEditor && npm i`
79

8-
## 下载
10+
打包源代码 `npm run release` **(注意查看`./gulpfile.js`,打包时,`font`文件会以`base64`编码嵌入到`css`中,然后`css`内容再嵌入`js`中。因此,使用者引用时,只需要引用一个`js`文件即可)**
911

12+
查看 demo `npm run exapmle` 然后浏览器访问 `localhost:3000/index.html`
1013

1114

12-
## 使用
13-
14-
15-
## 本地运行demo
16-
17-
18-
19-
## 交流
20-
21-
交流QQ群:**164999061**
22-
23-
## License
24-
MIT

‎example/index.html‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,42 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>test</title>
6+
<style type="text/css">
7+
.toolbar {
8+
background-color: #f1f1f1;
9+
border: 1px solid #ccc;
10+
}
11+
.text {
12+
border: 1px solid #ccc;
13+
min-height: 100px;
14+
max-height: 200px;
15+
}
16+
</style>
617
</head>
718
<body>
819

9-
<p>
10-
<i class="w-e-icon-quotes-left"></i>
11-
<i class="w-e-icon-header"></i>
12-
<i class="w-e-icon-paragraph-center"></i>
13-
</p>
14-
<p class="w-e-text">.w-e-text</p>
20+
<p>第一个 demo(菜单和编辑器区域分开)</p>
21+
<div id="div1" class="toolbar">
22+
</div>
23+
<div style="padding: 5px 0; color: #ccc">中间隔离带</div>
24+
<div id="div2" class="text">
25+
<p>请输入内容</p>
26+
</div>
27+
28+
<p>第二个 demo(常规)</p>
29+
<div id="div3"></div>
1530

1631
<!-- 引用js -->
1732
<script type="text/javascript" src="/wangEditor.min.js"></script>
1833
<script type="text/javascript">
19-
34+
var E = window.wangEditor
35+
36+
var editor1 = new E('#div1', '#div2')
37+
editor1.customConfig.menus = ['head', 'bold', 'link']
38+
editor1.create()
39+
40+
var editor2 = new E('#div3')
41+
editor2.create()
2042
</script>
2143
</body>
2244
</html>

‎gulpfile.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const autoprefixer = require('autoprefixer')
1414
const cssgrace = require('cssgrace')
1515
const resolve = require('rollup-plugin-node-resolve')
1616
const babel = require('rollup-plugin-babel')
17-
const gukpReplace = require('gulp-replace')
17+
const gulpReplace = require('gulp-replace')
1818

1919
// 拷贝 fonts 文件
2020
gulp.task('copy-fonts', () => {
@@ -34,7 +34,7 @@ gulp.task('css', () => {
3434
cssgrace
3535
]))
3636
// 将 css 引用的字体文件转换为 base64 格式
37-
.pipe(gukpReplace( /'fonts\/icomoon\..+?'/gm, function (fontFile) {
37+
.pipe(gulpReplace( /'fonts\/icomoon\..+?'/gm, function (fontFile) {
3838
// fontFile 例如 'fonts/icomoon.eot?paxlku'
3939
fontFile = fontFile.slice(0, -1).slice(1)
4040
fontFile = fontFile.split('?')[0]
@@ -80,7 +80,7 @@ gulp.task('script', () => {
8080
// 待 rollup 打包 js 完毕之后,再进行如下的处理:
8181
gulp.src('./release/wangEditor.js')
8282
// inline css
83-
.pipe(gukpReplace(/__INLINE_CSS__/gm, function () {
83+
.pipe(gulpReplace(/__INLINE_CSS__/gm, function () {
8484
// 读取 css 文件内容
8585
var filePath = path.resolve(__dirname, 'release', 'wangEditor.css')
8686
var content = fs.readFileSync(filePath).toString('utf-8')

‎release/wangEditor.css‎

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

0 commit comments

Comments
 (0)