Apache-SdnFw
view release on metacpan or search on metacpan
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
// Import
case 3:
addClasses(r.styleSheet);
break;
}
});
};
try {
each(t.doc.styleSheets, addClasses);
} catch (ex) {
// Ignore
}
if (cl.length > 0)
t.classes = cl;
return cl;
},
run : function(e, f, s) {
var t = this, o;
if (t.doc && typeof(e) === 'string')
e = t.get(e);
if (!e)
return false;
s = s || this;
if (!e.nodeType && (e.length || e.length === 0)) {
o = [];
each(e, function(e, i) {
if (e) {
if (typeof(e) == 'string')
e = t.doc.getElementById(e);
o.push(f.call(s, e, i));
}
});
return o;
}
return f.call(s, e);
},
getAttribs : function(n) {
var o;
n = this.get(n);
if (!n)
return [];
if (isIE) {
o = [];
// Object will throw exception in IE
if (n.nodeName == 'OBJECT')
return n.attributes;
// IE doesn't keep the selected attribute if you clone option elements
if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))
o.push({specified : 1, nodeName : 'selected'});
// It's crazy that this is faster in IE but it's because it returns all attributes all the time
n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {
o.push({specified : 1, nodeName : a});
});
return o;
}
return n.attributes;
},
destroy : function(s) {
var t = this;
if (t.events)
t.events.destroy();
t.win = t.doc = t.root = t.events = null;
// Manual destroy then remove unload handler
if (!s)
tinymce.removeUnload(t.destroy);
},
createRng : function() {
var d = this.doc;
return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
},
nodeIndex : function(node, normalized) {
var idx = 0, lastNodeType, lastNode, nodeType;
if (node) {
for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
nodeType = node.nodeType;
// Normalize text nodes
if (normalized && nodeType == 3) {
if (nodeType == lastNodeType || !node.nodeValue.length)
continue;
}
idx++;
lastNodeType = nodeType;
}
}
return idx;
},
split : function(pe, e, re) {
var t = this, r = t.createRng(), bef, aft, pa;
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
ctrlRng.scrollIntoView();
return;
} catch (ex) {
// Ignore
}
}
}
// Set start/end point of selection
setEndPoint(true);
setEndPoint();
// Select the new range and scroll it into view
ieRng.select();
ieRng.scrollIntoView();
};
this.getRangeAt = function() {
// Setup new range if the cache is empty
if (!range || !tinymce.dom.RangeUtils.compareRanges(lastIERng, selection.getRng())) {
range = getRange();
// Store away text range for next call
lastIERng = selection.getRng();
}
// IE will say that the range is equal then produce an invalid argument exception
// if you perform specific operations in a keyup event. For example Ctrl+Del.
// This hack will invalidate the range cache if the exception occurs
try {
range.startContainer.nextSibling;
} catch (ex) {
range = getRange();
lastIERng = null;
}
// Return cached range
return range;
};
this.destroy = function() {
// Destroy cached range and last IE range to avoid memory leaks
lastIERng = range = null;
};
// IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode
if (selection.dom.boxModel) {
(function() {
var doc = dom.doc, body = doc.body, started, startRng;
// Make HTML element unselectable since we are going to handle selection by hand
doc.documentElement.unselectable = TRUE;
// Return range from point or null if it failed
function rngFromPoint(x, y) {
var rng = body.createTextRange();
try {
rng.moveToPoint(x, y);
} catch (ex) {
// IE sometimes throws and exception, so lets just ignore it
rng = null;
}
return rng;
};
// Fires while the selection is changing
function selectionChange(e) {
var pointRng;
// Check if the button is down or not
if (e.button) {
// Create range from mouse position
pointRng = rngFromPoint(e.x, e.y);
if (pointRng) {
// Check if pointRange is before/after selection then change the endPoint
if (pointRng.compareEndPoints('StartToStart', startRng) > 0)
pointRng.setEndPoint('StartToStart', startRng);
else
pointRng.setEndPoint('EndToEnd', startRng);
pointRng.select();
}
} else
endSelection();
}
// Removes listeners
function endSelection() {
dom.unbind(doc, 'mouseup', endSelection);
dom.unbind(doc, 'mousemove', selectionChange);
started = 0;
};
// Detect when user selects outside BODY
dom.bind(doc, 'mousedown', function(e) {
if (e.target.nodeName === 'HTML') {
if (started)
endSelection();
started = 1;
// Setup start position
startRng = rngFromPoint(e.x, e.y);
if (startRng) {
// Listen for selection change events
dom.bind(doc, 'mouseup', endSelection);
dom.bind(doc, 'mousemove', selectionChange);
startRng.select();
}
}
});
})();
}
};
// Expose the selection object
tinymce.dom.TridentSelection = Selection;
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function(elem){
return elem.getAttribute("href");
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !/\W/.test(part),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function(checkSet, part){
var isPartStr = typeof part === "string",
elem, i = 0, l = checkSet.length;
if ( isPartStr && !/\W/.test(part) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
else
rng.setEndBefore(node);
return;
}
} while (node = (start ? walker.next() : walker.prev()));
};
setPoint(node, 1);
setPoint(node);
}
t.setRng(rng);
return node;
},
isCollapsed : function() {
var t = this, r = t.getRng(), s = t.getSel();
if (!r || r.item)
return false;
if (r.compareEndPoints)
return r.compareEndPoints('StartToEnd', r) === 0;
return !s || r.collapsed;
},
collapse : function(b) {
var t = this, r = t.getRng(), n;
// Control range on IE
if (r.item) {
n = r.item(0);
r = this.win.document.body.createTextRange();
r.moveToElementText(n);
}
r.collapse(!!b);
t.setRng(r);
},
getSel : function() {
var t = this, w = this.win;
return w.getSelection ? w.getSelection() : w.document.selection;
},
getRng : function(w3c) {
var t = this, s, r;
// Found tridentSel object then we need to use that one
if (w3c && t.tridentSel)
return t.tridentSel.getRangeAt(0);
try {
if (s = t.getSel())
r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange());
} catch (ex) {
// IE throws unspecified error here if TinyMCE is placed in a frame/iframe
}
// No range found then create an empty one
// This can occur when the editor is placed in a hidden container element on Gecko
// Or on IE when there was an exception
if (!r)
r = t.win.document.createRange ? t.win.document.createRange() : t.win.document.body.createTextRange();
if (t.selectedRange && t.explicitRange) {
if (r.compareBoundaryPoints(r.START_TO_START, t.selectedRange) === 0 && r.compareBoundaryPoints(r.END_TO_END, t.selectedRange) === 0) {
// Safari, Opera and Chrome only ever select text which causes the range to change.
// This lets us use the originally set range if the selection hasn't been changed by the user.
r = t.explicitRange;
} else {
t.selectedRange = null;
t.explicitRange = null;
}
}
return r;
},
setRng : function(r) {
var s, t = this;
if (!t.tridentSel) {
s = t.getSel();
if (s) {
t.explicitRange = r;
s.removeAllRanges();
s.addRange(r);
t.selectedRange = s.getRangeAt(0);
}
} else {
// Is W3C Range
if (r.cloneRange) {
t.tridentSel.addRange(r);
return;
}
// Is IE specific range
try {
r.select();
} catch (ex) {
// Needed for some odd IE bug #1843306
}
}
},
setNode : function(n) {
var t = this;
t.setContent(t.dom.getOuterHTML(n));
return n;
},
getNode : function() {
var t = this, rng = t.getRng(), sel = t.getSel(), elm;
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
return s.replace(/[<>&"]/g, function(v) {
switch (v) {
case '<':
return '<';
case '>':
return '>';
case '&':
return '&';
case '"':
return '"';
}
return v;
});
},
getContent : function() {
return this.str;
},
_writeAttributesEnd : function(s) {
if (!this.inAttr)
return;
this.inAttr = false;
if (s && this.elementCount == this.count) {
this.writeRaw(' />');
return false;
}
this.writeRaw('>');
return true;
}
});
})(tinymce);
(function(tinymce) {
// Shorten names
var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;
function wildcardToRE(s) {
return s.replace(/([?+*])/g, '.$1');
};
tinymce.create('tinymce.dom.Serializer', {
Serializer : function(s) {
var t = this;
t.key = 0;
t.onPreProcess = new Dispatcher(t);
t.onPostProcess = new Dispatcher(t);
try {
t.writer = new tinymce.dom.XMLWriter();
} catch (ex) {
// IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter
t.writer = new tinymce.dom.StringWriter();
}
// Default settings
t.settings = s = extend({
dom : tinymce.DOM,
valid_nodes : 0,
node_filter : 0,
attr_filter : 0,
invalid_attrs : /^(_mce_|_moz_|sizset|sizcache)/,
closed : /^(br|hr|input|meta|img|link|param|area)$/,
entity_encoding : 'named',
entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,1...
valid_elements : '*[*]',
extended_valid_elements : 0,
invalid_elements : 0,
fix_table_elements : 1,
fix_list_elements : true,
fix_content_duplication : true,
convert_fonts_to_spans : false,
font_size_classes : 0,
apply_source_formatting : 0,
indent_mode : 'simple',
indent_char : '\t',
indent_levels : 1,
remove_linebreaks : 1,
remove_redundant_brs : 1,
element_format : 'xhtml'
}, s);
t.dom = s.dom;
t.schema = s.schema;
// Use raw entities if no entities are defined
if (s.entity_encoding == 'named' && !s.entities)
s.entity_encoding = 'raw';
if (s.remove_redundant_brs) {
t.onPostProcess.add(function(se, o) {
// Remove single BR at end of block elements since they get rendered
o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) {
// Check if it's a single element
if (/^<br \/>\s*<\//.test(a))
return '</' + c + '>';
return a;
});
});
}
// Remove XHTML element endings i.e. produce crap :) XHTML is better
if (s.element_format == 'html') {
t.onPostProcess.add(function(se, o) {
o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>');
});
}
if (s.fix_list_elements) {
t.onPreProcess.add(function(se, o) {
var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
ev = 'resizestart';
cb = t.dom.bind(e, 'resizestart', Event.cancel, Event);
}
re = t.resizeInfo = {
node : e,
ev : ev,
cb : cb
};
});
t.onKeyDown.add(function(ed, e) {
switch (e.keyCode) {
case 8:
// Fix IE control + backspace browser bug
if (t.selection.getRng().item) {
ed.dom.remove(t.selection.getRng().item(0));
return Event.cancel(e);
}
}
});
/*if (t.dom.boxModel) {
t.getBody().style.height = '100%';
Event.add(t.getWin(), 'resize', function(e) {
var docElm = t.getDoc().documentElement;
docElm.style.height = (docElm.offsetHeight - 10) + 'px';
});
}*/
}
if (tinymce.isOpera) {
t.onClick.add(function(ed, e) {
Event.prevent(e);
});
}
// Add custom undo/redo handlers
if (s.custom_undo_redo) {
function addUndo() {
t.undoManager.typing = 0;
t.undoManager.add();
};
t.dom.bind(t.getDoc(), 'focusout', function(e) {
if (!t.removed && t.undoManager.typing)
addUndo();
});
t.onKeyUp.add(function(ed, e) {
if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey)
addUndo();
});
t.onKeyDown.add(function(ed, e) {
var rng, parent, bookmark;
// IE has a really odd bug where the DOM might include an node that doesn't have
// a proper structure. If you try to access nodeValue it would throw an illegal value exception.
// This seems to only happen when you delete contents and it seems to be avoidable if you refresh the element
// after you delete contents from it. See: #3008923
if (isIE && e.keyCode == 46) {
rng = t.selection.getRng();
if (rng.parentElement) {
parent = rng.parentElement();
// Select next word when ctrl key is used in combo with delete
if (e.ctrlKey) {
rng.moveEnd('word', 1);
rng.select();
}
// Delete contents
t.selection.getSel().clear();
// Check if we are within the same parent
if (rng.parentElement() == parent) {
bookmark = t.selection.getBookmark();
try {
// Update the HTML and hopefully it will remove the artifacts
parent.innerHTML = parent.innerHTML;
} catch (ex) {
// And since it's IE it can sometimes produce an unknown runtime error
}
// Restore the caret position
t.selection.moveToBookmark(bookmark);
}
// Block the default delete behavior since it might be broken
e.preventDefault();
return;
}
}
// Is caracter positon keys
if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
if (t.undoManager.typing)
addUndo();
return;
}
if (!t.undoManager.typing) {
t.undoManager.add();
t.undoManager.typing = 1;
}
});
t.onMouseDown.add(function() {
if (t.undoManager.typing)
addUndo();
});
}
},
_isHidden : function() {
( run in 1.410 second using v1.01-cache-2.11-cpan-39bf76dae61 )