zoukankan      html  css  js  c++  java
  • 前端页面使用ace插件优化脚本

    html页面:<pre id="editor" style=" 100%;height: 800px;"></pre>(注:必须设置高度)

    function getScriptHightLight(){
      ace.config.set("basePath", "vendors/ace-build/src-min");
      ace.require("ace/ext/beautify");
      var editor = ace.edit("editor");
      if($scope.store&&$scope.store.scriptContent){
        editor.setValue($scope.store.scriptContent); //设置内容
        if($scope.oper==="detail"){
          editor.setReadOnly(true); //只读
        }else{
          editor.setReadOnly(false); //只读
        }
      }else{
        editor.setValue('');//没有值设置为空
      }
      editor.setOption("wrap", "free") //自动换行
      editor.setShowPrintMargin(false); //设置打印线
      editor.session.setMode("ace/mode/sh");
      editor.setTheme("ace/theme/vibrant_ink"); //引入的模板
      editor.setHighlightActiveLine(true); //设置高亮
      editor.setOptions({
        enableBasicAutocompletion: true,
        enableSnippets: true,
        enableLiveAutocompletion: true
      });
      editor.on('change', function () {//更新脚本事件
        $timeout(function () {
          $scope.$apply(function () {
            var value = editor.getValue();
            $scope.store.scriptContent=value;
          });
        });
      });
    }

  • 相关阅读:
    centos7.6 redis
    centos7.5 rabbitmq3.7.4
    centos7.6 nfs
    nginx跨域
    Linux进阶教程丨第1章:访问命令行
    Representation Learning for Event-based Visuomotor Policies
    Goland 2019下载和安装(带破解补丁和汉化包)
    Adobe XD CC 2020中文破解版(附破解教程)
    SSH 三步解决免密登录
    cygwin命令行安装
  • 原文地址:https://www.cnblogs.com/shixy1617/p/10616334.html
Copyright © 2011-2022 走看看