view release on metacpan or search on metacpan
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
230231232233234235236237238239240241242243244245246247248249250
d.maxLineChanged = false;
// Used
for
measuring wheel scrolling granularity
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
// True
when
shift
is held down.
d.
shift
= false;
// Used to track whether anything happened since the context menu
// was opened.
d.selForContextMenu = null;
}
// STATE UPDATES
// Used to get the editor into a consistent state again
when
options change.
function loadMode(cm) {
cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
resetModeState(cm);
}
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
225222532254225522562257225822592260226122622263226422652266226722682269227022712272// Work
around
nonsensical selection resetting in IE9/10
if
(ie && !ie_upto8 && cm.display.inputHasSelection === text) {
resetInput(cm);
return
false;
}
var withOp = !cm.curOp;
if
(withOp) startOperation(cm);
cm.display.
shift
= false;
if
(text.charCodeAt(0) == 0x200b && doc.sel == cm.display.selForContextMenu && !prevInput)
prevInput =
"\u200b"
;
// Find the part of the input that is actually new
var same = 0, l = Math.min(prevInput.
length
, text.
length
);
while
(same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
var inserted = text.slice(same), textLines = splitLines(inserted);
// When pasing N lines into N selections, insert one line per selection
var multiPaste = cm.state.pasteIncoming && textLines.
length
> 1 && doc.sel.ranges.
length
== textLines.
length
;
// Normal behavior is to insert the new text into every selection
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
236523662367236823692370237123722373237423752376237723782379238023812382238323842385
}));
else
on(d.scroller,
"dblclick"
, function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
// Prevent normal selection in the editor (we handle
our
own)
on(d.lineSpace,
"selectstart"
, function(e) {
if
(!eventInWidget(d, e)) e_preventDefault(e);
});
// Some browsers fire contextmenu
*after
* opening the menu, at
// which point we can't mess
with
it anymore. Context menu is
// handled in onMouseDown
for
these browsers.
if
(!captureRightClick) on(d.scroller,
"contextmenu"
, function(e) {onContextMenu(cm, e);});
// Sync scrolling between fake scrollbars and real scrollable
// area, ensure viewport is updated
when
scrolling.
on(d.scroller,
"scroll"
, function() {
if
(d.scroller.clientHeight) {
setScrollTop(cm, d.scroller.scrollTop);
setScrollLeft(cm, d.scroller.scrollLeft, true);
signal(cm,
"scroll"
, cm);
}
});
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
254825492550255125522553255425552556255725582559256025612562256325642565256625672568
else
if
(e_target(e) == display.scroller)
e_preventDefault(e);
break;
case 2:
if
(webkit) cm.state.lastMiddleDown = +new Date;
if
(start) extendSelection(cm.doc, start);
setTimeout(
bind
(focusInput, cm), 20);
e_preventDefault(e);
break;
case 3:
if
(captureRightClick) onContextMenu(cm, e);
break;
}
}
var lastClick, lastDoubleClick;
function leftButtonDown(cm, e, start) {
setTimeout(
bind
(ensureFocus, cm), 0);
var now = +new Date, type;
if
(lastDoubleClick && lastDoubleClick.
time
> now - 400 && cmp(lastDoubleClick.
pos
, start) == 0) {
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
311031113112311331143115311631173118311931203121312231233124312531263127312831293130function onFocus(cm) {
if
(cm.options.readOnly ==
"nocursor"
)
return
;
if
(!cm.state.focused) {
signal(cm,
"focus"
, cm);
cm.state.focused = true;
addClass(cm.display.wrapper,
"CodeMirror-focused"
);
// The prevInput test prevents this from firing
when
a context
// menu is closed (since the resetInput would
kill
the
//
select
-all detection hack)
if
(!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
resetInput(cm);
if
(webkit) setTimeout(
bind
(resetInput, cm, true), 0); // Issue
#1730
}
}
slowPoll(cm);
restartBlink(cm);
}
function onBlur(cm) {
if
(cm.state.focused) {
signal(cm,
"blur"
, cm);
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204
}
clearInterval(cm.display.blinker);
setTimeout(function() {
if
(!cm.state.focused) cm.display.
shift
= false;}, 150);
}
// CONTEXT MENU HANDLING
// To make the context menu work, we need to briefly unhide the
// textarea (making it as unobtrusive as possible) to let the
// right-click take effect on it.
function onContextMenu(cm, e) {
if
(signalDOMEvent(cm, e,
"contextmenu"
))
return
;
var display = cm.display;
if
(eventInWidget(display, e) || contextMenuInGutter(cm, e))
return
;
var
pos
= posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
if
(!
pos
|| presto)
return
; // Opera is difficult.
// Reset the current text selection only
if
the click is done outside of the selection
// and
'resetSelectionOnContextMenu'
option is true.
var
reset
= cm.options.resetSelectionOnContextMenu;
if
(
reset
&& cm.doc.sel.contains(
pos
) == -1)
operation(cm, setSelection)(cm.doc, simpleSelection(
pos
), sel_dontScroll);
var oldCSS = display.input.style.cssText;
display.inputDiv.style.position =
"absolute"
;
display.input.style.cssText =
"position: fixed; width: 30px; height: 30px; top: "
+ (e.clientY - 5) +
"px; left: "
+ (e.clientX - 5) +
"px; z-index: 1000; background: "
+
(ie ?
"rgba(255, 255, 255, .05)"
:
"transparent"
) +
"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"
;
focusInput(cm);
resetInput(cm);
// Adds
"Select all"
to context menu in FF
if
(!cm.somethingSelected()) display.input.value = display.prevInput =
" "
;
display.selForContextMenu = cm.doc.sel;
clearTimeout(display.detectingSelectAll);
// Select-all will be greyed out
if
there's nothing to
select
, so
// this adds a zero-width space so that we can later check whether
// it got selected.
function prepareSelectAllHack() {
if
(display.input.selectionStart != null) {
var selected = cm.somethingSelected();
var extval = display.input.value =
"\u200b"
+ (selected ? display.input.value :
""
);
display.prevInput = selected ?
""
:
"\u200b"
;
display.input.selectionStart = 1; display.input.selectionEnd = extval.
length
;
// Re-set this, in case some other handler touched the
// selection in the meantime.
display.selForContextMenu = cm.doc.sel;
}
}
function rehide() {
display.inputDiv.style.position =
"relative"
;
display.input.style.cssText = oldCSS;
if
(ie_upto8) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
slowPoll(cm);
// Try to detect the user choosing
select
-all
if
(display.input.selectionStart != null) {
if
(!ie || ie_upto8) prepareSelectAllHack();
var i = 0, poll = function() {
if
(display.selForContextMenu == cm.doc.sel && display.input.selectionStart == 0)
operation(cm, commands.selectAll)(cm);
else
if
(i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);
else
resetInput(cm);
};
display.detectingSelectAll = setTimeout(poll, 200);
}
}
if
(ie && !ie_upto8) prepareSelectAllHack();
if
(captureRightClick) {
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
32063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228
var mouseup = function() {
off(window,
"mouseup"
, mouseup);
setTimeout(rehide, 20);
};
on(window,
"mouseup"
, mouseup);
}
else
{
setTimeout(rehide, 50);
}
}
function contextMenuInGutter(cm, e) {
if
(!hasHandler(cm,
"gutterContextMenu"
))
return
false;
return
gutterEvent(cm, e,
"gutterContextMenu"
, false, signal);
}
// UPDATING
// Compute the position of the end of a change (its
'to'
property
// refers to the pre-change end).
var changeEnd = CodeMirror.changeEnd = function(change) {
if
(!change.text)
return
change.to;
return
Pos(change.from.line + change.text.
length
- 1,
lst(change.text).
length
+ (change.text.
length
== 1 ? change.from.ch : 0));
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
350435053506350735083509351035113512351335143515351635173518351935203521352235233524
if
(changeHandler || changesHandler) {
var obj = {
from: from, to: to,
text: change.text,
removed: change.removed,
origin: change.origin
};
if
(changeHandler) signalLater(cm,
"change"
, cm, obj);
if
(changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).
push
(obj);
}
cm.display.selForContextMenu = null;
}
function replaceRange(doc, code, from, to, origin) {
if
(!to) to = from;
if
(cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
if
(typeof code ==
"string"
) code = splitLines(code);
makeChange(doc, {from: from, to: to, text: code, origin: origin});
}
// SCROLLING THINGS INTO VIEW
lib/Farabi/files/public/assets/codemirror/lib/codemirror.js view on Meta::CPAN
435543564357435843594360436143624363436443654366436743684369437043714372437343744375}, true);
option(
"coverGutterNextToScrollbar"
, false, updateScrollbars, true);
option(
"lineNumbers"
, false, function(cm) {
setGuttersForLineNumbers(cm.options);
guttersChanged(cm);
}, true);
option(
"firstLineNumber"
, 1, guttersChanged, true);
option(
"lineNumberFormatter"
, function(integer) {
return
integer;}, guttersChanged, true);
option(
"showCursorWhenSelecting"
, false, updateSelection, true);
option(
"resetSelectionOnContextMenu"
, true);
option(
"readOnly"
, false, function(cm, val) {
if
(val ==
"nocursor"
) {
onBlur(cm);
cm.display.input.blur();
cm.display.disabled = true;
}
else
{
cm.display.disabled = false;
if
(!val) resetInput(cm);
}
lib/Farabi/files/public/assets/jshint/jshint-1.1.0.js view on Meta::CPAN
206207208209210211212213214215216217218219220221222223224225226require
.define(
"/node_modules/underscore/package.json"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],
"module.exports = {\"main\":\"underscore.js\"}\n//@ sourceURL=/node_modules/underscore/package.json"
));
require
.define(
"/node_modules/underscore/underscore.js"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"// Underscore.js 1.4.4\n// http://underscorejs.org\n// (c) 2009-2013 Jeremy Ashkenas, DocumentClo...
));
require
.define(
"events"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"
if
(!process.EventEmitter) process.EventEmitter = function () {};\n\nvar EventEmitter = exports.EventEmitter = process.EventEmitter;\nvar isA...
));
require
.define(
"/src/shared/vars.js"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"// jshint -W001\n\n\"
use
strict\";\n\n// Identifiers provided by the ECMAScript standard.\n\nexports.reservedVars = {\n\targumen...
));
require
.define(
"/src/shared/messages.js"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"\"
use
strict\";\n\nvar _ =
require
(\"underscore\");\n\nvar errors = {\n\t// JSHint options\n\tE001: \"Bad option:
'{a}'
.\",\...
));
require
.define(
"/src/stable/lex.js"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"/*\n * Lexical analysis and token construction.\n */\n\n\"
use
strict\";\n\nvar _ =
require
(\"underscore\");\nvar events = re...
));
require
.define(
"/src/stable/reg.js"
,Function([
'require'
,
'module'
,
'exports'
,
'__dirname'
,
'__filename'
,
'process'
,
'global'
],"/*\n * Regular expressions. Some of these are stupidly long.\n */\n\n/
*jshint
maxlen:1000 */\n\n\"
use
string\";\n\n// Unsafe comm...
));