Skip to content

upgrade wang editor version #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 11 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
wangEditor extension for laravel-admin
======
fork from:https://github.com/laravel-admin-extensions/wangEditor

这个仓库独立出来是给自己使用的,目前 wangEditor 的版本为 4.6.9

``` bash
// 注意:升级后需要重新发布静态资源
php artisan vendor:publish --force --tag=laravel-admin-wangEditor
```

这是一个`laravel-admin`扩展,用来将`wangEditor`集成进`laravel-admin`的表单中

Expand All @@ -8,17 +16,13 @@ laravel-admin | extension
1.x | 1.x
2.x |2.x

## 截图

![wx20180904-103609](https://user-images.githubusercontent.com/1479100/45007036-65573b80-b02e-11e8-8b27-7ced3db47085.png)

## 安装

```bash
// laravel-admin 1.x
composer require "laravel-admin-ext/wang-editor:1.*"
composer require leo-yi/wang-editor

// laravel-admin 2.x
// laravel-admin 2.x (请使用官方)
composer require laravel-admin-ext/wang-editor
```

Expand Down Expand Up @@ -48,14 +52,7 @@ php artisan vendor:publish --tag=laravel-admin-wangEditor

```

编辑器的配置可以到[wangEditor文档](https://www.kancloud.cn/wangfupeng/wangeditor3/335776)找到,比如配置上传图片的地址[上传图片](https://www.kancloud.cn/wangfupeng/wangeditor3/335782)

```php
'config' => [
// `/upload`接口用来上传文件,上传逻辑要自己实现,可参考下面的`上传图片`
'uploadImgServer' => '/upload'
]
```
编辑器的配置可以到[wangEditor官网](http://www.wangeditor.com/)

## 使用

Expand All @@ -64,35 +61,6 @@ php artisan vendor:publish --tag=laravel-admin-wangEditor
$form->editor('content');
```

## 上传图片

图片上传默认使用base64格式化后与文本内容一起存入数据库,如果要上传图片到本地接口,那么下面是这个接口对应的action代码示例:

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

public function upload(Request $request)
{
$urls = [];

foreach ($request->file() as $file) {
$urls[] = Storage::url($file->store('images'));
}

return [
"errno" => 0,
"data" => $urls,
];
}

> **Note:** 配置路由指向这个action,存储的disk配置在`config/filesystem.php`中,这个需参考laravel官方文档。

## 支持

如果觉得这个项目帮你节约了时间,不妨支持一下;)

![-1](https://cloud.githubusercontent.com/assets/1479100/23287423/45c68202-fa78-11e6-8125-3e365101a313.jpg)

License
------------
Licensed under [The MIT License (MIT)](LICENSE).
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "laravel-admin-ext/wang-editor",
"name": "leo-yi/wang-editor",
"description": "wangEditor extension for laravel-admin",
"type": "library",
"keywords": ["laravel-admin", "extension", "editor"],
"homepage": "https://github.com/laravel-admin-extensions/wangEditor",
"license": "MIT",
"authors": [
{
"name": "song",
"email": "zosong@126.com"
"name": "leo",
"email": "uyihoo@gmail.com"
}
],
"require": {
"php": ">=7.0.0",
"encore/laravel-admin": ">=1.6"
"php": ">=7.2.0",
"encore/laravel-admin": ">=1.8"
},
"require-dev": {
"phpunit/phpunit": "~6.0"
Expand Down
Binary file not shown.
Loading