first commit

This commit is contained in:
2020-08-06 16:37:53 +08:00
commit 91311c63a4
12865 changed files with 1504178 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
.DS_Store
phpunit.phar
/vendor
composer.phar
composer.lock
*.project
.idea/

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2015 Jens Segers
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,65 @@
wangEditor extension for laravel-admin
======
这是一个`laravel-admin`扩展,用来将`wangEditor`集成进`laravel-admin`的表单中
## 截图
![wx20180904-103609](https://user-images.githubusercontent.com/1479100/45007036-65573b80-b02e-11e8-8b27-7ced3db47085.png)
## 安装
```bash
composer require laravel-admin-ext/wang-editor
```
然后
```bash
php artisan vendor:publish --tag=laravel-admin-wangEditor
```
## 配置
`config/admin.php`文件的`extensions`,加上属于这个扩展的一些配置
```php
'extensions' => [
'wang-editor' => [
// 如果要关掉这个扩展设置为false
'enable' => true,
// 编辑器的配置
'config' => [
]
]
]
```
编辑器的配置可以到[wangEditor文档](https://www.kancloud.cn/wangfupeng/wangeditor3/335776)找到,比如配置上传图片的地址[上传图片](https://www.kancloud.cn/wangfupeng/wangeditor3/335782)
```php
'config' => [
'uploadImgServer' => '/upload'
]
```
## 使用
在form表单中使用它
```php
$form->editor('content');
```
## 支持
如果觉得这个项目帮你节约了时间,不妨支持一下;)
![-1](https://cloud.githubusercontent.com/assets/1479100/23287423/45c68202-fa78-11e6-8125-3e365101a313.jpg)
License
------------
Licensed under [The MIT License (MIT)](LICENSE).

View File

@@ -0,0 +1,33 @@
{
"name": "laravel-admin-ext/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"
}
],
"require": {
"php": ">=7.0.0",
"encore/laravel-admin": "~1.6"
},
"require-dev": {
"phpunit/phpunit": "~6.0"
},
"autoload": {
"psr-4": {
"Encore\\WangEditor\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Encore\\WangEditor\\WangEditorServiceProvider"
]
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
<div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
<div class="{{$viewClass['field']}}">
@include('admin::form.error')
<div id="{{$id}}" style="width: 100%; height: 100%;">
<p>{!! old($column, $value) !!}</p>
</div>
<input id="input-{{$id}}" type="hidden" name="{{$name}}" value="{{ old($column, $value) }}" />
@include('admin::form.help-block')
</div>
</div>

View File

@@ -0,0 +1,56 @@
<?php
namespace Encore\WangEditor;
use Encore\Admin\Form\Field;
class Editor extends Field
{
protected $view = 'laravel-admin-wangEditor::editor';
protected static $css = [
'vendor/laravel-admin-ext/wang-editor/wangEditor-3.0.10/release/wangEditor.css',
];
protected static $js = [
'vendor/laravel-admin-ext/wang-editor/wangEditor-3.0.10/release/wangEditor.js',
];
public function render()
{
$id = $this->formatName($this->id);
$config = (array) WangEditor::config('config');
$config = json_encode(array_merge([
'zIndex' => 0,
'uploadImgShowBase64' => true,
], $config, $this->options));
$token = csrf_token();
$this->script = <<<EOT
(function ($) {
if ($('#{$this->id}').attr('initialized')) {
return;
}
var E = window.wangEditor
var editor = new E('#{$this->id}');
editor.customConfig.uploadImgParams = {_token: '$token'}
Object.assign(editor.customConfig, {$config})
editor.customConfig.onchange = function (html) {
$('#input-$id').val(html);
}
editor.create();
$('#{$this->id}').attr('initialized', 1);
})(jQuery);
EOT;
return parent::render();
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Encore\WangEditor;
use Encore\Admin\Extension;
class WangEditor extends Extension
{
public $name = 'wang-editor';
public $views = __DIR__.'/../resources/views';
public $assets = __DIR__.'/../resources/assets';
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Encore\WangEditor;
use Encore\Admin\Admin;
use Encore\Admin\Form;
use Illuminate\Support\ServiceProvider;
class WangEditorServiceProvider extends ServiceProvider
{
/**
* {@inheritdoc}
*/
public function boot(WangEditor $extension)
{
if (! WangEditor::boot()) {
return ;
}
if ($views = $extension->views()) {
$this->loadViewsFrom($views, 'laravel-admin-wangEditor');
}
if ($this->app->runningInConsole() && $assets = $extension->assets()) {
$this->publishes(
[$assets => public_path('vendor/laravel-admin-ext/wang-editor')],
'laravel-admin-wangEditor'
);
}
Admin::booting(function () {
Form::extend('editor', Editor::class);
});
}
}