Skip to content

Commit

Permalink
🐛 fix #291
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 9, 2020
1 parent 2fec413 commit 6d7ddf2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

### v3.1.4 / 2020-04-0x

* [291](https://github.com/Vanessa219/vditor/pull/291) 🎨 改进 Counter `修复缺陷`
* [285](https://github.com/Vanessa219/vditor/issues/285) shift+tab is not working at lists `修复缺陷`
* [292](https://github.com/Vanessa219/vditor/pull/292) 🐛 全屏模式文末空白 `修复缺陷`
* [293](https://github.com/Vanessa219/vditor/issues/293) iOS Safari 快捷键显示为 Windows 版本 `修复缺陷`
Expand Down
4 changes: 2 additions & 2 deletions src/ts/counter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export class Counter {

}

public render(text: string, counter: number, label: string = "Markdown") {
public render(text: string, counter: number) {
const length = text.endsWith("\n") ? text.length - 1 : text.length;
if (length > counter) {
this.element.className = "vditor-counter vditor-counter--error";
} else {
this.element.className = "vditor-counter";
}
this.element.innerHTML = `${label}: ${length}/${counter}`;
this.element.innerHTML = `Markdown: ${length}/${counter}`;
}
}
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ interface IVditor {
};
counter?: {
element: HTMLElement
render(text: string, counter: number, label?: string): void,
render(text: string, counter: number): void,
};
resize?: {
element: HTMLElement,
Expand Down

0 comments on commit 6d7ddf2

Please sign in to comment.