* [task#133857,doing,0.5h] add btn and bind event to apply template.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
window.applyTemplate = function()
|
||||
{
|
||||
const docApp = getDocApp();
|
||||
const editor = docApp.editor.$;
|
||||
|
||||
const templateID = $('#template').find('.picker-box').zui('picker').$.value;
|
||||
const url = $.createLink('doc', 'ajaxGetTemplateContent', `id=${templateID}`);
|
||||
$.get(url, function(data)
|
||||
{
|
||||
data = JSON.parse(data);
|
||||
editor.updateDoc(data.content, data.type != 'doc' ? data.type : undefined);
|
||||
});
|
||||
}
|
||||
@@ -14,10 +14,24 @@ formPanel
|
||||
set::title($lang->doc->template),
|
||||
formGroup
|
||||
(
|
||||
setID('template'),
|
||||
set::label($lang->doc->selectTemplate),
|
||||
set::name('template'),
|
||||
set::required(true),
|
||||
set::width('5/6'),
|
||||
set::items($templatePairs)
|
||||
),
|
||||
set::actions(array()),
|
||||
formGroup
|
||||
(
|
||||
setClass('form-actions'),
|
||||
btn
|
||||
(
|
||||
$lang->save,
|
||||
set::btnType('button'),
|
||||
set::type('primary'),
|
||||
setData('dismiss', 'modal'),
|
||||
on::click('applyTemplate')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user