英文:
How to Get Full Content using Tinymce getContent() API method
问题
I have a form that uses tinymce and has content like the image above. Then, I want to preview that content to PDF page using getContent() API method with code like below.
<script nonce="{{ csp_nonce() }}">
var options = {
selector: "#body_sp3d",
menubar: 'file edit view insert format tools table help',
plugins: [
"advlist autolink autosave lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime nonbreaking save table directionality",
"template paste textpattern"
],
toolbar: "fullscreen restoredraft insertfile undo redo toc | styleselect fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify codesample | bullist numlist outdent indent toc",
};
tinymce.init(options);
</script>
<script>
$(document).ready(function() {
$('#previewSp3d').on('click', function() {
//get content from tinyMCE editor and set to #content_sp3d
var body_sp3d = tinymce.get('body_sp3d').getContent();
var no_sp3d = $('#no_sp3d').val();
var penerima_sp3d = $('#penerima_sp3d').val();
var klasifikasi_sp3d = $('#klasifikasi_sp3d').val();
var url = "{{ route('preview.sp3d')}}";
var full_url = url + '?no_sp3d=' + no_sp3d + '&penerima_sp3d=' + penerima_sp3d + '&body_sp3d=' + body_sp3d + '&klasifikasi_sp3d=' + klasifikasi_sp3d;
$('#previewSp3d').attr('href', full_url);
});
});
</script>
But, only part of the content is previewed, not all content can be displayed on the PDF page. How do I get all the content in the form to be displayed on the PDF page? Thanks
英文:
I have a form that uses tinymce and has content like the image above. Then, I want to preview that content to PDF page using getContent() API method with code like below.
<script nonce="{{ csp_nonce() }}">
var options = {
selector: "#body_sp3d",
menubar: 'file edit view insert format tools table help',
plugins: [
"advlist autolink autosave lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime nonbreaking save table directionality",
"template paste textpattern"
],
toolbar: "fullscreen restoredraft insertfile undo redo toc | styleselect fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify codesample | bullist numlist outdent indent toc",
};
tinymce.init(options);
</script>
<script>
$(document).ready(function() {
$('#previewSp3d').on('click', function() {
//get content from tinyMCE editor and set to #content_sp3d
var body_sp3d = tinymce.get('body_sp3d').getContent();
var no_sp3d = $('#no_sp3d').val();
var penerima_sp3d = $('#penerima_sp3d').val();
var klasifikasi_sp3d = $('#klasifikasi_sp3d').val();
var url = "{{ route('preview.sp3d')}}";
var full_url = url + '?no_sp3d=' + no_sp3d + '&penerima_sp3d=' + penerima_sp3d + '&body_sp3d=' + body_sp3d + '&klasifikasi_sp3d=' + klasifikasi_sp3d;
$('#previewSp3d').attr('href', full_url);
});
});
</script>
But, only part of the content is previewed, not all content can be displayed on the PDF page. How do I get all the content in the form to be displayed on the PDF page? Thanks
答案1
得分: 0
已解决。在body_sp3d中包含了 字符。
英文:
SOLVED. at body_sp3d contains   character
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论