Hopkins-Plugin-HMI
view release on metacpan or search on metacpan
share/root/static/yui/build/editor/simpleeditor-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);
( run in 0.749 second using v1.01-cache-2.11-cpan-39bf76dae61 )