- fix: unneeded empty lines when copy as HTML
This commit is contained in:
parent
3a81281f7d
commit
58e849063c
|
@ -1123,7 +1123,7 @@ void Editor::copyAsHTML()
|
|||
{
|
||||
if (!selAvail())
|
||||
return;
|
||||
SynHTMLExporter SynExporterHTML;
|
||||
SynHTMLExporter SynExporterHTML(tabWidth());
|
||||
|
||||
SynExporterHTML.setTitle(QFileInfo(mFilename).fileName());
|
||||
SynExporterHTML.setExportAsText(false);
|
||||
|
@ -1142,6 +1142,8 @@ void Editor::copyAsHTML()
|
|||
QMimeData * mimeData = new QMimeData;
|
||||
|
||||
//sethtml will convert buffer to QString , which will cause encoding trouble
|
||||
StringToFile(QString::fromLocal8Bit(SynExporterHTML.buffer()),"f:\\buffer.html");
|
||||
|
||||
mimeData->setData(SynExporterHTML.clipboardFormat(),SynExporterHTML.buffer());
|
||||
mimeData->setText(selText());
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "../MiscProcs.h"
|
||||
#include <functional>
|
||||
|
||||
SynHTMLExporter::SynHTMLExporter()
|
||||
SynHTMLExporter::SynHTMLExporter(int tabSize)
|
||||
{
|
||||
mClipboardFormat = "text/html";
|
||||
mDefaultFilter = "HTML Documents (*.htm;*.html)|*.htm;*.html";
|
||||
|
@ -11,6 +11,8 @@ SynHTMLExporter::SynHTMLExporter()
|
|||
mReplaceReserved['<'] = "<";
|
||||
mReplaceReserved['>'] = ">";
|
||||
mReplaceReserved['"'] = """;
|
||||
mReplaceReserved[' '] = " ";
|
||||
mReplaceReserved['\t'] = mReplaceReserved[' '].repeated(tabSize);
|
||||
mCreateHTMLFragment = false;
|
||||
}
|
||||
|
||||
|
@ -120,13 +122,14 @@ void SynHTMLExporter::FormatBeforeFirstAttribute(bool, bool, SynFontStyles)
|
|||
|
||||
void SynHTMLExporter::FormatNewLine()
|
||||
{
|
||||
AddData("<br />");
|
||||
AddNewLine();
|
||||
}
|
||||
|
||||
QString SynHTMLExporter::GetFooter()
|
||||
{
|
||||
QString Result = "";
|
||||
Result = "</span></code></pre>" + lineBreak();
|
||||
Result = "</span>" + lineBreak();
|
||||
if (mCreateHTMLFragment)
|
||||
Result += "<!--EndFragment-->";
|
||||
Result += "</body>"+lineBreak()+ "</html>";
|
||||
|
@ -172,7 +175,7 @@ QString SynHTMLExporter::GetHeader()
|
|||
if (mCreateHTMLFragment) {
|
||||
Result += "<!--StartFragment-->";
|
||||
}
|
||||
Result += QString("<pre><code><span style=\"font: %1pt %2;\">")
|
||||
Result += QString("<span style=\"font: %1pt %2;\">")
|
||||
.arg(mFont.pointSize())
|
||||
.arg(mFont.family());
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class SynHTMLExporter : public SynExporter
|
||||
{
|
||||
public:
|
||||
SynHTMLExporter();
|
||||
SynHTMLExporter(int tabSize);
|
||||
bool createHTMLFragment() const;
|
||||
void setCreateHTMLFragment(bool createHTMLFragment);
|
||||
|
||||
|
|
Loading…
Reference in New Issue