Skip to content

Latest commit

 

History

History
66 lines (54 loc) · 1.82 KB

File metadata and controls

66 lines (54 loc) · 1.82 KB

Export to Word with JWT authentication (Node.js) Guide

Setup

Web Page (public/index.html)

Inside the public folder where you created the index.html file add the HTML setup code.

<!DOCTYPE html>
<html>
<head>
  <title>TinyMCE with Export to Word</title>
  <script
    src="https://cdn.tiny.cloud/1/no-api-key/tinymce/8/tinymce.min.js"
    referrerpolicy="origin"
    crossorigin="anonymous">
  </script>
  <script>
    tinymce.init({
      selector: 'textarea',
      plugins: 'exportword',
      toolbar: 'exportword',
      exportword_converter_options: {
        'document': {
          'size': 'Letter'
        }
      },

      // exportword_token_provider fetches a token from the `/jwt` endpoint.
      exportword_token_provider: () => {
        return fetch('http://localhost:3000/jwt', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
        }).then(response => response.json());
      },
    });
  </script>
</head>
<body>
  <h1>TinyMCE Export to Word Demo</h1>
  <textarea>
    Welcome to TinyMCE! Try the Export to Word feature.
  </textarea>
</body>
</html>