3.0.4 • Published 9 years ago

apeman-react-builder v3.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

apeman-react-builder

Build Status Code Climate Code Coverage npm Version JS Standard

apeman react package for builder components.

Installation

$ npm install apeman-react-builder --save

Demo

Live demo is hosted on GitHub Pages.

Usage

'use strict'

import React from 'react'
import {ApBuilder, ApBuilderStyle} from 'apeman-react-builder'
import {ApTabStyle} from 'apeman-react-tab'
import {ApFrameStyle} from 'apeman-react-frame'

const color = '#38E'
const ExampleComponent = React.createClass({
  getInitialState () {
    return {
      html: `
<html><body><!-- ** --></body></html>
`,
      script: `
console.log('hoge', window.foo)
/* ... */
`,
      globals: {
        foo: 'This is foo!!'
      }
    }
  },

  render () {
    const s = this
    let { state } = s
    return (
      <div>
        <ApBuilderStyle highlightColor={ color }/>
        <ApTabStyle highlightColor={ color }/>
        <ApButtonStyle highlightColor={ color }/>
        <ApFrameStyle highlightColor={ color }/>
        <ApBuilderStyle highlightColor={ color }/>
        <ApBuilder html={ state.html }
                   script={ state.script }
                   compile={ (script) => { /* ... */ return script } }
                   globals={ state.globals }/>
      </div>
    )
  }
})

Components

ApBuilderEditor

Props

NameTypeDefaultDescription
onChangefuncHandle for change
onCancelfuncHandle for cancel
onSubmitfuncHandle for submit
labelsobject{

cancel: 'Cancel', submit: 'Submit' } | | Label texts | | src | string | | | Editting source | | mode | string | | | Editting type | | error | string|object | | | Error message | | spinning | bool | | | Show spinner | | actions | array | [] | | Custom actions |

ApBuilderFrame

Props

NameTypeDefaultDescription
srcstringSource string
onLoadfuncHandler for load event
onScriptErrorfuncHandler for script error
globalsobject{}Global variables inside iframe
scriptstringScript to execute when loaded
compilefunc(script) => scriptCompile script before executing
vrnumberVersion number
id`ap-builder-frame-${uuid.v4()}`

ApBuilderStyle

Props

NameTypeDefaultDescription
styleobject{}
highlightColorstringApStyle.DEFAULT_HIGHLIGHT_COLOR
backgroundColorApStyle.DEFAULT_BACKGROUND_COLOR

ApBuilder

Props

NameTypeDefaultDescription
htmlstring''Html contents
scriptstring''Script text
globalsobjectGlobal variables
compilefuncCompile script before executing
onHtmlEditfunc() => undefinedHandle html edit
onScriptEditfunc() => undefinedHandle script edit
onScriptErrorfuncHandle script error
labelsobject{

htmlTab: 'HTML', scriptTab: 'Script' } | | Labels | | errors | object | | | Errors | | htmlMode | string | 'htmlmixed' | | Codemirror mode for html | | scriptMode | string | 'javascript' | | Codemirror mode for script | | htmlActions | array | | | Custom actions for html editor | | scriptActions | array | | | Custom actions for script editor | | isSupported | func | function() { return /Chrome/.test(navigator.userAgent) } | | Check if supported |

License

This software is released under the MIT License.

Links

3.0.4

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

1.2.12

9 years ago

1.2.11

9 years ago

1.2.10

9 years ago

1.2.9

9 years ago

1.2.8

9 years ago

1.2.7

9 years ago

1.2.6

9 years ago

1.2.5

9 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.13

9 years ago

1.1.12

9 years ago

1.1.10

10 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.0

10 years ago