Hopkins-Plugin-HMI
view release on metacpan or search on metacpan
share/root/static/yui/build/editor/editor-debug.js view on Meta::CPAN
* @description Fires after a nodeChange happens to setup the things that where reset on the node change (button state).
*/
_handleAfterNodeChange: function() {
var path = this._getDomPath(),
elm = null,
family = null,
fontsize = null,
validFont = false,
fn_button = this.toolbar.getButtonByValue('fontname'),
fs_button = this.toolbar.getButtonByValue('fontsize'),
hd_button = this.toolbar.getButtonByValue('heading');
for (var i = 0; i < path.length; i++) {
elm = path[i];
var tag = elm.tagName.toLowerCase();
if (elm.getAttribute('tag')) {
tag = elm.getAttribute('tag');
}
family = elm.getAttribute('face');
if (Dom.getStyle(elm, 'font-family')) {
family = Dom.getStyle(elm, 'font-family');
//Adobe AIR Code
family = family.replace(/'/g, '');
}
if (tag.substring(0, 1) == 'h') {
if (hd_button) {
for (var h = 0; h < hd_button._configs.menu.value.length; h++) {
if (hd_button._configs.menu.value[h].value.toLowerCase() == tag) {
hd_button.set('label', hd_button._configs.menu.value[h].text);
}
}
this._updateMenuChecked('heading', tag);
}
}
}
if (fn_button) {
for (var b = 0; b < fn_button._configs.menu.value.length; b++) {
if (family && fn_button._configs.menu.value[b].text.toLowerCase() == family.toLowerCase()) {
validFont = true;
family = fn_button._configs.menu.value[b].text; //Put the proper menu name in the button
}
}
if (!validFont) {
family = fn_button._configs.label._initialConfig.value;
}
var familyLabel = '<span class="yui-toolbar-fontname-' + this._cleanClassName(family) + '">' + family + '</span>';
if (fn_button.get('label') != familyLabel) {
fn_button.set('label', familyLabel);
this._updateMenuChecked('fontname', family);
}
}
if (fs_button) {
fontsize = parseInt(Dom.getStyle(elm, 'fontSize'), 10);
if ((fontsize === null) || isNaN(fontsize)) {
fontsize = fs_button._configs.label._initialConfig.value;
}
fs_button.set('label', ''+fontsize);
}
if (!this._isElement(elm, 'body') && !this._isElement(elm, 'img')) {
this.toolbar.enableButton(fn_button);
this.toolbar.enableButton(fs_button);
this.toolbar.enableButton('forecolor');
this.toolbar.enableButton('backcolor');
}
if (this._isElement(elm, 'img')) {
if (YAHOO.widget.Overlay) {
this.toolbar.enableButton('createlink');
}
}
if (this._hasParent(elm, 'blockquote')) {
this.toolbar.selectButton('indent');
this.toolbar.disableButton('indent');
this.toolbar.enableButton('outdent');
}
if (this._hasParent(elm, 'ol') || this._hasParent(elm, 'ul')) {
this.toolbar.disableButton('indent');
}
this._lastButton = null;
},
/**
* @private
* @method _handleInsertImageClick
* @description Opens the Image Properties Window when the insert Image button is clicked or an Image is Double Clicked.
*/
_handleInsertImageClick: function() {
if (this.get('limitCommands')) {
if (!this.toolbar.getButtonByValue('insertimage')) {
YAHOO.log('Toolbar Button for (insertimage) was not found, skipping exec.', 'info', 'SimpleEditor');
return false;
}
}
this.toolbar.set('disabled', true); //Disable the toolbar when the prompt is showing
var _handleAEC = function() {
var el = this.currentElement[0],
src = 'http://';
if (!el) {
el = this._getSelectedElement();
}
if (el) {
if (el.getAttribute('src')) {
src = el.getAttribute('src', 2);
if (src.indexOf(this.get('blankimage')) != -1) {
src = this.STR_IMAGE_HERE;
}
}
}
var str = prompt(this.STR_IMAGE_URL + ': ', src);
if ((str !== '') && (str !== null)) {
el.setAttribute('src', str);
} else if (str === '') {
el.parentNode.removeChild(el);
share/root/static/yui/build/editor/editor-debug.js view on Meta::CPAN
} else {
var w = parseInt(this.currentElement[0].width, 10);
var h = parseInt(this.currentElement[0].height, 10);
newXY[0] = (newXY[0] + (w / 2));
newXY[1] = (newXY[1] + h);
}
newXY[1] = newXY[1] + 15;
} else {
var fs = Dom.getStyle(this.currentElement[0], 'fontSize');
if (fs && fs.indexOf && fs.indexOf('px') != -1) {
newXY[1] = newXY[1] + parseInt(Dom.getStyle(this.currentElement[0], 'fontSize'), 10) + 5;
} else {
newXY[1] = newXY[1] + 20;
}
}
if (newXY[0] < elXY[0]) {
newXY[0] = elXY[0] + 5;
align = 'left';
}
if ((newXY[0] + (wWidth * 2)) > (elXY[0] + parseInt(this.get('iframe').get('element').clientWidth, 10))) {
newXY[0] = ((elXY[0] + parseInt(this.get('iframe').get('element').clientWidth, 10)) - (wWidth * 2) - 5);
align = 'right';
}
try {
xDiff = (newXY[0] - orgXY[0]);
yDiff = (newXY[1] - orgXY[1]);
} catch (e) {}
var iTop = elXY[1] + parseInt(this.get('height'), 10);
var iLeft = elXY[0] + parseInt(this.get('width'), 10);
if (newXY[1] > iTop) {
newXY[1] = iTop;
}
if (newXY[0] > iLeft) {
newXY[0] = (iLeft / 2);
}
//Convert negative numbers to positive so we can get the difference in distance
xDiff = ((xDiff < 0) ? (xDiff * -1) : xDiff);
yDiff = ((yDiff < 0) ? (yDiff * -1) : yDiff);
if (((xDiff > 10) || (yDiff > 10)) || force) { //Only move the window if it's supposed to move more than 10px or force was passed (new window)
var _knobLeft = 0,
elW = 0;
if (this.currentElement[0].width) {
elW = (parseInt(this.currentElement[0].width, 10) / 2);
}
var leftOffset = xy[0] + elXY[0] + elW;
_knobLeft = leftOffset - newXY[0];
//Check to see if the knob will go off either side & reposition it
if (_knobLeft > (parseInt(win.attrs.width, 10) - 1)) {
_knobLeft = ((parseInt(win.attrs.width, 10) - 30) - 1);
} else if (_knobLeft < 40) {
_knobLeft = 1;
}
if (isNaN(_knobLeft)) {
_knobLeft = 1;
}
if (force) {
if (_knob) {
_knob.style.left = _knobLeft + 'px';
}
//Removed Animation from a forced move..
panel.cfg.setProperty('xy', newXY);
} else {
if (this.get('animate')) {
anim = new YAHOO.util.Anim(panel.element, {}, 0.5, YAHOO.util.Easing.easeOut);
anim.attributes = {
top: {
to: newXY[1]
},
left: {
to: newXY[0]
}
};
anim.onComplete.subscribe(function() {
panel.cfg.setProperty('xy', newXY);
});
//We have to animate the iframe shim at the same time as the panel or we get scrollbar bleed ..
var iframeAnim = new YAHOO.util.Anim(panel.iframe, anim.attributes, 0.5, YAHOO.util.Easing.easeOut);
var _knobAnim = new YAHOO.util.Anim(_knob, {
left: {
to: _knobLeft
}
}, 0.6, YAHOO.util.Easing.easeOut);
anim.animate();
iframeAnim.animate();
_knobAnim.animate();
} else {
_knob.style.left = _knobLeft + 'px';
panel.cfg.setProperty('xy', newXY);
}
}
}
},
/**
* @private
* @method _closeWindow
* @description Close the currently open EditorWindow with the Escape key.
* @param {Event} ev The keypress Event that we are trapping
*/
_closeWindow: function(ev) {
//if ((ev.charCode == 87) && ev.shiftKey && ev.ctrlKey) {
if (this._checkKey(this._keyMap.CLOSE_WINDOW, ev)) {
if (this.currentWindow) {
this.closeWindow();
}
}
},
/**
* @method closeWindow
* @description Close the currently open EditorWindow.
*/
closeWindow: function(keepOpen) {
YAHOO.log('closeWindow: ' + this.currentWindow.name, 'info', 'Editor');
( run in 1.148 second using v1.01-cache-2.11-cpan-5837b0d9d2c )