[SE mobile] Add editing of image
This commit is contained in:
parent
e9c73ce811
commit
ef7fc59735
|
@ -126,7 +126,7 @@ require([
|
||||||
,'EditCell'
|
,'EditCell'
|
||||||
// ,'EditParagraph'
|
// ,'EditParagraph'
|
||||||
// ,'EditTable'
|
// ,'EditTable'
|
||||||
// ,'EditImage'
|
,'EditImage'
|
||||||
,'EditShape'
|
,'EditShape'
|
||||||
,'EditChart'
|
,'EditChart'
|
||||||
// ,'EditHyperlink'
|
// ,'EditHyperlink'
|
||||||
|
@ -197,7 +197,7 @@ require([
|
||||||
,'spreadsheeteditor/mobile/app/controller/edit/EditCell'
|
,'spreadsheeteditor/mobile/app/controller/edit/EditCell'
|
||||||
// ,'spreadsheeteditor/mobile/app/controller/edit/EditParagraph'
|
// ,'spreadsheeteditor/mobile/app/controller/edit/EditParagraph'
|
||||||
// ,'spreadsheeteditor/mobile/app/controller/edit/EditTable'
|
// ,'spreadsheeteditor/mobile/app/controller/edit/EditTable'
|
||||||
// ,'spreadsheeteditor/mobile/app/controller/edit/EditImage'
|
,'spreadsheeteditor/mobile/app/controller/edit/EditImage'
|
||||||
,'spreadsheeteditor/mobile/app/controller/edit/EditShape'
|
,'spreadsheeteditor/mobile/app/controller/edit/EditShape'
|
||||||
,'spreadsheeteditor/mobile/app/controller/edit/EditChart'
|
,'spreadsheeteditor/mobile/app/controller/edit/EditChart'
|
||||||
// ,'spreadsheeteditor/mobile/app/controller/edit/EditHyperlink'
|
// ,'spreadsheeteditor/mobile/app/controller/edit/EditHyperlink'
|
||||||
|
|
|
@ -249,7 +249,6 @@ define([
|
||||||
this.notcriticalErrorTitle,
|
this.notcriticalErrorTitle,
|
||||||
function () {
|
function () {
|
||||||
me._state.lostEditingRights = false;
|
me._state.lostEditingRights = false;
|
||||||
me.onEditComplete();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -299,11 +298,12 @@ define([
|
||||||
me._state.timerSave = setInterval(function(){
|
me._state.timerSave = setInterval(function(){
|
||||||
if ((new Date()) - me._state.isSaving>500) {
|
if ((new Date()) - me._state.isSaving>500) {
|
||||||
clearInterval(me._state.timerSave);
|
clearInterval(me._state.timerSave);
|
||||||
|
// console.debug('End long action');
|
||||||
me._state.timerSave = undefined;
|
me._state.timerSave = undefined;
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
} else {
|
} else {
|
||||||
console.debug('End long action');
|
// console.debug('End long action');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ define([
|
||||||
} else {
|
} else {
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
me.api.asc_setAutoSaveGap(value);
|
// me.api.asc_setAutoSaveGap(value);
|
||||||
|
|
||||||
if (me.needToUpdateVersion) {
|
if (me.needToUpdateVersion) {
|
||||||
Common.NotificationCenter.trigger('api:disconnect');
|
Common.NotificationCenter.trigger('api:disconnect');
|
||||||
|
@ -985,7 +985,6 @@ define([
|
||||||
(this.appOptions.canDownload) ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : this.api.asc_DownloadOrigin();
|
(this.appOptions.canDownload) ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : this.api.asc_DownloadOrigin();
|
||||||
}
|
}
|
||||||
this._state.lostEditingRights = false;
|
this._state.lostEditingRights = false;
|
||||||
this.onEditComplete();
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
268
apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js
Normal file
268
apps/spreadsheeteditor/mobile/app/controller/edit/EditImage.js
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System Limited 2010-2016
|
||||||
|
*
|
||||||
|
* This program is a free software product. You can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||||
|
* version 3 as published by the Free Software Foundation. In accordance with
|
||||||
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||||
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||||
|
* of any third-party rights.
|
||||||
|
*
|
||||||
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||||
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
*
|
||||||
|
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||||
|
* EU, LV-1021.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of the Program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU AGPL version 3.
|
||||||
|
*
|
||||||
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||||
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||||
|
* grant you any rights under trademark law for use of our trademarks.
|
||||||
|
*
|
||||||
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||||
|
* well as technical writing content are licensed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||||
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EditImage.js
|
||||||
|
* Document Editor
|
||||||
|
*
|
||||||
|
* Created by Alexander Yuzhin on 11/3/16
|
||||||
|
* Copyright (c) 2016 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'core',
|
||||||
|
'spreadsheeteditor/mobile/app/view/edit/EditImage',
|
||||||
|
'jquery',
|
||||||
|
'underscore',
|
||||||
|
'backbone'
|
||||||
|
], function (core, view, $, _, Backbone) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
SSE.Controllers.EditImage = Backbone.Controller.extend(_.extend((function() {
|
||||||
|
// Private
|
||||||
|
var _stack = [],
|
||||||
|
_imageObject = undefined,
|
||||||
|
_isEdit = false;
|
||||||
|
|
||||||
|
return {
|
||||||
|
models: [],
|
||||||
|
collections: [],
|
||||||
|
views: [
|
||||||
|
'EditImage'
|
||||||
|
],
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
||||||
|
|
||||||
|
this.addListeners({
|
||||||
|
'EditImage': {
|
||||||
|
'page:show': this.onPageShow
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
setApi: function (api) {
|
||||||
|
var me = this;
|
||||||
|
me.api = api;
|
||||||
|
|
||||||
|
me.api.asc_registerCallback('asc_onSelectionChanged', _.bind(me.onApiSelectionChanged, me));
|
||||||
|
me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onApiFocusObject, me));
|
||||||
|
},
|
||||||
|
|
||||||
|
setMode: function (mode) {
|
||||||
|
_isEdit = ('edit' === mode);
|
||||||
|
},
|
||||||
|
|
||||||
|
onPageShow: function (view, pageId) {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
me.initSettings(pageId);
|
||||||
|
},
|
||||||
|
|
||||||
|
onLaunch: function () {
|
||||||
|
this.createView('EditImage').render();
|
||||||
|
},
|
||||||
|
|
||||||
|
initEvents: function () {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
me.initSettings();
|
||||||
|
},
|
||||||
|
|
||||||
|
initSettings: function (pageId) {
|
||||||
|
if ($('#edit-image').length < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
if ('#edit-image-replace-view' == pageId) {
|
||||||
|
me.initReplacePage();
|
||||||
|
} else if ('#edit-image-reorder-view' == pageId) {
|
||||||
|
me.initReorderPage();
|
||||||
|
} else if ('#edit-image-url-view' == pageId) {
|
||||||
|
me.initLinkPage();
|
||||||
|
} else {
|
||||||
|
me.initRootPage();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initRootPage: function () {
|
||||||
|
$('#image-default').single('click', _.bind(this.onDefaultSize, this));
|
||||||
|
$('#image-remove').single('click', _.bind(this.onRemoveImage, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
initReplacePage: function () {
|
||||||
|
$('#edit-image-file').single('click', _.bind(this.onReplaceByFile, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
initReorderPage: function () {
|
||||||
|
$('.page[data-page=edit-image-reorder-view] a.item-link').single('click', _.bind(this.onReorder, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
initLinkPage: function () {
|
||||||
|
$('.edit-image-url-link .button, .edit-image-url-link .list-button').single('click', _.bind(this.onReplaceByUrl, this));
|
||||||
|
|
||||||
|
$('.edit-image-url-link input[type=url]').single('input', _.bind(function(e) {
|
||||||
|
$('.edit-image-url-link .buttons').toggleClass('disabled', _.isEmpty($(e.currentTarget).val()));
|
||||||
|
}, this));
|
||||||
|
|
||||||
|
_.delay(function () {
|
||||||
|
$('.edit-image-url-link input[type=url]').focus();
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
getImage: function () {
|
||||||
|
return _imageObject;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Handlers
|
||||||
|
|
||||||
|
onDefaultSize: function () {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
if (me.api) {
|
||||||
|
var imgSize = me.api.asc_getOriginalImageSize(),
|
||||||
|
properties = new Asc.asc_CImgProperty();
|
||||||
|
|
||||||
|
properties.put_Width(imgSize.get_ImageWidth());
|
||||||
|
properties.put_Height(imgSize.get_ImageHeight());
|
||||||
|
|
||||||
|
me.api.asc_setGraphicObjectProps(properties);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onRemoveImage: function () {
|
||||||
|
this.api.asc_Remove();
|
||||||
|
SSE.getController('EditContainer').hideModal();
|
||||||
|
},
|
||||||
|
|
||||||
|
onReplaceByFile: function () {
|
||||||
|
this.api.asc_changeImageFromFile();
|
||||||
|
SSE.getController('EditContainer').hideModal();
|
||||||
|
},
|
||||||
|
|
||||||
|
onReplaceByUrl: function () {
|
||||||
|
var me = this,
|
||||||
|
$input = $('.edit-image-url-link input[type=url]');
|
||||||
|
|
||||||
|
if ($input) {
|
||||||
|
var value = ($input.val()).replace(/ /g, '');
|
||||||
|
|
||||||
|
if (!_.isEmpty(value)) {
|
||||||
|
if ((/((^https?)|(^ftp)):\/\/.+/i.test(value))) {
|
||||||
|
SSE.getController('EditContainer').hideModal();
|
||||||
|
_.defer(function () {
|
||||||
|
var image = new Asc.asc_CImgProperty();
|
||||||
|
image.asc_putImageUrl(value);
|
||||||
|
me.api.asc_setGraphicObjectProps(image);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uiApp.alert(me.txtNotUrl);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uiApp.alert(me.textEmptyImgUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onReorder: function (e) {
|
||||||
|
var $target = $(e.currentTarget),
|
||||||
|
type = $target.data('type'),
|
||||||
|
ascType;
|
||||||
|
|
||||||
|
if (type == 'all-up') {
|
||||||
|
ascType = Asc.c_oAscDrawingLayerType.BringToFront;
|
||||||
|
} else if (type == 'all-down') {
|
||||||
|
ascType = Asc.c_oAscDrawingLayerType.SendToBack;
|
||||||
|
} else if (type == 'move-up') {
|
||||||
|
ascType = Asc.c_oAscDrawingLayerType.BringForward;
|
||||||
|
} else {
|
||||||
|
ascType = Asc.c_oAscDrawingLayerType.SendBackward;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.api.asc_setSelectedDrawingObjectLayer(ascType);
|
||||||
|
},
|
||||||
|
|
||||||
|
// API handlers
|
||||||
|
|
||||||
|
onApiSelectionChanged: function(info) {
|
||||||
|
if (!_isEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var me = this,
|
||||||
|
selectedObjects = [],
|
||||||
|
selectType = info.asc_getFlags().asc_getSelectionType();
|
||||||
|
|
||||||
|
if (selectType == Asc.c_oAscSelectionType.RangeImage) {
|
||||||
|
selectedObjects = me.api.asc_getGraphicObjectProps();
|
||||||
|
}
|
||||||
|
|
||||||
|
me.onApiFocusObject(selectedObjects);
|
||||||
|
},
|
||||||
|
|
||||||
|
onApiFocusObject: function (objects) {
|
||||||
|
_stack = objects;
|
||||||
|
|
||||||
|
if (!_isEdit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var images = [];
|
||||||
|
|
||||||
|
_.each(_stack, function (object) {
|
||||||
|
if (object.get_ObjectType() == Asc.c_oAscTypeSelectElement.Image) {
|
||||||
|
images.push(object.get_ObjectValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var getTopObject = function(array) {
|
||||||
|
if (array.length > 0) {
|
||||||
|
return array[array.length - 1]; // get top
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_imageObject = getTopObject(images);
|
||||||
|
},
|
||||||
|
|
||||||
|
textEmptyImgUrl: 'You need to specify image URL.',
|
||||||
|
txtNotUrl: 'This field should be a URL in the format \"http://www.example.com\"'
|
||||||
|
}
|
||||||
|
})(), SSE.Controllers.EditImage || {}))
|
||||||
|
});
|
|
@ -3,28 +3,19 @@
|
||||||
<div class="list-block">
|
<div class="list-block">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a id="image-wrap" class="item-link">
|
<a id="image-replace" class="item-link" data-page="#edit-image-replace-view">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Wrap</div>
|
<div class="item-title"><%= scope.textReplace %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="image-replace" class="item-link">
|
<a id="image-reorder" class="item-link" data-page="#edit-image-reorder-view">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Replace</div>
|
<div class="item-title"><%= scope.textReorder %></div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a id="image-reorder" class="item-link">
|
|
||||||
<div class="item-content">
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Reorder</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -35,16 +26,16 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<% if (android) { %>
|
<% if (android) { %>
|
||||||
<a id="image-default" class="button button-raised button-fill" style="margin: 20px 16px;">Default Size</a>
|
<a id="image-default" class="button button-raised button-fill" style="margin: 20px 16px;"><%= scope.textDefault %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a id="image-default" class="item-link list-button" style="text-align: center;">Default Size</a>
|
<a id="image-default" class="item-link list-button" style="text-align: center;"><%= scope.textDefault %></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<% if (android) { %>
|
<% if (android) { %>
|
||||||
<a id="image-default" class="button button-raised button-fill" style="margin: 20px 16px; background-color: #f44336;">Remove Image</a>
|
<a id="image-default" class="button button-raised button-fill" style="margin: 20px 16px; background-color: #f44336;"><%= scope.textRemove %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a id="image-remove" class="item-link list-button" style="text-align: center; color: #f00">Remove Image</a>
|
<a id="image-remove" class="item-link list-button" style="text-align: center; color: #f00"><%= scope.textRemove %></a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -55,21 +46,21 @@
|
||||||
<div id="edit-image-reorder-view">
|
<div id="edit-image-reorder-view">
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span>Back</span><% } %></a></div>
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
<div class="center sliding">Reorder</div>
|
<div class="center sliding"><%= scope.textReorder %></div>
|
||||||
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page image-reorder">
|
<div class="page image-reorder" data-page="edit-image-reorder-view">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="list-block">
|
<div class="list-block">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a data-type="all-up" class="item-link no-indicator">
|
<a data-type="all-up" class="item-link no-indicator">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
<div class="item-media"><i class="icon icon-move-foreground"></i></div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Bring to Foreground</div>
|
<div class="item-title"><%= scope.textToForeground %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -77,9 +68,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a data-type="all-down" class="item-link no-indicator">
|
<a data-type="all-down" class="item-link no-indicator">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
<div class="item-media"><i class="icon icon-move-background"></i></div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Send to Background</div>
|
<div class="item-title"><%= scope.textToBackground %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -87,9 +78,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a data-type="move-up" class="item-link no-indicator">
|
<a data-type="move-up" class="item-link no-indicator">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
<div class="item-media"><i class="icon icon-move-forward"></i></div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Move Forward</div>
|
<div class="item-title"><%= scope.textForward %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -97,9 +88,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a data-type="move-down" class="item-link no-indicator">
|
<a data-type="move-down" class="item-link no-indicator">
|
||||||
<div data-type="move-down" class="item-content">
|
<div data-type="move-down" class="item-content">
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
<div class="item-media"><i class="icon icon-move-backward"></i></div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Move Backward</div>
|
<div class="item-title"><%= scope.textBackward %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -110,212 +101,39 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Wrap view -->
|
|
||||||
<div id="edit-image-wrap-view">
|
|
||||||
<div class="navbar">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span>Back</span><% } %></a></div>
|
|
||||||
<div class="center sliding">Wrap</div>
|
|
||||||
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="page image-wrap">
|
|
||||||
<div class="page-content">
|
|
||||||
<div class="list-block image-wrap-types">
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="inline">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Inline</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="square">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Square</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="tight">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Tight</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="through">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Through</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="top-bottom">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Top and Bottom</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="infront">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">In Front</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label class="label-radio item-content">
|
|
||||||
<input type="radio" name="image-wrap" value="behind">
|
|
||||||
<% if (android) { %>
|
|
||||||
<div class="item-media"><i class="icon icon-form-radio"></i></div>
|
|
||||||
<% } else { %>
|
|
||||||
<div class="item-media"><i class="icon icon-search"></i></div>
|
|
||||||
<% } %>
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Behind</div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="content-block-title align">Align</div>
|
|
||||||
<div class="list-block align">
|
|
||||||
<ul>
|
|
||||||
<li id="edit-image-align">
|
|
||||||
<div class="item-content buttons">
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="row">
|
|
||||||
<a data-type="left" class="button no-ripple"><i class="icon icon-text-align-left"></i></a>
|
|
||||||
<a data-type="center" class="button no-ripple"><i class="icon icon-text-align-center"></i></a>
|
|
||||||
<a data-type="right" class="button no-ripple"><i class="icon icon-text-align-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="list-block inline">
|
|
||||||
<ul>
|
|
||||||
<li id="edit-image-movetext">
|
|
||||||
<div class="item-content">
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Move with Text</div>
|
|
||||||
<div class="item-after">
|
|
||||||
<label class="label-switch">
|
|
||||||
<input type="checkbox">
|
|
||||||
<div class="checkbox"></div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li id="edit-image-overlap">
|
|
||||||
<div class="item-content">
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-title">Allow Overlap</div>
|
|
||||||
<div class="item-after">
|
|
||||||
<label class="label-switch">
|
|
||||||
<input type="checkbox">
|
|
||||||
<div class="checkbox"></div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="content-block-title distance">Distance from text</div>
|
|
||||||
<div class="list-block distance" style="margin-bottom: 40px;">
|
|
||||||
<ul>
|
|
||||||
<li id="table-distance">
|
|
||||||
<div class="item-content">
|
|
||||||
<div class="item-inner">
|
|
||||||
<div class="item-input">
|
|
||||||
<div class="range-slider">
|
|
||||||
<input type="range" min="0" max="200" value="0" step="1">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="item-after value">0 pt</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Replace view -->
|
<!-- Replace view -->
|
||||||
<div id="edit-image-replace-view">
|
<div id="edit-image-replace-view">
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span>Back</span><% } %></a></div>
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
<div class="center sliding">Replace</div>
|
<div class="center sliding"><%= scope.textReplace %></div>
|
||||||
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page">
|
<div class="page" data-page="edit-image-replace-view">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="list-block">
|
<div class="list-block">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a id="edit-image-file" class="item-link no-indicator">
|
<a id="edit-image-file" class="item-link no-indicator no-fastclick">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-media">
|
<div class="item-media">
|
||||||
<i class="icon icon-search"></i>
|
<i class="icon icon-image-library"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Picture from Library</div>
|
<div class="item-title"><%= scope.textFromLibrary %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="edit-image-url" class="item-link">
|
<a id="edit-image-url" class="item-link" data-page="#edit-image-url-view">
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-media">
|
<div class="item-media">
|
||||||
<i class="icon icon-search"></i>
|
<i class="icon icon-link"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title">Picture from URL</div>
|
<div class="item-title"><%= scope.textFromURL %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -330,20 +148,20 @@
|
||||||
<div id="edit-image-url-view">
|
<div id="edit-image-url-view">
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span>Back</span><% } %></a></div>
|
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||||
<div class="center sliding">Link Settings</div>
|
<div class="center sliding"><%= scope.textLinkSettings %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="page edit-image-url-link">
|
<div class="page edit-image-url-link" data-page="edit-image-url-view">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="content-block-title">Address</div>
|
<div class="content-block-title"><%= scope.textAddress %></div>
|
||||||
<div class="list-block">
|
<div class="list-block">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-input">
|
<div class="item-input">
|
||||||
<input type="url" placeholder="Image URL">
|
<input type="url" placeholder="<%= scope.textImageURL %>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -352,11 +170,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="list-block disabled buttons">
|
<div class="list-block disabled buttons">
|
||||||
<% if (android) { %>
|
<% if (android) { %>
|
||||||
<a href="#" class="button button-fill button-raised" style="margin: 20px 16px;">Replace Image</a>
|
<a href="#" class="button button-fill button-raised" style="margin: 20px 16px;"><%= scope.textReplaceImg %></a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="list-button item-link">Replace Image</a>
|
<a href="#" class="list-button item-link"><%= scope.textReplaceImg %></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
163
apps/spreadsheeteditor/mobile/app/view/edit/EditImage.js
Normal file
163
apps/spreadsheeteditor/mobile/app/view/edit/EditImage.js
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System Limited 2010-2016
|
||||||
|
*
|
||||||
|
* This program is a free software product. You can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||||
|
* version 3 as published by the Free Software Foundation. In accordance with
|
||||||
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||||
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||||
|
* of any third-party rights.
|
||||||
|
*
|
||||||
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||||
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
*
|
||||||
|
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||||
|
* EU, LV-1021.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of the Program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU AGPL version 3.
|
||||||
|
*
|
||||||
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||||
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||||
|
* grant you any rights under trademark law for use of our trademarks.
|
||||||
|
*
|
||||||
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||||
|
* well as technical writing content are licensed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||||
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EditImage.js
|
||||||
|
* Spreadsheet Editor
|
||||||
|
*
|
||||||
|
* Created by Alexander Yuzhin on 12/19/16
|
||||||
|
* Copyright (c) 2016 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'text!spreadsheeteditor/mobile/app/template/EditImage.template',
|
||||||
|
'jquery',
|
||||||
|
'underscore',
|
||||||
|
'backbone'
|
||||||
|
], function (editTemplate, $, _, Backbone) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
SSE.Views.EditImage = Backbone.View.extend(_.extend((function() {
|
||||||
|
// private
|
||||||
|
|
||||||
|
return {
|
||||||
|
// el: '.view-main',
|
||||||
|
|
||||||
|
template: _.template(editTemplate),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
Common.NotificationCenter.on('editcontainer:show', _.bind(this.initEvents, this));
|
||||||
|
Common.NotificationCenter.on('editcategory:show', _.bind(this.categoryShow, this));
|
||||||
|
this.on('page:show', _.bind(this.updateItemHandlers, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
initEvents: function () {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
me.updateItemHandlers();
|
||||||
|
me.initControls();
|
||||||
|
},
|
||||||
|
|
||||||
|
categoryShow: function(e) {
|
||||||
|
// if ('edit-shape' == $(e.currentTarget).prop('id')) {
|
||||||
|
// this.initEvents();
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
// Render layout
|
||||||
|
render: function () {
|
||||||
|
this.layout = $('<div/>').append(this.template({
|
||||||
|
android : Common.SharedSettings.get('android'),
|
||||||
|
phone : Common.SharedSettings.get('phone'),
|
||||||
|
scope : this
|
||||||
|
}));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
rootLayout: function () {
|
||||||
|
if (this.layout) {
|
||||||
|
return this.layout
|
||||||
|
.find('#edit-image-root')
|
||||||
|
.html();
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
|
||||||
|
initControls: function () {
|
||||||
|
//
|
||||||
|
},
|
||||||
|
|
||||||
|
updateItemHandlers: function () {
|
||||||
|
if ($('#edit-image').length < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.container-edit a.item-link[data-page]').single('click', _.buffered(this.onItemClick, 100, this));
|
||||||
|
},
|
||||||
|
|
||||||
|
showPage: function (templateId, suspendEvent) {
|
||||||
|
var rootView = SSE.getController('EditContainer').rootView;
|
||||||
|
|
||||||
|
if (rootView && this.layout) {
|
||||||
|
var $content = this.layout.find(templateId);
|
||||||
|
|
||||||
|
// Android fix for navigation
|
||||||
|
if (Framework7.prototype.device.android) {
|
||||||
|
$content.find('.page').append($content.find('.navbar'));
|
||||||
|
}
|
||||||
|
|
||||||
|
rootView.router.load({
|
||||||
|
content: $content.html()
|
||||||
|
});
|
||||||
|
|
||||||
|
if (suspendEvent !== true) {
|
||||||
|
this.fireEvent('page:show', [this, templateId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initEvents();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onItemClick: function (e) {
|
||||||
|
var $target = $(e.currentTarget),
|
||||||
|
page = $target.data('page');
|
||||||
|
|
||||||
|
if (page && page.length > 0 ) {
|
||||||
|
this.showPage(page);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
textReplace: 'Replace',
|
||||||
|
textReorder: 'Reorder',
|
||||||
|
textDefault: 'Default Size',
|
||||||
|
textRemove: 'Remove Image',
|
||||||
|
textBack: 'Back',
|
||||||
|
textToForeground: 'Bring to Foreground',
|
||||||
|
textToBackground: 'Send to Background',
|
||||||
|
textForward: 'Move Forward',
|
||||||
|
textBackward: 'Move Backward',
|
||||||
|
textFromLibrary: 'Picture from Library',
|
||||||
|
textFromURL: 'Picture from URL',
|
||||||
|
textLinkSettings: 'Link Settings',
|
||||||
|
textAddress: 'Address',
|
||||||
|
textImageURL: 'Image URL',
|
||||||
|
textReplaceImg: 'Replace Image'
|
||||||
|
}
|
||||||
|
})(), SSE.Views.EditImage || {}))
|
||||||
|
});
|
Loading…
Reference in a new issue