How to get selected html from editor & IE compitability problem

Last post 06-25-2008, 4:29 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  06-23-2008, 4:34 AM 41645

    How to get selected html from editor & IE compitability problem

    1. editor.getHTML() recieves whole html from editor. Is there a posibility to recieve only selected html?
    2. I used the following code to add a new item into right-click pop-up menu. But it works only with Firefox.. IExplorer doesn't display my item in pop-up. What can be the problem. Thanx.
     
    var menu = CuteEditor_CreateMenu(editor);
    window.CuteEditor_AddMainMenuItems(menu)
            
            function CuteEditor_AddMainMenuItems(menuitem)
            {
                menuitem.AddMenuItem(1,"Extended Properties","page.gif",DefaultMenuHandler);
            }
            function CuteEditor_AddDropMenuItems(menuitem,group)
            {
                menuitem.AddMenuItem(1,"drop:"+group,"bold.gif",DefaultMenuHandler);
            }
            function DefaultMenuHandler(menuitem)
            {
                //use CuteEditor_GetEditor(elementinsidetheEditor) to get the cute editor instance
                var editor=CuteEditor_GetEditor(menuitem.editor);
                //show the dialog page , and pass the editor as newwin.dialogArguments(handler,url,args,feature)
                var newwin=editor.ShowDialog(null,"ExControls/ExPropOut.aspx?_rand="+new Date().getTime(),editor,"dialogWidth:400px;dialogHeight:240px");
            }
  •  06-25-2008, 4:29 PM 41718 in reply to 41645

    Re: How to get selected html from editor & IE compitability problem

    Please check the following thread:
     
     
     
      function getSelectedHTML(){
          var rng=null,html="";

          if (document.selection && document.selection.createRange){
            rng=editdoc.selection.createRange();
            html=rng.htmlText||"";
          }else if (window.getSelection){
            rng=editwin.getSelection();

            if (rng.rangeCount > 0 && window.XMLSerializer){
              rng=rng.getRangeAt(0);
              html=new XMLSerializer().serializeToString(rng.cloneContents());
            }
          }
          return html;
        }

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML