Skip to content

Commit

Permalink
v3 初始化框架 part1
Browse files Browse the repository at this point in the history
  • Loading branch information
wangfupeng1988 committed Apr 4, 2017
1 parent dd729d6 commit 6e6f070
Show file tree
Hide file tree
Showing 22 changed files with 889 additions and 53 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src/js/util/ierange.js
src/js/util/poly-fill.js
2 changes: 1 addition & 1 deletion ISSUE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 当前遗留的一些问题

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

- `Object.assign` 未被 rollup 编译

20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@

# wangEditor

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

下载源码 `git clone [email protected]:wangfupeng1988/wangEditor.git -b v3`

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

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

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


## 使用


## 本地运行demo



## 交流

交流QQ群:**164999061**

## License
MIT
36 changes: 29 additions & 7 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,42 @@
<head>
<meta charset="UTF-8">
<title>test</title>
<style type="text/css">
.toolbar {
background-color: #f1f1f1;
border: 1px solid #ccc;
}
.text {
border: 1px solid #ccc;
min-height: 100px;
max-height: 200px;
}
</style>
</head>
<body>

<p>
<i class="w-e-icon-quotes-left"></i>
<i class="w-e-icon-header"></i>
<i class="w-e-icon-paragraph-center"></i>
</p>
<p class="w-e-text">.w-e-text</p>
<p>第一个 demo(菜单和编辑器区域分开)</p>
<div id="div1" class="toolbar">
</div>
<div style="padding: 5px 0; color: #ccc">中间隔离带</div>
<div id="div2" class="text">
<p>请输入内容</p>
</div>

<p>第二个 demo(常规)</p>
<div id="div3"></div>

<!-- 引用js -->
<script type="text/javascript" src="/wangEditor.min.js"></script>
<script type="text/javascript">

var E = window.wangEditor

var editor1 = new E('#div1', '#div2')
editor1.customConfig.menus = ['head', 'bold', 'link']
editor1.create()

var editor2 = new E('#div3')
editor2.create()
</script>
</body>
</html>
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const autoprefixer = require('autoprefixer')
const cssgrace = require('cssgrace')
const resolve = require('rollup-plugin-node-resolve')
const babel = require('rollup-plugin-babel')
const gukpReplace = require('gulp-replace')
const gulpReplace = require('gulp-replace')

// 拷贝 fonts 文件
gulp.task('copy-fonts', () => {
Expand All @@ -34,7 +34,7 @@ gulp.task('css', () => {
cssgrace
]))
// 将 css 引用的字体文件转换为 base64 格式
.pipe(gukpReplace( /'fonts\/icomoon\..+?'/gm, function (fontFile) {
.pipe(gulpReplace( /'fonts\/icomoon\..+?'/gm, function (fontFile) {
// fontFile 例如 'fonts/icomoon.eot?paxlku'
fontFile = fontFile.slice(0, -1).slice(1)
fontFile = fontFile.split('?')[0]
Expand Down Expand Up @@ -80,7 +80,7 @@ gulp.task('script', () => {
// 待 rollup 打包 js 完毕之后,再进行如下的处理:
gulp.src('./release/wangEditor.js')
// inline css
.pipe(gukpReplace(/__INLINE_CSS__/gm, function () {
.pipe(gulpReplace(/__INLINE_CSS__/gm, function () {
// 读取 css 文件内容
var filePath = path.resolve(__dirname, 'release', 'wangEditor.css')
var content = fs.readFileSync(filePath).toString('utf-8')
Expand Down
35 changes: 35 additions & 0 deletions release/wangEditor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6e6f070

Please sign in to comment.