Skip to content

Commit f43f8a2

Browse files
committed
chore: clean up code
1 parent b07df65 commit f43f8a2

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

src/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
pointer-events: all;
100100
max-width: 800px;
101101
white-space: pre-wrap;
102-
line-height: 1; // 保证中英文行高一致
102+
line-height: 1; // assure the line-height consistency between different languages
103103
#input-box {
104104
padding: 5px;
105105
}

src/index.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,22 @@ import mobileMenu from './plugin/mobileMenu'
7070
import Bus from './utils/pubsub'
7171

7272
import './index.less'
73-
import './plugin/contextMenu.less'
74-
import './plugin/toolBar.less'
75-
import './plugin/nodeMenu.less'
76-
import './plugin/mobileMenu.less'
7773

7874
// import { exportSvg, exportPng } from '../painter'
7975

8076
import './iconfont/iconfont.js'
8177

8278
// TODO show up animation
79+
80+
/**
81+
* @function
82+
* @global
83+
* @name E
84+
* @param {string} id Node id.
85+
* @return {TargetElement} Target element.
86+
* @example
87+
* E('bd4313fbac40284b')
88+
*/
8389
export const E = findEle
8490
type LinkObj = object
8591
type operation = {
@@ -346,15 +352,6 @@ MindElixir.prototype = {
346352
refresh,
347353

348354
init: function() {
349-
/**
350-
* @function
351-
* @global
352-
* @name E
353-
* @param {string} id Node id.
354-
* @return {TargetElement} Target element.
355-
* @example
356-
* E('bd4313fbac40284b')
357-
*/
358355
addParentLink(this.nodeData)
359356
console.log('ME_version ' + MindElixir.version)
360357
console.log(this)

src/plugin/contextMenu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import i18n from '../i18n'
22
import { encodeHTML } from '../utils/index'
3+
import './contextMenu.less'
34

45
export default function(mind, option) {
56
const createTips = words => {
@@ -163,7 +164,7 @@ export default function(mind, option) {
163164
) {
164165
mind.createLink(from, mind.currentNode)
165166
} else {
166-
console.log('取消连接')
167+
console.log('link cancel')
167168
}
168169
},
169170
{

src/plugin/mobileMenu.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import './mobileMenu.less'
2+
13
export default function(mind, option?) {
24
const createLi = (id, name) => {
35
const div = document.createElement('div')

src/plugin/nodeMenu.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './nodeMenu.less'
12
import i18n from '../i18n'
23

34
const createDiv = (id) => {

src/plugin/toolBar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import './toolBar.less'
2+
13
const createButton = (id, name) => {
24
const button = document.createElement('span')
35
button.id = id

src/utils/dom.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function createInputDiv(tpc: Topic) {
128128
div.addEventListener('keydown', e => {
129129
e.stopPropagation()
130130
const key = e.key
131-
// console.log(e, key)
131+
132132
if (key === 'Enter' || key === 'Tab') {
133133
// keep wrap for shift enter
134134
if (e.shiftKey) return
@@ -139,15 +139,15 @@ export function createInputDiv(tpc: Topic) {
139139
}
140140
})
141141
div.addEventListener('blur', () => {
142-
if (!div) return // 防止重复blur
142+
if (!div) return
143143
const node = tpc.nodeObj
144144
const topic = div.textContent!.trim()
145145
console.log(topic)
146146
if (topic === '') node.topic = origin
147147
else node.topic = topic
148148
div.remove()
149149
this.inputDiv = div = null
150-
if (topic === origin) return // 没有修改不做处理
150+
if (topic === origin) return
151151
tpc.childNodes[0].textContent = node.topic
152152
this.linkDiv()
153153
this.bus.fire('operation', {
@@ -162,7 +162,6 @@ export function createInputDiv(tpc: Topic) {
162162
export const createExpander = function(expanded: boolean | undefined): Expander {
163163
const expander: Expander = $d.createElement('epd')
164164
// 包含未定义 expanded 的情况,未定义视为展开
165-
// expander.innerText = expanded !== false ? '⊖' : '⊕'
166165
expander.expanded = expanded !== false
167166
expander.className = expanded !== false ? 'minus' : ''
168167
return expander

src/utils/svg.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ export const createPath = function(d: string) {
3939
path.setAttribute('fill', 'none')
4040
path.setAttribute('stroke-linecap', 'square')
4141
path.setAttribute('stroke-width', '1')
42-
path.setAttribute('transform', 'translate(0.5,-0.5)')
43-
// adding translate(0.5,-0.5) can fix render error on windows, but i still dunno why
4442
return path
4543
}
4644

0 commit comments

Comments
 (0)