Пример #1
0
        private void PersistAllEditFields()
        {
            SmartContent content = SmartContent;

            foreach (IHTMLElement el in EditFields)
            {
                InlineEditField field = new InlineEditField(el, content, EditorContext, HTMLElement, this);
                field.SetDefaultText();
                field.PersistFieldValueToContent(false);
            }
        }
Пример #2
0
        protected override void OnElementAttached()
        {
            SmartContent content = SmartContent;

            if (content == null)
            {
                return;
            }

            ContentSourceInfo contentSourceInfo = _contentSourceContext.FindContentSource(ContentSourceId);

            _contentSource = contentSourceInfo.Instance as SmartContentSource;

            if (_contentSource != null && _contentSource.ResizeCapabilities != ResizeCapabilities.None)
            {
                Resizable           = true;
                PreserveAspectRatio = ResizeCapabilities.PreserveAspectRatio == (_contentSource.ResizeCapabilities & ResizeCapabilities.PreserveAspectRatio);
                _realtimeResizing   = ResizeCapabilities.LiveResize == (_contentSource.ResizeCapabilities & ResizeCapabilities.LiveResize);
            }
            else
            {
                Resizable = false;
            }

            EditorContext.CommandKey += new KeyEventHandler(EditorContext_CommandKey);
            EditorContext.DocumentEvents.DoubleClick   += new HtmlEventHandler(EditorContext_DoubleClick);
            EditorContext.SelectionChanged             += new EventHandler(EditorContext_SelectionChanged);
            EditorContext.PostEventNotify              += new MshtmlEditor.EditDesignerEventHandler(EditorContext_PostEventNotify);
            EditorContext.CommandManager.BeforeExecute += new CommandManagerExecuteEventHandler(CommandManager_BeforeExecute);
            EditorContext.CommandManager.AfterExecute  += new CommandManagerExecuteEventHandler(CommandManager_AfterExecute);
            EditorContext.HtmlInserted += new EventHandler(EditorContext_HtmlInserted);


            base.OnElementAttached();

            foreach (IHTMLElement el in EditFields)
            {
                InlineEditField field = new InlineEditField(el, content, EditorContext, HTMLElement, this);

                if (!field.ContentEditable && EditorContext.EditMode)
                {
                    field.ContentEditable = true;
                }

                field.SetDefaultText();
            }
        }
 private void PersistAllEditFields()
 {
     SmartContent content = SmartContent;
     foreach (IHTMLElement el in EditFields)
     {
         InlineEditField field = new InlineEditField(el, content, EditorContext, HTMLElement, this);
         field.SetDefaultText();
         field.PersistFieldValueToContent(false);
     }
 }
        protected override void OnElementAttached()
        {
            SmartContent content = SmartContent;
            if (content == null)
                return;

            ContentSourceInfo contentSourceInfo = _contentSourceContext.FindContentSource(ContentSourceId);
            _contentSource = contentSourceInfo.Instance as SmartContentSource;

            if (_contentSource != null && _contentSource.ResizeCapabilities != ResizeCapabilities.None)
            {
                Resizable = true;
                PreserveAspectRatio = ResizeCapabilities.PreserveAspectRatio == (_contentSource.ResizeCapabilities & ResizeCapabilities.PreserveAspectRatio);
                _realtimeResizing = ResizeCapabilities.LiveResize == (_contentSource.ResizeCapabilities & ResizeCapabilities.LiveResize);
            }
            else
                Resizable = false;

            EditorContext.CommandKey += new KeyEventHandler(EditorContext_CommandKey);
            EditorContext.DocumentEvents.DoubleClick += new HtmlEventHandler(EditorContext_DoubleClick);
            EditorContext.SelectionChanged += new EventHandler(EditorContext_SelectionChanged);
            EditorContext.PostEventNotify += new MshtmlEditor.EditDesignerEventHandler(EditorContext_PostEventNotify);
            EditorContext.CommandManager.BeforeExecute += new CommandManagerExecuteEventHandler(CommandManager_BeforeExecute);
            EditorContext.CommandManager.AfterExecute += new CommandManagerExecuteEventHandler(CommandManager_AfterExecute);
            EditorContext.HtmlInserted += new EventHandler(EditorContext_HtmlInserted);

            base.OnElementAttached();

            foreach (IHTMLElement el in EditFields)
            {
                InlineEditField field = new InlineEditField(el, content, EditorContext, HTMLElement, this);

                if (!field.ContentEditable && EditorContext.EditMode)
                {
                    field.ContentEditable = true;
                }

                field.SetDefaultText();
            }
        }