Skip to content

Commit

Permalink
🎨 fix #349
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed May 2, 2020
1 parent 4b21948 commit 3c86118
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
* [open issues](https://github.com/Vanessa219/vditor/issues)
* [346](https://github.com/Vanessa219/vditor/issues/346) 内容主题推荐(长期有效) `改进功能`

### v3.1.21 / 2020-05-0x
### v3.2.0 / 2020-05-0x

### v3.1.21 / 2020-05-02

* [349](https://github.com/Vanessa219/vditor/issues/349) 传统中文排版“段落开头空两格” `引入特性`
* [351](https://github.com/Vanessa219/vditor/issues/351) MathJax plugin `修复缺陷`
* [353](https://github.com/Vanessa219/vditor/issues/353) list demo at static-preview.html `文档相关`
* [350](https://github.com/Vanessa219/vditor/issues/350) 自定义渲染的方法 `引入特性`

### v3.1.20 / 2020-04-29

* [345](https://github.com/Vanessa219/vditor/issues/345) 支持预览区域粘贴到公众号 `引入特性`
* [324](https://github.com/Vanessa219/vditor/issues/324) 支持多款主题预览 `引入特性`
* [325](https://github.com/Vanessa219/vditor/issues/325) 导出功能 `引入特性`
Expand Down Expand Up @@ -127,9 +127,10 @@
* `setTheme` 方法添加 `conentTheme`, `codeTheme` 参数
* `setPreviewMode` 方法移除 `preview`
* `options.preview` 中 `maxWidth` 默认值改为 800, `mode` 移除 `preview` 选项,`markdonw` 添加 `theme`、`setext` 配置
* IPreviewOptions 添加 `after`,`lazyLoadImage`, `markdown.theme`, `renderers`,移除 `theme`
* IPreviewOptions 添加 `after`,`lazyLoadImage`, `markdown.theme`, `renderers`, `markdown.paragraphBeginningSpace`,移除 `theme`

* `renderers` 使用文档详细说明
* `paragraphBeginningSpace`

### v3.0.12 / 2020-04-06

Expand Down
4 changes: 2 additions & 2 deletions demo/static-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<meta name="twitter:url" content="https://hacpai.com/tag/vditor"/>
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png"/>
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].20/dist/index.css"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/method.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].21/dist/index.css"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected].21/dist/method.min.js"></script>
<style>
a {
color: #4285f4;
Expand Down
4 changes: 2 additions & 2 deletions demo/static.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<meta name="twitter:url" content="https://hacpai.com/tag/vditor"/>
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/vditor/dist/images/logo.png"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].20/dist/index.css"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected].20/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].21/dist/index.css"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected].21/dist/index.min.js"></script>
<style>
a {
color: #4285f4;
Expand Down
8 changes: 4 additions & 4 deletions src/js/lute/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/ts/ir/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class IR {
if ((event.key === "Backspace" || event.key === "Delete") &&
vditor.ir.element.innerHTML !== "" && vditor.ir.element.childNodes.length === 1 &&
vditor.ir.element.firstElementChild && vditor.ir.element.firstElementChild.tagName === "P"
&& vditor.wysiwyg.element.firstElementChild.childElementCount === 0
&& vditor.ir.element.firstElementChild.childElementCount === 0
&& (vditor.ir.element.textContent === "" || vditor.ir.element.textContent === "\n")) {
// 为空时显示 placeholder
vditor.ir.element.innerHTML = "";
Expand Down
2 changes: 2 additions & 0 deletions src/ts/markdown/previewRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const mergeOptions = (options?: IPreviewOptions) => {
codeBlockPreview: true,
fixTermTypo: false,
footnotes: true,
paragraphBeginningSpace: false,
setext: true,
theme: "light",
toc: false,
Expand Down Expand Up @@ -75,6 +76,7 @@ export const md2html = (mdText: string, options?: IPreviewOptions) => {
headingAnchor: mergedOptions.anchor,
inlineMathDigit: mergedOptions.math.inlineDigit,
lazyLoadImage: mergedOptions.lazyLoadImage,
paragraphBeginningSpace: mergedOptions.markdown.paragraphBeginningSpace,
setext: mergedOptions.markdown.setext,
toc: mergedOptions.markdown.toc,
});
Expand Down
1 change: 1 addition & 0 deletions src/ts/markdown/setLute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const setLute = (options: ILuteOptions) => {
lute.SetFixTermTypo(options.fixTermTypo);
lute.SetVditorCodeBlockPreview(options.codeBlockPreview);
lute.SetSetext(options.setext);
lute.SetChineseParagraphBeginningSpace(options.paragraphBeginningSpace);
if (options.lazyLoadImage) {
lute.SetImageLazyLoading(options.lazyLoadImage);
}
Expand Down
4 changes: 4 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ interface ILute {
},
}): void;

SetChineseParagraphBeginningSpace(enable: boolean): void;

SetHeadingAnchor(enable: boolean): void;

SetImageLazyLoading(imagePath: string): void;
Expand Down Expand Up @@ -227,6 +229,8 @@ interface IMath {
interface IMarkdownConfig {
/** 自动空格。默认值: false */
autoSpace?: boolean;
/** 段落开头是否空两格。默认值: false */
paragraphBeginningSpace?: boolean;
/** 自动矫正术语。默认值: false */
fixTermTypo?: boolean;
/** 自动矫正标点。默认值: false */
Expand Down

0 comments on commit 3c86118

Please sign in to comment.