mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Improved styles for inserting code into md
This commit is contained in:
@ -12,7 +12,7 @@
|
|||||||
#include "StaticFunctions.h"
|
#include "StaticFunctions.h"
|
||||||
#include "ConstValues.h"
|
#include "ConstValues.h"
|
||||||
|
|
||||||
#define DEFAULT_FONT_SIZE 14
|
#define DEFAULT_FONT_SIZE 12
|
||||||
|
|
||||||
namespace NSCSS
|
namespace NSCSS
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,7 +29,7 @@ void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile)
|
|||||||
oFile.WriteStringUTF8(L"<style>");
|
oFile.WriteStringUTF8(L"<style>");
|
||||||
|
|
||||||
// Main styles
|
// Main styles
|
||||||
oFile.WriteStringUTF8(L"* { font-family: Arial; }");
|
oFile.WriteStringUTF8(L"* { font-family: Arial; color:black; }");
|
||||||
oFile.WriteStringUTF8(L"p { margin: 0 0 10px; display: block; }");
|
oFile.WriteStringUTF8(L"p { margin: 0 0 10px; display: block; }");
|
||||||
oFile.WriteStringUTF8(L"a { color: #0553c1; text-decoration: underline; } a:visited { color: #954f72; text-decoration: underline; }");
|
oFile.WriteStringUTF8(L"a { color: #0553c1; text-decoration: underline; } a:visited { color: #954f72; text-decoration: underline; }");
|
||||||
oFile.WriteStringUTF8(L"ul { margin-top: 0; margin-bottom: 10px; }");
|
oFile.WriteStringUTF8(L"ul { margin-top: 0; margin-bottom: 10px; }");
|
||||||
@ -50,11 +50,10 @@ void WriteBaseHtmlStyles(NSFile::CFileBinary& oFile)
|
|||||||
|
|
||||||
// Styles for code
|
// Styles for code
|
||||||
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }");
|
oFile.WriteStringUTF8(L"code { padding: 2px 4px; font-size: 90%; color: #c7254e; background-color: #f9f2f4; border-radius: 4px; }");
|
||||||
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; background-color: transparent; border-radius: 0; color: inherit; }");
|
oFile.WriteStringUTF8(L"pre code { padding: 0px; white-space: pre-wrap; border-radius: 0; background-color: #f5f5f5; color:black; }");
|
||||||
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }");
|
oFile.WriteStringUTF8(L"pre { display: block; padding: 9.5px; margin: 0 0 10px; line-height: 1.4; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; }");
|
||||||
oFile.WriteStringUTF8(L"code, pre { font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; }");
|
oFile.WriteStringUTF8(L"code, pre { font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace; }");
|
||||||
|
|
||||||
|
|
||||||
// Styles for headings
|
// Styles for headings
|
||||||
oFile.WriteStringUTF8(L"h1 { font-size: 20pt; color: #0f4761; margin-top: 18pt; margin-bottom: 4pt; }");
|
oFile.WriteStringUTF8(L"h1 { font-size: 20pt; color: #0f4761; margin-top: 18pt; margin-bottom: 4pt; }");
|
||||||
oFile.WriteStringUTF8(L"h2 { font-size: 16pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
|
oFile.WriteStringUTF8(L"h2 { font-size: 16pt; color: #0f4761; margin-top: 8pt; margin-bottom: 4pt; }");
|
||||||
|
|||||||
@ -2403,6 +2403,7 @@ private:
|
|||||||
if (oTS.bAddSpaces && m_oState.m_bInP && !m_oState.m_bInR && !iswspace(sText.front()) && !m_oState.m_bWasSpace && CTextSettings::Normal == oTS.eTextMode)
|
if (oTS.bAddSpaces && m_oState.m_bInP && !m_oState.m_bInR && !iswspace(sText.front()) && !m_oState.m_bWasSpace && CTextSettings::Normal == oTS.eTextMode)
|
||||||
WriteSpace(pXml);
|
WriteSpace(pXml);
|
||||||
|
|
||||||
|
//TODO:: сделать так, чтобы параграф (со своими стилями) открывался при чтении сооответствующей ноды, а не при чтении текста
|
||||||
OpenP(pXml);
|
OpenP(pXml);
|
||||||
|
|
||||||
NSStringUtils::CStringBuilder oPPr;
|
NSStringUtils::CStringBuilder oPPr;
|
||||||
@ -2619,7 +2620,6 @@ private:
|
|||||||
|
|
||||||
CTextSettings oTSR(oTS);
|
CTextSettings oTSR(oTS);
|
||||||
oTSR.oAdditionalStyle.m_oFont.SetFamily(L"Courier New", UINT_MAX, true);
|
oTSR.oAdditionalStyle.m_oFont.SetFamily(L"Courier New", UINT_MAX, true);
|
||||||
oTSR.oAdditionalStyle.m_oFont.SetSize(20, UINT_MAX, true);
|
|
||||||
|
|
||||||
return readStream(pXml, arSelectors, oTSR);
|
return readStream(pXml, arSelectors, oTSR);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user