Suggesting to add a button to the standatd editor to quote selected text (selected anywhere, not only in the editor field)
Here is the code

js: 
textObj=document.getElementById("edit-comment");
       txt = '';
        if (window.getSelection && !window.opera) txt = window.getSelection();
        else if (document.getSelection) txt = document.getSelection();
        else if (document.selection) txt = document.selection.createRange().text;
        txt='[quote]\n' + txt + '\n[/quote]\n';
    textV=txt;

    textV=textV.replace(/\s\[\?\]/g,'')
    if (textV==''||!textObj) return
    var ver=8;
    if(document.all && !window.opera){
      if (textObj.createTextRange&&textObj.caretPos) {
          var caretPos=textObj.caretPos
          caretPos.text=textV
        }else textObj.value+= textV
        }else
        {var brows=navigator.userAgent.toString()
         var scrollTop, scrollLeft
         if (textObj.type=='textarea'&&textObj.scrollTop)
         {scrollTop=textObj.scrollTop;scrollLeft=textObj.scrollLeft}                
          if(brows.search(/opera\/?(\d*.\d*)/i)!=-1) ver=RegExp.$1 
          if(textObj.selectionStart>=0&&ver>=8){
          if(textObj.textLength != undefined) 
           {var selLength=textObj.textLength 
            var selStart=textObj.selectionStart
            var selEnd=textObj.selectionEnd 
            if (selEnd==1||selEnd==2)selEnd=selLength  
            var s1=(textObj.value).substring(0,selStart) 
            var s2=(textObj.value).substring(selEnd,selLength)
            textObj.value=s1+textV+s2
            textObj.setSelectionRange(selStart+textV.length,selStart+textV.length) 
            } 
            if (typeof scrollTop != 'undefined')
            {textObj.scrollTop=scrollTop;textObj.scrollLeft=scrollLeft}
           }else textObj.value+=textV
        }

Comments

superfedya’s picture

Doesn't work with 6.x-2.5.

Any fix?

Thanks!

__Sander__’s picture

I am afraid, not now...
I really do not want to update my site untill it is a security reason or some significant improvement I need.
So I have nowhere to test it on...

ufku’s picture

Status: Active » Closed (won't fix)

Core would include only very simple buttons.