Merge pull request #178 from Ilphrin/151-bigger-editor
151 - Make the editor bigger and autosize it
This commit is contained in:
commit
06b311cb48
14
static/js/autoExpand.js
Normal file
14
static/js/autoExpand.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
function autosize(){
|
||||||
|
const el = this;
|
||||||
|
el.style.height = 'auto';
|
||||||
|
el.style.height = (el.scrollHeight ) + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
const articleContent = document.querySelector('#content');
|
||||||
|
let offset = 0;
|
||||||
|
let style = window.getComputedStyle(articleContent, null);
|
||||||
|
|
||||||
|
offset += parseInt(style['paddingTop']) + parseInt(style['paddingBottom']);
|
||||||
|
autosize.bind(articleContent)();
|
||||||
|
articleContent.addEventListener('keyup', autosize);
|
||||||
|
|
@ -422,6 +422,9 @@ form.new-post .title {
|
|||||||
}
|
}
|
||||||
form.new-post textarea {
|
form.new-post textarea {
|
||||||
min-height: 20em;
|
min-height: 20em;
|
||||||
|
overflow-y: hidden;
|
||||||
|
resize: none;
|
||||||
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
form.new-post input[type="submit"] {
|
form.new-post input[type="submit"] {
|
||||||
background: #ECECEC;
|
background: #ECECEC;
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<label for="content">{{ "Content" | _ }}<small>{{ "Markdown is supported" | _ }}</small></label>
|
<label for="content">{{ "Content" | _ }}<small>{{ "Markdown is supported" | _ }}</small></label>
|
||||||
<textarea id="content" name="content" value="{{ form.content | default(value="") }}"></textarea>
|
<textarea id="content" name="content" value="{{ form.content | default(value="") }}" rows="20"></textarea>
|
||||||
|
|
||||||
{% set license_infos = "Default license will be {{ instance.default_license }}" | _(instance=instance) %}
|
{% set license_infos = "Default license will be {{ instance.default_license }}" | _(instance=instance) %}
|
||||||
{{ macros::input(name="license", label="License", errors=errors, form=form, optional=true, details=license_infos) }}
|
{{ macros::input(name="license", label="License", errors=errors, form=form, optional=true, details=license_infos) }}
|
||||||
|
|
||||||
<input type="submit" value="{{ "Publish" | _ }}" />
|
<input type="submit" value="{{ "Publish" | _ }}" />
|
||||||
</form>
|
</form>
|
||||||
|
<script src="/static/js/autoExpand.js"></script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
Loading…
Reference in New Issue
Block a user