Skip to content

Commit 5ecea7e

Browse files
authored
Merge pull request #417 from hackmdio/refactor
Refactor editor cont.
2 parents 3ef22fd + a4385ec commit 5ecea7e

6 files changed

Lines changed: 191 additions & 158 deletions

File tree

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
root = true
22

3-
# Tab indentation
43
[*]
54
indent_style = space
65
indent_size = 2
76
trim_trailing_whitespace = true
87
insert_final_newline = true
98

9+
[{*.html,*.ejs}]
10+
indent_style = space
11+
indent_size = 4
12+
trim_trailing_whitespace = true
13+
1014
[*.md]
1115
trim_trailing_whitespace = false
1216

public/js/extra.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ require('./lib/common/login')
1919
require('../vendor/md-toc')
2020
var Viz = require('viz.js')
2121

22+
import getUIElements from './lib/editor/ui-elements'
23+
const ui = getUIElements()
24+
2225
// auto update last change
2326
window.createtime = null
2427
window.lastchangetime = null
@@ -634,7 +637,7 @@ function generateCleanHTML (view) {
634637
}
635638

636639
export function exportToRawHTML (view) {
637-
const filename = `${renderFilename(window.ui.area.markdown)}.html`
640+
const filename = `${renderFilename(ui.area.markdown)}.html`
638641
const src = generateCleanHTML(view)
639642
$(src).find('a.anchor').remove()
640643
const html = src[0].outerHTML
@@ -646,8 +649,8 @@ export function exportToRawHTML (view) {
646649

647650
// extract markdown body to html and compile to template
648651
export function exportToHTML (view) {
649-
const title = renderTitle(window.ui.area.markdown)
650-
const filename = `${renderFilename(window.ui.area.markdown)}.html`
652+
const title = renderTitle(ui.area.markdown)
653+
const filename = `${renderFilename(ui.area.markdown)}.html`
651654
const src = generateCleanHTML(view)
652655
// generate toc
653656
const toc = $('#ui-toc').clone()

0 commit comments

Comments
 (0)