Beginning of work on templates.

This commit is contained in:
Tomas Bures 2018-02-13 23:50:13 +01:00
parent 47b8d80c22
commit 508d6b3b2f
40 changed files with 1685 additions and 1031 deletions

View file

@ -13,9 +13,11 @@ import { Table, TableSelectMode } from './table';
import {Button, Icon} from "./bootstrap-components";
import brace from 'brace';
import AceEditor from 'react-ace';
import ACEEditorRaw from 'react-ace';
import 'brace/theme/github';
import CKEditorRaw from "react-ckeditor-component";
import DayPicker from 'react-day-picker';
import 'react-day-picker/lib/style.css';
import { parseDate, parseBirthday, formatDate, formatBirthday, DateFormat, birthdayYear, getDateFormatString, getBirthdayFormatString } from '../../../shared/date';
@ -823,7 +825,7 @@ class ACEEditor extends Component {
const htmlId = 'form_' + id;
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
<AceEditor
<ACEEditorRaw
id={htmlId}
mode={props.mode}
theme="github"
@ -841,6 +843,35 @@ class ACEEditor extends Component {
}
class CKEditor extends Component {
static propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.string,
help: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
height: PropTypes.string
}
static contextTypes = {
formStateOwner: PropTypes.object.isRequired
}
render() {
const props = this.props;
const owner = this.context.formStateOwner;
const id = this.props.id;
const htmlId = 'form_' + id;
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
<CKEditorRaw
onChange={evt => owner.updateFormValue(id, evt.editor.getData())}
content={owner.getFormValue(id)}
config={{width: '100%', height: props.height}}
/>
);
}
}
function withForm(target) {
const inst = target.prototype;
@ -1251,5 +1282,6 @@ export {
TableSelect,
TableSelectMode,
ACEEditor,
CKEditor,
FormSendMethod
}