Unify Edit/save/cancel buttons
This commit is contained in:
@@ -15,11 +15,16 @@
|
|||||||
{{range .Crumbs}}<span class="sep">/</span
|
{{range .Crumbs}}<span class="sep">/</span
|
||||||
><a href="{{.URL}}">{{.Name}}</a>{{end}}
|
><a href="{{.URL}}">{{.Name}}</a>{{end}}
|
||||||
</nav>
|
</nav>
|
||||||
{{if .CanEdit}}<a class="edit-btn" href="?edit" title="Edit (E)">EDIT</a>{{end}}
|
{{if .EditMode}}
|
||||||
|
<a class="btn-cancel" href="{{.PostURL}}">CANCEL</a>
|
||||||
|
<button class="btn-save" type="submit" form="edit-form" data-action="save" data-key="S" title="Save (S)">SAVE</button>
|
||||||
|
{{else if .CanEdit}}
|
||||||
|
<a class="edit-btn" href="?edit" title="Edit (Alt+Shift+E)">EDIT</a>
|
||||||
|
{{end}}
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
{{if .EditMode}}
|
{{if .EditMode}}
|
||||||
<form class="edit-form" method="POST" action="{{.PostURL}}">
|
<form id="edit-form" class="edit-form" method="POST" action="{{.PostURL}}">
|
||||||
<div class="editor-toolbar">
|
<div class="editor-toolbar">
|
||||||
<button type="button" class="btn-tool" data-action="bold" data-key="B" title="Bold (B)">**</button>
|
<button type="button" class="btn-tool" data-action="bold" data-key="B" title="Bold (B)">**</button>
|
||||||
<button type="button" class="btn-tool" data-action="italic" data-key="I" title="Italic (I)">*</button>
|
<button type="button" class="btn-tool" data-action="italic" data-key="I" title="Italic (I)">*</button>
|
||||||
@@ -38,10 +43,6 @@
|
|||||||
<button type="button" class="btn-tool" data-action="hr" data-key="R" title="Horizontal rule (R)">---</button>
|
<button type="button" class="btn-tool" data-action="hr" data-key="R" title="Horizontal rule (R)">---</button>
|
||||||
</div>
|
</div>
|
||||||
<textarea name="content" id="editor" autofocus>{{.RawContent}}</textarea>
|
<textarea name="content" id="editor" autofocus>{{.RawContent}}</textarea>
|
||||||
<div class="form-actions">
|
|
||||||
<a class="btn-cancel" href="{{.PostURL}}">CANCEL</a>
|
|
||||||
<button class="btn-save" type="submit" data-action="save" data-key="S" title="Save (S)">SAVE</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
<script src="/_/editor.js"></script>
|
<script src="/_/editor.js"></script>
|
||||||
{{else}} {{if .Content}}
|
{{else}} {{if .Content}}
|
||||||
|
|||||||
@@ -303,12 +303,6 @@ textarea:focus {
|
|||||||
box-shadow: 0 0 5px #0a0;
|
box-shadow: 0 0 5px #0a0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.75rem;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-save {
|
.btn-save {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user