mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 09:21:04 +00:00
Merge pull request #458 from SethFalco/fix-437
fix: don't update url after character-limit
This commit is contained in:
commit
dcc821bc3c
4 changed files with 23 additions and 21 deletions
|
@ -10,11 +10,11 @@ insert_final_newline = true
|
||||||
curly_bracket_next_line = false
|
curly_bracket_next_line = false
|
||||||
spaces_around_operators = true
|
spaces_around_operators = true
|
||||||
|
|
||||||
[*.{js,py}]
|
[*.js]
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[*.{js,ts}]
|
|
||||||
quote_type = double
|
quote_type = double
|
||||||
|
|
||||||
|
[*.{js,js.template,py}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[*.{markdown,md}]
|
[*.{markdown,md}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
|
@ -527,6 +527,12 @@ def create_app(args):
|
||||||
if not target_lang:
|
if not target_lang:
|
||||||
abort(400, description=_("Invalid request: missing %(name)s parameter", name='target'))
|
abort(400, description=_("Invalid request: missing %(name)s parameter", name='target'))
|
||||||
|
|
||||||
|
if not request.is_json:
|
||||||
|
# Normalize line endings to UNIX style (LF) only so we can consistently
|
||||||
|
# enforce character limits.
|
||||||
|
# https://www.rfc-editor.org/rfc/rfc2046#section-4.1.1
|
||||||
|
q = "\n".join(q.splitlines())
|
||||||
|
|
||||||
batch = isinstance(q, list)
|
batch = isinstance(q, list)
|
||||||
|
|
||||||
if batch and args.batch_limit != -1:
|
if batch and args.batch_limit != -1:
|
||||||
|
|
|
@ -108,10 +108,6 @@ document.addEventListener('DOMContentLoaded', function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.charactersLimit !== -1 && this.inputText.length >= this.charactersLimit){
|
|
||||||
this.inputText = this.inputText.substring(0, this.charactersLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update "selected" attribute (to overcome a vue.js limitation)
|
// Update "selected" attribute (to overcome a vue.js limitation)
|
||||||
// but properly display checkmarks on supported browsers.
|
// but properly display checkmarks on supported browsers.
|
||||||
// Also change the <select> width value depending on the <option> length
|
// Also change the <select> width value depending on the <option> length
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
<label for="textarea1" class="sr-only">
|
<label for="textarea1" class="sr-only">
|
||||||
{{ _h("Text to translate") }}
|
{{ _h("Text to translate") }}
|
||||||
</label>
|
</label>
|
||||||
<textarea id="textarea1" v-model="inputText" @input="handleInput" ref="inputTextarea" dir="auto"></textarea>
|
<textarea id="textarea1" :maxLength="charactersLimit" v-model="inputText" @input="handleInput" ref="inputTextarea" dir="auto"></textarea>
|
||||||
<button class="btn-delete-text" title="{{ _h('Delete text') }}" aria-label="{{ _h('Delete text') }}" aria-label="Delete text" @click="deleteText">
|
<button class="btn-delete-text" title="{{ _h('Delete text') }}" aria-label="{{ _h('Delete text') }}" aria-label="Delete text" @click="deleteText">
|
||||||
<i class="material-icons">close</i>
|
<i class="material-icons">close</i>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue