Re: selection to node

  •  01-08-2014, 9:50 AM

    Re: selection to node

    I'll do the custom Mark function, this opens a dialog wich allows you to mark the word you selected for later indexing and add a description.

    This is the one with the least amount of javascript.

    I still have to replace the handwritten html with "

    var element = editor.GetFrame().contentDocument.createElement("mark"); 

    " . But I first want the right functionality.

    1. var editor;  
    2. function RichTextEditor_OnLoad(rteeditor) {  
    3.     editor = rteeditor;  
    4.     editor.AttachEvent("ExecUICommand", CaptureSaveEvent);  
    5. }  
    6. function CaptureSaveEvent(rteeditor, info) {  
    7.     if (!rteeditor) return;  
    8.     if (!info || !info.Arguments || !info.Arguments[1]) return;  
    9.   
    10.     if (info.Arguments[1] == "DoMark") {  
    11.         // Todo edit if mark selected  
    12.   
    13.         var oldvalue = editor.GetRangePreviewHTML();  
    14.         editor.ShowXmlDialog("/richtexteditor/dialogs/mark.xml", {  
    15.             value: oldvalue,  
    16.             confirm: function (markvalue) {  
    17.                 if (!!markvalue && markvalue.trim() != "") {  
    18.                     var newvalue = "<mark data-value=\"" + markvalue + "\">" + oldvalue + "</mark>";  
    19.                     var insert = editor.InsertHTML(newvalue, true);  
    20.                     insert[0].Ox13.focus(0);  
    21.                     insert[0].Ox13.selectionStart = 0;  
    22.                     insert[0].Ox13.selectionEnd = 0;  
    23.                     editor.ExecCommand("CleanCode");  
    24.                 }  
    25.             }  
    26.         });  
    27.     }             
    28. }  
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems