diff options
Diffstat (limited to 'internal/web/templates/partials/editor.html')
| -rw-r--r-- | internal/web/templates/partials/editor.html | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/web/templates/partials/editor.html b/internal/web/templates/partials/editor.html index a0f8c7f..cfc5642 100644 --- a/internal/web/templates/partials/editor.html +++ b/internal/web/templates/partials/editor.html @@ -1,10 +1,13 @@ +{{/* A second editor in the same form (a page's outro) shares the first one's + Format row: pass "formatof" with that editor's name and no radios are + rendered, the script watches the other row instead. */}} {{define "editor"}}<div class="editor{{if eq .format "html"}} html{{end}}" id="ed-{{.name}}-wrap"> -<p class="ed-format" id="ed-{{.name}}-format"> +{{if not .formatof}}<p class="ed-format" id="ed-{{.name}}-format"> <span class="muted">{{t "Format"}}:</span> <label><input type="radio" name="format" value="markdown"{{if ne .format "html"}} checked{{end}}> Markdown</label> <label><input type="radio" name="format" value="html"{{if eq .format "html"}} checked{{end}}> HTML</label> <span class="muted small ed-htmlnote">{{t "Put on your blog exactly as written — embeds and scripts all work. An unclosed tag can break the page around it, so check your blog after saving."}}</span> -</p> +</p>{{end}} <div class="ed-toolbar" id="ed-{{.name}}-bar" hidden> <span class="ed-group ed-md"> <button type="button" data-cmd="bold" title="{{t "Bold"}} (Ctrl+B)"><svg viewBox="0 0 16 16"><path d="M4 2h5a3.5 3.5 0 0 1 2.4 6 3.75 3.75 0 0 1-2.2 6.8H4zM6 4v3.5h3a1.75 1.75 0 0 0 0-3.5zm0 5.5V13h3.2a1.75 1.75 0 0 0 0-3.5z"/></svg></button> @@ -41,7 +44,7 @@ <div class="ed-preview" id="ed-{{.name}}-preview" hidden></div> <iframe class="ed-preview-frame" id="ed-{{.name}}-frame" sandbox title="{{t "Preview"}}" hidden></iframe> <div class="editor-tools"> - <label class="upload">{{t "Insert file"}} <input type="file" name="inline_file" id="ed-{{.name}}-file"></label> + <label class="upload">{{t "Insert file"}} <input type="file" name="{{.name}}_file" id="ed-{{.name}}-file"></label> <span class="upload-status" id="ed-{{.name}}-status"></span> <span class="muted small">{{t "…or paste / drop a file into the text. Images are shown, other files linked."}}</span> <noscript><span class="muted small">{{t "The file is added at the end of the text when you save."}}</span></noscript> @@ -52,7 +55,7 @@ (function () { var id = "ed-{{.name}}", ta = document.getElementById(id), inp = document.getElementById(id + "-file"), st = document.getElementById(id + "-status"), wrap = document.getElementById(id + "-wrap"), bar = document.getElementById(id + "-bar"), lk = document.getElementById(id + "-link"), pv = document.getElementById(id + "-preview"), - frame = document.getElementById(id + "-frame"), fmt = document.getElementById(id + "-format"); + frame = document.getElementById(id + "-frame"), fmt = document.getElementById({{if .formatof}}"ed-{{.formatof}}-format"{{else}}id + "-format"{{end}}); if (!window.fetch || !window.FormData || !ta || !inp) return; // old browser: plain textarea, the file is uploaded on save bar.hidden = false; |
