当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Common.escapeHtml方法代码示例

本文整理汇总了TypeScript中common.Common.escapeHtml方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Common.escapeHtml方法的具体用法?TypeScript Common.escapeHtml怎么用?TypeScript Common.escapeHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.Common的用法示例。


在下文中一共展示了Common.escapeHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createKeyBinding

   function createKeyBinding(name, description, preventDefault, pressAction) {
      var keyBinding = parseKeyBinding(name);      
//      var editor = ace.edit("editor");
//       
//      console.log(keyBinding.editor);
//      editor.commands.addCommand({
//           name : name,
//           bindKey : {
//               win : keyBinding.editor,
//               mac : keyBinding.editor
//           },
//           exec : function(editor) {
//              if(pressAction) { 
//                 pressAction();
//              }
//           }
//      });
      keyBindings[keyBinding.editor] = Common.escapeHtml(description);
      FileEditor.addEditorKeyBinding(keyBinding, pressAction);
      Mousetrap.bindGlobal(keyBinding.global, function(e) {
         if(pressAction) {
            pressAction();
         }
         return !preventDefault;
      });
   }
开发者ID:snapscript,项目名称:snap-develop,代码行数:26,代码来源:keys.ts

示例2: pasteInPlainText

 function pasteInPlainText(name, event) {
    if(event && event.originalEvent) {
       var text = event.originalEvent.clipboardData.getData("text/plain");
       var element = document.getElementById(name);
       
       if(text && element) {
          text = text.replace(/[\n\r]/g, '');
          text = Common.escapeHtml(text);
          
          element.innerHTML = text;
          return false;
       }
    }
    return true;
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:15,代码来源:dialog.ts

示例3: createEvaluateDialog

 function createEvaluateDialog(inputText, dialogTitle) { 
    var windowHeight = $(window).height();   // returns height of browser viewport
    var windowWidth = $(window).width();   // returns width of browser viewport
    var dialogBody = createGridDialogLayout(inputText ? Common.escapeHtml(inputText) : '');
    var focusInput = function() {
       var element = document.getElementById('dialogPath');
       element.contentEditable = "true";
       element.focus();
    };
    var executeEvaluation = function() {
       var text = $("#dialogPath").html();
       var expression = Common.clearHtml(text);
       
       Command.browseScriptEvaluation([], expression, true); // clear the variables 
    };
    w2popup.open({
       title : dialogTitle,
       body : dialogBody.content,
       buttons : '<button id="dialogSave" class="btn dialogButton">Evaluate</button>',
       width : Math.max(700, windowWidth / 2),
       height : Math.max(400, windowHeight / 2),
       overflow : 'hidden',
       color : '#999',
       speed : '0.3',
       opacity : '0.8',
       modal : false,
       showClose : true,
       showMax : true,
       onOpen : function(event) {
          setTimeout(function() {
             dialogBody.init(); // bind the functions
             $('#dialog').w2grid({
                recordTitles: false, // show tooltips
                name : 'evaluation',
                columns : [ {
                   field : 'name',
                   caption : 'Name',
                   size : '40%',
                   sortable : false
                }, {
                   field : 'value',
                   caption : 'Value',
                   size : '30%',
                   sortable : false
                }, {
                   field : 'type',
                   caption : 'Type',
                   size : '30%'
                } ],
                onClick : function(event) {
                   var grid = this;
                   event.onComplete = function() {
                      var sel = grid.getSelection();
                      if (sel.length == 1) {
                         var record = grid.get(sel[0]);
                         var text = $("#dialogPath").html();
                         var expression = Common.clearHtml(text);
                         
                         VariableManager.toggleExpandEvaluation(record.path, expression);
                      }
                      grid.selectNone();
                      grid.refresh();
                   }
                }               
             }); 
             focusInput();
             
             setTimeout(function() {
                VariableManager.showVariables();
             }, 200);
          }, 200);
       },
       onClose : function(event) {
          w2ui['evaluation'].destroy(); // destroy grid so you can recreate it
          //$("#dialog").remove(); // delete the element
          VariableManager.clearEvaluation();
          Command.browseScriptEvaluation([], "", true); // clear the variables
       },
       onMax : function(event) {
          event.onComplete = function() {
             w2ui['evaluation'].refresh(); // resize
             focusInput();
          }
          $(window).trigger('resize');
       },
       onMin : function(event) {
          event.onComplete = function() {
             w2ui['evaluation'].refresh(); // resize
             focusInput();
          }
          $(window).trigger('resize');
       },
       onKeydown : function(event) {
          console.log('keydown');
       }
    });
    $("#dialogSave").click(function() {
       executeEvaluation();
    });
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:100,代码来源:dialog.ts

示例4: showVariablesGrid

 function showVariablesGrid(threadVariables: ThreadVariables, gridName: string, expressions: boolean) {
    var variables = threadVariables.getVariables();
    var sortedNames = [];
    var variableRecords = [];
    var variableIndex = 1;
    
    for (var variableName in variables) {
       if (variables.hasOwnProperty(variableName)) {
          sortedNames.push(variableName); // add a '.' to ensure dot notation sorts e.g x.y.z
       }
    }
    sortedNames.sort();
    
    for(var i = 0; i < sortedNames.length; i++) {
       var sortedName = sortedNames[i];
       var variable = variables[sortedName];
       var variableExpandable = "" + variable.expandable;
       var variableRoot = variable.depth == 0; // style the root differently
       var variableProperty = ""+variable.property;
       var variableModifiers = variable.modifiers;
       var displayStyle = "variableLeaf";
 
       if(variableRoot && expressions) { // highlight expressions differently
          displayStyle = "variableExpression";
       }else {
          if(variableProperty == "true") {
             if(variableModifiers.indexOf("[private]") != -1) {
                displayStyle = "variableNodePrivate";
             }
             else if(variableModifiers.indexOf("[protected]") != -1){
                displayStyle = "variableNodeProtected";
             }
             else if(variableModifiers.indexOf("[public]") != -1){
                displayStyle = "variableNodePublic";
             }
             else {
                displayStyle = "variableNode"; // default
             }
          }
       }
       var displayValue = "<div class='variableData'>"+Common.escapeHtml(variable.value)+"</div>";
       var displayName = "<div title='"+Common.escapeHtml(variable.description)+"' style='padding-left: " + 
          (variable.depth * 20)+ 
          "px;'><div class='"+displayStyle+
          "'>"+Common.escapeHtml(variable.name)+"</div></div>";
       
       variableRecords.push({
          recid: variableIndex++,
          path: sortedName,
          name: displayName,
          value: displayValue,
          type: variable.type,
          expandable: variableExpandable == "true"
          //depth: variable.depth // seems to cause issues?
       });
    }
    var variableGrid = w2ui[gridName];
    
    if(variableGrid != null) {
       variableGrid.records = variableRecords;
       variableGrid.refresh();
    }
 }
开发者ID:snapscript,项目名称:snap-develop,代码行数:63,代码来源:variables.ts


注:本文中的common.Common.escapeHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。