From: Radek Czajka Date: Mon, 19 Jun 2023 12:15:29 +0000 (+0200) Subject: Uwaga button. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/4334b1df511eb3a8161e9a98b1d3f00777e4e054?ds=inline;hp=fbedc8f26f2879a46629edc72ce20e3e85135523 Uwaga button. --- diff --git a/src/redakcja/static/css/html.scss b/src/redakcja/static/css/html.scss index 6d3d3c54..cfd7fc2d 100644 --- a/src/redakcja/static/css/html.scss +++ b/src/redakcja/static/css/html.scss @@ -351,7 +351,7 @@ div[x-node] > .uwaga { visibility: hidden; } -.edit-button, .delete-button, .accept-button, .tytul-button, .wyroznienie-button, .slowo-button, .znak-button { +.active-block-button, .delete-button, .accept-button, .tytul-button, .wyroznienie-button, .slowo-button, .znak-button { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: 16px; line-height: 1.5; @@ -393,8 +393,12 @@ div[x-node] > .uwaga { left:450px; width:100px; } +.uwaga-button { + right: 0; + left: auto; +} -.edit-button:hover, .edit-button:active, +.active-block-button:hover, .active-block-button:active, .delete-button:hover, .delete-button:active, .accept-button:hover, .accept-button:active, .tytul-button:hover, .tytul-button:active, diff --git a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js index 5183a97e..e5b0796b 100644 --- a/src/redakcja/static/js/wiki/view_editor_wysiwyg.js +++ b/src/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -479,9 +479,20 @@ }; }); } - else if($box.is('*[x-annotation-box]') || $origin.is('*[x-edit-attribute]')) { + else if($box.is('*[x-annotation-box]') || $origin.is('*[x-edit-attribute]') || $origin.is('*[x-node="uwaga"]')) { + let q; + switch ($origin.attr('x-node')) { + case 'uwaga': + q = 'tę uwagę'; + break; + case 'ref': + q = 'tę referencję'; + break + default: + q = 'ten przypis'; + } $('.delete-button', $overlay).click(function(){ - if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten przypis?")) { + if (window.confirm("Czy jesteś pewien, że chcesz usunąć " + q + "?")) { $origin.remove(); $overlay.remove(); $(document).unbind('click.blur-overlay'); @@ -621,6 +632,16 @@ }); } + function createUwagaBefore(before) { + xml2html({ + xml: '', + success: function(element){ + let $element = $(element); + $element.insertBefore(before); + openForEdit($element); + } + }); + } function VisualPerspective(options){ perspective = this; @@ -629,26 +650,25 @@ options.callback = function(){ var element = $("#html-view"); - var button = $(''); + var button = $(''); + var uwagaButton = $(''); if (!CurrentDocument.readonly) { $('#html-view').bind('mousemove', function(event){ var editable = $(event.target).closest('*[x-editable]'); - $('.active', element).not(editable).removeClass('active').children('.edit-button').remove(); + $('.active', element).not(editable).removeClass('active').children('.active-block-button').remove(); if (!editable.hasClass('active')) { editable.addClass('active').append(button); + if (!editable.is('[x-edit-attribute]')) { + editable.append(uwagaButton); + } } if (editable.is('.annotation-inline-box')) { $('*[x-annotation-box]', editable).css({ -// left: event.clientX - editable.offset().left + 5, -// top: event.clientY - editable.offset().top + 5 }).show(); } - else { -// $('*[x-annotation-box]').hide(); - } }); perspective.caret = new Caret(element); @@ -685,6 +705,10 @@ openForEdit($(this).parent()); }); + $(document).on('click', '.uwaga-button', function(event){ + event.preventDefault(); + createUwagaBefore($(this).parent()); + }); } $(document).on('click', '[x-node="motyw"]', function(){