Vergleich admin/jscripts/codemirror/addon/dialog/dialog.js - 1.8.0 - 1.8.25

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 15Zeile 15
    var wrap = cm.getWrapperElement();
var dialog;
dialog = wrap.appendChild(document.createElement("div"));

    var wrap = cm.getWrapperElement();
var dialog;
dialog = wrap.appendChild(document.createElement("div"));

    if (bottom) {

    if (bottom)

      dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";

      dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";

    } else {

    else

      dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";

      dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";

    }



    if (typeof template == "string") {
dialog.innerHTML = template;
} else { // Assuming it's a detached DOM element.

    if (typeof template == "string") {
dialog.innerHTML = template;
} else { // Assuming it's a detached DOM element.

Zeile 35Zeile 35
  }

CodeMirror.defineExtension("openDialog", function(template, callback, options) {

  }

CodeMirror.defineExtension("openDialog", function(template, callback, options) {

 
    if (!options) options = {};


    closeNotification(this, null);

    closeNotification(this, null);

    var dialog = dialogDiv(this, template, options && options.bottom);



var dialog = dialogDiv(this, template, options.bottom);

    var closed = false, me = this;
function close(newVal) {
if (typeof newVal == 'string') {

    var closed = false, me = this;
function close(newVal) {
if (typeof newVal == 'string') {

Zeile 45Zeile 48
        if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);

        if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);

 
        me.focus();

if (options.onClose) options.onClose(dialog);

      }
}

      }
}

 


    var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {

    var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {

      if (options && options.value) inp.value = options.value;














      inp.focus();

if (options.value) {
inp.value = options.value;
if (options.selectValueOnOpen !== false) {
inp.select();
}
}

if (options.onInput)
CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
if (options.onKeyUp)
CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});


      CodeMirror.on(inp, "keydown", function(e) {
if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }

      CodeMirror.on(inp, "keydown", function(e) {
if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }

        if (e.keyCode == 13 || e.keyCode == 27) {

        if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {

          inp.blur();
CodeMirror.e_stop(e);
close();

          inp.blur();
CodeMirror.e_stop(e);
close();

          me.focus();
if (e.keyCode == 13) callback(inp.value);

 
        }

        }

      });
if (options && options.onKeyUp) {
CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
}
if (options && options.value) inp.value = options.value;
inp.focus();
CodeMirror.on(inp, "blur", close);

        if (e.keyCode == 13) callback(inp.value, e);
});

if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);




    } else if (button = dialog.getElementsByTagName("button")[0]) {
CodeMirror.on(button, "click", function() {
close();
me.focus();
});

    } else if (button = dialog.getElementsByTagName("button")[0]) {
CodeMirror.on(button, "click", function() {
close();
me.focus();
});

 

if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);


      button.focus();

      button.focus();

      CodeMirror.on(button, "blur", close);

 
    }
return close;
});

    }
return close;
});

Zeile 117Zeile 134
  CodeMirror.defineExtension("openNotification", function(template, options) {
closeNotification(this, close);
var dialog = dialogDiv(this, template, options && options.bottom);

  CodeMirror.defineExtension("openNotification", function(template, options) {
closeNotification(this, close);
var dialog = dialogDiv(this, template, options && options.bottom);

    var duration = options && (options.duration === undefined ? 5000 : options.duration);

 
    var closed = false, doneTimer;

    var closed = false, doneTimer;

 
    var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;


function close() {
if (closed) return;


function close() {
if (closed) return;

Zeile 131Zeile 148
      CodeMirror.e_preventDefault(e);
close();
});

      CodeMirror.e_preventDefault(e);
close();
});

 


    if (duration)

    if (duration)

      doneTimer = setTimeout(close, options.duration);



      doneTimer = setTimeout(close, duration);

return close;

  });
});

  });
});