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
🚨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Apr 30, 2020
1 parent f75372c commit 123fe8d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/src/config/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const image = {
});
});
},
onSetimage: (liandi: ILiandi, image: IImage) => {
liandi.config.image = image;
onSetimage: (liandi: ILiandi, imageConfig: IImage) => {
liandi.config.image = imageConfig;
}
};
2 changes: 1 addition & 1 deletion app/src/config/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const markdown = {
<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>
</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' : ''}/>
Expand Down
4 changes: 2 additions & 2 deletions app/src/editors/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {rename} from '../util/rename';
import {remote} from 'electron';
import {Constants} from "../constants";
import {Constants} from '../constants';

export class Editors {
private inputElement: HTMLInputElement;
Expand Down Expand Up @@ -43,7 +43,7 @@ export class Editors {
sendMessage(message: string, liandi?: ILiandi, editorData?: { content: string, name: string }) {
if (editorData) {
remote.getGlobal('liandiEditor').editorText = editorData.content;
this.inputElement.value = editorData.name.replace(".md", "");
this.inputElement.value = editorData.name.replace('.md', '');
this.inputElement.classList.remove('fn__none');
this.editorWebviewElement.classList.remove('fn__none');
}
Expand Down
18 changes: 9 additions & 9 deletions app/src/editors/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class EditorWebview {
id: 'copyAsPlainText',
accelerator: 'CmdOrCtrl+Shift+C',
click: () => {
clipboard.writeText(getSelection().getRangeAt(0).toString().replace(//g, ""));
clipboard.writeText(getSelection().getRangeAt(0).toString().replace(//g, ''));
}
}));
menu.append(new remote.MenuItem({
Expand Down Expand Up @@ -98,7 +98,7 @@ export class EditorWebview {
}

private isCtrl(event: KeyboardEvent) {
if (navigator.platform.toUpperCase().indexOf("MAC") >= 0) {
if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
// mac
if (event.metaKey && !event.ctrlKey) {
return true;
Expand All @@ -110,7 +110,7 @@ export class EditorWebview {
}
return false;
}
};
}

private onOpen(liandi: ILiandi, value: string = remote.getGlobal('liandiEditor').editorText) {
document.getElementById('liandiVditor').innerHTML = '';
Expand Down Expand Up @@ -184,7 +184,7 @@ export class EditorWebview {
counter: {
enable: true
},
cdn: remote.getGlobal('liandiEditor').appDir + "/node_modules/vditor",
cdn: remote.getGlobal('liandiEditor').appDir + '/node_modules/vditor',
preview: {
markdown: {
autoSpace: liandi.config.markdown.autoSpace,
Expand All @@ -210,7 +210,7 @@ export class EditorWebview {
'X-URL': encodeURIComponent(liandi.current.dir.url),
'X-PATH': encodeURIComponent(liandi.current.path),
'X-Mode': this.vditor.getCurrentMode()
}
};
},
linkToImgUrl: Constants.UPLOAD_FETCH_ADDRESS,
filename: (name: string) => name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, '').replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, '').replace('/\\s/g', ''),
Expand All @@ -233,19 +233,19 @@ export class EditorWebview {
}
});

this.vditor.vditor.wysiwyg.element.addEventListener("keydown", (event: KeyboardEvent) => {
this.vditor.vditor.wysiwyg.element.addEventListener('keydown', (event: KeyboardEvent) => {
if (this.isCtrl(event) && event.key.toLowerCase() === 'v' && !event.altKey && event.shiftKey) {
const range = getSelection().getRangeAt(0)
const range = getSelection().getRangeAt(0);
range.extractContents();
this.vditor.insertValue(clipboard.readText());
event.preventDefault();
}

if (this.isCtrl(event) && event.key.toLowerCase() === 'c' && !event.altKey && event.shiftKey) {
clipboard.writeText(getSelection().getRangeAt(0).toString().replace(//g, ""));
clipboard.writeText(getSelection().getRangeAt(0).toString().replace(//g, ''));
event.preventDefault();
}
})
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/hotkey/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const initGlobalKeyPress = (liandi: ILiandi | any) => {
&& thisKeypressTime - lastKeypressTime >= 50) { // 防止 win32 长按
lastKeypressTime = 0;
if (liandi.range) {
liandi.range = getSelection().getRangeAt(0)
liandi.range = getSelection().getRangeAt(0);
ipcRenderer.sendToHost(Constants.LIANDI_SEARCH_OPEN);
} else {
initSearch(liandi);
Expand Down
2 changes: 1 addition & 1 deletion app/src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const i18n: II18n = {
copyAsPlainText: 'Copy As Plain Text',
paste: 'Paste',
pasteAsPlainText: 'Paste As Plain Text',
hideToolbar: "Hide Editor's toolbar",
hideToolbar: 'Hide Editor\'s toolbar',
toc: 'Enable [toc]',
footnotes: 'Enable [^footnotes]',
autoFetch: 'Auto fetch remote image to local',
Expand Down
2 changes: 1 addition & 1 deletion app/src/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {initConfigSearch} from '../config/search';
import {getPath, removeLastPath} from '../util/path';
import {markdown} from '../config/markdown';
import {image} from '../config/image';
import {Constants} from "../constants";
import {Constants} from '../constants';

export const quickOpenFile = (liandi: ILiandi, dialogElement: Element) => {
const currentList: HTMLElement = dialogElement.querySelector('div[data-name="search"] .list__item--current');
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const dialog = (options: {
if (!dialogElement) {
document.body.insertAdjacentHTML('beforeend', `
<div class="dialog" id="dialog">
${options.hideBackground ? "" : '<div class="dialog__bg"></div>'}
${options.hideBackground ? '' : '<div class="dialog__bg"></div>'}
<div class="dialog__main fn__layer">
<svg class="dialog__close"><use xlink:href="#iconClose"></use></svg>
<div class="dialog__header" onselectstart="return false;">
Expand Down
2 changes: 1 addition & 1 deletion app/src/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class WebSocketUtil {
liandi.files.onLs(liandi, response.data);
break;
case 'get':
liandi.editors.focus()
liandi.editors.focus();
liandi.editors.sendMessage(Constants.LIANDI_EDITOR_OPEN, liandi, response.data);
break;
case 'searchget':
Expand Down

0 comments on commit 123fe8d

Please sign in to comment.