Skip to content

Commit ae9cde8

Browse files
authored
Merge pull request #89 from ShahinSorkh/master
fix handleTabs from @ecchochan fork and fix #67
2 parents ceaaed7 + e745d2c commit ae9cde8

File tree

8 files changed

+317
-220
lines changed

8 files changed

+317
-220
lines changed

build/codeflask.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/codeflask.module.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeflask.js

+283-185
Large diffs are not rendered by default.

src/styles/editor.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { BACKGROUND_COLOR, LINE_HEIGHT, FONT_SIZE } from './theme-default';
2-
import { cssSupports } from '../utils/css-supports';
1+
import { BACKGROUND_COLOR, LINE_HEIGHT, FONT_SIZE } from './theme-default'
2+
import { cssSupports } from '../utils/css-supports'
33

4-
const FONT_FAMILY = `"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace`;
5-
const COLOR = (cssSupports('caret-color', '#000')) ? BACKGROUND_COLOR : '#ccc';
4+
const FONT_FAMILY = `"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace`
5+
const COLOR = (cssSupports('caret-color', '#000')) ? BACKGROUND_COLOR : '#ccc'
66
const LINE_NUMBER_WIDTH = '40px'
77

8-
9-
export const editor_css = `
8+
export const editorCss = `
109
.codeflask {
1110
position: absolute;
1211
width: 100%;
@@ -110,4 +109,4 @@ export const editor_css = `
110109
background: #eee;
111110
z-index: 1;
112111
}
113-
`;
112+
`

src/styles/injector.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
export function inject_css(css, styleName, parent) {
2-
const CSS_ID = styleName || 'codeflask-style';
3-
const PARENT = parent || document.head;
1+
export function injectCss (css, styleName, parent) {
2+
const CSS_ID = styleName || 'codeflask-style'
3+
const PARENT = parent || document.head
44

55
if (!css) {
6-
return false;
6+
return false
77
}
88

99
if (document.getElementById(CSS_ID)) {
10-
return true;
10+
return true
1111
}
1212

13-
const style = document.createElement('style');
13+
const style = document.createElement('style')
1414

15-
style.innerHTML = css;
16-
style.id = CSS_ID;
17-
PARENT.appendChild(style);
15+
style.innerHTML = css
16+
style.id = CSS_ID
17+
PARENT.appendChild(style)
1818

19-
return true;
19+
return true
2020
}

src/styles/theme-default.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export const BACKGROUND_COLOR = '#fff';
2-
export const LINE_HEIGHT = '20px';
3-
export const FONT_SIZE = '13px';
1+
export const BACKGROUND_COLOR = '#fff'
2+
export const LINE_HEIGHT = '20px'
3+
export const FONT_SIZE = '13px'
44

5-
export const default_css_theme = `
5+
export const defaultCssTheme = `
66
.codeflask {
77
background: ${BACKGROUND_COLOR};
88
color: #4f559c;
@@ -55,4 +55,4 @@ export const default_css_theme = `
5555
.codeflask .token.attr-value {
5656
color: #8500ff;
5757
}
58-
`;
58+
`

src/utils/css-supports.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
export function cssSupports(property, value) {
1+
export function cssSupports (property, value) {
22
if (CSS) {
3-
return CSS.supports(property, value);
3+
return CSS.supports(property, value)
44
}
55

6-
return toCamelCase(property) in document.body.style;
6+
return toCamelCase(property) in document.body.style
77
}
88

9-
export function toCamelCase(cssProperty) {
9+
export function toCamelCase (cssProperty) {
1010
cssProperty = cssProperty
1111
.split('-')
1212
.filter(word => !!word)
1313
.map(word => word[0].toUpperCase() + word.substr(1))
14-
.join('');
14+
.join('')
1515

16-
return cssProperty[0].toLowerCase() + cssProperty.substr(1);
16+
return cssProperty[0].toLowerCase() + cssProperty.substr(1)
1717
}

src/utils/html-escape.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const entityMap = {
77
'/': '/',
88
'`': '`',
99
'=': '='
10-
};
10+
}
1111

12-
export function escape_html (string) {
13-
return String(string).replace(/[&<>"'`=\/]/g, function (s) {
14-
return entityMap[s];
15-
});
12+
export function escapeHtml (string) {
13+
return String(string).replace(/[&<>"'`=/]/g, function (s) {
14+
return entityMap[s]
15+
})
1616
}

0 commit comments

Comments
 (0)