diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 70907988a..152bebdc1 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -325,6 +325,7 @@ "textHyperlink": "Hyperlink", "textImage": "Image", "textImageURL": "Image URL", + "textInsertImage": "Insert Image", "textLastColumn": "Last Column", "textLastSlide": "Last Slide", "textLayout": "Layout", diff --git a/apps/presentationeditor/mobile/src/controller/edit/EditText.jsx b/apps/presentationeditor/mobile/src/controller/edit/EditText.jsx index 7d96bf4eb..ce713e8a9 100644 --- a/apps/presentationeditor/mobile/src/controller/edit/EditText.jsx +++ b/apps/presentationeditor/mobile/src/controller/edit/EditText.jsx @@ -8,6 +8,26 @@ import { EditText } from '../../view/edit/EditText'; class EditTextController extends Component { constructor (props) { super(props); + + this.onApiImageLoaded = this.onApiImageLoaded.bind(this); + } + + componentDidMount() { + const api = Common.EditorApi.get(); + api.asc_registerCallback('asc_onBulletImageLoaded', this.onApiImageLoaded); + } + + componentWillUnmount() { + const api = Common.EditorApi.get(); + api.asc_unregisterCallback('asc_onBulletImageLoaded', this.onApiImageLoaded); + } + + closeModal() { + if ( Device.phone ) { + f7.sheet.close('#edit-sheet', true); + } else { + f7.popover.close('#edit-popover'); + } } toggleBold(value) { @@ -247,6 +267,40 @@ class EditTextController extends Component { if (api) api.SetDrawImagePreviewBulletForMenu(arr, type); } + onApiImageLoaded(bullet) { + const api = Common.EditorApi.get(); + const selectedElements = api.getSelectedElements(); + const imageProp = {id: bullet.asc_getImageId(), redraw: true}; + + let selectItem = null; + + if(selectedElements) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + selectItem = selectedElements[i].get_ObjectValue(); + break; + } + } + } + + bullet.asc_fillBulletImage(imageProp.id); + selectItem.asc_putBullet(bullet); + api.paraApply(selectItem); + this.closeModal(); + } + + onImageSelect() { + (new Asc.asc_CBullet()).asc_showFileDialog(); + } + + onInsertByUrl(value) { + var checkUrl = value.replace(/ /g, ''); + + if(checkUrl) { + (new Asc.asc_CBullet()).asc_putImageUrl(checkUrl); + } + } + onLineSpacing(value) { const api = Common.EditorApi.get(); const LINERULE_AUTO = 1; @@ -276,6 +330,8 @@ class EditTextController extends Component { onBullet={this.onBullet} onNumber={this.onNumber} getIconsBulletsAndNumbers={this.getIconsBulletsAndNumbers} + onImageSelect={this.onImageSelect} + onInsertByUrl={this.onInsertByUrl} onLineSpacing={this.onLineSpacing} /> ) diff --git a/apps/presentationeditor/mobile/src/less/app.less b/apps/presentationeditor/mobile/src/less/app.less index 52f98b332..334d1d1c2 100644 --- a/apps/presentationeditor/mobile/src/less/app.less +++ b/apps/presentationeditor/mobile/src/less/app.less @@ -171,4 +171,12 @@ z-index: 1; .encoded-svg-background(''); } +} + +.bullet-menu-image ul{ + padding: 0; + + li { + display: inherit; + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx index 863f789df..0ae622112 100644 --- a/apps/presentationeditor/mobile/src/view/edit/Edit.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/Edit.jsx @@ -14,7 +14,7 @@ import EditChartController from "../../controller/edit/EditChart"; import { EditLinkController } from "../../controller/edit/EditLink"; import { Theme, Layout, Transition, Type, Effect, StyleFillColor, CustomFillColor } from './EditSlide'; -import { PageTextFonts, PageTextFontColor, PageTextHighlightColor, PageTextCustomFontColor, PageTextAddFormatting, PageTextBulletsAndNumbers, PageTextLineSpacing } from './EditText'; +import { PageTextFonts, PageTextFontColor, PageTextHighlightColor, PageTextCustomFontColor, PageTextAddFormatting, PageTextBulletsAndNumbers, PageTextLineSpacing, PageTextBulletsLinkSettings } from './EditText'; import { PageShapeStyle, PageShapeStyleNoFill, PageReplaceContainer, PageReorderContainer, PageAlignContainer, PageShapeBorderColor, PageShapeCustomBorderColor, PageShapeCustomFillColor } from './EditShape'; import { PageImageReplace, PageImageReorder, PageImageAlign, PageLinkSettings } from './EditImage'; import { PageTableStyle, PageTableStyleOptions, PageTableCustomFillColor, PageTableBorderColor, PageTableCustomBorderColor, PageTableReorder, PageTableAlign } from './EditTable'; @@ -77,7 +77,13 @@ const routes = [ }, { path: '/edit-bullets-and-numbers/', - component: PageTextBulletsAndNumbers + component: PageTextBulletsAndNumbers, + routes: [ + { + path: 'image-link/', + component: PageTextBulletsLinkSettings + } + ] }, { path: '/edit-text-line-spacing/', diff --git a/apps/presentationeditor/mobile/src/view/edit/EditText.jsx b/apps/presentationeditor/mobile/src/view/edit/EditText.jsx index 778473eb0..d5b21cc87 100644 --- a/apps/presentationeditor/mobile/src/view/edit/EditText.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/EditText.jsx @@ -1,6 +1,6 @@ import React, {Fragment, useState, useEffect} from 'react'; import {observer, inject} from "mobx-react"; -import {f7, Swiper, View, SwiperSlide, List, ListItem, Icon, Row, Button, Page, Navbar, Segmented, BlockTitle, NavRight, Link} from 'framework7-react'; +import {f7, Swiper, View, SwiperSlide, List, ListItem, ListButton, ListInput, Icon, Row, Button, Page, Navbar, Segmented, BlockTitle, NavRight, Link} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx'; @@ -143,7 +143,9 @@ const EditText = props => {
{previewList}
@@ -498,18 +500,69 @@ const PageAdditionalFormatting = props => { ) }; +const PageBulletLinkSettings = (props) => { + const { t } = useTranslation(); + const _t = t('View.Edit', {returnObjects: true}); + const [stateValue, setValue] = useState(''); + + return ( + + + {_t.textAddress} + + {setValue(event.target.value)}} + > + + + + {props.onInsertByUrl(stateValue)}} + > + {_t.textInsertImage} + + + + ) +} + +const PageAddImage = (props) => { + const { t } = useTranslation(); + const _t = t('View.Edit', {returnObjects: true}); + + return ( + + + + + + props.f7router.navigate('/edit-bullets-and-numbers/image-link/', + {props: {onInsertByUrl: props.onInsertByUrl}}) }> + + + + ) +} + const PageBullets = observer(props => { + const { t } = useTranslation(); + const _t = t('View.Edit', {returnObjects: true}); + const storeTextSettings = props.storeTextSettings; const typeBullets = storeTextSettings.typeBullets; const bulletArrays = [ - {id: `id-markers-0`, type: 0, subtype: -1, drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'} }, - {id: `id-markers-1`, type: 0, subtype: 1, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7), specialFont: 'Symbol'} }, - {id: `id-markers-2`, type: 0, subtype: 2, drawdata: {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'} }, - {id: `id-markers-3`, type: 0, subtype: 3, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'} }, - {id: `id-markers-4`, type: 0, subtype: 4, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'} }, - {id: `id-markers-5`, type: 0, subtype: 5, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'} }, - {id: `id-markers-6`, type: 0, subtype: 6, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'} }, - {id: `id-markers-7`, type: 0, subtype: 7, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'} } + {id: 'id-markers-0', type: 0, subtype: -1, drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'} }, + {id: 'id-markers-1', type: 0, subtype: 1, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00B7), specialFont: 'Symbol'} }, + {id: 'id-markers-2', type: 0, subtype: 2, drawdata: {type: Asc.asc_PreviewBulletType.char, char: 'o', specialFont: 'Courier New'} }, + {id: 'id-markers-3', type: 0, subtype: 3, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A7), specialFont: 'Wingdings'} }, + {id: 'id-markers-4', type: 0, subtype: 4, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x0076), specialFont: 'Wingdings'} }, + {id: 'id-markers-5', type: 0, subtype: 5, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00D8), specialFont: 'Wingdings'} }, + {id: 'id-markers-6', type: 0, subtype: 6, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00FC), specialFont: 'Wingdings'} }, + {id: 'id-markers-7', type: 0, subtype: 7, drawdata: {type: Asc.asc_PreviewBulletType.char, char: String.fromCharCode(0x00A8), specialFont: 'Symbol'} } ]; useEffect(() => { @@ -539,6 +592,13 @@ const PageBullets = observer(props => {
))} + { !Device.isPhone && + + } ) }); @@ -547,14 +607,14 @@ const PageNumbers = observer(props => { const storeTextSettings = props.storeTextSettings; const typeNumbers = storeTextSettings.typeNumbers; const numberArrays = [ - {id: `id-numbers-0`, type: 1, subtype: -1, drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}}, - {id: `id-numbers-4`, type: 1, subtype: 4, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperLetterDot_Left}}, - {id: `id-numbers-5`, type: 1, subtype: 5, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterBracket_Left}}, - {id: `id-numbers-6`, type: 1, subtype: 6, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterDot_Left}}, - {id: `id-numbers-1`, type: 1, subtype: 1, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalDot_Right}}, - {id: `id-numbers-2`, type: 1, subtype: 2, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalBracket_Right}}, - {id: `id-numbers-3`, type: 1, subtype: 3, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperRomanDot_Right}}, - {id: `id-numbers-7`, type: 1, subtype: 7, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerRomanDot_Right}} + {id: 'id-numbers-0', type: 1, subtype: -1, drawdata: {type: Asc.asc_PreviewBulletType.text, text: 'None'}}, + {id: 'id-numbers-4', type: 1, subtype: 4, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperLetterDot_Left}}, + {id: 'id-numbers-5', type: 1, subtype: 5, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterBracket_Left}}, + {id: 'id-numbers-6', type: 1, subtype: 6, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerLetterDot_Left}}, + {id: 'id-numbers-1', type: 1, subtype: 1, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalDot_Right}}, + {id: 'id-numbers-2', type: 1, subtype: 2, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.DecimalBracket_Right}}, + {id: 'id-numbers-3', type: 1, subtype: 3, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.UpperRomanDot_Right}}, + {id: 'id-numbers-7', type: 1, subtype: 7, drawdata: {type: Asc.asc_PreviewBulletType.number, numberingType: Asc.asc_oAscNumberingLevel.LowerRomanDot_Right}} ]; useEffect(() => { @@ -570,25 +630,20 @@ const PageNumbers = observer(props => { return ( - {numberArrays.map((numbers, index) => ( - - {numbers.map((number) => ( - { - storeTextSettings.resetNumbers(number.type); - props.onNumber(number.type); - }}> - {number.thumb.length < 1 ? - - - : - - } - + + {numberArrays.map((number, index) => ( + { + storeTextSettings.resetNumbers(number.subtype); + props.onNumber(number.subtype); + }}> +
+ +
+
))} -
- ))} +
); }); @@ -627,8 +682,19 @@ const PageBulletsAndNumbers = props => { storeTextSettings={storeTextSettings} onBullet={props.onBullet} getIconsBulletsAndNumbers={props.getIconsBulletsAndNumbers} + onImageSelect={props.onImageSelect} + onInsertByUrl={props.onInsertByUrl} /> + { Device.phone && + + + + } ) @@ -678,6 +744,7 @@ const PageTextCustomFontColor = inject("storeTextSettings", "storePalette")(obse const PageTextAddFormatting = inject("storeTextSettings", "storeFocusObjects")(observer(PageAdditionalFormatting)); const PageTextBulletsAndNumbers = inject("storeTextSettings", "storeFocusObjects")(observer(PageBulletsAndNumbers)); const PageTextLineSpacing = inject("storeTextSettings", "storeFocusObjects")(observer(PageLineSpacing)); +const PageTextBulletsLinkSettings = inject("storeTextSettings", "storeFocusObjects")(observer(PageBulletLinkSettings)); export { EditTextContainer as EditText, @@ -687,5 +754,6 @@ export { PageTextCustomFontColor, PageTextAddFormatting, PageTextBulletsAndNumbers, - PageTextLineSpacing + PageTextLineSpacing, + PageTextBulletsLinkSettings }; \ No newline at end of file