[DE mobile] Added the ability to insert page number
This commit is contained in:
parent
133f5d4675
commit
68854f47dd
|
@ -246,6 +246,14 @@
|
|||
"textAddLink": "Add Link",
|
||||
"textDisplay": "Display",
|
||||
"textScreenTip": "Screen Tip",
|
||||
"textInsert": "Insert"
|
||||
"textInsert": "Insert",
|
||||
"textPosition": "Position",
|
||||
"textLeftTop": "Left Top",
|
||||
"textCenterTop": "Center Top",
|
||||
"textRightTop": "Right Top",
|
||||
"textLeftBottom": "Left Bottom",
|
||||
"textCenterBottom": "Center Bottom",
|
||||
"textRightBottom": "Right Bottom",
|
||||
"textCurrentPosition": "Current Position"
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ class AddOtherController extends Component {
|
|||
constructor (props) {
|
||||
super(props);
|
||||
this.onInsertLink = this.onInsertLink.bind(this);
|
||||
this.onInsertPageNumber = this.onInsertPageNumber.bind(this);
|
||||
}
|
||||
|
||||
closeModal () {
|
||||
|
@ -55,10 +56,48 @@ class AddOtherController extends Component {
|
|||
this.closeModal();
|
||||
}
|
||||
|
||||
onInsertPageNumber (type) {
|
||||
const api = Common.EditorApi.get();
|
||||
|
||||
let value = -1;
|
||||
|
||||
if (2 == type.length) {
|
||||
const c_pageNumPosition = {
|
||||
PAGE_NUM_POSITION_TOP: 0x01,
|
||||
PAGE_NUM_POSITION_BOTTOM: 0x02,
|
||||
PAGE_NUM_POSITION_RIGHT: 0,
|
||||
PAGE_NUM_POSITION_LEFT: 1,
|
||||
PAGE_NUM_POSITION_CENTER: 2
|
||||
};
|
||||
value = {};
|
||||
|
||||
if (type[0] == 'l') {
|
||||
value.subtype = c_pageNumPosition.PAGE_NUM_POSITION_LEFT;
|
||||
} else if (type[0] == 'c') {
|
||||
value.subtype = c_pageNumPosition.PAGE_NUM_POSITION_CENTER;
|
||||
} else if (type[0] == 'r') {
|
||||
value.subtype = c_pageNumPosition.PAGE_NUM_POSITION_RIGHT;
|
||||
}
|
||||
|
||||
if (type[1] == 't') {
|
||||
value.type = c_pageNumPosition.PAGE_NUM_POSITION_TOP;
|
||||
} else if (type[1] == 'b') {
|
||||
value.type = c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM;
|
||||
}
|
||||
|
||||
api.put_PageNum(value.type, value.subtype);
|
||||
} else {
|
||||
api.put_PageNum(value);
|
||||
}
|
||||
|
||||
this.closeModal();
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<AddOther onInsertLink={this.onInsertLink}
|
||||
getDisplayLinkText={this.getDisplayLinkText}
|
||||
onInsertPageNumber={this.onInsertPageNumber}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import {AddImageController} from "../../controller/add/AddImage";
|
|||
import {AddOtherController} from "../../controller/add/AddOther";
|
||||
|
||||
import {PageImageLinkSettings} from "../add/AddImage";
|
||||
import {PageAddLink} from "../add/AddOther";
|
||||
import {PageAddLink, PageAddNumber} from "../add/AddOther";
|
||||
|
||||
const routes = [
|
||||
// Image
|
||||
|
@ -24,6 +24,10 @@ const routes = [
|
|||
path: '/add-link/',
|
||||
component: PageAddLink,
|
||||
},
|
||||
{
|
||||
path: '/add-page-number/',
|
||||
component: PageAddNumber,
|
||||
},
|
||||
];
|
||||
|
||||
const AddLayoutNavbar = ({ tabs, inPopover }) => {
|
||||
|
|
|
@ -48,6 +48,25 @@ const PageLink = props => {
|
|||
)
|
||||
};
|
||||
|
||||
const PageNumber = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('Add', {returnObjects: true});
|
||||
return (
|
||||
<Page>
|
||||
<Navbar title={_t.textPosition} backLink={_t.textBack}/>
|
||||
<List>
|
||||
<ListItem title={_t.textLeftTop} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('lt')}}></ListItem>
|
||||
<ListItem title={_t.textCenterTop} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('ct')}}></ListItem>
|
||||
<ListItem title={_t.textRightTop} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('rt')}}></ListItem>
|
||||
<ListItem title={_t.textLeftBottom} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('lb')}}></ListItem>
|
||||
<ListItem title={_t.textCenterBottom} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('cb')}}></ListItem>
|
||||
<ListItem title={_t.textRightBottom} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('rb')}}></ListItem>
|
||||
<ListItem title={_t.textCurrentPosition} link='#' className='no-indicator' onClick={()=>{props.onInsertPageNumber('current')}}></ListItem>
|
||||
</List>
|
||||
</Page>
|
||||
)
|
||||
};
|
||||
|
||||
const AddOther = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t('Add', {returnObjects: true});
|
||||
|
@ -62,7 +81,9 @@ const AddOther = props => {
|
|||
}}>
|
||||
<Icon slot="media" icon="icon-link"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title={_t.textPageNumber}>
|
||||
<ListItem title={_t.textPageNumber} link={'/add-page-number/'} routeProps={{
|
||||
onInsertPageNumber: props.onInsertPageNumber
|
||||
}}>
|
||||
<Icon slot="media" icon="icon-pagenumber"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title={_t.textBreak}>
|
||||
|
@ -75,4 +96,6 @@ const AddOther = props => {
|
|||
)
|
||||
};
|
||||
|
||||
export {AddOther, PageLink as PageAddLink};
|
||||
export {AddOther,
|
||||
PageLink as PageAddLink,
|
||||
PageNumber as PageAddNumber};
|
Loading…
Reference in a new issue