1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-06-07 13:24:06 +00:00

Editor: Make the textarea bigger

This commit is contained in:
Timur Ismagilov 2022-04-24 15:19:52 +03:00
parent 49b94074d1
commit 57efc3e848
4 changed files with 123 additions and 121 deletions

View File

@ -1,5 +1,5 @@
{ {
"title": "Редактирование «%s»", "title": "Редактирование %s",
"new_hypha": "Вы создаёте новую гифу.", "new_hypha": "Вы создаёте новую гифу.",
"tag": "Опишите ваши правки:", "tag": "Опишите ваши правки:",

View File

@ -92,19 +92,15 @@ body { margin: 0; font-size:16px; font-family: sans-serif; color: black; }
input, kbd { font: inherit; color: inherit; } input, kbd { font: inherit; color: inherit; }
textarea {font-size:16px; font-family: inherit; line-height: 150%; } textarea {font-size:16px; font-family: inherit; line-height: 150%; }
.edit { min-height: 80vh; } .edit { height: 90vh; }
.edit__title { margin-top: 0; } .edit__title { margin-top: 0; }
.edit__preview { border: 2px dashed #ddd; padding: 10px; } .edit__preview { border: 2px dashed #ddd; padding: 10px; }
.edit-form__textarea { width: 100%; height: calc(100% - 8rem); min-height: 4rem; } .edit-form__textarea { width: 100%; height: 80vh; min-height: 4rem; }
.edit-form p { margin: .25rem 0; }
.edit-form__message { width: 100%; margin: 0.25em 0; } .edit-form__message { width: 100%; margin: 0.25em 0; }
.edit-form__save { font-weight: bold; } .edit-form__save { font-weight: bold; }
.edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; } .edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; }
@media screen and (max-height: 500px) { .edit-form { height: 100%; display: flex; flex-direction: column; }
.edit-form { height: 90vh; }
}
@media screen and (min-height: 501px) {
.edit-form { height: 80vh; }
}
.icon {margin-right: .25rem; vertical-align: bottom; } .icon {margin-right: .25rem; vertical-align: bottom; }

View File

@ -70,18 +70,19 @@
lc := l18n.FromRequest(rq) lc := l18n.FromRequest(rq)
%} %}
<main class="main-width edit edit_no-preview"> <main class="main-width edit edit_no-preview">
<h1 class="edit__title">{%s= fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName)) %}</h1>
{%s= warning %}
<form method="post" class="edit-form" <form method="post" class="edit-form"
action="/upload-text/{%s hyphaName %}"> action="/upload-text/{%s hyphaName %}">
<h1 class="edit__title">{%s= fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName)) %}</h1>
{%s= warning %}
<textarea name="text" class="edit-form__textarea" autofocus>{%s textAreaFill %}</textarea> <textarea name="text" class="edit-form__textarea" autofocus>{%s textAreaFill %}</textarea>
<br><br> <p class="edit-form__message-zone">
<label for="text">{%s lc.Get("edit.tag") %}</label><br> <input id="text" type="text" name="message" class="edit-form__message" placeholder="{%s lc.Get("edit.tag") %}" aria-label="{%s lc.Get("edit.tag") %}">
<input id="text" type="text" name="message" class="edit-form__message"> </p>
<br><br> <p class="edit-form__buttons">
<button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">{%s lc.Get("edit.save") %}</button> <button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">{%s lc.Get("edit.save") %}</button>
<button type="submit" name="action" class="btn edit-form__preview" value="Preview">{%s lc.Get("edit.preview") %}</button> <button type="submit" name="action" class="btn edit-form__preview" value="Preview">{%s lc.Get("edit.preview") %}</button>
<a href="/hypha/{%s hyphaName %}" class="btn btn_weak">{%s lc.Get("ui.cancel") %}</a> <a href="/hypha/{%s hyphaName %}" class="btn btn_weak">{%s lc.Get("ui.cancel") %}</a>
</p>
</form> </form>
</main> </main>
{%s= Toolbar(user.FromRequest(rq), lc) %} {%s= Toolbar(user.FromRequest(rq), lc) %}

View File

