Searching for SunEditor object for .getContents() into formarea value for submit
This commit is contained in:
parent
6e2055e96f
commit
a11aa91420
4 changed files with 31 additions and 5 deletions
|
|
@ -59,6 +59,7 @@ class AdminController extends Controller
|
|||
return view('admin.edit_home')->with('content',$page->content);
|
||||
}
|
||||
public function store_home(Request $request) {
|
||||
dd($request);
|
||||
$request->validate(
|
||||
[
|
||||
'pagecontent' => 'required'
|
||||
|
|
|
|||
2
motorradig/resources/js/app.js
vendored
2
motorradig/resources/js/app.js
vendored
|
|
@ -5,4 +5,4 @@
|
|||
*/
|
||||
|
||||
require('./bootstrap');
|
||||
require('./suneditor')
|
||||
require('./suneditor');
|
||||
|
|
|
|||
2
motorradig/resources/js/suneditor.js
vendored
2
motorradig/resources/js/suneditor.js
vendored
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
import 'suneditor/dist/css/suneditor.min.css'
|
||||
import suneditor from 'suneditor'
|
||||
import plugins from 'suneditor/src/plugins'
|
||||
|
|
|
|||
|
|
@ -10,12 +10,20 @@
|
|||
<div class="card-body">
|
||||
|
||||
|
||||
<form style="background-color: #fff;" class="text-dark" method="post" action="/admin/store_home" enctype="multipart/form-data">
|
||||
<form style="background-color: #fff;" class="text-dark" method="post" action="/admin/store_home"
|
||||
onsubmit = "event.preventDefault(); updateAndSubmit();"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<div class="form-group" style="display:flex;">
|
||||
<textarea class="col-10" name="pagecontent" rows="20" cols="50">{{ $content }}
|
||||
|
||||
{{-- <textarea class="col-10" name="pagecontent" rows="20" cols="50">--content-- --}}
|
||||
{{-- </textarea> --}}
|
||||
|
||||
<textarea style="width:100%; height:100vh;" name="pagecontent" id="sample">
|
||||
{!! $content !!}
|
||||
</textarea>
|
||||
|
||||
</div>
|
||||
|
||||
@if(Auth::user()->role=="ADMIN")
|
||||
|
|
@ -30,4 +38,23 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function updateAndSubmit() {
|
||||
|
||||
alert(suneditor);
|
||||
alert(suneditor.suneditor);
|
||||
|
||||
var htmlString = JSON.stringify($('.richText-editor').html());
|
||||
alert(htmlString);
|
||||
/*
|
||||
let suneditor=document.getElementById("sample").suneditor;
|
||||
console.log("updateAndSubmit");
|
||||
let ta=document.getElementById("sample");
|
||||
ta.value=suneditor.getContents();
|
||||
console.log(suneditor.getContents());
|
||||
|
||||
*/
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue