void IBlogPostEditor.SaveChanges(BlogPost post, BlogPostSaveOptions options) { }
Example #2
0
 void IBlogPostEditor.SaveChanges(BlogPost post, BlogPostSaveOptions options)
 {
     _isDirty = false;
 }
        private void AutoSave()
        {
            using (new QuickTimer("AutoSave"))
            {
                // save all pending edits to the post
                BlogPostSaveOptions options = new BlogPostSaveOptions();
                options.AutoSave = true;
                SaveEditsToPost(true, options);

                try
                {
                    PostEditorFile fileToSave = AutoSaveLocalFile;
                    fileToSave.AutoSave(this, LocalFile);
                }
                catch (Exception ex)
                {
                    Trace.Fail("AutoSave failed! " + ex.Message);
                    if (ApplicationDiagnostics.VerboseLogging)
                    {
                        Trace.WriteLine(ex.ToString());
                    }
                }
            }
        }
 /// <summary>
 /// Saves info to the active blog post, but does not persist them
 /// to disk. Optionally preserve dirty state.
 /// </summary>
 public void SaveEditsToPost(bool preserveDirty, BlogPostSaveOptions options)
 {
     bool makeDirty = preserveDirty && PostIsDirty;
     try
     {
         foreach (IBlogPostEditor postEditor in _postEditors)
             postEditor.SaveChanges(BlogPost, options);
     }
     finally
     {
         if (makeDirty)
             ForceDirty();
     }
 }
 void IBlogPostEditor.SaveChanges(BlogPost post, BlogPostSaveOptions options)
 {
     _isDirty = false;
 }
        public virtual void SaveChanges(BlogPost post, BlogPostSaveOptions options)
        {
            // get the title (remove linebreaks to prevent auto-convertion to P or BR)
            string postTitle = _currentEditor.GetEditedTitleHtml();
            post.Title = HtmlLinebreakStripper.RemoveLinebreaks(postTitle);

            // get the editor html
            // performance optimization for AutoSave
            string postContents = options.AutoSave ? GetBodyCore(false) : Body;

            //replace the structured content with the publish HTML.
            postContents = SmartContentWorker.PerformOperation(postContents, GetStructuredPublishHtml, false, this, true);

            // remove linebreaks to prevent auto-convertion to P or BR
            postContents = HtmlLinebreakStripper.RemoveLinebreaks(postContents);

            post.Contents = postContents;
            _currentEditor.IsDirty = false;
        }
 void IBlogPostEditor.SaveChanges(BlogPost post, BlogPostSaveOptions options)
 {
     post.Categories = CategoryContext.SelectedExistingCategories;
     post.NewCategories = CategoryContext.SelectedNewCategories;
     _isDirty = false;
 }