Merge pull request #796 from ppardi/Format-HTML-in-Source
Option to always format HTML
This commit is contained in:
commit
de565b29c6
|
@ -165,7 +165,7 @@ namespace OpenLiveWriter.HtmlEditor
|
|||
|
||||
public virtual string GetEditedHtmlFast()
|
||||
{
|
||||
return GetEditedHtml(false);
|
||||
return GetEditedHtml(true);
|
||||
}
|
||||
|
||||
public string SelectedText
|
||||
|
|
|
@ -985,7 +985,8 @@ namespace OpenLiveWriter.PostEditor
|
|||
|
||||
private string GetBodyCore(bool preferWellFormed)
|
||||
{
|
||||
string html = _currentEditor != null ? _currentEditor.GetEditedHtml(preferWellFormed) : "";
|
||||
bool formatHTML = PostEditorPreferences.Instance.FormatHTML;
|
||||
string html = _currentEditor != null ? _currentEditor.GetEditedHtml(formatHTML) : "";
|
||||
|
||||
html = StripPluginHeadersAndFooters(html);
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ namespace OpenLiveWriter.PostEditor
|
|||
}
|
||||
private bool _viewPostAfterPublish;
|
||||
|
||||
public bool FormatHTML
|
||||
{
|
||||
get { return _formatHTML; }
|
||||
set { _formatHTML = value; Modified(); }
|
||||
}
|
||||
private bool _formatHTML;
|
||||
|
||||
public bool CloseWindowOnPublish
|
||||
{
|
||||
get { return _closeWindowOnPublish; }
|
||||
|
@ -94,6 +101,7 @@ namespace OpenLiveWriter.PostEditor
|
|||
AutoSaveDrafts = PostEditorSettings.AutoSaveDrafts;
|
||||
AutoSaveMinutes = PostEditorSettings.AutoSaveMinutes;
|
||||
WeblogPostsFolder = PostEditorSettings.WeblogPostsFolder;
|
||||
FormatHTML = PostEditorSettings.FormatHTML;
|
||||
}
|
||||
|
||||
protected override void SavePreferences()
|
||||
|
@ -107,6 +115,7 @@ namespace OpenLiveWriter.PostEditor
|
|||
PostEditorSettings.AutoSaveDrafts = AutoSaveDrafts;
|
||||
PostEditorSettings.AutoSaveMinutes = AutoSaveMinutes;
|
||||
PostEditorSettings.WeblogPostsFolder = WeblogPostsFolder;
|
||||
PostEditorSettings.FormatHTML = FormatHTML;
|
||||
}
|
||||
|
||||
public void SaveWebLogPostFolder()
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenLiveWriter.PostEditor
|
|||
private System.Windows.Forms.Button buttonBrowserDialog;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
|
||||
private WordCountPreferences _wordCountPreferences;
|
||||
private System.Windows.Forms.CheckBox checkBoxFormatHTML;
|
||||
private string _originalFolder = string.Empty;
|
||||
|
||||
public PostEditorPreferencesPanel()
|
||||
|
@ -126,6 +127,9 @@ namespace OpenLiveWriter.PostEditor
|
|||
checkBoxCategoryReminder.CheckedChanged += new EventHandler(checkBoxCategoryReminder_CheckedChanged);
|
||||
checkBoxTagReminder.CheckedChanged += new EventHandler(checkBoxTagReminder_CheckedChanged);
|
||||
|
||||
checkBoxFormatHTML.Checked = _postEditorPreferences.FormatHTML;
|
||||
checkBoxFormatHTML.CheckedChanged += new EventHandler(checkBoxFormatHTML_CheckedChanged);
|
||||
|
||||
}
|
||||
|
||||
private void ButtonBrowserDialog_MouseClick(object sender, MouseEventArgs e)
|
||||
|
@ -204,6 +208,11 @@ namespace OpenLiveWriter.PostEditor
|
|||
_postEditorPreferences.ViewPostAfterPublish = checkBoxViewWeblog.Checked;
|
||||
}
|
||||
|
||||
private void checkBoxFormatHTML_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
_postEditorPreferences.FormatHTML = checkBoxFormatHTML.Checked;
|
||||
}
|
||||
|
||||
private void radioButtonPostWindowBehavior_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (radioButtonUseSameWindow.Checked)
|
||||
|
@ -330,12 +339,12 @@ namespace OpenLiveWriter.PostEditor
|
|||
this.groupBoxGeneral = new System.Windows.Forms.GroupBox();
|
||||
this.checkBoxAutoSaveDrafts = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxWordCount = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxFormatHTML = new System.Windows.Forms.CheckBox();
|
||||
this.groupBoxWeblogPostsFolder = new System.Windows.Forms.GroupBox();
|
||||
this.textBoxWeblogPostsFolder = new TextBox();
|
||||
this.folderBrowserDialog = new FolderBrowserDialog();
|
||||
this.buttonBrowserDialog = new Button();
|
||||
this.flowLayoutPanel = new FlowLayoutPanel();
|
||||
this.flowLayoutPanel.SuspendLayout();
|
||||
this.textBoxWeblogPostsFolder = new System.Windows.Forms.TextBox();
|
||||
this.buttonBrowserDialog = new System.Windows.Forms.Button();
|
||||
this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.groupBoxPublishing.SuspendLayout();
|
||||
this.groupBoxPostWindows.SuspendLayout();
|
||||
this.groupBoxGeneral.SuspendLayout();
|
||||
|
@ -404,7 +413,6 @@ namespace OpenLiveWriter.PostEditor
|
|||
this.checkBoxViewWeblog.Name = "checkBoxViewWeblog";
|
||||
this.checkBoxViewWeblog.Size = new System.Drawing.Size(312, 21);
|
||||
this.checkBoxViewWeblog.TabIndex = 0;
|
||||
// Modified on 2/19/2016 by @kathweaver to resolve Issue #377
|
||||
this.checkBoxViewWeblog.Text = "&View blog after publishing";
|
||||
this.checkBoxViewWeblog.TextAlign = System.Drawing.ContentAlignment.TopLeft;
|
||||
//
|
||||
|
@ -453,10 +461,11 @@ namespace OpenLiveWriter.PostEditor
|
|||
//
|
||||
// groupBoxGeneral
|
||||
//
|
||||
this.groupBoxGeneral.Controls.Add(this.checkBoxFormatHTML);
|
||||
this.groupBoxGeneral.Controls.Add(this.checkBoxAutoSaveDrafts);
|
||||
this.groupBoxGeneral.Controls.Add(this.checkBoxWordCount);
|
||||
this.groupBoxGeneral.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.groupBoxGeneral.Location = new System.Drawing.Point(8, 154);
|
||||
this.groupBoxGeneral.Location = new System.Drawing.Point(8, 254);
|
||||
this.groupBoxGeneral.Name = "groupBoxGeneral";
|
||||
this.groupBoxGeneral.Size = new System.Drawing.Size(345, 174);
|
||||
this.groupBoxGeneral.TabIndex = 3;
|
||||
|
@ -480,39 +489,21 @@ namespace OpenLiveWriter.PostEditor
|
|||
this.checkBoxWordCount.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.checkBoxWordCount.Location = new System.Drawing.Point(16, 156);
|
||||
this.checkBoxWordCount.Name = "checkBoxWordCount";
|
||||
this.checkBoxWordCount.Size = new System.Drawing.Size(312, 18);
|
||||
this.checkBoxWordCount.Size = new System.Drawing.Size(312, 62);
|
||||
this.checkBoxWordCount.TabIndex = 1;
|
||||
this.checkBoxWordCount.Text = "Show real time &word count in status bar";
|
||||
this.checkBoxWordCount.TextAlign = System.Drawing.ContentAlignment.TopLeft;
|
||||
this.checkBoxWordCount.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxWeblogPostsFolder
|
||||
// checkBoxFormatHTML
|
||||
//
|
||||
this.textBoxWeblogPostsFolder.Name = "textBoxWeblogPostsFolder";
|
||||
this.textBoxWeblogPostsFolder.Size = new System.Drawing.Size(314, 22);
|
||||
this.textBoxWeblogPostsFolder.AutoSize = false;
|
||||
this.textBoxWeblogPostsFolder.TabIndex = 1;
|
||||
this.textBoxWeblogPostsFolder.Text = "Show default post save location";
|
||||
this.textBoxWeblogPostsFolder.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
|
||||
this.textBoxWeblogPostsFolder.Location = new System.Drawing.Point(16, 21);
|
||||
this.textBoxWeblogPostsFolder.BorderStyle = BorderStyle.FixedSingle;
|
||||
this.textBoxWeblogPostsFolder.Font = Res.DefaultFont;
|
||||
//
|
||||
// buttonBrowserDialog
|
||||
//
|
||||
this.buttonBrowserDialog.Name = "buttonBrowserDialog";
|
||||
this.buttonBrowserDialog.Text = Res.Get(StringId.PostEditorPrefBrowseFolder);
|
||||
this.buttonBrowserDialog.TabIndex = 2;
|
||||
this.buttonBrowserDialog.Location = new System.Drawing.Point(16, 32);
|
||||
this.buttonBrowserDialog.Size = new System.Drawing.Size(70, 22);
|
||||
this.buttonBrowserDialog.Font = Res.DefaultFont;
|
||||
this.buttonBrowserDialog.AutoSize = false;
|
||||
//
|
||||
// FolderBrowserDialog
|
||||
//
|
||||
this.folderBrowserDialog.Description = "Select the directory that you want to use as the default";
|
||||
this.folderBrowserDialog.ShowNewFolderButton = true;
|
||||
this.folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
|
||||
this.checkBoxFormatHTML.AutoSize = true;
|
||||
this.checkBoxFormatHTML.Location = new System.Drawing.Point(16, 131);
|
||||
this.checkBoxFormatHTML.Name = "checkBoxFormatHTML";
|
||||
this.checkBoxFormatHTML.Size = new System.Drawing.Size(218, 19);
|
||||
this.checkBoxFormatHTML.TabIndex = 2;
|
||||
this.checkBoxFormatHTML.Text = "&Always format HTML in Source View";
|
||||
this.checkBoxFormatHTML.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBoxWeblogPostsFolder
|
||||
//
|
||||
|
@ -526,13 +517,44 @@ namespace OpenLiveWriter.PostEditor
|
|||
this.groupBoxWeblogPostsFolder.TabStop = false;
|
||||
this.groupBoxWeblogPostsFolder.Text = "Post Folder Location";
|
||||
//
|
||||
// textBoxWeblogPostsFolder
|
||||
//
|
||||
this.textBoxWeblogPostsFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBoxWeblogPostsFolder.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.textBoxWeblogPostsFolder.Location = new System.Drawing.Point(16, 21);
|
||||
this.textBoxWeblogPostsFolder.Name = "textBoxWeblogPostsFolder";
|
||||
this.textBoxWeblogPostsFolder.Size = new System.Drawing.Size(314, 23);
|
||||
this.textBoxWeblogPostsFolder.TabIndex = 1;
|
||||
this.textBoxWeblogPostsFolder.Text = "Show default post save location";
|
||||
//
|
||||
// buttonBrowserDialog
|
||||
//
|
||||
this.buttonBrowserDialog.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.buttonBrowserDialog.Location = new System.Drawing.Point(16, 32);
|
||||
this.buttonBrowserDialog.Name = "buttonBrowserDialog";
|
||||
this.buttonBrowserDialog.Size = new System.Drawing.Size(70, 22);
|
||||
this.buttonBrowserDialog.TabIndex = 2;
|
||||
this.buttonBrowserDialog.Text = "Browse";
|
||||
//
|
||||
// folderBrowserDialog
|
||||
//
|
||||
this.folderBrowserDialog.Description = "Select the directory that you want to use as the default";
|
||||
this.folderBrowserDialog.RootFolder = System.Environment.SpecialFolder.MyComputer;
|
||||
//
|
||||
// flowLayoutPanel
|
||||
//
|
||||
this.flowLayoutPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel.Name = "flowLayoutPanel";
|
||||
this.flowLayoutPanel.Size = new System.Drawing.Size(200, 100);
|
||||
this.flowLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// PostEditorPreferencesPanel
|
||||
//
|
||||
this.AccessibleName = "Preferences";
|
||||
this.Controls.Add(this.groupBoxWeblogPostsFolder);
|
||||
this.Controls.Add(this.groupBoxGeneral);
|
||||
this.Controls.Add(this.groupBoxPostWindows);
|
||||
this.Controls.Add(this.groupBoxPublishing);
|
||||
this.Controls.Add(this.groupBoxGeneral);
|
||||
this.Controls.Add(this.groupBoxWeblogPostsFolder);
|
||||
this.Name = "PostEditorPreferencesPanel";
|
||||
this.PanelName = "Preferences";
|
||||
this.Size = new System.Drawing.Size(370, 521);
|
||||
|
@ -543,9 +565,11 @@ namespace OpenLiveWriter.PostEditor
|
|||
this.groupBoxPublishing.ResumeLayout(false);
|
||||
this.groupBoxPostWindows.ResumeLayout(false);
|
||||
this.groupBoxGeneral.ResumeLayout(false);
|
||||
this.flowLayoutPanel.ResumeLayout(false);
|
||||
this.groupBoxGeneral.PerformLayout();
|
||||
this.groupBoxWeblogPostsFolder.ResumeLayout(false);
|
||||
this.groupBoxWeblogPostsFolder.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -112,9 +112,12 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -20,6 +20,13 @@ namespace OpenLiveWriter.PostEditor
|
|||
|
||||
public class PostEditorSettings
|
||||
{
|
||||
public static bool FormatHTML
|
||||
{
|
||||
get { return SettingsKey.GetBoolean(FORMAT_HTML, true); }
|
||||
set { SettingsKey.SetBoolean(FORMAT_HTML, value); }
|
||||
}
|
||||
private const string FORMAT_HTML = "FormatHTML";
|
||||
|
||||
public static bool ViewPostAfterPublish
|
||||
{
|
||||
get { return SettingsKey.GetBoolean(VIEW_POST_AFTER_PUBLISH, true); }
|
||||
|
|
|
@ -204,7 +204,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
|
|||
|
||||
public string GetEditedHtml(bool preferWellFormed)
|
||||
{
|
||||
return sourceControl.GetEditedHtml(preferWellFormed);
|
||||
bool formatHTML = PostEditorPreferences.Instance.FormatHTML;
|
||||
return sourceControl.GetEditedHtml(formatHTML);
|
||||
}
|
||||
|
||||
public string GetEditedHtmlFast()
|
||||
|
@ -427,7 +428,8 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
|
|||
public override string GetEditedHtml(bool preferWellFormed)
|
||||
{
|
||||
//get the raw HTML out of the source control's text box
|
||||
String htmlText = base.GetEditedHtml(preferWellFormed);
|
||||
bool formatHTML = PostEditorPreferences.Instance.FormatHTML;
|
||||
String htmlText = base.GetEditedHtml(formatHTML);
|
||||
|
||||
//undo any URL variable-name conversions that were previously applied by the replace operation.
|
||||
_replaceOperation.Mode = ReplaceAbsoluteFilePathsOperation.REPLACE_MODE.VAR2ABS;
|
||||
|
|
Loading…
Reference in New Issue