[SSE mobile] Added the ability to insert shape

This commit is contained in:
JuliaSvinareva 2021-02-04 15:29:33 +03:00
parent a81459fcd6
commit 366f1db1de
3 changed files with 71 additions and 7 deletions

View file

@ -0,0 +1,35 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import AddShape from '../../view/add/AddShape';
class AddShapeController extends Component {
constructor (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.asc_addShapeOnSheet(type);
this.closeModal();
}
render () {
return (
<AddShape onShapeClick={this.onShapeClick}
/>
)
}
}
export default AddShapeController;

View file

@ -8,7 +8,7 @@ import {Device} from '../../../../../common/mobile/utils/device';
import AddChartController from "../../controller/add/AddChart";
import {AddFunctionController} from "../../controller/add/AddFunction";
import {PageFunctionGroup, PageFunctionInfo} from "./AddFunction";
//import AddShapeController from "../../controller/add/AddShape";
import AddShapeController from "../../controller/add/AddShape";
//import {AddOtherController} from "../../controller/add/AddOther";
const routes = [
@ -75,13 +75,15 @@ const AddTabs = props => {
component: <AddFunctionController onOptionClick={props.onOptionClick}/>
});
}
if (!showPanels || showPanels.indexOf('shape') > 0) {
tabs.push({
caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController/>
});
}
/*tabs.push({
caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController />
});
tabs.push({
caption: _t.textOther,
id: 'add-other',
icon: 'icon-add-other',

View file

@ -0,0 +1,27 @@
import React, {Fragment, useState} from 'react';
import {observer, inject} from "mobx-react";
const AddShape = props => {
const shapes = props.storeShapeSettings.getStyleGroups();
return (
<div className={'dataview shapes'}>
{shapes.map((row, indexRow) => {
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 default inject("storeShapeSettings")(observer(AddShape));