标签:ng-click ati The toc outline btn toolbar init lib
dir_alert
.set({
theme: {
width: ‘70%‘,
},
title: ‘脚本编辑器‘,
tpl: ‘<div ng-init="init()">‘ +
‘<div id="editormd">‘ +
‘<textarea style="display:none;"></textarea>‘ +
‘</div>‘ +
‘<div class="text-center">‘ +
‘<button type="button" class="btn btn-outline-primary" style="margin-right:50px;width:150px" ng-click="cancel()">取消</button>‘ +
‘<button type="button" class="btn btn-outline-danger" style="width:150px" ng-click="ok()">确认</button>‘ +
‘</div>‘ +
‘</div>‘,
tpl_scope: {
init: function () {
var that = this;
angular.element(document).ready(function () {
that.testEditor = editormd(‘editormd‘, {
width: ‘100%‘,
height: ‘720‘,
watch: false,
toolbar: false,
codeFold: true,
searchReplace: true,
placeholder: ‘‘,
value: res.content,
theme: ‘default‘,
mode: current_config.language,
path: ‘../../static/common/editor.md/lib/‘
});
});
$timeout(function () {
that.past_value = that.testEditor.getValue();
}, 500);
},
ok: function () {
var that = this;
that.now_value = that.testEditor.getValue();
if (that.past_value === that.now_value) {
dir_alert.show(false);
return;
}
tradeApi
.query({
method: ‘post‘,
root: ‘protocol‘,
url: current_config.save_url,
data: {
id: li.id,
content: that.now_value
},
check_status: ‘never‘,
})
.then(function (res) {
if (res.data.status === 0) {
if (res.data.type === 2) {
dir_alert
.set({
content: res.data.msg,
button: true,
ok: function () {
tradeApi
.query({
method: ‘post‘,
root: ‘protocol‘,
url: current_config.save_url,
data: {
id: li.id,
content: that.now_value,
action: 2,
},
check_status: ‘never‘,
})
.then(function () {
$scope.g_tip(‘协议保存成功‘);
});
}
});
} else if (res.data.type === 3) {
dir_alert.set({
content: res.data.msg,
button: true,
cancel_hiden: true,
});
} else {
dir_alert.set({
content: res.data.msg
});
}
} else if (res.data.status === 1) {
dir_alert.show(false);
$scope.g_tip(‘协议保存成功‘);
}
});
},
cancel: function () {
dir_alert.show(false);
}
}
});
标签:ng-click ati The toc outline btn toolbar init lib
原文地址:https://www.cnblogs.com/gushixianqiancheng/p/11388151.html