@ -190,35 +190,39 @@ func StreamEditor(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAr
//line views/mutators.qtpl:71 //line views/mutators.qtpl:71
qw422016.N().S(` qw422016.N().S(`
<main class="main-width edit edit_no-preview"> <main class="main-width edit edit_no-preview">
<h1 class="edit__title">`)
//line views/mutators.qtpl:73
qw422016.N().S(fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName)))
//line views/mutators.qtpl:73
qw422016.N().S(`</h1>
`)
//line views/mutators.qtpl:74
qw422016.N().S(warning)
//line views/mutators.qtpl:74
qw422016.N().S(`
<form method="post" class="edit-form" <form method="post" class="edit-form"
action="/upload-text/`) action="/upload-text/`)
//line views/mutators.qtpl:76 //line views/mutators.qtpl:74
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line views/mutators.qtpl:76 //line views/mutators.qtpl:74
qw422016.N().S(`"> qw422016.N().S(`">
<h1 class="edit__title">`)
//line views/mutators.qtpl:75
qw422016.N().S(fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName)))
//line views/mutators.qtpl:75
qw422016.N().S(`</h1>
`)
//line views/mutators.qtpl:76
qw422016.N().S(warning)
//line views/mutators.qtpl:76
qw422016.N().S(`
<textarea name="text" class="edit-form__textarea" autofocus>`) <textarea name="text" class="edit-form__textarea" autofocus>`)
//line views/mutators.qtpl:77 //line views/mutators.qtpl:77
qw422016.E().S(textAreaFill) qw422016.E().S(textAreaFill)
//line views/mutators.qtpl:77 //line views/mutators.qtpl:77
qw422016.N().S(`</textarea> qw422016.N().S(`</textarea>
<br><br> <p class="edit-form__message-zone">
<label for="text">`) <input id="text" type="text" name="message" class="edit-form__message" placeholder="`)
//line views/mutators.qtpl:79 //line views/mutators.qtpl:79
qw422016.E().S(lc.Get("edit.tag")) qw422016.E().S(lc.Get("edit.tag"))
//line views/mutators.qtpl:79 //line views/mutators.qtpl:79
qw422016.N().S(`</label><br> qw422016.N().S(`" aria-label="`)
<input id="text" type="text" name="message" class="edit-form__message"> //line views/mutators.qtpl:79
<br><br> qw422016.E().S(lc.Get("edit.tag"))
//line views/mutators.qtpl:79
qw422016.N().S(`">
</p>
<p class="edit-form__buttons">
<button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">`) <button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">`)
//line views/mutators.qtpl:82 //line views/mutators.qtpl:82
qw422016.E().S(lc.Get("edit.save")) qw422016.E().S(lc.Get("edit.save"))
@ -238,209 +242,210 @@ func StreamEditor(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAr
qw422016.E().S(lc.Get("ui.cancel")) qw422016.E().S(lc.Get("ui.cancel"))
//line views/mutators.qtpl:84 //line views/mutators.qtpl:84
qw422016.N().S(`</a> qw422016.N().S(`</a>
</p>
</form> </form>
</main> </main>
`) `)
//line views/mutators.qtpl:87 //line views/mutators.qtpl:88
qw422016.N().S(Toolbar(user.FromRequest(rq), lc)) qw422016.N().S(Toolbar(user.FromRequest(rq), lc))
//line views/mutators.qtpl:87 //line views/mutators.qtpl:88
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:88 //line views/mutators.qtpl:89
streameditScripts(qw422016) streameditScripts(qw422016)
//line views/mutators.qtpl:88 //line views/mutators.qtpl:89
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
} }
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
func WriteEditor(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) { func WriteEditor(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
StreamEditor(qw422016, rq, hyphaName, textAreaFill, warning) StreamEditor(qw422016, rq, hyphaName, textAreaFill, warning)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
} }
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
func Editor(rq *http.Request, hyphaName, textAreaFill, warning string) string { func Editor(rq *http.Request, hyphaName, textAreaFill, warning string) string {
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
WriteEditor(qb422016, rq, hyphaName, textAreaFill, warning) WriteEditor(qb422016, rq, hyphaName, textAreaFill, warning)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
return qs422016 return qs422016
//line views/mutators.qtpl:89 //line views/mutators.qtpl:90
} }
//line views/mutators.qtpl:91 //line views/mutators.qtpl:92
func StreamPreview(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) { func StreamPreview(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) {
//line views/mutators.qtpl:91 //line views/mutators.qtpl:92
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:93 //line views/mutators.qtpl:94
lc := l18n.FromRequest(rq) lc := l18n.FromRequest(rq)
//line views/mutators.qtpl:94 //line views/mutators.qtpl:95
qw422016.N().S(` qw422016.N().S(`
<main class="main-width edit edit_with-preview"> <main class="main-width edit edit_with-preview">
<h1 class="edit__title">`) <h1 class="edit__title">`)
//line views/mutators.qtpl:96 //line views/mutators.qtpl:97
qw422016.N().S(fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName))) qw422016.N().S(fmt.Sprintf(lc.Get("edit.title"), beautifulLink(hyphaName)))
//line views/mutators.qtpl:96 //line views/mutators.qtpl:97
qw422016.N().S(`</h1> qw422016.N().S(`</h1>
`) `)
//line views/mutators.qtpl:97 //line views/mutators.qtpl:98
qw422016.N().S(warning) qw422016.N().S(warning)
//line views/mutators.qtpl:97 //line views/mutators.qtpl:98
qw422016.N().S(` qw422016.N().S(`
<form method="post" class="edit-form" <form method="post" class="edit-form"
action="/upload-text/`) action="/upload-text/`)
//line views/mutators.qtpl:99 //line views/mutators.qtpl:100
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line views/mutators.qtpl:99 //line views/mutators.qtpl:100
qw422016.N().S(`"> qw422016.N().S(`">
<textarea name="text" class="edit-form__textarea" autofocus>`) <textarea name="text" class="edit-form__textarea" autofocus>`)
//line views/mutators.qtpl:100 //line views/mutators.qtpl:101
qw422016.E().S(textAreaFill) qw422016.E().S(textAreaFill)
//line views/mutators.qtpl:100 //line views/mutators.qtpl:101
qw422016.N().S(`</textarea> qw422016.N().S(`</textarea>
<br><br> <br><br>
<label for="text">`) <label for="text">`)
//line views/mutators.qtpl:102 //line views/mutators.qtpl:103
qw422016.E().S(lc.Get("edit.tag")) qw422016.E().S(lc.Get("edit.tag"))
//line views/mutators.qtpl:102 //line views/mutators.qtpl:103
qw422016.N().S(`</label><br> qw422016.N().S(`</label><br>
<input id="text" type="text" name="message" class="edit-form__message" value="`) <input id="text" type="text" name="message" class="edit-form__message" value="`)
//line views/mutators.qtpl:103 //line views/mutators.qtpl:104
qw422016.E().S(message) qw422016.E().S(message)
//line views/mutators.qtpl:103 //line views/mutators.qtpl:104
qw422016.N().S(`"> qw422016.N().S(`">
<br><br> <br><br>
<button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">`) <button type="submit" name="action" class="btn btn_accent edit-form__save" value="Save">`)
//line views/mutators.qtpl:105 //line views/mutators.qtpl:106
qw422016.E().S(lc.Get("edit.save")) qw422016.E().S(lc.Get("edit.save"))
//line views/mutators.qtpl:105 //line views/mutators.qtpl:106
qw422016.N().S(`</button> qw422016.N().S(`</button>
<button type="submit" name="action" class="btn edit-form__preview" value="Preview">`) <button type="submit" name="action" class="btn edit-form__preview" value="Preview">`)
//line views/mutators.qtpl:106 //line views/mutators.qtpl:107
qw422016.E().S(lc.Get("edit.preview")) qw422016.E().S(lc.Get("edit.preview"))
//line views/mutators.qtpl:106 //line views/mutators.qtpl:107
qw422016.N().S(`</button> qw422016.N().S(`</button>
<a href="/hypha/`) <a href="/hypha/`)
//line views/mutators.qtpl:107 //line views/mutators.qtpl:108
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line views/mutators.qtpl:107 //line views/mutators.qtpl:108
qw422016.N().S(`" class="btn btn_weak">`) qw422016.N().S(`" class="btn btn_weak">`)
//line views/mutators.qtpl:107 //line views/mutators.qtpl:108
qw422016.E().S(lc.Get("ui.cancel")) qw422016.E().S(lc.Get("ui.cancel"))
//line views/mutators.qtpl:107 //line views/mutators.qtpl:108
qw422016.N().S(`</a> qw422016.N().S(`</a>
</form> </form>
<p class="warning">`) <p class="warning">`)
//line views/mutators.qtpl:109 //line views/mutators.qtpl:110
qw422016.E().S(lc.Get("edit.preview_tip")) qw422016.E().S(lc.Get("edit.preview_tip"))
//line views/mutators.qtpl:109 //line views/mutators.qtpl:110
qw422016.N().S(`</p> qw422016.N().S(`</p>
<article class="edit__preview">`) <article class="edit__preview">`)
//line views/mutators.qtpl:110 //line views/mutators.qtpl:111
qw422016.N().S(renderedPage) qw422016.N().S(renderedPage)
//line views/mutators.qtpl:110 //line views/mutators.qtpl:111
qw422016.N().S(`</article> qw422016.N().S(`</article>
</main> </main>
`) `)
//line views/mutators.qtpl:112 //line views/mutators.qtpl:113
qw422016.N().S(Toolbar(user.FromRequest(rq), lc)) qw422016.N().S(Toolbar(user.FromRequest(rq), lc))
//line views/mutators.qtpl:112 //line views/mutators.qtpl:113
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:113 //line views/mutators.qtpl:114
streameditScripts(qw422016) streameditScripts(qw422016)
//line views/mutators.qtpl:113 //line views/mutators.qtpl:114
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
} }
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
func WritePreview(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) { func WritePreview(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) {
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
StreamPreview(qw422016, rq, hyphaName, textAreaFill, message, warning, renderedPage) StreamPreview(qw422016, rq, hyphaName, textAreaFill, message, warning, renderedPage)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
} }
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
func Preview(rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) string { func Preview(rq *http.Request, hyphaName, textAreaFill, message, warning string, renderedPage string) string {
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
WritePreview(qb422016, rq, hyphaName, textAreaFill, message, warning, renderedPage) WritePreview(qb422016, rq, hyphaName, textAreaFill, message, warning, renderedPage)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
return qs422016 return qs422016
//line views/mutators.qtpl:114 //line views/mutators.qtpl:115
} }
//line views/mutators.qtpl:116 //line views/mutators.qtpl:117
func streameditScripts(qw422016 *qt422016.Writer) { func streameditScripts(qw422016 *qt422016.Writer) {
//line views/mutators.qtpl:116 //line views/mutators.qtpl:117
qw422016.N().S(` qw422016.N().S(`
<script src="/static/editor.js"></script> <script src="/static/editor.js"></script>
`) `)
//line views/mutators.qtpl:118 //line views/mutators.qtpl:119
for _, scriptPath := range cfg.EditScripts { for _, scriptPath := range cfg.EditScripts {
//line views/mutators.qtpl:118 //line views/mutators.qtpl:119
qw422016.N().S(` qw422016.N().S(`
<script src="`) <script src="`)
//line views/mutators.qtpl:119 //line views/mutators.qtpl:120
qw422016.E().S(scriptPath) qw422016.E().S(scriptPath)
//line views/mutators.qtpl:119 //line views/mutators.qtpl:120
qw422016.N().S(`"></script> qw422016.N().S(`"></script>
`) `)
//line views/mutators.qtpl:120 //line views/mutators.qtpl:121
} }
//line views/mutators.qtpl:120 //line views/mutators.qtpl:121
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
} }
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
func writeeditScripts(qq422016 qtio422016.Writer) { func writeeditScripts(qq422016 qtio422016.Writer) {
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
streameditScripts(qw422016) streameditScripts(qw422016)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
} }
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
func editScripts() string { func editScripts() string {
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
writeeditScripts(qb422016) writeeditScripts(qb422016)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
return qs422016 return qs422016
//line views/mutators.qtpl:121 //line views/mutators.qtpl:122
} }