first commit
This commit is contained in:
7
vendor/laravel-admin-ext/wang-editor/.gitignore
vendored
Normal file
7
vendor/laravel-admin-ext/wang-editor/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
phpunit.phar
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
*.project
|
||||
.idea/
|
||||
20
vendor/laravel-admin-ext/wang-editor/LICENSE
vendored
Normal file
20
vendor/laravel-admin-ext/wang-editor/LICENSE
vendored
Normal 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.
|
||||
65
vendor/laravel-admin-ext/wang-editor/README.md
vendored
Normal file
65
vendor/laravel-admin-ext/wang-editor/README.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
wangEditor extension for laravel-admin
|
||||
======
|
||||
|
||||
这是一个`laravel-admin`扩展,用来将`wangEditor`集成进`laravel-admin`的表单中
|
||||
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||
## 安装
|
||||
|
||||
```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');
|
||||
```
|
||||
|
||||
## 支持
|
||||
|
||||
如果觉得这个项目帮你节约了时间,不妨支持一下;)
|
||||
|
||||

|
||||
|
||||
License
|
||||
------------
|
||||
Licensed under [The MIT License (MIT)](LICENSE).
|
||||
33
vendor/laravel-admin-ext/wang-editor/composer.json
vendored
Normal file
33
vendor/laravel-admin-ext/wang-editor/composer.json
vendored
Normal 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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/fonts/w-e-icon.woff
vendored
Normal file
BIN
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/fonts/w-e-icon.woff
vendored
Normal file
Binary file not shown.
410
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.css
vendored
Normal file
410
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4220
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.js
vendored
Normal file
4220
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.js
vendored
Normal file
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
18
vendor/laravel-admin-ext/wang-editor/resources/views/editor.blade.php
vendored
Normal file
18
vendor/laravel-admin-ext/wang-editor/resources/views/editor.blade.php
vendored
Normal 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>
|
||||
56
vendor/laravel-admin-ext/wang-editor/src/Editor.php
vendored
Normal file
56
vendor/laravel-admin-ext/wang-editor/src/Editor.php
vendored
Normal 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();
|
||||
}
|
||||
}
|
||||
14
vendor/laravel-admin-ext/wang-editor/src/WangEditor.php
vendored
Normal file
14
vendor/laravel-admin-ext/wang-editor/src/WangEditor.php
vendored
Normal 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';
|
||||
}
|
||||
35
vendor/laravel-admin-ext/wang-editor/src/WangEditorServiceProvider.php
vendored
Normal file
35
vendor/laravel-admin-ext/wang-editor/src/WangEditorServiceProvider.php
vendored
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user