-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I am using unlayer editor in my laravel project. I want to load my existing HTML markup into the editor. But it's not working with loadDesign and loadTemplate function. Here is my code.
<script>
class EmailEditor {
constructor(id) {
unlayer.init({
id: id,
displayMode: "web",
appearance: {
theme: 'dark',
}
});
}
loadDesign(design) {
unlayer.loadDesign(design);
}
saveDesign(callback) {
unlayer.saveDesign(callback);
}
exportHtml(callback) {
unlayer.exportHtml(callback);
}
}
const editor = new EmailEditor('editor-container');
const saveHTMLBtn = document.getElementById('update_html_btn');
saveHTMLBtn.addEventListener('click',e => {
editor.exportHtml(
d => {
// Ajax
var body = d.html;
$.post('{{ route('api.page.content.create') }}',
{_token:'{{ csrf_token() }}',
page_id: '{{ $content->id }}',
title: '{{ $content->title }}',
body: body
},
function(data){
console.log(data);
});
}
);
});
</script>
Metadata
Metadata
Assignees
Labels
No labels