예제 #1
0
        private bool InsertSmartContentFromLiveClipboard(ContentSourceInfo contentSource, XmlDocument lcDocument)
        {
            SmartContentSource smartSource = contentSource.Instance as SmartContentSource;

            if (smartSource == null)
            {
                Trace.Fail("Unexpected failure to get live clipboard content-source!");
                return(false);
            }

            // create the smart content
            IExtensionData extensionData = _contentSourceSite.CreateExtensionData(Guid.NewGuid().ToString());
            ISmartContent  smartContent  = new SmartContent(extensionData);

            if (smartSource.CreateContentFromLiveClipboard(EditorContext.FrameWindow, lcDocument, smartContent) == DialogResult.OK)
            {
                // generate html and insert it
                string content = smartSource.GenerateEditorHtml(smartContent, _contentSourceSite);
                if (content != null)
                {
                    _contentSourceSite.InsertContent(contentSource.Id, content, extensionData);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        public static void InsertEditorHtmlIntoElement(IContentSourceSidebarContext contentSourceContext, SmartContentSource source, ISmartContent sContent, IHTMLElement element)
        {
            string content = source.GenerateEditorHtml(sContent, contentSourceContext);

            // If the plugin returned null has the HTML it would like to insert, remove the element from the editor
            if (content == null)
            {
                HTMLElementHelper.RemoveElement(element);
            }
            else
            {
                InsertContentIntoElement(content, sContent, contentSourceContext, element);
            }
        }
예제 #3
0
        private bool InsertSmartContentFromUrl(ContentSourceInfo contentSource, string url)
        {
            SmartContentSource smartSource   = contentSource.Instance as SmartContentSource;
            string             title         = String.Empty;
            IExtensionData     extensionData = _contentSourceSite.CreateExtensionData(Guid.NewGuid().ToString());
            ISmartContent      smartContent  = new SmartContent(extensionData);

            if (UrlContentRetreivalWithProgress.ExecuteSmartContentRetreival(
                    EditorContext.FrameWindow, contentSource, url, ref title, smartContent))
            {
                string content = smartSource.GenerateEditorHtml(smartContent, _contentSourceSite);
                if (content != null)
                {
                    _contentSourceSite.InsertContent(contentSource.Id, content, extensionData);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }