如何使用Tinymce的getContent() API方法获取完整内容。

huangapple go评论105阅读模式
英文:

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.

  1. <script nonce="{{ csp_nonce() }}">
  2. var options = {
  3. selector: "#body_sp3d",
  4. menubar: 'file edit view insert format tools table help',
  5. plugins: [
  6. "advlist autolink autosave lists link image charmap print preview hr anchor pagebreak",
  7. "searchreplace wordcount visualblocks visualchars code fullscreen",
  8. "insertdatetime nonbreaking save table directionality",
  9. "template paste textpattern"
  10. ],
  11. toolbar: "fullscreen restoredraft insertfile undo redo toc | styleselect fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify codesample | bullist numlist outdent indent toc",
  12. };
  13. tinymce.init(options);
  14. </script>
  1. <script>
  2. $(document).ready(function() {
  3. $('#previewSp3d').on('click', function() {
  4. //get content from tinyMCE editor and set to #content_sp3d
  5. var body_sp3d = tinymce.get('body_sp3d').getContent();
  6. var no_sp3d = $('#no_sp3d').val();
  7. var penerima_sp3d = $('#penerima_sp3d').val();
  8. var klasifikasi_sp3d = $('#klasifikasi_sp3d').val();
  9. var url = "{{ route('preview.sp3d')}}";
  10. var full_url = url + '?no_sp3d=' + no_sp3d + '&penerima_sp3d=' + penerima_sp3d + '&body_sp3d=' + body_sp3d + '&klasifikasi_sp3d=' + klasifikasi_sp3d;
  11. $('#previewSp3d').attr('href', full_url);
  12. });
  13. });
  14. </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

英文:

如何使用Tinymce的getContent() API方法获取完整内容。

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.

  1. &lt;script nonce=&quot;{{ csp_nonce() }}&quot;&gt;
  2. var options = {
  3. selector: &quot;#body_sp3d&quot;,
  4. menubar: &#39;file edit view insert format tools table help&#39;,
  5. plugins: [
  6. &quot;advlist autolink autosave lists link image charmap print preview hr anchor pagebreak&quot;,
  7. &quot;searchreplace wordcount visualblocks visualchars code fullscreen&quot;,
  8. &quot;insertdatetime nonbreaking save table directionality&quot;,
  9. &quot;template paste textpattern&quot;
  10. ],
  11. toolbar: &quot;fullscreen restoredraft insertfile undo redo toc | styleselect fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify codesample | bullist numlist outdent indent toc&quot;,
  12. };
  13. tinymce.init(options);
  14. &lt;/script&gt;
  1. &lt;script&gt;
  2. $(document).ready(function() {
  3. $(&#39;#previewSp3d&#39;).on(&#39;click&#39;, function() {
  4. //get content from tinyMCE editor and set to #content_sp3d
  5. var body_sp3d = tinymce.get(&#39;body_sp3d&#39;).getContent();
  6. var no_sp3d = $(&#39;#no_sp3d&#39;).val();
  7. var penerima_sp3d = $(&#39;#penerima_sp3d&#39;).val();
  8. var klasifikasi_sp3d = $(&#39;#klasifikasi_sp3d&#39;).val();
  9. var url = &quot;{{ route(&#39;preview.sp3d&#39;)}}&quot;;
  10. var full_url = url + &#39;?no_sp3d=&#39; + no_sp3d + &#39;&amp;penerima_sp3d=&#39; + penerima_sp3d + &#39;&amp;body_sp3d=&#39; + body_sp3d + &#39;&amp;klasifikasi_sp3d=&#39; + klasifikasi_sp3d;
  11. $(&#39;#previewSp3d&#39;).attr(&#39;href&#39;, full_url);
  12. });
  13. });
  14. &lt;/script&gt;

如何使用Tinymce的getContent() API方法获取完整内容。

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中包含了&nbsp字符。

英文:

SOLVED. at body_sp3d contains &nbsp character

huangapple
  • 本文由 发表于 2023年6月13日 13:53:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76462010.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定