From 94be7f94583b9c266694be7f9b623deae980e1d3 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 9 Jul 2019 11:49:41 +0300 Subject: [PATCH 1/4] [DE mobile] [SSE mobile] [PE mobile] Fix Bug 33999 --- .../mobile/app/controller/DocumentHolder.js | 48 ++++++++------- .../mobile/app/view/DocumentHolder.js | 11 +++- .../mobile/resources/css/app-ios.css | 15 +++++ .../mobile/resources/css/app-material.css | 15 +++++ .../mobile/resources/less/ios/_icons.less | 15 +++++ .../resources/less/material/_icons.less | 15 +++++ .../mobile/app/controller/DocumentHolder.js | 38 +++++++----- .../mobile/app/view/DocumentHolder.js | 11 +++- .../mobile/resources/css/app-ios.css | 15 +++++ .../mobile/resources/css/app-material.css | 15 +++++ .../mobile/resources/less/ios/_icons.less | 15 +++++ .../resources/less/material/_icons.less | 15 +++++ .../mobile/app/controller/DocumentHolder.js | 58 +++++++++++-------- .../mobile/app/view/DocumentHolder.js | 11 +++- .../mobile/resources/css/app-ios.css | 15 +++++ .../mobile/resources/css/app-material.css | 15 +++++ .../mobile/resources/less/ios/_icons.less | 15 +++++ .../resources/less/material/_icons.less | 15 +++++ 18 files changed, 286 insertions(+), 71 deletions(-) diff --git a/apps/documenteditor/mobile/app/controller/DocumentHolder.js b/apps/documenteditor/mobile/app/controller/DocumentHolder.js index cc5a81647..bff7031dc 100644 --- a/apps/documenteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/controller/DocumentHolder.js @@ -379,15 +379,17 @@ define([ _initMenu: function (stack) { var me = this, - menuItems = [], + arrItems = [], + arrItemsIcon = [], canCopy = me.api.can_CopyCut(); _actionSheets = []; if (canCopy) { - menuItems.push({ + arrItemsIcon.push({ caption: me.menuCopy, - event: 'copy' + event: 'copy', + icon: 'icon-copy' }); } @@ -438,59 +440,61 @@ define([ if (_isEdit && !me.isDisconnected) { if (!lockedText && !lockedTable && !lockedImage && !lockedHeader && canCopy) { - menuItems.push({ + arrItemsIcon.push({ caption: me.menuCut, - event: 'cut' + event: 'cut', + icon: 'icon-cut' }); // Swap 'Copy' and 'Cut' - swapItems(menuItems, 0, 1); + swapItems(arrItemsIcon, 0, 1); } if (!lockedText && !lockedTable && !lockedImage && !lockedHeader) { - menuItems.push({ + arrItemsIcon.push({ caption: me.menuPaste, - event: 'paste' + event: 'paste', + icon: 'icon-paste' }); } if(isTable && me.api.CheckBeforeMergeCells() && !lockedTable && !lockedHeader) { - menuItems.push({ + arrItems.push({ caption: me.menuMerge, event: 'merge' }); } if(isTable && me.api.CheckBeforeSplitCells() && !lockedTable && !lockedHeader) { - menuItems.push({ + arrItems.push({ caption: me.menuSplit, event: 'split' }); } if(!lockedText && !lockedTable && !lockedImage && !lockedHeader) { - menuItems.push({ + arrItems.push({ caption: me.menuDelete, event: 'delete' }); } if(isTable && !lockedTable && !lockedText && !lockedHeader) { - menuItems.push({ + arrItems.push({ caption: me.menuDeleteTable, event: 'deletetable' }); } if(!lockedText && !lockedTable && !lockedImage && !lockedHeader){ - menuItems.push({ + arrItems.push({ caption: me.menuEdit, event: 'edit' }); } if (!_.isEmpty(me.api.can_AddHyperlink()) && !lockedHeader) { - menuItems.push({ + arrItems.push({ caption: me.menuAddLink, event: 'addlink' }); @@ -498,12 +502,12 @@ define([ if (_canReview) { if (_inRevisionChange) { - menuItems.push({ + arrItems.push({ caption: me.menuReviewChange, event: 'reviewchange' }); } else { - menuItems.push({ + arrItems.push({ caption: me.menuReview, event: 'review' }); @@ -513,22 +517,24 @@ define([ } if (isLink) { - menuItems.push({ + arrItems.push({ caption: me.menuOpenLink, event: 'openlink' }); } - if (Common.SharedSettings.get('phone') && menuItems.length > 3) { - _actionSheets = menuItems.slice(3); + if (Common.SharedSettings.get('phone') && arrItems.length > 2) { + _actionSheets = arrItems.slice(2); - menuItems = menuItems.slice(0, 3); - menuItems.push({ + arrItems = arrItems.slice(0, 2); + arrItems.push({ caption: me.menuMore, event: 'showActionSheet' }); } + var menuItems = {itemsIcon: arrItemsIcon, items: arrItems}; + return menuItems; }, diff --git a/apps/documenteditor/mobile/app/view/DocumentHolder.js b/apps/documenteditor/mobile/app/view/DocumentHolder.js index b842f656b..c9637f358 100644 --- a/apps/documenteditor/mobile/app/view/DocumentHolder.js +++ b/apps/documenteditor/mobile/app/view/DocumentHolder.js @@ -82,9 +82,14 @@ define([ } var menuItemTemplate = _.template([ - '<% _.each(menuItems, function(item) { %>', - '
  • <%= item.caption %>
  • ', - '<% }); %>' + '<% if(menuItems.itemsIcon) {%>', + '<% _.each(menuItems.itemsIcon, function(item) { %>', + '
  • ', + '<% }); }%>', + '<% if(menuItems.items) {%>', + '<% _.each(menuItems.items, function(item) { %>', + '
  • <%= item.caption %>
  • ', + '<% }); }%>' ].join('')); $('#' + _anchorId) diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index e5fc9e44f..5f8bc366d 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -6859,6 +6859,21 @@ i.icon.icon-footnote { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M22%208.11133H20.9177V5.15361L20.9282%204.66765L20.9457%204.13624C20.7659%204.31571%2020.641%204.43341%2020.5709%204.48935L19.9825%204.96132L19.4606%204.31105L21.1103%203H22V8.11133Z%22%20fill%3D%22%23446995%22%2F%3E%3Cpath%20d%3D%22M10.3363%2018.8514L8.98161%2015.3968H4.61996L3.28021%2018.8514H2L6.3021%207.94526H7.36646L11.6462%2018.8514H10.3363ZM8.58713%2014.2601L7.3218%2010.8947C7.15806%2010.4687%206.98935%209.94621%206.81567%209.32711C6.70651%209.80258%206.5502%2010.3251%206.34676%2010.8947L5.06655%2014.2601H8.58713Z%22%20fill%3D%22%23446995%22%2F%3E%3Cpath%20d%3D%22M16.1425%2010.5752C17.2143%2010.5752%2018.0454%2010.9417%2018.6359%2011.6748C19.2313%2012.4028%2019.5291%2013.4355%2019.5291%2014.7728C19.5291%2016.11%2019.2288%2017.1501%2018.6284%2017.893C18.033%2018.631%2017.2043%2019%2016.1425%2019C15.6115%2019%2015.1252%2018.9034%2014.6836%2018.7103C14.2469%2018.5121%2013.8798%2018.21%2013.582%2017.8039H13.4927L13.2322%2018.8514H12.3465V7.29149H13.582V10.0997C13.582%2010.7288%2013.5622%2011.2934%2013.5225%2011.7936H13.582C14.1576%2010.9814%2015.0111%2010.5752%2016.1425%2010.5752ZM15.9638%2011.6079C15.1203%2011.6079%2014.5124%2011.8506%2014.1403%2012.336C13.7681%2012.8164%2013.582%2013.6286%2013.582%2014.7728C13.582%2015.9169%2013.7731%2016.7366%2014.1551%2017.2318C14.5372%2017.7222%2015.15%2017.9673%2015.9936%2017.9673C16.7528%2017.9673%2017.3185%2017.6925%2017.6906%2017.1427C18.0628%2016.588%2018.2488%2015.793%2018.2488%2014.7579C18.2488%2013.698%2018.0628%2012.908%2017.6906%2012.388C17.3185%2011.8679%2016.7429%2011.6079%2015.9638%2011.6079Z%22%20fill%3D%22%23446995%22%2F%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22white%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} .label-switch input[type="checkbox"]:checked + .checkbox { background: #446995; } diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index aaa58ba90..d1aabb74d 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -6339,6 +6339,21 @@ i.icon.icon-footnote { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M22%208.11133H20.9177V5.15361L20.9282%204.66765L20.9457%204.13624C20.7659%204.31571%2020.641%204.43341%2020.5709%204.48935L19.9825%204.96132L19.4606%204.31105L21.1103%203H22V8.11133Z%22%20fill%3D%22%23446995%22%2F%3E%3Cpath%20d%3D%22M10.3363%2018.8514L8.98161%2015.3968H4.61996L3.28021%2018.8514H2L6.3021%207.94526H7.36646L11.6462%2018.8514H10.3363ZM8.58713%2014.2601L7.3218%2010.8947C7.15806%2010.4687%206.98935%209.94621%206.81567%209.32711C6.70651%209.80258%206.5502%2010.3251%206.34676%2010.8947L5.06655%2014.2601H8.58713Z%22%20fill%3D%22%23446995%22%2F%3E%3Cpath%20d%3D%22M16.1425%2010.5752C17.2143%2010.5752%2018.0454%2010.9417%2018.6359%2011.6748C19.2313%2012.4028%2019.5291%2013.4355%2019.5291%2014.7728C19.5291%2016.11%2019.2288%2017.1501%2018.6284%2017.893C18.033%2018.631%2017.2043%2019%2016.1425%2019C15.6115%2019%2015.1252%2018.9034%2014.6836%2018.7103C14.2469%2018.5121%2013.8798%2018.21%2013.582%2017.8039H13.4927L13.2322%2018.8514H12.3465V7.29149H13.582V10.0997C13.582%2010.7288%2013.5622%2011.2934%2013.5225%2011.7936H13.582C14.1576%2010.9814%2015.0111%2010.5752%2016.1425%2010.5752ZM15.9638%2011.6079C15.1203%2011.6079%2014.5124%2011.8506%2014.1403%2012.336C13.7681%2012.8164%2013.582%2013.6286%2013.582%2014.7728C13.582%2015.9169%2013.7731%2016.7366%2014.1551%2017.2318C14.5372%2017.7222%2015.15%2017.9673%2015.9936%2017.9673C16.7528%2017.9673%2017.3185%2017.6925%2017.6906%2017.1427C18.0628%2016.588%2018.2488%2015.793%2018.2488%2014.7579C18.2488%2013.698%2018.0628%2012.908%2017.6906%2012.388C17.3185%2011.8679%2016.7429%2011.6079%2015.9638%2011.6079Z%22%20fill%3D%22%23446995%22%2F%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22black%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22black%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} .navbar i.icon.icon-undo { width: 22px; height: 22px; diff --git a/apps/documenteditor/mobile/resources/less/ios/_icons.less b/apps/documenteditor/mobile/resources/less/ios/_icons.less index 507610a60..03d035167 100644 --- a/apps/documenteditor/mobile/resources/less/ios/_icons.less +++ b/apps/documenteditor/mobile/resources/less/ios/_icons.less @@ -456,4 +456,19 @@ i.icon { height: 24px; .encoded-svg-background(''); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/resources/less/material/_icons.less b/apps/documenteditor/mobile/resources/less/material/_icons.less index b4db3fbfa..da3252478 100644 --- a/apps/documenteditor/mobile/resources/less/material/_icons.less +++ b/apps/documenteditor/mobile/resources/less/material/_icons.less @@ -383,6 +383,21 @@ i.icon { height: 24px; .encoded-svg-background(''); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } // Overwrite color for toolbar diff --git a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js index a40c6c814..1640f0e7e 100644 --- a/apps/presentationeditor/mobile/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/mobile/app/controller/DocumentHolder.js @@ -200,7 +200,8 @@ define([ _initMenu: function (stack) { var me = this, - menuItems = [], + arrItems = [], + arrItemsIcon = [], canCopy = me.api.can_CopyCut(); _actionSheets = []; @@ -237,9 +238,10 @@ define([ isObject = isText || isImage || isChart || isShape || isTable; if (canCopy && isObject) { - menuItems.push({ + arrItemsIcon.push({ caption: me.menuCopy, - event: 'copy' + event: 'copy', + icon: 'icon-copy' }); } @@ -257,33 +259,35 @@ define([ if (!objectLocked && _isEdit && !me.isDisconnected) { if (canCopy && isObject) { - menuItems.push({ + arrItemsIcon.push({ caption: me.menuCut, - event: 'cut' + event: 'cut', + icon: 'icon-cut' }); // Swap 'Copy' and 'Cut' - swapItems(menuItems, 0, 1); + swapItems(arrItemsIcon, 0, 1); } - menuItems.push({ + arrItemsIcon.push({ caption: me.menuPaste, - event: 'paste' + event: 'paste', + icon: 'icon-paste' }); if (isObject) - menuItems.push({ + arrItems.push({ caption: me.menuDelete, event: 'delete' }); - menuItems.push({ + arrItems.push({ caption: me.menuEdit, event: 'edit' }); if (!isLink && me.api.can_AddHyperlink()!==false) { - menuItems.push({ + arrItems.push({ caption: me.menuAddLink, event: 'addlink' }); @@ -292,22 +296,24 @@ define([ } if (isLink) { - menuItems.push({ + arrItems.push({ caption: me.menuOpenLink, event: 'openlink' }); } - if (Common.SharedSettings.get('phone') && menuItems.length > 3) { - _actionSheets = menuItems.slice(3); + if (Common.SharedSettings.get('phone') && arrItems.length > 2) { + _actionSheets = arrItems.slice(2); - menuItems = menuItems.slice(0, 3); - menuItems.push({ + arrItems = arrItems.slice(0, 2); + arrItems.push({ caption: me.menuMore, event: 'showActionSheet' }); } + var menuItems = {itemsIcon: arrItemsIcon, items: arrItems}; + return menuItems; }, diff --git a/apps/presentationeditor/mobile/app/view/DocumentHolder.js b/apps/presentationeditor/mobile/app/view/DocumentHolder.js index 19165f2a8..1145e070d 100644 --- a/apps/presentationeditor/mobile/app/view/DocumentHolder.js +++ b/apps/presentationeditor/mobile/app/view/DocumentHolder.js @@ -81,9 +81,14 @@ define([ } var menuItemTemplate = _.template([ - '<% _.each(menuItems, function(item) { %>', - '
  • <%= item.caption %>
  • ', - '<% }); %>' + '<% if(menuItems.itemsIcon) {%>', + '<% _.each(menuItems.itemsIcon, function(item) { %>', + '
  • ', + '<% }); }%>', + '<% if(menuItems.items) {%>', + '<% _.each(menuItems.items, function(item) { %>', + '
  • <%= item.caption %>
  • ', + '<% }); }%>' ].join('')); $('#' + _anchorId) diff --git a/apps/presentationeditor/mobile/resources/css/app-ios.css b/apps/presentationeditor/mobile/resources/css/app-ios.css index 2502178ff..793548ff6 100644 --- a/apps/presentationeditor/mobile/resources/css/app-ios.css +++ b/apps/presentationeditor/mobile/resources/css/app-ios.css @@ -6741,6 +6741,21 @@ i.icon.icon-app-settings { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M7%2014H16C18.2091%2014%2020%2015.7909%2020%2018C20%2020.2091%2018.2091%2022%2016%2022H7C4.79086%2022%203%2020.2091%203%2018C3%2015.7909%204.79086%2014%207%2014ZM16%2013C18.7614%2013%2021%2015.2386%2021%2018C21%2020.7614%2018.7614%2023%2016%2023H7C4.23858%2023%202%2020.7614%202%2018C2%2015.2386%204.23858%2013%207%2013H16Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16%2020C14.8954%2020%2014%2019.1046%2014%2018C14%2016.8954%2014.8954%2016%2016%2016C17.1046%2016%2018%2016.8954%2018%2018C18%2019.1046%2017.1046%2020%2016%2020ZM16%2021C14.3431%2021%2013%2019.6569%2013%2018C13%2016.3431%2014.3431%2015%2016%2015C17.6569%2015%2019%2016.3431%2019%2018C19%2019.6569%2017.6569%2021%2016%2021Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16%203H7C4.79086%203%203%204.79086%203%207C3%209.20914%204.79086%2011%207%2011H16C18.2091%2011%2020%209.20914%2020%207C20%204.79086%2018.2091%203%2016%203ZM7%202C4.23858%202%202%204.23858%202%207C2%209.76142%204.23858%2012%207%2012H16C18.7614%2012%2021%209.76142%2021%207C21%204.23858%2018.7614%202%2016%202H7Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M7%209C8.10457%209%209%208.10457%209%207C9%205.89543%208.10457%205%207%205C5.89543%205%205%205.89543%205%207C5%208.10457%205.89543%209%207%209ZM7%2010C8.65685%2010%2010%208.65685%2010%207C10%205.34315%208.65685%204%207%204C5.34315%204%204%205.34315%204%207C4%208.65685%205.34315%2010%207%2010Z%22%20fill%3D%22%23aa5252%22%2F%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22white%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} .label-switch input[type="checkbox"]:checked + .checkbox { background: #aa5252; } diff --git a/apps/presentationeditor/mobile/resources/css/app-material.css b/apps/presentationeditor/mobile/resources/css/app-material.css index 1ad0970e4..39ffc9763 100644 --- a/apps/presentationeditor/mobile/resources/css/app-material.css +++ b/apps/presentationeditor/mobile/resources/css/app-material.css @@ -6273,6 +6273,21 @@ i.icon.icon-app-settings { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M7%2014H16C18.2091%2014%2020%2015.7909%2020%2018C20%2020.2091%2018.2091%2022%2016%2022H7C4.79086%2022%203%2020.2091%203%2018C3%2015.7909%204.79086%2014%207%2014ZM16%2013C18.7614%2013%2021%2015.2386%2021%2018C21%2020.7614%2018.7614%2023%2016%2023H7C4.23858%2023%202%2020.7614%202%2018C2%2015.2386%204.23858%2013%207%2013H16Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16%2020C14.8954%2020%2014%2019.1046%2014%2018C14%2016.8954%2014.8954%2016%2016%2016C17.1046%2016%2018%2016.8954%2018%2018C18%2019.1046%2017.1046%2020%2016%2020ZM16%2021C14.3431%2021%2013%2019.6569%2013%2018C13%2016.3431%2014.3431%2015%2016%2015C17.6569%2015%2019%2016.3431%2019%2018C19%2019.6569%2017.6569%2021%2016%2021Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16%203H7C4.79086%203%203%204.79086%203%207C3%209.20914%204.79086%2011%207%2011H16C18.2091%2011%2020%209.20914%2020%207C20%204.79086%2018.2091%203%2016%203ZM7%202C4.23858%202%202%204.23858%202%207C2%209.76142%204.23858%2012%207%2012H16C18.7614%2012%2021%209.76142%2021%207C21%204.23858%2018.7614%202%2016%202H7Z%22%20fill%3D%22%23aa5252%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M7%209C8.10457%209%209%208.10457%209%207C9%205.89543%208.10457%205%207%205C5.89543%205%205%205.89543%205%207C5%208.10457%205.89543%209%207%209ZM7%2010C8.65685%2010%2010%208.65685%2010%207C10%205.34315%208.65685%204%207%204C5.34315%204%204%205.34315%204%207C4%208.65685%205.34315%2010%207%2010Z%22%20fill%3D%22%23aa5252%22%2F%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22black%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22black%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} .navbar i.icon.icon-undo { width: 22px; height: 22px; diff --git a/apps/presentationeditor/mobile/resources/less/ios/_icons.less b/apps/presentationeditor/mobile/resources/less/ios/_icons.less index 329c3dda4..f18b1a51d 100644 --- a/apps/presentationeditor/mobile/resources/less/ios/_icons.less +++ b/apps/presentationeditor/mobile/resources/less/ios/_icons.less @@ -410,4 +410,19 @@ i.icon { height: 24px; .encoded-svg-background(''); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/resources/less/material/_icons.less b/apps/presentationeditor/mobile/resources/less/material/_icons.less index b3da0d5df..c1727bc4f 100644 --- a/apps/presentationeditor/mobile/resources/less/material/_icons.less +++ b/apps/presentationeditor/mobile/resources/less/material/_icons.less @@ -380,6 +380,21 @@ i.icon { height: 24px; .encoded-svg-background(''); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } // Overwrite color for toolbar diff --git a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js index f015907e9..3caf8f9c2 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/controller/DocumentHolder.js @@ -209,9 +209,10 @@ define([ // Internal _initMenu: function (cellinfo) { - var me = this; - - _actionSheets = []; + var me = this, + _actionSheets = [], + arrItems = [], + arrItemsIcon = []; var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu; var iscelllocked = cellinfo.asc_getLocked(), @@ -240,38 +241,43 @@ define([ } if ( iscelllocked || this.api.isCellEdited ) { - menuItems = [{ + arrItemsIcon = [{ caption: me.menuCopy, - event: 'copy' + event: 'copy', + icon: 'icon-copy' }]; } else { - var menuItems = [{ + var arrItemsIcon = [{ caption: me.menuCut, - event: 'cut' + event: 'cut', + icon: 'icon-cut' },{ caption: me.menuCopy, - event: 'copy' + event: 'copy', + icon: 'icon-copy' },{ caption: me.menuPaste, - event: 'paste' - },{ - caption: me.menuDelete, - event: 'del' + event: 'paste', + icon: 'icon-paste' }]; + arrItems.push({ + caption: me.menuDelete, + event: 'del' + }); // isTableLocked = cellinfo.asc_getLockedTable()===true; if (isimagemenu || isshapemenu || ischartmenu || istextshapemenu || istextchartmenu ) { - menuItems.push({ + arrItems.push({ caption: me.menuEdit, event: 'edit' }); } else { if ( iscolmenu || isrowmenu) { - menuItems.push({ + arrItems.push({ caption: me.menuHide, event: 'hide' },{ @@ -281,24 +287,24 @@ define([ } else if ( iscellmenu ) { !iscelllocked && - menuItems.push({ + arrItems.push({ caption: me.menuCell, event: 'edit' }); (cellinfo.asc_getFlags().asc_getMerge() == Asc.c_oAscMergeOptions.None) && - menuItems.push({ + arrItems.push({ caption: me.menuMerge, event: 'merge' }); (cellinfo.asc_getFlags().asc_getMerge() == Asc.c_oAscMergeOptions.Merge) && - menuItems.push({ + arrItems.push({ caption: me.menuUnmerge, event: 'unmerge' }); - menuItems.push( + arrItems.push( cellinfo.asc_getFlags().asc_getWrapText() ? { caption: me.menuUnwrap, @@ -312,7 +318,7 @@ define([ if ( cellinfo.asc_getHyperlink() && !cellinfo.asc_getFlags().asc_getMultiselect() && cellinfo.asc_getHyperlink().asc_getType() == Asc.c_oAscHyperlinkType.WebLink ) { - menuItems.push({ + arrItems.push({ caption: me.menuOpenLink, event: 'openlink' }); @@ -320,14 +326,14 @@ define([ if ( !cellinfo.asc_getHyperlink() && !cellinfo.asc_getFlags().asc_getMultiselect() && !cellinfo.asc_getFlags().asc_getLockText() && !!cellinfo.asc_getText() ) { - menuItems.push({ + arrItems.push({ caption: me.menuAddLink, event: 'addlink' }); } } - menuItems.push({ + arrItems.push({ caption: this.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? me.menuUnfreezePanes : me.menuFreezePanes, event: 'freezePanes' }); @@ -337,16 +343,18 @@ define([ - if (Common.SharedSettings.get('phone') && menuItems.length > 3) { - _actionSheets = menuItems.slice(3); + if (Common.SharedSettings.get('phone') && arrItems.length > 2) { + _actionSheets = arrItems.slice(2); - menuItems = menuItems.slice(0, 3); - menuItems.push({ + arrItems = arrItems.slice(0, 2); + arrItems.push({ caption: me.menuMore, event: 'showActionSheet' }); } + var menuItems = {itemsIcon: arrItemsIcon, items: arrItems}; + return menuItems; }, diff --git a/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js index 7e6b52636..9f134c4e7 100644 --- a/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js @@ -83,9 +83,14 @@ define([ } var menuItemTemplate = _.template([ - '<% _.each(menuItems, function(item) { %>', - '
  • <%= item.caption %>
  • ', - '<% }); %>' + '<% if(menuItems.itemsIcon) {%>', + '<% _.each(menuItems.itemsIcon, function(item) { %>', + '
  • ', + '<% }); }%>', + '<% if(menuItems.items) {%>', + '<% _.each(menuItems.items, function(item) { %>', + '
  • <%= item.caption %>
  • ', + '<% }); }%>' ].join('')); var $target = $('#' + _anchorId) diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css index 6f82e22f4..0adba5b26 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css @@ -6632,6 +6632,21 @@ i.icon.icon-table-settings { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M1%202H22V21H1V2ZM12%203H21V8H12V3ZM12%209H21V14H12V9ZM11%2014V9H2V14H11ZM2%2015V20H11V15H2ZM12%2015H21V20H12V15ZM11%203V8H2V3H11Z%22%20fill%3D%22%2340865c%22%2F%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22white%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22white%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22white%22%2F%3E%3C%2Fsvg%3E"); +} .chart-types .thumb.bar-normal { background-image: url('../img/charts/chart-03.png'); } diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-material.css b/apps/spreadsheeteditor/mobile/resources/css/app-material.css index c12269d60..f4134c4ed 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-material.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-material.css @@ -6266,6 +6266,21 @@ i.icon.icon-collaboration { height: 24px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.9912%206C15.9912%208.34102%2015.4074%2010.1346%2014.6055%2011.3121C13.7983%2012.4974%2012.8249%2013%2011.9912%2013C11.1575%2013%2010.1841%2012.4974%209.37695%2011.3121C8.57501%2010.1346%207.99121%208.34102%207.99121%206C7.99121%203.61508%209.96974%202%2011.9912%202C14.0127%202%2015.9912%203.61508%2015.9912%206ZM14.5015%2012.9506C13.7365%2013.6361%2012.8649%2014%2011.9912%2014C11.1195%2014%2010.2499%2013.6378%209.48619%2012.9554C7.78363%2013.6081%206.36015%2014.2591%205.26963%2014.9224C3.55256%2015.9667%203%2016.8326%203%2017.5C3%2018.2545%203.4257%2019.0877%204.82302%2019.7879C6.25015%2020.5031%208.57272%2020.9999%2012%2021C15.4273%2021%2017.7499%2020.5031%2019.177%2019.7879C20.5743%2019.0877%2021%2018.2545%2021%2017.5C21%2016.8326%2020.4474%2015.9667%2018.7304%2014.9224C17.6372%2014.2575%2016.2095%2013.605%2014.5015%2012.9506ZM15.2272%2012.1594C16.2765%2010.7825%2016.9912%208.67814%2016.9912%206C16.9912%203%2014.5%201%2011.9912%201C9.48242%201%206.99121%203%206.99121%206C6.99121%208.68159%207.70777%2010.7879%208.75931%2012.1647C4.60309%2013.7964%202%2015.4951%202%2017.5C2%2019.9852%205%2021.9999%2012%2022C19%2022%2022%2019.9852%2022%2017.5C22%2015.4929%2019.3913%2013.7927%2015.2272%2012.1594Z%22%20fill%3D%22%2340865c%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); } +i.icon.icon-cut { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url(%23cut)%22%3E%3Cpath%20d%3D%22M19.4406%2016.7116C17.8368%2016.7116%2016.4336%2017.76%2015.9825%2019.2576L13.1259%2013.5167L19.4907%200.737143C19.5909%200.487542%2019.4907%200.18802%2019.2902%200.0881796C19.0396%20-0.011661%2018.7389%200.0881795%2018.6387%200.287861L12.5245%2012.3686L6.51049%200.287861C6.41026%200.0382593%206.10956%20-0.0615813%205.85898%200.0382593C5.6084%200.1381%205.50816%200.437622%205.6084%200.687223L11.9732%2013.4668L9.06644%2019.2576C8.61539%2017.8099%207.21213%2016.7116%205.6084%2016.7116C3.60373%2016.7116%202%2018.3091%202%2020.3059C2%2022.3027%203.60373%2023.9002%205.6084%2023.9002C6.91143%2023.9002%208.06411%2023.2013%208.71562%2022.153C8.71562%2022.153%208.71562%2022.1529%208.71562%2022.103C8.81586%2021.9533%208.86597%2021.8035%208.91609%2021.6537L12.5245%2014.615L16.0828%2021.7037C16.1329%2021.8534%2016.2331%2022.0032%2016.2832%2022.153V22.2029C16.2832%2022.2029%2016.2832%2022.2029%2016.2832%2022.2528C16.9347%2023.3011%2018.0874%2024%2019.3905%2024C21.3951%2024%2022.9989%2022.4026%2022.9989%2020.4057C23.049%2018.359%2021.4452%2016.7116%2019.4406%2016.7116ZM5.6084%2022.9517C4.15501%2022.9517%203.00233%2021.8035%203.00233%2020.3558C3.00233%2018.9081%204.15501%2017.76%205.6084%2017.76C7.06178%2017.76%208.21446%2018.9081%208.21446%2020.3558C8.21446%2020.7053%208.16434%2021.0547%208.01399%2021.3542L7.91376%2021.5539C7.51283%2022.3526%206.66084%2022.9517%205.6084%2022.9517ZM19.4406%2022.9517C18.4382%2022.9517%2017.5361%2022.3526%2017.1352%2021.504L17.035%2021.3043C16.9347%2021.0048%2016.8345%2020.6553%2016.8345%2020.3059C16.8345%2018.8582%2017.9872%2017.71%2019.4406%2017.71C20.894%2017.71%2022.0466%2018.8582%2022.0466%2020.3059C22.0466%2021.7536%2020.894%2022.9517%2019.4406%2022.9517Z%22%20fill%3D%22black%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22cut%22%3E%3Crect%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22black%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E"); +} +i.icon.icon-copy { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%203.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%207.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M3%2011.5H9%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9%2014.5H0.5V0.5H14.5V9H9.5H9V9.5V14.5ZM15%2010V9.5H23.5V23.5H9.5V15.5H10V15V14.5V10H15Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} +i.icon.icon-paste { + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M21%2020.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2016.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M21%2012.5H12%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M13%202.5H4%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%202.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%201.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%203.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%204.5H5%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M14%200.5L5%200.500001%22%20stroke%3D%22black%22%2F%3E%3Cpath%20d%3D%22M9.5%209H9V9.5V19H10V10H23.5V23.5H9.5V20V19.5H9H0.5V2.5H18.5V9H9.5Z%22%20stroke%3D%22black%22%2F%3E%3C%2Fsvg%3E"); +} .navbar i.icon.icon-undo { width: 22px; height: 22px; diff --git a/apps/spreadsheeteditor/mobile/resources/less/ios/_icons.less b/apps/spreadsheeteditor/mobile/resources/less/ios/_icons.less index ec9deff91..603d5ea4c 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/ios/_icons.less +++ b/apps/spreadsheeteditor/mobile/resources/less/ios/_icons.less @@ -368,6 +368,21 @@ i.icon { height: 24px; .encoded-svg-background(' '); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } .chart-types .thumb { diff --git a/apps/spreadsheeteditor/mobile/resources/less/material/_icons.less b/apps/spreadsheeteditor/mobile/resources/less/material/_icons.less index de0bc9d1c..a6ba74d6b 100644 --- a/apps/spreadsheeteditor/mobile/resources/less/material/_icons.less +++ b/apps/spreadsheeteditor/mobile/resources/less/material/_icons.less @@ -332,6 +332,21 @@ i.icon { height: 24px; .encoded-svg-background(''); } + &.icon-cut { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-copy { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } + &.icon-paste { + width: 24px; + height: 24px; + .encoded-svg-background(''); + } } // Overwrite color for toolbar From 6d517a28f93ae8dd1b96e817a04209ae0ba5a973 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 9 Jul 2019 17:38:53 +0300 Subject: [PATCH 2/4] [Common mobile] Add load and register plugins --- apps/common/mobile/lib/controller/Plugins.js | 82 ++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/apps/common/mobile/lib/controller/Plugins.js b/apps/common/mobile/lib/controller/Plugins.js index d9e37a5d3..2105dc4be 100644 --- a/apps/common/mobile/lib/controller/Plugins.js +++ b/apps/common/mobile/lib/controller/Plugins.js @@ -57,6 +57,8 @@ define([ var modal; return { + configPlugins: {autostart:[]},// {config: 'from editor config', plugins: 'loaded plugins', UIplugins: 'loaded customization plugins', autostart: 'autostart guids'} + serverPlugins: {autostart:[]}, models: [], collections: [], views: [ @@ -71,9 +73,11 @@ define([ this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.showPluginModal, this)); this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.pluginClose, this)); this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.pluginResize, this)); + this.loadPlugins(); }, onLaunch: function () { + Common.Gateway.on('init', this.loadConfig.bind(this)); }, setMode: function(mode) { @@ -173,6 +177,84 @@ define([ } }, + loadConfig: function(data) { + this.configPlugins.config = data.config.plugins; + }, + + loadPlugins: function() { + var me = this; + if (me.configPlugins.config) { + me.configPlugins.plugins = me.getPlugins(me.configPlugins.config); + me.registerPlugins(); + } else { + me.configPlugins.plugins = false; + } + var server_plugins_url = '../../../../plugins.json'; + Common.Utils.loadConfig(server_plugins_url, function (obj) { + if ( obj != 'error' ) { + me.serverPlugins.config = obj; + me.serverPlugins.plugins = me.getPlugins(me.serverPlugins.config); + me.registerPlugins(); + } else + me.serverPlugins.config = false; + }); + }, + + registerPlugins: function() { + var me = this; + if (me.serverPlugins.plugins && me.configPlugins.plugins) { + var arr = me.configPlugins.plugins; + arr = arr.concat(me.serverPlugins.plugins); + me.api.asc_pluginsRegister('', arr); + } else if (me.serverPlugins.plugins) { + me.api.asc_pluginsRegister('', me.serverPlugins.plugins); + } else { + me.api.asc_pluginsRegister('', me.configPlugins.plugins); + } + }, + + getPlugins: function(pluginsConfig) { + var arrPluginsConfigs = []; + pluginsConfig.pluginsData.forEach(function(item) { + var value = window["Asc"].loadConfigAsInterface(item); + value["baseUrl"] = item.substring(0, item.lastIndexOf("config.json")); + arrPluginsConfigs.push(value); + }); + var arrPlugins = []; + arrPluginsConfigs.forEach(function (item) { + var plugin = new Asc.CPlugin(); + plugin["set_Name"](item["name"]); + plugin["set_Guid"](item["guid"]); + plugin["set_BaseUrl"](item["baseUrl"]); + var variations = item["variations"]; + var variationsArr = []; + variations.forEach(function (itemVar) { + var variation = new Asc.CPluginVariation(); + variation["set_Description"](itemVar["description"]); + variation["set_Url"](itemVar["url"]); + variation["set_Icons"](itemVar["icons"]); + variation["set_Visual"](itemVar["isVisual"]); + variation["set_CustomWindow"](itemVar["'isCustomWindow"]); + variation["set_System"](itemVar["isSystem"]); + variation["set_Viewer"](itemVar["isViewer"]); + variation["set_EditorsSupport"](itemVar["EditorsSupport"]); + variation["set_Modal"](itemVar["isModal"]); + variation["set_InsideMode"](itemVar["isInsideMode"]); + variation["set_InitDataType"](itemVar["initDataType"]); + variation["set_InitData"](itemVar["initData"]); + variation["set_UpdateOleOnResize"](itemVar["isUpdateOleOnResize"]); + variation["set_Buttons"](itemVar["buttons"]); + variation["set_Size"](itemVar["size"]); + variation["set_InitOnSelectionChanged"](itemVar["initOnSelectionChanged"]); + variation["set_Events"](itemVar["events"]); + variationsArr.push(variation); + }); + plugin["set_Variations"](variationsArr); + arrPlugins.push(plugin); + }); + return arrPlugins; + }, + textCancel: 'Cancel', textLoading: 'Loading' } From c5fc8db80351da4ebf0467018fab97aef394c63b Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 10 Jul 2019 12:13:39 +0300 Subject: [PATCH 3/4] [Common mobile] Fix load plugins --- apps/common/mobile/lib/controller/Plugins.js | 145 +++++++++++++------ 1 file changed, 97 insertions(+), 48 deletions(-) diff --git a/apps/common/mobile/lib/controller/Plugins.js b/apps/common/mobile/lib/controller/Plugins.js index 2105dc4be..ebdac7b5d 100644 --- a/apps/common/mobile/lib/controller/Plugins.js +++ b/apps/common/mobile/lib/controller/Plugins.js @@ -73,6 +73,7 @@ define([ this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.showPluginModal, this)); this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.pluginClose, this)); this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.pluginResize, this)); + this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.registerPlugins, this)); this.loadPlugins(); }, @@ -184,8 +185,12 @@ define([ loadPlugins: function() { var me = this; if (me.configPlugins.config) { - me.configPlugins.plugins = me.getPlugins(me.configPlugins.config); - me.registerPlugins(); + me.getPlugins(me.configPlugins.config.pluginsData) + .then(function(loaded) + { + me.configPlugins.plugins = loaded; + me.mergePlugins(); + }); } else { me.configPlugins.plugins = false; } @@ -193,66 +198,110 @@ define([ Common.Utils.loadConfig(server_plugins_url, function (obj) { if ( obj != 'error' ) { me.serverPlugins.config = obj; - me.serverPlugins.plugins = me.getPlugins(me.serverPlugins.config); - me.registerPlugins(); + me.getPlugins(me.serverPlugins.config.pluginsData) + .then(function(loaded) + { + me.serverPlugins.plugins = loaded; + me.mergePlugins(); + }); } else - me.serverPlugins.config = false; + me.serverPlugins.plugins = false; }); }, - registerPlugins: function() { + mergePlugins: function() { var me = this; - if (me.serverPlugins.plugins && me.configPlugins.plugins) { - var arr = me.configPlugins.plugins; - arr = arr.concat(me.serverPlugins.plugins); - me.api.asc_pluginsRegister('', arr); - } else if (me.serverPlugins.plugins) { - me.api.asc_pluginsRegister('', me.serverPlugins.plugins); - } else { - me.api.asc_pluginsRegister('', me.configPlugins.plugins); + if (me.serverPlugins.plugins !== undefined && me.configPlugins.plugins !== undefined) { + var arr = [], + plugins = this.configPlugins; + if (plugins.plugins && plugins.plugins.length>0) { + arr = plugins.plugins; + } + plugins = this.serverPlugins; + if (plugins.plugins && plugins.plugins.length>0) { + arr = arr.concat(plugins.plugins); + } + this.registerPlugins(arr); } }, - getPlugins: function(pluginsConfig) { - var arrPluginsConfigs = []; - pluginsConfig.pluginsData.forEach(function(item) { - var value = window["Asc"].loadConfigAsInterface(item); - value["baseUrl"] = item.substring(0, item.lastIndexOf("config.json")); - arrPluginsConfigs.push(value); - }); - var arrPlugins = []; - arrPluginsConfigs.forEach(function (item) { + registerPlugins: function(plugins) { + var me = this; + var arr = []; + plugins.forEach(function(item){ var plugin = new Asc.CPlugin(); - plugin["set_Name"](item["name"]); - plugin["set_Guid"](item["guid"]); - plugin["set_BaseUrl"](item["baseUrl"]); - var variations = item["variations"]; - var variationsArr = []; - variations.forEach(function (itemVar) { + plugin.set_Name(item['name']); + plugin.set_Guid(item['guid']); + plugin.set_BaseUrl(item['baseUrl']); + + var variations = item['variations'], + variationsArr = []; + variations.forEach(function(itemVar){ var variation = new Asc.CPluginVariation(); - variation["set_Description"](itemVar["description"]); - variation["set_Url"](itemVar["url"]); - variation["set_Icons"](itemVar["icons"]); - variation["set_Visual"](itemVar["isVisual"]); - variation["set_CustomWindow"](itemVar["'isCustomWindow"]); - variation["set_System"](itemVar["isSystem"]); - variation["set_Viewer"](itemVar["isViewer"]); - variation["set_EditorsSupport"](itemVar["EditorsSupport"]); - variation["set_Modal"](itemVar["isModal"]); - variation["set_InsideMode"](itemVar["isInsideMode"]); - variation["set_InitDataType"](itemVar["initDataType"]); - variation["set_InitData"](itemVar["initData"]); - variation["set_UpdateOleOnResize"](itemVar["isUpdateOleOnResize"]); - variation["set_Buttons"](itemVar["buttons"]); - variation["set_Size"](itemVar["size"]); - variation["set_InitOnSelectionChanged"](itemVar["initOnSelectionChanged"]); - variation["set_Events"](itemVar["events"]); + variation.set_Description(itemVar['description']); + variation.set_Url(itemVar['url']); + variation.set_Icons(itemVar['icons']); + variation.set_Visual(itemVar['isVisual']); + variation.set_CustomWindow(itemVar['isCustomWindow']); + variation.set_System(itemVar['isSystem']); + variation.set_Viewer(itemVar['isViewer']); + variation.set_EditorsSupport(itemVar['EditorsSupport']); + variation.set_Modal(itemVar['isModal']); + variation.set_InsideMode(itemVar['isInsideMode']); + variation.set_InitDataType(itemVar['initDataType']); + variation.set_InitData(itemVar['initData']); + variation.set_UpdateOleOnResize(itemVar['isUpdateOleOnResize']); + variation.set_Buttons(itemVar['buttons']); + variation.set_Size(itemVar['size']); + variation.set_InitOnSelectionChanged(itemVar['initOnSelectionChanged']); + variation.set_Events(itemVar['events']); + variationsArr.push(variation); }); + plugin["set_Variations"](variationsArr); - arrPlugins.push(plugin); + arr.push(plugin); }); - return arrPlugins; + me.api.asc_pluginsRegister('', arr); + }, + + getPlugins: function(pluginsData, fetchFunction) { + if (!pluginsData || pluginsData.length<1) + return Promise.resolve([]); + + fetchFunction = fetchFunction || function (url) { + return fetch(url) + .then(function(response) { + if ( response.ok ) return response.json(); + else return Promise.reject(url); + }).then(function(json) { + json.baseUrl = url.substring(0, url.lastIndexOf("config.json")); + return json; + }); + }; + + var loaded = []; + return pluginsData.map(fetchFunction).reduce(function (previousPromise, currentPromise) { + return previousPromise + .then(function() + { + return currentPromise; + }) + .then(function(item) + { + loaded.push(item); + return Promise.resolve(item); + }) + .catch(function(item) + { + return Promise.resolve(item); + }); + + }, Promise.resolve()) + .then(function () + { + return Promise.resolve(loaded); + }); }, textCancel: 'Cancel', From df4308513ac130d0fab3c0805ccbfa12e78445fe Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 12 Jul 2019 12:08:45 +0300 Subject: [PATCH 4/4] Refactoring plugins --- apps/common/mobile/lib/controller/Plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/mobile/lib/controller/Plugins.js b/apps/common/mobile/lib/controller/Plugins.js index ebdac7b5d..eb08aa1c5 100644 --- a/apps/common/mobile/lib/controller/Plugins.js +++ b/apps/common/mobile/lib/controller/Plugins.js @@ -74,7 +74,6 @@ define([ this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.pluginClose, this)); this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.pluginResize, this)); this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.registerPlugins, this)); - this.loadPlugins(); }, onLaunch: function () { @@ -180,6 +179,7 @@ define([ loadConfig: function(data) { this.configPlugins.config = data.config.plugins; + this.loadPlugins(); }, loadPlugins: function() {