Skip to content

Commit 1668b51

Browse files
committed
Installed Summernote
1 parent 19c6aee commit 1668b51

File tree

9 files changed

+27
-6
lines changed

9 files changed

+27
-6
lines changed

config/purifier.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
'settings' => [
2525
'default' => [
2626
'HTML.Doctype' => 'HTML 4.01 Transitional',
27-
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
28-
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
27+
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src|style]',
28+
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width,height',
2929
'AutoFormat.AutoParagraph' => true,
3030
'AutoFormat.RemoveEmpty' => true,
31+
'URI.AllowedSchemes' => ['data' => true, 'http' => true, 'https' => true],
3132
],
3233
'test' => [
3334
'Attr.EnableID' => 'true',

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"jquery": "^3.2",
1818
"laravel-mix": "^2.0",
1919
"lodash": "^4.17.4",
20-
"popper.js": "^1.12"
20+
"popper.js": "^1.12",
21+
"summernote": "^0.8.10"
2122
}
2223
}

resources/assets/js/app.js

+6
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,10 @@ $(document).on('click', '.location-button', function () {
6161
} else {
6262
alert('Unable to detect your location.');
6363
}
64+
});
65+
66+
$(document).ready(function() {
67+
$('.summernote').summernote({
68+
height: 300
69+
});
6470
});

resources/assets/js/bootstrap.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ try {
1212
window.$ = window.jQuery = require('jquery');
1313

1414
require('bootstrap');
15+
require('summernote/dist/summernote-bs4');
1516
} catch (e) {}
1617

1718
/**

resources/assets/sass/app.scss

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@import '~bootstrap/scss/bootstrap';
66

77
@import "~font-awesome/scss/font-awesome.scss";
8+
@import "~summernote/dist/summernote-bs4.css";
89

910
.navbar {
1011
background-color: #0c64a2;

resources/views/admin/pages/create.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
<div class="form-group">
5050
<label for="content" class="col-form-label">Content</label>
51-
<textarea id="content" class="form-control{{ $errors->has('content') ? ' is-invalid' : '' }}" name="content" rows="10" required>{{ old('content') }}</textarea>
51+
<textarea id="content" class="form-control{{ $errors->has('content') ? ' is-invalid' : '' }} summernote" name="content" rows="10" required>{{ old('content') }}</textarea>
5252
@if ($errors->has('content'))
5353
<span class="invalid-feedback"><strong>{{ $errors->first('content') }}</strong></span>
5454
@endif

resources/views/admin/pages/edit.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<div class="form-group">
5151
<label for="content" class="col-form-label">Content</label>
52-
<textarea id="content" class="form-control{{ $errors->has('content') ? ' is-invalid' : '' }}" name="content" rows="10" required>{{ old('content', $page->content) }}</textarea>
52+
<textarea id="content" class="form-control{{ $errors->has('content') ? ' is-invalid' : '' }} summernote" name="content" rows="10" required>{{ old('content', $page->content) }}</textarea>
5353
@if ($errors->has('content'))
5454
<span class="invalid-feedback"><strong>{{ $errors->first('content') }}</strong></span>
5555
@endif

webpack.mix.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
let mix = require('laravel-mix');
2+
let webpack = require('webpack');
23

34
/*
45
|--------------------------------------------------------------------------
@@ -16,4 +17,10 @@ mix
1617
.setResourceRoot('/build/')
1718
.js('resources/assets/js/app.js', 'js')
1819
.sass('resources/assets/sass/app.scss', 'css')
19-
.version();
20+
.version();
21+
22+
mix.webpackConfig({
23+
plugins: [
24+
new webpack.IgnorePlugin(/^codemirror$/)
25+
]
26+
});

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -6617,6 +6617,10 @@ sum-up@^1.0.1:
66176617
dependencies:
66186618
chalk "^1.0.0"
66196619

6620+
summernote@^0.8.10:
6621+
version "0.8.10"
6622+
resolved "https://registry.yarnpkg.com/summernote/-/summernote-0.8.10.tgz#21a5d7f18a3b07500b58b60d5907417a54897520"
6623+
66206624
supports-color@^2.0.0:
66216625
version "2.0.0"
66226626
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"

0 commit comments

Comments
 (0)