better handling for enter

This commit is contained in:
Edward Betts 2017-02-20 20:03:36 +00:00
parent ca92fc8046
commit d652208e94
2 changed files with 8 additions and 4 deletions

View file

@ -8,9 +8,9 @@ div#text { font-family: Courier; }
<div class="row">
<div class="col-xs-12">
<h1>{{ title }}
{% if doc.user == current_user %}
{# {% if doc.user == current_user %} #}
<a href="{{ doc.edit_url }}" class="btn btn-default">edit</a>
{% endif %}
{# {% endif %} #}
{% if doc.type == 'xanadoc' %}
<a href="{{ doc.url }}" class="btn btn-default">fulfil</a>
{% endif %}
@ -23,7 +23,9 @@ div#text { font-family: Courier; }
<p data-start="{{ start }}">
{% for i in line %}
{%- if i.highlight -%}
{% if i.highlight != '\n' and i.highlight != '\r\n' %}
<span class="highlight">{{- i.highlight -}}</span>
{% endif %}
{%- else -%}
{{- i.text -}}
{%- endif -%}
@ -32,6 +34,8 @@ div#text { font-family: Courier; }
{%- endfor -%}
{% else %}
{%- for start, line in iter_lines(doc.text) if line -%}
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %}&nbsp;{% endif
%}</p>#}
<p data-start="{{ start }}">{{ line }}</p>
{%- endfor -%}
{% endif %}

View file

@ -166,7 +166,7 @@ def view_item(username, hashid, raw=False):
@bp.route('/<username>/<hashid>/edit', methods=['GET', 'POST'])
def edit_item(username, hashid):
obj = get_item(current_user.username, hashid)
obj = get_item(username, hashid)
form = SourceDocForm(obj=obj)
if form.validate_on_submit():
form.populate_obj(obj)