Вход Регистрация
Файл: upload/admin/view/javascript/ckeditor/plugins/codemirror/js/util/multiplex.js
Строк: 210
<?php
CodeMirror
.multiplexingMode = function(outer /*, others */) {
  
// Others should be {open, close, mode [, delimStyle]} objects
  
var others = Array.prototype.slice.call(arguments1);
  var 
n_others others.length;

  function 
indexOf(stringpatternfrom) {
    if (
typeof pattern == "string") return string.indexOf(patternfrom);
    var 
pattern.exec(from string.slice(from) : string);
    return 
m.index from : -1;
  }

  return {
    
startState: function() {
      return {
        
outerCodeMirror.startState(outer),
        
innerActivenull,
        
innernull
      
};
    },

    
copyState: function(state) {
      return {
        
outerCodeMirror.copyState(outerstate.outer),
        
innerActivestate.innerActive,
        
innerstate.innerActive && CodeMirror.copyState(state.innerActive.modestate.inner)
      };
    },

    
token: function(streamstate) {
      if (!
state.innerActive) {
        var 
cutOff InfinityoldContent stream.string;
        for (var 
0n_others; ++i) {
          var 
other others[i];
          var 
found indexOf(oldContentother.openstream.pos);
          if (
found == stream.pos) {
            
stream.match(other.open);
            
state.innerActive other;
            
state.inner CodeMirror.startState(other.modeouter.indent outer.indent(state.outer"") : 0);
            return 
other.delimStyle;
          } else if (
found != -&& found cutOff) {
            
cutOff found;
          }
        }
        if (
cutOff != Infinitystream.string oldContent.slice(0cutOff);
        var 
outerToken outer.token(streamstate.outer);
        if (
cutOff != Infinitystream.string oldContent;
        return 
outerToken;
      } else {
        var 
curInner state.innerActiveoldContent stream.string;
        var 
found indexOf(oldContentcurInner.closestream.pos);
        if (
found == stream.pos) {
          
stream.match(curInner.close);
          
state.innerActive state.inner null;
          return 
curInner.delimStyle;
        }
        if (
found > -1stream.string oldContent.slice(0found);
        var 
innerToken curInner.mode.token(streamstate.inner);
        if (
found > -1stream.string oldContent;
        var 
cur stream.current(), found cur.indexOf(curInner.close);
        if (
found > -1stream.backUp(cur.length found);
        return 
innerToken;
      }
    },
    
    
indent: function(statetextAfter) {
      var 
mode state.innerActive state.innerActive.mode outer;
      if (!
mode.indent) return CodeMirror.Pass;
      return 
mode.indent(state.innerActive state.inner state.outertextAfter);
    },

    
blankLine: function(state) {
      var 
mode state.innerActive state.innerActive.mode outer;
      if (
mode.blankLine) {
        
mode.blankLine(state.innerActive state.inner state.outer);
      }
      if (!
state.innerActive) {
        for (var 
0n_others; ++i) {
          var 
other others[i];
          if (
other.open === "n") {
            
state.innerActive other;
            
state.inner CodeMirror.startState(other.modemode.indent mode.indent(state.outer"") : 0);
          }
        }
      } else if (
mode.close === "n") {
        
state.innerActive state.inner null;
      }
    },

    
electricCharsouter.electricChars,

    
innerMode: function(state) {
      return 
state.inner ? {statestate.innermodestate.innerActive.mode} : {statestate.outermodeouter};
    }
  };
};
?>
Онлайн: 0
Реклама