HTML Preview Action Improvements

Situation

Up to 2020 the HTMLPreview action has only one text-edit that is a fixed height.

Given the basic structure of an HTML document a second text-edit could be useful to define the and the section in different fields.

This would add a layer of complexity to the action.

Maybe be there could be a list/stack of text-edits that the user can add. If the GUI would be similar to the action steps UI this would increase the usability of the HTML preview action by hiding long blocks of CSS or script code.

If something is to compact in the request please feel free to ask…

Maybe I’m missing something, but is this not the sort of complexity provided by scripting’s HTMLPreview object? Anything beyond the most simple action steps always switches to the script objects. This looks to be true across the board.

Ok.
That might be totally true.
but many drafts users do have trouble writing a java script action.

But then I am wondering why this action has a text-edit at all and not only a combo box for selection of the themes .

the template tag feature gives a quite powerful extension to html preview.

maybe it’s best to ask the developer for his idea.

((one problem though might be to remove something- like the text edit - after putting it out in the open…))

Could be to make it easier for people to apply their own web site structure for previewing posts or to allow for passing in specific content from earlier steps via template tags. A fixed list would preclude those (common?) options, or at least make them harder to maintain (e.g. if you had to create a file first to have it appear in the list).

Your reply gave me an idea.

Maybe the feature change I am aiming at is easily build with different actions (like file or clipboard).

Both do have a “Text Edit” and already can be stacked.

By using a file action, the user could generate files like first:

  • head.template
  • css.template
  • js.template

And then load them into the template tags in a simple script.

The clipboard action would be even more comfortable (I am still writing about non scripting users) by building the header in steps in the keyboard (appending the content) and then using it in a HTML Preview with a template like

[[clipboard]] <!-- this is the header preprocessed in the previous action steps -->
<body>
   [[body]]
   <!-- some modifications ... ->

If you are just wanting to manage templates as separate components, you could save your partial templates in /iCloud Drive/Drafts/Library/Templates and use the [[template|path]] tag to insert them in an HTMLPreview template. So your HTMLPreview template might look like:

[[template|my-header-template.txt]]
[[template|my-body-template.txt]]
1 Like

thanks Greg.
I found that solution in the documentation yesterday.

This is a nice solution - surely the reason why you implement it in the first place.

The other thing that is a bit of a pain, that none of the reset buttons clears the Previews Text Edit.

I solved it by using import on an empty file.

My last solution

<!DOCTYPE html>

<html dir="auto">
  <head>
    <title>[[title]]</title>
<meta charset="utf-8"> <!--"ISO-8859-1"-->
[[template|html5/head_css.html.drafts.txt]]
[[template|html5/head_js.html.drafts.txt]]
    </head>
  <body>
    %%[[draft]]%% 
   [[template|html5/head_js_load.html.drafts.txt]]
  </body>
</html>