Creating an HTML Editor field in Tape App

Do you need more formatting options for the “Multi-line text” field in the Tape App? The current Tape “Multi-line text” field has some basic formatting options, but what if you needed a more sophisticated HTML editor as a Tape field? In this video, I will explain how to integrate TinyMCE editor directly as a Tape field. Here is the result:

This is the itinerary for the tutorial:

  1. Tools required
  1. Setting up the Tape Record
  2. Setting up the Webstudio project
  3. Updating Tape Calculation, Webhook, and testing
  4. Example uses

CODE USED

Tape Calculation

const file_url = `https://your-webstudio-staging-link/${@Record ID}`;
`
<center><a href="${file_url}" target="_blank"><b>Open editor in new tab</b></a></center>
<iframe src="${file_url}" width="100%" height="800px"></iframe>
`

Webstudio Data Variable

  • Body > Settings > Data variables> New resource
    • URL: https://api.tapeapp.com/v1/record/filter/app/your_app_id
    • Method: Post
    • Headers:
      • Content-Type: application/json
      • Authorization: Bearer your_tape_api_key
    • Body:
{
  "filters": [
    {
      "field_id": you_app_record_id_field_id_number
,
      "field_type": "single_text",
      "match_type": "equal",
      "values": [
        {
          "value": system.params.custom_name_webstudio_page
        }
      ],
      "type": "text"
    }
  ]
}

Tinymce.init script

`<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.5.1/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
    selector: '#editor',
    height: 600,
    plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks visualchars wordcount linkchecker code fullscreen accordion preview insertdatetime contextmenu',
    menubar: 'file edit insert view format table',
    menu: {
      file: { title: 'File', items: 'code wordcount | preview fullscreen' },
      edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' },
      view: { title: 'View', items: 'visualaid visualchars visualblocks' },
      insert: { title: 'Insert', items: 'image link media inserttable | charmap emoticons hr accordion | pagebreak nonbreaking anchor tableofcontents | insertdatetime' },
      format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | removeformat' },
      table: { title: 'Table', items: 'inserttable | cell row column | advtablesort | tableprops deletetable' }
  },
    toolbar_sticky: true,
    toolbar: 'blocks fontfamily fontsize | bold italic underline strikethrough | numlist bullist | align lineheight | outdent indent | link image media table | code fullscreen',
    contextmenu: 'bold italic underline link image table',
setup: function (editor) {
        editor.on('init', function () {
            const content = \`${TAPE-RESOURCE-HERE}\`;
            editor.setContent(content);
        });
    }
});
</script>
`

Please note that you need Webstudio for this to work.

4 Likes

Hi @Luis thanks for sharing this here. As you know I have been using this solution for the last week or so after you kindly showed it to me and it has been great :slight_smile:

Well done on working it out

2 Likes

Hi Luis,
I am probably personally not going to apply this one guide but I just wanted to thank you for your awesome work! It is wonderful to see these high-quality, well-structured and detailed guides. I love seeing these very interesting and intricate guides you guys are creating (also looking at you @Jason and all the rest really). :smiley:

Best,
R.J.

2 Likes