feat: v0.4.0 —— 编辑模式改成文档排版,源代码模式加行号与细线
编辑模式(默认)参照 Typora / Word 的“写字”体验 - 正文改为比例字体,整列限制 760px 居中,隐藏行号栏 - 段落统一行高 150%、段间距统一(applyBlockRhythm) - 代码片段在文档里仍然保持等宽字体 - 隐藏标记、标题缩放、光标行露出标记等行为保留 源代码模式 - 等宽字体 + 行号栏 + 每行一条细线,通栏不居中 - 标题不再放大,逐行等高,只保留颜色 其它 - 切换模式时字体、边距、标题格式整体重建 - 新增 docs/screenshot-source.png,README 区分两种模式
This commit is contained in:
@@ -444,6 +444,7 @@ void MainWindow::showWelcomeDocument()
|
||||
if (text.startsWith(QLatin1Char('\n')))
|
||||
text.remove(0, 1);
|
||||
m_editor->setPlainText(text);
|
||||
m_editor->applyBlockRhythm();
|
||||
m_editor->document()->setModified(false);
|
||||
m_editor->document()->clearUndoRedoStacks();
|
||||
setCurrentFile(QString());
|
||||
@@ -455,6 +456,7 @@ void MainWindow::newFile()
|
||||
if (!maybeSave())
|
||||
return;
|
||||
m_editor->clear();
|
||||
m_editor->applyBlockRhythm();
|
||||
m_editor->document()->setModified(false);
|
||||
m_editor->document()->clearUndoRedoStacks();
|
||||
m_hasBom = false;
|
||||
@@ -503,6 +505,7 @@ bool MainWindow::openPath(const QString &path)
|
||||
text.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
|
||||
|
||||
m_editor->setPlainText(text);
|
||||
m_editor->applyBlockRhythm();
|
||||
m_editor->document()->setModified(false);
|
||||
m_editor->document()->clearUndoRedoStacks();
|
||||
setCurrentFile(absolutePath);
|
||||
|
||||
Reference in New Issue
Block a user