加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

138、脚本编辑器

发布时间:2020-12-15 07:59:30 所属栏目:Java 来源:网络整理
导读: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="b
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‘,data: {
                                        id: li.id,content: that.now_value,action: 2,})
                                    .then(function () {
                                      $scope.g_tip(‘协议保存成功‘);
                                    });
                                }
                              });
                          } else if (res.data.type === 3) {
                            dir_alert.set({
                              content: res.data.msg,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);
                  }
                }
              });

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读