Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.
/ liandi Public archive

Commit

Permalink
fix #10
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 5, 2020
1 parent c9af5b4 commit 1ec62ac
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 60 deletions.
115 changes: 58 additions & 57 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"ts-loader": "^6.2.1",
"tslint": "^6.0.0",
"tslint": "^6.1.1",
"typescript": "^3.7.5",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},
"dependencies": {
"vditor": "^3.0.10"
"vditor": "^3.0.11"
}
}
20 changes: 19 additions & 1 deletion app/src/config/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ import {Constants} from '../constants';
export const markdown = {
genHTML: (liandi: ILiandi) => {
return `
<div class="form__item">
${i18n[liandi.config.lang].editMode}<span class="fn__space"></span><span class="fn__space"></span>
<label>
<input value="wysiwyg" type="radio" name="editMode"${liandi.config.markdown.editorMode === 'wysiwyg' ? ' checked' : ''}/>
<span class="fn__space"></span>${i18n[liandi.config.lang].wysiwyg}
</label>
<span class="fn__space"></span><span class="fn__space"></span>
<label>
<input value="ir" name="editMode" type="radio"${liandi.config.markdown.editorMode === 'ir' ? ' checked' : ''}/>
<span class="fn__space"></span>${i18n[liandi.config.lang].ir}
</label>
<span class="fn__space"></span><span class="fn__space"></span>
<label>
<input value="sv" name="editMode" type="radio"${liandi.config.markdown.editorMode === 'sv' ? ' checked' : ''}/>
<span class="fn__space"></span>${i18n[liandi.config.lang].sv}
</label>
</div>
<div class="form__item"><label>
<input id="autoSpace" type="checkbox"${liandi.config.markdown.autoSpace ? ' checked' : ''}/>
<span class="fn__space"></span>${i18n[liandi.config.lang].autoSpace}
Expand Down Expand Up @@ -53,7 +70,8 @@ export const markdown = {
chinesePunct: (element.querySelector('#chinesePunct') as HTMLInputElement).checked,
fixTermTypo: (element.querySelector('#fixTermTypo') as HTMLInputElement).checked,
inlineMathAllowDigitAfterOpenMarker: (element.querySelector('#inlineMathAllowDigitAfterOpenMarker') as HTMLInputElement).checked,
mathEngine: (element.querySelector('[name="mathEngine"]:checked') as HTMLInputElement).value,
editorMode: (element.querySelector('[name="editMode"]:checked') as HTMLInputElement).value,
mathEngine: (element.querySelector('[name="editMode"]:checked') as HTMLInputElement).value,
footnotes: (element.querySelector('#footnotes') as HTMLInputElement).checked,
toc: (element.querySelector('#toc') as HTMLInputElement).checked,
hideToolbar: (element.querySelector('#hideToolbar') as HTMLInputElement).checked,
Expand Down
1 change: 1 addition & 0 deletions app/src/editors/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class EditorWebview {
document.getElementById('liandiVditor').innerHTML = '';
let timeoutId: number;
this.vditor = new Vditor('liandiVditor', {
mode: liandi.config.markdown.editorMode,
hideToolbar: liandi.config.markdown.hideToolbar,
typewriterMode: true,
toolbar: [
Expand Down
8 changes: 8 additions & 0 deletions app/src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export const i18n: II18n = {
en_US: {
editMode: 'Edit Mode',
ir: 'Instant Rendering',
wysiwyg: 'WYSIWYG',
sv: 'Split View',
title: 'LianDi',
newFile: 'New Doc',
newFolder: 'New Folder',
Expand Down Expand Up @@ -46,6 +50,10 @@ export const i18n: II18n = {
image: 'Image',
},
zh_CN: {
editMode: '编辑模式',
ir: '即时渲染',
wysiwyg: '所见即所得',
sv: '分屏预览',
title: '链滴笔记',
newFile: '新建文档',
newFolder: '新建文件夹',
Expand Down
1 change: 1 addition & 0 deletions app/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ declare interface IMD {
fixTermTypo: boolean;
inlineMathAllowDigitAfterOpenMarker: boolean;
mathEngine: 'KaTeX' | 'MathJax';
editorMode: 'ir' | 'sv' | 'wysiwyg';
hideToolbar: boolean;
toc: boolean;
footnotes: boolean;
Expand Down

0 comments on commit 1ec62ac

Please sign in to comment.