mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-24 10:05:27 +08:00
Merge pull request #2531 from ONLYOFFICE/feature/add-mi-create-from-template
Feature/add mi create from template
This commit is contained in:
@ -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: $(`<li id="fm-btn-create-fromtpl" class="fm-btn"></li>`),
|
||||
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 = {});
|
||||
|
||||
@ -348,6 +348,7 @@ define([
|
||||
this.panels['protect'].setApi(this.api);
|
||||
}
|
||||
|
||||
this.fireEvent('render:after', [this]);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
@ -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.",
|
||||
|
||||
@ -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": "Объект недоступен, так как редактируется другим пользователем.",
|
||||
|
||||
@ -344,6 +344,7 @@ define([
|
||||
this.panels['protect'].setApi(this.api);
|
||||
}
|
||||
|
||||
this.fireEvent('render:after', [this]);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
@ -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.",
|
||||
|
||||
@ -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": "Объект недоступен, так как редактируется другим пользователем.",
|
||||
|
||||
@ -327,6 +327,7 @@ define([
|
||||
this.panels['opts'].setApi(this.api);
|
||||
}
|
||||
|
||||
this.fireEvent('render:after', this);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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": "Диаграмма с областями с накоплением",
|
||||
|
||||
Reference in New Issue
Block a user