protected override void OnElementAttached()
        {
            base.OnElementAttached();
            (HTMLElement as IHTMLElement3).contentEditable = "false";

            string sourceId;
            string contentId;
            if (HTMLElement.id != null)
            {
                try
                {
                    if (HTMLElement.className == HtmlPreserver.PRESERVE_CLASS)
                        _contentState = SmartContentState.Preserve;
                    else
                    {
                        ContentSourceManager.ParseContainingElementId(HTMLElement.id, out sourceId, out contentId);
                        if (sourceId == null || contentId == null)
                            _contentState = SmartContentState.Broken;
                        else
                        {
                            if (_contentSourceContext.FindSmartContent(contentId) == null)
                                _contentState = SmartContentState.Broken;
                        }
                    }
                }
                catch (Exception)
                {
                    _contentState = SmartContentState.Broken;
                }
            }
            else
                _contentState = SmartContentState.Broken;
        }
        public static SmartContentSelection SelectIfSmartContentElement(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, SmartContentState contentState)
        {
            if (e != null)
            {
                IHTMLElement smartContent = ContentSourceManager.GetContainingSmartContent(e);
                if (smartContent == null)
                    return null;

                return SelectElement(editorComponentContext, smartContent, contentState);
            }
            return null;
        }
Ejemplo n.º 3
0
        protected ContentSelection(IHtmlEditorComponentContext editorComponentContext, IHTMLElement element, SmartContentState contentState)
        {
            _editorComponentContext = editorComponentContext;
            _markupServices         = editorComponentContext.MarkupServices;
            _element      = element;
            _contentState = contentState;

            _markupRange = _markupServices.CreateMarkupRange(_element, true);
            _markupRange.Start.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Right;
            _markupRange.End.Gravity   = _POINTER_GRAVITY.POINTER_GRAVITY_Left;
            _markupRange.Start.Cling   = false;
            _markupRange.End.Cling     = false;
        }
Ejemplo n.º 4
0
        protected override void OnElementAttached()
        {
            base.OnElementAttached();
            (HTMLElement as IHTMLElement3).contentEditable = "false";

            string sourceId;
            string contentId;

            if (HTMLElement.id != null)
            {
                try
                {
                    if (HTMLElement.className == HtmlPreserver.PRESERVE_CLASS)
                    {
                        _contentState = SmartContentState.Preserve;
                    }
                    else
                    {
                        ContentSourceManager.ParseContainingElementId(HTMLElement.id, out sourceId, out contentId);
                        if (sourceId == null || contentId == null)
                        {
                            _contentState = SmartContentState.Broken;
                        }
                        else
                        {
                            if (_contentSourceContext.FindSmartContent(contentId) == null)
                            {
                                _contentState = SmartContentState.Broken;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    _contentState = SmartContentState.Broken;
                }
            }
            else
            {
                _contentState = SmartContentState.Broken;
            }
        }
Ejemplo n.º 5
0
        public static SmartContentSelection SelectElement(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, SmartContentState contentState)
        {
            SmartContentSelection selection = (SmartContentSelection)SelectElementCore(editorComponentContext, e, new SmartContentSelection(editorComponentContext, e, contentState));

            return(selection);
        }
Ejemplo n.º 6
0
        public static SmartContentSelection SelectIfSmartContentElement(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, SmartContentState contentState)
        {
            if (e != null)
            {
                IHTMLElement smartContent = ContentSourceManager.GetContainingSmartContent(e);
                if (smartContent == null)
                {
                    return(null);
                }

                return(SelectElement(editorComponentContext, smartContent, contentState));
            }
            return(null);
        }
Ejemplo n.º 7
0
 protected SmartContentSelection(IHtmlEditorComponentContext editorComponentContext, IHTMLElement element, SmartContentState contentState)
     : base(editorComponentContext, element, contentState)
 {
 }
        protected ContentSelection(IHtmlEditorComponentContext editorComponentContext, IHTMLElement element, SmartContentState contentState)
        {
            _editorComponentContext = editorComponentContext;
            _markupServices = editorComponentContext.MarkupServices;
            _element = element;
            _contentState = contentState;

            _markupRange = _markupServices.CreateMarkupRange(_element, true);
            _markupRange.Start.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Right;
            _markupRange.End.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Left;
            _markupRange.Start.Cling = false;
            _markupRange.End.Cling = false;
        }
 public static SmartContentSelection SelectElement(IHtmlEditorComponentContext editorComponentContext, IHTMLElement e, SmartContentState contentState)
 {
     SmartContentSelection selection = (SmartContentSelection)SelectElementCore(editorComponentContext, e, new SmartContentSelection(editorComponentContext, e, contentState));
     return selection;
 }
 protected SmartContentSelection(IHtmlEditorComponentContext editorComponentContext, IHTMLElement element, SmartContentState contentState)
     : base(editorComponentContext, element, contentState)
 {
 }