I am using summernote editor. I facing an error when going on edit page.
Form Field
<div >
<label>Service Content</label>
<textarea name="content" id="summernote" rows="7" v-model="form.content">
</textarea>
@error('content')
<span >{{ $message }}</span>
@enderror
</div>
Vue
<script>
new Vue({
el: '#vueApp',
data() {
return {
form: {
title: "{{ old('title', $page->title ?? '') }}",
service_id: "{{ old('service_id', $page->service_id ?? '0') }}",
keywords: "{!! old('keywords', $page->keywords ?? '') !!}",
description: "{!! old('description', $page->description ?? '') !!}",
content: "{!! old('content', $page->content ?? '') !!}",
draft: "{{ old('draft', $page->draft ?? 'N') }}"
},
buttonText: "@if ($form !== 'add') Update @else Add @endif"
};
}
});
</script>
Error in Console
Uncaught SyntaxError: Unexpected identifier (at edit:506:25)
I am getting this error when I go on edit page.
Where i am doing wrong, can anyone please guide ?
CodePudding user response:
Solved my Issue by adding this addslashes()
content: "{!! old('content', addslashes($page->content) ?? '') !!}"