Zeile 125 | Zeile 125 |
---|
this.colors[38] = "#E6E6FA"; this.colors[39] = "#DDA0DD"; this.colors[40] = "#FFFFFF";
|
this.colors[38] = "#E6E6FA"; this.colors[39] = "#DDA0DD"; this.colors[40] = "#FFFFFF";
|
// An array of video services to be shown (youtube, vimeo, etc)
| // An array of video services to be shown (youtube, vimeo, etc)
|
this.videos = new Object(); this.videos["dailymotion"] = this.options.lang.video_dailymotion; this.videos["metacafe"] = this.options.lang.video_metacafe;
| this.videos = new Object(); this.videos["dailymotion"] = this.options.lang.video_dailymotion; this.videos["metacafe"] = this.options.lang.video_metacafe;
|
Zeile 156 | Zeile 156 |
---|
// Now this.textarea becomes the new textarea ID this.textarea += "_new";
|
// Now this.textarea becomes the new textarea ID this.textarea += "_new";
|
|
|
// Begin the creation of our new editor.
this.editor = document.createElement("div");
| // Begin the creation of our new editor.
this.editor = document.createElement("div");
|
Zeile 186 | Zeile 186 |
---|
h = oldTextarea.clientHeight+"px"; } else if(oldTextarea.style.height)
|
h = oldTextarea.clientHeight+"px"; } else if(oldTextarea.style.height)
|
{
| {
|
h = oldTextarea.style.height; } else
| h = oldTextarea.style.height; } else
|
Zeile 195 | Zeile 195 |
---|
} this.editor.style.width = w; this.editor.style.height = h;
|
} this.editor.style.width = w; this.editor.style.height = h;
|
|
|
this.createToolbarContainer('top');
this.createToolbar('closetags', {
|
this.createToolbarContainer('top');
this.createToolbar('closetags', {
|
container: 'top', alignment: 'right', items: [
| container: 'top', alignment: 'right', items: [
|
{type: 'button', name: 'close_tags', insert: 'zzzz', sprite: 'close_tags', width: 80, style: {visibility: 'hidden'}} ] });
| {type: 'button', name: 'close_tags', insert: 'zzzz', sprite: 'close_tags', width: 80, style: {visibility: 'hidden'}} ] });
|
Zeile 231 | Zeile 231 |
---|
{type: 'button', name: 'code', sprite: 'code', insert: 'code', title: this.options.lang.title_code}, {type: 'button', name: 'php', sprite: 'php', insert: 'php', title: this.options.lang.title_php}, {type: 'button', name: 'video', insert: 'video', image: 'television.gif', dropdown: true, title: this.options.lang.title_video, options: this.videos}
|
{type: 'button', name: 'code', sprite: 'code', insert: 'code', title: this.options.lang.title_code}, {type: 'button', name: 'php', sprite: 'php', insert: 'php', title: this.options.lang.title_php}, {type: 'button', name: 'video', insert: 'video', image: 'television.gif', dropdown: true, title: this.options.lang.title_video, options: this.videos}
|
]
| ]
|
}); this.createToolbar('formatting', { container: 'bottom',
| }); this.createToolbar('formatting', { container: 'bottom',
|
Zeile 246 | Zeile 246 |
---|
{type: 'button', name: 'align_justify', sprite: 'align_justify', insert: 'align', extra: 'justify', title: this.options.lang.title_justify} ] });
|
{type: 'button', name: 'align_justify', sprite: 'align_justify', insert: 'align', extra: 'justify', title: this.options.lang.title_justify} ] });
|
|
|
// Create our new text area areaContainer = document.createElement("div"); areaContainer.style.clear = "both";
// Set the width/height of the area subtract = 20;
|
// Create our new text area areaContainer = document.createElement("div"); areaContainer.style.clear = "both";
// Set the width/height of the area subtract = 20;
|
subtract2 = 12;
| subtract2 = 8;
|
areaContainer.style.height = parseInt(Element.getDimensions(this.editor).height)-this.toolbarHeight-subtract+"px"; areaContainer.style.width = parseInt(Element.getDimensions(this.editor).width)-subtract2+"px";
| areaContainer.style.height = parseInt(Element.getDimensions(this.editor).height)-this.toolbarHeight-subtract+"px"; areaContainer.style.width = parseInt(Element.getDimensions(this.editor).width)-subtract2+"px";
|
Zeile 369 | Zeile 369 |
---|
if(toolbar.lastChild.previousSibling) toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last'; },
|
if(toolbar.lastChild.previousSibling) toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last'; },
|
|
|
setElementState: function(element, state) { element.addClassName('toolbar_'+state);
|
setElementState: function(element, state) { element.addClassName('toolbar_'+state);
|
if(element.hasClassName('toolbar_button_group_first')) { if(state == 'clicked') { append = 'toolbar_clicked'; } else if(state == 'hover') { append = 'toolbar_hover'; } append += '_button_group_first'; element.addClassName(append); } if(element.hasClassName('toolbar_button_group_last')) { if(state == 'clicked') { append = 'toolbar_clicked';
| if(element.hasClassName('toolbar_button_group_first')) { if(state == 'clicked') { append = 'toolbar_clicked'; } else if(state == 'hover') { append = 'toolbar_hover'; } append += '_button_group_first'; element.addClassName(append); }
if(element.hasClassName('toolbar_button_group_last')) { if(state == 'clicked') { append = 'toolbar_clicked';
|
} else if(state == 'hover') { append = 'toolbar_hover';
| } else if(state == 'hover') { append = 'toolbar_hover';
|
Zeile 395 | Zeile 395 |
---|
element.addClassName(append); } },
|
element.addClassName(append); } },
|
|
|
removeElementState: function(element, state) { element.removeClassName('toolbar_'+state);
|
removeElementState: function(element, state) { element.removeClassName('toolbar_'+state);
|
|
|
if(element.hasClassName('toolbar_button_group_first')) {
|
if(element.hasClassName('toolbar_button_group_first')) {
|
if(state == 'clicked') { append = 'toolbar_clicked'; }
| if(state == 'clicked') { append = 'toolbar_clicked'; }
|
else if(state == 'hover') { append = 'toolbar_hover'; } append += '_button_group_first'; element.removeClassName(append); }
|
else if(state == 'hover') { append = 'toolbar_hover'; } append += '_button_group_first'; element.removeClassName(append); }
|
|
|
if(element.hasClassName('toolbar_button_group_last')) { if(state == 'clicked') { append = 'toolbar_clicked';
| if(element.hasClassName('toolbar_button_group_last')) { if(state == 'clicked') { append = 'toolbar_clicked';
|
Zeile 420 | Zeile 420 |
---|
} append += '_button_group_last'; element.removeClassName(append);
|
} append += '_button_group_last'; element.removeClassName(append);
|
}
| }
|
},
|
},
|
|
|
dropDownMenuItemClick: function(e) { this.restartEditorSelection();
| dropDownMenuItemClick: function(e) { this.restartEditorSelection();
|
Zeile 430 | Zeile 430 |
---|
if(!element) return;
|
if(!element) return;
|
|
|
if(!element.extra) element = element.up('li');
|
if(!element.extra) element = element.up('li');
|
|
|
var mnu = element.up('ul'); var dropdown = this.getElementToolbarItem(mnu); var label = dropdown.down('.editor_dropdown_label');
|
var mnu = element.up('ul'); var dropdown = this.getElementToolbarItem(mnu); var label = dropdown.down('.editor_dropdown_label');
|
|
|
if(!dropdown.insertText || (dropdown.insertText != "video" && mnu.activeItem && mnu.activeItem == element)) return;
|
if(!dropdown.insertText || (dropdown.insertText != "video" && mnu.activeItem && mnu.activeItem == element)) return;
|
|
|
mnu.lastItemValue = element.extra;
if(this.getSelectedText($(this.textarea)))
|
mnu.lastItemValue = element.extra;
if(this.getSelectedText($(this.textarea)))
|
{
| {
|
this.setDropDownMenuActiveItem(dropdown, 0); } else
| this.setDropDownMenuActiveItem(dropdown, 0); } else
|
Zeile 453 | Zeile 453 |
---|
{ label.innerHTML = element.innerHTML; label.style.overflow = 'hidden';
|
{ label.innerHTML = element.innerHTML; label.style.overflow = 'hidden';
|
}
| }
|
var sel_color = dropdown.down('.editor_button_color_selected') if(sel_color) {
| var sel_color = dropdown.down('.editor_button_color_selected') if(sel_color) {
|
Zeile 496 | Zeile 496 |
---|
}
var sel_color = element.down('.editor_dropdown_color_selected')
|
}
var sel_color = element.down('.editor_dropdown_color_selected')
|
if(sel_color) {
| if(sel_color) {
|
sel_color.style.backgroundColor = item.style.backgroundColor; mnu.lastItemValue = item.insertExtra; var use_default = element.down('.editor_dropdown_color_item_default');
| sel_color.style.backgroundColor = item.style.backgroundColor; mnu.lastItemValue = item.insertExtra; var use_default = element.down('.editor_dropdown_color_item_default');
|
Zeile 557 | Zeile 557 |
---|
else { label.innerHTML = ' ';
|
else { label.innerHTML = ' ';
|
}
| }
|
dropdown.appendChild(label)
|
dropdown.appendChild(label)
|
|
|
// create the arrow var arrow = document.createElement('div'); arrow.className = 'editor_dropdown_arrow';
| // create the arrow var arrow = document.createElement('div'); arrow.className = 'editor_dropdown_arrow';
|
Zeile 572 | Zeile 572 |
---|
dropdown.appendChild(mnu); return dropdown; },
|
dropdown.appendChild(mnu); return dropdown; },
|
|
|
buildDropDownMenu: function(options) { var mnu = document.createElement('ul');
| buildDropDownMenu: function(options) { var mnu = document.createElement('ul');
|
Zeile 587 | Zeile 587 |
---|
item.innerHTML = options.title; mnu.appendChild(item); Event.observe(item, 'click', function()
|
item.innerHTML = options.title; mnu.appendChild(item); Event.observe(item, 'click', function()
|
{
| {
|
if(mnu.activeItem) { this.restartEditorSelection();
| if(mnu.activeItem) { this.restartEditorSelection();
|
Zeile 596 | Zeile 596 |
---|
this.setDropDownMenuActiveItem(dropdown, 0); }.bindAsEventListener(this)); }
|
this.setDropDownMenuActiveItem(dropdown, 0); }.bindAsEventListener(this)); }
|
|
|
$H(options.options).each(function(option) { if(options.draw_option)
| $H(options.options).each(function(option) { if(options.draw_option)
|
Zeile 618 | Zeile 618 |
---|
item.addClassName('editor_dropdown_menu_item_over'); }); Event.observe(item, 'mouseout', function()
|
item.addClassName('editor_dropdown_menu_item_over'); }); Event.observe(item, 'mouseout', function()
|
{
| {
|
item.removeClassName('editor_dropdown_menu_item_over'); }); mnu.appendChild(item); }, this); return mnu; },
|
item.removeClassName('editor_dropdown_menu_item_over'); }); mnu.appendChild(item); }, this); return mnu; },
|
|
|
toggleDropDownMenu: function(e) { element = Event.element(e);
| toggleDropDownMenu: function(e) { element = Event.element(e);
|
Zeile 633 | Zeile 633 |
---|
return; if(!element.elementType) element = this.getElementToolbarItem(element);
|
return; if(!element.elementType) element = this.getElementToolbarItem(element);
|
|
|
var mnu = $(element).down('ul');
|
var mnu = $(element).down('ul');
|
|
|
// This menu is already open, close it if(mnu.style.display != 'none') {
| // This menu is already open, close it if(mnu.style.display != 'none') {
|
Zeile 650 | Zeile 650 |
---|
{ // If a menu is already open, close it first this.showDropDownMenu(mnu);
|
{ // If a menu is already open, close it first this.showDropDownMenu(mnu);
|
}
| }
|
this.removeElementState(element, 'clicked'); Event.stop(e);
|
this.removeElementState(element, 'clicked'); Event.stop(e);
|
},
| },
|
showDropDownMenu: function(mnu) {
| showDropDownMenu: function(mnu) {
|
Zeile 664 | Zeile 664 |
---|
this.setElementState(element, 'clicked'); this.openDropDownMenu = mnu; Event.observe(document, 'click', this.hideOpenDropDownMenu.bindAsEventListener(this));
|
this.setElementState(element, 'clicked'); this.openDropDownMenu = mnu; Event.observe(document, 'click', this.hideOpenDropDownMenu.bindAsEventListener(this));
|
},
| },
|
hideOpenDropDownMenu: function() { if(!this.openDropDownMenu) return;
| hideOpenDropDownMenu: function() { if(!this.openDropDownMenu) return;
|
Zeile 695 | Zeile 695 |
---|
{ return; }
|
{ return; }
|
|
|
// Internet explorer errors if you try and select an element... so just handle that by try catch try { var range = document.selection.createRange();
| // Internet explorer errors if you try and select an element... so just handle that by try catch try { var range = document.selection.createRange();
|
Zeile 741 | Zeile 741 |
---|
if($('editor_item_'+options.name)) return;
insert_first_class = false;
|
if($('editor_item_'+options.name)) return;
insert_first_class = false;
|
|
|
// Is this the first item? childnodes = 1 (closing br) or lastchild.previousSibling = sep if(toolbar.childNodes.length == 1 || (toolbar.lastChild.previousSibling && toolbar.lastChild.previousSibling.className.indexOf('toolbar_sep') > -1 || (toolbar.lastChild.previousSibling.className.indexOf('editor_dropdown') > -1 && options.type != 'dropdown'))) { insert_first_class = true; }
|
// Is this the first item? childnodes = 1 (closing br) or lastchild.previousSibling = sep if(toolbar.childNodes.length == 1 || (toolbar.lastChild.previousSibling && toolbar.lastChild.previousSibling.className.indexOf('toolbar_sep') > -1 || (toolbar.lastChild.previousSibling.className.indexOf('editor_dropdown') > -1 && options.type != 'dropdown'))) { insert_first_class = true; }
|
|
|
if(options.type == "dropdown") { var dropdown = this.createDropDownMenu(options);
| if(options.type == "dropdown") { var dropdown = this.createDropDownMenu(options);
|
Zeile 756 | Zeile 756 |
---|
if(insert_first_class == true) dropdown.className += ' toolbar_dropdown_group_first';
|
if(insert_first_class == true) dropdown.className += ' toolbar_dropdown_group_first';
|
}
| }
|
else if(options.type == 'button') { var button = this.createToolbarButton(options)
| else if(options.type == 'button') { var button = this.createToolbarButton(options)
|
Zeile 786 | Zeile 786 |
---|
if(typeof(options.title) != 'undefined') { button.title = options.title;
|
if(typeof(options.title) != 'undefined') { button.title = options.title;
|
}
| }
|
button.className = 'toolbar_button toolbar_normal toolbar_button_'+options.name;
|
button.className = 'toolbar_button toolbar_normal toolbar_button_'+options.name;
|
|
|
if(typeof(options.style) == 'object') { $H(options.style).each(function(item) {
| if(typeof(options.style) == 'object') { $H(options.style).each(function(item) {
|
Zeile 799 | Zeile 799 |
---|
button.insertExtra = ''; if(typeof(options.extra) != 'undefined') button.insertExtra = options.extra;
|
button.insertExtra = ''; if(typeof(options.extra) != 'undefined') button.insertExtra = options.extra;
|
|
|
if(typeof(options.sprite) != 'undefined') { var img = document.createElement('span');
| if(typeof(options.sprite) != 'undefined') { var img = document.createElement('span');
|
Zeile 832 | Zeile 832 |
---|
// Create the actual drop down menu if(options.dropdown)
|
// Create the actual drop down menu if(options.dropdown)
|
{
| {
|
// create the menu item container var mnu = this.buildDropDownMenu(options);
| // create the menu item container var mnu = this.buildDropDownMenu(options);
|
Zeile 861 | Zeile 861 |
---|
button.disable = function() { if(button.disabled == true) return;
|
button.disable = function() { if(button.disabled == true) return;
|
if(options.disabled_sprite)
| if(options.disabled_sprite)
|
{ img.removeClassName('toolbar_sprite_'+options.sprite); img.addClassName('toolbar_sprite_disabled_'+options.disabled_sprite);
| { img.removeClassName('toolbar_sprite_'+options.sprite); img.addClassName('toolbar_sprite_disabled_'+options.disabled_sprite);
|
Zeile 892 | Zeile 892 |
---|
{ button.disable(); button.disabled = true;
|
{ button.disable(); button.disabled = true;
|
}
| }
|
else button.disabled = false;
|
else button.disabled = false;
|
}
| }
|
Event.observe(button, "mouseover", this.toolbarItemHover.bindAsEventListener(this)); Event.observe(button, "mouseout", this.toolbarItemOut.bindAsEventListener(this));
| Event.observe(button, "mouseover", this.toolbarItemHover.bindAsEventListener(this)); Event.observe(button, "mouseout", this.toolbarItemOut.bindAsEventListener(this));
|
Zeile 906 | Zeile 906 |
---|
Event.observe(button, "click", this.toolbarItemClick.bindAsEventListener(this)); } return button;
|
Event.observe(button, "click", this.toolbarItemClick.bindAsEventListener(this)); } return button;
|
},
| },
|
updateOldArea: function(e) { this.oldTextarea.value = $(this.textarea).value;
| updateOldArea: function(e) { this.oldTextarea.value = $(this.textarea).value;
|
Zeile 936 | Zeile 936 |
---|
else { insertCode = element.insertText;
|
else { insertCode = element.insertText;
|
}
| }
|
if(this.openTags.indexOf(insertCode) != -1 || element.className.indexOf('editor_dropdown_menu_open') > -1) { this.setElementState(element, 'clicked');
| if(this.openTags.indexOf(insertCode) != -1 || element.className.indexOf('editor_dropdown_menu_open') > -1) { this.setElementState(element, 'clicked');
|
Zeile 945 | Zeile 945 |
---|
} this.removeElementState(element, 'hover'); },
|
} this.removeElementState(element, 'hover'); },
|
|
|
toolbarItemHover: function(e) { this.storeCaret();
|
toolbarItemHover: function(e) { this.storeCaret();
|
element = Event.element(e); if(!element) return false;
| element = Event.element(e); if(!element) return false;
|
if(!element.elementType) element = this.getElementToolbarItem(element);
| if(!element.elementType) element = this.getElementToolbarItem(element);
|
Zeile 982 | Zeile 982 |
---|
{ Event.stop(e); if(!element.menu.lastItemValue)
|
{ Event.stop(e); if(!element.menu.lastItemValue)
|
{
| {
|
this.showDropDownMenu(element.menu);
|
this.showDropDownMenu(element.menu);
|
}
| }
|
else { this.insertMyCode(element.insertText, element.menu.lastItemValue);
| else { this.insertMyCode(element.insertText, element.menu.lastItemValue);
|
Zeile 997 | Zeile 997 |
---|
if(element.id == "editor_item_close_tags") { this.closeTags();
|
if(element.id == "editor_item_close_tags") { this.closeTags();
|
}
| }
|
else { if(typeof(element.insertExtra) != 'undefined')
| else { if(typeof(element.insertExtra) != 'undefined')
|
Zeile 1012 | Zeile 1012 |
---|
list = "";
do
|
list = "";
do
|
{
| {
|
listItem = prompt(this.options.lang.enter_list_item, "");
if(listItem != "" && listItem != null)
| listItem = prompt(this.options.lang.enter_list_item, "");
if(listItem != "" && listItem != null)
|
Zeile 1041 | Zeile 1041 |
---|
},
insertURL: function()
|
},
insertURL: function()
|
{ selectedText = this.getSelectedText($(this.textarea));
| { selectedText = this.getSelectedText($(this.textarea));
|
url = prompt(this.options.lang.enter_url, "http://");
|
url = prompt(this.options.lang.enter_url, "http://");
|
|
|
if(url) { if(!selectedText)
|
if(url) { if(!selectedText)
|
{
| {
|
title = prompt(this.options.lang.enter_url_title, "");
|
title = prompt(this.options.lang.enter_url_title, "");
|
} else { title = selectedText; }
if(title) {
| } else { title = selectedText; }
if(title) {
|
this.performInsert("[url="+url+"]"+title+"[/url]", "", true, false); } else
| this.performInsert("[url="+url+"]"+title+"[/url]", "", true, false); } else
|
Zeile 1103 | Zeile 1103 |
---|
this.performInsert("[img]"+image+"[/img]", "", true); } },
|
this.performInsert("[img]"+image+"[/img]", "", true); } },
|
|
|
insertVideo: function(type) { selectedText = this.getSelectedText($(this.textarea));
| insertVideo: function(type) { selectedText = this.getSelectedText($(this.textarea));
|
Zeile 1359 | Zeile 1359 |
---|
textarea.focus(); this.trackingCaret = true; this.storeCaret();
|
textarea.focus(); this.trackingCaret = true; this.storeCaret();
|
this.trackingCaret = false;
| this.trackingCaret = false;
|
return is_closed; },
| return is_closed; },
|