From: root Date: Tue, 5 Oct 2010 12:51:38 +0000 (-0500) Subject: Ticket 868: tags in visual editor X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/421fbd31647ecb40540f767b1d506e0843dfc3a9 Ticket 868: tags in visual editor --- diff --git a/redakcja/static/css/html.css b/redakcja/static/css/html.css index 820aed7a..d156aabe 100644 --- a/redakcja/static/css/html.css +++ b/redakcja/static/css/html.css @@ -479,7 +479,7 @@ div[x-node] > .uwaga { visibility: hidden; } -.edit-button, .delete-button, .accept-button { +.edit-button, .delete-button, .accept-button, .tytul-button, .wyroznienie-button, .slowo-button { position: absolute; top: -21px; left: -1px; @@ -502,9 +502,26 @@ div[x-node] > .uwaga { left: 70px; } +.tytul-button { + left:200px; + width:100px; +} + +.wyroznienie-button { + left:300px; + width:100px; +} +.slowo-button { + left: 400px; + width:100px; +} + .edit-button:hover, .edit-button:active, .delete-button:hover, .delete-button:active, -.accept-button:hover, .accept-button:active { +.accept-button:hover, .accept-button:active, +.tytul-button:hover, .tytul-button:active, +.wyroznienie-button:hover, .wyroznienie-button:active, +.slowo-button:hover, .slowo-button:active { /* color: #FFF;*/ background-color: #999; color: #FFF; diff --git a/redakcja/static/js/wiki/view_editor_wysiwyg.js b/redakcja/static/js/wiki/view_editor_wysiwyg.js index 2beb4d4a..d5fa29dd 100644 --- a/redakcja/static/js/wiki/view_editor_wysiwyg.js +++ b/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -305,7 +305,7 @@ } // start edition on this node - var $overlay = $('
').css({ + var $overlay = $('
').css({ position: 'absolute', height: h, left: x, @@ -315,6 +315,7 @@ if ($origin.is('.motyw')) { + $('.akap-edit-button').remove(); withThemes(function(canonThemes){ $('textarea', $overlay).autocomplete(canonThemes, { autoFill: true, @@ -398,6 +399,39 @@ }); } + $('.akap-edit-button', $overlay).click(function(){ + var textAreaOpened = $('textarea', $overlay)[0]; + var startTag = ""; + var endTag = ""; + var buttonName = this.innerHTML; + + if(buttonName == "słowo obce") { + startTag = ""; + endTag = ""; + } else if (buttonName == "wyróżnienie") { + startTag = ""; + endTag = ""; + } else if (buttonName == "tytuł dzieła") { + startTag = ""; + endTag = ""; + } + var myField = textAreaOpened; + + //IE support + if (document.selection) { + textAreaOpened.focus(); + sel = document.selection.createRange(); + sel.text = startTag + sel.text + endTag; + } + //MOZILLA/NETSCAPE support + else if (textAreaOpened.selectionStart || textAreaOpened.selectionStart == '0') { + var startPos = textAreaOpened.selectionStart; + var endPos = textAreaOpened.selectionEnd; + textAreaOpened.value = textAreaOpened.value.substring(0, startPos) + + startTag + textAreaOpened.value.substring(startPos, endPos) + endTag + textAreaOpened.value.substring(endPos, textAreaOpened.value.length); + } + }); + $('.accept-button', $overlay).click(function(){ save(); });