922f2e02ec
Unify dropdown handling, refactor crowded toolbar
81 lines
5.8 KiB
HTML
81 lines
5.8 KiB
HTML
{{define "headerActions"}}
|
|
<a class="btn" href="{{.PostURL}}">CANCEL</a>
|
|
<button class="btn" type="submit" form="edit-form" data-action="save" data-key="S" title="Save (S)">SAVE</button>
|
|
{{end}}
|
|
|
|
{{define "content"}}
|
|
<script>
|
|
if (sessionStorage.getItem('editor-wide') === '1') document.body.classList.add('editor-wide');
|
|
</script>
|
|
<form id="edit-form" class="edit-form" method="POST" action="{{.PostURL}}">
|
|
{{if ge .SectionIndex 0}}<input type="hidden" name="section" value="{{.SectionIndex}}">{{end}}
|
|
<div class="editor-toolbar">
|
|
<button type="button" class="btn btn-tool" data-action="bold" data-key="B" title="Bold (B)">**</button>
|
|
<button type="button" class="btn btn-tool" data-action="italic" data-key="I" title="Italic (I)">*</button>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="Heading (1/2/3)">H▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="h1" data-key="1" title="Heading 1 (1)">Heading 1</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="h2" data-key="2" title="Heading 2 (2)">Heading 2</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="h3" data-key="3" title="Heading 3 (3)">Heading 3</button>
|
|
</div>
|
|
</span>
|
|
<span class="toolbar-sep"></span>
|
|
<button type="button" class="btn btn-tool" data-action="code" data-key="C" title="Inline code (C)">`</button>
|
|
<button type="button" class="btn btn-tool" data-action="codeblock" data-key="K" title="Code block (K)">```</button>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="Link (L/P)">L▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="link" data-key="L" title="Link (L)">Link</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="wikilink" data-key="P" title="Wiki link (P)">Wiki link</button>
|
|
</div>
|
|
</span>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="List (U/O/X)">≡▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="ul" data-key="U" title="Unordered list (U)">Unordered list</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="ol" data-key="O" title="Ordered list (O)">Ordered list</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="task" data-key="X" title="Task list (X)">Task list</button>
|
|
</div>
|
|
</span>
|
|
<button type="button" class="btn btn-tool" data-action="quote" data-key="Q" title="Blockquote (Q)">></button>
|
|
<button type="button" class="btn btn-tool" data-action="hr" data-key="R" title="Horizontal rule (R)">---</button>
|
|
<span class="toolbar-sep"></span>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="Table (T)">T▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="fmttable" data-key="T" title="Format table (T)">Format table</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tblalignleft" title="Align left">Align left</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tblaligncenter" title="Align center">Align center</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tblalignright" title="Align right">Align right</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tblinsertcol" title="Insert column">Insert column</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tbldeletecol" title="Delete column">Delete column</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tblinsertrow" title="Insert row">Insert row</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="tbldeleterow" title="Delete row">Delete row</button>
|
|
</div>
|
|
</span>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="Insert date (D/W)">D▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="dateiso" data-key="D" title="YYYY-MM-DD (D)">YYYY-MM-DD</button>
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="datelong" data-key="W" title="DE Long (W)">DE Long</button>
|
|
</div>
|
|
</span>
|
|
<span class="dropdown">
|
|
<button type="button" class="btn btn-tool dropdown-toggle" title="Special (V)">★▾</button>
|
|
<div class="dropdown-menu">
|
|
<button type="button" class="btn btn-tool dropdown-item" data-action="movie" data-key="V" title="Import movie (V)">Import movie</button>
|
|
</div>
|
|
</span>
|
|
<span class="toolbar-sep"></span>
|
|
<button type="button" class="btn btn-tool" data-action="wide" data-key="Z" title="Toggle wide mode (Z)">⇔</button>
|
|
</div>
|
|
<textarea name="content" id="editor" autofocus>{{.RawContent}}</textarea>
|
|
</form>
|
|
<script src="/_/editor/lists.js"></script>
|
|
<script src="/_/editor/tables.js"></script>
|
|
<script src="/_/editor/dates.js"></script>
|
|
<script src="/_/editor/movie.js"></script>
|
|
<script src="/_/editor/main.js"></script>
|
|
{{end}}
|