pull/1721/head
Andrew Watkins 2017-07-25 13:38:12 -07:00
parent c653982216
commit 25d5310cf5
5 changed files with 16 additions and 15 deletions

View File

@ -9,11 +9,13 @@ CodeMirror.defineSimpleMode = function(name, states) {
CodeMirror.simpleMode = function(config, states) {
ensureState(states, 'start')
const states_ = {}, meta = states.meta || {}
const states_ = {},
meta = states.meta || {}
let hasIndentation = false
for (const state in states) {
if (state !== meta && states.hasOwnProperty(state)) {
const list = (states_[state] = []), orig = states[state]
const list = (states_[state] = []),
orig = states[state]
for (let i = 0; i < orig.length; i++) {
const data = orig[i]
list.push(new Rule(data, states))
@ -51,9 +53,10 @@ CodeMirror.simpleMode = function(config, states) {
s.persistentStates = {
mode: pers.mode,
spec: pers.spec,
state: pers.state === state.localState
? s.localState
: CodeMirror.copyState(pers.mode, pers.state),
state:
pers.state === state.localState
? s.localState
: CodeMirror.copyState(pers.mode, pers.state),
next: s.persistentStates,
}
}
@ -144,7 +147,8 @@ function tokenFunction(states, config) {
tok = state.local.mode.token(stream, state.localState)
if (
state.local.endScan && (m = state.local.endScan.exec(stream.current()))
state.local.endScan &&
(m = state.local.endScan.exec(stream.current()))
) {
stream.pos = stream.start + m.index
}
@ -278,7 +282,8 @@ function indentFunction(states, meta) {
return CodeMirror.Pass
}
let pos = state.indent.length - 1, rules = states[state.state]
let pos = state.indent.length - 1,
rules = states[state.state]
scan: for (;;) {
for (let i = 0; i < rules.length; i++) {
const rule = rules[i]

View File

@ -15,7 +15,7 @@ const Tickscript = ({
onStartEditID,
onStopEditID,
isNewTickscript,
}) => (
}) =>
<div className="page">
<TickscriptHeader
task={task}
@ -46,7 +46,6 @@ const Tickscript = ({
</div>
</FancyScrollbar>
</div>
)
const {arrayOf, bool, func, shape, string} = PropTypes

View File

@ -17,7 +17,7 @@ const TickscriptHeader = ({
onChangeType,
onSelectDbrps,
isNewTickscript,
}) => (
}) =>
<div className="page-header">
<div className="page-header__container">
<div className="page-header__left">
@ -43,7 +43,6 @@ const TickscriptHeader = ({
</div>
</div>
</div>
)
const {arrayOf, bool, func, shape, string} = PropTypes

View File

@ -53,11 +53,10 @@ class TickscriptNewID extends Component {
}
}
export const TickscriptEditID = ({id}) => (
export const TickscriptEditID = ({id}) =>
<h1 className="page-header__title page-header kapacitor-theme">
{id}
</h1>
)
const {bool, func, string} = PropTypes

View File

@ -2,7 +2,7 @@ import React, {PropTypes} from 'react'
const STREAM = 'stream'
const BATCH = 'batch'
const TickscriptType = ({type, onChangeType}) => (
const TickscriptType = ({type, onChangeType}) =>
<ul className="nav nav-tablist nav-tablist-sm">
<li
className={type === STREAM ? 'active' : ''}
@ -17,7 +17,6 @@ const TickscriptType = ({type, onChangeType}) => (
Batch
</li>
</ul>
)
const {string, func} = PropTypes