CurrentDocument.active = new Date();
});
+ $(window).keydown(function(e) {
+ if (e.ctrlKey || e.metaKey) {
+ switch (e.key) {
+ case 's':
+ e.preventDefault();
+ $("#save-button").click();
+ break;
+ }
+ }
+ });
+
console.log("Fetching document's text");
$(document).bind('wlapi_document_changed', function(event, doc) {
success: function(text){
var t = $(text);
tag.replaceWith(t);
- openForEdit(t);
+ openForEdit(t, trim=false);
},
error: function(){
tag.remove();
}
/* open edition window for selected fragment */
- function openForEdit($origin){
+ function openForEdit($origin, trim=true){
var $box = null
// annotations overlay their sub box - not their own box //
element: source,
stripOuter: true,
success: function(text){
- let ttext = $.trim(text);
+ let ttext = text;
+ if (trim) {
+ ttext = ttext.trim();
+ }
$('textarea', $overlay).val(ttext);
setTimeout(function(){
<span class="navbar-text">{% trans "Version" %}: <span id="document-revision">{% trans "Unknown" %}</span></span>
{% if not readonly %}
- <button class='ml-2 nav-item btn btn-primary' id="save-button">{% trans "Save" %}</button>
+ <button class='ml-2 nav-item btn btn-primary' id="save-button" title="[Ctrl-s]">{% trans "Save" %}</button>
<span id='save-attempt-info' class="navbar-text ml-2"><span class="alert alert-info">{% trans "Save attempt in progress" %}</span></span>
<span id='out-of-date-info' class="navbar-text ml-2"><span class="alert alert-danger">{% trans "There is a newer version of this document!" %}</span></span>
{% endif %}
<span data-ui-error-for="{{ forms.text_save.author_email.name }}"> </span></td>
</tr>
</table>
- {% else %}
- <p>
- {{ forms.text_save.stage_completed.label }}:
- {{ forms.text_save.stage_completed }}
- <span class="help_text">{{ forms.text_save.stage_completed.help_text }}</span>
- <span data-ui-error-for="{{ forms.text_save.stage_completed.name }}"> </span>
- </p>
- {% if can_pubmark %}
- <p>
- {{ forms.text_save.publishable.label_tag }}:
- {{ forms.text_save.publishable }}
- <span class="help_text">{{ forms.text_save.publishable.help_text }}</span>
- <span data-ui-error-for="{{ forms.text_save.publishable.name }}"> </span>
- </p>
{% endif %}
+ <p data-ui-error-for="__all__"> </p>
+
+ <div class="container">
+ <button type="submit" class="ok btn btn-primary" data-ui-action="save">Zapisz</button>
+ <button type="button" class="cancel btn btn-secondary" data-ui-action="cancel">Anuluj</button>
+
+ {% if request.user.is_authenticated %}
+ <div class="row mt-4">
+ <div class="col-6">
+ {{ forms.text_save.stage_completed.label }}:
+ {{ forms.text_save.stage_completed }}
+ <span class="help_text">{{ forms.text_save.stage_completed.help_text }}</span>
+ <span data-ui-error-for="{{ forms.text_save.stage_completed.name }}"> </span>
+ </div>
+ {% if can_pubmark %}
+ <div class="col-6">
+ {{ forms.text_save.publishable.label_tag }}
+ {{ forms.text_save.publishable }}
+ <span class="help_text">{{ forms.text_save.publishable.help_text }}</span>
+ <span data-ui-error-for="{{ forms.text_save.publishable.name }}"> </span>
+ </div>
{% endif %}
+ </div>
+
+ {% endif %}
+ </div>
{% for f in forms.text_save.hidden_fields %}
{{ f }}
{% endfor %}
- <p data-ui-error-for="__all__"> </p>
-
- <p class="action_area">
- <button type="submit" class="ok" data-ui-action="save">Zapisz</button>
- <button type="button" class="cancel" data-ui-action="cancel">Anuluj</button>
- </p>
</form>
</div>