diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index 53f8320f5a..834b1954d4 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -488,6 +488,33 @@ define([ console.log('open recent'); } + const _extend_menu_file = function (args) { + console.log('extend menu file') + + // if ( native.features.opentemplate ) + { + const filemenu = webapp.getController('LeftMenu').leftMenu.getMenu('file'); + if ( filemenu.miNew.visible ) { + const miNewFromTemplate = new Common.UI.MenuItem({ + el: $(`
`), + action: 'create:fromtemplate', + caption: _tr('itemCreateFromTemplate', 'Create from template'), + canFocused: false, + dataHint: 1, + dataHintDirection: 'left-top', + dataHintOffset: [2, 14], + }); + + miNewFromTemplate.$el.insertAfter(filemenu.miNew.$el); + filemenu.items.push(miNewFromTemplate); + } + } + } + + const _tr = function (id, defvalue) { + return Common.Locale.get(id, {name:"Common.Controllers.Desktop", default: defvalue}); + } + return { init: function (opts) { _.extend(config, opts); @@ -525,10 +552,15 @@ define([ if ( action == 'file:open' ) { native.execCommand('editor:event', JSON.stringify({action: 'file:open'})); menu.hide(); + } else + if ( action == 'create:fromtemplate' ) { + native.execCommand('create:new', 'template:' + (!!window.SSE ? 'cell' : !!window.PE ? 'slide' : 'word')); + menu.hide(); } }, 'settings:apply': _onApplySettings.bind(this), 'recent:open': _onOpenRecent.bind(this), + 'render:after': _extend_menu_file, }, }, {id: 'desktop'}); @@ -630,12 +662,12 @@ define([ } native.execCommand("open:recent", JSON.stringify(params)); - return true + return true; } return false; }, - }; + }; }; !Common.Controllers && (Common.Controllers = {}); diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 86e3b4927a..d95aab4681 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -348,6 +348,7 @@ define([ this.panels['protect'].setApi(this.api); } + this.fireEvent('render:after', [this]); return this; }, diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 52471ba8d7..38527beeb2 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2,6 +2,7 @@ "Common.Controllers.Chat.notcriticalErrorTitle": "Warning", "Common.Controllers.Chat.textEnterMessage": "Enter your message here", "Common.Controllers.Desktop.hintBtnHome": "Show Main window", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Create from template", "Common.Controllers.ExternalDiagramEditor.textAnonymous": "Anonymous", "Common.Controllers.ExternalDiagramEditor.textClose": "Close", "Common.Controllers.ExternalDiagramEditor.warningText": "The object is disabled because it is being edited by another user.", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index 459ac5e29e..c6e0e0a117 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -2,6 +2,7 @@ "Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение", "Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение", "Common.Controllers.Desktop.hintBtnHome": "Показать главное окно", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Создать из шаблона", "Common.Controllers.ExternalDiagramEditor.textAnonymous": "Аноним", "Common.Controllers.ExternalDiagramEditor.textClose": "Закрыть", "Common.Controllers.ExternalDiagramEditor.warningText": "Объект недоступен, так как редактируется другим пользователем.", diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index b213b5bf4a..85030d783d 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -344,6 +344,7 @@ define([ this.panels['protect'].setApi(this.api); } + this.fireEvent('render:after', [this]); return this; }, diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 3660723d2d..64d2cb6643 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1,6 +1,8 @@ { "Common.Controllers.Chat.notcriticalErrorTitle": "Warning", "Common.Controllers.Chat.textEnterMessage": "Enter your message here", + "Common.Controllers.Desktop.hintBtnHome": "Show Main window", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Create from template", "Common.Controllers.ExternalDiagramEditor.textAnonymous": "Anonymous", "Common.Controllers.ExternalDiagramEditor.textClose": "Close", "Common.Controllers.ExternalDiagramEditor.warningText": "The object is disabled because it is being edited by another user.", diff --git a/apps/presentationeditor/main/locale/ru.json b/apps/presentationeditor/main/locale/ru.json index e05b87fe81..cb83783717 100644 --- a/apps/presentationeditor/main/locale/ru.json +++ b/apps/presentationeditor/main/locale/ru.json @@ -1,6 +1,8 @@ { "Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение", "Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение", + "Common.Controllers.Desktop.hintBtnHome": "Показать главное окно", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Создать из шаблона", "Common.Controllers.ExternalDiagramEditor.textAnonymous": "Аноним", "Common.Controllers.ExternalDiagramEditor.textClose": "Закрыть", "Common.Controllers.ExternalDiagramEditor.warningText": "Объект недоступен, так как редактируется другим пользователем.", diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 2b330ef65b..e582f2cf07 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -327,6 +327,7 @@ define([ this.panels['opts'].setApi(this.api); } + this.fireEvent('render:after', this); return this; }, diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index ba6582ba18..d6e559a2ab 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2,6 +2,8 @@ "cancelButtonText": "Cancel", "Common.Controllers.Chat.notcriticalErrorTitle": "Warning", "Common.Controllers.Chat.textEnterMessage": "Enter your message here", + "Common.Controllers.Desktop.hintBtnHome": "Show Main window", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Create from template", "Common.Controllers.History.notcriticalErrorTitle": "Warning", "Common.define.chartData.textArea": "Area", "Common.define.chartData.textAreaStacked": "Stacked area", diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index 387c0527e4..ee5acbbf06 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -2,6 +2,8 @@ "cancelButtonText": "Отмена", "Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение", "Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение", + "Common.Controllers.Desktop.hintBtnHome": "Показать главное окно", + "Common.Controllers.Desktop.itemCreateFromTemplate": "Создать из шаблона", "Common.Controllers.History.notcriticalErrorTitle": "Внимание", "Common.define.chartData.textArea": "С областями", "Common.define.chartData.textAreaStacked": "Диаграмма с областями с накоплением",