[DE mobile] Added the ability to add shapes
This commit is contained in:
parent
f3c4af7914
commit
e8f2c61f83
|
@ -337,7 +337,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataview, #add-table {
|
.dataview, #add-table, #add-shape {
|
||||||
&.page-content {
|
&.page-content {
|
||||||
background-color: @white;
|
background-color: @white;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import {observer, inject} from "mobx-react";
|
|
||||||
|
|
||||||
import { AddShape } from '../../view/add/AddShape';
|
import AddShape from '../../view/add/AddShape';
|
||||||
|
|
||||||
class AddShapeController extends Component {
|
class AddShapeController extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.onShapeClick = this.onShapeClick.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeModal () {
|
||||||
|
if ( Device.phone ) {
|
||||||
|
f7.sheet.close('.add-popup', true);
|
||||||
|
} else {
|
||||||
|
f7.popover.close('#add-popover');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onShapeClick (type) {
|
||||||
|
const api = Common.EditorApi.get();
|
||||||
|
api.AddShapeOnCurrentPage(type);
|
||||||
|
this.closeModal();
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<AddShape
|
<AddShape onShapeClick={this.onShapeClick}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,28 @@
|
||||||
import React, {Fragment, useState} from 'react';
|
import React from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
import {Page, Navbar, List, ListItem, ListButton, Row, BlockTitle, Range, Toggle, Icon} from 'framework7-react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
|
||||||
|
|
||||||
const AddShape = props => {
|
const AddShape = props => {
|
||||||
|
const storeShapeSettings = props.storeShapeSettings;
|
||||||
|
let shapes = storeShapeSettings.getStyleGroups();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<div className={'dataview shapes'}>
|
||||||
|
{shapes.map((row, indexRow) => {
|
||||||
</Fragment>
|
return (
|
||||||
|
<ul className="row" key={'shape-row-' + indexRow}>
|
||||||
|
{row.map((shape, index) => {
|
||||||
|
return (
|
||||||
|
<li key={'shape-' + indexRow + '-' + index} onClick={() => {props.onShapeClick(shape.type)}}>
|
||||||
|
<div className="thumb"
|
||||||
|
style={{WebkitMaskImage: `url('resources/img/shapes/${shape.thumb}')`}}>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export {AddShape};
|
export default inject("storeShapeSettings")(observer(AddShape));
|
Loading…
Reference in a new issue