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
tmpRng.moveToElementText(marker);
} else {
// Empty node selection for example <div>|</div>
marker = doc.createTextNode(invisibleChar);
container.appendChild(marker);
tmpRng.moveToElementText(marker.parentNode);
tmpRng.collapse(TRUE);
}
ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
dom.remove(marker);
}
}
// Destroy cached range
this.destroy();
// Setup some shorter versions
startContainer = rng.startContainer;
startOffset = rng.startOffset;
endContainer = rng.endContainer;
endOffset = rng.endOffset;
ieRng = body.createTextRange();
// If single element selection then try making a control selection out of it
if (startContainer == endContainer && startContainer.nodeType == 1 && startOffset == endOffset - 1) {
if (startOffset == endOffset - 1) {
try {
ctrlRng = body.createControlRange();
ctrlRng.addElement(startContainer.childNodes[startOffset]);
ctrlRng.select();
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();
}
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed, keep, type, scopeName;
if (!s.node_filter || s.node_filter(n)) {
switch (n.nodeType) {
case 1: // Element
if (n.hasAttribute ? n.hasAttribute('_mce_bogus') : n.getAttribute('_mce_bogus'))
return;
iv = keep = false;
hc = n.hasChildNodes();
nn = n.getAttribute('_mce_name') || n.nodeName.toLowerCase();
// Get internal type
type = n.getAttribute('_mce_type');
if (type) {
if (!t._info.cleanup) {
iv = true;
return;
} else
keep = 1;
}
// Add correct prefix on IE
if (isIE) {
scopeName = n.scopeName;
if (scopeName && scopeName !== 'HTML' && scopeName !== 'html')
nn = scopeName + ':' + nn;
}
// Remove mce prefix on IE needed for the abbr element
if (nn.indexOf('mce:') === 0)
nn = nn.substring(4);
// Check if valid
if (!keep) {
if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inner) {
iv = true;
break;
}
}
if (isIE) {
// Fix IE content duplication (DOM can have multiple copies of the same node)
if (s.fix_content_duplication) {
if (n._mce_serialized == t.key)
return;
n._mce_serialized = t.key;
}
// IE sometimes adds a / infront of the node name
if (nn.charAt(0) == '/')
nn = nn.substring(1);
} else if (isGecko) {
// Ignore br elements
if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz')
return;
}
// Check if valid child
if (s.validate_children) {
if (t.elementName && !t.schema.isValid(t.elementName, nn)) {
iv = true;
break;
}
t.elementName = nn;
}
ru = t.findRule(nn);
// No valid rule for this element could be found then skip it
if (!ru) {
iv = true;
break;
}
nn = ru.name || nn;
closed = s.closed.test(nn);
// Skip empty nodes or empty node name in IE
if ((!hc && ru.noEmpty) || (isIE && !nn)) {
iv = true;
break;
}
// Check required
if (ru.requiredAttribs) {
a = ru.requiredAttribs;
for (i = a.length - 1; i >= 0; i--) {
if (this.dom.getAttrib(n, a[i]) !== '')
break;
}
// None of the required was there
if (i == -1) {
iv = true;
break;
}
}
w.writeStartElement(nn);
// Add ordered attributes
if (ru.attribs) {
for (i=0, at = ru.attribs, l = at.length; i<l; i++) {
a = at[i];
v = t._getAttrib(n, a);
if (v !== null)
w.writeAttribute(a.name, v);
}
}
// Add wild attributes
if (ru.validAttribsRE) {
at = t.dom.getAttribs(n);
for (i=at.length-1; i>-1; i--) {
no = at[i];
if (no.specified) {
a = no.nodeName.toLowerCase();
if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))
continue;
ar = t.findAttribRule(ru, a);
v = t._getAttrib(n, ar, a);
if (v !== null)
w.writeAttribute(a, v);
}
}
}
// Keep type attribute
if (type && keep)
w.writeAttribute('_mce_type', type);
// Write text from script
if (nn === 'script' && tinymce.trim(n.innerHTML)) {
w.writeText('// '); // Padd it with a comment so it will parse on older browsers
w.writeCDATA(n.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g, '')); // Remove comments and cdata stuctures
hc = false;
break;
}
// Padd empty nodes with a
if (ru.padd) {
// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug
if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {
if (cn.hasAttribute ? cn.hasAttribute('_mce_bogus') : cn.getAttribute('_mce_bogus'))
w.writeText('\u00a0');
} else if (!hc)
w.writeText('\u00a0'); // No children then padd it
}
break;
case 3: // Text
// Check if valid child
if (s.validate_children && t.elementName && !t.schema.isValid(t.elementName, '#text'))
return;
return w.writeText(n.nodeValue);
case 4: // CDATA
return w.writeCDATA(n.nodeValue);
case 8: // Comment
return w.writeComment(n.nodeValue);
}
} else if (n.nodeType == 1)
hc = n.hasChildNodes();
if (hc && !closed) {
cn = n.firstChild;
while (cn) {
t._serializeNode(cn);
t.elementName = nn;
cn = cn.nextSibling;
}
}
// Write element end
if (!iv) {
if (!closed)
w.writeFullEndElement();
else
w.writeEndElement();
}
},
_protect : function(o) {
var t = this;
o.items = o.items || [];
function enc(s) {
return s.replace(/[\r\n\\]/g, function(c) {
if (c === '\n')
return '\\n';
else if (c === '\\')
return '\\\\';
return '\\r';
});
};
function dec(s) {
return s.replace(/\\[\\rn]/g, function(c) {
if (c === '\\n')
return '\n';
else if (c === '\\\\')
return '\\';
return '\r';
});
};
each(o.patterns, function(p) {
( run in 0.529 second using v1.01-cache-2.11-cpan-39bf76dae61 )