예제 #1
0
        protected static ContentSelection SelectElementCore(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, ContentSelection smartContentSelection)
        {
            Debug.Assert(e.sourceIndex > -1, "Cannot select an unpositioned element");
            if (e.sourceIndex > -1) //avoid unhandled exception reported by bug 291968
            {
                //suspend selection change events while the selection object is replaced
                editorComponentContext.BeginSelectionChange();
                try
                {
                    //clear the DOM selection so that whatever is currently selected gets unselected.
                    editorComponentContext.EmptySelection();

                    //select the newly smart content element
                    editorComponentContext.Selection = smartContentSelection;
                    return(smartContentSelection);
                }
                finally
                {
                    editorComponentContext.EndSelectionChange();
                }
            }
            return(null);
        }
        protected static ContentSelection SelectElementCore(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, ContentSelection smartContentSelection)
        {
            Debug.Assert(e.sourceIndex > -1, "Cannot select an unpositioned element");
            if (e.sourceIndex > -1) //avoid unhandled exception reported by bug 291968
            {
                //suspend selection change events while the selection object is replaced
                editorComponentContext.BeginSelectionChange();
                try
                {
                    //clear the DOM selection so that whatever is currently selected gets unselected.
                    editorComponentContext.EmptySelection();

                    //select the newly smart content element
                    editorComponentContext.Selection = smartContentSelection;
                    return smartContentSelection;
                }
                finally
                {
                    editorComponentContext.EndSelectionChange();
                }
            }
            return null;
        }