view release on metacpan or search on metacpan
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
return v ? n : '';
}
// Inner input elements will override attributes on form elements
if (e.nodeName === "FORM" && e.getAttributeNode(n))
return e.getAttributeNode(n).nodeValue;
if (n === 'style') {
v = v || e.style.cssText;
if (v) {
v = t.serializeStyle(t.parseStyle(v), e.nodeName);
if (t.settings.keep_values && !t._isRes(v))
e.setAttribute('_mce_style', v);
}
}
// Remove Apple and WebKit stuff
if (isWebKit && n === "class" && v)
v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
// Handle IE issues
if (isIE) {
switch (n) {
case 'rowspan':
case 'colspan':
// IE returns 1 as default value
if (v === 1)
v = '';
break;
case 'size':
// IE returns +0 as default value for size
if (v === '+0' || v === 20 || v === 0)
v = '';
break;
case 'width':
case 'height':
case 'vspace':
case 'checked':
case 'disabled':
case 'readonly':
if (v === 0)
v = '';
break;
case 'hspace':
// IE returns -1 as default value
if (v === -1)
v = '';
break;
case 'maxlength':
case 'tabindex':
// IE returns default value
if (v === 32768 || v === 2147483647 || v === '32768')
v = '';
break;
case 'multiple':
case 'compact':
case 'noshade':
case 'nowrap':
if (v === 65535)
return n;
return dv;
case 'shape':
v = v.toLowerCase();
break;
default:
// IE has odd anonymous function for event attributes
if (n.indexOf('on') === 0 && v)
v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1');
}
}
return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
},
getPos : function(n, ro) {
var t = this, x = 0, y = 0, e, d = t.doc, r;
n = t.get(n);
ro = ro || d.body;
if (n) {
// Use getBoundingClientRect on IE, Opera has it but it's not perfect
if (isIE && !t.stdMode) {
n = n.getBoundingClientRect();
e = t.boxModel ? d.documentElement : d.body;
x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border
x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x;
return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
}
r = n;
while (r && r != ro && r.nodeType) {
x += r.offsetLeft || 0;
y += r.offsetTop || 0;
r = r.offsetParent;
}
r = n.parentNode;
while (r && r != ro && r.nodeType) {
x -= r.scrollLeft || 0;
y -= r.scrollTop || 0;
r = r.parentNode;
}
}
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
var i, children = node.childNodes;
if (node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark')
return;
for (i = children.length - 1; i >= 0; i--)
trim(children[i]);
if (node.nodeType != 9) {
// Keep non whitespace text nodes
if (node.nodeType == 3 && node.nodeValue.length > 0)
return;
if (node.nodeType == 1) {
// If the only child is a bookmark then move it up
children = node.childNodes;
if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('_mce_type') == 'bookmark')
node.parentNode.insertBefore(children[0], node);
// Keep non empty elements or img, hr etc
if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))
return;
}
t.remove(node);
}
return node;
};
if (pe && e) {
// Get before chunk
r.setStart(pe.parentNode, t.nodeIndex(pe));
r.setEnd(e.parentNode, t.nodeIndex(e));
bef = r.extractContents();
// Get after chunk
r = t.createRng();
r.setStart(e.parentNode, t.nodeIndex(e) + 1);
r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);
aft = r.extractContents();
// Insert before chunk
pa = pe.parentNode;
pa.insertBefore(trim(bef), pe);
// Insert middle chunk
if (re)
pa.replaceChild(re, e);
else
pa.insertBefore(e, pe);
// Insert after chunk
pa.insertBefore(trim(aft), pe);
t.remove(pe);
return re || e;
}
},
bind : function(target, name, func, scope) {
var t = this;
if (!t.events)
t.events = new tinymce.dom.EventUtils();
return t.events.add(target, name, func, scope || this);
},
unbind : function(target, name, func) {
var t = this;
if (!t.events)
t.events = new tinymce.dom.EventUtils();
return t.events.remove(target, name, func);
},
_findSib : function(node, selector, name) {
var t = this, f = selector;
if (node) {
// If expression make a function of it using is
if (is(f, 'string')) {
f = function(node) {
return t.is(node, selector);
};
}
// Loop all siblings
for (node = node[name]; node; node = node[name]) {
if (f(node))
return node;
}
}
return null;
},
_isRes : function(c) {
// Is live resizble element
return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);
}
/*
walk : function(n, f, s) {
var d = this.doc, w;
if (d.createTreeWalker) {
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
while ((n = w.nextNode()) != null)
f.call(s || this, n);
} else
tinymce.walk(n, f, 'childNodes', s);
}
*/
/*
toRGB : function(s) {
var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
if (c) {
// #FFF -> #FFFFFF
if (!is(c[3]))
c[3] = c[2] = c[1];
return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
}
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
} 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;
})();
/*
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function(){
baseHasDuplicate = false;
return 0;
});
var Sizzle = function(selector, context, results, seed) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
soFar = selector, ret, cur, pop, i;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec("");
m = chunker.exec(soFar);
if ( m ) {
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
// Do we need to do something?
if (va != t.selectedValue) {
// Find item
each(t.items, function(o, i) {
if (f(o.value)) {
fv = 1;
t.selectByIndex(i);
return false;
}
});
if (!fv)
t.selectByIndex(-1);
}
},
selectByIndex : function(idx) {
var t = this, e, o;
if (idx != t.selectedIndex) {
e = DOM.get(t.id + '_text');
o = t.items[idx];
if (o) {
t.selectedValue = o.value;
t.selectedIndex = idx;
DOM.setHTML(e, DOM.encode(o.title));
DOM.removeClass(e, 'mceTitle');
} else {
DOM.setHTML(e, DOM.encode(t.settings.title));
DOM.addClass(e, 'mceTitle');
t.selectedValue = t.selectedIndex = null;
}
e = 0;
}
},
add : function(n, v, o) {
var t = this;
o = o || {};
o = tinymce.extend(o, {
title : n,
value : v
});
t.items.push(o);
t.onAdd.dispatch(t, o);
},
getLength : function() {
return this.items.length;
},
renderHTML : function() {
var h = '', t = this, s = t.settings, cp = t.classPrefix;
h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';
h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';
h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>';
h += '</tr></tbody></table>';
return h;
},
showMenu : function() {
var t = this, p1, p2, e = DOM.get(this.id), m;
if (t.isDisabled() || t.items.length == 0)
return;
if (t.menu && t.menu.isMenuVisible)
return t.hideMenu();
if (!t.isMenuRendered) {
t.renderMenu();
t.isMenuRendered = true;
}
p1 = DOM.getPos(this.settings.menu_container);
p2 = DOM.getPos(e);
m = t.menu;
m.settings.offset_x = p2.x;
m.settings.offset_y = p2.y;
m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus
// Select in menu
if (t.oldID)
m.items[t.oldID].setSelected(0);
each(t.items, function(o) {
if (o.value === t.selectedValue) {
m.items[o.id].setSelected(1);
t.oldID = o.id;
}
});
m.showMenu(0, e.clientHeight);
Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
DOM.addClass(t.id, t.classPrefix + 'Selected');
//DOM.get(t.id + '_text').focus();
},
hideMenu : function(e) {
var t = this;
if (t.menu && t.menu.isMenuVisible) {
// Prevent double toogles by canceling the mouse click event to the button
if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
return;
if (!e || !DOM.getParent(e.target, '.mceMenu')) {
DOM.removeClass(t.id, t.classPrefix + 'Selected');
Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
t.menu.hideMenu();
}
}
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
'onSetContent',
'onGetContent',
'onLoadContent',
'onSaveContent',
'onNodeChange',
'onChange',
'onBeforeExecCommand',
'onExecCommand',
'onUndo',
'onRedo',
'onVisualAid',
'onSetProgressState'
], function(e) {
t[e] = new Dispatcher(t);
});
t.settings = s = extend({
id : id,
language : 'en',
docs_language : 'en',
theme : 'simple',
skin : 'default',
delta_width : 0,
delta_height : 0,
popup_css : '',
plugins : '',
document_base_url : tinymce.documentBaseURL,
add_form_submit_trigger : 1,
submit_patch : 1,
add_unload_trigger : 1,
convert_urls : 1,
relative_urls : 1,
remove_script_host : 1,
table_inline_editing : 0,
object_resizing : 1,
cleanup : 1,
accessibility_focus : 1,
custom_shortcuts : 1,
custom_undo_redo_keyboard_shortcuts : 1,
custom_undo_redo_restore_selection : 1,
custom_undo_redo : 1,
doctype : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll
visual_table_class : 'mceItemTable',
visual : 1,
font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
apply_source_formatting : 1,
directionality : 'ltr',
forced_root_block : 'p',
valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|titl...
hidden_input : 1,
padd_empty_editor : 1,
render_ui : 1,
init_theme : 1,
force_p_newlines : 1,
indentation : '30px',
keep_styles : 1,
fix_table_elements : 1,
inline_styles : 1,
convert_fonts_to_spans : true
}, s);
t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
base_uri : tinyMCE.baseURI
});
t.baseURI = tinymce.baseURI;
// Call setup
t.execCallback('setup', t);
},
render : function(nst) {
var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;
// Page is not loaded yet, wait for it
if (!Event.domLoaded) {
Event.add(document, 'init', function() {
t.render();
});
return;
}
tinyMCE.settings = s;
// Element not found, then skip initialization
if (!t.getElement())
return;
// Is a iPad/iPhone, then skip initialization. We need to sniff here since the
// browser says it has contentEditable support but there is no visible caret
// We will remove this check ones Apple implements full contentEditable support
if (tinymce.isIDevice)
return;
// Add hidden input for non input elements inside form elements
if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
if (tinymce.WindowManager)
t.windowManager = new tinymce.WindowManager(t);
if (s.encoding == 'xml') {
t.onGetContent.add(function(ed, o) {
if (o.save)
o.content = DOM.encode(o.content);
});
}
if (s.add_form_submit_trigger) {
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
if (!t.settings.content_editable) {
Event.clear(t.getWin());
Event.clear(t.getDoc());
}
Event.clear(t.getBody());
Event.clear(t.formElement);
}
if (t.formElement) {
t.formElement.submit = t.formElement._mceOldSubmit;
t.formElement._mceOldSubmit = null;
}
t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;
if (t.selection)
t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
t.destroyed = 1;
},
// Internal functions
_addEvents : function() {
// 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
var t = this, i, s = t.settings, lo = {
mouseup : 'onMouseUp',
mousedown : 'onMouseDown',
click : 'onClick',
keyup : 'onKeyUp',
keydown : 'onKeyDown',
keypress : 'onKeyPress',
submit : 'onSubmit',
reset : 'onReset',
contextmenu : 'onContextMenu',
dblclick : 'onDblClick',
paste : 'onPaste' // Doesn't work in all browsers yet
};
function eventHandler(e, o) {
var ty = e.type;
// Don't fire events when it's removed
if (t.removed)
return;
// Generic event handler
if (t.onEvent.dispatch(t, e, o) !== false) {
// Specific event handler
t[lo[e.fakeType || e.type]].dispatch(t, e, o);
}
};
// Add DOM events
each(lo, function(v, k) {
switch (k) {
case 'contextmenu':
if (tinymce.isOpera) {
// Fake contextmenu on Opera
t.dom.bind(t.getBody(), 'mousedown', function(e) {
if (e.ctrlKey) {
e.fakeType = 'contextmenu';
eventHandler(e);
}
});
} else
t.dom.bind(t.getBody(), k, eventHandler);
break;
case 'paste':
t.dom.bind(t.getBody(), k, function(e) {
eventHandler(e);
});
break;
case 'submit':
case 'reset':
t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
break;
default:
t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
}
});
t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
t.focus(true);
});
// Fixes bug where a specified document_base_uri could result in broken images
// This will also fix drag drop of images in Gecko
if (tinymce.isGecko) {
// Convert all images to absolute URLs
/* t.onSetContent.add(function(ed, o) {
each(ed.dom.select('img'), function(e) {
var v;
if (v = e.getAttribute('_mce_src'))
e.src = t.documentBaseURI.toAbsolute(v);
})
});*/
t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {
var v;
e = e.target;
if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('_mce_src')))
e.src = t.documentBaseURI.toAbsolute(v);
});
}
// Set various midas options in Gecko
if (isGecko) {
function setOpts() {
var t = this, d = t.getDoc(), s = t.settings;
if (isGecko && !s.readonly) {
if (t._isHidden()) {
try {
if (!s.content_editable)
d.designMode = 'On';
} catch (ex) {
// Fails if it's hidden
}
}
try {
// Try new Gecko method
d.execCommand("styleWithCSS", 0, false);
} catch (ex) {
// Use old method
if (!t._isHidden())
try {d.execCommand("useCSS", 0, true);} catch (ex) {}
}
if (!s.table_inline_editing)
try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
if (!s.object_resizing)
try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
}
};
t.onBeforeExecCommand.add(setOpts);
t.onMouseDown.add(setOpts);
}
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
// WebKit can't even do simple things like selecting an image
// This also fixes so it's possible to select mceItemAnchors
if (tinymce.isWebKit) {
t.onClick.add(function(ed, e) {
e = e.target;
// Needs tobe the setBaseAndExtend or it will fail to select floated images
if (e.nodeName == 'IMG' || (e.nodeName == 'A' && t.dom.hasClass(e, 'mceItemAnchor')))
t.selection.getSel().setBaseAndExtent(e, 0, e, 1);
});
}
// Add node change handlers
t.onMouseUp.add(t.nodeChanged);
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);
t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);
function find(e) {
var v = null;
if (!e.altKey && !e.ctrlKey && !e.metaKey)
return v;
each(t.shortcuts, function(o) {
if (tinymce.isMac && o.ctrl != e.metaKey)
return;
else if (!tinymce.isMac && o.ctrl != e.ctrlKey)
return;
if (o.alt != e.altKey)
return;
if (o.shift != e.shiftKey)
return;
if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
v = o;
return false;
}
});
return v;
};
t.onKeyUp.add(function(ed, e) {
var o = find(e);
if (o)
return Event.cancel(e);
});
t.onKeyPress.add(function(ed, e) {
var o = find(e);
if (o)
return Event.cancel(e);
});
t.onKeyDown.add(function(ed, e) {
var o = find(e);
if (o) {
o.func.call(o.scope);
return Event.cancel(e);
}
});
}
if (tinymce.isIE) {
// Fix so resize will only update the width and height attributes not the styles of an image
// It will also block mceItemNoResize items
t.dom.bind(t.getDoc(), 'controlselect', function(e) {
var re = t.resizeInfo, cb;
e = e.target;
// Don't do this action for non image elements
if (e.nodeName !== 'IMG')
return;
if (re)
t.dom.unbind(re.node, re.ev, re.cb);
if (!t.dom.hasClass(e, 'mceItemNoResize')) {
ev = 'resizeend';
cb = t.dom.bind(e, ev, function(e) {
var v;
e = e.target;
if (v = t.dom.getStyle(e, 'width')) {
t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
t.dom.setStyle(e, 'width', '');
}
if (v = t.dom.getStyle(e, 'height')) {
t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
t.dom.setStyle(e, 'height', '');
}
});
} else {
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;
}
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
// Check if it already exists then ignore it
for (i = currentPendingFormats.length - 1; i >= 0; i--) {
if (currentPendingFormats[i].name == name)
return;
}
currentPendingFormats.push({name : name, vars : vars});
// Check if it's in the other type, then remove it
for (i = otherPendingFormats.length - 1; i >= 0; i--) {
if (otherPendingFormats[i].name == name)
otherPendingFormats.splice(i, 1);
}
// Pending apply or remove formats
if (hasPending()) {
ed.getDoc().execCommand('FontName', false, 'mceinline');
pendingFormats.lastRng = selection.getRng();
// IE will convert the current word
each(dom.select('font,span'), function(node) {
var bookmark;
if (isCaretNode(node)) {
bookmark = selection.getBookmark();
perform(node);
selection.moveToBookmark(bookmark);
ed.nodeChanged();
}
});
// Only register listeners once if we need to
if (!pendingFormats.isListening && hasPending()) {
pendingFormats.isListening = true;
each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) {
ed[event].addToTop(function(ed, e) {
// Do we have pending formats and is the selection moved has moved
if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) {
each(dom.select('font,span'), function(node) {
var textNode, rng;
// Look for marker
if (isCaretNode(node)) {
textNode = node.firstChild;
if (textNode) {
perform(node);
rng = dom.createRng();
rng.setStart(textNode, textNode.nodeValue.length);
rng.setEnd(textNode, textNode.nodeValue.length);
selection.setRng(rng);
ed.nodeChanged();
} else
dom.remove(node);
}
});
// Always unbind and clear pending styles on keyup
if (e.type == 'keyup' || e.type == 'mouseup')
resetPending();
}
});
});
}
}
};
};
})(tinymce);
tinymce.onAddEditor.add(function(tinymce, ed) {
var filters, fontSizes, dom, settings = ed.settings;
if (settings.inline_styles) {
fontSizes = tinymce.explode(settings.font_size_style_values);
function replaceWithSpan(node, styles) {
dom.replace(dom.create('span', {
style : styles
}), node, 1);
};
filters = {
font : function(dom, node) {
replaceWithSpan(node, {
backgroundColor : node.style.backgroundColor,
color : node.color,
fontFamily : node.face,
fontSize : fontSizes[parseInt(node.size) - 1]
});
},
u : function(dom, node) {
replaceWithSpan(node, {
textDecoration : 'underline'
});
},
strike : function(dom, node) {
replaceWithSpan(node, {
textDecoration : 'line-through'
});
}
};
function convert(editor, params) {
dom = editor.dom;
if (settings.convert_fonts_to_spans) {
tinymce.each(dom.select('font,u,strike', params.node), function(node) {
filters[node.nodeName.toLowerCase()](ed.dom, node);
});
}
};
ed.onPreProcess.add(convert);
ed.onInit.add(function() {
ed.selection.onSetContent.add(convert);