From 2665a2d3e6aecdde1726a763dd664fa9deedb5b8 Mon Sep 17 00:00:00 2001 From: Madhuri Debnath Date: Wed, 5 Jan 2011 17:17:20 +0600 Subject: [PATCH 001/190] task-2613, fix the javascript error --- Public/Support/Components/TextView/TextView.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Public/Support/Components/TextView/TextView.js b/Public/Support/Components/TextView/TextView.js index f65c2d6..93ce06d 100644 --- a/Public/Support/Components/TextView/TextView.js +++ b/Public/Support/Components/TextView/TextView.js @@ -40,22 +40,14 @@ function ComponentTextView( id ) { self.node().value = value; } if( self.iframe() ) { - if( self.iframe().contentDocument ) { - doc = self.iframe().contentDocument; - } else if (self.iframe.contentWindow) { - doc = self.iframe().contentWindow.document; - } else { - doc = self.iframe().document; - } - + var doc = self.iframe().contentWindow.document; doc.open(); doc.write(value); doc.close(); - if(doc.body != null ) { - Element.setStyle(doc.body, { + Element.setStyle(doc.body, { 'fontFamily': Element.getStyle(self.node(), 'fontFamily'), 'fontSize': Element.getStyle(self.node(), 'fontSize') }); - } + } if( self.ckeditor() ) { From 987dcfdd2deba1e30109e27fda4a10818dc9cdb6 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 23 Feb 2011 11:46:54 +0100 Subject: [PATCH 002/190] New autocomplete feature added to the Combobox component. Autocomplete comes with goodies as highlightning of matched words. This can be configured with three new attributes. 1. autocomplete (boolean) - if autocomplete should be enabled. 2. multiple (boolean) - if you should be able to select multiple items. 3. itemseparator (string) - if multiple is on this is the separator that separates the items in the textfield. --- .../Support/Components/Combobox/Combobox.css | 6 +- .../Support/Components/Combobox/Combobox.feh | 3 + .../Support/Components/Combobox/Combobox.js | 192 +++++++++++++++++- .../Components/Combobox/Combobox.template | 3 + 4 files changed, 194 insertions(+), 10 deletions(-) diff --git a/Public/Support/Components/Combobox/Combobox.css b/Public/Support/Components/Combobox/Combobox.css index 58f27e2..edd6ecd 100644 --- a/Public/Support/Components/Combobox/Combobox.css +++ b/Public/Support/Components/Combobox/Combobox.css @@ -6,7 +6,7 @@ .wfComboboxTextfield { width: 100%; border: 1px solid white; - cursor: default; + cursor: text; background-color: white; } @@ -32,7 +32,7 @@ margin: 0px; padding: 0px; } -.wfComboboxList ul li:hover { +.wfComboboxList ul li.selected { background-color: #79d9f7; } .wfComboboxList ul li { @@ -45,6 +45,7 @@ text-align: left; white-space: nowrap; } +/* div.autocomplete { position:absolute; width:500px; @@ -67,3 +68,4 @@ div.autocomplete ul li { height:16px; cursor: pointer; } +*/ diff --git a/Public/Support/Components/Combobox/Combobox.feh b/Public/Support/Components/Combobox/Combobox.feh index 23dca73..191aa1a 100644 --- a/Public/Support/Components/Combobox/Combobox.feh +++ b/Public/Support/Components/Combobox/Combobox.feh @@ -29,6 +29,9 @@ namespace modifies GUIKit { [attribute string icon '' 'The icon to be displayed besides the text field']; [attribute boolean listEnabled true 'If the list should be enabled']; [attribute boolean textfieldEnabled true 'If the text field should be enabled']; + [attribute boolean autocomplete true 'If auto complete should be enabled']; + [attribute boolean multiple true 'If it should be possible to select multiple items']; + [attribute string itemSeparator ',' 'The separator which separates items in the textfield if multiple items can be selected']; object source; diff --git a/Public/Support/Components/Combobox/Combobox.js b/Public/Support/Components/Combobox/Combobox.js index da915ff..310fc6a 100644 --- a/Public/Support/Components/Combobox/Combobox.js +++ b/Public/Support/Components/Combobox/Combobox.js @@ -4,12 +4,45 @@ function ComponentCombobox( id ) { self.iconNode = document.getElementById( id + '_icon' ); self.listNode = document.getElementById( id + '_list' ); self.showingList = false; + self.selectedItem = -1; - self.showList = function() { + self.showList = function( searchTerm ) { var iconWidth = 0; if( self.iconNode ) { iconWidth = self.iconNode.offsetWidth; } + self.selectedItem = -1; + if( searchTerm ) { + var size = self.listNode.childNodes[0].childNodes.length; + for( var i = 0; i < size; i++ ) { + var text = self.listNode.childNodes[0].childNodes[i].itemLabel; + var index = text.toLowerCase().search(searchTerm); + var display = 'none'; + var className = ''; + if( index > -1 ) { + var start = text.substring(0, index); + var middle = text.substring(index, index + searchTerm.length); + var end = text.substring(index + searchTerm.length, text.length); + //alert('Search term: ' + searchTerm + ', Search term length: ' + searchTerm.length + ', Index: ' + index + ', Start: ' + start + ', Middle: ' + middle + ', End: ' + end); + text = start + '' + middle + '' + end; + display = ''; + if( self.selectedItem == -1 ) { + className = 'selected'; + self.selectedItem = i; + } + } + self.listNode.childNodes[0].childNodes[i].style.display = display; + self.listNode.childNodes[0].childNodes[i].className = className; + self.listNode.childNodes[0].childNodes[i].innerHTML = text; + } + } else { + var size = self.listNode.childNodes[0].childNodes.length; + for( var i = 0; i < size; i++ ) { + self.listNode.childNodes[0].childNodes[i].style.display = ''; + self.listNode.childNodes[0].childNodes[i].className = ''; + self.listNode.childNodes[0].childNodes[i].innerHTML = self.listNode.childNodes[0].childNodes[i].itemLabel; + } + } Position.clone( self.node(), self.listNode, { setWidth: false, setHeight: false, offsetTop: 0 + self.node().clientHeight + 1 } ); self.listNode.style.minWidth = self.node().offsetWidth + iconWidth - 1 + 'px'; self.listNode.style.display = 'block'; @@ -27,6 +60,7 @@ function ComponentCombobox( id ) { var previousActivate = self.activate; self.activate = function activate() { + self.node().style.cursor = 'text'; if( self.getState('list-enabled') ) { if( self.iconNode ) { self.iconNode.onclick = function( event ) { @@ -46,7 +80,7 @@ function ComponentCombobox( id ) { }; } } - if( ! self.getState('textfield-enabled') ) { + if( self.getState('textfield-enabled') == false ) { self.node().onfocus = function( event ) { Hotkeys.add('Backspace', function() { self.clearTextfield(); @@ -59,17 +93,156 @@ function ComponentCombobox( id ) { Hotkeys.remove('Backspace'); Hotkeys.remove('Delete'); }; + } else if( self.getState('autocomplete') == true ) { + var getCaretPosition = function( o ) { + if( o.createTextRange ) { + var r = document.selection.createRange().duplicate(); + r.moveEnd('character', o.value.length); + if( r.text == '' ) + return o.value.length + return o.value.lastIndexOf(r.text) + } + return o.selectionStart; + }; + self.node().onfocus = function( event ) { + self.node().onkeypress = function( keyEvent ) { + keyEvent = keyEvent || window.event; + if( keyEvent.keyCode != 9 /* tab */ && + keyEvent.keyCode != 38 /* up */ && + keyEvent.keyCode != 40 /* down */ && + keyEvent.keyCode != 13 /* return/enter */ ) + { + if( keyEvent.keyCode != 27 /* esc */ ) { + setTimeout(function() { + var value = self.node().value; + if( getCaretPosition(self.node()) == value.length /* at the end of the text */ ) { + var items = value.split(','); + var lastItem = items.length - 1; + var searchTerm = items[lastItem].strip(); + if( searchTerm ) { + self.showList(searchTerm); + } else { + self.hideList(); + } + } else { + self.hideList(); + } + }, 100); + } else { + self.hideList(); + } + } + return true; + }; + Hotkeys.add('up', function( hotkeyEvent ) { + if( self.showingList ) { + if( self.selectedItem > 0 ) { + var previousItem = self.selectedItem - 1; + // Find the previous visible item in the list. + while( self.listNode.childNodes[0].childNodes[previousItem].style.display == 'none' ) { + previousItem--; + } + if( previousItem > -1 ) { + if( self.selectedItem > -1 ) { + self.listNode.childNodes[0].childNodes[self.selectedItem].className = ''; + } + self.listNode.childNodes[0].childNodes[previousItem].className = 'selected'; + self.selectedItem = previousItem; + } + } + } + }); + Hotkeys.add('down', function( hotkeyEvent ) { + if( self.showingList ) { + var size = self.listNode.childNodes[0].childNodes.length; + var lastItem = size - 1; + if( self.selectedItem < lastItem ) { + var nextItem = self.selectedItem + 1; + // Find the next visible item in the list. + while( self.listNode.childNodes[0].childNodes[nextItem].style.display == 'none' ) { + nextItem++; + } + if( nextItem < size ) { + if( self.selectedItem > -1 ) { + self.listNode.childNodes[0].childNodes[self.selectedItem].className = ''; + } + self.listNode.childNodes[0].childNodes[nextItem].className = 'selected'; + self.selectedItem = nextItem; + } + } + } + }); + Hotkeys.add('enter', function( hotkeyEvent ) { + if( self.showingList ) { + if( self.selectedItem > -1 ) { + var option = self.listNode.childNodes[0].childNodes[self.selectedItem]; + self._selectItem(option); + } + self.hideList(); + } + }); + }; + self.node().onblur = function( event ) { + // This is done on a timeout because blur events are fired before + // onclick events. That means that if an item is clicked in + // the list this blur event will fire before the click event + // that puts the item in the list and this blur event hides + // the list causing the click event to never be fired. + setTimeout(function() { + Hotkeys.remove('up'); + Hotkeys.remove('down'); + Hotkeys.remove('enter'); + self.node().onkeypress = null; + self.hideList(); + }, 100); + }; } previousActivate(); }; - self._createItem = function( value, label ) { + self._selectItem = function( option ) { + if( option ) { + if( self.getState('multiple') == true ) { + var value = self.node().value; + var items = value.split(self.getState('item-separator')); + var lastItem = items.length - 1; + items[lastItem] = option.itemValue; + value = ''; + items.each(function(item) { + value += item.strip() + self.getState('item-separator') + ' '; + }); + self.node().value = value; + self.setState('text-value', value); + } else { + self.node().value = option.itemValue; + self.setState('text-value', option.itemValue); + } + } + }; + + self._createItem = function( value, label, id ) { var option = document.createElement('li'); option.appendChild(document.createTextNode(label)); + option.itemID = id; + option.itemValue = value; + option.itemLabel = label; option.onclick = function( event ) { - self.node().value = value; - self.setState('text-value', value); - self.hideList(); + self._selectItem(option); + // This is done on a timeout because we need the timeout set in + // the blur event to fire before this. Yes is it a (ugly) hack. + setTimeout(function() { + self.node().focus(); + }, 100); + }; + option.onmouseover = function( event ) { + if( self.selectedItem > -1 ) { + var previousSelectedOption = self.listNode.childNodes[0].childNodes[self.selectedItem]; + if( previousSelectedOption ) { + previousSelectedOption.className = ''; + } + } + option.className = 'selected'; + self.selectedItem = option.itemID; }; return option; }; @@ -79,10 +252,13 @@ function ComponentCombobox( id ) { while( node.childNodes.length ) { node.removeChild(node.childNodes[0]); } - + + var itemID = 0; + var ul = document.createElement('ul'); items.each(function(item){ - ul.appendChild(self._createItem(item.id,item.value)); + ul.appendChild(self._createItem(item.id, item.value, itemID)); + itemID++; }); node.appendChild(ul); diff --git a/Public/Support/Components/Combobox/Combobox.template b/Public/Support/Components/Combobox/Combobox.template index b70f4e3..678f805 100644 --- a/Public/Support/Components/Combobox/Combobox.template +++ b/Public/Support/Components/Combobox/Combobox.template @@ -11,6 +11,9 @@ _('[ID]').setFormValueTarget('[ID]') _('[ID]').setState('textfield-enabled', [textfieldEnabled]); _('[ID]').setState('list-enabled', [listEnabled]); + _('[ID]').setState('autocomplete', [autocomplete]); + _('[ID]').setState('multiple', [multiple]); + _('[ID]').setState('item-separator', '[itemSeparator]'); _('[ID]').setState('text-value', '[TextValue]'); _('[ID]').setItems([items]); _('[ID]').activate(); From 0924b59d56beb5700b1ec75677562380400f4042 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 24 May 2011 15:24:10 +0200 Subject: [PATCH 003/190] Removed features for task #2750. --- .../Support/Components/Combobox/Combobox.js | 27 +++++++++++++------ .../Plugins/GUIKit.plugin/Components/View.feh | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Public/Support/Components/Combobox/Combobox.js b/Public/Support/Components/Combobox/Combobox.js index 310fc6a..ff4a693 100644 --- a/Public/Support/Components/Combobox/Combobox.js +++ b/Public/Support/Components/Combobox/Combobox.js @@ -6,6 +6,13 @@ function ComponentCombobox( id ) { self.showingList = false; self.selectedItem = -1; + self.enable = function() { + self.node().readonly = true; + }; + self.disable = function() { + self.node().readonly = false; + }; + self.showList = function( searchTerm ) { var iconWidth = 0; if( self.iconNode ) { @@ -64,18 +71,22 @@ function ComponentCombobox( id ) { if( self.getState('list-enabled') ) { if( self.iconNode ) { self.iconNode.onclick = function( event ) { - if( self.showingList ) { - self.hideList(); - } else { - self.showList(); + if( self._enabled ) { + if( self.showingList ) { + self.hideList(); + } else { + self.showList(); + } } }; } else { self.node().onclick = function( event ) { - if( self.showingList ) { - self.hideList(); - } else { - self.showList(); + if( self._enabled ) { + if( self.showingList ) { + self.hideList(); + } else { + self.showList(); + } } }; } diff --git a/webframework/Plugins/GUIKit.plugin/Components/View.feh b/webframework/Plugins/GUIKit.plugin/Components/View.feh index 0c45fe6..4c96c06 100644 --- a/webframework/Plugins/GUIKit.plugin/Components/View.feh +++ b/webframework/Plugins/GUIKit.plugin/Components/View.feh @@ -410,7 +410,7 @@ namespace modifies GUIKit { values = .generateAttributes(); - if( textValue and .action and F('hotkeys') and (GUIKit.Hotkeys.sharedObject and GUIKit.Hotkeys.sharedObject.visible) ) { + if( textValue and .action and (GUIKit.Hotkeys.sharedObject and GUIKit.Hotkeys.sharedObject.visible) ) { string key = (hotkeyActionKeyMap.keyExists(.action) ? hotkeyActionKeyMap[.action] : ''); string prettyKey = (hotkeyCodeToPretty.keyExists(key) ? hotkeyCodeToPretty[key] : key); if( key ) { From b674670c9b1be08d765aa7753a36a519fca8a0f9 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 26 May 2011 09:54:02 +0200 Subject: [PATCH 004/190] Solved bug where images would not be displayed because WFServerURI had not been set yet. --- .../Plugins/GUIKit.plugin/Render/HTML/Render.feh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webframework/Plugins/GUIKit.plugin/Render/HTML/Render.feh b/webframework/Plugins/GUIKit.plugin/Render/HTML/Render.feh index e4328a7..3696cd9 100644 --- a/webframework/Plugins/GUIKit.plugin/Render/HTML/Render.feh +++ b/webframework/Plugins/GUIKit.plugin/Render/HTML/Render.feh @@ -164,11 +164,15 @@ namespace modifies GUIKit ].join('') ) : '') + - ' - - - diff --git a/Public/Support/Components/MultiplePopup/MultiplePopupItem.template b/Public/Support/Components/MultiplePopup/MultiplePopupItem.template index 7010d38..33751a5 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopupItem.template +++ b/Public/Support/Components/MultiplePopup/MultiplePopupItem.template @@ -1,6 +1,6 @@ -
  • - [componentAttributes: [multiple: +
  • + [!instanceSeparator: [componentAttributes: [multiple: - ]] - [instanceRender] + ]]] + [instanceRender]
  • From 88a11a48910f07851e8f737e82b20f95f7fe7185 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 9 Aug 2011 15:14:36 +0200 Subject: [PATCH 023/190] Added last needed function to MultiplePopup component so it can completely replace Popup component. --- Public/Support/Components/MultiplePopup/MultiplePopup.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.js b/Public/Support/Components/MultiplePopup/MultiplePopup.js index 774e155..6dd7bb8 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.js +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.js @@ -16,6 +16,13 @@ function ComponentMultiplePopup( id ) { self.setState('multiple-items-text', 'Multiple Items'); self.setState('all-items-text', 'All Items'); + self.setVisible = function( status ) { + if( status ) + self.buttonNode.show(); + else + self.buttonNode.hide(); + }; + self._forceSelectItemsByValue = function( value ) { var items = self.itemsByValue(value); if( items.length > 0 ) { From 44188c0c92ca982d774ef6cf10891e117cef8339 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 16 Aug 2011 22:25:49 +0200 Subject: [PATCH 024/190] Hopefully last fix for FS#2837 - Search - errors. Tested in FF4, IE8 and Chrome (does anybody know the version of their Chrome?). --- .../Components/MultiplePopup/MultiplePopup.js | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.js b/Public/Support/Components/MultiplePopup/MultiplePopup.js index 6dd7bb8..199ca19 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.js +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.js @@ -128,8 +128,12 @@ function ComponentMultiplePopup( id ) { // will flash under some circumstances in Linux/Firefox (3.5.9) self.listNode.style.display = 'block'; - var extra = (Prototype.Browser.WebKit ? 0 : 1) - Position.clone( self.buttonNode, self.listNode, { setWidth: false, setHeight: false, offsetTop: Element.getHeight(self.buttonNode) - extra } ); + var buttonNodeHeight = Element.getHeight(self.buttonNode); + var extraTopOffset = (Prototype.Browser.WebKit ? 0 : 1) + Position.clone(self.buttonNode, self.listNode, { + setWidth: false, + setHeight: false, + offsetTop: buttonNodeHeight - extraTopOffset }); self.listNode.style.minWidth = self.node().offsetWidth + iconWidth - 1 + 'px'; self.showingList = true; @@ -151,52 +155,51 @@ function ComponentMultiplePopup( id ) { }); }; - var cumulativeOffset = Element.cumulativeOffset(self.node()); - var viewportHeight = document.viewport.getDimensions().height; + var viewportDimensions = document.viewport.getDimensions(); + var viewportHeight = viewportDimensions.height; - var maxHeight = (viewportHeight - cumulativeOffset.top - 50); - var actualHeight = Element.getDimensions(self.node()).height; - var actualWidth = Element.getDimensions(self.node()).width; + var nodeDimensions = Element.getDimensions(self.node()); + var nodeCumulativeOffset = Element.cumulativeOffset(self.node()); + var maxHeight = (viewportHeight - nodeCumulativeOffset.top - 25); + var actualWidth = nodeDimensions.width; + var actualHeight = nodeDimensions.height; + // Tobias 2011-08-16: I think active is first set to false here and then to true + // to prevent updateVisual function to run when the states are set. self._active = false; self.setState('reset-width', actualWidth); self.setState('reset-height', actualHeight); self._active = true; - //self.node().style.maxHeight = '' + maxHeight + 'px'; // Tobias 2011-05-26: Anyone know why this is commented? + if( maxHeight < 100 ) { // List goes above button + // Calculate new max height + var buttonNodeCumulativeOffset = Element.cumulativeOffset(self.buttonNode); + maxHeight = buttonNodeCumulativeOffset.top - 25; + if( maxHeight < actualHeight ) { + self.node().style.height = '' + maxHeight + 'px'; + } + // Set new position above button + Position.clone(self.buttonNode, self.listNode, { + setWidth: false, + setHeight: false, + offsetTop: -(Element.getHeight(self.listNode)) }); + } + + self.node().style.maxHeight = ''; if( maxHeight < actualHeight ) { + self.node().style.maxHeight = '' + maxHeight + 'px'; var id = self.idOfFirstSelected(); if( id ) { $(id).top = 0; } } - - //< added by raihan for FS#2556 > - var list = self.node().getElementsByTagName("li"); - - if( (cumulativeOffset.top + 24 * list.length) > viewportHeight ) { - if( cumulativeOffset.top > 24 * list.length ) { - var maxHeight = viewportHeight - cumulativeOffset.top + 430; - var bottom = viewportHeight - cumulativeOffset.top + 18; - - self.listNode.style.position = 'absolute'; - self.listNode.style.bottom = bottom +'px'; - self.listNode.style.top = ''; - self.node().style.maxHeight = '' + maxHeight + 'px'; - } - } else { - if( Prototype.Browser.IE == false ) { - self.node().style.maxHeight = '' + maxHeight + 'px'; - } - } - //< added by raihan for FS#2556 > - /* Tobias 2011-05-26: Setting the width sometimes causes strange problems in IE - disable it for now - self.node().style.width = '' + (actualWidth + (browser == 'Internet Explorer' ? 30 : 20)) + 'px'; */ + // Tobias 2011-05-26: Setting the width sometimes causes strange problems in IE - disable it for now + //self.node().style.width = '' + (actualWidth + (browser == 'Internet Explorer' ? 30 : 20)) + 'px'; - if( (cumulativeOffset.left + actualWidth + 40) > document.viewport.getDimensions().width ) { - self.listNode.style.left = '' + (cumulativeOffset.left - ((cumulativeOffset.left + actualWidth + 40) - document.viewport.getDimensions().width)) + 'px'; + if( (nodeCumulativeOffset.left + actualWidth + 40) > viewportDimensions.width ) { + self.listNode.style.left = '' + (nodeCumulativeOffset.left - ((nodeCumulativeOffset.left + actualWidth + 40) - viewportDimensions.width)) + 'px'; } }; self.hideList = function() { @@ -204,9 +207,9 @@ function ComponentMultiplePopup( id ) { self.showingList = false; // This causes browser window to flash in Linux/Firefox (3.5.9) //self.node().style.maxHeight = '' + 1024 + 'px'; - /* Tobias 2011-05-26: Setting the width sometimes causes strange problems in IE - disable it for now - self.node().style.width = '' + self.getState('reset-width') + 'px'; */ - self.node().style.height = '' + self.getState('reset-height') + 'px'; + // Tobias 2011-05-26: Setting the width sometimes causes strange problems in IE - disable it for now + //self.node().style.width = '' + self.getState('reset-width') + 'px'; + //self.node().style.height = '' + self.getState('reset-height') + 'px'; document.body.onclick = null; }; self.registerEventHandler = function( value, callback ) { From a16d84f5e530a2284a348115b0ca69cca72cdd2e Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 17 Aug 2011 10:32:57 +0200 Subject: [PATCH 025/190] When using the MultiplePopup component it is now possible if one chooses to configure the component that way to select no items. --- .../MultiplePopup/MultiplePopup.css | 2 +- .../MultiplePopup/MultiplePopup.feh | 3 +++ .../Components/MultiplePopup/MultiplePopup.js | 27 ++++++++++++++++--- .../MultiplePopup/MultiplePopup.template | 7 ++++- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.css b/Public/Support/Components/MultiplePopup/MultiplePopup.css index b2e116b..78ee45a 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.css +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.css @@ -56,7 +56,7 @@ .wfMultiplePopupList div:hover { background-color: #79d9f7; } -.wfMultiplePopupList div.selectall { +.wfMultiplePopupList div.selectall, .wfMultiplePopupList div.selectnone { border-bottom: 1px solid #BBB; } .wfMultiplePopupList div.done { diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.feh b/Public/Support/Components/MultiplePopup/MultiplePopup.feh index de22a83..ca38e19 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.feh +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.feh @@ -4,8 +4,11 @@ namespace modifies GUIKit { [attribute string allItemsSelectedText 'All Items' 'The text to be shown when all items are selected']; [attribute string multipleItemsSelectedText 'Multiple Items' 'The text to be show when some items are selected']; + [attribute string noItemsSelectedText 'No Items' 'The text to be shown when no items are selected']; [attribute boolean wantSelectAll true 'Whether to show select all']; + [attribute boolean wantSelectNone false 'Whether to show select none']; [attribute boolean multiple true 'Whether to show the done button']; + [attribute boolean requiresSelection true 'Whether at least one item always should be selected']; function component return 'MultiplePopup'; diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.js b/Public/Support/Components/MultiplePopup/MultiplePopup.js index 199ca19..9761251 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.js +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.js @@ -3,18 +3,19 @@ function ComponentMultiplePopup( id ) { self.bind = function() {}; - self._requiresSelection = true; - self.buttonNode = $( id + '_button' ); self.listNode = $( id + '_list' ); self.doneNode = $(id + '.Done'); self.selectAllNode = $(id + '.SelectAll'); + self.selectNoneNode = $(id + '.SelectNone'); self.showingList = false; + self._requiresSelection = true; self._multiple = true; self.setState('multiple-items-text', 'Multiple Items'); self.setState('all-items-text', 'All Items'); + self.setState('no-items-text', 'No Items'); self.setVisible = function( status ) { if( status ) @@ -22,7 +23,17 @@ function ComponentMultiplePopup( id ) { else self.buttonNode.hide(); }; - + self._selectNone = function() { + self.itemsEach(function( index, item ) { + if( self.itemIsSelected(item) ) { + self.itemDeselect(item); + } + }); + }; + self.selectNone = function() { + self._selectNone(); + self.action('change'); + }; self._forceSelectItemsByValue = function( value ) { var items = self.itemsByValue(value); if( items.length > 0 ) { @@ -291,6 +302,13 @@ function ComponentMultiplePopup( id ) { CancelEvent(event); }; } + if( self.selectNoneNode ) { + self.selectNoneNode.onclick = function(event) { + self.hideList(); + self.selectNone(); + CancelEvent(event); + }; + } var previousUpdateSelected = self.updateSelected; self.updateSelected = function() { @@ -316,6 +334,9 @@ function ComponentMultiplePopup( id ) { if( count == totalCount ) { title = self.getState('all-items-text'); } + if( count == 0 ) { + title = self.getState('no-items-text'); + } } while( self.buttonNode.hasChildNodes() ) { diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.template b/Public/Support/Components/MultiplePopup/MultiplePopup.template index f0091ab..8baabcf 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.template +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.template @@ -4,6 +4,9 @@ [wantSelectAll:
    Select All
    ] + [wantSelectNone: +
    Select None
    + ]
      [@Items: []]
    @@ -17,9 +20,11 @@ SetComponent('[ID]', ComponentMultiplePopup('[ID]')); _('[ID]').setState('all-items-text', '[allItemsSelectedText]'); _('[ID]').setState('multiple-items-text', '[multipleItemsSelectedText]'); + _('[ID]').setState('no-items-text', '[noItemsSelectedText]'); + _('[ID]')._requiresSelection = [requiresSelection:true][!requiresSelection:false]; _('[ID]').setMultiple([multiple:true][!multiple:false]); _('[ID]').applyEventHandlers(); _('[ID]').activate(); - [@Selected: _('[.ID]')._selectItemsByValue('[]');] + [@Selected: _('[.ID]')._forceSelectItemsByValue('[]');] _('[ID]').updateSelected(); From 31bbaf36549c4eb7f754dad01a6fbe3167dab7ec Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 17 Aug 2011 15:55:19 +0200 Subject: [PATCH 026/190] Fix for FS#2772 - Spell check - doesn't work. Apparently it does not always work so good to use a config file for Ckeditor toolbar when you have several Ckeditor instances on the same page so lets not set the toolbar using the config file. --- Public/Support/Components/TextView/TextView.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Public/Support/Components/TextView/TextView.js b/Public/Support/Components/TextView/TextView.js index 93ce06d..5c5ff21 100644 --- a/Public/Support/Components/TextView/TextView.js +++ b/Public/Support/Components/TextView/TextView.js @@ -174,7 +174,7 @@ function ComponentTextView( id ) { } }; CKEDITOR.on('instanceReady', callback); - CKEDITOR.replace(self.node(), { toolbar: self._ckeditorToolbar, height: textarea_height }); + CKEDITOR.replace(self.node(), { toolbar: [ ['CentionSpellCheckLanguage', 'CentionSpellCheck', 'CentionSpellCheckDone'] ], height: textarea_height }); } } // Ckeditor @@ -191,7 +191,18 @@ function ComponentTextView( id ) { if( self.ckeditor() ) { self.ckeditor().setPlainTextMode(false); } else { - CKEDITOR.replace(self.node(), { toolbar: self._ckeditorToolbar, height: textarea_height }); + CKEDITOR.replace(self.node(), { toolbar: [ + ['Bold','Italic','Underline','Strike'], + ['NumberedList','BulletedList'], + ['Outdent','Indent','Blockquote'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['CentionLink', 'Link'], + ['CentionImage','HorizontalRule'], + ['Font','FontSize'], + ['TextColor','BGColor'], + ['CentionSpellCheckLanguage', 'CentionSpellCheck', 'CentionSpellCheckDone'], + ['PlainText'] + ], height: textarea_height }); } } // Textarea From 67af4bdb8e7c4ee4231b826aa8c2da32cf25eb52 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 18 Aug 2011 17:25:04 +0200 Subject: [PATCH 027/190] Use the correct cursor for these components. --- Public/Support/Components/Helper/Helper.css | 3 ++- Public/Support/Components/Textfield/Textfield.feh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Public/Support/Components/Helper/Helper.css b/Public/Support/Components/Helper/Helper.css index bc424c7..5dd6409 100644 --- a/Public/Support/Components/Helper/Helper.css +++ b/Public/Support/Components/Helper/Helper.css @@ -12,4 +12,5 @@ font-weight: bold; font-size: 1.5em; color: #393; -} \ No newline at end of file + cursor: pointer; +} diff --git a/Public/Support/Components/Textfield/Textfield.feh b/Public/Support/Components/Textfield/Textfield.feh index 26382ec..6c19110 100644 --- a/Public/Support/Components/Textfield/Textfield.feh +++ b/Public/Support/Components/Textfield/Textfield.feh @@ -35,6 +35,7 @@ namespace modifies GUIKit { array values = .generateTemplateAttributes('wfTextfield'); object component = GUIKit.componentByName('Textfield'); string path = component.pathForComponentResource('Textfield.template'); + values['Style'] = (values['Style'] ? values['Style'] + ';' : '') + 'cursor:text;'; values['EventCode'] = .onKeyPress(); values['TextValue'] = Regexp.replaceAll('"', values['TextValue'], '"'); values['JavascriptSafeTextValue'] = JSON.escape(values['TextValue']); From 3010b15bbb4cfbc766cad2ade65a6f8ff89bca48 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Fri, 19 Aug 2011 16:51:33 +0200 Subject: [PATCH 028/190] Fix for FS#2851 - Wrong agent pre-selected in My Errands. --- Public/Support/Components/MultiplePopup/MultiplePopup.template | 1 + 1 file changed, 1 insertion(+) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.template b/Public/Support/Components/MultiplePopup/MultiplePopup.template index 8baabcf..bfb2a40 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.template +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.template @@ -25,6 +25,7 @@ _('[ID]').setMultiple([multiple:true][!multiple:false]); _('[ID]').applyEventHandlers(); _('[ID]').activate(); + _('[ID]').resetSelected(); [@Selected: _('[.ID]')._forceSelectItemsByValue('[]');] _('[ID]').updateSelected(); From 4ac4c89da9068f17ef7b075d6a623e4a4e38e5b4 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Fri, 19 Aug 2011 16:54:05 +0200 Subject: [PATCH 029/190] Component code and images for Wysiwyg Editor. --- Public/Resources/Images/Wysiwyg/add.png | Bin 0 -> 373 bytes .../Images/Wysiwyg/backgroundcolor.png | Bin 0 -> 280 bytes .../Resources/Images/Wysiwyg/blockjustify.png | Bin 0 -> 228 bytes Public/Resources/Images/Wysiwyg/bold.png | Bin 0 -> 229 bytes .../Images/Wysiwyg/centerjustify.png | Bin 0 -> 237 bytes Public/Resources/Images/Wysiwyg/check.png | Bin 0 -> 397 bytes Public/Resources/Images/Wysiwyg/done.png | Bin 0 -> 303 bytes .../Images/Wysiwyg/dropdownbutton.png | Bin 0 -> 505 bytes Public/Resources/Images/Wysiwyg/hr.png | Bin 0 -> 219 bytes Public/Resources/Images/Wysiwyg/ignore.png | Bin 0 -> 522 bytes Public/Resources/Images/Wysiwyg/image.png | Bin 0 -> 252 bytes Public/Resources/Images/Wysiwyg/indent.png | Bin 0 -> 306 bytes Public/Resources/Images/Wysiwyg/italic.png | Bin 0 -> 195 bytes .../Resources/Images/Wysiwyg/leftjustify.png | Bin 0 -> 241 bytes Public/Resources/Images/Wysiwyg/link.png | Bin 0 -> 486 bytes Public/Resources/Images/Wysiwyg/ol.png | Bin 0 -> 301 bytes Public/Resources/Images/Wysiwyg/outdent.png | Bin 0 -> 310 bytes Public/Resources/Images/Wysiwyg/quote.png | Bin 0 -> 230 bytes Public/Resources/Images/Wysiwyg/replace.png | Bin 0 -> 421 bytes .../Resources/Images/Wysiwyg/rightjustify.png | Bin 0 -> 230 bytes .../Images/Wysiwyg/strikethrough.png | Bin 0 -> 231 bytes Public/Resources/Images/Wysiwyg/textcolor.png | Bin 0 -> 253 bytes Public/Resources/Images/Wysiwyg/ul.png | Bin 0 -> 265 bytes Public/Resources/Images/Wysiwyg/underline.png | Bin 0 -> 190 bytes .../Support/Components/WysiwygEditor/Core.feh | 1 + .../WysiwygEditor/WysiwygEditor.css | 265 ++++++++++++++++++ .../WysiwygEditor/WysiwygEditor.feh | 30 ++ .../Components/WysiwygEditor/WysiwygEditor.js | 0 .../WysiwygEditor/WysiwygEditor.template | 9 + .../WysiwygEditor/toolbar-background.png | Bin 0 -> 208 bytes .../toolbar-item-group-background.png | Bin 0 -> 218 bytes 31 files changed, 305 insertions(+) create mode 100644 Public/Resources/Images/Wysiwyg/add.png create mode 100644 Public/Resources/Images/Wysiwyg/backgroundcolor.png create mode 100644 Public/Resources/Images/Wysiwyg/blockjustify.png create mode 100644 Public/Resources/Images/Wysiwyg/bold.png create mode 100644 Public/Resources/Images/Wysiwyg/centerjustify.png create mode 100644 Public/Resources/Images/Wysiwyg/check.png create mode 100644 Public/Resources/Images/Wysiwyg/done.png create mode 100644 Public/Resources/Images/Wysiwyg/dropdownbutton.png create mode 100644 Public/Resources/Images/Wysiwyg/hr.png create mode 100644 Public/Resources/Images/Wysiwyg/ignore.png create mode 100644 Public/Resources/Images/Wysiwyg/image.png create mode 100644 Public/Resources/Images/Wysiwyg/indent.png create mode 100644 Public/Resources/Images/Wysiwyg/italic.png create mode 100644 Public/Resources/Images/Wysiwyg/leftjustify.png create mode 100644 Public/Resources/Images/Wysiwyg/link.png create mode 100644 Public/Resources/Images/Wysiwyg/ol.png create mode 100644 Public/Resources/Images/Wysiwyg/outdent.png create mode 100644 Public/Resources/Images/Wysiwyg/quote.png create mode 100644 Public/Resources/Images/Wysiwyg/replace.png create mode 100644 Public/Resources/Images/Wysiwyg/rightjustify.png create mode 100644 Public/Resources/Images/Wysiwyg/strikethrough.png create mode 100644 Public/Resources/Images/Wysiwyg/textcolor.png create mode 100644 Public/Resources/Images/Wysiwyg/ul.png create mode 100644 Public/Resources/Images/Wysiwyg/underline.png create mode 100644 Public/Support/Components/WysiwygEditor/Core.feh create mode 100644 Public/Support/Components/WysiwygEditor/WysiwygEditor.css create mode 100644 Public/Support/Components/WysiwygEditor/WysiwygEditor.feh create mode 100644 Public/Support/Components/WysiwygEditor/WysiwygEditor.js create mode 100644 Public/Support/Components/WysiwygEditor/WysiwygEditor.template create mode 100644 Public/Support/Components/WysiwygEditor/toolbar-background.png create mode 100644 Public/Support/Components/WysiwygEditor/toolbar-item-group-background.png diff --git a/Public/Resources/Images/Wysiwyg/add.png b/Public/Resources/Images/Wysiwyg/add.png new file mode 100644 index 0000000000000000000000000000000000000000..87d17fc4fcf33b1259f7775905fac44ea34d62ed GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg4Mh+e^%?ncd{E}Rvt|D&xto4^4lVW*Kd3hvd*0E{KcdfY<&n&@(~%9Q zEYGyBGQGrQAbfOY*foxZ&)*W8eyo^k>U`Q{*`zh1^{O8tpNk*qbN{V&PUs8JZw#KU KelF{r5}E)r_Km9m literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/backgroundcolor.png b/Public/Resources/Images/Wysiwyg/backgroundcolor.png new file mode 100644 index 0000000000000000000000000000000000000000..b1d765c7352bb8dab3cd84b3ab27410257bb4132 GIT binary patch literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ zgfO@@^rpN5if|TqL>4nJa0`PlBg3pY5H=O_S>vNyvE8mI4@cPg(OQ{BTAg} zb8}PkN*J7rQWHy3QxwWGOEMJPJ$(bh8~Mb6ii$m5978NlCnqcrFc6zxdF;S}10Uwg z?A@yt#N(5a)fRoK$@kgGQ*}IsGe0=3S!NI@#pZM5MxVdTdhP2Qo<8H zvvKQ9F8n$3Rb0Zs=QTNcRhu@+yUy#Bs%*To4nJa0`PlBg3pY5H=O_S?+teDZ>a_1K+(LXst}5hc#~ zxw)x%B@E6*sfi`2DGKG8B^e6tp1uL$jeO!jMfRR9jv*GOlM@yQ7#JBC7_>~E_D|jY z^Qm`vZfzopr0G(DoK>z>% literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/bold.png b/Public/Resources/Images/Wysiwyg/bold.png new file mode 100644 index 0000000000000000000000000000000000000000..41ee077c15fb77dcfa3d38b97957f7920564de7c GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S?+teDacKzxEdbg(OQ{BTAg} zb8}PkN*J7rQWHy3QxwWGOEMJPJ$(bh8~Mb6iX1#$978NlCnrdJY7mT7*t6w}y&bRi z?%jc33?^nN?_$+Ca;xohs*kfik4F*XIs*r>uPgg&ebxsLQ0JH=@#{d8T literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/centerjustify.png b/Public/Resources/Images/Wysiwyg/centerjustify.png new file mode 100644 index 0000000000000000000000000000000000000000..fb4b9480b52887d9e37a094915bfed9e4e55f88d GIT binary patch literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S?+teDa#Fb@tx{3Q3l@MwB?` z=jNv7l`uFLr6!i7rYMwWmSiZnd-?{1H}Z)C6?u5NIEGl9PEJ@LU|?hb1QODRSr5&f z^Y8KH4Mq3u+$^5IiS%LiU`ju4v_T+Q+wb}u+tVJh;tI@@4lzV4^tBz#keKk8sf&@} YS+`F0iQL70(Y)*K0-AbW|YuPgg4MjkE|%hh||&jbodmbgZgIOpf) zrskC}I2WZRmZYXAlxLP?D7bt2281{Ai31hA@N{tuu{gbUvMpbegFx$jhN)XOZoMB- z#UO3Eu`SQG_4x;p3olt4yd{#hO$*v^)hm))s3rA}^Y)u5X7^{C8(XtHi!nDodsJ3m z$=Gdv!}^vN(Kkdk?mA!+7uu6-7nQ^*G>NrTYC6+l&92Xa4lG8SZ|8N~E<49{gIoRu z?}E?L2;70!#oqC>*`M`1h-Zl==(6Y kIey=#|I=2!wz|(~VU{yv-L3fFKtD5hy85}Sb4q9e0N7lXr2qf` literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/done.png b/Public/Resources/Images/Wysiwyg/done.png new file mode 100644 index 0000000000000000000000000000000000000000..3ef0fdd9e27c09a643098b5f67302408d66d2edb GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg4MjkE&V||vx%|Ic^64!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiF3uPZ!4!i_^&|2bh+{^8f7jwec?IRo*3` zY$)|n@`%T(v=V2DlNWn(IJh@CwEfazb8~ZRdui?@X=EC9_~^u+m-AZ|NgQg*vEG!H z(rRG0X`#V%W5L%kC1(vBwlKc%Yp-q$k?u5Nn4aq*-Eg)nrp+kPd!7NWflrB*L!VYj m_yaECS1PHiQq+nz8#B!7@qC;5swNBQDh5wiKbLh*2~7aQr(yvB literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/dropdownbutton.png b/Public/Resources/Images/Wysiwyg/dropdownbutton.png new file mode 100644 index 0000000000000000000000000000000000000000..1111eedec3dffdcfcecb8c3e6db5947c96df4441 GIT binary patch literal 505 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JUE z;Mx3@1wawb0*}aI1_o|n5N2eUHAey{$X?><>&kwcS(ZzJPB>g487z z&L6c-t_G^UD<<&B@`lb3*DQzg=d=B*ZRCXi^atoWzwwY@WawRB@rQ2(d(xWVQl%yO{s9*i zUe9Pcb5y9oBY??cNtefipDsxWu`eaECN9hL3pY$+VMq%zxc|0nzt+Z@Xg254lm5#m zOI#6Io^yY@ME`Nt3Zt1K4~{=(^yWFiwS{Y{WX6%ItxmVMN!rxTJai^uN&i7Bbpz!y zFRG4gj?BNXO*d`xOzTv>Ws*JDrWX9OVb`2K-B9%Dx3uO%*Iu0a{Z~#eq@|PbL@%52 z#3hR+SzTQGX1BxVBOf2O&rVF<#r~$Wd|Ti-$sVIAeoGX7)IC#hOsPEZwCJOnwggK~ tK`_Uos@+L9sxxLilb^n-d)K<3ym9QUeuZ65zk!j!;OXk;vd$@?2>`gr#=HOk literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/hr.png b/Public/Resources/Images/Wysiwyg/hr.png new file mode 100644 index 0000000000000000000000000000000000000000..92b7caa4a3d47827811ebb8e7d34fe4f4ca51cf7 GIT binary patch literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JM? zdKgwcTW6CA6yYrJh%9Dc;1&j9Muu5)B!GhKC7!;n?6;XYxXrZ+FH9-`3Q3l@MwB?` z=jNv7l`uFLr6!i7rYMwWmSiZnd-?{1H}Z)C6`6UuIEGl9PEL@>IKYwIGJV=Vb=SwI z-sQRd+S!n`t+$PFEpy<)bWzX79}84^CN=^=XQBuL!&)m5j?ey#kw6m|JYD@<);T3K F0RSgFKVkp? literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/ignore.png b/Public/Resources/Images/Wysiwyg/ignore.png new file mode 100644 index 0000000000000000000000000000000000000000..11eb1f0d46ebf0ce7910066367058f38fa7e7d2b GIT binary patch literal 522 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg4Mh+ekKKGT=8-PNRC9V-A&iT2y zsd*&~&PAz-C8;S2<(VZJ3hti10pX2&;y|lXJzX3_EKbjzyw{7_QKWUh*Eb z99&I89~f2U3jF7YNcpIKFkSE~=O>=d-2$wRO)0OhWGZuHr>=Ap)JZZDvwoac7jcw3 z_{`IJ#qaJ|h8qaX%_`$M!RVSGUcoNqAh}~}&U@u3eYOMa2UHa#Wo;KE+?ynHQKRXQVQR)$x9<5Z|(MOLN3M?sLzLSA`m~>};7=7BIt${lRj! zy=j^ub+ryo4hFmV6dePZX3jtLaw@}xZ|%p|bGjBO&N`>^>tBhDq(BQ7L(kLK4^x#~ zmEzqsUB6dJuk^i?-?87_IjfyjYjW}7E{E?~*&H|b-elL{uT74Tc(i_kL1s@0hect6 zv)so68&j+MST5YN>sJo=`+)oOw>g2QzhtYsRX#EMmp*qtW5C~<^71#S8!d literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/image.png b/Public/Resources/Images/Wysiwyg/image.png new file mode 100644 index 0000000000000000000000000000000000000000..1ad554bcdaa71ec9a7c13ee426de1f90c056840d GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JM? zdKgwcTW6CA6yYrJh%9Dc;1&j9Muu5)B!GhKC7!;n?6;XYxOJFkg&b@H3e|YJIEGl9 zPX6=%zdf^RLu+GWqhs~)+P3`g^Al2prf=hX9Ln$7!FYe&yr1=!ho`H|E=|w*cmBb` z6DOL~Jf@_joQ}Al+AN#%AuF!>0SDLo&PFGL4{Ql72bZn>-nL7;ZhxKIKE@@>++I~S qdf#pdEI*bu$yk^f2$YxJlw^?Jrm7R*E)W592ZN`ppUXO@geCx;Syku& literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/indent.png b/Public/Resources/Images/Wysiwyg/indent.png new file mode 100644 index 0000000000000000000000000000000000000000..1a554de6db4f5542f78acdef78da2cbb002ef2a9 GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JM? zdKgwcTW6CA6yYrJh%9Dc;1&j9Muu5)B!GhKC7!;n?6;XYxQz_k4z0fl6p}1)jVN)> z&&^HED`9XhN=+bZ;V;Pw1wOamfF4>cM4nJa0`PlBg3pY5H=O_S?+tdA}`foLm06NL*k%&;+@puuSaSWcWelF{r5}E+89XB}u literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/leftjustify.png b/Public/Resources/Images/Wysiwyg/leftjustify.png new file mode 100644 index 0000000000000000000000000000000000000000..e9a9331a750958763ae54c9bd343b7ca91360fa0 GIT binary patch literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S?+td z&&^HED`9XhN=+~GO eva2D9f#Jk2o$8g#bhZP{W$<+Mb6Mw<&;$TOdrJ!d literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/link.png b/Public/Resources/Images/Wysiwyg/link.png new file mode 100644 index 0000000000000000000000000000000000000000..b6879f5adfec50aede5e691365c5e6b6df86ef17 GIT binary patch literal 486 zcmV@P)Px#24YJ`L;xTFi~y?Ut~_Y~000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipS( z3ojHhsuzL)000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0003&NklPe){dAiNI6!b@ zC+Foj6I(CGXa{G>KWH=>d$n3^15uel=!~SYPH%o(&oGS2LMh_ zjtfDP=?s9I>ni|!-`^N%s%-ZVBX6go(quYAwtGk^volZfxy*8l(j literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/ol.png b/Public/Resources/Images/Wysiwyg/ol.png new file mode 100644 index 0000000000000000000000000000000000000000..0e1f7ed68aea499be2dde050a2e1b8f4259235f4 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S?+tdT#9Zjg{||drmE#W4U3KzG_zCB%!&}Gmb<(VmzsSVTTKYg5~6=;?sO(xNjZ3 pC~0o{%x7=qvuDrtbF|N{V9qFWIk180a~RM~44$rjF6*2UngGd4WZeJ& literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/outdent.png b/Public/Resources/Images/Wysiwyg/outdent.png new file mode 100644 index 0000000000000000000000000000000000000000..29de65f123c566f4a501a151557f9f4e8bd95f5e GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JM? zdKgwcTW6CA6yYrJh%9Dc;1&j9Muu5)B!GhKC7!;n?6;XYc;p#d>n_U!g(OQ{BTAg} zb8}PkN*J7rQWHy3QxwWGOEMJPJ$(bh8~Mb6iY9uxIEGl9zB=hNZ;Jts%Y4;x2hEZL ziP1O0G#ER*l&TgmPj_PXcqlaC=h{sv`qt{FgWf!!>9CNcVb`;}CLeDfU-&*%`h!Q> zizs^~gWrmb2kwLk3cOW&cjA!6sgp-4D;Qnwe|9e7_%m%r#)Z5|{`Xjn1GksD7qr(* zv5N7Od*FZK(}Cp^E^H3|v3|aWxMqM)z#3M)ZbvDvJ?R^Pj$`n2^>bP0l+XkKuq$jy literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/quote.png b/Public/Resources/Images/Wysiwyg/quote.png new file mode 100644 index 0000000000000000000000000000000000000000..e132cefecf397252d6663157f1c34cc70fee78b6 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S?+td~#|@9g}&1LXst}5hc#~ zxw)x%B@E6*sfi`2DGKG8B^e6tp1uL$jeO!jMUI{>jv*GOlM^I9H3%N#(AWLjud{K} z?%9Gf`@QE0&Q{r_RP)JaN>!s3+k)TX)5AO1cKqq_o!9y5qgU74D_3or7#Y&c6}jaF SR;B?BWAJqKb6Mw<&;$Swr9(Xc literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/replace.png b/Public/Resources/Images/Wysiwyg/replace.png new file mode 100644 index 0000000000000000000000000000000000000000..b6455bfdf9856ef815836c7366010bdff1591e56 GIT binary patch literal 421 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg4Mh+f6wL^wS7XpPOOI#yLobz*Y zQ}ap~oQqNuOHxx5$}>wc6x=<11Hv2m#DP{Zc)B=-Se%|a+24=JP~vEP?hQ_rJ5BQr zN>A9Z$*tw)t{L|lj|iL(_||4I`NG_b!WHdO`HX?$Iv0G8U-6VoxVP&6z29-4_xcAM ze(Zkl{@eZQ%k1N&Bp9O~@J2A6ciVaX$KDR}YpkK;g*Y|gRQ8CE#WRoawSmU>Dy|#*rapK;4 z41cHbZTl23)k{Nu-Q>J~yAt-+aW-0Zu!XOmJ7GiM<@=9!&pM%X^O&*Bmy{FV*05Gq zS?<^^5I9Brz@H-`b`npYtxTN7a8&Tq6^(F}<%S(4&Q_a)kNp%^PfgJ)sd>f(3@`>y LS3j3^P6ME z`6564&Z&2KZcS_tSkuoNZ4lVRDj!k#O=oIM1OEeF=2bfrOnBUCBm#IC3hTA5Mz4ui Q2O7rU>FVdQ&MBb@09WBb1poj5 literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/strikethrough.png b/Public/Resources/Images/Wysiwyg/strikethrough.png new file mode 100644 index 0000000000000000000000000000000000000000..a5d7553b07cfb1c74cd71b92b8060138f39f65f7 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)W_BJEB~C7Xkhzj2t`Q~9`MJ5N zc_j?aMX8A;sVNHOnI#zt?w-B@;f;LaKt)cTE{-7Q~e{ebgcw PXc~j3tDnm{r-UW|aJWJ( literal 0 HcmV?d00001 diff --git a/Public/Resources/Images/Wysiwyg/textcolor.png b/Public/Resources/Images/Wysiwyg/textcolor.png new file mode 100644 index 0000000000000000000000000000000000000000..40c6d3dbbcefc95534b1abaa878ebd7f85f720b6 GIT binary patch literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rl_ ztY&bt6AfSoif|TqL>4nJa0`PlBg3pY5H=O_S>vNyjHwdWz+Wqg(OQ{BTAg} zb8}PkN*J7rQWHy3QxwWGOEMJPJ$(bh8~Mb6iXuE+978NlCnrc`9O&@f@Z-$p|1XmE zss%+{H441TdL!rfbFMvl2cG8Ks${(R^Tf8tLdUZicuMa1JBUVjYU@8JdN%)R-v5`6 rnPL)deH9Q9PkH}#={jz4nJa0`PlBg3pY5H=O_S?+td z&&^HED`9XhN=+4nJa0`PlBg3pY5H=O_S?+te2UD4LAhl>Av;eO#}JFt z$q5pl8U$ww$3^{;KNffMuJ05X;iY;KrVU(d28*~A+{Mir item['label'], + 'language' => item['language'], + 'selected' => (.selectedLanguage == item['language'] ? true : false) + ]; + }; + values['Languages'] = JSON.valueToJSON(languages); + return GUIKit.ViewTemplate.renderPath(path, values); + } + } + } +} + diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js new file mode 100644 index 0000000..e69de29 diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template new file mode 100644 index 0000000..2ab2ad8 --- /dev/null +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template @@ -0,0 +1,9 @@ + + + + diff --git a/Public/Support/Components/WysiwygEditor/toolbar-background.png b/Public/Support/Components/WysiwygEditor/toolbar-background.png new file mode 100644 index 0000000000000000000000000000000000000000..63b5a83a8ac07a1c9d6984b9b60895c48ae67194 GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^j6j^i!3HGVb)phL0>we@P7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)CJA0e)hWyttARq2C9V-A&iT2y zsd*&~&PAz-C8;S2<(VZJ3hti10pX2&;y^{(o-U3d5|@*I{QUg9UX2Y1N*?|H|KFuE raq`iXe7>B@%F0IE%TF$5G38`1Un9Bb+uedEKy3`3u6{1-oD!Mwe@P7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)CJ9~@#dne%-+@AsC9V-A&iT2y zsd*&~&PAz-C8;S2<(VZJ3hti10pX2&;y^{Fo-U3d5|`ih7;-Tf@GxEdzu)ru(g^{( z%3l^~%;8dKP|9Qq$k7hndfE5o+P9Iv7wmQZS<%RP%2;V*hT@4YKm!;&UHx3vIVCg! E05|+Wng9R* literal 0 HcmV?d00001 From 894b322f091e1496b30c69a11549dd176bca9664 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Sun, 21 Aug 2011 12:37:19 +0200 Subject: [PATCH 030/190] Moved images into Components folder and moved WysiwygEditor Javascript code into WysiwygEditor.js. --- .../WysiwygEditor}/add.png | Bin .../WysiwygEditor}/backgroundcolor.png | Bin .../WysiwygEditor}/blockjustify.png | Bin .../WysiwygEditor}/bold.png | Bin .../WysiwygEditor}/centerjustify.png | Bin .../WysiwygEditor}/check.png | Bin .../WysiwygEditor}/done.png | Bin .../WysiwygEditor}/dropdownbutton.png | Bin .../WysiwygEditor}/hr.png | Bin .../WysiwygEditor}/ignore.png | Bin .../WysiwygEditor}/image.png | Bin .../WysiwygEditor}/indent.png | Bin .../WysiwygEditor}/italic.png | Bin .../WysiwygEditor}/leftjustify.png | Bin .../WysiwygEditor}/link.png | Bin .../WysiwygEditor}/ol.png | Bin .../WysiwygEditor}/outdent.png | Bin .../WysiwygEditor}/quote.png | Bin .../WysiwygEditor}/replace.png | Bin .../WysiwygEditor}/rightjustify.png | Bin .../WysiwygEditor}/strikethrough.png | Bin .../WysiwygEditor}/textcolor.png | Bin .../WysiwygEditor}/ul.png | Bin .../WysiwygEditor}/underline.png | Bin Public/Resources/Javascript/Wysiwyg/Basic.js | 274 --- Public/Resources/Javascript/Wysiwyg/Colour.js | 159 -- Public/Resources/Javascript/Wysiwyg/Editor.js | 547 ------ Public/Resources/Javascript/Wysiwyg/Link.js | 193 --- .../Javascript/Wysiwyg/Spellcheck.js | 287 ---- .../Components/WysiwygEditor/WysiwygEditor.js | 1463 +++++++++++++++++ .../WysiwygEditor/WysiwygEditor.template | 1 - .../Plugins/GUIKit.plugin/Components/Page.feh | 3 +- 32 files changed, 1464 insertions(+), 1463 deletions(-) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/add.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/backgroundcolor.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/blockjustify.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/bold.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/centerjustify.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/check.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/done.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/dropdownbutton.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/hr.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/ignore.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/image.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/indent.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/italic.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/leftjustify.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/link.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/ol.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/outdent.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/quote.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/replace.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/rightjustify.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/strikethrough.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/textcolor.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/ul.png (100%) rename Public/Resources/Images/{Wysiwyg => Components/WysiwygEditor}/underline.png (100%) delete mode 100644 Public/Resources/Javascript/Wysiwyg/Basic.js delete mode 100644 Public/Resources/Javascript/Wysiwyg/Colour.js delete mode 100644 Public/Resources/Javascript/Wysiwyg/Editor.js delete mode 100644 Public/Resources/Javascript/Wysiwyg/Link.js delete mode 100644 Public/Resources/Javascript/Wysiwyg/Spellcheck.js diff --git a/Public/Resources/Images/Wysiwyg/add.png b/Public/Resources/Images/Components/WysiwygEditor/add.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/add.png rename to Public/Resources/Images/Components/WysiwygEditor/add.png diff --git a/Public/Resources/Images/Wysiwyg/backgroundcolor.png b/Public/Resources/Images/Components/WysiwygEditor/backgroundcolor.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/backgroundcolor.png rename to Public/Resources/Images/Components/WysiwygEditor/backgroundcolor.png diff --git a/Public/Resources/Images/Wysiwyg/blockjustify.png b/Public/Resources/Images/Components/WysiwygEditor/blockjustify.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/blockjustify.png rename to Public/Resources/Images/Components/WysiwygEditor/blockjustify.png diff --git a/Public/Resources/Images/Wysiwyg/bold.png b/Public/Resources/Images/Components/WysiwygEditor/bold.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/bold.png rename to Public/Resources/Images/Components/WysiwygEditor/bold.png diff --git a/Public/Resources/Images/Wysiwyg/centerjustify.png b/Public/Resources/Images/Components/WysiwygEditor/centerjustify.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/centerjustify.png rename to Public/Resources/Images/Components/WysiwygEditor/centerjustify.png diff --git a/Public/Resources/Images/Wysiwyg/check.png b/Public/Resources/Images/Components/WysiwygEditor/check.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/check.png rename to Public/Resources/Images/Components/WysiwygEditor/check.png diff --git a/Public/Resources/Images/Wysiwyg/done.png b/Public/Resources/Images/Components/WysiwygEditor/done.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/done.png rename to Public/Resources/Images/Components/WysiwygEditor/done.png diff --git a/Public/Resources/Images/Wysiwyg/dropdownbutton.png b/Public/Resources/Images/Components/WysiwygEditor/dropdownbutton.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/dropdownbutton.png rename to Public/Resources/Images/Components/WysiwygEditor/dropdownbutton.png diff --git a/Public/Resources/Images/Wysiwyg/hr.png b/Public/Resources/Images/Components/WysiwygEditor/hr.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/hr.png rename to Public/Resources/Images/Components/WysiwygEditor/hr.png diff --git a/Public/Resources/Images/Wysiwyg/ignore.png b/Public/Resources/Images/Components/WysiwygEditor/ignore.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/ignore.png rename to Public/Resources/Images/Components/WysiwygEditor/ignore.png diff --git a/Public/Resources/Images/Wysiwyg/image.png b/Public/Resources/Images/Components/WysiwygEditor/image.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/image.png rename to Public/Resources/Images/Components/WysiwygEditor/image.png diff --git a/Public/Resources/Images/Wysiwyg/indent.png b/Public/Resources/Images/Components/WysiwygEditor/indent.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/indent.png rename to Public/Resources/Images/Components/WysiwygEditor/indent.png diff --git a/Public/Resources/Images/Wysiwyg/italic.png b/Public/Resources/Images/Components/WysiwygEditor/italic.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/italic.png rename to Public/Resources/Images/Components/WysiwygEditor/italic.png diff --git a/Public/Resources/Images/Wysiwyg/leftjustify.png b/Public/Resources/Images/Components/WysiwygEditor/leftjustify.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/leftjustify.png rename to Public/Resources/Images/Components/WysiwygEditor/leftjustify.png diff --git a/Public/Resources/Images/Wysiwyg/link.png b/Public/Resources/Images/Components/WysiwygEditor/link.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/link.png rename to Public/Resources/Images/Components/WysiwygEditor/link.png diff --git a/Public/Resources/Images/Wysiwyg/ol.png b/Public/Resources/Images/Components/WysiwygEditor/ol.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/ol.png rename to Public/Resources/Images/Components/WysiwygEditor/ol.png diff --git a/Public/Resources/Images/Wysiwyg/outdent.png b/Public/Resources/Images/Components/WysiwygEditor/outdent.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/outdent.png rename to Public/Resources/Images/Components/WysiwygEditor/outdent.png diff --git a/Public/Resources/Images/Wysiwyg/quote.png b/Public/Resources/Images/Components/WysiwygEditor/quote.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/quote.png rename to Public/Resources/Images/Components/WysiwygEditor/quote.png diff --git a/Public/Resources/Images/Wysiwyg/replace.png b/Public/Resources/Images/Components/WysiwygEditor/replace.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/replace.png rename to Public/Resources/Images/Components/WysiwygEditor/replace.png diff --git a/Public/Resources/Images/Wysiwyg/rightjustify.png b/Public/Resources/Images/Components/WysiwygEditor/rightjustify.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/rightjustify.png rename to Public/Resources/Images/Components/WysiwygEditor/rightjustify.png diff --git a/Public/Resources/Images/Wysiwyg/strikethrough.png b/Public/Resources/Images/Components/WysiwygEditor/strikethrough.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/strikethrough.png rename to Public/Resources/Images/Components/WysiwygEditor/strikethrough.png diff --git a/Public/Resources/Images/Wysiwyg/textcolor.png b/Public/Resources/Images/Components/WysiwygEditor/textcolor.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/textcolor.png rename to Public/Resources/Images/Components/WysiwygEditor/textcolor.png diff --git a/Public/Resources/Images/Wysiwyg/ul.png b/Public/Resources/Images/Components/WysiwygEditor/ul.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/ul.png rename to Public/Resources/Images/Components/WysiwygEditor/ul.png diff --git a/Public/Resources/Images/Wysiwyg/underline.png b/Public/Resources/Images/Components/WysiwygEditor/underline.png similarity index 100% rename from Public/Resources/Images/Wysiwyg/underline.png rename to Public/Resources/Images/Components/WysiwygEditor/underline.png diff --git a/Public/Resources/Javascript/Wysiwyg/Basic.js b/Public/Resources/Javascript/Wysiwyg/Basic.js deleted file mode 100644 index 1ebde85..0000000 --- a/Public/Resources/Javascript/Wysiwyg/Basic.js +++ /dev/null @@ -1,274 +0,0 @@ -function WysiwygEditorBoldToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'bold', '', uriForServerImageResource('Wysiwyg/bold.png'), false, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('bold', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - if( container ) { - var style = Element.getStyle(container, 'font-weight'); - if( style == '700' || style == 'bold' ) - return true; - } - return false; - }); -} -function WysiwygEditorItalicToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Wysiwyg/italic.png'), false, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('italic', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'font-style') == 'italic' ) - return true; - return false; - }); -} -function WysiwygEditorUnderlineToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'underline', '', uriForServerImageResource('Wysiwyg/underline.png'), false, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('underline', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'text-decoration').search('underline') > -1 ) - return true; - return false; - }); -} -function WysiwygEditorStrikethroughToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'strikethrough', '', uriForServerImageResource('Wysiwyg/strikethrough.png'), true, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('strikethrough', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'text-decoration').search('line-through') > -1 ) - return true; - return false; - }); -} - -function WysiwygEditorOrderedListToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'ol', '', uriForServerImageResource('Wysiwyg/ol.png'), false, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('insertorderedlist', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - var found = false; - var node = container; - while( node && (node != editor.contentElement) ) { - if( node.tagName.toLowerCase() == 'ol' ) { - found = true; - break; - } - node = node.parentNode; - } - if( found ) - return true; - return false; - }); -} -function WysiwygEditorUnorderedListToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'ul', '', uriForServerImageResource('Wysiwyg/ul.png'), true, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('insertunorderedlist', false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }, function( editor, item, container ) { - var found = false; - var node = container - while( node && (node != editor.contentElement) ) { - if( node.tagName.toLowerCase() == 'ul' ) { - found = true; - break; - } - node = node.parentNode; - } - if( found ) - return true; - return false; - }); -} - -function WysiwygEditorOutdentToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'outdent', '', uriForServerImageResource('Wysiwyg/outdent.png'), false, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('outdent', false, false); - }); -} -function WysiwygEditorIndentToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'indent', '', uriForServerImageResource('Wysiwyg/indent.png'), true, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('indent', false, false); - }); -} - -function WysiwygEditorAddCommonJustifyFunction( editor ) { - editor.previousJustifyItemClicked = null; - editor.justifyItemClicked = function( item, command ) { - if( editor.previousJustifyItemClicked ) - editor.previousJustifyItemClicked.className = 'WysiwygEditorToolbarItem'; - editor.previousJustifyItemClicked = item; - editor.contentElement.focus(); - editor.iframeDocument.execCommand(command, false, false); - item.active = (item.active ? false : true); - item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - }; -} -function WysiwygEditorJustifyLeftToolbarItem( editor, group ) { - if( editor.justifyItemClicked == undefined ) { - WysiwygEditorAddCommonJustifyFunction(editor); - } - editor.addToolbarItem(group, 'leftjustify', '', uriForServerImageResource('Wysiwyg/leftjustify.png'), false, function( item ) { - editor.justifyItemClicked(item, 'justifyleft'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'text-align') == 'left' ) - return true; - return false; - }); -} -function WysiwygEditorJustifyCenterToolbarItem( editor, group ) { - if( editor.justifyItemClicked == undefined ) { - WysiwygEditorAddCommonJustifyFunction(editor); - } - editor.addToolbarItem(group, 'centerjustify', '', uriForServerImageResource('Wysiwyg/centerjustify.png'), false, function( item ) { - editor.justifyItemClicked(item, 'justifycenter'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'text-align') == 'center' ) - return true; - return false; - }); -} -function WysiwygEditorJustifyRightToolbarItem( editor, group ) { - if( editor.justifyItemClicked == undefined ) { - WysiwygEditorAddCommonJustifyFunction(editor); - } - editor.addToolbarItem(group, 'rightjustify', '', uriForServerImageResource('Wysiwyg/rightjustify.png'), false, function( item ) { - editor.justifyItemClicked(item, 'justifyright'); - }, function( editor, item, container ) { - if( container && Element.getStyle(container, 'text-align') == 'right' ) - return true; - return false; - }); -} - -function WysiwygEditorHorizontalLineToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'horizontalline', '', uriForServerImageResource('Wysiwyg/hr.png'), true, function( item ) { - editor.contentElement.focus(); - editor.iframeDocument.execCommand('inserthorizontalrule', false, false); - }); -} - -function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { - var list = [ - { name: 'Arial', label: 'Arial', font: 'arial' }, - { name: 'Arial black', label: 'Arial black', font: 'arial black' }, - { name: 'Comic Sans MS', label: 'Comic Sans MS', font: 'comic sans ms' }, - { name: 'Courier New', label: 'Courier New', font: 'courier new' }, - { name: 'Georgia', label: 'Georgia', font: 'georgia' }, - { name: 'Impact', label: 'Impact', font: 'Impact' }, - { name: 'Lucida Console', label: 'Lucida Console', font: 'lucida console' }, - { name: 'Lucida Sans Unicode', label: 'Lucida Sans Unicode', font: 'lucida sans unicode' }, - { name: 'Tahoma', label: 'Tahoma', font: 'tahoma' }, - { name: 'Times New Roman', label: 'Times New Roman', font: 'times new roman' }, - { name: 'Trebuchet MS', label: 'Trebuchet MS', font: 'trebuchet ms' }, - { name: 'Verdana', label: 'Verdana', font: 'verdana' } - ]; - editor.addToolbarDropDown(toolbar, 'Font', 155, list, function(item) { - //editor.contentElement.focus(); - editor.iframeDocument.execCommand('fontname', false, item.font); - }, function( itemLabel, container ) { - if( container ) { - var found = false; - var fontFamily; - if( Prototype.Browser.WebKit ) { - if( container.tagName.toLowerCase() == 'font' && container.className.toLowerCase() == 'apple-style-span' ) { - fontFamily = container.getAttribute('face').replace(/'/g, ''); - } - } else if( Prototype.Browser.IE ) { - if( container.tagName.toLowerCase() == 'font' ) { - fontFamily = container.getAttribute('face'); - } - if( !fontFamily ) { - fontFamily = Element.getStyle(container, 'font-family'); - } - } else { - fontFamily = Element.getStyle(container, 'font-family'); - } - if( fontFamily ) { - var size = list.length; - for( var i = 0; i < size; i++ ) { - var item = list[i]; - if( item.font == fontFamily ) { - if( fontFamily != editor.previousSelectionFontFamily ) { - itemLabel.innerHTML = item.name; - } - editor.previousSelectionFontFamily = item.font; - found = true; - break; - } - } - } - if( found == false && editor.previousSelectionFontFamily != 'Font' ) { - itemLabel.innerHTML = 'Font'; - editor.previousSelectionFontFamily = 'Font'; - } - } - }); -} -function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { - var list = [ - { name: '10', label: '10', size: 1 }, - { name: '12', label: '12', size: 2 }, - { name: '14', label: '14', size: 3 }, - { name: '18', label: '18', size: 4 }, - { name: '24', label: '24', size: 5 }, - { name: '32', label: '32', size: 6 }, - { name: '48', label: '48', size: 7 } - ]; - editor.addToolbarDropDown(toolbar, 'Size', 70, list, function(item) { - //editor.contentElement.focus(); - editor.iframeDocument.execCommand('FontSize', false, item.size); - }, function( itemLabel, container ) { - if( container ) { - var found = false; - var fontSize; - if( Prototype.Browser.WebKit ) { - if( container.tagName.toLowerCase() == 'font' && container.className.toLowerCase() == 'apple-style-span' ) { - fontSize = container.getAttribute('size').replace(/'/g, ''); - } - } else if( Prototype.Browser.IE ) { - if( container.tagName.toLowerCase() == 'font' ) { - fontSize = container.getAttribute('size'); - } - if( !fontSize ) { - fontSize = Element.getStyle(container, 'font-size'); - } - } else { - fontSize = Element.getStyle(container, 'font-size'); - } - if( fontSize ) { - var size = list.length; - for( var i = 0; i < size; i++ ) { - var item = list[i]; - if( item.size == fontSize ) { - if( fontSize != editor.previousSelectionFontSize ) { - itemLabel.innerHTML = item.name; - } - editor.previousSelectionFontSize = item.font; - found = true; - break; - } - } - } - if( found == false && editor.previousSelectionFontSize != 'Size' ) { - itemLabel.innerHTML = 'Size'; - editor.previousSelectionFontSize = 'Size'; - } - } - }); -} - diff --git a/Public/Resources/Javascript/Wysiwyg/Colour.js b/Public/Resources/Javascript/Wysiwyg/Colour.js deleted file mode 100644 index eba3ed2..0000000 --- a/Public/Resources/Javascript/Wysiwyg/Colour.js +++ /dev/null @@ -1,159 +0,0 @@ -function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { - editor.addToolbarItem(group, name, '', icon, false, function( item ) { - if( editor.colorPopup == undefined ) { - var colors = [ - [ '#000', '#800000', '#8B4513', '#2F4F4F', '#008080', '#000080', '#4B0082', '#696969' ], - [ '#B22222', '#A52A2A', '#DAA520', '#006400', '#40E0D0', '#0000CD', '#800080', '#808080' ], - [ '#F00', '#FF8C00', '#FFD700', '#008000', '#0FF', '#00F', '#EE82EE', '#A9A9A9' ], - [ '#FFA07A', '#FFA500', '#FFFF00', '#00FF00', '#AFEEEE', '#ADD8E6', '#DDA0DD', '#D3D3D3' ], - [ '#FFF0F5', '#FAEBD7', '#FFFFE0', '#F0FFF0', '#F0FFFF', '#F0F8FF', '#E6E6FA', '#FFF' ] - ]; - var moreColors = [ - [ "#000000", "#003300", "#006600", "#009900", "#00cc00", "#00ff00", "#330000", "#333300", "#336600", "#339900", "#33cc00", "#33ff00", "#660000", "#663300", "#666600", "#669900", "#66cc00", "#66ff00" ], - [ "#000033", "#003333", "#006633", "#009933", "#00cc33", "#00ff33", "#330033", "#333333", "#336633", "#339933", "#33cc33", "#33ff33", "#660033", "#663333", "#666633", "#669933", "#66cc33", "#66ff33" ], - [ "#000066", "#003366", "#006666", "#009966", "#00cc66", "#00ff66", "#330066", "#333366", "#336666", "#339966", "#33cc66", "#33ff66", "#660066", "#663366", "#666666", "#669966", "#66cc66", "#66ff66" ], - [ "#000099", "#003399", "#006699", "#009999", "#00cc99", "#00ff99", "#330099", "#333399", "#336699", "#339999", "#33cc99", "#33ff99", "#660099", "#663399", "#666699", "#669999", "#66cc99", "#66ff99" ], - [ "#0000cc", "#0033cc", "#0066cc", "#0099cc", "#00cccc", "#00ffcc", "#3300cc", "#3333cc", "#3366cc", "#3399cc", "#33cccc", "#33ffcc", "#6600cc", "#6633cc", "#6666cc", "#6699cc", "#66cccc", "#66ffcc" ], - [ "#0000ff", "#0033ff", "#0066ff", "#0099ff", "#00ccff", "#00ffff", "#3300ff", "#3333ff", "#3366ff", "#3399ff", "#33ccff", "#33ffff", "#6600ff", "#6633ff", "#6666ff", "#6699ff", "#66ccff", "#66ffff" ], - [ "#990000", "#993300", "#996600", "#999900", "#99cc00", "#99ff00", "#cc0000", "#cc3300", "#cc6600", "#cc9900", "#cccc00", "#ccff00", "#ff0000", "#ff3300", "#ff6600", "#ff9900", "#ffcc00", "#ffff00" ], - [ "#990033", "#993333", "#996633", "#999933", "#99cc33", "#99ff33", "#cc0033", "#cc3333", "#cc6633", "#cc9933", "#cccc33", "#ccff33", "#ff0033", "#ff3333", "#ff6633", "#ff9933", "#ffcc33", "#ffff33" ], - [ "#990066", "#993366", "#996666", "#999966", "#99cc66", "#99ff66", "#cc0066", "#cc3366", "#cc6666", "#cc9966", "#cccc66", "#ccff66", "#ff0066", "#ff3366", "#ff6666", "#ff9966", "#ffcc66", "#ffff66" ], - [ "#990099", "#993399", "#996699", "#999999", "#99cc99", "#99ff99", "#cc0099", "#cc3399", "#cc6699", "#cc9999", "#cccc99", "#ccff99", "#ff0099", "#ff3399", "#ff6699", "#ff9999", "#ffcc99", "#ffff99" ], - [ "#9900cc", "#9933cc", "#9966cc", "#9999cc", "#99cccc", "#99ffcc", "#cc00cc", "#cc33cc", "#cc66cc", "#cc99cc", "#cccccc", "#ccffcc", "#ff00cc", "#ff33cc", "#ff66cc", "#ff99cc", "#ffcccc", "#ffffcc" ], - [ "#9900ff", "#9933ff", "#9966ff", "#9999ff", "#99ccff", "#99ffff", "#cc00ff", "#cc33ff", "#cc66ff", "#cc99ff", "#ccccff", "#ccffff", "#ff00ff", "#ff33ff", "#ff66ff", "#ff99ff", "#ffccff", "#ffffff" ] - ]; - var colorsTable = editor.createTable(function( table, tbody ) { - //table.style.width = '100%'; - colors.each(function(colorRow) { - editor.createTableRow(tbody, function( row ) { - colorRow.each(function(color) { - editor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorColorItemContainer'; - column.onmousedown = item.onselectstart = function() { return false; }; - column.unselectable = true; - column.appendChild(editor.createElement('div', function(div) { - div.className = 'WysiwygEditorColorItem'; - div.onmousedown = item.onselectstart = function() { return false; }; - div.unselectable = true; - div.style.backgroundColor = color; - div.onclick = function() { - editor.colorSelectorOnclick(color); - }; - })); - }); - }); - }); - }); - }); - var moreColorsPreview = null; - var moreColorsPreviewTable = editor.createTable(function( table, tbody ) { - table.style.width = '100%'; - table.style.marginTop = '1px'; - table.style.marginBottom = '3px'; - table.style.marginLeft = '3px'; - table.style.marginRight = '3px'; - table.style.display = 'none', - editor.createTableRow(tbody, function( row ) { - moreColorsPreview = editor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorMoreColorsPreview'; - column.onmousedown = item.onselectstart = function() { return false; }; - column.unselectable = true; - }); - }); - }); - var moreColorsTable = editor.createTable(function( table, tbody ) { - table.style.margin = '2px'; - table.style.display = 'none'; - //table.style.border = '1px solid #999'; - table.onmouseout = function() { - moreColorsPreview.style.backgroundColor = '#FFF'; - }; - moreColors.each(function(colorRow) { - editor.createTableRow(tbody, function( row ) { - colorRow.each(function(color) { - editor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorMoreColorItemContainer'; - column.onmousedown = item.onselectstart = function() { return false; }; - column.unselectable = true; - column.appendChild(editor.createElement('div', function(div) { - div.className = 'WysiwygEditorMoreColorItem'; - div.onmousedown = item.onselectstart = function() { return false; }; - div.unselectable = true; - div.style.backgroundColor = color; - div.onmouseover = function() { - moreColorsPreview.style.backgroundColor = color; - }; - div.onclick = function() { - editor.colorSelectorOnclick(color); - }; - })); - }); - }); - }); - }); - }); - var popup = editor.createElement('div', function( div ) { - div.className = 'WysiwygEditorItemPopup'; - div.align = 'center'; - div.style.display = 'none'; - //div.style.width = '150px'; - div.appendChild(colorsTable); - div.appendChild(editor.createElement('div', function( div ) { - div.className = 'WysiwygEditorMoreColorsButton'; - div.innerHTML = 'More Colors...'; - div.align = 'center'; - div.onmousedown = item.onselectstart = function() { return false; }; - div.unselectable = true; - div.onclick = function() { - if( Element.visible(moreColorsTable) ) { - Element.hide(moreColorsTable); - Element.hide(moreColorsPreviewTable); - } else { - Element.show(moreColorsTable); - Element.show(moreColorsPreviewTable); - moreColorsPreviewTable.style.width = Element.getWidth(moreColorsTable) + 'px'; - } - }; - })); - div.appendChild(moreColorsTable); - div.appendChild(moreColorsPreviewTable); - }); - editor.colorPopup = popup; - Element.hide(editor.colorPopup); - document.body.appendChild(popup); - } - - if( editor.colorSelectorPreviousToolbarItem && editor.colorSelectorCurrentItem != name ) { - Element.hide(editor.colorPopup); - editor.colorSelectorPreviousToolbarItem.className = 'WysiwygEditorToolbarItem'; - } - if( Element.visible(editor.colorPopup) ) { - Element.hide(editor.colorPopup); - item.className = 'WysiwygEditorToolbarItem'; - editor.colorSelectorSavedRange = null; - editor.colorSelectorPreviousToolbarItem = null; - } else { - var selection = rangy.getSelection(editor.iframeWindow); - editor.colorSelectorSavedRange = selection.getRangeAt(0).cloneRange(); - editor.colorSelectorPreviousToolbarItem = item; - Element.clonePosition(editor.colorPopup, item, { - setWidth: false, - setHeight: false, - offsetLeft: 0 - (Element.getWidth(editor.colorPopup) / 2), - offsetTop: Element.getHeight(item.parentNode) - }); - Element.show(editor.colorPopup); - item.className = 'WysiwygEditorToolbarItemActive'; - editor.colorSelectorCurrentItem = name; - editor.colorSelectorOnclick = function( color ) { - var selection = rangy.getSelection(editor.iframeWindow); - selection.setSingleRange(editor.colorSelectorSavedRange); - editor.iframeDocument.execCommand(command, false, color); - Element.hide(editor.colorPopup); - item.className = 'WysiwygEditorToolbarItem'; - editor.colorSelectorSavedRange = null; - }; - } - }); -} - diff --git a/Public/Resources/Javascript/Wysiwyg/Editor.js b/Public/Resources/Javascript/Wysiwyg/Editor.js deleted file mode 100644 index 10b72e1..0000000 --- a/Public/Resources/Javascript/Wysiwyg/Editor.js +++ /dev/null @@ -1,547 +0,0 @@ -function WysiwygEditor() { - var self = this; - self.iframe = null; - self.iframeDocument = null; - self.iframeWindow = null; - self.contentElement = null; - self.eventCallbacks = {}; - self.contextMenu = null; - self.languages = []; - self.onEvent = function( type, callback ) { - if( self.eventCallbacks[type] == undefined ) - self.eventCallbacks[type] = []; - self.eventCallbacks[type].push(callback); - }; - self.fireEvent = function( type, event ) { - /* - var lenght = self.eventCallbacks[type].length; - for( var i = 0; i < length; i++ ) { - self.eventCallbacks[type][i](self); - } - */ - if( self.eventCallbacks[type] ) { - event = (event ? event : {}); - event.editor = self; - self.eventCallbacks[type].each(function(callback){ - callback(event); - }); - } - }; - self.selectionContainer = function() { - var selection = rangy.getSelection(self.iframeWindow); - var range = selection.getRangeAt(0); - var container = range.startContainer; - if( container.nodeType == 3 ) - container = container.parentNode; - return container; - }; - self.setLanguages = function( list ) { - self.languages = list; - }; - self.getLanguages = function() { - return self.languages; - }; - self.createElement = function( tagName, creator, otherDocument ) { - var useDocument = (otherDocument ? otherDocument : document); - var element = useDocument.createElement(tagName); - if( creator ) { - creator(element); - } - return element; - }; - self.createTable = function( creator ) { - var table = document.createElement('table'); - var tbody = document.createElement('tbody'); - table.cellSpacing = 0; - table.cellPadding = 0; - table.setAttribute('cellpadding', 0), - table.setAttribute('cellspacing', 0); - table.setAttribute('border', 0); - table.appendChild(tbody); - if( creator ) { - creator(table, tbody); - } - return table; - }; - self.createTableRow = function( table, creator ) { - var row = document.createElement('tr'); - table.appendChild(row); - if( creator ) { - creator(row); - } - return row; - }; - self.createTableColumn = function( row, creator ) { - var column = document.createElement('td'); - row.appendChild(column); - if( creator ) { - creator(column); - } - return column; - }; - self.addToolbarItemGroup = function( toolbar, callback ) { - var group = document.createElement('td'); - var table = document.createElement('table'); - var tbody = document.createElement('tbody'); - var row = document.createElement('tr'); - row.items = 0; - tbody.appendChild(row); - table.appendChild(tbody); - toolbar.appendChild(group); - group.appendChild(table); - table.className = 'WysiwygEditorToolbarItemGroup'; - table.setAttribute('cellpadding', 0); - table.setAttribute('cellspacing', 0); - callback(row); - }; - self.addToolbarItem = function( group, name, label, icon, lastItem, onclick, onselectionchange ) { - var column = document.createElement('td'); - var item = document.createElement('div') - var iconImage; - if( icon ) { - iconImage = document.createElement('img'); - iconImage.src = icon; - item.appendChild(iconImage); - } - if( label ) { - item.appendChild(self.createElement('span', function( span ) { - span.appendChild(document.createTextNode(label)); - })); - } - item.onmousedown = item.onselectstart = function() { return false; }; - item.unselectable = true; - item.active = false; - item.className = 'WysiwygEditorToolbarItem'; - item.onclick = function() { - onclick(item); - }; - column.className = 'WysiwygEditorToolbarItemContainer'; - if( lastItem && group.items == 0 ) { - column.className = 'WysiwygEditorToolbarItemContainerFirstLast'; - } else if( lastItem ) { - column.className = 'WysiwygEditorToolbarItemContainerLast'; - } else if( group.items == 0 ) { - column.className = 'WysiwygEditorToolbarItemContainerFirst'; - } - column.appendChild(item); - group.appendChild(column); - group.items++; - if( onselectionchange ) { - self.onEvent('selectionchange', function( event ) { - var container = event.editor.selectionContainer(); - var active = onselectionchange(event.editor, item, container); - if( item.active != active ) { - item.className = (active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - item.active = active; - } - }); - } - return column; - }; - self.addToolbarDropDown = function( toolbar, label, width, items, callback, onselectionchange ) { - var selectedItem = null; - var itemLabel = null; - var list = self.createTable(function(table, tbody){ - table.className = 'WysiwygEditorToolbarDropDown'; - self.createTableRow(tbody, function(row){ - self.createTableColumn(row, function(column){ - column.innerHTML = label; - column.className = 'WysiwygEditorToolbarDropDownItemHeader'; - column.onmousedown = column.onselectstart = function() { return false; }; - column.unselectable = true; - }); - }); - items.each(function(item){ - self.createTableRow(tbody, function(row){ - self.createTableColumn(row, function(column){ - column.innerHTML = item.label; - column.className = 'WysiwygEditorToolbarDropDownItem'; - column.onmousedown = column.onselectstart = function() { return false; }; - column.unselectable = true; - column.onclick = function() { - var selection = rangy.getSelection(self.iframeWindow); - selection.setSingleRange(self.dropDownSavedRange); - callback(item, itemLabel); - Element.hide(list); - self.toolbarOpenedDropDownList = null; - self.dropDownSavedRange = null; - return false; - }; - }); - }); - if( item.selected ) { - selectedItem = item; - } - }); - }); - var container = document.createElement('td'); - /*container.appendChild(self.createElement('div', function(element){ - element.className = 'WysiwygEditorToolbarItemDropDown'; - element.style.width = width + 'px'; - element.onmousedown = element.onselectstart = function() { return false; }; - element.unselectable = true; - itemLabel = editor.createElement('span', function( span ) { - span.innerHTML = (selectedItem ? selectedItem.label : label); - }); - element.appendChild(itemLabel); - element.appendChild(editor.createElement('img', function(img){ - img.src = 'dropdownbutton.png'; - //img.align = 'right'; - //img.style.cssFloat = 'right'; - img.style.verticalAlign = 'bottom'; - img.style.marginLeft = '4px'; - })); - }));*/ - container.appendChild(self.createTable(function(table, tbody) { - table.className = 'WysiwygEditorToolbarItemDropDown'; - table.style.width = width + 'px'; - self.createTableRow(tbody, function(row) { - self.createTableColumn(row, function(column) { - column.onmousedown = column.onselectstart = function() { return false; }; - column.unselectable = true; - column.style.width = '100%'; - itemLabel = self.createElement('span', function( span ) { - span.innerHTML = (selectedItem ? selectedItem.label : label); - }); - column.appendChild(itemLabel); - }); - self.createTableColumn(row, function(column) { - column.appendChild(self.createElement('img', function(img){ - img.src = uriForServerImageResource('Wysiwyg/dropdownbutton.png'); - img.style.verticalAlign = 'bottom'; - img.style.marginLeft = '4px'; - })); - }); - }); - })); - container.onclick = function() { - var selection = rangy.getSelection(self.iframeWindow); - self.dropDownSavedRange = selection.getRangeAt(0).cloneRange(); - if( Element.visible(list) ) { - Element.hide(list); - self.toolbarOpenedDropDownList = null; - self.dropDownSavedRange = null; - } else { - if( self.toolbarOpenedDropDownList ) { - Element.hide(self.toolbarOpenedDropDownList); - } - Element.clonePosition(list, container, { - setWidth: false, - setHeight: false, - offsetLeft: 2, - offsetTop: Element.getHeight(container) - 2 - }); - Element.show(list); - self.toolbarOpenedDropDownList = list; - } - }; - toolbar.appendChild(container); - document.body.appendChild(list); - if( Element.getHeight(list) > 260 ) { - list.style.height = '260px'; - } - Element.hide(list); - if( onselectionchange ) { - self.onEvent('selectionchange', function( event ) { - var container = event.editor.selectionContainer(); - var active = onselectionchange(itemLabel, container); - /*if( item.active != active ) { - item.className = (active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); - item.active = active; - }*/ - }); - } - }; - self.createItemPopupFooter = function( creator ) { - var footer = self.createTable(function( table, tbody ) { - table.className = 'WysiwygEditorItemPopupFooter'; - self.createTableRow(tbody, function( row ) { - self.createTableColumn(row, function( column ) { - column.style.width = '100%'; - }); - if( creator ) { - creator(row); - } - }); - }); - return footer; - }; - self.addItemPopupFooterButton = function( footer, label, icon, colour, onclick ) { - self.createTableColumn(footer, function( baseColumn ) { - table = self.createTable(function( table, tbody ) { - self.createTableRow(tbody, function( row ) { - self.createTableColumn(row, function( column ) { - column.style.border = '0px'; - column.style.padding = '0px'; - column.style.background = '#F2F2F2'; - column.appendChild(document.createTextNode(' ')); - }); - self.createTableColumn(row, function( column ) { - column.style.border = '0px'; - column.style.padding = '0px'; - column.style.background = colour; - column.appendChild(self.createElement('img', function( img ) { - img.src = icon; - img.style.verticalAlign = 'top'; - img.setAttribute('border', 0); - })); - }); - self.createTableColumn(row, function( column ) { - column.style.border = '0px'; - column.style.padding = '0px'; - column.style.whiteSpace = 'nowrap'; - column.style.background = '#F2F2F2'; - column.style.fontSize = '12px'; - column.appendChild(document.createTextNode('\u00a0')); - column.appendChild(self.createElement('span', function( span ) { - span.style.verticalAlign = 'middle'; - span.style.color = '#717171'; - span.innerHTML = label; - })); - column.appendChild(document.createTextNode('\u00a0\u00a0')); - }); - }); - }); - baseColumn.style.height = '20px'; - baseColumn.style.padding = (Prototype.Browser.IE ? '2px' : '5px'); - baseColumn.style.cursor = 'pointer'; - baseColumn.style.whiteSpace = 'nowrap'; - baseColumn.appendChild(table); - baseColumn.onclick = function() { - onclick(); - }; - }); - }; - self.init = function( textareaName ) { - setTimeout(function() { - var textarea = document.getElementById(textareaName); - - self.iframe = document.getElementById(textareaName + '.IFrame'); - self.iframe.style.width = (textarea.offsetWidth > 0 ? textarea.offsetWidth + 'px' : '200px'); - self.iframe.style.height = (textarea.offsetHeight > 0 ? textarea.offsetHeight + 'px' : '200px'); - self.iframe.className = 'WysiwygEditor'; - - self.iframeWindow = (self.iframe.contentDocument ? self.iframe.contentDocument.defaultView : self.iframe.contentWindow); - self.iframeDocument = self.iframe.contentWindow || self.iframe.contentDocument; - if( self.iframeDocument.document ) { - self.iframeDocument = self.iframeDocument.document; - } - - if( Prototype.Browser.IE ) { - self.iframeDocument.open(); - self.iframeDocument.write('' + - '' + - 'Wysiwyg Editor' + - '' + - '' + - '' + - '' + - ''); - self.iframeDocument.close(); - } - - self.contentElement = self.iframeDocument.body; - self.contentElement.style.padding = '0px'; - self.contentElement.style.margin = '0px'; - self.contentElement.contentEditable = true; - self.contentElement.hideFocus = true; - self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; - self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; - - Element.hide(textarea); - Element.show(self.iframe); - - self.contentElement.onmouseup = function() { - self.fireEvent('selectionchange'); - }; - self.contentElement.onkeyup = function() { - self.fireEvent('selectionchange'); - self.fireEvent('keyup'); - }; - /*self.contentElement.onmousedown = function( event ) { - var rightclick = false; - if( !event ) { - var event = window.event; - } - if( event.which ) { - rightclick = (event.which == 3); - } else if( event.button ) { - rightclick = (event.button == 2); - } - if( rightclick ) { - self.fireEvent('rightclick'); - } - };*/ - self.contentElement.oncontextmenu = function( event ) { - var editorEvent = { - showBrowserContextMenu: true, - mouseCursorPositionX: 0, - mouseCursorPositionY: 0 - }; - if( !event ) { - var event = window.event; - } - if( event.pageX || event.pageY ) { - var offset = Element.cumulativeOffset(self.iframe); - editorEvent.mouseCursorPositionX = event.pageX + offset.left; - editorEvent.mouseCursorPositionY = event.pageY + offset.top; - }/* else if( event.clientX || event.clientY ) { - editorEvent.mouseCursorPositionX = event.clientX;// + self.contentElement.scrollLeft + document.documentElement.scrollLeft; - editorEvent.mouseCursorPositionY = event.clientY;// + self.contentElement.scrollTop + document.documentElement.scrollTop; - }*/ - self.fireEvent('rightclick', editorEvent); - return editorEvent.showBrowserContextMenu; - }; - - self.contextMenu = { - element: null, - show: function( x, y ) { - this.element.style.left = x + 'px'; - this.element.style.top = y + 'px'; - Element.show(this.element); - }, - hide: function() { - Element.hide(this.element); - }, - clear: function() { - while( this.element.hasChildNodes() ) { - this.element.removeChild(this.element.firstChild); - } - }, - hasItems: function() { - return this.element.hasChildNodes(); - }, - addGroup: function( creator ) { - var group = { - element: null, - addItem: function( icon, label, callback ) { - if( !this.element ) { - this.element = self.createElement('div', function( div ) { - div.className = 'WysiwygEditorContextMenuGroup'; - }); - } - this.element.appendChild(self.createTable(function( table, tbody ) { - table.className = 'WysiwygEditorContextMenuItem'; - self.createTableRow(tbody, function( row ) { - row.onclick = function( event ) { - callback(self); - self.contextMenu.hide(); - CancelEvent((event ? event : window.event)); - return false; - }; - self.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemLeft'; - column.appendChild(self.createElement('img', function( image ) { - image.src = icon; - })); - }); - self.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemRight'; - column.innerHTML = label; - }); - }); - })); - } - }; - creator(group); - this.element.appendChild(group.element); - } - }; - - self.onEvent('rightclick', function( event ) { - if( event.editor.contextMenu.element == null ) { - event.editor.contextMenu.element = event.editor.createElement('div', function( div ) { - div.className = 'WysiwygEditorContextMenu'; - //div.style.zIndex = '99'; - //div.style.width = '320px'; - //div.style.height = '240px'; - //div.style.backgroundColor = '#000'; - //div.style.position = 'absolute'; - //alert('x: ' + event.mouseCursorPositionX + ', y: ' + event.mouseCursorPositionY); - //div.style.top = event.mouseCursorPositionX + 'px'; - //div.style.left = event.mouseCursorPositionY + 'px'; - //div.innerHTML = 'Hello World!'; - }); - document.body.appendChild(event.editor.contextMenu.element); - } - event.editor.contextMenu.clear(); - event.editor.fireEvent('contextmenu'); - if( event.editor.contextMenu.hasItems() ) { - event.showBrowserContextMenu = false; - event.editor.contextMenu.show(event.mouseCursorPositionX, event.mouseCursorPositionY); - var previous_onclick = document.body.onclick; - document.body.onclick = function() { - event.editor.contextMenu.hide(); - document.body.onclick = previous_onclick; - }; - event.editor.contentElement.onclick = function() { - event.editor.contextMenu.hide(); - }; - } - }); - - WysiwygEditorSpellCheckSetup(self); - - var toolbar = document.createElement('table'); - var tbody = document.createElement('tbody'); - var row = document.createElement('tr'); - var lastColumn = document.createElement('td'); - toolbar.id = textareaName + '.WysiwygEditorToolbar'; - toolbar.style.width = (textarea.offsetWidth + 12) + 'px'; - toolbar.className = 'WysiwygEditorToolbar'; - toolbar.setAttribute('cellpadding', 0); - toolbar.setAttribute('cellspacing', 0); - toolbar.appendChild(tbody); - tbody.appendChild(row); - - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorBoldToolbarItem(self, group); - WysiwygEditorItalicToolbarItem(self, group), - WysiwygEditorUnderlineToolbarItem(self, group); - WysiwygEditorStrikethroughToolbarItem(self, group); - }); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorOrderedListToolbarItem(self, group); - WysiwygEditorUnorderedListToolbarItem(self, group); - }); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorOutdentToolbarItem(self, group); - WysiwygEditorIndentToolbarItem(self, group); - }); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorJustifyLeftToolbarItem(self, group); - WysiwygEditorJustifyCenterToolbarItem(self, group); - WysiwygEditorJustifyRightToolbarItem(self, group); - }); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorLinkToolbarItem(self, group); - self.addToolbarItem(group, 'image', '', uriForServerImageResource('Wysiwyg/image.png'), false, function( item ) { - }); - WysiwygEditorHorizontalLineToolbarItem(self, group); - }); - WysiwygEditorFontToolbarDropDown(self, row); - WysiwygEditorFontSizeToolbarDropDown(self, row); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Wysiwyg/textcolor.png'), 'forecolor'); - WysiwygEditorColorToolbarItem(self, group, 'backgroundcolor', uriForServerImageResource('Wysiwyg/backgroundcolor.png'), 'backcolor'); - }); - WysiwygEditorSpellCheckLanguageDropDown(self, row); - self.addToolbarItemGroup(row, function( group ) { - WysiwygEditorSpellCheckToolbarItems(self, group); - }); - - lastColumn.style.width = '100%'; - row.appendChild(lastColumn); - - textarea.parentNode.insertBefore(toolbar, self.iframe); - - setTimeout(function() { - if( Element.getWidth(toolbar) > Element.getWidth(self.iframe) ) { - self.iframe.style.width = Element.getWidth(toolbar) + 'px'; - self.iframeDocument.body.style.width = self.iframe.style.width; - } - }, 100); - }, 100); - }; -} diff --git a/Public/Resources/Javascript/Wysiwyg/Link.js b/Public/Resources/Javascript/Wysiwyg/Link.js deleted file mode 100644 index 9398276..0000000 --- a/Public/Resources/Javascript/Wysiwyg/Link.js +++ /dev/null @@ -1,193 +0,0 @@ -function WysiwygEditorLinkToolbarItem( editor, group ) { - editor.addToolbarItem(group, 'link', '', uriForServerImageResource('Wysiwyg/link.png'), false, function( item ) { - if( editor.linkPopup == undefined ) { - var textTextfield = null; - var urlTextfield = null; - var webAddressLabel = null; - var webAddressRadioButton = null; - var emailAddressLabel = null; - var emailAddressRadioButton = null; - var descriptionLabel = null; - var table = editor.createTable(function( table, tbody ) { - table.style.width = '100%'; - editor.createTableRow(tbody, function( row ) { - editor.createTableColumn(row, function( column ) { - column.style.padding = '5px'; - column.style.whiteSpace = 'nowrap'; - column.innerHTML = 'Text to display:'; - }); - editor.createTableColumn(row, function( column ) { - var input = document.createElement('input'); - input.setAttribute('type', 'text'); - input.style.width = '99%'; - column.style.padding = '5px'; - column.style.width = '100%'; - column.appendChild(input); - textTextfield = input; - }); - }); - editor.createTableRow(tbody, function( row ) { - row.style.verticalAlign = 'bottom'; - editor.createTableColumn(row, function( column ) { - column.style.padding = '5px'; - column.style.whiteSpace = 'nowrap'; - column.appendChild(editor.createElement('div', function( div ) { - div.style.width = '120px'; - div.style.marginBottom = '2px'; - div.innerHTML = 'Link to:'; - })); - column.appendChild(editor.createElement('div', function( div ) { - div.style.marginBottom = '2px'; - div.style.cursor = 'pointer'; - div.appendChild(editor.createElement('input', function( input ) { - input.setAttribute('type', 'radio'); - input.style.verticalAlign = (Prototype.Browser.IE ? 'middle' : 'bottom'); - input.style.marginRight = '0px'; - webAddressRadioButton = input; - })); - div.appendChild(document.createTextNode('\u00a0')); - div.appendChild(editor.createElement('span', function( span ) { - span.innerHTML = 'Web address'; - webAddressLabel = span; - })); - })); - column.appendChild(editor.createElement('div', function( div ) { - div.style.cursor = 'pointer'; - div.appendChild(editor.createElement('input', function( input ) { - input.setAttribute('type', 'radio'); - input.style.verticalAlign = (Prototype.Browser.IE ? 'middle' : 'bottom'); - input.style.marginRight = '0px'; - emailAddressRadioButton = input; - })); - div.appendChild(document.createTextNode('\u00a0')); - div.appendChild(editor.createElement('span', function( span ) { - span.innerHTML = 'Email address'; - emailAddressLabel = span; - })); - })); - }); - editor.createTableColumn(row, function( column ) { - column.style.width = '100%'; - column.style.padding = '5px'; - column.appendChild(editor.createElement('div', function( div ) { - div.style.fontWeight = 'bold'; - div.style.marginBottom = '2px'; - div.innerHTML = 'To what URL should this link go?'; - descriptionLabel = div; - })); - column.appendChild(editor.createElement('input', function( input ) { - input.setAttribute('type', 'text'); - input.style.width = '99%'; - urlTextfield = input; - })); - }); - }); - }); - var popup = editor.createElement('div', function( div ) { - div.className = 'WysiwygEditorItemPopup'; - div.style.display = 'none'; - div.style.width = '450px'; - div.appendChild(table); - div.appendChild(editor.createItemPopupFooter(function( footer ) { - editor.addItemPopupFooterButton(footer, 'Save', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_save.png', '#96D754', function() { - if( editor.linkSelectedContainer ) { - editor.linkSelectedContainer.href = editor.linkTextfieldURL.value; - } else if( editor.linkSelectedText ) { - var selection = rangy.getSelection(editor.iframeWindow); - selection.setSingleRange(editor.linkSelectedRange); - editor.iframeDocument.execCommand('createLink', false, editor.linkTextfieldURL.value); - } else { - var node = editor.createElement('a', function( a ) { - a.href = editor.linkTextfieldURL.value; - a.innerHTML = editor.linkTextfieldText.value; - }, editor.iframeDocument); - var selection = rangy.getSelection(editor.iframeWindow); - var range = editor.linkSelectedRange; - range.collapse(false); - range.insertNode(node); - range.collapseAfter(node); - selection.setSingleRange(range); - } - Element.hide(div); - item.className = 'WysiwygEditorToolbarItem'; - }); - editor.addItemPopupFooterButton(footer, 'Cancel', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_arrow_right.png', '#FCAB46', function() { - Element.hide(div); - item.className = 'WysiwygEditorToolbarItem'; - }); - })); - }); - document.body.appendChild(popup); - editor.linkPopup = popup; - editor.linkWebAddressRadioButton = webAddressRadioButton; - editor.linkWebAddressLabel = webAddressLabel; - editor.linkEmailAddressRadioButton = emailAddressRadioButton; - editor.linkEmailAddressLabel = emailAddressLabel; - editor.linkDescriptionLabel = descriptionLabel; - editor.linkTextfieldText = textTextfield; - editor.linkTextfieldURL = urlTextfield; - webAddressRadioButton.onclick = webAddressLabel.onclick = function() { - webAddressRadioButton.checked = true; - webAddressLabel.style.fontWeight = 'bold'; - emailAddressRadioButton.checked = false; - emailAddressLabel.style.fontWeight = 'normal'; - descriptionLabel.innerHTML = 'To what URL should this link go?'; - }; - emailAddressRadioButton.onclick = emailAddressLabel.onclick = function() { - emailAddressRadioButton.checked = true; - emailAddressLabel.style.fontWeight = 'bold'; - webAddressRadioButton.checked = false; - webAddressLabel.style.fontWeight = 'normal'; - descriptionLabel.innerHTML = 'To what email address should this link?'; - }; - } - if( Element.visible(editor.linkPopup) ) { - Element.hide(editor.linkPopup); - item.className = 'WysiwygEditorToolbarItem'; - } else { - var selection = rangy.getSelection(editor.iframeWindow); - var range = selection.getRangeAt(0).cloneRange(); - var selectedText = selection.toString(); - var selectedContainer = range.startContainer; - if( selectedContainer.nodeType == 3 ) - selectedContainer = selectedContainer.parentNode; - editor.linkSelectedText = selectedText; - editor.linkWebAddressRadioButton.checked = true; - editor.linkWebAddressLabel.style.fontWeight = 'bold'; - editor.linkEmailAddressRadioButton.checked = false; - editor.linkEmailAddressLabel.style.fontWeight = 'normal'; - editor.linkDescriptionLabel = 'To what URL should this link go?'; - editor.linkSelectedContainer = null; - editor.linkTextfieldURL.value = ''; - editor.linkTextfieldText.value = ''; - editor.linkTextfieldText.disabled = false; - if( selectedText ) { - editor.linkTextfieldText.disabled = true; - editor.linkTextfieldText.value = selectedText; - } - editor.linkSelectedRange = range; - editor.linkSelectedContainer = null; - if( selectedContainer && selectedContainer.tagName.toLowerCase() == 'a' ) { - editor.linkSelectedContainer = selectedContainer; - editor.linkTextfieldURL.value = selectedContainer.href; - editor.linkTextfieldText.disabled = true; - editor.linkTextfieldText.value = selectedContainer.innerHTML.stripTags(); - } else if( selectedContainer && selectedContainer.parentNode && selectedContainer.parentNode.tagName.toLowerCase() == 'a' ) { - editor.linkSelectedContainer = selectedContainer.parentNode; - editor.linkTextfieldURL.value = selectedContainer.parentNode.href; - editor.linkTextfieldText.disabled = true; - editor.linkTextfieldText.value = selectedContainer.parentNode.innerHTML.stripTags(); - } - Element.clonePosition(editor.linkPopup, item, { - setWidth: false, - setHeight: false, - offsetLeft: 0 - (Element.getWidth(editor.linkPopup) / 2), - offsetTop: Element.getHeight(item.parentNode) - }); - Element.show(editor.linkPopup); - item.className = 'WysiwygEditorToolbarItemActive'; - } - }, function( editor, item ) { - }); -} - diff --git a/Public/Resources/Javascript/Wysiwyg/Spellcheck.js b/Public/Resources/Javascript/Wysiwyg/Spellcheck.js deleted file mode 100644 index 8b4a934..0000000 --- a/Public/Resources/Javascript/Wysiwyg/Spellcheck.js +++ /dev/null @@ -1,287 +0,0 @@ -function WysiwygEditorSpellCheckSetup( editor ) { - editor.spellcheck = { - list: [], - words: {}, - misspelled_words: {}, - language: 0, - - reset: function() { - this.list = []; - this.words = {}; - }, - setLanguage: function( language ) { - this.language = language; - }, - check: function( element ) { - var wordNodes = new Array(); - - var node = element.firstChild; - while( node ) { - if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { - node.className = ''; - wordNodes.push(node); - } else if( node.nodeType == 3 ) { - wordNodes.push(node); - } - - if( node.firstChild ) { - node = node.firstChild; - } else if( node.nextSibling ) { - node = node.nextSibling; - } else { - for( node = node.parentNode; node; node = node.parentNode ) { - if( node.nextSibling ) { - node = node.nextSibling; - break; - } - } - } - } - - var i; - var wordNodesLength = wordNodes.length; - - for( i = 0; i < wordNodesLength; i++ ) { - this.setWord(wordNodes[i], this.getInnerText(wordNodes[i])); - } - - var captured_this = this; - mcam.fireCallbackRequest('wysiwyg_editor_spell_check_perform', function( value ) { - var data = JSON.parse(value); - var i; - var j; - captured_this.misspelled_words = {}; - for( i = 0; i < data.misspelled_words.length; i++ ) { - var item = data.misspelled_words[i]; - captured_this.misspelled_words[item.word] = true; - if( captured_this.words[item.word] && !captured_this.words[item.word].ignore ) { - for( j = 0; j < captured_this.words[item.word].nodes.length; j++ ) { - var node = captured_this.words[item.word].nodes[j]; - node.style.backgroundColor = 'red'; - if( item.suggestions.length > 0 ) { - node.style.backgroundColor = 'yellow'; - } - captured_this.words[item.word].suggestions = item.suggestions; - } - } - } - }, { words: this.list, language: this.language }); - }, - finish: function( node ) { - var i; - - for( i = 0; i < this.list.length; i++ ) { - var word = this.list[i]; - this.words[word].nodes = new Array(); - } - - var nodes = new Array(); - - while( node ) { - if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { - nodes.push(node); - } - if ( node.firstChild ) { - node = node.firstChild; - } else if( node.nextSibling ) { - node = node.nextSibling; - } else { - for( node = node.parentNode; node; node = node.parentNode ) { - if( node.nextSibling ) { - node = node.nextSibling; - break; - } - } - } - } - - var nodesLength = nodes.length; - var j; - - for ( i = 0; i < nodesLength; i++ ) { - node = nodes[i]; - var childNodesLength = node.childNodes.length; - for ( j = 0; j < childNodesLength; j++ ) { - node.parentNode.insertBefore(node.childNodes[j], node); - } - node.parentNode.removeChild(node); - } - }, - ignore: function ( word ) { - if( this.words[word] ) { - this.words[word].ignore = true; - var i; - var nodesLength = this.words[word].nodes.length; - for( i = 0; i < nodesLength; i++ ) { - var node = this.words[word].nodes[i]; - node.style.backgroundColor = ''; - } - } - }, - learn: function( word ) { - if( this.words[word] ) - { - mcam.fireCallbackRequest('WysiwygEditorSpellCheckLearnWord', null, { word: word, language: this.language }); - this.ignore(word); - } - }, - suggestions: function( word ) { - return this.words[word].suggestions; - }, - isWordMisspelled: function( word ) { - return (this.misspelled_words[word] ? true : false); - }, - isWordIgnored: function( word ) { - return this.words[word].ignore; - }, - getInnerText: function( node ) { - if ( !node ) { - return ''; - } - - switch ( node.nodeType ) { - case 1: - if ( node.tagName == 'BR' ) { - return '\n'; - } else { - var string = ''; - var i; - for( i = 0; i < node.childNodes.length; i++ ) { - string += this.getInnerText(node.childNodes[i]); - } - return string; - } - break; - case 3: - return node.nodeValue; - break; - }; - }, - setWord: function( element, word ) { - var doc = element.ownerDocument || element.document; - var wordLength = word.length; - var string = ''; - var n = 0; - var i; - - for( i = 0; i < wordLength; i++ ) { - var character = word.substr( i, 1 ); - - // Match all but numbers, letters, - and ' - if( !character.match( /[AaBbCcDdEeFfGgHhiiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÅåÄäÖöÜüßÆæØøÀàÁáÂâÇçÈèÉéÊêËëÎîÏïÍíÔôÓóŒœÙùÚúÛûÑñĄąĘęÓóĆ棳ŃńŚśŹźŻż\']/ ) ) { - var newNode; - - if( string ) { - element.parentNode.insertBefore(this.createWordNode(string, doc), element); - } - - if( character == '\n' ) { - newNode = doc.createElement('br'); - } else { - newNode = doc.createTextNode(character); - } - - element.parentNode.insertBefore(newNode, element); - string = ''; - n++; - } else { - string += character; - } - } - - if( string ) { - element.parentNode.insertBefore(this.createWordNode(string, doc), element); - } - - element.parentNode.removeChild(element); - - return n; - }, - createWordNode: function( word, doc ) { - var node = doc.createElement('span'); - node.className = 'wysiwyg-spell-check-word'; - node.appendChild(doc.createTextNode(word)); - - if( !this.words[word] ) { - this.list.push(word); - this.words[word] = {}; - this.words[word].ignore = false; - this.words[word].suggestions = new Array(); - this.words[word].nodes = new Array(); - } - this.words[word].nodes.push(node); - - return node; - } - }; -} - -function WysiwygEditorSpellCheckLanguageDropDown( editor, toolbar ) { - var list = editor.getLanguages(); - var listLength = list.length - editor.addToolbarDropDown(toolbar, 'Language', 105, list, function(item, itemLabel) { - itemLabel.innerHTML = item.label; - editor.spellcheck.setLanguage(item.language); - }); - for( var i = 0; i < listLength; i++ ) { - var item = list[i]; - if( item.selected ) { - editor.spellcheck.setLanguage(item.language); - } - } -} - -function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { - var check_button = null; - var finish_button = null; - var spell_check_mode = false; - check_button = editor.addToolbarItem(toolbar, 'spellcheck', 'Perform Spell Check', uriForServerImageResource('Wysiwyg/check.png'), false, function( item ) { - Element.hide(check_button); - Element.show(finish_button); - spell_check_mode = true; - editor.spellcheck.check(editor.contentElement); - }); - finish_button = editor.addToolbarItem(toolbar, 'finishspellcheck', 'Finish Spell Check', uriForServerImageResource('Wysiwyg/done.png'), true, function( item ) { - Element.hide(finish_button); - Element.show(check_button); - spell_check_mode = false; - editor.spellcheck.finish(editor.contentElement); - }); - editor.onEvent('keyup', function() { - if( spell_check_mode ) { - Element.hide(finish_button); - Element.show(check_button); - spell_check_mode = false; - editor.spellcheck.finish(editor.contentElement); - } - }); - editor.onEvent('contextmenu', function() { - if( spell_check_mode ) { - var container = editor.selectionContainer(); - if( container && container.className == 'wysiwyg-spell-check-word' ) { - var word = container.innerHTML; - word = word.trim(); - if( editor.spellcheck.words[word] ) { - var mainSuggestions = 0; - var moreSuggestionsGroup = null; - editor.spellcheck.words[word].suggestions.each(function(suggestion) { - if( mainSuggestions < 5 ) { - editor.contextMenu.addGroup(function( group ) { - group.addItem(uriForServerImageResource('Wysiwyg/replace.png'), suggestion, function() { - Element.replace(container, suggestion); - }); - }); - mainSuggestions++; - } else { - if( ! moreSuggestionsGroup ) { - - } - } - }); - } - } - } - }); - Element.show(check_button); - Element.hide(finish_button); -} diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index e69de29..87b8106 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -0,0 +1,1463 @@ +function WysiwygEditor() { + var self = this; + self.iframe = null; + self.iframeDocument = null; + self.iframeWindow = null; + self.contentElement = null; + self.eventCallbacks = {}; + self.contextMenu = null; + self.languages = []; + self.onEvent = function( type, callback ) { + if( self.eventCallbacks[type] == undefined ) + self.eventCallbacks[type] = []; + self.eventCallbacks[type].push(callback); + }; + self.fireEvent = function( type, event ) { + /* + var lenght = self.eventCallbacks[type].length; + for( var i = 0; i < length; i++ ) { + self.eventCallbacks[type][i](self); + } + */ + if( self.eventCallbacks[type] ) { + event = (event ? event : {}); + event.editor = self; + self.eventCallbacks[type].each(function(callback){ + callback(event); + }); + } + }; + self.selectionContainer = function() { + var selection = rangy.getSelection(self.iframeWindow); + var range = selection.getRangeAt(0); + var container = range.startContainer; + if( container.nodeType == 3 ) + container = container.parentNode; + return container; + }; + self.setLanguages = function( list ) { + self.languages = list; + }; + self.getLanguages = function() { + return self.languages; + }; + self.createElement = function( tagName, creator, otherDocument ) { + var useDocument = (otherDocument ? otherDocument : document); + var element = useDocument.createElement(tagName); + if( creator ) { + creator(element); + } + return element; + }; + self.createTable = function( creator ) { + var table = document.createElement('table'); + var tbody = document.createElement('tbody'); + table.cellSpacing = 0; + table.cellPadding = 0; + table.setAttribute('cellpadding', 0), + table.setAttribute('cellspacing', 0); + table.setAttribute('border', 0); + table.appendChild(tbody); + if( creator ) { + creator(table, tbody); + } + return table; + }; + self.createTableRow = function( table, creator ) { + var row = document.createElement('tr'); + table.appendChild(row); + if( creator ) { + creator(row); + } + return row; + }; + self.createTableColumn = function( row, creator ) { + var column = document.createElement('td'); + row.appendChild(column); + if( creator ) { + creator(column); + } + return column; + }; + self.addToolbarItemGroup = function( toolbar, callback ) { + var group = document.createElement('td'); + var table = document.createElement('table'); + var tbody = document.createElement('tbody'); + var row = document.createElement('tr'); + row.items = 0; + tbody.appendChild(row); + table.appendChild(tbody); + toolbar.appendChild(group); + group.appendChild(table); + table.className = 'WysiwygEditorToolbarItemGroup'; + table.setAttribute('cellpadding', 0); + table.setAttribute('cellspacing', 0); + callback(row); + }; + self.addToolbarItem = function( group, name, label, icon, lastItem, onclick, onselectionchange ) { + var column = document.createElement('td'); + var item = document.createElement('div') + var iconImage; + if( icon ) { + iconImage = document.createElement('img'); + iconImage.src = icon; + item.appendChild(iconImage); + } + if( label ) { + item.appendChild(self.createElement('span', function( span ) { + span.appendChild(document.createTextNode(label)); + })); + } + item.onmousedown = item.onselectstart = function() { return false; }; + item.unselectable = true; + item.active = false; + item.className = 'WysiwygEditorToolbarItem'; + item.onclick = function() { + onclick(item); + }; + column.className = 'WysiwygEditorToolbarItemContainer'; + if( lastItem && group.items == 0 ) { + column.className = 'WysiwygEditorToolbarItemContainerFirstLast'; + } else if( lastItem ) { + column.className = 'WysiwygEditorToolbarItemContainerLast'; + } else if( group.items == 0 ) { + column.className = 'WysiwygEditorToolbarItemContainerFirst'; + } + column.appendChild(item); + group.appendChild(column); + group.items++; + if( onselectionchange ) { + self.onEvent('selectionchange', function( event ) { + var container = event.editor.selectionContainer(); + var active = onselectionchange(event.editor, item, container); + if( item.active != active ) { + item.className = (active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + item.active = active; + } + }); + } + return column; + }; + self.addToolbarDropDown = function( toolbar, label, width, items, callback, onselectionchange ) { + var selectedItem = null; + var itemLabel = null; + var list = self.createTable(function(table, tbody){ + table.className = 'WysiwygEditorToolbarDropDown'; + self.createTableRow(tbody, function(row){ + self.createTableColumn(row, function(column){ + column.innerHTML = label; + column.className = 'WysiwygEditorToolbarDropDownItemHeader'; + column.onmousedown = column.onselectstart = function() { return false; }; + column.unselectable = true; + }); + }); + items.each(function(item){ + self.createTableRow(tbody, function(row){ + self.createTableColumn(row, function(column){ + column.innerHTML = item.label; + column.className = 'WysiwygEditorToolbarDropDownItem'; + column.onmousedown = column.onselectstart = function() { return false; }; + column.unselectable = true; + column.onclick = function() { + var selection = rangy.getSelection(self.iframeWindow); + selection.setSingleRange(self.dropDownSavedRange); + callback(item, itemLabel); + Element.hide(list); + self.toolbarOpenedDropDownList = null; + self.dropDownSavedRange = null; + return false; + }; + }); + }); + if( item.selected ) { + selectedItem = item; + } + }); + }); + var container = document.createElement('td'); + /*container.appendChild(self.createElement('div', function(element){ + element.className = 'WysiwygEditorToolbarItemDropDown'; + element.style.width = width + 'px'; + element.onmousedown = element.onselectstart = function() { return false; }; + element.unselectable = true; + itemLabel = editor.createElement('span', function( span ) { + span.innerHTML = (selectedItem ? selectedItem.label : label); + }); + element.appendChild(itemLabel); + element.appendChild(editor.createElement('img', function(img){ + img.src = 'dropdownbutton.png'; + //img.align = 'right'; + //img.style.cssFloat = 'right'; + img.style.verticalAlign = 'bottom'; + img.style.marginLeft = '4px'; + })); + }));*/ + container.appendChild(self.createTable(function(table, tbody) { + table.className = 'WysiwygEditorToolbarItemDropDown'; + table.style.width = width + 'px'; + self.createTableRow(tbody, function(row) { + self.createTableColumn(row, function(column) { + column.onmousedown = column.onselectstart = function() { return false; }; + column.unselectable = true; + column.style.width = '100%'; + itemLabel = self.createElement('span', function( span ) { + span.innerHTML = (selectedItem ? selectedItem.label : label); + }); + column.appendChild(itemLabel); + }); + self.createTableColumn(row, function(column) { + column.appendChild(self.createElement('img', function(img){ + img.src = uriForServerImageResource('Components/WysiwygEditor/dropdownbutton.png'); + img.style.verticalAlign = 'bottom'; + img.style.marginLeft = '4px'; + })); + }); + }); + })); + container.onclick = function() { + var selection = rangy.getSelection(self.iframeWindow); + self.dropDownSavedRange = selection.getRangeAt(0).cloneRange(); + if( Element.visible(list) ) { + Element.hide(list); + self.toolbarOpenedDropDownList = null; + self.dropDownSavedRange = null; + } else { + if( self.toolbarOpenedDropDownList ) { + Element.hide(self.toolbarOpenedDropDownList); + } + Element.clonePosition(list, container, { + setWidth: false, + setHeight: false, + offsetLeft: 2, + offsetTop: Element.getHeight(container) - 2 + }); + Element.show(list); + self.toolbarOpenedDropDownList = list; + } + }; + toolbar.appendChild(container); + document.body.appendChild(list); + if( Element.getHeight(list) > 260 ) { + list.style.height = '260px'; + } + Element.hide(list); + if( onselectionchange ) { + self.onEvent('selectionchange', function( event ) { + var container = event.editor.selectionContainer(); + var active = onselectionchange(itemLabel, container); + /*if( item.active != active ) { + item.className = (active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + item.active = active; + }*/ + }); + } + }; + self.createItemPopupFooter = function( creator ) { + var footer = self.createTable(function( table, tbody ) { + table.className = 'WysiwygEditorItemPopupFooter'; + self.createTableRow(tbody, function( row ) { + self.createTableColumn(row, function( column ) { + column.style.width = '100%'; + }); + if( creator ) { + creator(row); + } + }); + }); + return footer; + }; + self.addItemPopupFooterButton = function( footer, label, icon, colour, onclick ) { + self.createTableColumn(footer, function( baseColumn ) { + table = self.createTable(function( table, tbody ) { + self.createTableRow(tbody, function( row ) { + self.createTableColumn(row, function( column ) { + column.style.border = '0px'; + column.style.padding = '0px'; + column.style.background = '#F2F2F2'; + column.appendChild(document.createTextNode(' ')); + }); + self.createTableColumn(row, function( column ) { + column.style.border = '0px'; + column.style.padding = '0px'; + column.style.background = colour; + column.appendChild(self.createElement('img', function( img ) { + img.src = icon; + img.style.verticalAlign = 'top'; + img.setAttribute('border', 0); + })); + }); + self.createTableColumn(row, function( column ) { + column.style.border = '0px'; + column.style.padding = '0px'; + column.style.whiteSpace = 'nowrap'; + column.style.background = '#F2F2F2'; + column.style.fontSize = '12px'; + column.appendChild(document.createTextNode('\u00a0')); + column.appendChild(self.createElement('span', function( span ) { + span.style.verticalAlign = 'middle'; + span.style.color = '#717171'; + span.innerHTML = label; + })); + column.appendChild(document.createTextNode('\u00a0\u00a0')); + }); + }); + }); + baseColumn.style.height = '20px'; + baseColumn.style.padding = (Prototype.Browser.IE ? '2px' : '5px'); + baseColumn.style.cursor = 'pointer'; + baseColumn.style.whiteSpace = 'nowrap'; + baseColumn.appendChild(table); + baseColumn.onclick = function() { + onclick(); + }; + }); + }; + self.init = function( textareaName ) { + setTimeout(function() { + var textarea = document.getElementById(textareaName); + + self.iframe = document.getElementById(textareaName + '.IFrame'); + self.iframe.style.width = (textarea.offsetWidth > 0 ? textarea.offsetWidth + 'px' : '200px'); + self.iframe.style.height = (textarea.offsetHeight > 0 ? textarea.offsetHeight + 'px' : '200px'); + self.iframe.className = 'WysiwygEditor'; + + self.iframeWindow = (self.iframe.contentDocument ? self.iframe.contentDocument.defaultView : self.iframe.contentWindow); + self.iframeDocument = self.iframe.contentWindow || self.iframe.contentDocument; + if( self.iframeDocument.document ) { + self.iframeDocument = self.iframeDocument.document; + } + + if( Prototype.Browser.IE ) { + self.iframeDocument.open(); + self.iframeDocument.write('' + + '' + + 'Wysiwyg Editor' + + '' + + '' + + '' + + '' + + ''); + self.iframeDocument.close(); + } + + self.contentElement = self.iframeDocument.body; + self.contentElement.style.padding = '0px'; + self.contentElement.style.margin = '0px'; + self.contentElement.contentEditable = true; + self.contentElement.hideFocus = true; + self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; + self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; + + Element.hide(textarea); + Element.show(self.iframe); + + self.contentElement.onmouseup = function() { + self.fireEvent('selectionchange'); + }; + self.contentElement.onkeyup = function() { + self.fireEvent('selectionchange'); + self.fireEvent('keyup'); + }; + /*self.contentElement.onmousedown = function( event ) { + var rightclick = false; + if( !event ) { + var event = window.event; + } + if( event.which ) { + rightclick = (event.which == 3); + } else if( event.button ) { + rightclick = (event.button == 2); + } + if( rightclick ) { + self.fireEvent('rightclick'); + } + };*/ + self.contentElement.oncontextmenu = function( event ) { + var editorEvent = { + showBrowserContextMenu: true, + mouseCursorPositionX: 0, + mouseCursorPositionY: 0 + }; + if( !event ) { + var event = window.event; + } + if( event.pageX || event.pageY ) { + var offset = Element.cumulativeOffset(self.iframe); + editorEvent.mouseCursorPositionX = event.pageX + offset.left; + editorEvent.mouseCursorPositionY = event.pageY + offset.top; + }/* else if( event.clientX || event.clientY ) { + editorEvent.mouseCursorPositionX = event.clientX;// + self.contentElement.scrollLeft + document.documentElement.scrollLeft; + editorEvent.mouseCursorPositionY = event.clientY;// + self.contentElement.scrollTop + document.documentElement.scrollTop; + }*/ + self.fireEvent('rightclick', editorEvent); + return editorEvent.showBrowserContextMenu; + }; + + self.contextMenu = { + element: null, + show: function( x, y ) { + this.element.style.left = x + 'px'; + this.element.style.top = y + 'px'; + Element.show(this.element); + }, + hide: function() { + Element.hide(this.element); + }, + clear: function() { + while( this.element.hasChildNodes() ) { + this.element.removeChild(this.element.firstChild); + } + }, + hasItems: function() { + return this.element.hasChildNodes(); + }, + addGroup: function( creator ) { + var group = { + element: null, + addItem: function( icon, label, callback ) { + if( !this.element ) { + this.element = self.createElement('div', function( div ) { + div.className = 'WysiwygEditorContextMenuGroup'; + }); + } + this.element.appendChild(self.createTable(function( table, tbody ) { + table.className = 'WysiwygEditorContextMenuItem'; + self.createTableRow(tbody, function( row ) { + row.onclick = function( event ) { + callback(self); + self.contextMenu.hide(); + CancelEvent((event ? event : window.event)); + return false; + }; + self.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemLeft'; + column.appendChild(self.createElement('img', function( image ) { + image.src = icon; + })); + }); + self.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemRight'; + column.innerHTML = label; + }); + }); + })); + } + }; + creator(group); + this.element.appendChild(group.element); + } + }; + + self.onEvent('rightclick', function( event ) { + if( event.editor.contextMenu.element == null ) { + event.editor.contextMenu.element = event.editor.createElement('div', function( div ) { + div.className = 'WysiwygEditorContextMenu'; + //div.style.zIndex = '99'; + //div.style.width = '320px'; + //div.style.height = '240px'; + //div.style.backgroundColor = '#000'; + //div.style.position = 'absolute'; + //alert('x: ' + event.mouseCursorPositionX + ', y: ' + event.mouseCursorPositionY); + //div.style.top = event.mouseCursorPositionX + 'px'; + //div.style.left = event.mouseCursorPositionY + 'px'; + //div.innerHTML = 'Hello World!'; + }); + document.body.appendChild(event.editor.contextMenu.element); + } + event.editor.contextMenu.clear(); + event.editor.fireEvent('contextmenu'); + if( event.editor.contextMenu.hasItems() ) { + event.showBrowserContextMenu = false; + event.editor.contextMenu.show(event.mouseCursorPositionX, event.mouseCursorPositionY); + var previous_onclick = document.body.onclick; + document.body.onclick = function() { + event.editor.contextMenu.hide(); + document.body.onclick = previous_onclick; + }; + event.editor.contentElement.onclick = function() { + event.editor.contextMenu.hide(); + }; + } + }); + + WysiwygEditorSpellCheckSetup(self); + + var toolbar = document.createElement('table'); + var tbody = document.createElement('tbody'); + var row = document.createElement('tr'); + var lastColumn = document.createElement('td'); + toolbar.id = textareaName + '.WysiwygEditorToolbar'; + toolbar.style.width = (textarea.offsetWidth + 12) + 'px'; + toolbar.className = 'WysiwygEditorToolbar'; + toolbar.setAttribute('cellpadding', 0); + toolbar.setAttribute('cellspacing', 0); + toolbar.appendChild(tbody); + tbody.appendChild(row); + + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorBoldToolbarItem(self, group); + WysiwygEditorItalicToolbarItem(self, group), + WysiwygEditorUnderlineToolbarItem(self, group); + WysiwygEditorStrikethroughToolbarItem(self, group); + }); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorOrderedListToolbarItem(self, group); + WysiwygEditorUnorderedListToolbarItem(self, group); + }); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorOutdentToolbarItem(self, group); + WysiwygEditorIndentToolbarItem(self, group); + }); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorJustifyLeftToolbarItem(self, group); + WysiwygEditorJustifyCenterToolbarItem(self, group); + WysiwygEditorJustifyRightToolbarItem(self, group); + }); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorLinkToolbarItem(self, group); + self.addToolbarItem(group, 'image', '', uriForServerImageResource('Components/WysiwygEditor/image.png'), false, function( item ) { + // TODO: Implement the image importer. + }); + WysiwygEditorHorizontalLineToolbarItem(self, group); + }); + WysiwygEditorFontToolbarDropDown(self, row); + WysiwygEditorFontSizeToolbarDropDown(self, row); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Components/WysiwygEditor/textcolor.png'), 'forecolor'); + WysiwygEditorColorToolbarItem(self, group, 'backgroundcolor', uriForServerImageResource('Components/WysiwygEditor/backgroundcolor.png'), 'backcolor'); + }); + WysiwygEditorSpellCheckLanguageDropDown(self, row); + self.addToolbarItemGroup(row, function( group ) { + WysiwygEditorSpellCheckToolbarItems(self, group); + }); + + lastColumn.style.width = '100%'; + row.appendChild(lastColumn); + + textarea.parentNode.insertBefore(toolbar, self.iframe); + + setTimeout(function() { + if( Element.getWidth(toolbar) > Element.getWidth(self.iframe) ) { + self.iframe.style.width = Element.getWidth(toolbar) + 'px'; + self.iframeDocument.body.style.width = self.iframe.style.width; + } + }, 100); + }, 100); + }; +} + +function WysiwygEditorBoldToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'bold', '', uriForServerImageResource('Components/WysiwygEditor/bold.png'), false, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('bold', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + if( container ) { + var style = Element.getStyle(container, 'font-weight'); + if( style == '700' || style == 'bold' ) + return true; + } + return false; + }); +} +function WysiwygEditorItalicToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), false, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('italic', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'font-style') == 'italic' ) + return true; + return false; + }); +} +function WysiwygEditorUnderlineToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'underline', '', uriForServerImageResource('Components/WysiwygEditor/underline.png'), false, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('underline', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'text-decoration').search('underline') > -1 ) + return true; + return false; + }); +} +function WysiwygEditorStrikethroughToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'strikethrough', '', uriForServerImageResource('Components/WysiwygEditor/strikethrough.png'), true, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('strikethrough', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'text-decoration').search('line-through') > -1 ) + return true; + return false; + }); +} + +function WysiwygEditorOrderedListToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'ol', '', uriForServerImageResource('Components/WysiwygEditor/ol.png'), false, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('insertorderedlist', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + var found = false; + var node = container; + while( node && (node != editor.contentElement) ) { + if( node.tagName.toLowerCase() == 'ol' ) { + found = true; + break; + } + node = node.parentNode; + } + if( found ) + return true; + return false; + }); +} +function WysiwygEditorUnorderedListToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'ul', '', uriForServerImageResource('Components/WysiwygEditor/ul.png'), true, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('insertunorderedlist', false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }, function( editor, item, container ) { + var found = false; + var node = container + while( node && (node != editor.contentElement) ) { + if( node.tagName.toLowerCase() == 'ul' ) { + found = true; + break; + } + node = node.parentNode; + } + if( found ) + return true; + return false; + }); +} + +function WysiwygEditorOutdentToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'outdent', '', uriForServerImageResource('Components/WysiwygEditor/outdent.png'), false, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('outdent', false, false); + }); +} +function WysiwygEditorIndentToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'indent', '', uriForServerImageResource('Components/WysiwygEditor/indent.png'), true, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('indent', false, false); + }); +} + +function WysiwygEditorAddCommonJustifyFunction( editor ) { + editor.previousJustifyItemClicked = null; + editor.justifyItemClicked = function( item, command ) { + if( editor.previousJustifyItemClicked ) + editor.previousJustifyItemClicked.className = 'WysiwygEditorToolbarItem'; + editor.previousJustifyItemClicked = item; + editor.contentElement.focus(); + editor.iframeDocument.execCommand(command, false, false); + item.active = (item.active ? false : true); + item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); + }; +} +function WysiwygEditorJustifyLeftToolbarItem( editor, group ) { + if( editor.justifyItemClicked == undefined ) { + WysiwygEditorAddCommonJustifyFunction(editor); + } + editor.addToolbarItem(group, 'leftjustify', '', uriForServerImageResource('Components/WysiwygEditor/leftjustify.png'), false, function( item ) { + editor.justifyItemClicked(item, 'justifyleft'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'text-align') == 'left' ) + return true; + return false; + }); +} +function WysiwygEditorJustifyCenterToolbarItem( editor, group ) { + if( editor.justifyItemClicked == undefined ) { + WysiwygEditorAddCommonJustifyFunction(editor); + } + editor.addToolbarItem(group, 'centerjustify', '', uriForServerImageResource('Components/WysiwygEditor/centerjustify.png'), false, function( item ) { + editor.justifyItemClicked(item, 'justifycenter'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'text-align') == 'center' ) + return true; + return false; + }); +} +function WysiwygEditorJustifyRightToolbarItem( editor, group ) { + if( editor.justifyItemClicked == undefined ) { + WysiwygEditorAddCommonJustifyFunction(editor); + } + editor.addToolbarItem(group, 'rightjustify', '', uriForServerImageResource('Components/WysiwygEditor/rightjustify.png'), false, function( item ) { + editor.justifyItemClicked(item, 'justifyright'); + }, function( editor, item, container ) { + if( container && Element.getStyle(container, 'text-align') == 'right' ) + return true; + return false; + }); +} + +function WysiwygEditorHorizontalLineToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'horizontalline', '', uriForServerImageResource('Components/WysiwygEditor/hr.png'), true, function( item ) { + editor.contentElement.focus(); + editor.iframeDocument.execCommand('inserthorizontalrule', false, false); + }); +} + +function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { + var list = [ + { name: 'Arial', label: 'Arial', font: 'arial' }, + { name: 'Arial black', label: 'Arial black', font: 'arial black' }, + { name: 'Comic Sans MS', label: 'Comic Sans MS', font: 'comic sans ms' }, + { name: 'Courier New', label: 'Courier New', font: 'courier new' }, + { name: 'Georgia', label: 'Georgia', font: 'georgia' }, + { name: 'Impact', label: 'Impact', font: 'Impact' }, + { name: 'Lucida Console', label: 'Lucida Console', font: 'lucida console' }, + { name: 'Lucida Sans Unicode', label: 'Lucida Sans Unicode', font: 'lucida sans unicode' }, + { name: 'Tahoma', label: 'Tahoma', font: 'tahoma' }, + { name: 'Times New Roman', label: 'Times New Roman', font: 'times new roman' }, + { name: 'Trebuchet MS', label: 'Trebuchet MS', font: 'trebuchet ms' }, + { name: 'Verdana', label: 'Verdana', font: 'verdana' } + ]; + editor.addToolbarDropDown(toolbar, 'Font', 155, list, function(item) { + //editor.contentElement.focus(); + editor.iframeDocument.execCommand('fontname', false, item.font); + }, function( itemLabel, container ) { + if( container ) { + var found = false; + var fontFamily; + if( Prototype.Browser.WebKit ) { + if( container.tagName.toLowerCase() == 'font' && container.className.toLowerCase() == 'apple-style-span' ) { + fontFamily = container.getAttribute('face').replace(/'/g, ''); + } + } else if( Prototype.Browser.IE ) { + if( container.tagName.toLowerCase() == 'font' ) { + fontFamily = container.getAttribute('face'); + } + if( !fontFamily ) { + fontFamily = Element.getStyle(container, 'font-family'); + } + } else { + fontFamily = Element.getStyle(container, 'font-family'); + } + if( fontFamily ) { + var size = list.length; + for( var i = 0; i < size; i++ ) { + var item = list[i]; + if( item.font == fontFamily ) { + if( fontFamily != editor.previousSelectionFontFamily ) { + itemLabel.innerHTML = item.name; + } + editor.previousSelectionFontFamily = item.font; + found = true; + break; + } + } + } + if( found == false && editor.previousSelectionFontFamily != 'Font' ) { + itemLabel.innerHTML = 'Font'; + editor.previousSelectionFontFamily = 'Font'; + } + } + }); +} +function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { + var list = [ + { name: '10', label: '10', size: 1 }, + { name: '12', label: '12', size: 2 }, + { name: '14', label: '14', size: 3 }, + { name: '18', label: '18', size: 4 }, + { name: '24', label: '24', size: 5 }, + { name: '32', label: '32', size: 6 }, + { name: '48', label: '48', size: 7 } + ]; + editor.addToolbarDropDown(toolbar, 'Size', 70, list, function(item) { + //editor.contentElement.focus(); + editor.iframeDocument.execCommand('FontSize', false, item.size); + }, function( itemLabel, container ) { + if( container ) { + var found = false; + var fontSize; + if( Prototype.Browser.WebKit ) { + if( container.tagName.toLowerCase() == 'font' && container.className.toLowerCase() == 'apple-style-span' ) { + fontSize = container.getAttribute('size').replace(/'/g, ''); + } + } else if( Prototype.Browser.IE ) { + if( container.tagName.toLowerCase() == 'font' ) { + fontSize = container.getAttribute('size'); + } + if( !fontSize ) { + fontSize = Element.getStyle(container, 'font-size'); + } + } else { + fontSize = Element.getStyle(container, 'font-size'); + } + if( fontSize ) { + var size = list.length; + for( var i = 0; i < size; i++ ) { + var item = list[i]; + if( item.size == fontSize ) { + if( fontSize != editor.previousSelectionFontSize ) { + itemLabel.innerHTML = item.name; + } + editor.previousSelectionFontSize = item.font; + found = true; + break; + } + } + } + if( found == false && editor.previousSelectionFontSize != 'Size' ) { + itemLabel.innerHTML = 'Size'; + editor.previousSelectionFontSize = 'Size'; + } + } + }); +} + +function WysiwygEditorLinkToolbarItem( editor, group ) { + editor.addToolbarItem(group, 'link', '', uriForServerImageResource('Components/WysiwygEditor/link.png'), false, function( item ) { + if( editor.linkPopup == undefined ) { + var textTextfield = null; + var urlTextfield = null; + var webAddressLabel = null; + var webAddressRadioButton = null; + var emailAddressLabel = null; + var emailAddressRadioButton = null; + var descriptionLabel = null; + var table = editor.createTable(function( table, tbody ) { + table.style.width = '100%'; + editor.createTableRow(tbody, function( row ) { + editor.createTableColumn(row, function( column ) { + column.style.padding = '5px'; + column.style.whiteSpace = 'nowrap'; + column.innerHTML = 'Text to display:'; + }); + editor.createTableColumn(row, function( column ) { + var input = document.createElement('input'); + input.setAttribute('type', 'text'); + input.style.width = '99%'; + column.style.padding = '5px'; + column.style.width = '100%'; + column.appendChild(input); + textTextfield = input; + }); + }); + editor.createTableRow(tbody, function( row ) { + row.style.verticalAlign = 'bottom'; + editor.createTableColumn(row, function( column ) { + column.style.padding = '5px'; + column.style.whiteSpace = 'nowrap'; + column.appendChild(editor.createElement('div', function( div ) { + div.style.width = '120px'; + div.style.marginBottom = '2px'; + div.innerHTML = 'Link to:'; + })); + column.appendChild(editor.createElement('div', function( div ) { + div.style.marginBottom = '2px'; + div.style.cursor = 'pointer'; + div.appendChild(editor.createElement('input', function( input ) { + input.setAttribute('type', 'radio'); + input.style.verticalAlign = (Prototype.Browser.IE ? 'middle' : 'bottom'); + input.style.marginRight = '0px'; + webAddressRadioButton = input; + })); + div.appendChild(document.createTextNode('\u00a0')); + div.appendChild(editor.createElement('span', function( span ) { + span.innerHTML = 'Web address'; + webAddressLabel = span; + })); + })); + column.appendChild(editor.createElement('div', function( div ) { + div.style.cursor = 'pointer'; + div.appendChild(editor.createElement('input', function( input ) { + input.setAttribute('type', 'radio'); + input.style.verticalAlign = (Prototype.Browser.IE ? 'middle' : 'bottom'); + input.style.marginRight = '0px'; + emailAddressRadioButton = input; + })); + div.appendChild(document.createTextNode('\u00a0')); + div.appendChild(editor.createElement('span', function( span ) { + span.innerHTML = 'Email address'; + emailAddressLabel = span; + })); + })); + }); + editor.createTableColumn(row, function( column ) { + column.style.width = '100%'; + column.style.padding = '5px'; + column.appendChild(editor.createElement('div', function( div ) { + div.style.fontWeight = 'bold'; + div.style.marginBottom = '2px'; + div.innerHTML = 'To what URL should this link go?'; + descriptionLabel = div; + })); + column.appendChild(editor.createElement('input', function( input ) { + input.setAttribute('type', 'text'); + input.style.width = '99%'; + urlTextfield = input; + })); + }); + }); + }); + var popup = editor.createElement('div', function( div ) { + div.className = 'WysiwygEditorItemPopup'; + div.style.display = 'none'; + div.style.width = '450px'; + div.appendChild(table); + div.appendChild(editor.createItemPopupFooter(function( footer ) { + editor.addItemPopupFooterButton(footer, 'Save', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_save.png', '#96D754', function() { + if( editor.linkSelectedContainer ) { + editor.linkSelectedContainer.href = editor.linkTextfieldURL.value; + } else if( editor.linkSelectedText ) { + var selection = rangy.getSelection(editor.iframeWindow); + selection.setSingleRange(editor.linkSelectedRange); + editor.iframeDocument.execCommand('createLink', false, editor.linkTextfieldURL.value); + } else { + var node = editor.createElement('a', function( a ) { + a.href = editor.linkTextfieldURL.value; + a.innerHTML = editor.linkTextfieldText.value; + }, editor.iframeDocument); + var selection = rangy.getSelection(editor.iframeWindow); + var range = editor.linkSelectedRange; + range.collapse(false); + range.insertNode(node); + range.collapseAfter(node); + selection.setSingleRange(range); + } + Element.hide(div); + item.className = 'WysiwygEditorToolbarItem'; + }); + editor.addItemPopupFooterButton(footer, 'Cancel', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_arrow_right.png', '#FCAB46', function() { + Element.hide(div); + item.className = 'WysiwygEditorToolbarItem'; + }); + })); + }); + document.body.appendChild(popup); + editor.linkPopup = popup; + editor.linkWebAddressRadioButton = webAddressRadioButton; + editor.linkWebAddressLabel = webAddressLabel; + editor.linkEmailAddressRadioButton = emailAddressRadioButton; + editor.linkEmailAddressLabel = emailAddressLabel; + editor.linkDescriptionLabel = descriptionLabel; + editor.linkTextfieldText = textTextfield; + editor.linkTextfieldURL = urlTextfield; + webAddressRadioButton.onclick = webAddressLabel.onclick = function() { + webAddressRadioButton.checked = true; + webAddressLabel.style.fontWeight = 'bold'; + emailAddressRadioButton.checked = false; + emailAddressLabel.style.fontWeight = 'normal'; + descriptionLabel.innerHTML = 'To what URL should this link go?'; + }; + emailAddressRadioButton.onclick = emailAddressLabel.onclick = function() { + emailAddressRadioButton.checked = true; + emailAddressLabel.style.fontWeight = 'bold'; + webAddressRadioButton.checked = false; + webAddressLabel.style.fontWeight = 'normal'; + descriptionLabel.innerHTML = 'To what email address should this link?'; + }; + } + if( Element.visible(editor.linkPopup) ) { + Element.hide(editor.linkPopup); + item.className = 'WysiwygEditorToolbarItem'; + } else { + var selection = rangy.getSelection(editor.iframeWindow); + var range = selection.getRangeAt(0).cloneRange(); + var selectedText = selection.toString(); + var selectedContainer = range.startContainer; + if( selectedContainer.nodeType == 3 ) + selectedContainer = selectedContainer.parentNode; + editor.linkSelectedText = selectedText; + editor.linkWebAddressRadioButton.checked = true; + editor.linkWebAddressLabel.style.fontWeight = 'bold'; + editor.linkEmailAddressRadioButton.checked = false; + editor.linkEmailAddressLabel.style.fontWeight = 'normal'; + editor.linkDescriptionLabel = 'To what URL should this link go?'; + editor.linkSelectedContainer = null; + editor.linkTextfieldURL.value = ''; + editor.linkTextfieldText.value = ''; + editor.linkTextfieldText.disabled = false; + if( selectedText ) { + editor.linkTextfieldText.disabled = true; + editor.linkTextfieldText.value = selectedText; + } + editor.linkSelectedRange = range; + editor.linkSelectedContainer = null; + if( selectedContainer && selectedContainer.tagName.toLowerCase() == 'a' ) { + editor.linkSelectedContainer = selectedContainer; + editor.linkTextfieldURL.value = selectedContainer.href; + editor.linkTextfieldText.disabled = true; + editor.linkTextfieldText.value = selectedContainer.innerHTML.stripTags(); + } else if( selectedContainer && selectedContainer.parentNode && selectedContainer.parentNode.tagName.toLowerCase() == 'a' ) { + editor.linkSelectedContainer = selectedContainer.parentNode; + editor.linkTextfieldURL.value = selectedContainer.parentNode.href; + editor.linkTextfieldText.disabled = true; + editor.linkTextfieldText.value = selectedContainer.parentNode.innerHTML.stripTags(); + } + Element.clonePosition(editor.linkPopup, item, { + setWidth: false, + setHeight: false, + offsetLeft: 0 - (Element.getWidth(editor.linkPopup) / 2), + offsetTop: Element.getHeight(item.parentNode) + }); + Element.show(editor.linkPopup); + item.className = 'WysiwygEditorToolbarItemActive'; + } + }, function( editor, item ) { + }); +} + +function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { + editor.addToolbarItem(group, name, '', icon, false, function( item ) { + if( editor.colorPopup == undefined ) { + var colors = [ + [ '#000', '#800000', '#8B4513', '#2F4F4F', '#008080', '#000080', '#4B0082', '#696969' ], + [ '#B22222', '#A52A2A', '#DAA520', '#006400', '#40E0D0', '#0000CD', '#800080', '#808080' ], + [ '#F00', '#FF8C00', '#FFD700', '#008000', '#0FF', '#00F', '#EE82EE', '#A9A9A9' ], + [ '#FFA07A', '#FFA500', '#FFFF00', '#00FF00', '#AFEEEE', '#ADD8E6', '#DDA0DD', '#D3D3D3' ], + [ '#FFF0F5', '#FAEBD7', '#FFFFE0', '#F0FFF0', '#F0FFFF', '#F0F8FF', '#E6E6FA', '#FFF' ] + ]; + var moreColors = [ + [ "#000000", "#003300", "#006600", "#009900", "#00cc00", "#00ff00", "#330000", "#333300", "#336600", "#339900", "#33cc00", "#33ff00", "#660000", "#663300", "#666600", "#669900", "#66cc00", "#66ff00" ], + [ "#000033", "#003333", "#006633", "#009933", "#00cc33", "#00ff33", "#330033", "#333333", "#336633", "#339933", "#33cc33", "#33ff33", "#660033", "#663333", "#666633", "#669933", "#66cc33", "#66ff33" ], + [ "#000066", "#003366", "#006666", "#009966", "#00cc66", "#00ff66", "#330066", "#333366", "#336666", "#339966", "#33cc66", "#33ff66", "#660066", "#663366", "#666666", "#669966", "#66cc66", "#66ff66" ], + [ "#000099", "#003399", "#006699", "#009999", "#00cc99", "#00ff99", "#330099", "#333399", "#336699", "#339999", "#33cc99", "#33ff99", "#660099", "#663399", "#666699", "#669999", "#66cc99", "#66ff99" ], + [ "#0000cc", "#0033cc", "#0066cc", "#0099cc", "#00cccc", "#00ffcc", "#3300cc", "#3333cc", "#3366cc", "#3399cc", "#33cccc", "#33ffcc", "#6600cc", "#6633cc", "#6666cc", "#6699cc", "#66cccc", "#66ffcc" ], + [ "#0000ff", "#0033ff", "#0066ff", "#0099ff", "#00ccff", "#00ffff", "#3300ff", "#3333ff", "#3366ff", "#3399ff", "#33ccff", "#33ffff", "#6600ff", "#6633ff", "#6666ff", "#6699ff", "#66ccff", "#66ffff" ], + [ "#990000", "#993300", "#996600", "#999900", "#99cc00", "#99ff00", "#cc0000", "#cc3300", "#cc6600", "#cc9900", "#cccc00", "#ccff00", "#ff0000", "#ff3300", "#ff6600", "#ff9900", "#ffcc00", "#ffff00" ], + [ "#990033", "#993333", "#996633", "#999933", "#99cc33", "#99ff33", "#cc0033", "#cc3333", "#cc6633", "#cc9933", "#cccc33", "#ccff33", "#ff0033", "#ff3333", "#ff6633", "#ff9933", "#ffcc33", "#ffff33" ], + [ "#990066", "#993366", "#996666", "#999966", "#99cc66", "#99ff66", "#cc0066", "#cc3366", "#cc6666", "#cc9966", "#cccc66", "#ccff66", "#ff0066", "#ff3366", "#ff6666", "#ff9966", "#ffcc66", "#ffff66" ], + [ "#990099", "#993399", "#996699", "#999999", "#99cc99", "#99ff99", "#cc0099", "#cc3399", "#cc6699", "#cc9999", "#cccc99", "#ccff99", "#ff0099", "#ff3399", "#ff6699", "#ff9999", "#ffcc99", "#ffff99" ], + [ "#9900cc", "#9933cc", "#9966cc", "#9999cc", "#99cccc", "#99ffcc", "#cc00cc", "#cc33cc", "#cc66cc", "#cc99cc", "#cccccc", "#ccffcc", "#ff00cc", "#ff33cc", "#ff66cc", "#ff99cc", "#ffcccc", "#ffffcc" ], + [ "#9900ff", "#9933ff", "#9966ff", "#9999ff", "#99ccff", "#99ffff", "#cc00ff", "#cc33ff", "#cc66ff", "#cc99ff", "#ccccff", "#ccffff", "#ff00ff", "#ff33ff", "#ff66ff", "#ff99ff", "#ffccff", "#ffffff" ] + ]; + var colorsTable = editor.createTable(function( table, tbody ) { + //table.style.width = '100%'; + colors.each(function(colorRow) { + editor.createTableRow(tbody, function( row ) { + colorRow.each(function(color) { + editor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorColorItemContainer'; + column.onmousedown = item.onselectstart = function() { return false; }; + column.unselectable = true; + column.appendChild(editor.createElement('div', function(div) { + div.className = 'WysiwygEditorColorItem'; + div.onmousedown = item.onselectstart = function() { return false; }; + div.unselectable = true; + div.style.backgroundColor = color; + div.onclick = function() { + editor.colorSelectorOnclick(color); + }; + })); + }); + }); + }); + }); + }); + var moreColorsPreview = null; + var moreColorsPreviewTable = editor.createTable(function( table, tbody ) { + table.style.width = '100%'; + table.style.marginTop = '1px'; + table.style.marginBottom = '3px'; + table.style.marginLeft = '3px'; + table.style.marginRight = '3px'; + table.style.display = 'none', + editor.createTableRow(tbody, function( row ) { + moreColorsPreview = editor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorMoreColorsPreview'; + column.onmousedown = item.onselectstart = function() { return false; }; + column.unselectable = true; + }); + }); + }); + var moreColorsTable = editor.createTable(function( table, tbody ) { + table.style.margin = '2px'; + table.style.display = 'none'; + //table.style.border = '1px solid #999'; + table.onmouseout = function() { + moreColorsPreview.style.backgroundColor = '#FFF'; + }; + moreColors.each(function(colorRow) { + editor.createTableRow(tbody, function( row ) { + colorRow.each(function(color) { + editor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorMoreColorItemContainer'; + column.onmousedown = item.onselectstart = function() { return false; }; + column.unselectable = true; + column.appendChild(editor.createElement('div', function(div) { + div.className = 'WysiwygEditorMoreColorItem'; + div.onmousedown = item.onselectstart = function() { return false; }; + div.unselectable = true; + div.style.backgroundColor = color; + div.onmouseover = function() { + moreColorsPreview.style.backgroundColor = color; + }; + div.onclick = function() { + editor.colorSelectorOnclick(color); + }; + })); + }); + }); + }); + }); + }); + var popup = editor.createElement('div', function( div ) { + div.className = 'WysiwygEditorItemPopup'; + div.align = 'center'; + div.style.display = 'none'; + //div.style.width = '150px'; + div.appendChild(colorsTable); + div.appendChild(editor.createElement('div', function( div ) { + div.className = 'WysiwygEditorMoreColorsButton'; + div.innerHTML = 'More Colors...'; + div.align = 'center'; + div.onmousedown = item.onselectstart = function() { return false; }; + div.unselectable = true; + div.onclick = function() { + if( Element.visible(moreColorsTable) ) { + Element.hide(moreColorsTable); + Element.hide(moreColorsPreviewTable); + } else { + Element.show(moreColorsTable); + Element.show(moreColorsPreviewTable); + moreColorsPreviewTable.style.width = Element.getWidth(moreColorsTable) + 'px'; + } + }; + })); + div.appendChild(moreColorsTable); + div.appendChild(moreColorsPreviewTable); + }); + editor.colorPopup = popup; + Element.hide(editor.colorPopup); + document.body.appendChild(popup); + } + + if( editor.colorSelectorPreviousToolbarItem && editor.colorSelectorCurrentItem != name ) { + Element.hide(editor.colorPopup); + editor.colorSelectorPreviousToolbarItem.className = 'WysiwygEditorToolbarItem'; + } + if( Element.visible(editor.colorPopup) ) { + Element.hide(editor.colorPopup); + item.className = 'WysiwygEditorToolbarItem'; + editor.colorSelectorSavedRange = null; + editor.colorSelectorPreviousToolbarItem = null; + } else { + var selection = rangy.getSelection(editor.iframeWindow); + editor.colorSelectorSavedRange = selection.getRangeAt(0).cloneRange(); + editor.colorSelectorPreviousToolbarItem = item; + Element.clonePosition(editor.colorPopup, item, { + setWidth: false, + setHeight: false, + offsetLeft: 0 - (Element.getWidth(editor.colorPopup) / 2), + offsetTop: Element.getHeight(item.parentNode) + }); + Element.show(editor.colorPopup); + item.className = 'WysiwygEditorToolbarItemActive'; + editor.colorSelectorCurrentItem = name; + editor.colorSelectorOnclick = function( color ) { + var selection = rangy.getSelection(editor.iframeWindow); + selection.setSingleRange(editor.colorSelectorSavedRange); + editor.iframeDocument.execCommand(command, false, color); + Element.hide(editor.colorPopup); + item.className = 'WysiwygEditorToolbarItem'; + editor.colorSelectorSavedRange = null; + }; + } + }); +} + +function WysiwygEditorSpellCheckSetup( editor ) { + editor.spellcheck = { + list: [], + words: {}, + misspelled_words: {}, + language: 0, + + reset: function() { + this.list = []; + this.words = {}; + }, + setLanguage: function( language ) { + this.language = language; + }, + check: function( element ) { + var wordNodes = new Array(); + + var node = element.firstChild; + while( node ) { + if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { + node.className = ''; + wordNodes.push(node); + } else if( node.nodeType == 3 ) { + wordNodes.push(node); + } + + if( node.firstChild ) { + node = node.firstChild; + } else if( node.nextSibling ) { + node = node.nextSibling; + } else { + for( node = node.parentNode; node; node = node.parentNode ) { + if( node.nextSibling ) { + node = node.nextSibling; + break; + } + } + } + } + + var i; + var wordNodesLength = wordNodes.length; + + for( i = 0; i < wordNodesLength; i++ ) { + this.setWord(wordNodes[i], this.getInnerText(wordNodes[i])); + } + + var captured_this = this; + mcam.fireCallbackRequest('wysiwyg_editor_spell_check_perform', function( value ) { + var data = JSON.parse(value); + var i; + var j; + captured_this.misspelled_words = {}; + for( i = 0; i < data.misspelled_words.length; i++ ) { + var item = data.misspelled_words[i]; + captured_this.misspelled_words[item.word] = true; + if( captured_this.words[item.word] && !captured_this.words[item.word].ignore ) { + for( j = 0; j < captured_this.words[item.word].nodes.length; j++ ) { + var node = captured_this.words[item.word].nodes[j]; + node.style.backgroundColor = 'red'; + if( item.suggestions.length > 0 ) { + node.style.backgroundColor = 'yellow'; + } + captured_this.words[item.word].suggestions = item.suggestions; + } + } + } + }, { words: this.list, language: this.language }); + }, + finish: function( node ) { + var i; + + for( i = 0; i < this.list.length; i++ ) { + var word = this.list[i]; + this.words[word].nodes = new Array(); + } + + var nodes = new Array(); + + while( node ) { + if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { + nodes.push(node); + } + if ( node.firstChild ) { + node = node.firstChild; + } else if( node.nextSibling ) { + node = node.nextSibling; + } else { + for( node = node.parentNode; node; node = node.parentNode ) { + if( node.nextSibling ) { + node = node.nextSibling; + break; + } + } + } + } + + var nodesLength = nodes.length; + var j; + + for ( i = 0; i < nodesLength; i++ ) { + node = nodes[i]; + var childNodesLength = node.childNodes.length; + for ( j = 0; j < childNodesLength; j++ ) { + node.parentNode.insertBefore(node.childNodes[j], node); + } + node.parentNode.removeChild(node); + } + }, + ignore: function ( word ) { + if( this.words[word] ) { + this.words[word].ignore = true; + var i; + var nodesLength = this.words[word].nodes.length; + for( i = 0; i < nodesLength; i++ ) { + var node = this.words[word].nodes[i]; + node.style.backgroundColor = ''; + } + } + }, + learn: function( word ) { + if( this.words[word] ) + { + mcam.fireCallbackRequest('WysiwygEditorSpellCheckLearnWord', null, { word: word, language: this.language }); + this.ignore(word); + } + }, + suggestions: function( word ) { + return this.words[word].suggestions; + }, + isWordMisspelled: function( word ) { + return (this.misspelled_words[word] ? true : false); + }, + isWordIgnored: function( word ) { + return this.words[word].ignore; + }, + getInnerText: function( node ) { + if ( !node ) { + return ''; + } + + switch ( node.nodeType ) { + case 1: + if ( node.tagName == 'BR' ) { + return '\n'; + } else { + var string = ''; + var i; + for( i = 0; i < node.childNodes.length; i++ ) { + string += this.getInnerText(node.childNodes[i]); + } + return string; + } + break; + case 3: + return node.nodeValue; + break; + }; + }, + setWord: function( element, word ) { + var doc = element.ownerDocument || element.document; + var wordLength = word.length; + var string = ''; + var n = 0; + var i; + + for( i = 0; i < wordLength; i++ ) { + var character = word.substr( i, 1 ); + + // Match all but numbers, letters, - and ' + if( !character.match( /[AaBbCcDdEeFfGgHhiiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÅåÄäÖöÜüßÆæØøÀàÁáÂâÇçÈèÉéÊêËëÎîÏïÍíÔôÓóŒœÙùÚúÛûÑñĄąĘęÓóĆ棳ŃńŚśŹźŻż\']/ ) ) { + var newNode; + + if( string ) { + element.parentNode.insertBefore(this.createWordNode(string, doc), element); + } + + if( character == '\n' ) { + newNode = doc.createElement('br'); + } else { + newNode = doc.createTextNode(character); + } + + element.parentNode.insertBefore(newNode, element); + string = ''; + n++; + } else { + string += character; + } + } + + if( string ) { + element.parentNode.insertBefore(this.createWordNode(string, doc), element); + } + + element.parentNode.removeChild(element); + + return n; + }, + createWordNode: function( word, doc ) { + var node = doc.createElement('span'); + node.className = 'wysiwyg-spell-check-word'; + node.appendChild(doc.createTextNode(word)); + + if( !this.words[word] ) { + this.list.push(word); + this.words[word] = {}; + this.words[word].ignore = false; + this.words[word].suggestions = new Array(); + this.words[word].nodes = new Array(); + } + this.words[word].nodes.push(node); + + return node; + } + }; +} + +function WysiwygEditorSpellCheckLanguageDropDown( editor, toolbar ) { + var list = editor.getLanguages(); + var listLength = list.length + editor.addToolbarDropDown(toolbar, 'Language', 105, list, function(item, itemLabel) { + itemLabel.innerHTML = item.label; + editor.spellcheck.setLanguage(item.language); + }); + for( var i = 0; i < listLength; i++ ) { + var item = list[i]; + if( item.selected ) { + editor.spellcheck.setLanguage(item.language); + } + } +} + +function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { + var check_button = null; + var finish_button = null; + var spell_check_mode = false; + check_button = editor.addToolbarItem(toolbar, 'spellcheck', 'Perform Spell Check', uriForServerImageResource('Components/WysiwygEditor/check.png'), false, function( item ) { + Element.hide(check_button); + Element.show(finish_button); + spell_check_mode = true; + editor.spellcheck.check(editor.contentElement); + }); + finish_button = editor.addToolbarItem(toolbar, 'finishspellcheck', 'Finish Spell Check', uriForServerImageResource('Components/WysiwygEditor/done.png'), true, function( item ) { + Element.hide(finish_button); + Element.show(check_button); + spell_check_mode = false; + editor.spellcheck.finish(editor.contentElement); + }); + editor.onEvent('keyup', function() { + if( spell_check_mode ) { + Element.hide(finish_button); + Element.show(check_button); + spell_check_mode = false; + editor.spellcheck.finish(editor.contentElement); + } + }); + editor.onEvent('contextmenu', function() { + if( spell_check_mode ) { + var container = editor.selectionContainer(); + if( container && container.className == 'wysiwyg-spell-check-word' ) { + var word = container.innerHTML; + word = word.trim(); + if( editor.spellcheck.words[word] ) { + var mainSuggestions = 0; + var moreSuggestionsGroup = null; + editor.spellcheck.words[word].suggestions.each(function(suggestion) { + if( mainSuggestions < 5 ) { + editor.contextMenu.addGroup(function( group ) { + group.addItem(uriForServerImageResource('Components/WysiwygEditor/replace.png'), suggestion, function() { + Element.replace(container, suggestion); + }); + }); + mainSuggestions++; + } else { + if( ! moreSuggestionsGroup ) { + + } + } + }); + } + } + } + }); + Element.show(check_button); + Element.hide(finish_button); +} + diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template index 2ab2ad8..02a74ff 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template @@ -1,7 +1,6 @@ From 49d82ecaf0e873201b68d2259ee0fd87a10c6176 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 24 Aug 2011 17:05:07 +0200 Subject: [PATCH 039/190] Reset the TextView component to its state before Ckeditor got added. --- .../Support/Components/TextView/TextView.feh | 7 +- .../Support/Components/TextView/TextView.js | 209 +----------------- .../Components/TextView/TextView.template | 7 +- 3 files changed, 11 insertions(+), 212 deletions(-) diff --git a/Public/Support/Components/TextView/TextView.feh b/Public/Support/Components/TextView/TextView.feh index af2f08b..cee5914 100644 --- a/Public/Support/Components/TextView/TextView.feh +++ b/Public/Support/Components/TextView/TextView.feh @@ -4,10 +4,7 @@ namespace modifies GUIKit { [attribute number rows 5 'Number of rows to have in the text view']; [attribute number columns 100 'Number of columns to have in the text view']; - [attribute boolean readOnly false 'If the text view should be read only']; - [attribute boolean richText false 'If rich text should be enabled in the text view']; - [attribute boolean ckeditor false 'If Ckeditor should be used as the editor']; - [attribute string ckeditorToolbar 'Full' 'The toolbar to use in Ckeditor']; + [attribute boolean readonly false 'If the text view should be read only']; function render() { if( .visible() ) { @@ -15,8 +12,6 @@ namespace modifies GUIKit { object component = GUIKit.componentByName('TextView'); string path = component.pathForComponentResource('TextView.template'); values['JavascriptSafeTextValue'] = JSON.escape(values['TextValue']); - values['ckeditor'] = (not .readOnly() ? (.ckeditor() or .richText() ? true : false) : false); - values['CkeditorHeight'] = .size.height - 'px'; return GUIKit.ViewTemplate.renderPath( path, values ); } return ""; diff --git a/Public/Support/Components/TextView/TextView.js b/Public/Support/Components/TextView/TextView.js index 5c5ff21..94935bc 100644 --- a/Public/Support/Components/TextView/TextView.js +++ b/Public/Support/Components/TextView/TextView.js @@ -1,226 +1,35 @@ function ComponentTextView( id ) { var self = ComponentTextfield(id); - self._readOnly = false; - self._richText = false; - self._ckeditor = false; - self._ckeditorToolbar = 'Full'; - self.rows = function() { return self.node().rows; }; self.columns = function() { return self.node().cols; }; - self.iframe = function() { return $(id + 'Iframe'); }; - self.ckeditor = function() { return CKEDITOR.instances[id]; }; - - self.setReadOnly = function( value ) { - self._readOnly = value; - }; - self.setRichText = function( value ) { - self._richText = value; - }; - self.setCkeditor = function( value ) { - self._ckeditor = value; - }; - self.setCkeditorToolbar = function( value ) { - self._ckeditorToolbar = value; - }; - + /* self.focus = function() { - if( self.ckeditor() ) { - if( self.ckeditor().focus ) - self.ckeditor().focus(); - } else { - self.node().focus(); - } + self.node().focus(); }; self.updateFormValue = function() { var value = self.formValue(); - if( self.node() ) { - self.node().value = value; - } - if( self.iframe() ) { - var doc = self.iframe().contentWindow.document; - doc.open(); - doc.write(value); - doc.close(); - Element.setStyle(doc.body, { - 'fontFamily': Element.getStyle(self.node(), 'fontFamily'), - 'fontSize': Element.getStyle(self.node(), 'fontSize') }); - - } - - if( self.ckeditor() ) { - self.ckeditor().setData(value); - self.ckeditor().updateElement(); - } + self.node().value = value; return self.formValue(); }; self.textValue = function() { - var value; - if( self._ckeditor == true ) { - value = self.ckeditor().getData(); - self._states['text-value'] = value; - } else { - value = self.node().value; - self._states['text-value'] = value; - } + var value = self.node().value; + self._states['text-value'] = value; return value; }; - self.empty = function() { - var value = self.textValue(); - if( self.ckeditor() ) { - value = value.replace('
    ', '').strip(); /* Ckeditor always leaves a
    */ - } - return (value ? false : true); - }; - self.setTextValue = function( value ) { - if( (self._ckeditor && !self._readOnly) || self._richText ) { - value = value.escapeHTML().replace(/(\r\n|[\r\n])/g, '
    '); - } self.setState('text-value', value); self.node().value = value; }; - self.setRichTextValue = function( value ) { - if( ! self._richText && ! self._ckeditor ) { - value = value.stripTags().unescapeHTML().strip(); - } - self.setState('text-value', value); - }; - - self.appendText = function( value ) { - if( self._richText ) { - value = value.escapeHTML().replace(/(\r\n|[\r\n])/g, '
    '); - } - self.setState('text-value', self.textValue() + value); - }; - - self.appendRichText = function( value ) { - if( ! self._richText ) { - value = value.stripTags().unescapeHTML().strip(); - } - self.setState('text-value', self.textValue() + value); - }; - - var previousActivate = self.activate; - self.activate = function activate() { - CKEDITOR.on('instanceReady', function( event ) { - if( ! event.editor.textViewComponentBlurRegistered ) { - event.editor.textViewComponentBlurRegistered = true; - event.editor.on('blur', function( ) { - self.action('blur'); - }); - } - }); - if( self._ckeditor == true && self._richText == false ) { - self._states['text-value'] = self.getState('text-value').escapeHTML().replace(/(\r\n|[\r\n])/g, '
    '); - } - self.reconfigure(self._ckeditor, self._richText, self._readOnly); - previousActivate(); - }; - - self.enableRichText = function() { - self.reconfigure(self._ckeditor, true, self._readOnly); - }; - self.disableRichText = function() { - self.reconfigure(self._ckeditor, false, self._readOnly); - }; - - self.reconfigure = function( ckeditor, richText, readOnly ) { - self._ckeditor = ckeditor; - self._richText = richText; - self._readOnly = readOnly; - // Iframe - if( readOnly && richText ) { - self.updateFormValue(); - if( self.ckeditor() ) { - self.ckeditor().destroy(true); - } - Element.hide(self.node()); - Element.show(self.iframe()); - } - // Textarea (disabled) - else if( readOnly && !richText ) { - self.updateFormValue(); - if( self.ckeditor() ) { - self.ckeditor().destroy(true); - } - Element.hide(self.iframe()); - Element.show(self.node()); - self.node().readOnly = true; - } - // Ckeditor (plain text mode) - else if( ckeditor && !richText ) { - self.updateFormValue(); - Element.hide(self.iframe()); - Element.hide(self.node()); - if( self.ckeditor() ) { - self.ckeditor().setPlainTextMode(true); - } else { - var textarea_height = 200; - if( self.node().style.height ) { - textarea_height = self.node().style.height; - } else if( Element.getHeight(self.node()) > 0 ) { - textarea_height = Element.getHeight(self.node()) - } - var callback = function( event ) { - if( event.editor.name == id ) { - event.editor.setPlainTextMode(true); - CKEDITOR.removeListener('instanceReady', callback); - } - }; - CKEDITOR.on('instanceReady', callback); - CKEDITOR.replace(self.node(), { toolbar: [ ['CentionSpellCheckLanguage', 'CentionSpellCheck', 'CentionSpellCheckDone'] ], height: textarea_height }); - } - } - // Ckeditor - else if( (ckeditor || richText) && !readOnly ) { - var textarea_height = 200; - if( self.node().style.height ) { - textarea_height = self.node().style.height; - } else if( Element.getHeight(self.node()) > 0 ) { - textarea_height = Element.getHeight(self.node()) - } - self.updateFormValue(); - Element.hide(self.iframe()); - Element.hide(self.node()); - if( self.ckeditor() ) { - self.ckeditor().setPlainTextMode(false); - } else { - CKEDITOR.replace(self.node(), { toolbar: [ - ['Bold','Italic','Underline','Strike'], - ['NumberedList','BulletedList'], - ['Outdent','Indent','Blockquote'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['CentionLink', 'Link'], - ['CentionImage','HorizontalRule'], - ['Font','FontSize'], - ['TextColor','BGColor'], - ['CentionSpellCheckLanguage', 'CentionSpellCheck', 'CentionSpellCheckDone'], - ['PlainText'] - ], height: textarea_height }); - } - } - // Textarea - else { - self.updateFormValue(); - if( self.ckeditor() ) { - self.ckeditor().destroy(true); - } - Element.hide(self.iframe()); - Element.show(self.node()); - self.node().readOnly = false; - } - return self.textValue(); - } - - self.formValue = function() { - return self._states['text-value']; - }; + self.formValue = function() { + return self._states['text-value']; + }; + */ return self; } diff --git a/Public/Support/Components/TextView/TextView.template b/Public/Support/Components/TextView/TextView.template index 093bb88..9335006 100644 --- a/Public/Support/Components/TextView/TextView.template +++ b/Public/Support/Components/TextView/TextView.template @@ -1,14 +1,9 @@ - + - From e72e47d3462df9a38618c7dd9fa2555c4f0e1b11 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 24 Aug 2011 17:05:34 +0200 Subject: [PATCH 040/190] The Wysiwyg Editor should have all of its toolbar items activated. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index f080336..99302d9 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -562,7 +562,7 @@ function WysiwygEditorObject() { toolbar.appendChild(tbody); tbody.appendChild(row); - /*WysiwygEditor.addToolbarItemGroup(row, function( group ) { + WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorBoldToolbarItem(self, group); WysiwygEditorItalicToolbarItem(self, group), WysiwygEditorUnderlineToolbarItem(self, group); @@ -593,7 +593,7 @@ function WysiwygEditorObject() { WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Components/WysiwygEditor/textcolor.png'), 'forecolor'); WysiwygEditorColorToolbarItem(self, group, 'backgroundcolor', uriForServerImageResource('Components/WysiwygEditor/backgroundcolor.png'), 'backcolor'); - });*/ + }); WysiwygEditorSpellCheckLanguageDropDown(self, row); WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorSpellCheckToolbarItems(self, group); From aa1fac9e603cd9b50bce56bb32b8c931c607e4cc Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 25 Aug 2011 16:57:47 +0200 Subject: [PATCH 041/190] Make sure cursor text is used in TextView textareas. --- Public/Support/Components/TextView/TextView.feh | 1 + 1 file changed, 1 insertion(+) diff --git a/Public/Support/Components/TextView/TextView.feh b/Public/Support/Components/TextView/TextView.feh index cee5914..b2a6eac 100644 --- a/Public/Support/Components/TextView/TextView.feh +++ b/Public/Support/Components/TextView/TextView.feh @@ -11,6 +11,7 @@ namespace modifies GUIKit { array values = .generateTemplateAttributes('wfTextView'); object component = GUIKit.componentByName('TextView'); string path = component.pathForComponentResource('TextView.template'); + values['Style'] = (values['Style'] ? values['Style'] + ';' : '') + 'cursor:text;'; values['JavascriptSafeTextValue'] = JSON.escape(values['TextValue']); return GUIKit.ViewTemplate.renderPath( path, values ); } From 79400e6df9d03e90c08ab5c198baa7a5ec337273 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 25 Aug 2011 16:58:27 +0200 Subject: [PATCH 042/190] Modifications needed for external parts to be able to use some WysiwygEditor things. External parts such as CentionTextView. --- .../WysiwygEditor/WysiwygEditor.feh | 19 +- .../Components/WysiwygEditor/WysiwygEditor.js | 322 +++++++++--------- 2 files changed, 172 insertions(+), 169 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh index 4982efe..4da5cc3 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh @@ -2,11 +2,14 @@ namespace modifies GUIKit { class CWysiwygEditor extends GUIKit.AbstractComponent { array _languages; string _selectedLanguage; - function setLanguages( array languages ) { - ._languages = languages; + function setLanguages( array items ) { + ._languages = items; } - function setSelectedLanguage( string language ) { - ._selectedLanguage = language; + function setSelectedLanguage( number selected ) { + ._selectedLanguage = '' + selected; + } + function setSelectedLanguage( string selected ) { + ._selectedLanguage = selected; } function render() { if( .visible() ) { @@ -15,10 +18,12 @@ namespace modifies GUIKit { string path = component.pathForComponentResource('WysiwygEditor.template'); array languages = []; ._languages.each() using ( item ) { + string label = (item.keyExists('TextValue') ? item['TextValue'] : (item.keyExists('value') ? item['value'] : '')); + string language = '' + (item.keyExists('ID') ? item['ID'] : (item.keyExists('id') ? item['id'] : '')); languages[] = [ - 'label' => item['label'], - 'language' => item['language'], - 'selected' => (._selectedLanguage == item['language'] ? true : false) + 'label' => label, + 'language' => language, + 'selected' => (._selectedLanguage == language ? true : false) ]; }; values['Languages'] = JSON.valueToJSON(languages); diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 99302d9..bf4f305 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -246,6 +246,126 @@ var WysiwygEditor = { onclick(); }; }); + }, + ContextMenu: { + editor: null, + element: null, + _previousGroup: null, + _onHideCallbacks: [], + _createElement: function() { + if( this.element == null ) { + this.element = WysiwygEditor.createElement('div', function( div ) { + div.className = 'WysiwygEditorContextMenu'; + div.appendChild(WysiwygEditor.createTable()); + Element.hide(div); + }); + document.body.appendChild(this.element); + } + }, + show: function( x, y ) { + this._createElement(); + this.element.style.left = x + 'px'; + this.element.style.top = y + 'px'; + Element.show(this.element); + }, + hide: function() { + this._createElement(); + Element.hide(this.element); + this._onHideCallbacks.each(function(callback) { + callback(); + }); + }, + onHide: function( callback ) { + this._onHideCallbacks.push(callback); + }, + clear: function() { + this._createElement(); + if( this.element && this.element.firstChild && this.element.firstChild.firstChild ) { + while( this.element.firstChild.firstChild.hasChildNodes() ) { + // Yes that is right, I'm not kidding, 3 firstChild in a row + this.element.firstChild.firstChild.removeChild(this.element.firstChild.firstChild.firstChild); + } + } + this._onHideCallbacks = []; + }, + hasItems: function() { + this._createElement(); + if( this.element && this.element.firstChild && this.element.firstChild.firstChild ) + return this.element.firstChild.firstChild.hasChildNodes(); + return false; + }, + addGroup: function( creator ) { + var group = { + editor: null, + element: null, + addMenu: function( label, creator ) { + var menu = Object.clone(WysiwygEditor.ContextMenu); + menu.editor = this.editor; + if( creator ) { + creator(menu); + } + var captured_this = this; + this.addItem('', label, function(e, item) { + var itemViewportOffset = Element.viewportOffset(item); + var itemWidth = Element.getWidth(item); + var x = itemViewportOffset.left + itemWidth + 4 /* 4 is a good number I promise */; + var y = itemViewportOffset.top; + menu._createElement(); + menu.element.style.left = x + 'px'; + menu.element.style.top = y + 'px'; + Element.show(menu.element); + captured_this.editor.contextMenu.onHide(function() { + menu.hide(); + }); + }); + return menu; + }, + addItem: function( icon, label, callback ) { + var captured_this = this; + WysiwygEditor.createTableRow(this.element, function( row ) { + row.onclick = function( event ) { + callback(captured_this.editor, row); + CancelEvent((event ? event : window.event)); + return false; + }; + WysiwygEditor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemLeft'; + if( icon ) { + column.appendChild(WysiwygEditor.createElement('img', function( image ) { + image.src = icon; + })); + } + }); + WysiwygEditor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemRight'; + column.innerHTML = label; + }); + }); + }, + end: function() { + WysiwygEditor.createTableRow(this.element, function( row ) { + row.className = 'WysiwygEditorContextMenuGroupEnd'; + WysiwygEditor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemLeft'; + }); + WysiwygEditor.createTableColumn(row, function( column ) { + column.className = 'WysiwygEditorContextMenuItemRight'; + }); + }); + } + }; + if( this._previousGroup ) { + this._previousGroup.end(); + } + group.editor = this.editor; + this._createElement(); + group.element = this.element.firstChild.firstChild; + if( creator ) { + creator(group); + } + this._previousGroup = group; + return group; + } } }; @@ -360,172 +480,41 @@ function WysiwygEditorObject() { // Yes I tried different combinations of addEventListener(). // I'm sure there is some way to get it to work nicely but I'm low on time so this is how // it will stay implemented for now. // Tobias 2011-08-24 + var oncontextmenu = function( event ) { + self.latestSelection = rangy.getIframeSelection(self.iframe); + self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + var editorEvent = { + showBrowserContextMenu: true, + mouseCursorPositionX: 0, + mouseCursorPositionY: 0 + }; + if( event.pageX || event.pageY ) { + var offset = Element.cumulativeOffset(self.iframe); + editorEvent.mouseCursorPositionX = event.pageX + offset.left; + editorEvent.mouseCursorPositionY = event.pageY + offset.top; + } else if( event.clientX || event.clientY ) { + var offset = Element.cumulativeOffset(self.iframe); + editorEvent.mouseCursorPositionX = event.clientX + offset.left; + editorEvent.mouseCursorPositionY = event.clientY + offset.top; + } + self.fireEvent('rightclick', editorEvent); + if( editorEvent.showBrowserContextMenu == false ) { + CancelEvent(event); + } + return editorEvent.showBrowserContextMenu; + }; if( Prototype.Browser.IE ) { self.contentElement.attachEvent('oncontextmenu', function( event ) { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); - var editorEvent = { - showBrowserContextMenu: true, - mouseCursorPositionX: 0, - mouseCursorPositionY: 0 - }; - if( event.pageX || event.pageY ) { - var offset = Element.cumulativeOffset(self.iframe); - editorEvent.mouseCursorPositionX = event.pageX + offset.left; - editorEvent.mouseCursorPositionY = event.pageY + offset.top; - } else if( event.clientX || event.clientY ) { - var offset = Element.cumulativeOffset(self.iframe); - editorEvent.mouseCursorPositionX = event.clientX + offset.left; - editorEvent.mouseCursorPositionY = event.clientY + offset.top; - } - self.fireEvent('rightclick', editorEvent); - if( editorEvent.showBrowserContextMenu == false ) { - CancelEvent(event); - } - return editorEvent.showBrowserContextMenu; + return oncontextmenu(event); }); } else { self.contentElement.oncontextmenu = function( event ) { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); - var editorEvent = { - showBrowserContextMenu: true, - mouseCursorPositionX: 0, - mouseCursorPositionY: 0 - }; - if( event.pageX || event.pageY ) { - var offset = Element.cumulativeOffset(self.iframe); - editorEvent.mouseCursorPositionX = event.pageX + offset.left; - editorEvent.mouseCursorPositionY = event.pageY + offset.top; - } else if( event.clientX || event.clientY ) { - var offset = Element.cumulativeOffset(self.iframe); - editorEvent.mouseCursorPositionX = event.clientX + offset.left; - editorEvent.mouseCursorPositionY = event.clientY + offset.top; - } - self.fireEvent('rightclick', editorEvent); - if( editorEvent.showBrowserContextMenu == false ) { - CancelEvent(event); - } - return editorEvent.showBrowserContextMenu; + return oncontextmenu(event); }; } - var ContextMenu = { - element: null, - _previousGroup: null, - _onHideCallbacks: [], - _createElement: function() { - if( this.element == null ) { - this.element = WysiwygEditor.createElement('div', function( div ) { - div.className = 'WysiwygEditorContextMenu'; - div.appendChild(WysiwygEditor.createTable()); - Element.hide(div); - }); - document.body.appendChild(this.element); - } - }, - show: function( x, y ) { - this._createElement(); - this.element.style.left = x + 'px'; - this.element.style.top = y + 'px'; - Element.show(this.element); - }, - hide: function() { - this._createElement(); - Element.hide(this.element); - this._onHideCallbacks.each(function(callback) { - callback(); - }); - }, - onHide: function( callback ) { - this._onHideCallbacks.push(callback); - }, - clear: function() { - this._createElement(); - if( this.element && this.element.firstChild && this.element.firstChild.firstChild ) { - while( this.element.firstChild.firstChild.hasChildNodes() ) { - // Yes that is right, I'm not kidding, 3 firstChild in a row - this.element.firstChild.firstChild.removeChild(this.element.firstChild.firstChild.firstChild); - } - } - this._onHideCallbacks = []; - }, - hasItems: function() { - this._createElement(); - if( this.element && this.element.firstChild && this.element.firstChild.firstChild ) - return this.element.firstChild.firstChild.hasChildNodes(); - return false; - }, - addGroup: function( creator ) { - var group = { - element: null, - addMenu: function( label, creator ) { - var menu = Object.clone(ContextMenu); - if( creator ) { - creator(menu); - } - this.addItem('', label, function(e, item) { - var itemViewportOffset = Element.viewportOffset(item); - var itemWidth = Element.getWidth(item); - var x = itemViewportOffset.left + itemWidth + 4 /* 4 is a good number I promise */; - var y = itemViewportOffset.top; - menu._createElement(); - menu.element.style.left = x + 'px'; - menu.element.style.top = y + 'px'; - Element.show(menu.element); - e.contextMenu.onHide(function() { - menu.hide(); - }); - }); - return menu; - }, - addItem: function( icon, label, callback ) { - WysiwygEditor.createTableRow(this.element, function( row ) { - row.onclick = function( event ) { - callback(self, row); // self = current instance of editor - CancelEvent((event ? event : window.event)); - return false; - }; - WysiwygEditor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemLeft'; - if( icon ) { - column.appendChild(WysiwygEditor.createElement('img', function( image ) { - image.src = icon; - })); - } - }); - WysiwygEditor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemRight'; - column.innerHTML = label; - }); - }); - }, - end: function() { - WysiwygEditor.createTableRow(this.element, function( row ) { - row.className = 'WysiwygEditorContextMenuGroupEnd'; - WysiwygEditor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemLeft'; - }); - WysiwygEditor.createTableColumn(row, function( column ) { - column.className = 'WysiwygEditorContextMenuItemRight'; - }); - }); - } - }; - if( this._previousGroup ) { - this._previousGroup.end(); - } - this._createElement(); - group.element = this.element.firstChild.firstChild; - if( creator ) { - creator(group); - } - this._previousGroup = group; - return group; - } - }; - - self.contextMenu = Object.clone(ContextMenu); + self.contextMenu = Object.clone(WysiwygEditor.ContextMenu); + self.contextMenu.editor = self; self.onEvent('rightclick', function( event ) { event.editor.contextMenu.clear(); @@ -1251,12 +1240,12 @@ function WysiwygEditorSpellCheckSetup( editor ) { }, check: function( element ) { var wordNodes = new Array(); - var node = element.firstChild; while( node ) { if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { node.className = ''; wordNodes.push(node); + //alert(node.innerHTML); } else if( node.nodeType == 3 ) { wordNodes.push(node); } @@ -1267,6 +1256,10 @@ function WysiwygEditorSpellCheckSetup( editor ) { node = node.nextSibling; } else { for( node = node.parentNode; node; node = node.parentNode ) { + if( node == element ) { + node = null; + break; + } if( node.nextSibling ) { node = node.nextSibling; break; @@ -1283,7 +1276,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { } var captured_this = this; - mcam.fireCallbackRequest('wysiwyg_editor_spell_check_perform', function( value ) { + mcam.fireCallbackRequest('spell_check_perform', function( value ) { var data = JSON.parse(value); var i; var j; @@ -1304,7 +1297,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { } }, { words: this.list, language: this.language }); }, - finish: function( node ) { + finish: function( element ) { var i; for( i = 0; i < this.list.length; i++ ) { @@ -1314,6 +1307,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { var nodes = new Array(); + var node = element; while( node ) { if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { nodes.push(node); @@ -1324,6 +1318,10 @@ function WysiwygEditorSpellCheckSetup( editor ) { node = node.nextSibling; } else { for( node = node.parentNode; node; node = node.parentNode ) { + if( node == element ) { + node = null; + break; + } if( node.nextSibling ) { node = node.nextSibling; break; @@ -1358,7 +1356,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { learn: function( word ) { if( this.words[word] ) { - mcam.fireCallbackRequest('WysiwygEditorSpellCheckLearnWord', null, { word: word, language: this.language }); + mcam.fireCallbackRequest('spell_check_learn_word', null, { word: word, language: this.language }); this.ignore(word); } }, From 540c04686fa5878023d9328ff79c39d1c8e20c3c Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Fri, 26 Aug 2011 10:48:46 +0200 Subject: [PATCH 043/190] Fix placement bug in submenus in the context menu for WysiwygEditor. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index bf4f305..67b8a12 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -306,10 +306,10 @@ var WysiwygEditor = { } var captured_this = this; this.addItem('', label, function(e, item) { - var itemViewportOffset = Element.viewportOffset(item); + var itemCumulativeOffset = Element.cumulativeOffset(item); var itemWidth = Element.getWidth(item); - var x = itemViewportOffset.left + itemWidth + 4 /* 4 is a good number I promise */; - var y = itemViewportOffset.top; + var x = itemCumulativeOffset.left + itemWidth + 4 /* 4 is a good number I promise */; + var y = itemCumulativeOffset.top; menu._createElement(); menu.element.style.left = x + 'px'; menu.element.style.top = y + 'px'; From 4a0cf3da2e35a749dfe01e4278e4dcc2886f94e1 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Fri, 26 Aug 2011 17:11:14 +0200 Subject: [PATCH 044/190] Make WysiwygEditor component behave more like a real TextView component. Also added support for displaying the toolbar items on two rows. --- .../Support/Components/WysiwygEditor/Core.feh | 2 +- .../WysiwygEditor/WysiwygEditor.feh | 7 +- .../Components/WysiwygEditor/WysiwygEditor.js | 166 ++++++++++++++++-- .../WysiwygEditor/WysiwygEditor.template | 13 +- 4 files changed, 163 insertions(+), 25 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/Core.feh b/Public/Support/Components/WysiwygEditor/Core.feh index d8bf5fb..eb9a856 100644 --- a/Public/Support/Components/WysiwygEditor/Core.feh +++ b/Public/Support/Components/WysiwygEditor/Core.feh @@ -1 +1 @@ -GUIKit.Component.register( 'WysiwygEditor', [ 'Component' ], 'GUIKit.CWysiwygEditor' ); +GUIKit.Component.register( 'WysiwygEditor', [ 'Textfield' ], 'GUIKit.CWysiwygEditor' ); diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh index 4da5cc3..18bf624 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh @@ -1,7 +1,10 @@ namespace modifies GUIKit { - class CWysiwygEditor extends GUIKit.AbstractComponent { + class CWysiwygEditor extends GUIKit.CTextfield { + [attribute boolean twoRowToolbar false 'Whether toolbar items should be on two rows']; + array _languages; string _selectedLanguage; + function setLanguages( array items ) { ._languages = items; } @@ -11,6 +14,7 @@ namespace modifies GUIKit { function setSelectedLanguage( string selected ) { ._selectedLanguage = selected; } + function render() { if( .visible() ) { array values = .generateTemplateAttributes('wfWysiwygEditor'); @@ -27,6 +31,7 @@ namespace modifies GUIKit { ]; }; values['Languages'] = JSON.valueToJSON(languages); + values['JavascriptSafeTextValue'] = JSON.escape(values['TextValue']); return GUIKit.ViewTemplate.renderPath(path, values); } } diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 67b8a12..536f300 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -377,6 +377,7 @@ function WysiwygEditorObject() { self.contentElement = null; self.eventCallbacks = {}; self.contextMenu = null; + self.twoRowToolbar = false; self.languages = []; self.onEvent = function( type, callback ) { if( self.eventCallbacks[type] == undefined ) @@ -408,6 +409,9 @@ function WysiwygEditorObject() { container = container.parentNode; return container; }; + self.setTwoRowToolbar = function( value ) { + self.twoRowToolbar = value; + }; self.setLanguages = function( list ) { self.languages = list; }; @@ -422,11 +426,11 @@ function WysiwygEditorObject() { }; self.init = function( textareaName ) { setTimeout(function() { - var textarea = document.getElementById(textareaName); + //var textarea = document.getElementById(textareaName); - self.iframe = document.getElementById(textareaName + '.IFrame'); - self.iframe.style.width = (textarea.offsetWidth > 0 ? textarea.offsetWidth + 'px' : '200px'); - self.iframe.style.height = (textarea.offsetHeight > 0 ? textarea.offsetHeight + 'px' : '200px'); + self.iframe = document.getElementById(textareaName); + //self.iframe.style.width = (textarea.offsetWidth > 0 ? textarea.offsetWidth + 'px' : '200px'); + //self.iframe.style.height = (textarea.offsetHeight > 0 ? textarea.offsetHeight + 'px' : '200px'); self.iframe.className = 'WysiwygEditor'; self.iframeWindow = (self.iframe.contentDocument ? self.iframe.contentDocument.defaultView : self.iframe.contentWindow); @@ -454,11 +458,11 @@ function WysiwygEditorObject() { self.contentElement.style.margin = '0px'; self.contentElement.contentEditable = true; self.contentElement.hideFocus = true; - self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; - self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; + //self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; + //self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; - Element.hide(textarea); - Element.show(self.iframe); + //Element.hide(textarea); + //Element.show(self.iframe); self.contentElement.onmouseup = function() { self.latestSelection = rangy.getIframeSelection(self.iframe); @@ -540,16 +544,29 @@ function WysiwygEditorObject() { WysiwygEditorSpellCheckSetup(self); var toolbar = document.createElement('table'); - var tbody = document.createElement('tbody'); - var row = document.createElement('tr'); - var lastColumn = document.createElement('td'); + var toolbar_tbody = document.createElement('tbody'); + var toolbar_row = document.createElement('tr'); + var toolbar_column = document.createElement('td'); toolbar.id = textareaName + '.WysiwygEditorToolbar'; - toolbar.style.width = (textarea.offsetWidth + 12) + 'px'; + //toolbar.style.width = (textarea.offsetWidth + 12) + 'px'; toolbar.className = 'WysiwygEditorToolbar'; toolbar.setAttribute('cellpadding', 0); toolbar.setAttribute('cellspacing', 0); - toolbar.appendChild(tbody); - tbody.appendChild(row); + toolbar.appendChild(toolbar_tbody); + toolbar_tbody.appendChild(toolbar_row); + toolbar_row.appendChild(toolbar_column); + + var row_table = document.createElement('table'); + row_table.setAttribute('cellpadding', 0); + row_table.setAttribute('cellspacing', 0); + var row_tbody = document.createElement('tbody'); + var row = document.createElement('tr'); + row_table.appendChild(row_tbody); + row_tbody.appendChild(row); + + var lastColumn = document.createElement('td'); + + toolbar_column.appendChild(row_table); WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorBoldToolbarItem(self, group); @@ -578,6 +595,26 @@ function WysiwygEditorObject() { WysiwygEditorHorizontalLineToolbarItem(self, group); }); WysiwygEditorFontToolbarDropDown(self, row); + if( self.twoRowToolbar ) { + lastColumn.style.width = '100%'; + row.appendChild(lastColumn); + + row_table = document.createElement('table'); + row_table.setAttribute('cellpadding', 0); + row_table.setAttribute('cellspacing', 0); + row_tbody = document.createElement('tbody'); + row = document.createElement('tr'); + row_table.appendChild(row_tbody); + row_tbody.appendChild(row); + + toolbar_row = document.createElement('tr'); + toolbar_tbody.appendChild(toolbar_row); + toolbar_column = document.createElement('td'); + toolbar_row.appendChild(toolbar_column); + toolbar_column.appendChild(row_table); + + lastColumn = document.createElement('td'); + } WysiwygEditorFontSizeToolbarDropDown(self, row); WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Components/WysiwygEditor/textcolor.png'), 'forecolor'); @@ -591,7 +628,8 @@ function WysiwygEditorObject() { lastColumn.style.width = '100%'; row.appendChild(lastColumn); - textarea.parentNode.insertBefore(toolbar, self.iframe); + //textarea.parentNode.insertBefore(toolbar, self.iframe); + self.iframe.parentNode.insertBefore(toolbar, self.iframe); setTimeout(function() { if( Element.getWidth(toolbar) > Element.getWidth(self.iframe) ) { @@ -599,8 +637,21 @@ function WysiwygEditorObject() { self.iframeDocument.body.style.width = self.iframe.style.width; } }, 100); + + self.fireEvent('loaded'); }, 100); }; + self.setData = function( data ) { + if( self.contentElement ) { + self.contentElement.innerHTML = data; + } + }; + self.getData = function() { + if( self.contentElement ) { + return self.contentElement.innerHTML; + } + return ''; + }; } function WysiwygEditorBoldToolbarItem( editor, group ) { @@ -1090,7 +1141,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { [ "#9900cc", "#9933cc", "#9966cc", "#9999cc", "#99cccc", "#99ffcc", "#cc00cc", "#cc33cc", "#cc66cc", "#cc99cc", "#cccccc", "#ccffcc", "#ff00cc", "#ff33cc", "#ff66cc", "#ff99cc", "#ffcccc", "#ffffcc" ], [ "#9900ff", "#9933ff", "#9966ff", "#9999ff", "#99ccff", "#99ffff", "#cc00ff", "#cc33ff", "#cc66ff", "#cc99ff", "#ccccff", "#ccffff", "#ff00ff", "#ff33ff", "#ff66ff", "#ff99ff", "#ffccff", "#ffffff" ] ]; - var colorsTable = editor.createTable(function( table, tbody ) { + var colorsTable = WysiwygEditor.createTable(function( table, tbody ) { //table.style.width = '100%'; colors.each(function(colorRow) { WysiwygEditor.createTableRow(tbody, function( row ) { @@ -1114,7 +1165,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { }); }); var moreColorsPreview = null; - var moreColorsPreviewTable = editor.createTable(function( table, tbody ) { + var moreColorsPreviewTable = WysiwygEditor.createTable(function( table, tbody ) { table.style.width = '100%'; table.style.marginTop = '1px'; table.style.marginBottom = '3px'; @@ -1129,7 +1180,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { }); }); }); - var moreColorsTable = editor.createTable(function( table, tbody ) { + var moreColorsTable = WysiwygEditor.createTable(function( table, tbody ) { table.style.margin = '2px'; table.style.display = 'none'; //table.style.border = '1px solid #999'; @@ -1532,3 +1583,82 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { Element.hide(finish_button); } +function ComponentWyiswygEditor( id ) { + var self = ComponentTextfield(id); + + //self.setDefaultState('text-value'); + //self.setState('text-value', ''); + + self._editor = new WysiwygEditorObject(); + + self.setLanguages = function( languages ) { + self._editor.setLanguages(languages); + }; + self.setTwoRowToolbar = function( value ) { + self._editor.setTwoRowToolbar(value); + }; + + self.editorNode = function() { + return document.getElementById(self.identifier() + '.IFrame'); + }; + self.toolbarNode = function() { + return document.getElementById(self.identifier() + '.WysiwygEditorToolbar'); + }; + + self.show = function() { + if( self.editorNode() ) { + Element.show(self.editorNode()); + } + if( self.editorNode() ) { + Element.show(self.editorNode()); + } + } + self.hide = function() { + if( self.editorNode() ) { + Element.hide(self.editorNode()); + } + if( self.editorNode() ) { + Element.hide(self.editorNode()); + } + } + self.focus = function() { + if( self._editor.contentElement && self._editor.contentElement.focus ) { + self._editor.contentElement.focus(); + return true; + } + return false; + }; + self.blur = function() { + if( self._editor.contentElement && self._editor.contentElement.blur ) { + self._editor.contentElement.blur(); + return true; + } + return false; + }; + + var previousUpdateVisual = self.updateVisual; + self.updateVisual = function() { + if( self.getState('text-value') ) { + self._editor.setData(self.getState('text-value')); + } + previousUpdateVisual(); + }; + self.updateFormValue = function() { + self._editor.setData(self.formValue()); + self.node().value = self.formValue(); + } + var previousActivate = self.activate; + self.activate = function() { + self._editor.init(self.identifier() + '.IFrame'); + self._editor.onEvent('loaded', function() { + self.updateVisual(); + }); + registerSubmitFunction(function() { + self.node().value = self._editor.getData(); + }); + previousActivate(); + }; + + return self; +} + diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template index 6bc2374..d123abb 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template @@ -1,8 +1,11 @@ - - + + + From 3431f91dbfac4fb03d28d6f0e87cc4c14501c8be Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 30 Aug 2011 10:09:05 +0200 Subject: [PATCH 045/190] Fix some issues in the WysiwygEditor component. --- .../Components/WysiwygEditor/WysiwygEditor.js | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 536f300..e5d7ae4 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -86,7 +86,6 @@ var WysiwygEditor = { group.items++; if( onselectionchange ) { editor.onEvent('selectionchange', function( event ) { - //var container = null;//event.editor.selectionContainer(); var container = event.editor.latestSelectionContainer(); var active = onselectionchange(event.editor, item, container); if( item.active != active ) { @@ -428,7 +427,7 @@ function WysiwygEditorObject() { setTimeout(function() { //var textarea = document.getElementById(textareaName); - self.iframe = document.getElementById(textareaName); + self.iframe = document.getElementById(textareaName + '.IFrame'); //self.iframe.style.width = (textarea.offsetWidth > 0 ? textarea.offsetWidth + 'px' : '200px'); //self.iframe.style.height = (textarea.offsetHeight > 0 ? textarea.offsetHeight + 'px' : '200px'); self.iframe.className = 'WysiwygEditor'; @@ -458,6 +457,8 @@ function WysiwygEditorObject() { self.contentElement.style.margin = '0px'; self.contentElement.contentEditable = true; self.contentElement.hideFocus = true; + self.contentElement.style.width = self.iframe.style.width; + self.contentElement.style.height = self.iframe.style.height; //self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; //self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; @@ -474,6 +475,7 @@ function WysiwygEditorObject() { self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); self.fireEvent('selectionchange'); self.fireEvent('keyup'); + self.fireEvent('change'); }; // If you are looking at this and thinking: @@ -548,7 +550,7 @@ function WysiwygEditorObject() { var toolbar_row = document.createElement('tr'); var toolbar_column = document.createElement('td'); toolbar.id = textareaName + '.WysiwygEditorToolbar'; - //toolbar.style.width = (textarea.offsetWidth + 12) + 'px'; + toolbar.style.width = self.iframe.style.width; toolbar.className = 'WysiwygEditorToolbar'; toolbar.setAttribute('cellpadding', 0); toolbar.setAttribute('cellspacing', 0); @@ -628,15 +630,15 @@ function WysiwygEditorObject() { lastColumn.style.width = '100%'; row.appendChild(lastColumn); - //textarea.parentNode.insertBefore(toolbar, self.iframe); self.iframe.parentNode.insertBefore(toolbar, self.iframe); + toolbar.style.display = self.iframe.style.display; - setTimeout(function() { + /*setTimeout(function() { if( Element.getWidth(toolbar) > Element.getWidth(self.iframe) ) { self.iframe.style.width = Element.getWidth(toolbar) + 'px'; self.iframeDocument.body.style.width = self.iframe.style.width; } - }, 100); + }, 100);*/ self.fireEvent('loaded'); }, 100); @@ -652,6 +654,16 @@ function WysiwygEditorObject() { } return ''; }; + self.enableEditableContent = function() { + if( self.contentElement ) { + self.contentElement.contentEditable = true; + } + }; + self.disableEditableContent = function() { + if( self.contentElement ) { + self.contentElement.contentEditable = false; + } + }; } function WysiwygEditorBoldToolbarItem( editor, group ) { @@ -1018,9 +1030,11 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { WysiwygEditor.addItemPopupFooterButton(footer, 'Save', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_save.png', '#96D754', function() { if( editor.linkSelectedContainer ) { editor.linkSelectedContainer.href = editor.linkTextfieldURL.value; + editor.fireEvent('change'); } else if( editor.linkSelectedText ) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('createLink', false, editor.linkTextfieldURL.value); + editor.fireEvent('change'); } else { var node = editor.createElement('a', function( a ) { a.href = editor.linkTextfieldURL.value; @@ -1032,6 +1046,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { range.insertNode(node); range.collapseAfter(node); selection.setSingleRange(range); + editor.fireEvent('change'); } Element.hide(div); item.className = 'WysiwygEditorToolbarItem'; @@ -1559,6 +1574,7 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { mainSuggestionsGroup.addItem(uriForServerImageResource('Components/WysiwygEditor/replace.png'), suggestion, function(e, i) { Element.replace(container, suggestion); e.contextMenu.hide(); + e.fireEvent('change'); }); mainSuggestions++; } else { @@ -1572,6 +1588,7 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { moreSuggestionsGroup.addItem(uriForServerImageResource('Components/WysiwygEditor/replace.png'), suggestion, function(e, i) { Element.replace(container, suggestion); e.contextMenu.hide(); + e.fireEvent('change'); }); } }); @@ -1586,9 +1603,6 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { function ComponentWyiswygEditor( id ) { var self = ComponentTextfield(id); - //self.setDefaultState('text-value'); - //self.setState('text-value', ''); - self._editor = new WysiwygEditorObject(); self.setLanguages = function( languages ) { @@ -1608,17 +1622,21 @@ function ComponentWyiswygEditor( id ) { self.show = function() { if( self.editorNode() ) { Element.show(self.editorNode()); + // Workaround for bug in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) + self._editor.enableEditableContent(); } - if( self.editorNode() ) { - Element.show(self.editorNode()); + if( self.toolbarNode() ) { + Element.show(self.toolbarNode()); } } self.hide = function() { if( self.editorNode() ) { Element.hide(self.editorNode()); + // Workaround for bug in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) + self._editor.disableEditableContent(); } - if( self.editorNode() ) { - Element.hide(self.editorNode()); + if( self.toolbarNode() ) { + Element.hide(self.toolbarNode()); } } self.focus = function() { @@ -1649,10 +1667,18 @@ function ComponentWyiswygEditor( id ) { } var previousActivate = self.activate; self.activate = function() { - self._editor.init(self.identifier() + '.IFrame'); + self._editor.init(self.identifier()); self._editor.onEvent('loaded', function() { self.updateVisual(); }); + self._editor.onEvent('change', function() { + // We do not want updateVisual() to be called evey time this happens + // so we set the value directly in the _states list instead of calling + // setState(). + // Calling updateVisual() sets the value in the editor again which + // causes cursor to change position to the beginning of the document. + self._states['text-value'] = self._editor.getData(); + }); registerSubmitFunction(function() { self.node().value = self._editor.getData(); }); From befee04115ecde8dfaaa8e65e50fe7981afa8e0b Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 30 Aug 2011 15:55:56 +0200 Subject: [PATCH 046/190] Some clean ups and other small things. --- .../Components/WysiwygEditor/WysiwygEditor.js | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index e5d7ae4..cd46da4 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -437,7 +437,7 @@ function WysiwygEditorObject() { if( self.iframeDocument.document ) { self.iframeDocument = self.iframeDocument.document; } - + if( Prototype.Browser.IE ) { self.iframeDocument.open(); self.iframeDocument.write('' + @@ -452,6 +452,10 @@ function WysiwygEditorObject() { self.iframeDocument.close(); } + // Tobias 2011-08-30: This is here as a reminder that there might + // be old web browsers that needs to use this instead of contentEditable. + //self.iframeDocument.designMode = 'on'; + self.contentElement = self.iframeDocument.body; self.contentElement.style.padding = '0px'; self.contentElement.style.margin = '0px'; @@ -459,11 +463,6 @@ function WysiwygEditorObject() { self.contentElement.hideFocus = true; self.contentElement.style.width = self.iframe.style.width; self.contentElement.style.height = self.iframe.style.height; - //self.contentElement.style.width = ((textarea.offsetWidth > 0 ? textarea.offsetWidth : 200) - 1) + 'px';; - //self.contentElement.style.height = ((textarea.offsetHeight > 0 ? textarea.offsetHeight : 200) - 1) + 'px';; - - //Element.hide(textarea); - //Element.show(self.iframe); self.contentElement.onmouseup = function() { self.latestSelection = rangy.getIframeSelection(self.iframe); @@ -478,14 +477,6 @@ function WysiwygEditorObject() { self.fireEvent('change'); }; - // If you are looking at this and thinking: - // "WHAT WAS THIS PERSON THINKING. IT COULD HAVE BEEN SO EASY TO AVOID DUPLICATING THE EVENT CODE". - // Well then let me tell you a story about a browser engine called WebKit. - // IT IS STUPID. End of story. - // If you passed in the function as a variable the browser context menu was not suppressed. - // Yes I tried different combinations of addEventListener(). - // I'm sure there is some way to get it to work nicely but I'm low on time so this is how - // it will stay implemented for now. // Tobias 2011-08-24 var oncontextmenu = function( event ) { self.latestSelection = rangy.getIframeSelection(self.iframe); self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); @@ -641,7 +632,7 @@ function WysiwygEditorObject() { }, 100);*/ self.fireEvent('loaded'); - }, 100); + }, 0); }; self.setData = function( data ) { if( self.contentElement ) { @@ -1311,7 +1302,6 @@ function WysiwygEditorSpellCheckSetup( editor ) { if( (node.nodeType == 1) && (node.className == 'wysiwyg-spell-check-word') ) { node.className = ''; wordNodes.push(node); - //alert(node.innerHTML); } else if( node.nodeType == 3 ) { wordNodes.push(node); } @@ -1622,8 +1612,12 @@ function ComponentWyiswygEditor( id ) { self.show = function() { if( self.editorNode() ) { Element.show(self.editorNode()); - // Workaround for bug in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) - self._editor.enableEditableContent(); + // Workaround for bug in Firefox. + // (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) + // (https://bugzilla.mozilla.org/show_bug.cgi?id=504268) + setTimeout(function() { + self._editor.enableEditableContent(); + }, 100); } if( self.toolbarNode() ) { Element.show(self.toolbarNode()); @@ -1632,7 +1626,9 @@ function ComponentWyiswygEditor( id ) { self.hide = function() { if( self.editorNode() ) { Element.hide(self.editorNode()); - // Workaround for bug in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) + // Workaround for bug in Firefox. + // (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) + // (https://bugzilla.mozilla.org/show_bug.cgi?id=504268) self._editor.disableEditableContent(); } if( self.toolbarNode() ) { From ddf6f80b781157be66ec63380da9dc081f61b211 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 30 Aug 2011 15:56:06 +0200 Subject: [PATCH 047/190] Might be the most important fix ever. Oh how I do not like Firefox at the moment. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template index d123abb..d158b3b 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template @@ -1,4 +1,4 @@ - + From fce2b1b5d07e56bc2135876c7ca48bc8b906bff0 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 27 Sep 2011 18:53:43 +0200 Subject: [PATCH 052/190] Fix FS#2627 - Notifications: characters are shown funny. --- .../Components/WysiwygEditor/WysiwygEditor.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 5024701..e10a746 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -684,6 +684,7 @@ function WysiwygEditorBoldToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'bold', '', uriForServerImageResource('Components/WysiwygEditor/bold.png'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('bold', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -699,6 +700,7 @@ function WysiwygEditorItalicToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), false, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('italic', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -711,6 +713,7 @@ function WysiwygEditorUnderlineToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'underline', '', uriForServerImageResource('Components/WysiwygEditor/underline.png'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('underline', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -723,6 +726,7 @@ function WysiwygEditorStrikethroughToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'strikethrough', '', uriForServerImageResource('Components/WysiwygEditor/strikethrough.png'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('strikethrough', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -736,6 +740,7 @@ function WysiwygEditorOrderedListToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'ol', '', uriForServerImageResource('Components/WysiwygEditor/ol.png'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('insertorderedlist', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -757,6 +762,7 @@ function WysiwygEditorUnorderedListToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'ul', '', uriForServerImageResource('Components/WysiwygEditor/ul.png'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('insertunorderedlist', false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }, function( editor, item, container ) { @@ -779,12 +785,14 @@ function WysiwygEditorOutdentToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'outdent', '', uriForServerImageResource('Components/WysiwygEditor/outdent.png'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('outdent', false, false); + editor.fireEvent('change'); }); } function WysiwygEditorIndentToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'indent', '', uriForServerImageResource('Components/WysiwygEditor/indent.png'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('indent', false, false); + editor.fireEvent('change'); }); } @@ -796,6 +804,7 @@ function WysiwygEditorAddCommonJustifyFunction( editor ) { editor.previousJustifyItemClicked = item; editor.contentElement.focus(); editor.iframeDocument.execCommand(command, false, false); + editor.fireEvent('change'); item.active = (item.active ? false : true); item.className = (item.active ? 'WysiwygEditorToolbarItemActive' : 'WysiwygEditorToolbarItem'); }; @@ -841,6 +850,7 @@ function WysiwygEditorHorizontalLineToolbarItem( editor, group ) { WysiwygEditor.addToolbarItem(group, 'horizontalline', '', uriForServerImageResource('Components/WysiwygEditor/hr.png'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('inserthorizontalrule', false, false); + editor.fireEvent('change'); }); } @@ -862,6 +872,7 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { WysiwygEditor.addToolbarDropDown(toolbar, 'Font', 155, list, editor, function(item, itemLabel) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('fontname', false, item.font); + editor.fireEvent('change'); }, function( itemLabel ) { var container = editor.latestSelectionContainer(); if( container ) { @@ -911,6 +922,7 @@ function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { WysiwygEditor.addToolbarDropDown(toolbar, 'Size', 70, list, editor, function(item, itemLabel) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('FontSize', false, item.size); + editor.fireEvent('change'); }, function( itemLabel ) { var container = editor.latestSelectionContainer(); if( container ) { @@ -1299,6 +1311,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { Element.hide(editor.colorPopup); item.className = 'WysiwygEditorToolbarItem'; editor.colorSelectorSavedRange = null; + editor.fireEvent('change'); }; } }); From 7320efcfa7666e4850c715591c73e79511085cbc Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 29 Sep 2011 14:42:59 +0200 Subject: [PATCH 053/190] Fix for FS#2717 - Overview page - translate. --- Public/Support/Components/Table/Table.feh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Public/Support/Components/Table/Table.feh b/Public/Support/Components/Table/Table.feh index 9cbd8ca..c5174fa 100644 --- a/Public/Support/Components/Table/Table.feh +++ b/Public/Support/Components/Table/Table.feh @@ -110,8 +110,11 @@ namespace modifies GUIKit { } } + if( header.size.width ) { + style += "width:${header.size.width};"; + } if( header.disableWordWrap() ) { - style = 'white-space:nowrap;'; + style += 'white-space:nowrap;'; } style += header.style(); @@ -145,6 +148,7 @@ namespace modifies GUIKit { [attribute boolean sortable true 'Whether or not the table can be sorted']; [attribute boolean autoSort false 'Whether the table should automatically note a sort change after data update']; + [attribute boolean showHeader true 'Whether the table should show the header']; [attribute string defaultForegroundColour '#000' 'The default foreground colour for a table row']; [attribute string defaultBackgroundColour '#FFF' 'The default foreground colour for a table row']; @@ -168,7 +172,8 @@ namespace modifies GUIKit { column.setItemClass('CSimpleTableColumnItem'); column.setID(ID); column.setMap(map); - + column.setSorted(sorted); + column.setSecondarySort(secondarySort); .contents[] = id; return column; @@ -198,7 +203,8 @@ namespace modifies GUIKit { column.setID(ID); column.setMap(map); column.setWidth(width); - + column.setSorted(sorted); + column.setSecondarySort(secondarySort); .contents[] = id; return column; @@ -286,7 +292,7 @@ namespace modifies GUIKit { if( .source ) { array columnMap = []; - values['ColumnHeaders'] = .source.columnHeaders(); + values['ColumnHeaders'] = (.showHeader() ? .source.columnHeaders() : []); values['Rows'] = .source.rows(); .contents.each() using ( id ) { object column = Cache.components[id]; From 20065947781cf1dbb5d3bfdfa498aeeb5297224e Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 29 Sep 2011 15:21:42 +0200 Subject: [PATCH 054/190] Fix FS#2772 - Spell check - doesn't work. --- .../Components/WysiwygEditor/WysiwygEditor.js | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index e10a746..d6f74da 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -869,7 +869,7 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { { name: 'Trebuchet MS', label: 'Trebuchet MS', font: "'Trebuchet MS'" }, { name: 'Verdana', label: 'Verdana', font: "Verdana" } ]; - WysiwygEditor.addToolbarDropDown(toolbar, 'Font', 155, list, editor, function(item, itemLabel) { + WysiwygEditor.addToolbarDropDown(toolbar, I('Font'), 155, list, editor, function(item, itemLabel) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('fontname', false, item.font); editor.fireEvent('change'); @@ -902,9 +902,9 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { } } } - if( found == false && editor.previousSelectionFontFamily != 'Font' ) { - itemLabel.innerHTML = 'Font'; - editor.previousSelectionFontFamily = 'Font'; + if( found == false && editor.previousSelectionFontFamily != I('Font') ) { + itemLabel.innerHTML = I('Font'); + editor.previousSelectionFontFamily = I('Font'); } } }); @@ -919,7 +919,7 @@ function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { { name: '32', label: '32', size: '6' }, { name: '48', label: '48', size: '7' } ]; - WysiwygEditor.addToolbarDropDown(toolbar, 'Size', 70, list, editor, function(item, itemLabel) { + WysiwygEditor.addToolbarDropDown(toolbar, I('Size'), 70, list, editor, function(item, itemLabel) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('FontSize', false, item.size); editor.fireEvent('change'); @@ -954,9 +954,9 @@ function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { } } } - if( found == false && editor.previousSelectionFontSize != 'Size' ) { - itemLabel.innerHTML = 'Size'; - editor.previousSelectionFontSize = 'Size'; + if( found == false && editor.previousSelectionFontSize != I('Size') ) { + itemLabel.innerHTML = I('Size'); + editor.previousSelectionFontSize = I('Size'); } } }); @@ -978,7 +978,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { WysiwygEditor.createTableColumn(row, function( column ) { column.style.padding = '5px'; column.style.whiteSpace = 'nowrap'; - column.innerHTML = 'Text to display:'; + column.innerHTML = I('Text to display') + ':'; }); WysiwygEditor.createTableColumn(row, function( column ) { var input = document.createElement('input'); @@ -998,7 +998,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { column.appendChild(WysiwygEditor.createElement('div', function( div ) { div.style.width = '120px'; div.style.marginBottom = '2px'; - div.innerHTML = 'Link to:'; + div.innerHTML = I('Link to') + ':'; })); column.appendChild(WysiwygEditor.createElement('div', function( div ) { div.style.marginBottom = '2px'; @@ -1011,7 +1011,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { })); div.appendChild(document.createTextNode('\u00a0')); div.appendChild(WysiwygEditor.createElement('span', function( span ) { - span.innerHTML = 'Web address'; + span.innerHTML = I('Web address'); webAddressLabel = span; })); })); @@ -1025,7 +1025,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { })); div.appendChild(document.createTextNode('\u00a0')); div.appendChild(WysiwygEditor.createElement('span', function( span ) { - span.innerHTML = 'Email address'; + span.innerHTML = I('Email address'); emailAddressLabel = span; })); })); @@ -1036,7 +1036,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { column.appendChild(WysiwygEditor.createElement('div', function( div ) { div.style.fontWeight = 'bold'; div.style.marginBottom = '2px'; - div.innerHTML = 'To what URL should this link go?'; + div.innerHTML = I('To what URL should this link go?'); descriptionLabel = div; })); column.appendChild(WysiwygEditor.createElement('input', function( input ) { @@ -1053,7 +1053,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { div.style.width = '450px'; div.appendChild(table); div.appendChild(WysiwygEditor.createItemPopupFooter(function( footer ) { - WysiwygEditor.addItemPopupFooterButton(footer, 'Save', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_save.png', '#96D754', function() { + WysiwygEditor.addItemPopupFooterButton(footer, I('Save'), uriForApplicationImageResource('submit_save.png'), '#96D754', function() { if( editor.linkSelectedContainer ) { editor.linkSelectedContainer.href = editor.linkTextfieldURL.value; editor.fireEvent('change'); @@ -1062,7 +1062,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { editor.iframeDocument.execCommand('createLink', false, editor.linkTextfieldURL.value); editor.fireEvent('change'); } else { - var node = editor.createElement('a', function( a ) { + var node = WysiwygEditor.createElement('a', function( a ) { a.href = editor.linkTextfieldURL.value; a.innerHTML = editor.linkTextfieldText.value; }, editor.iframeDocument); @@ -1077,7 +1077,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { Element.hide(div); item.className = 'WysiwygEditorToolbarItem'; }); - WysiwygEditor.addItemPopupFooterButton(footer, 'Cancel', 'http://10.42.2.181/webframework/Cention.app/Resources/Images/submit_arrow_right.png', '#FCAB46', function() { + WysiwygEditor.addItemPopupFooterButton(footer, I('Cancel'), uriForApplicationImageResource('submit_arrow_right.png'), '#FCAB46', function() { Element.hide(div); item.className = 'WysiwygEditorToolbarItem'; }); @@ -1097,14 +1097,14 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { webAddressLabel.style.fontWeight = 'bold'; emailAddressRadioButton.checked = false; emailAddressLabel.style.fontWeight = 'normal'; - descriptionLabel.innerHTML = 'To what URL should this link go?'; + descriptionLabel.innerHTML = I('To what URL should this link go?'); }; emailAddressRadioButton.onclick = emailAddressLabel.onclick = function() { emailAddressRadioButton.checked = true; emailAddressLabel.style.fontWeight = 'bold'; webAddressRadioButton.checked = false; webAddressLabel.style.fontWeight = 'normal'; - descriptionLabel.innerHTML = 'To what email address should this link?'; + descriptionLabel.innerHTML = I('To what email address should this link?'); }; } if( Element.visible(editor.linkPopup) ) { @@ -1124,7 +1124,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { editor.linkWebAddressLabel.style.fontWeight = 'bold'; editor.linkEmailAddressRadioButton.checked = false; editor.linkEmailAddressLabel.style.fontWeight = 'normal'; - editor.linkDescriptionLabel = 'To what URL should this link go?'; + editor.linkDescriptionLabel = I('To what URL should this link go?'); editor.linkSelectedContainer = null; editor.linkTextfieldURL.value = ''; editor.linkTextfieldText.value = ''; @@ -1260,7 +1260,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { div.appendChild(colorsTable); div.appendChild(WysiwygEditor.createElement('div', function( div ) { div.className = 'WysiwygEditorMoreColorsButton'; - div.innerHTML = 'More Colors...'; + div.innerHTML = I('More Colors...'); div.align = 'center'; div.onmousedown = item.onselectstart = function() { return false; }; div.unselectable = true; @@ -1446,8 +1446,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { } }, learn: function( word ) { - if( this.words[word] ) - { + if( this.words[word] ) { mcam.fireCallbackRequest('spell_check_learn_word', null, { word: word, language: this.language }); this.ignore(word); } @@ -1546,7 +1545,7 @@ function WysiwygEditorSpellCheckSetup( editor ) { function WysiwygEditorSpellCheckLanguageDropDown( editor, toolbar ) { var list = editor.getLanguages(); var listLength = list.length - WysiwygEditor.addToolbarDropDown(toolbar, 'Language', 105, list, editor, function(item, itemLabel) { + WysiwygEditor.addToolbarDropDown(toolbar, I('Language'), 105, list, editor, function(item, itemLabel) { itemLabel.innerHTML = item.label; editor.spellcheck.setLanguage(item.language); }); @@ -1562,13 +1561,13 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { var check_button = null; var finish_button = null; var spell_check_mode = false; - check_button = WysiwygEditor.addToolbarItem(toolbar, 'spellcheck', 'Perform Spell Check', uriForServerImageResource('Components/WysiwygEditor/check.png'), false, editor, function( item ) { + check_button = WysiwygEditor.addToolbarItem(toolbar, 'spellcheck', I('Perform Spell Check'), uriForServerImageResource('Components/WysiwygEditor/check.png'), false, editor, function( item ) { Element.hide(check_button); Element.show(finish_button); spell_check_mode = true; editor.spellcheck.check(editor.contentElement); }); - finish_button = WysiwygEditor.addToolbarItem(toolbar, 'finishspellcheck', 'Finish Spell Check', uriForServerImageResource('Components/WysiwygEditor/done.png'), true, editor, function( item ) { + finish_button = WysiwygEditor.addToolbarItem(toolbar, 'finishspellcheck', I('Finish Spell Check'), uriForServerImageResource('Components/WysiwygEditor/done.png'), true, editor, function( item ) { Element.hide(finish_button); Element.show(check_button); spell_check_mode = false; @@ -1618,6 +1617,16 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { }); } }); + editor.contextMenu.addGroup(function(group) { + group.addItem(uriForServerImageResource('Components/WysiwygEditor/add.png'), I('Learn'), function(e, i) { + e.spellcheck.learn(word); + e.contextMenu.hide(); + }); + group.addItem(uriForServerImageResource('Components/WysiwygEditor/ignore.png'), I('Ignore'), function(e, i) { + e.spellcheck.ignore(word); + e.contextMenu.hide(); + }); + }); } } } From f627d8ff342f56c3f4936c12aa5599ce1eaff2f7 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 29 Sep 2011 15:36:58 +0200 Subject: [PATCH 055/190] Fix FS#2772 - Spell check - doesn't work. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index d6f74da..84c339c 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -1260,7 +1260,7 @@ function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { div.appendChild(colorsTable); div.appendChild(WysiwygEditor.createElement('div', function( div ) { div.className = 'WysiwygEditorMoreColorsButton'; - div.innerHTML = I('More Colors...'); + div.innerHTML = I('More Colours...'); div.align = 'center'; div.onmousedown = item.onselectstart = function() { return false; }; div.unselectable = true; @@ -1605,7 +1605,7 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { } else { if( ! moreSuggestionsGroup ) { editor.contextMenu.addGroup(function( group ) { - group.addMenu('More', function( menu ) { + group.addMenu(I('More'), function( menu ) { moreSuggestionsGroup = menu.addGroup(); }); }); @@ -1618,7 +1618,7 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { } }); editor.contextMenu.addGroup(function(group) { - group.addItem(uriForServerImageResource('Components/WysiwygEditor/add.png'), I('Learn'), function(e, i) { + group.addItem(uriForServerImageResource('Components/WysiwygEditor/add.png'), I('Add to word list'), function(e, i) { e.spellcheck.learn(word); e.contextMenu.hide(); }); From 70ce8721fde0e537de9795415ebea6e4d9ae1965 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 29 Sep 2011 18:55:31 +0200 Subject: [PATCH 056/190] Fix FS#2778 - Search errands - changes. --- .../Support/Components/Combobox/Combobox.css | 6 ++--- .../Support/Components/Combobox/Combobox.js | 4 +-- .../Support/Components/TextView/TextView.js | 27 ------------------- .../Support/Components/Textfield/Textfield.js | 13 ++++++++- .../Components/WysiwygEditor/WysiwygEditor.js | 19 +++++++++++++ 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/Public/Support/Components/Combobox/Combobox.css b/Public/Support/Components/Combobox/Combobox.css index f9c198a..ab424ff 100644 --- a/Public/Support/Components/Combobox/Combobox.css +++ b/Public/Support/Components/Combobox/Combobox.css @@ -12,9 +12,9 @@ .wfComboboxTextfieldDisabled { width: 100%; - border: 1px solid #cdcdcd; + border: 1px solid #ddd; cursor: text; - background-color: #cdcdcd; + background-color: #ddd; } .wfComboboxIcon { @@ -31,7 +31,7 @@ padding-left: 4px; padding-right: 4px; cursor: pointer; - background-color: #cdcdcd; + background-color: #ddd; } .wfComboboxList { diff --git a/Public/Support/Components/Combobox/Combobox.js b/Public/Support/Components/Combobox/Combobox.js index e1e66d4..553188a 100644 --- a/Public/Support/Components/Combobox/Combobox.js +++ b/Public/Support/Components/Combobox/Combobox.js @@ -8,13 +8,13 @@ function ComponentCombobox( id ) { self.enable = function() { self._enabled = true; - self.node().disabled = false; + self.node().removeAttribute('readonly'); self.node().className = 'wfComboboxTextfield'; self.iconNode.className = 'wfComboboxIcon'; }; self.disable = function() { self._enabled = false; - self.node().disabled = true; + self.node().setAttribute('readonly', 'true'); self.node().className = 'wfComboboxTextfieldDisabled'; self.iconNode.className = 'wfComboboxIconDisabled'; }; diff --git a/Public/Support/Components/TextView/TextView.js b/Public/Support/Components/TextView/TextView.js index 94935bc..4f98ccc 100644 --- a/Public/Support/Components/TextView/TextView.js +++ b/Public/Support/Components/TextView/TextView.js @@ -4,32 +4,5 @@ function ComponentTextView( id ) { self.rows = function() { return self.node().rows; }; self.columns = function() { return self.node().cols; }; - /* - self.focus = function() { - self.node().focus(); - }; - - self.updateFormValue = function() { - var value = self.formValue(); - self.node().value = value; - return self.formValue(); - }; - - self.textValue = function() { - var value = self.node().value; - self._states['text-value'] = value; - return value; - }; - - self.setTextValue = function( value ) { - self.setState('text-value', value); - self.node().value = value; - }; - - self.formValue = function() { - return self._states['text-value']; - }; - */ - return self; } diff --git a/Public/Support/Components/Textfield/Textfield.js b/Public/Support/Components/Textfield/Textfield.js index 408bf1d..c6c6c1b 100644 --- a/Public/Support/Components/Textfield/Textfield.js +++ b/Public/Support/Components/Textfield/Textfield.js @@ -21,5 +21,16 @@ function ComponentTextfield( id ) { self.setState('text-value', value); self.node().value = value; }; + self.enable = function() { + self._enabled = true; + self.node().removeAttribute('readonly'); + self.node().style.backgroundColor = (self.__previousBackgroundColor ? self.__previousBackgroundColor : '#fff'); + }; + self.disable = function() { + self._enabled = false; + self.node().setAttribute('readonly', 'true'); + self.__previousBackgroundColor = self.node().style.backgroundColor; + self.node().style.backgroundColor = '#ddd'; + }; return self; -} \ No newline at end of file +} diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 84c339c..121a1e8 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -1650,9 +1650,25 @@ function ComponentWyiswygEditor( id ) { self.setReadOnly = function( value ) { self._editor.setReadOnly(value); }; + self.enable = function() { + self._enabled = true; + self._editor.setReadOnly(true); + self._editor.enableEditableContent(); + }; + self.disable = function() { + self._enabled = false; + self._editor.setReadOnly(false); + self._editor.disableEditableContent(); + }; self.setShowToolbar = function( value ) { self._showToolbar = value; }; + self.showToolbar = function() { + Element.show(self.toolbarNode()); + }; + self.hideToolbar = function() { + Element.hide(self.toolbarNode()); + }; self.setTwoRowToolbar = function( value ) { self._editor.setTwoRowToolbar(value); }; @@ -1664,6 +1680,9 @@ function ComponentWyiswygEditor( id ) { return document.getElementById(self.identifier() + '.WysiwygEditorToolbar'); }; + self.visible = function() { + return Element.visible(self.editorNode()); + }; self.show = function() { if( self.editorNode() ) { Element.show(self.editorNode()); From f76ebb7668ca20f87b79c190b102773ab86e62db Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Fri, 30 Sep 2011 09:57:24 +0200 Subject: [PATCH 057/190] Modify so that .png images are also installed if components have them. --- farm.yard | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farm.yard b/farm.yard index 9111b3d..a43f0b9 100644 --- a/farm.yard +++ b/farm.yard @@ -21,7 +21,7 @@ - + From 45bc34620f5095d401eb8d3c5783c8885a0e0e5e Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 4 Oct 2011 13:46:08 +0200 Subject: [PATCH 058/190] Fix FS#2778 - Search errands - changes. --- .../Components/WysiwygEditor/WysiwygEditor.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 121a1e8..54ebdfa 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -1641,6 +1641,9 @@ function ComponentWyiswygEditor( id ) { self._editor = new WysiwygEditorObject(); self._showToolbar = true; + self.editor = function() { + return self._editor; + } self.setLanguages = function( languages ) { self._editor.setLanguages(languages); }; @@ -1652,12 +1655,12 @@ function ComponentWyiswygEditor( id ) { }; self.enable = function() { self._enabled = true; - self._editor.setReadOnly(true); + self._editor.setReadOnly(false); self._editor.enableEditableContent(); }; self.disable = function() { self._enabled = false; - self._editor.setReadOnly(false); + self._editor.setReadOnly(true); self._editor.disableEditableContent(); }; self.setShowToolbar = function( value ) { @@ -1689,9 +1692,11 @@ function ComponentWyiswygEditor( id ) { // Workaround for bug in Firefox. // (https://bugzilla.mozilla.org/show_bug.cgi?id=467333) // (https://bugzilla.mozilla.org/show_bug.cgi?id=504268) - setTimeout(function() { - self._editor.enableEditableContent(); - }, 100); + if( self._editor.readOnly == false ) { + setTimeout(function() { + self._editor.enableEditableContent(); + }, 100); + } } if( self.toolbarNode() ) { Element.show(self.toolbarNode()); From 2f6462233ac21cac405a569f366cee537d29cee9 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 4 Oct 2011 14:34:28 +0200 Subject: [PATCH 059/190] Fix FS#2715 - Fullscreen log in - unrecoverable error. --- webframework/Core/Permissions.feh | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/webframework/Core/Permissions.feh b/webframework/Core/Permissions.feh index 7a799e4..ece7d32 100644 --- a/webframework/Core/Permissions.feh +++ b/webframework/Core/Permissions.feh @@ -174,7 +174,7 @@ namespace Permissions { */ function validateUser( string username, string password ) { object user = Interface.User.byLogin( username.toLower() ); - if( user and user.password == Permissions.encodePassword(password)) { + if( user and user.active and user.password == Permissions.encodePassword(password)) { Permissions.setValidationCookies( user ); .currentUserObject = user; return .currentUserObject; @@ -317,21 +317,6 @@ namespace Permissions { } } } - - /** - * @function isActiveUser - * @declaration function isActiveUser(string username) - * @brief check whether the user is active or not - * @param string username The username to work with - * @return true if active - */ - - function isActiveUser(string username){ - object user = Interface.User.byLogin( username.toLower() ); - if(user.active) - return true; - return false; - } } /** * @end From d0b95e1cf98448841898e0cd7ea58def7c7322cf Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 11 Oct 2011 14:26:33 +0200 Subject: [PATCH 060/190] Modify design of MultiPopup component to make it look better. --- .../Support/Components/MultiplePopup/MultiplePopupItem.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopupItem.template b/Public/Support/Components/MultiplePopup/MultiplePopupItem.template index 33751a5..4b60370 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopupItem.template +++ b/Public/Support/Components/MultiplePopup/MultiplePopupItem.template @@ -1,6 +1,6 @@
  • [!instanceSeparator: [componentAttributes: [multiple: - + ]]] [instanceRender]
  • From 1c8360723a7e525053dcc8afeb8e1bfd15c60f28 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 11 Oct 2011 16:23:52 +0200 Subject: [PATCH 061/190] Fix issue were Wysiwyg Editor component did not became enabled even though the function was called. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 121a1e8..8249a50 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -1652,12 +1652,12 @@ function ComponentWyiswygEditor( id ) { }; self.enable = function() { self._enabled = true; - self._editor.setReadOnly(true); + self._editor.setReadOnly(false); self._editor.enableEditableContent(); }; self.disable = function() { self._enabled = false; - self._editor.setReadOnly(false); + self._editor.setReadOnly(true); self._editor.disableEditableContent(); }; self.setShowToolbar = function( value ) { From 932f626014b7f96d3ac973a90a80ada9473cd022 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 11 Oct 2011 16:24:29 +0200 Subject: [PATCH 062/190] Fix FS#2889 - Table component - rows and pointer. --- Public/Support/Components/Table/Table.feh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Public/Support/Components/Table/Table.feh b/Public/Support/Components/Table/Table.feh index c5174fa..20bbc8d 100644 --- a/Public/Support/Components/Table/Table.feh +++ b/Public/Support/Components/Table/Table.feh @@ -116,6 +116,9 @@ namespace modifies GUIKit { if( header.disableWordWrap() ) { style += 'white-space:nowrap;'; } + if( not header.ignoreClicks() ) { + style += 'cursor:pointer;'; + } style += header.style(); rowColumns[] = [ From cbf5ae87ed630bdfb2174ace38f780c11053d227 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 13 Oct 2011 16:05:09 +0200 Subject: [PATCH 063/190] Fix FS#2880 - Wysiwyg Editor - Italic button. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 54ebdfa..7f2b69e 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -697,7 +697,7 @@ function WysiwygEditorBoldToolbarItem( editor, group ) { }); } function WysiwygEditorItalicToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), false, function( item ) { + WysiwygEditor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('italic', false, false); editor.fireEvent('change'); From 8a6c5e75569080a1ed91125540d2879bb939a072 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 13 Oct 2011 16:29:54 +0200 Subject: [PATCH 064/190] Fix FS#2905 - Wysiwyg Editor - Perform command. --- .../Components/WysiwygEditor/WysiwygEditor.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 7f2b69e..0278038 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -444,10 +444,14 @@ function WysiwygEditorObject() { // be old web browsers that needs to use this instead of contentEditable. //self.iframeDocument.designMode = 'on'; self.contentElement.contentEditable = true; + self.contentElement.onmousedown = function() { + self.contentElementMouseDown = true; + }; self.contentElement.onmouseup = function() { self.latestSelection = rangy.getIframeSelection(self.iframe); self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); self.fireEvent('selectionchange'); + self.contentElementMouseDown = false; }; self.contentElement.onkeyup = function() { self.latestSelection = rangy.getIframeSelection(self.iframe); @@ -456,6 +460,16 @@ function WysiwygEditorObject() { self.fireEvent('keyup'); self.fireEvent('change'); }; + var previousDocumentBodyOnMouseUp = document.body.onmouseup; + document.body.onmouseup = function() { + if( self.contentElementMouseDown ) { + self.latestSelection = rangy.getIframeSelection(self.iframe); + self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + self.fireEvent('selectionchange'); + self.contentElementMouseDown = false; + } + previousDocumentBodyOnMouseUp(); + }; } var oncontextmenu = function( event ) { From 913a0e80f1dd944b4263b1814320adf5408d3fc0 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Mon, 17 Oct 2011 11:35:43 +0200 Subject: [PATCH 065/190] Fix FS#2916 - Search - java error. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 0278038..6a51160 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -468,7 +468,9 @@ function WysiwygEditorObject() { self.fireEvent('selectionchange'); self.contentElementMouseDown = false; } - previousDocumentBodyOnMouseUp(); + if( previousDocumentBodyOnMouseUp ) { + previousDocumentBodyOnMouseUp(); + } }; } From e76f06e5ccf344cb0e8ad04d818b2cc7a1becdf2 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 18 Oct 2011 16:47:24 +0200 Subject: [PATCH 066/190] Fix FS#2936 - Wysiwyg Editor - Add titles to buttons. --- .../Components/WysiwygEditor/WysiwygEditor.js | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 6a51160..802d59d 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -52,18 +52,20 @@ var WysiwygEditor = { table.setAttribute('cellspacing', 0); callback(row); }, - addToolbarItem: function( group, name, label, icon, lastItem, editor, onclick, onselectionchange ) { + addToolbarItem: function( group, name, label, icon, title, lastItem, editor, onclick, onselectionchange ) { var column = document.createElement('td'); var item = document.createElement('div') var iconImage; if( icon ) { iconImage = document.createElement('img'); iconImage.src = icon; + iconImage.title = title; item.appendChild(iconImage); } if( label ) { item.appendChild(WysiwygEditor.createElement('span', function( span ) { span.appendChild(document.createTextNode(label)); + span.title = title; })); } item.onmousedown = item.onselectstart = function() { return false; }; @@ -611,7 +613,7 @@ function WysiwygEditorObject() { }); WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorLinkToolbarItem(self, group); - WysiwygEditor.addToolbarItem(group, 'image', '', uriForServerImageResource('Components/WysiwygEditor/image.png'), false, self, function( item ) { + WysiwygEditor.addToolbarItem(group, 'image', '', uriForServerImageResource('Components/WysiwygEditor/image.png'), I('Insert image'), false, self, function( item ) { // TODO: Implement the image importer. }); WysiwygEditorHorizontalLineToolbarItem(self, group); @@ -639,8 +641,8 @@ function WysiwygEditorObject() { } WysiwygEditorFontSizeToolbarDropDown(self, row); WysiwygEditor.addToolbarItemGroup(row, function( group ) { - WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Components/WysiwygEditor/textcolor.png'), 'forecolor'); - WysiwygEditorColorToolbarItem(self, group, 'backgroundcolor', uriForServerImageResource('Components/WysiwygEditor/backgroundcolor.png'), 'backcolor'); + WysiwygEditorColorToolbarItem(self, group, 'textcolor', uriForServerImageResource('Components/WysiwygEditor/textcolor.png'), I('Change text colour'), 'forecolor'); + WysiwygEditorColorToolbarItem(self, group, 'backgroundcolor', uriForServerImageResource('Components/WysiwygEditor/backgroundcolor.png'), I('Change highlight colour'), 'backcolor'); }); WysiwygEditorSpellCheckLanguageDropDown(self, row); WysiwygEditor.addToolbarItemGroup(row, function( group ) { @@ -697,7 +699,7 @@ function WysiwygEditorObject() { } function WysiwygEditorBoldToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'bold', '', uriForServerImageResource('Components/WysiwygEditor/bold.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'bold', '', uriForServerImageResource('Components/WysiwygEditor/bold.png'), I('Make selection bold'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('bold', false, false); editor.fireEvent('change'); @@ -713,7 +715,7 @@ function WysiwygEditorBoldToolbarItem( editor, group ) { }); } function WysiwygEditorItalicToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'italic', '', uriForServerImageResource('Components/WysiwygEditor/italic.png'), I('Make selection italic'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('italic', false, false); editor.fireEvent('change'); @@ -726,7 +728,7 @@ function WysiwygEditorItalicToolbarItem( editor, group ) { }); } function WysiwygEditorUnderlineToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'underline', '', uriForServerImageResource('Components/WysiwygEditor/underline.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'underline', '', uriForServerImageResource('Components/WysiwygEditor/underline.png'), I('Underline selection'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('underline', false, false); editor.fireEvent('change'); @@ -739,7 +741,7 @@ function WysiwygEditorUnderlineToolbarItem( editor, group ) { }); } function WysiwygEditorStrikethroughToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'strikethrough', '', uriForServerImageResource('Components/WysiwygEditor/strikethrough.png'), true, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'strikethrough', '', uriForServerImageResource('Components/WysiwygEditor/strikethrough.png'), I('Overline selection'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('strikethrough', false, false); editor.fireEvent('change'); @@ -753,7 +755,7 @@ function WysiwygEditorStrikethroughToolbarItem( editor, group ) { } function WysiwygEditorOrderedListToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'ol', '', uriForServerImageResource('Components/WysiwygEditor/ol.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'ol', '', uriForServerImageResource('Components/WysiwygEditor/ol.png'), I('Insert numbered list'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('insertorderedlist', false, false); editor.fireEvent('change'); @@ -775,7 +777,7 @@ function WysiwygEditorOrderedListToolbarItem( editor, group ) { }); } function WysiwygEditorUnorderedListToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'ul', '', uriForServerImageResource('Components/WysiwygEditor/ul.png'), true, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'ul', '', uriForServerImageResource('Components/WysiwygEditor/ul.png'), I('Insert bullet list'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('insertunorderedlist', false, false); editor.fireEvent('change'); @@ -798,14 +800,14 @@ function WysiwygEditorUnorderedListToolbarItem( editor, group ) { } function WysiwygEditorOutdentToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'outdent', '', uriForServerImageResource('Components/WysiwygEditor/outdent.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'outdent', '', uriForServerImageResource('Components/WysiwygEditor/outdent.png'), I('Decrease indent'), false, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('outdent', false, false); editor.fireEvent('change'); }); } function WysiwygEditorIndentToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'indent', '', uriForServerImageResource('Components/WysiwygEditor/indent.png'), true, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'indent', '', uriForServerImageResource('Components/WysiwygEditor/indent.png'), I('Increase indent'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('indent', false, false); editor.fireEvent('change'); @@ -829,7 +831,7 @@ function WysiwygEditorJustifyLeftToolbarItem( editor, group ) { if( editor.justifyItemClicked == undefined ) { WysiwygEditorAddCommonJustifyFunction(editor); } - WysiwygEditor.addToolbarItem(group, 'leftjustify', '', uriForServerImageResource('Components/WysiwygEditor/leftjustify.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'leftjustify', '', uriForServerImageResource('Components/WysiwygEditor/leftjustify.png'), I('Left-align text'), false, editor, function( item ) { editor.justifyItemClicked(item, 'justifyleft'); }, function( editor, item, container ) { if( container && Element.getStyle(container, 'text-align') == 'left' ) @@ -841,7 +843,7 @@ function WysiwygEditorJustifyCenterToolbarItem( editor, group ) { if( editor.justifyItemClicked == undefined ) { WysiwygEditorAddCommonJustifyFunction(editor); } - WysiwygEditor.addToolbarItem(group, 'centerjustify', '', uriForServerImageResource('Components/WysiwygEditor/centerjustify.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'centerjustify', '', uriForServerImageResource('Components/WysiwygEditor/centerjustify.png'), I('Center-align text'), false, editor, function( item ) { editor.justifyItemClicked(item, 'justifycenter'); }, function( editor, item, container ) { if( container && Element.getStyle(container, 'text-align') == 'center' ) @@ -853,7 +855,7 @@ function WysiwygEditorJustifyRightToolbarItem( editor, group ) { if( editor.justifyItemClicked == undefined ) { WysiwygEditorAddCommonJustifyFunction(editor); } - WysiwygEditor.addToolbarItem(group, 'rightjustify', '', uriForServerImageResource('Components/WysiwygEditor/rightjustify.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'rightjustify', '', uriForServerImageResource('Components/WysiwygEditor/rightjustify.png'), I('Right-align text'), false, editor, function( item ) { editor.justifyItemClicked(item, 'justifyright'); }, function( editor, item, container ) { if( container && Element.getStyle(container, 'text-align') == 'right' ) @@ -863,7 +865,7 @@ function WysiwygEditorJustifyRightToolbarItem( editor, group ) { } function WysiwygEditorHorizontalLineToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'horizontalline', '', uriForServerImageResource('Components/WysiwygEditor/hr.png'), true, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'horizontalline', '', uriForServerImageResource('Components/WysiwygEditor/hr.png'), I('Insert horizontal line'), true, editor, function( item ) { editor.contentElement.focus(); editor.iframeDocument.execCommand('inserthorizontalrule', false, false); editor.fireEvent('change'); @@ -979,7 +981,7 @@ function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { } function WysiwygEditorLinkToolbarItem( editor, group ) { - WysiwygEditor.addToolbarItem(group, 'link', '', uriForServerImageResource('Components/WysiwygEditor/link.png'), false, editor, function( item ) { + WysiwygEditor.addToolbarItem(group, 'link', '', uriForServerImageResource('Components/WysiwygEditor/link.png'), I('Insert link'), false, editor, function( item ) { if( editor.linkPopup == undefined ) { var textTextfield = null; var urlTextfield = null; @@ -1174,8 +1176,8 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { }); } -function WysiwygEditorColorToolbarItem( editor, group, name, icon, command ) { - WysiwygEditor.addToolbarItem(group, name, '', icon, false, editor, function( item ) { +function WysiwygEditorColorToolbarItem( editor, group, name, icon, title, command ) { + WysiwygEditor.addToolbarItem(group, name, '', icon, title, false, editor, function( item ) { if( editor.colorPopup == undefined ) { var colors = [ [ '#000', '#800000', '#8B4513', '#2F4F4F', '#008080', '#000080', '#4B0082', '#696969' ], @@ -1577,13 +1579,13 @@ function WysiwygEditorSpellCheckToolbarItems( editor, toolbar ) { var check_button = null; var finish_button = null; var spell_check_mode = false; - check_button = WysiwygEditor.addToolbarItem(toolbar, 'spellcheck', I('Perform Spell Check'), uriForServerImageResource('Components/WysiwygEditor/check.png'), false, editor, function( item ) { + check_button = WysiwygEditor.addToolbarItem(toolbar, 'spellcheck', I('Perform Spell Check'), uriForServerImageResource('Components/WysiwygEditor/check.png'), I('Perform spell check'), false, editor, function( item ) { Element.hide(check_button); Element.show(finish_button); spell_check_mode = true; editor.spellcheck.check(editor.contentElement); }); - finish_button = WysiwygEditor.addToolbarItem(toolbar, 'finishspellcheck', I('Finish Spell Check'), uriForServerImageResource('Components/WysiwygEditor/done.png'), true, editor, function( item ) { + finish_button = WysiwygEditor.addToolbarItem(toolbar, 'finishspellcheck', I('Finish Spell Check'), uriForServerImageResource('Components/WysiwygEditor/done.png'), I('Finish spell check'), true, editor, function( item ) { Element.hide(finish_button); Element.show(check_button); spell_check_mode = false; From f65a2e7820182a156a0805e7ff00b4d5b6c40e9b Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 18 Oct 2011 17:59:33 +0200 Subject: [PATCH 067/190] Fix partially FS#2881 - Wysiwyg Editor - Image importing. --- .../Components/WysiwygEditor/WysiwygEditor.js | 110 ++++++++++++++++-- 1 file changed, 98 insertions(+), 12 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 802d59d..72fc6fa 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -613,9 +613,7 @@ function WysiwygEditorObject() { }); WysiwygEditor.addToolbarItemGroup(row, function( group ) { WysiwygEditorLinkToolbarItem(self, group); - WysiwygEditor.addToolbarItem(group, 'image', '', uriForServerImageResource('Components/WysiwygEditor/image.png'), I('Insert image'), false, self, function( item ) { - // TODO: Implement the image importer. - }); + WysiwygEditorImageToolbarItem(self, group); WysiwygEditorHorizontalLineToolbarItem(self, group); }); WysiwygEditorFontToolbarDropDown(self, row); @@ -1065,7 +1063,7 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { }); }); }); - var popup = WysiwygEditor.createElement('div', function( div ) { + editor.linkPopup = WysiwygEditor.createElement('div', function( div ) { div.className = 'WysiwygEditorItemPopup'; div.style.display = 'none'; div.style.width = '450px'; @@ -1092,17 +1090,18 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { selection.setSingleRange(range); editor.fireEvent('change'); } - Element.hide(div); - item.className = 'WysiwygEditorToolbarItem'; + editor.hideLinkPopup(); }); WysiwygEditor.addItemPopupFooterButton(footer, I('Cancel'), uriForApplicationImageResource('submit_arrow_right.png'), '#FCAB46', function() { - Element.hide(div); - item.className = 'WysiwygEditorToolbarItem'; + editor.hideLinkPopup(); }); })); }); - document.body.appendChild(popup); - editor.linkPopup = popup; + editor.hideLinkPopup = function() { + Element.hide(editor.linkPopup); + item.className = 'WysiwygEditorToolbarItem'; + }; + document.body.appendChild(editor.linkPopup); editor.linkWebAddressRadioButton = webAddressRadioButton; editor.linkWebAddressLabel = webAddressLabel; editor.linkEmailAddressRadioButton = emailAddressRadioButton; @@ -1125,9 +1124,11 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { descriptionLabel.innerHTML = I('To what email address should this link?'); }; } + if( editor.hideImagePopup ) { + editor.hideImagePopup(); + } if( Element.visible(editor.linkPopup) ) { - Element.hide(editor.linkPopup); - item.className = 'WysiwygEditorToolbarItem'; + editor.hideLinkPopup(); } else { if( !editor.latestSelection ) { editor.latestSelection = rangy.getIframeSelection(editor.iframe); @@ -1176,6 +1177,91 @@ function WysiwygEditorLinkToolbarItem( editor, group ) { }); } +function WysiwygEditorImageToolbarItem( editor, group ) { + WysiwygEditor.addToolbarItem(group, 'image', '', uriForServerImageResource('Components/WysiwygEditor/image.png'), I('Insert image'), false, editor, function( item ) { + if( editor.imagePopup == undefined ) { + editor.imagePopup = WysiwygEditor.createElement('div', function( div ) { + div.className = 'WysiwygEditorItemPopup'; + div.style.display = 'none'; + div.style.width = '450px'; + div.appendChild(WysiwygEditor.createTable(function( table, tbody ) { + WysiwygEditor.createTableRow(tbody, function( row ) { + WysiwygEditor.createTableColumn(row, function( column ) { + column.style.padding = '5px'; + column.appendChild(WysiwygEditor.createElement('div', function( imageWrapper ) { + imageWrapper.style.backgroundColor = '#a3d7ff'; + imageWrapper.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { + imageContainer.style.width = '128px'; + imageContainer.style.height = '128px'; + imageContainer.style.padding = '5px'; + imageContainer.style.display = 'table-cell'; + imageContainer.style.verticalAlign = 'middle'; + imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { + image.src = 'http://wedogames.se/logo.png'; + image.style.maxWidth = '128px'; + image.style.maxHeight = '128px'; + + })); + })); + })); + }); + WysiwygEditor.createTableColumn(row, function( column ) { + column.style.padding = '5px'; + column.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { + imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { + image.src = 'http://laggarbo.net/images/laggarbo.gif'; + image.style.maxWidth = '128px'; + image.style.maxHeight = '128px'; + image.style.margin = '5px'; + })); + })); + }); + WysiwygEditor.createTableColumn(row, function( column ) { + column.style.padding = '5px'; + column.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { + imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { + image.src = 'http://tobias.laggarbo.net/iron_man.gif'; + image.style.maxWidth = '128px'; + image.style.maxHeight = '128px'; + image.style.margin = '5px'; + })); + })); + }); + }); + })); + div.appendChild(WysiwygEditor.createItemPopupFooter(function( footer ) { + WysiwygEditor.addItemPopupFooterButton(footer, I('Save'), uriForApplicationImageResource('submit_save.png'), '#96D754', function() { + editor.hideImagePopup(); + }); + WysiwygEditor.addItemPopupFooterButton(footer, I('Cancel'), uriForApplicationImageResource('submit_arrow_right.png'), '#FCAB46', function() { + editor.hideImagePopup(); + }); + })); + }); + editor.hideImagePopup = function() { + Element.hide(editor.imagePopup); + item.className = 'WysiwygEditorToolbarItem'; + }; + document.body.appendChild(editor.imagePopup); + } + if( editor.hideLinkPopup ) { + editor.hideLinkPopup(); + } + if( Element.visible(editor.imagePopup) ) { + editor.hideImagePopup(); + } else { + Element.clonePosition(editor.imagePopup, item, { + setWidth: false, + setHeight: false, + offsetLeft: 0 - (Element.getWidth(editor.imagePopup) / 2), + offsetTop: Element.getHeight(item.parentNode) + }); + Element.show(editor.imagePopup); + item.className = 'WysiwygEditorToolbarItemActive'; + } + }); +} + function WysiwygEditorColorToolbarItem( editor, group, name, icon, title, command ) { WysiwygEditor.addToolbarItem(group, name, '', icon, title, false, editor, function( item ) { if( editor.colorPopup == undefined ) { From 727bc5bd45108b8f6aa8a1dff6a54e85ba96671c Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 19 Oct 2011 13:15:22 +0200 Subject: [PATCH 068/190] Fix FS#2881 - Wysiwyg Editor - Image importing. --- .../WysiwygEditor/WysiwygEditor.feh | 5 + .../Components/WysiwygEditor/WysiwygEditor.js | 156 ++++++++++++------ .../WysiwygEditor/WysiwygEditor.template | 1 + 3 files changed, 115 insertions(+), 47 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh index 3c0dd1c..9cad28a 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.feh @@ -5,6 +5,7 @@ namespace modifies GUIKit { [attribute boolean showToolbar true 'Whether the toolbar should be shown']; [attribute boolean twoRowToolbar false 'Whether toolbar items should be on two rows']; + array _images; array _languages; string _selectedLanguage; @@ -17,6 +18,9 @@ namespace modifies GUIKit { function setSelectedLanguage( string selected ) { ._selectedLanguage = selected; } + function setImages( array items ) { + ._images = items; + } function render() { if( .visible() ) { @@ -34,6 +38,7 @@ namespace modifies GUIKit { ]; }; values['Languages'] = JSON.valueToJSON(languages); + values['Images'] = JSON.valueToJSON(._images); values['JavascriptSafeTextValue'] = JSON.escape(values['TextValue']); return GUIKit.ViewTemplate.renderPath(path, values); } diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 72fc6fa..7256654 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -196,7 +196,7 @@ var WysiwygEditor = { column.style.width = '100%'; }); if( creator ) { - creator(row); + creator(row, table); } }); }); @@ -382,6 +382,7 @@ function WysiwygEditorObject() { self.readOnly = false; self.twoRowToolbar = false; self.languages = []; + self.images = []; self.onEvent = function( type, callback ) { if( self.eventCallbacks[type] == undefined ) self.eventCallbacks[type] = []; @@ -427,6 +428,16 @@ function WysiwygEditorObject() { self.getLanguages = function() { return self.languages; }; + self.setImages = function( list ) { + if( self.imagePopup ) { + Element.remove(self.imagePopup); + self.imagePopup = null; + } + self.images = list; + }; + self.getImages = function() { + return self.images; + }; self.restoreLatestSelection = function() { if( self.latestSelectionRange ) { var selection = rangy.getIframeSelection(self.iframe); @@ -1184,55 +1195,103 @@ function WysiwygEditorImageToolbarItem( editor, group ) { div.className = 'WysiwygEditorItemPopup'; div.style.display = 'none'; div.style.width = '450px'; - div.appendChild(WysiwygEditor.createTable(function( table, tbody ) { - WysiwygEditor.createTableRow(tbody, function( row ) { - WysiwygEditor.createTableColumn(row, function( column ) { - column.style.padding = '5px'; - column.appendChild(WysiwygEditor.createElement('div', function( imageWrapper ) { - imageWrapper.style.backgroundColor = '#a3d7ff'; - imageWrapper.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { - imageContainer.style.width = '128px'; - imageContainer.style.height = '128px'; - imageContainer.style.padding = '5px'; - imageContainer.style.display = 'table-cell'; - imageContainer.style.verticalAlign = 'middle'; - imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { - image.src = 'http://wedogames.se/logo.png'; - image.style.maxWidth = '128px'; - image.style.maxHeight = '128px'; - + div.appendChild(WysiwygEditor.createElement('div', function( container ) { + container.style.width = '450px'; + container.style.overflowX = 'auto'; + container.appendChild(WysiwygEditor.createTable(function( table, tbody ) { + WysiwygEditor.createTableRow(tbody, function( row ) { + + var images = editor.getImages(); + var size = images.length; + var first = 0; + var last = size - 1; + var i = 0; + + if( size > 0 ) { + images.each(function( imageItem ) { + WysiwygEditor.createTableColumn(row, function( column ) { + column.style.paddingLeft = '5px'; + column.style.paddingTop = '5px'; + column.style.paddingBottom = '5px'; + if( i == last ) { + column.style.paddingRight = '5px'; + } + column.appendChild(WysiwygEditor.createTable(function( imagetable, imagetbody ) { + imagetable.style.width = '128px'; + imagetable.style.height = '128px'; + WysiwygEditor.createTableRow(imagetbody, function( imagerow ) { + WysiwygEditor.createTableColumn(imagerow, function( imagecolumn ) { + if( i == first ) { + imagecolumn.style.backgroundColor = '#a3d7ff'; + editor.selectedImage = imagecolumn; + } + imagecolumn.style.width = '128px'; + imagecolumn.style.height = '128px'; + imagecolumn.style.borderRadius = '5px'; // standard + imagecolumn.style.MozBorderRadius = '5px'; // Mozilla + imagecolumn.style.WebkitBorderRadius = '5px'; // WebKit + imagecolumn.align = 'center'; + imagecolumn.appendChild(WysiwygEditor.createElement('img', function( image ) { + image.src = imageItem.src; + // After carful testing it has been + // proven that a max width and height + // of 125px will result in container + // table columns that have a width and + // height of 128px. + // But we are using 120px as width and + // height because that leaves some room + // between the edge of the selection box + // and the image. + image.style.maxWidth = '120px'; + image.style.maxHeight = '120px'; + })); + imagecolumn.onclick = function() { + if( editor.selectedImage ) { + editor.selectedImage.style.backgroundColor = '#fff'; + imagecolumn.style.backgroundColor = '#a3d7ff'; + editor.selectedImage = imagecolumn; + } + }; + }); + }); + })); + }); + + i++; + }); + } else { + WysiwygEditor.createTableColumn(row, function( column ) { + column.style.width = '450px'; + column.style.height = '128px'; + column.align = 'center'; + column.appendChild(WysiwygEditor.createElement('span', function( span ) { + span.appendChild(document.createTextNode(I('No images have been uploaded to the area file archive.'))); })); - })); - })); - }); - WysiwygEditor.createTableColumn(row, function( column ) { - column.style.padding = '5px'; - column.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { - imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { - image.src = 'http://laggarbo.net/images/laggarbo.gif'; - image.style.maxWidth = '128px'; - image.style.maxHeight = '128px'; - image.style.margin = '5px'; - })); - })); - }); - WysiwygEditor.createTableColumn(row, function( column ) { - column.style.padding = '5px'; - column.appendChild(WysiwygEditor.createElement('div', function( imageContainer ) { - imageContainer.appendChild(WysiwygEditor.createElement('img', function( image ) { - image.src = 'http://tobias.laggarbo.net/iron_man.gif'; - image.style.maxWidth = '128px'; - image.style.maxHeight = '128px'; - image.style.margin = '5px'; - })); - })); + }); + } + }); - }); + })); })); - div.appendChild(WysiwygEditor.createItemPopupFooter(function( footer ) { - WysiwygEditor.addItemPopupFooterButton(footer, I('Save'), uriForApplicationImageResource('submit_save.png'), '#96D754', function() { - editor.hideImagePopup(); - }); + div.appendChild(WysiwygEditor.createItemPopupFooter(function( footer, footerContainer ) { + footerContainer.style.marginTop = '0px'; + if( editor.getImages().length > 0 ) { + WysiwygEditor.addItemPopupFooterButton(footer, I('Insert'), uriForApplicationImageResource('submit_infoga.png'), '#96D754', function() { + if( editor.selectedImage ) { + var node = WysiwygEditor.createElement('img', function( img ) { + img.src = editor.selectedImage.firstChild.src; + }, editor.iframeDocument); + var selection = rangy.getIframeSelection(editor.iframe); + var range = editor.latestSelectionRange; + range.collapse(false); + range.insertNode(node); + range.collapseAfter(node); + selection.setSingleRange(range); + editor.fireEvent('change'); + } + editor.hideImagePopup(); + }); + } WysiwygEditor.addItemPopupFooterButton(footer, I('Cancel'), uriForApplicationImageResource('submit_arrow_right.png'), '#FCAB46', function() { editor.hideImagePopup(); }); @@ -1751,6 +1810,9 @@ function ComponentWyiswygEditor( id ) { self.setLanguages = function( languages ) { self._editor.setLanguages(languages); }; + self.setImages = function( images ) { + self._editor.setImages(images); + }; self.setContentRendersWholeDocument = function( value ) { self._editor.setContentRendersWholeDocument(value); }; diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template index c95647d..e125384 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.template +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.template @@ -6,6 +6,7 @@ if( Prototype.Browser.IE ) { $('[ID].IFrame').src = ""; } _('[ID]').setState('text-value', "[JavascriptSafeTextValue]"); _('[ID]').setLanguages([Languages]); + _('[ID]').setImages([Images]); _('[ID]').setContentRendersWholeDocument([contentRendersWholeDocument:true][!contentRendersWholeDocument:false]); _('[ID]').setReadOnly([readOnly:true][!readOnly:false]); _('[ID]').setShowToolbar([showToolbar:true][!showToolbar:false]); From d770b019f24b33014d44ade1d845e0abeaa77284 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 19 Oct 2011 16:53:00 +0200 Subject: [PATCH 069/190] Fix FS#2882 - Combobox - design issue (IE 7). --- Public/Support/Components/Combobox/Combobox.css | 4 ++-- Public/Support/Components/Combobox/Combobox.js | 4 ++-- Public/Support/Components/Combobox/Combobox.template | 2 +- Public/Support/Components/Textfield/Textfield.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Public/Support/Components/Combobox/Combobox.css b/Public/Support/Components/Combobox/Combobox.css index ab424ff..06641ac 100644 --- a/Public/Support/Components/Combobox/Combobox.css +++ b/Public/Support/Components/Combobox/Combobox.css @@ -5,14 +5,14 @@ .wfComboboxTextfield { width: 100%; - border: 1px solid white; + border: 0px solid #000; cursor: text; background-color: white; } .wfComboboxTextfieldDisabled { width: 100%; - border: 1px solid #ddd; + border: 0px solid #000; cursor: text; background-color: #ddd; } diff --git a/Public/Support/Components/Combobox/Combobox.js b/Public/Support/Components/Combobox/Combobox.js index 553188a..df15845 100644 --- a/Public/Support/Components/Combobox/Combobox.js +++ b/Public/Support/Components/Combobox/Combobox.js @@ -8,13 +8,13 @@ function ComponentCombobox( id ) { self.enable = function() { self._enabled = true; - self.node().removeAttribute('readonly'); + self.node().readOnly = false; self.node().className = 'wfComboboxTextfield'; self.iconNode.className = 'wfComboboxIcon'; }; self.disable = function() { self._enabled = false; - self.node().setAttribute('readonly', 'true'); + self.node().readOnly = true; self.node().className = 'wfComboboxTextfieldDisabled'; self.iconNode.className = 'wfComboboxIconDisabled'; }; diff --git a/Public/Support/Components/Combobox/Combobox.template b/Public/Support/Components/Combobox/Combobox.template index 678f805..cd171c2 100644 --- a/Public/Support/Components/Combobox/Combobox.template +++ b/Public/Support/Components/Combobox/Combobox.template @@ -1,6 +1,6 @@ - + [icon:]
    diff --git a/Public/Support/Components/Textfield/Textfield.js b/Public/Support/Components/Textfield/Textfield.js index c6c6c1b..322a395 100644 --- a/Public/Support/Components/Textfield/Textfield.js +++ b/Public/Support/Components/Textfield/Textfield.js @@ -23,12 +23,12 @@ function ComponentTextfield( id ) { }; self.enable = function() { self._enabled = true; - self.node().removeAttribute('readonly'); + self.node().readOnly = false; self.node().style.backgroundColor = (self.__previousBackgroundColor ? self.__previousBackgroundColor : '#fff'); }; self.disable = function() { self._enabled = false; - self.node().setAttribute('readonly', 'true'); + self.node().readOnly = true; self.__previousBackgroundColor = self.node().style.backgroundColor; self.node().style.backgroundColor = '#ddd'; }; From 7726c31c8753dd23088bdaa580bdacaea31238ae Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 19 Oct 2011 20:41:50 +0200 Subject: [PATCH 070/190] Make Popup component listen to .setEnabled() calls in Ferite. --- Public/Support/Components/Popup/Popup.template | 1 + 1 file changed, 1 insertion(+) diff --git a/Public/Support/Components/Popup/Popup.template b/Public/Support/Components/Popup/Popup.template index a1f1029..c6a56b2 100644 --- a/Public/Support/Components/Popup/Popup.template +++ b/Public/Support/Components/Popup/Popup.template @@ -6,5 +6,6 @@ SetComponent('[ID]', ComponentPopup('[ID]')); _('[ID]').updateSelected(); [@Selected: _('[.ID]').selectItemsByValue('[]');] + _('[ID]').setEnabled([Enabled:true][!Enabled:false]); _('[ID]').activate(); From a5f39da36644c05d41627f3befea131c94cbdbab Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 19 Oct 2011 20:42:42 +0200 Subject: [PATCH 071/190] Fix FS#2912 - Reports - Table is not generated. --- webframework/Plugins/GUIKit.plugin/Components/Page.feh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webframework/Plugins/GUIKit.plugin/Components/Page.feh b/webframework/Plugins/GUIKit.plugin/Components/Page.feh index f0457ea..6f45058 100644 --- a/webframework/Plugins/GUIKit.plugin/Components/Page.feh +++ b/webframework/Plugins/GUIKit.plugin/Components/Page.feh @@ -455,8 +455,12 @@ namespace modifies GUIKit { returnJSON[] = HTML.MCAMChannel('Error', "${err.str + ', backtrace: ' + error.backtrace()}"); } else { Cache.components.each() using ( component ) { - if( component.lastChange >= waterMark ) - returnJSON[] = component.renderForMCAM(); + if( component.lastChange >= waterMark ) { + string render = component.renderForMCAM(); + if( render ) { + returnJSON[] = render; + } + } }; } // Send back the information From 4632836f556c0661fbb6f7c06f36900d47bc3e3e Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 27 Oct 2011 11:01:32 +0200 Subject: [PATCH 072/190] Make some small fixes and changes. --- Public/Resources/Javascript/Hotkey.js | 2 +- webframework/Core/Application.feh | 2 +- webframework/Core/Cache.feh | 3 - webframework/Core/Debug.feh | 2 - webframework/Core/Resources.feh | 149 +++++++++++++------------- webframework/Core/Test.feh | 3 - webframework/webframework.feh | 1 + 7 files changed, 78 insertions(+), 84 deletions(-) diff --git a/Public/Resources/Javascript/Hotkey.js b/Public/Resources/Javascript/Hotkey.js index 6e5f8db..2ad3e1a 100644 --- a/Public/Resources/Javascript/Hotkey.js +++ b/Public/Resources/Javascript/Hotkey.js @@ -200,7 +200,7 @@ Hotkeys = { var keydown_function = function(e) { if( check_key_function( e, shortcut_combination ) ) { - if( captured_this.all_shortcuts[shortcut_combination]['timeout'] == 0 ) { + if( captured_this.all_shortcuts[shortcut_combination] && captured_this.all_shortcuts[shortcut_combination]['timeout'] == 0 ) { captured_this.log_keypress('Calling callback for ' + shortcut_combination); callback(e, shortcut_combination, opt); diff --git a/webframework/Core/Application.feh b/webframework/Core/Application.feh index df4ee41..fd94c76 100644 --- a/webframework/Core/Application.feh +++ b/webframework/Core/Application.feh @@ -566,4 +566,4 @@ class Application { } /** * @end - */ \ No newline at end of file + */ diff --git a/webframework/Core/Cache.feh b/webframework/Core/Cache.feh index 939c5f9..77c4e40 100644 --- a/webframework/Core/Cache.feh +++ b/webframework/Core/Cache.feh @@ -1,6 +1,3 @@ -uses "embfer"; -uses "memcached"; - global { object currentPage; } diff --git a/webframework/Core/Debug.feh b/webframework/Core/Debug.feh index 91bbb30..02a7cdd 100644 --- a/webframework/Core/Debug.feh +++ b/webframework/Core/Debug.feh @@ -1,5 +1,3 @@ -uses "console", "date"; - global { array debugOutput; array profileOutput; diff --git a/webframework/Core/Resources.feh b/webframework/Core/Resources.feh index eb7c416..a50cbe3 100644 --- a/webframework/Core/Resources.feh +++ b/webframework/Core/Resources.feh @@ -1,4 +1,5 @@ -uses "image"; +// Tobias 2011-10-21: This has been deemed evil and disabled. +//uses "image"; global { array requiredJavascriptList; @@ -280,8 +281,8 @@ function resourceForName( string directory, string name ) { /** * @namespace ImageTools */ -namespace ImageTools { - +//namespace ImageTools { +// /** * @function imageForName * @declaration function imageForName( string directory, string name ) @@ -292,27 +293,27 @@ namespace ImageTools { */ /** */ - function imageForName( string directory, string name ) { - object image = null; - monitor { - object d = Directory.open(directory); - if( d ) { - array items = d.toArray(); - object r = new Regexp("^($name\.[a-zA-Z]+)"), match; - - Array.each( items ) using ( entry ) { - if( (match = r.match(entry)) ) { - image = new Image(); - image.load( directory + '/' + match.capture(0) ); - return false; - } - }; - } - } handle { - image = null; - } - return image; - } +// function imageForName( string directory, string name ) { +// object image = null; +// monitor { +// object d = Directory.open(directory); +// if( d ) { +// array items = d.toArray(); +// object r = new Regexp("^($name\.[a-zA-Z]+)"), match; +// +// Array.each( items ) using ( entry ) { +// if( (match = r.match(entry)) ) { +// image = new Image(); +// image.load( directory + '/' + match.capture(0) ); +// return false; +// } +// }; +// } +// } handle { +// image = null; +// } +// return image; +// } /** * @function thumbNailName * @declaration function thumbNailName( string name ) @@ -320,9 +321,9 @@ namespace ImageTools { * @param string name The name of the image * @return The filename to use. */ - function thumbNailName( string name ) { - return "Thumb_$name.jpg"; - } +// function thumbNailName( string name ) { +// return "Thumb_$name.jpg"; +// } /** * @function makeThumbNail * @declaration function makeThumbNail( string path, string filename, string extension ) @@ -332,30 +333,30 @@ namespace ImageTools { * @param string extension The extension of the source image * @return An array containing the width and height of the image */ - function makeThumbNail( string path, string filename, string extension ) { - object image = new Image(); - number width, height; - number scale = 1; - - image.load( "$path/$filename.$extension" ); - - width = image.getWidth(); - height = image.getHeight(); - - if( width > height ) - scale = 133.0 / width; - else - scale = 88.0 / height; - - width = Number.round( width * scale ); - height = Number.round( height * scale ); - - image.resize( width, height ); - - image.saveAsType( "$path/${.thumbNailName(filename)}", "jpg" ); - - return [ 'width' => width, 'height' => height ]; - } +// function makeThumbNail( string path, string filename, string extension ) { +// object image = new Image(); +// number width, height; +// number scale = 1; +// +// image.load( "$path/$filename.$extension" ); +// +// width = image.getWidth(); +// height = image.getHeight(); +// +// if( width > height ) +// scale = 133.0 / width; +// else +// scale = 88.0 / height; +// +// width = Number.round( width * scale ); +// height = Number.round( height * scale ); +// +// image.resize( width, height ); +// +// image.saveAsType( "$path/${.thumbNailName(filename)}", "jpg" ); +// +// return [ 'width' => width, 'height' => height ]; +// } /** * @function generateImageStatistics * @declaration function generateImageStatistics( object image ) @@ -363,29 +364,29 @@ namespace ImageTools { * @param object image The image object to source the information from * @return A string containing the information, or 'No Details' otherwise */ - function generateImageStatistics( object image ) { - string imageDescription = 'No Details'; - if( image ) - { - object file = File.open(image.lastLoaded); - number file_size = file.length(); - string size = ''; - - if( file_size >= 1073741824 ) { - size = '' + (Number.round(file_size / 1073741824.0 * 100) / 100) + "Gb"; - } else if( file_size >= 1048576 ) { - size = '' + (Number.round(file_size / 1048576.0 * 100) / 100) + "Mb"; - } else if( file_size >= 1024 ) { - size = '' + (Number.round(file_size / 1024.0 * 100) / 100) + "Kb"; - } else { - size = '' + file_size + "b"; - } - imageDescription = "Dimensions: ${image.getWidth()}x${image.getHeight()}; Size: $size"; - } - return imageDescription; - } -} +// function generateImageStatistics( object image ) { +// string imageDescription = 'No Details'; +// if( image ) +// { +// object file = File.open(image.lastLoaded); +// number file_size = file.length(); +// string size = ''; +// +// if( file_size >= 1073741824 ) { +// size = '' + (Number.round(file_size / 1073741824.0 * 100) / 100) + "Gb"; +// } else if( file_size >= 1048576 ) { +// size = '' + (Number.round(file_size / 1048576.0 * 100) / 100) + "Mb"; +// } else if( file_size >= 1024 ) { +// size = '' + (Number.round(file_size / 1024.0 * 100) / 100) + "Kb"; +// } else { +// size = '' + file_size + "b"; +// } +// imageDescription = "Dimensions: ${image.getWidth()}x${image.getHeight()}; Size: $size"; +// } +// return imageDescription; +// } +//} /** * @end - */ \ No newline at end of file + */ diff --git a/webframework/Core/Test.feh b/webframework/Core/Test.feh index b228f6f..3bca2d6 100644 --- a/webframework/Core/Test.feh +++ b/webframework/Core/Test.feh @@ -1,6 +1,3 @@ -uses "date"; -uses "number"; - /** * @class WebTestSuite * @brief A suite of tests. A suite is a named set of tests that can be run at the same time. diff --git a/webframework/webframework.feh b/webframework/webframework.feh index 75a099c..91b1244 100644 --- a/webframework/webframework.feh +++ b/webframework/webframework.feh @@ -17,6 +17,7 @@ uses "posix"; uses "filesystem"; uses "date"; uses "template"; +uses "memcached"; uses "MHash"; uses "SOAP"; uses "JSON"; From 222b9c1f04505278cca5a4550163792403e4676c Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 27 Oct 2011 14:32:16 +0200 Subject: [PATCH 073/190] Fix partially FS#2938 - Translations missing in Tags. --- Public/Support/Components/Helper/Helper.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Public/Support/Components/Helper/Helper.js b/Public/Support/Components/Helper/Helper.js index e734702..2d49797 100644 --- a/Public/Support/Components/Helper/Helper.js +++ b/Public/Support/Components/Helper/Helper.js @@ -31,8 +31,12 @@ function ComponentHelper( id, target ) { if( self.highlight ) self.highlight.style.backgroundColor = '#e1ffe4'; - if( $(target) ) - $(target).focus(); + if( $(target) ) { + try { + $(target).focus(); + } catch( e ) { + } + } helperCurrent = id; visible = true; From c69823c9d78cd7b5eaef6d61f6ced74e28671fd6 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Mon, 31 Oct 2011 13:43:54 +0100 Subject: [PATCH 074/190] Modify Hotkey component to always display hotkey dialog so it is visible to the user. --- Public/Support/Components/Hotkeys/Hotkeys.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Public/Support/Components/Hotkeys/Hotkeys.js b/Public/Support/Components/Hotkeys/Hotkeys.js index 443c845..f9d8c96 100644 --- a/Public/Support/Components/Hotkeys/Hotkeys.js +++ b/Public/Support/Components/Hotkeys/Hotkeys.js @@ -72,6 +72,7 @@ function ComponentHotkeys( id ) { $(self.identifier() + '_Action').innerHTML = self.getState('press-key-combo'); $(self.identifier() + '_Advice').innerHTML = ""; $(self.identifier() + '_Advice').style.display = 'none'; + $(self.identifier() + '_Dialog').style.top = (document.viewport.getHeight() * 0.2) + document.viewport.getScrollOffsets().top + 'px'; $(self.identifier() + '_Dialog').style.display = 'block'; self.setState('current-action', ''); From 81f15e61883bebf87af7a74045cc6cb5af0b84bc Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Mon, 31 Oct 2011 13:44:35 +0100 Subject: [PATCH 075/190] Remove Hotkey for combination if exists when adding hotkey with same combination. --- Public/Resources/Javascript/Hotkey.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Public/Resources/Javascript/Hotkey.js b/Public/Resources/Javascript/Hotkey.js index 2ad3e1a..62270d1 100644 --- a/Public/Resources/Javascript/Hotkey.js +++ b/Public/Resources/Javascript/Hotkey.js @@ -232,6 +232,10 @@ Hotkeys = { } }; + if( this.all_shortcuts[shortcut_combination] ) { + this.remove(shortcut_combination); + } + this.all_shortcuts[shortcut_combination] = { 'callback': keydown_function, 'keyup_callback': keyup_function, @@ -281,7 +285,7 @@ Hotkeys = { var binding = this.all_shortcuts[shortcut_combination]; delete(this.all_shortcuts[shortcut_combination]) - if(!binding) + if(!binding) return; var type = binding['event']; From b238db780904fb63709de14ae36f77c0e8bc1fe7 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 1 Nov 2011 17:11:48 +0100 Subject: [PATCH 076/190] Bump version to 3.2. --- farm.yard | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/farm.yard b/farm.yard index a43f0b9..bc0142c 100644 --- a/farm.yard +++ b/farm.yard @@ -2,7 +2,7 @@ - + From 7280dc1fca7060c92b98a6a0b9e42976640ea9a6 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 8 Nov 2011 11:45:48 +0100 Subject: [PATCH 077/190] Modify MultiPopup to not hide when "Select None" is clicked. --- Public/Support/Components/MultiplePopup/MultiplePopup.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Public/Support/Components/MultiplePopup/MultiplePopup.js b/Public/Support/Components/MultiplePopup/MultiplePopup.js index 9761251..4d37157 100644 --- a/Public/Support/Components/MultiplePopup/MultiplePopup.js +++ b/Public/Support/Components/MultiplePopup/MultiplePopup.js @@ -32,7 +32,6 @@ function ComponentMultiplePopup( id ) { }; self.selectNone = function() { self._selectNone(); - self.action('change'); }; self._forceSelectItemsByValue = function( value ) { var items = self.itemsByValue(value); @@ -304,7 +303,6 @@ function ComponentMultiplePopup( id ) { } if( self.selectNoneNode ) { self.selectNoneNode.onclick = function(event) { - self.hideList(); self.selectNone(); CancelEvent(event); }; From 84fd067eb91a6f6c69ba39c06d490960f57c40dd Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 8 Nov 2011 12:50:29 +0100 Subject: [PATCH 078/190] Change font size 13 to 12 in the Wysiwyg editor. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 7256654..e7fce5e 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -939,7 +939,7 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { var list = [ { name: '10', label: '10', size: '1' }, - { name: '13', label: '13', size: '2' }, + { name: '12', label: '12', size: '2' }, { name: '14', label: '14', size: '3' }, { name: '16', label: '16', size: '4' }, { name: '24', label: '24', size: '5' }, From afa3baeb80e1c12f647aec1e9aeaafee9a77e9d8 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 8 Nov 2011 14:38:32 +0100 Subject: [PATCH 079/190] Fix FS#2972 - Wysiwyg Editor - Font and Size drop downs. --- .../Components/WysiwygEditor/WysiwygEditor.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index e7fce5e..704c35f 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -900,6 +900,7 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('fontname', false, item.font); editor.fireEvent('change'); + itemLabel.innerHTML = item.name; }, function( itemLabel ) { var container = editor.latestSelectionContainer(); if( container ) { @@ -938,18 +939,19 @@ function WysiwygEditorFontToolbarDropDown( editor, toolbar ) { } function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { var list = [ - { name: '10', label: '10', size: '1' }, - { name: '12', label: '12', size: '2' }, - { name: '14', label: '14', size: '3' }, - { name: '16', label: '16', size: '4' }, - { name: '24', label: '24', size: '5' }, - { name: '32', label: '32', size: '6' }, - { name: '48', label: '48', size: '7' } + { name: '10', label: '10', size: '1', pixelSize: 10 }, + { name: '12', label: '12', size: '2', pixelSize: 13 }, + { name: '14', label: '14', size: '3', pixelSize: 14 }, + { name: '16', label: '16', size: '4', pixelSize: 16 }, + { name: '24', label: '24', size: '5', pixelSize: 24 }, + { name: '32', label: '32', size: '6', pixelSize: 32 }, + { name: '48', label: '48', size: '7', pixelSize: 48 } ]; WysiwygEditor.addToolbarDropDown(toolbar, I('Size'), 70, list, editor, function(item, itemLabel) { editor.restoreLatestSelection(); editor.iframeDocument.execCommand('FontSize', false, item.size); editor.fireEvent('change'); + itemLabel.innerHTML = item.name; }, function( itemLabel ) { var container = editor.latestSelectionContainer(); if( container ) { @@ -970,7 +972,7 @@ function WysiwygEditorFontSizeToolbarDropDown( editor, toolbar ) { var size = list.length; for( var i = 0; i < size; i++ ) { var item = list[i]; - var compareTo = (Prototype.Browser.Gecko || Prototype.Browser.WebKit ? item.name : item.size); + var compareTo = (Prototype.Browser.Gecko || Prototype.Browser.WebKit ? item.pixelSize : item.size); if( compareTo == fontSize ) { if( fontSize != editor.previousSelectionFontSize ) { itemLabel.innerHTML = item.name; From 9c500a9959852f1ac3d17e0d1ae8ce13c0aeb896 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Tue, 8 Nov 2011 14:58:32 +0100 Subject: [PATCH 080/190] Fix FS#2971 - Wysiwyg Editor - Link button. --- Public/Support/Components/WysiwygEditor/WysiwygEditor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 704c35f..06e3fd2 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -485,6 +485,10 @@ function WysiwygEditorObject() { previousDocumentBodyOnMouseUp(); } }; + try { + self.contentElement.focus(); + } catch( e ) { + } } var oncontextmenu = function( event ) { From 3657a19d7759c4c1439a57e392a7e8a2516e5488 Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Thu, 10 Nov 2011 18:03:04 +0100 Subject: [PATCH 081/190] Fix FS#2985 - Gina Tricot - Wysiwyg Editor - Enter key for Internet Explorer. --- .../Components/WysiwygEditor/WysiwygEditor.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index 06e3fd2..c1be4a7 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -473,6 +473,34 @@ function WysiwygEditorObject() { self.fireEvent('keyup'); self.fireEvent('change'); }; + if( Prototype.Browser.IE ) { + self.contentElement.attachEvent('onkeydown', function( event ) { + if( event.keyCode == 13 ) { + // Prevent Internet Explorer to insert its own line + // break which is a new

    . + // This codes instead inserts a
    or

    depending + // on if the Shift key is hold. + var count = (event.shiftKey ? 2 : 1); + for( var i = 0; i < count; i++ ) { + var node = self.iframeDocument.createElement('br'); + var selection = rangy.getIframeSelection(self.iframe); + var range = self.latestSelectionRange; + range.collapse(false); + range.insertNode(node); + range.collapseAfter(node); + selection.setSingleRange(range); + } + self.fireEvent('change'); + // Cancel the default behaviour + CancelEvent(event); + return false; + } + }); + }/* else { + self.contentElement.addEventListener('keydown', function( event ) { + alert(event.keyCode); + }, false); + }*/ var previousDocumentBodyOnMouseUp = document.body.onmouseup; document.body.onmouseup = function() { if( self.contentElementMouseDown ) { From 730b898ab566ba6718cf3b30167f1b0b16f54bcb Mon Sep 17 00:00:00 2001 From: Tobias Eriksson Date: Wed, 16 Nov 2011 15:29:13 +0100 Subject: [PATCH 082/190] Fix FS#2986 - Gina Tricot - Wysiwyg Editor - Pasting from Excel for Internet Explorer. --- .../Components/WysiwygEditor/WysiwygEditor.js | 182 +++++++++++++----- 1 file changed, 132 insertions(+), 50 deletions(-) diff --git a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js index c1be4a7..4ff1130 100644 --- a/Public/Support/Components/WysiwygEditor/WysiwygEditor.js +++ b/Public/Support/Components/WysiwygEditor/WysiwygEditor.js @@ -37,6 +37,20 @@ var WysiwygEditor = { } return column; }, + hasElementContainer: function( startNode, elementName ) { + var found = false; + var node = startNode; + while( node && (node != self.contentElement) ) { + if( node.nodeType == 1 && node.tagName.toLowerCase() == elementName ) { + found = true; + break; + } + node = node.parentNode; + } + if( found ) + return true; + return false; + }, addToolbarItemGroup: function( toolbar, callback ) { var group = document.createElement('td'); var table = document.createElement('table'); @@ -405,8 +419,7 @@ function WysiwygEditorObject() { if( self.latestSelectionRange ) { container = self.latestSelectionRange.startContainer; } else { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + self.updateSelection(); container = self.latestSelectionRange.startContainer; } if( container.nodeType == 3 ) @@ -438,6 +451,14 @@ function WysiwygEditorObject() { self.getImages = function() { return self.images; }; + self.updateSelection = function() { + if( self.latestSelection ) + self.latestSelection.detach(); + if( self.latestSelectionRange ) + self.latestSelectionRange.detach(); + self.latestSelection = rangy.getIframeSelection(self.iframe); + self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + }; self.restoreLatestSelection = function() { if( self.latestSelectionRange ) { var selection = rangy.getIframeSelection(self.iframe); @@ -457,55 +478,74 @@ function WysiwygEditorObject() { // be old web browsers that needs to use this instead of contentEditable. //self.iframeDocument.designMode = 'on'; self.contentElement.contentEditable = true; + + // Some things needs to know if the mouse button is being held. self.contentElement.onmousedown = function() { self.contentElementMouseDown = true; }; + // Fire some events on upmouseup and onkeyup. self.contentElement.onmouseup = function() { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + self.updateSelection(); self.fireEvent('selectionchange'); self.contentElementMouseDown = false; }; self.contentElement.onkeyup = function() { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + self.updateSelection(); self.fireEvent('selectionchange'); self.fireEvent('keyup'); self.fireEvent('change'); }; + + // Setup specifc things for Internet Explorer if( Prototype.Browser.IE ) { + // Prevent Internet Explorer to insert its own line + // break which is a new

    . + // We should only prevent this if we the selection + // is not inside a

      or
        element. self.contentElement.attachEvent('onkeydown', function( event ) { - if( event.keyCode == 13 ) { - // Prevent Internet Explorer to insert its own line - // break which is a new

        . - // This codes instead inserts a
        or

        depending - // on if the Shift key is hold. - var count = (event.shiftKey ? 2 : 1); - for( var i = 0; i < count; i++ ) { + if( event.keyCode == 13 /* enter */ ) { + var selection = rangy.getIframeSelection(self.iframe); + var range = selection.getRangeAt(0); + if( !(WysiwygEditor.hasElementContainer(range.startContainer, 'ol') || + WysiwygEditor.hasElementContainer(range.startContainer, 'ul')) ) + { var node = self.iframeDocument.createElement('br'); - var selection = rangy.getIframeSelection(self.iframe); - var range = self.latestSelectionRange; range.collapse(false); range.insertNode(node); range.collapseAfter(node); selection.setSingleRange(range); + self.updateSelection(); + // Cancel the default behaviour + CancelEvent(event); + return false; } - self.fireEvent('change'); - // Cancel the default behaviour - CancelEvent(event); - return false; } + return true; + }); + // Internet Explorer has this magical event called onbeforepaste. + // It is actually quite usefull because it allows us to + // implement our own paste handler which we want to do. + self.contentElement.attachEvent('onbeforepaste', function( event ) { + self.fireEvent('beforepaste'); + CancelEvent(event); + return false; }); - }/* else { - self.contentElement.addEventListener('keydown', function( event ) { - alert(event.keyCode); - }, false); - }*/ + // Cancel the default paste event. + self.contentElement.attachEvent('onpaste', function( event ) { + CancelEvent(event); + return false; + }); + } + + // If you select a text using the mouse you can end up with + // mouse pointer outside of the editor window. + // If this happens the onmouseup event is triggered by + // the parent document so we need to catch this too so that we can + // update the selection. var previousDocumentBodyOnMouseUp = document.body.onmouseup; document.body.onmouseup = function() { if( self.contentElementMouseDown ) { - self.latestSelection = rangy.getIframeSelection(self.iframe); - self.latestSelectionRange = self.latestSelection.getRangeAt(0).cloneRange(); + self.updateSelection(); self.fireEvent('selectionchange'); self.contentElementMouseDown = false; } @@ -513,6 +553,68 @@ function WysiwygEditorObject() { previousDocumentBodyOnMouseUp(); } }; + + // We have or own implementation of paste which makes the editor + // paste content as a regular - - - -

        -
        - - - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/api_dialog.html b/Public/Resources/Javascript/ckeditor/_samples/api_dialog.html deleted file mode 100644 index 1ccc542..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/api_dialog.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - Using API to customize dialogs - CKEditor Sample - - - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        - -

        - This sample shows how to use the dialog API to customize dialogs whithout changing - the original editor code. The following customizations are being done::

        -
          -
        1. Add dialog pages ("My Tab" in the Link dialog).
        2. -
        3. Remove a dialog tab ("Target" tab from the Link dialog).
        4. -
        5. Add dialog fields ("My Custom Field" into the Link dialog).
        6. -
        7. Remove dialog fields ("Link Type" and "Browser Server" the Link - dialog).
        8. -
        9. Set default values for dialog fields (for the "URL" field in the - Link dialog).
        10. -
        11. Create a custom dialog ("My Dialog" button).
        12. -
        - - - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/api_dialog/my_dialog.js b/Public/Resources/Javascript/ckeditor/_samples/api_dialog/my_dialog.js deleted file mode 100644 index 02f412f..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/api_dialog/my_dialog.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dialog.add( 'myDialog', function( editor ) -{ - return { - title : 'My Dialog', - minWidth : 400, - minHeight : 200, - contents : [ - { - id : 'tab1', - label : 'First Tab', - title : 'First Tab', - elements : - [ - { - id : 'input1', - type : 'text', - label : 'Input 1' - } - ] - } - ] - }; -} ); diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/advanced.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/advanced.asp deleted file mode 100644 index dfb94d5..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/advanced.asp +++ /dev/null @@ -1,105 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - -<% - - ' You must set "Enable Parent Paths" on your web site - ' in order for the above relative include to work. - ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp" - -%> - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        -

        -<% - ' Create class instance. - dim editor, initialValue, code, textareaAttributes - set editor = New CKEditor - - ' Do not print the code directly to the browser, return it instead - editor.returnOutput = true - - ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - ' editor.basePath = "/ckeditor/" - ' If not set, CKEditor will default to /ckeditor/ - editor.basePath = "../../" - - ' Set global configuration (will be used by all instances of CKEditor). - editor.config("width") = 600 - - ' Change default textarea attributes - set textareaAttributes = CreateObject("Scripting.Dictionary") - textareaAttributes.Add "rows", 10 - textareaAttributes.Add "cols", 80 - Set editor.textareaAttributes = textareaAttributes - - ' The initial value to be displayed in the editor. - initialValue = "

        This is some sample text. You are using CKEditor.

        " - - ' Create first instance. - code = editor.editor("editor1", initialValue) - - response.write code -%> -

        -
        -

        -<% -' Configuration that will be used only by the second editor. - -editor.instanceConfig("toolbar") = Array( _ - Array( "Source", "-", "Bold", "Italic", "Underline", "Strike" ), _ - Array( "Image", "Link", "Unlink", "Anchor" ) _ - ) - -editor.instanceConfig("skin") = "v2" - -' Create second instance. -response.write editor.editor("editor2", initialValue) -%> -

        - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/events.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/events.asp deleted file mode 100644 index 5391cef..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/events.asp +++ /dev/null @@ -1,136 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - -<% - - ' You must set "Enable Parent Paths" on your web site - ' in order for the above relative include to work. - ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp" - -%> - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        -

        -<% - -'' - ' Adds global event, will hide "Target" tab in Link dialog in all instances. - ' -function CKEditorHideLinkTargetTab(editor) - dim functionCode - functionCode = "function (ev) {" & vbcrlf & _ - "// Take the dialog name and its definition from the event data" & vbcrlf & _ - "var dialogName = ev.data.name;" & vbcrlf & _ - "var dialogDefinition = ev.data.definition;" & vbcrlf & _ - "" & vbcrlf & _ - "// Check if the definition is from the Link dialog." & vbcrlf & _ - "if ( dialogName == 'link' )" & vbcrlf & _ - " dialogDefinition.removeContents('target')" & vbcrlf & _ - "}" & vbcrlf - - editor.addGlobalEventHandler "dialogDefinition", functionCode -end function - -'' - ' Adds global event, will notify about opened dialog. - ' -function CKEditorNotifyAboutOpenedDialog(editor) - dim functionCode - functionCode = "function (evt) {" & vbcrlf & _ - "alert('Loading dialog: ' + evt.data.name);" & vbcrlf & _ - "}" - - editor.addGlobalEventHandler "dialogDefinition", functionCode -end function - - -dim editor, initialValue - -' Create class instance. -set editor = new CKEditor - -' Set configuration option for all editors. -editor.config("width") = 750 - -' Path to CKEditor directory, ideally instead of relative dir, use an absolute path: -' editor.basePath = "/ckeditor/" -' If not set, CKEditor will default to /ckeditor/ -editor.basePath = "../../" - -' The initial value to be displayed in the editor. -initialValue = "

        This is some sample text. You are using CKEditor.

        " - -' Event that will be handled only by the first editor. -editor.addEventHandler "instanceReady", "function (evt) { alert('Loaded editor: ' + evt.editor.name );}" - -' Create first instance. -editor.editor "editor1", initialValue - -' Clear event handlers, instances that will be created later will not have -' the 'instanceReady' listener defined a couple of lines above. -editor.clearEventHandlers empty -%> -

        -
        -

        -<% -' Configuration that will be used only by the second editor. -editor.instanceConfig("width") = 600 -editor.instanceConfig("toolbar") = "Basic" - -' Add some global event handlers (for all editors). -CKEditorHideLinkTargetTab(editor) -CKEditorNotifyAboutOpenedDialog(editor) - -' Event that will be handled only by the second editor. -editor.addInstanceEventHandler "instanceReady", "function (evt) { alert('Loaded second editor: ' + evt.editor.name );}" - -' Create second instance. -editor.editor "editor2", initialValue -%> -

        - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/index.html b/Public/Resources/Javascript/ckeditor/_samples/asp/index.html deleted file mode 100644 index e40ec45..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/index.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - ASP integration Samples List - CKEditor - - - -

        - CKEditor Samples List for ASP -

        -

        - Overview -

        -

        The ckeditor.asp file provides a wrapper to ease the work of creating CKEditor instances from classic Asp.

        -

        To use it, you must first include it into your page: - - <!-- #INCLUDE file="../../ckeditor.asp" --> - - Of course, you should adjust the path to make it point to the correct location, and maybe use a full path (with virtual="" instead of file="") -

        -

        After that script is included, you can use it in different ways, based on the following pattern:

        - -
          -
        1. - Create an instance of the CKEditor class: -
          dim editor
          -set editor = New CKEditor
          -
        2. -
        3. - Set the path to the folder where CKEditor has been installed, by default it will use /ckeditor/ -
          editor.basePath = "../../"
          -
        4. -
        5. - Now use one of the three main methods to create the CKEditor instances: -
            -
          • - Replace textarea with id (or name) "editor1". -
            editor.replaceInstance "editor1"
            -
          • -
          • - Replace all textareas with CKEditor. -
            editor.replaceAll empty
            -
          • -
          • - Create a textarea element and attach CKEditor to it. -
            editor.editor "editor1", initialValue
            -
          • -
          -
        6. -
        -

        Before step 3 you can use a number of methods and properties to adjust the behavior of this class and the CKEditor instances -that will be created:

        -
          -
        • returnOutput : if set to true, the functions won't dump the code with response.write, but instead they will return it so - you can do anything you want
        • -
        • basePath: location of the CKEditor scripts
        • -
        • initialized: if you set it to true, it means that you have already included the CKEditor.js file into the page and it - doesn't have to be generated again.
        • -
        • textareaAttributes: You can set here a Dictionary object with the attributes that you want to output in the call to the "editor" method.
        • - -
        • config: Allows to set config values for all the instances from now on.
        • -
        • instanceConfig: Allows to set config values just for the next instance.
        • - -
        • addEventHandler: Adds an event handler for all the instances from now on.
        • -
        • addInstanceEventHandler: Adds an event handler just for the next instance.
        • -
        • addGlobalEventHandler: Adds an event handler for the global CKEDITOR object.
        • - -
        • clearEventHandlers: Removes one or all the event handlers from all the instances from now on.
        • -
        • clearInstanceEventHandlers: Removes one or all the event handlers from the next instance.
        • -
        • clearGlobalEventHandlers: Removes one or all the event handlers from the global CKEDITOR object.
        • - -
        - -

        - Basic Samples -

        - -

        - Advanced Samples -

        - - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/replace.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/replace.asp deleted file mode 100644 index d89e0bf..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/replace.asp +++ /dev/null @@ -1,72 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - -<% - - ' You must set "Enable Parent Paths" on your web site - ' in order for the above relative include to work. - ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp" - -%> - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        - -

        -

        - -

        -
        -
        - - <% - ' Create class instance. - dim editor - set editor = New CKEditor - ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - ' editor.basePath = "/ckeditor/" - ' If not set, CKEditor will default to /ckeditor/ - editor.basePath = "../../" - ' Replace textarea with id (or name) "editor1". - editor.replaceInstance "editor1" - %> - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/replaceall.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/replaceall.asp deleted file mode 100644 index d1187ed..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/replaceall.asp +++ /dev/null @@ -1,77 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - -<% - - ' You must set "Enable Parent Paths" on your web site - ' in order for the above relative include to work. - ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp" - -%> - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        - -

        -

        -
        - -

        -

        - -

        -
        -
        - - <% - ' Create class instance. - dim editor - set editor = New CKEditor - ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - ' editor.basePath = "/ckeditor/" - ' If not set, CKEditor will default to /ckeditor/ - editor.basePath = "../../" - ' Replace all textareas with CKEditor. - editor.replaceAll empty - %> - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/sample_posteddata.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/sample_posteddata.asp deleted file mode 100644 index 3b45181..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/sample_posteddata.asp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - - - - - Sample - CKEditor - - - - -

        - CKEditor - Posted Data -

        - - - - - - - - - <% - Dim sForm - For Each sForm in Request.Form - %> - - - - - <% Next %> -
        Field NameValue
        <%=Server.HTMLEncode( sForm )%>
        <%=Server.HTMLEncode( Request.Form(sForm) )%>
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/asp/standalone.asp b/Public/Resources/Javascript/ckeditor/_samples/asp/standalone.asp deleted file mode 100644 index 02cda38..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/asp/standalone.asp +++ /dev/null @@ -1,72 +0,0 @@ -<%@ codepage="65001" language="VBScript" %> -<% Option Explicit %> - -<% - - ' You must set "Enable Parent Paths" on your web site - ' in order for the above relative include to work. - ' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp" - -%> - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        - Editor 1: -

        -

        - <% - dim initialValue, editor - ' The initial value to be displayed in the editor. - initialValue = "

        This is some sample text.

        " - ' Create class instance. - set editor = New CKEditor - ' Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - ' editor.basePath = "/ckeditor/" - ' If not set, CKEditor will default to /ckeditor/ - editor.basePath = "../../" - ' Create textarea element and attach CKEditor to it. - editor.editor "editor1", initialValue - %> - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/assets/output_xhtml.css b/Public/Resources/Javascript/ckeditor/_samples/assets/output_xhtml.css deleted file mode 100644 index 620ac64..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/assets/output_xhtml.css +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.html or http://ckeditor.com/license - * - * Styles used by the XHTML 1.1 sample page (xhtml.html). - */ - -/** - * Basic definitions for the editing area. - */ -body -{ - font-family: Arial, Verdana, sans-serif; - font-size: 80%; - color: #000000; - background-color: #ffffff; - padding: 5px; - margin: 0px; -} - -/** - * Core styles. - */ - -.Bold -{ - font-weight: bold; -} - -.Italic -{ - font-style: italic; -} - -.Underline -{ - text-decoration: underline; -} - -.StrikeThrough -{ - text-decoration: line-through; -} - -.Subscript -{ - vertical-align: sub; - font-size: smaller; -} - -.Superscript -{ - vertical-align: super; - font-size: smaller; -} - -/** - * Font faces. - */ - -.FontComic -{ - font-family: 'Comic Sans MS'; -} - -.FontCourier -{ - font-family: 'Courier New'; -} - -.FontTimes -{ - font-family: 'Times New Roman'; -} - -/** - * Font sizes. - */ - -.FontSmaller -{ - font-size: smaller; -} - -.FontLarger -{ - font-size: larger; -} - -.FontSmall -{ - font-size: 8pt; -} - -.FontBig -{ - font-size: 14pt; -} - -.FontDouble -{ - font-size: 200%; -} - -/** - * Font colors. - */ -.FontColor1 -{ - color: #ff9900; -} - -.FontColor2 -{ - color: #0066cc; -} - -.FontColor3 -{ - color: #ff0000; -} - -.FontColor1BG -{ - background-color: #ff9900; -} - -.FontColor2BG -{ - background-color: #0066cc; -} - -.FontColor3BG -{ - background-color: #ff0000; -} - -/** - * Indentation. - */ - -.Indent1 -{ - margin-left: 40px; -} - -.Indent2 -{ - margin-left: 80px; -} - -.Indent3 -{ - margin-left: 120px; -} - -/** - * Alignment. - */ - -.JustifyLeft -{ - text-align: left; -} - -.JustifyRight -{ - text-align: right; -} - -.JustifyCenter -{ - text-align: center; -} - -.JustifyFull -{ - text-align: justify; -} - -/** - * Other. - */ - -code -{ - font-family: courier, monospace; - background-color: #eeeeee; - padding-left: 1px; - padding-right: 1px; - border: #c0c0c0 1px solid; -} - -kbd -{ - padding: 0px 1px 0px 1px; - border-width: 1px 2px 2px 1px; - border-style: solid; -} - -blockquote -{ - color: #808080; -} diff --git a/Public/Resources/Javascript/ckeditor/_samples/autogrow.html b/Public/Resources/Javascript/ckeditor/_samples/autogrow.html deleted file mode 100644 index ccc08b6..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/autogrow.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - AutoGrow Plugin - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - In this sample the AutoGrow plugin is available. It makes the editor grow to fit the size of the content.

        -

        -
        - - -

        -

        -
        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/divreplace.html b/Public/Resources/Javascript/ckeditor/_samples/divreplace.html deleted file mode 100644 index bee6797..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/divreplace.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Replace DIV - CKEditor Sample - - - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -

        - Double-click on any of the following DIVs to transform them into editor instances.

        -
        -

        - Part 1

        -

        - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

        -
        -
        -

        - Part 2

        -

        - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

        -

        - Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus - sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum - vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate. -

        -
        -
        -

        - Part 3

        -

        - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi - semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna - rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla - nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce - eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus. -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/enterkey.html b/Public/Resources/Javascript/ckeditor/_samples/enterkey.html deleted file mode 100644 index def67ae..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/enterkey.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - ENTER Key Configuration - CKEditor Sample - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        - When ENTER is pressed:
        - -
        -
        - When SHIFT + ENTER is pressed:
        - -
        -
        -
        -

        -
        - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/fullpage.html b/Public/Resources/Javascript/ckeditor/_samples/fullpage.html deleted file mode 100644 index bdd301e..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/fullpage.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Full Page Editing - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - In this sample the editor is configured to edit entire HTML pages, from the <html> - tag to </html>.

        -

        -
        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/index.html b/Public/Resources/Javascript/ckeditor/_samples/index.html deleted file mode 100644 index 679914b..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/index.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Samples List - CKEditor - - - -

        - CKEditor Samples List -

        -

        - Basic Samples -

        - -

        - Basic Customization -

        - -

        - Advanced Samples -

        - - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/jqueryadapter.html b/Public/Resources/Javascript/ckeditor/_samples/jqueryadapter.html deleted file mode 100644 index 86113c5..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/jqueryadapter.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - jQuery adapter - CKEditor Sample - - - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        -

        -
        - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/output_html.html b/Public/Resources/Javascript/ckeditor/_samples/output_html.html deleted file mode 100644 index 6712d7c..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/output_html.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - - HTML compliant output - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - This sample shows CKEditor configured to produce a legacy HTML4 document. Traditional - HTML elements like <b>, <i>, and <font> are used in place of - <strong>, <em> and CSS styles.

        -

        -
        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/output_xhtml.html b/Public/Resources/Javascript/ckeditor/_samples/output_xhtml.html deleted file mode 100644 index c84ca0e..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/output_xhtml.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - XHTML compliant output - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - This sample shows CKEditor configured to produce XHTML 1.1 compliant - HTML. Deprecated elements or attributes, like the <font> and <u> elements - or the "style" attribute, are avoided.

        -

        -
        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/php/advanced.php b/Public/Resources/Javascript/ckeditor/_samples/php/advanced.php deleted file mode 100644 index 771cb0c..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/php/advanced.php +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        -

        -returnOutput = true; - -// Path to CKEditor directory, ideally instead of relative dir, use an absolute path: -// $CKEditor->basePath = '/ckeditor/' -// If not set, CKEditor will try to detect the correct path. -$CKEditor->basePath = '../../'; - -// Set global configuration (will be used by all instances of CKEditor). -$CKEditor->config['width'] = 600; - -// Change default textarea attributes -$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10); - -// The initial value to be displayed in the editor. -$initialValue = '

        This is some sample text. You are using CKEditor.

        '; - -// Create first instance. -$code = $CKEditor->editor("editor1", $initialValue); - -echo $code; -?> -

        -
        -

        -editor("editor2", $initialValue, $config); -?> -

        - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/php/events.php b/Public/Resources/Javascript/ckeditor/_samples/php/events.php deleted file mode 100644 index 36f2be2..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/php/events.php +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        -

        -addGlobalEventHandler('dialogDefinition', $function); -} - -/** - * Adds global event, will notify about opened dialog. - */ -function CKEditorNotifyAboutOpenedDialog(&$CKEditor) { - $function = 'function (evt) { - alert("Loading dialog: " + evt.data.name); - }'; - - $CKEditor->addGlobalEventHandler('dialogDefinition', $function); -} - -// Include CKEditor class. -include("../../ckeditor.php"); - -// Create class instance. -$CKEditor = new CKEditor(); - -// Set configuration option for all editors. -$CKEditor->config['width'] = 750; - -// Path to CKEditor directory, ideally instead of relative dir, use an absolute path: -// $CKEditor->basePath = '/ckeditor/' -// If not set, CKEditor will try to detect the correct path. -$CKEditor->basePath = '../../'; - -// The initial value to be displayed in the editor. -$initialValue = '

        This is some sample text. You are using CKEditor.

        '; - -// Event that will be handled only by the first editor. -$CKEditor->addEventHandler('instanceReady', 'function (evt) { - alert("Loaded editor: " + evt.editor.name); -}'); - -// Create first instance. -$CKEditor->editor("editor1", $initialValue); - -// Clear event handlers, instances that will be created later will not have -// the 'instanceReady' listener defined a couple of lines above. -$CKEditor->clearEventHandlers(); -?> -

        -
        -

        -editor("editor2", $initialValue, $config, $events); -?> -

        - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/php/replace.php b/Public/Resources/Javascript/ckeditor/_samples/php/replace.php deleted file mode 100644 index 80d813b..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/php/replace.php +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        - -

        -

        - -

        -
        -
        - - basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Replace textarea with id (or name) "editor1". - $CKEditor->replace("editor1"); - ?> - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/php/replaceall.php b/Public/Resources/Javascript/ckeditor/_samples/php/replaceall.php deleted file mode 100644 index 38efc80..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/php/replaceall.php +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        - -

        -

        -
        - -

        -

        - -

        -
        -
        - - basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Replace all textareas with CKEditor. - $CKEditor->replaceAll(); - ?> - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/php/standalone.php b/Public/Resources/Javascript/ckeditor/_samples/php/standalone.php deleted file mode 100644 index 2a39ca1..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/php/standalone.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor Sample -

        - -
        - -
        - -
        - Output -
        -

        -
        -

        -

        - This is some sample text.

        '; - // Create class instance. - $CKEditor = new CKEditor(); - // Path to CKEditor directory, ideally instead of relative dir, use an absolute path: - // $CKEditor->basePath = '/ckeditor/' - // If not set, CKEditor will try to detect the correct path. - $CKEditor->basePath = '../../'; - // Create textarea element and attach CKEditor to it. - $CKEditor->editor("editor1", $initialValue); - ?> - -

        -
        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/replacebyclass.html b/Public/Resources/Javascript/ckeditor/_samples/replacebyclass.html deleted file mode 100644 index fd31e7d..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/replacebyclass.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Replace Textareas by Class Name - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        -
        - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/replacebycode.html b/Public/Resources/Javascript/ckeditor/_samples/replacebycode.html deleted file mode 100644 index bd3f54d..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/replacebycode.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Replace Textarea by Code - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        -
        - - -

        -

        -
        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/sample.css b/Public/Resources/Javascript/ckeditor/_samples/sample.css deleted file mode 100644 index cee85e8..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/sample.css +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -fieldset -{ - margin: 0; - padding: 10px; -} - -form -{ - margin: 0; - padding: 0; -} - -pre -{ - background-color: #F7F7F7; - border: 1px solid #D7D7D7; - overflow: auto; - margin: 0; - padding: 0.25em; -} - -#alerts -{ - color: Red; -} - -#footer hr -{ - margin: 10px 0 15px 0; - height: 1px; - border: solid 1px gray; - border-bottom: none; -} - -#footer p -{ - margin: 0 10px 10px 10px; - float: left; -} - -#footer #copy -{ - float: right; -} - -#outputSample -{ - width: 100%; - table-layout: fixed; -} - -#outputSample thead th -{ - color: #dddddd; - background-color: #999999; - padding: 4px; - white-space: nowrap; -} - -#outputSample tbody th -{ - vertical-align: top; - text-align: left; -} - -#outputSample pre -{ - margin: 0; - padding: 0; - white-space: pre; /* CSS2 */ - white-space: -moz-pre-wrap; /* Mozilla*/ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS 2.1 */ - white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */ - word-wrap: break-word; /* IE */ -} diff --git a/Public/Resources/Javascript/ckeditor/_samples/sample.js b/Public/Resources/Javascript/ckeditor/_samples/sample.js deleted file mode 100644 index f7c023c..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/sample.js +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -// This file is not required by CKEditor and may be safely ignored. -// It is just a helper file that displays a red message about browser compatibility -// at the top of the samples (if incompatible browser is detected). - -if ( window.CKEDITOR ) -{ - (function() - { - var showCompatibilityMsg = function() - { - var env = CKEDITOR.env; - - var html = '

        Your browser is not compatible with CKEditor.'; - - var browsers = - { - gecko : 'Firefox 2.0', - ie : 'Internet Explorer 6.0', - opera : 'Opera 9.5', - webkit : 'Safari 3.0' - }; - - var alsoBrowsers = ''; - - for ( var key in env ) - { - if ( browsers[ key ] ) - { - if ( env[key] ) - html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.'; - else - alsoBrowsers += browsers[ key ] + '+, '; - } - } - - alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' ); - - html += ' It is also compatible with ' + alsoBrowsers + '.'; - - html += '

        With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.

        '; - - var alertsEl = document.getElementById( 'alerts' ); - alertsEl && ( alertsEl.innerHTML = html ); - }; - - var onload = function() - { - // Show a friendly compatibility message as soon as the page is loaded, - // for those browsers that are not compatible with CKEditor. - if ( !CKEDITOR.env.isCompatible ) - showCompatibilityMsg(); - }; - - // Register the onload listener. - if ( window.addEventListener ) - window.addEventListener( 'load', onload, false ); - else if ( window.attachEvent ) - window.attachEvent( 'onload', onload ); - })(); -} diff --git a/Public/Resources/Javascript/ckeditor/_samples/sample_posteddata.php b/Public/Resources/Javascript/ckeditor/_samples/sample_posteddata.php deleted file mode 100644 index af20e89..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/sample_posteddata.php +++ /dev/null @@ -1,59 +0,0 @@ - - - - - Sample - CKEditor - - - - -

        - CKEditor - Posted Data -

        - - - - - - - - - $value ) -{ - if ( get_magic_quotes_gpc() ) - $postedValue = htmlspecialchars( stripslashes( $value ) ) ; - else - $postedValue = htmlspecialchars( $value ) ; - -?> - - - - - -
        Field NameValue
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/sharedspaces.html b/Public/Resources/Javascript/ckeditor/_samples/sharedspaces.html deleted file mode 100644 index 7b32b9f..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/sharedspaces.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Shared toolbars - CKEditor Sample - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -
        -
        -

        -
        - -

        -

        -
        - -

        -

        -
        - -

        -

        -
        - -

        -

        - -

        -
        -
        -
        - - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/skins.html b/Public/Resources/Javascript/ckeditor/_samples/skins.html deleted file mode 100644 index 7f8ea83..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/skins.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Skins - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - "Kama" skin:
        - - -

        -

        - "Office 2003" skin:
        - - -

        -

        - "V2" skin:
        - - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/ui_color.html b/Public/Resources/Javascript/ckeditor/_samples/ui_color.html deleted file mode 100644 index 8ba1acf..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/ui_color.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - UI Color Setting Tool - CKEditor Sample - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -

        - Click the UI Color Picker button to test your color preferences at runtime.

        -
        -

        - - -

        -

        - - -

        -

        - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_samples/ui_languages.html b/Public/Resources/Javascript/ckeditor/_samples/ui_languages.html deleted file mode 100644 index e7c2e15..0000000 --- a/Public/Resources/Javascript/ckeditor/_samples/ui_languages.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - User Interface Globalization - CKEditor Sample - - - - - - - -

        - CKEditor Sample -

        - -
        - -
        -
        -

        - Available languages ( languages!):
        - -
        - (You may see strange characters if your system doesn't - support the selected language) -

        -

        - - -

        -
        - - - diff --git a/Public/Resources/Javascript/ckeditor/_source/adapters/jquery.js b/Public/Resources/Javascript/ckeditor/_source/adapters/jquery.js deleted file mode 100644 index e633758..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/adapters/jquery.js +++ /dev/null @@ -1,297 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview jQuery adapter provides easy use of basic CKEditor functions - * and access to internal API. It also integrates some aspects of CKEditor with - * jQuery framework. - * - * Every TEXTAREA, DIV and P elements can be converted to working editor. - * - * Plugin exposes some of editor's event to jQuery event system. All of those are namespaces inside - * ".ckeditor" namespace and can be binded/listened on supported textarea, div and p nodes. - * - * Available jQuery events: - * - instanceReady.ckeditor( editor, rootNode ) - * Triggered when new instance is ready. - * - destroy.ckeditor( editor ) - * Triggered when instance is destroyed. - * - getData.ckeditor( editor, eventData ) - * Triggered when getData event is fired inside editor. It can change returned data using eventData reference. - * - setData.ckeditor( editor ) - * Triggered when getData event is fired inside editor. - * - * @example - * - * - * - */ - -(function() -{ - /** - * Allow CKEditor to override jQuery.fn.val(). This results in ability to use val() - * function on textareas as usual and having those calls synchronized with CKEditor - * Rich Text Editor component. - * - * This config option is global and executed during plugin load. - * Can't be customized across editor instances. - * - * @type Boolean - * @example - * $( 'textarea' ).ckeditor(); - * // ... - * $( 'textarea' ).val( 'New content' ); - */ - CKEDITOR.config.jqueryOverrideVal = typeof CKEDITOR.config.jqueryOverrideVal == 'undefined' - ? true : CKEDITOR.config.jqueryOverrideVal; - - var jQuery = window.jQuery; - - if ( typeof jQuery == 'undefined' ) - return; - - // jQuery object methods. - jQuery.extend( jQuery.fn, - /** @lends jQuery.fn */ - { - /** - * Return existing CKEditor instance for first matched element. - * Allows to easily use internal API. Doesn't return jQuery object. - * - * Raised exception if editor doesn't exist or isn't ready yet. - * - * @name jQuery.ckeditorGet - * @return CKEDITOR.editor - * @see CKEDITOR.editor - */ - ckeditorGet: function() - { - var instance = this.eq( 0 ).data( 'ckeditorInstance' ); - if ( !instance ) - throw "CKEditor not yet initialized, use ckeditor() with callback."; - return instance; - }, - /** - * Triggers creation of CKEditor in all matched elements (reduced to DIV, P and TEXTAREAs). - * Binds callback to instanceReady event of all instances. If editor is already created, than - * callback is fired right away. - * - * Mixed parameter order allowed. - * - * @param callback Function to be run on editor instance. Passed parameters: [ textarea ]. - * Callback is fiered in "this" scope being ckeditor instance and having source textarea as first param. - * - * @param config Configuration options for new instance(s) if not already created. - * See URL - * - * @example - * $( 'textarea' ).ckeditor( function( textarea ) { - * $( textarea ).val( this.getData() ) - * } ); - * - * @name jQuery.fn.ckeditor - * @return jQuery.fn - */ - ckeditor: function( callback, config ) - { - if ( !jQuery.isFunction( callback )) - { - var tmp = config; - config = callback; - callback = tmp; - } - config = config || {}; - - this.filter( 'textarea, div, p' ).each( function() - { - var $element = jQuery( this ), - editor = $element.data( 'ckeditorInstance' ), - instanceLock = $element.data( '_ckeditorInstanceLock' ), - element = this; - - if ( editor && !instanceLock ) - { - if ( callback ) - callback.apply( editor, [ this ] ); - } - else if ( !instanceLock ) - { - // CREATE NEW INSTANCE - - // Handle config.autoUpdateElement inside this plugin if desired. - if ( config.autoUpdateElement - || ( typeof config.autoUpdateElement == 'undefined' && CKEDITOR.config.autoUpdateElement ) ) - { - config.autoUpdateElementJquery = true; - } - - // Always disable config.autoUpdateElement. - config.autoUpdateElement = false; - $element.data( '_ckeditorInstanceLock', true ); - - // Set instance reference in element's data. - editor = CKEDITOR.replace( element, config ); - $element.data( 'ckeditorInstance', editor ); - - // Register callback. - editor.on( 'instanceReady', function( event ) - { - var editor = event.editor; - setTimeout( function() - { - // Delay bit more if editor is still not ready. - if ( !editor.element ) - { - setTimeout( arguments.callee, 100 ); - return; - } - - // Remove this listener. - event.removeListener( 'instanceReady', this.callee ); - - // Forward setData on dataReady. - editor.on( 'dataReady', function() - { - $element.trigger( 'setData' + '.ckeditor', [ editor ] ); - }); - - // Forward getData. - editor.on( 'getData', function( event ) { - $element.trigger( 'getData' + '.ckeditor', [ editor, event.data ] ); - }, 999 ); - - // Forward destroy event. - editor.on( 'destroy', function() - { - $element.trigger( 'destroy.ckeditor', [ editor ] ); - }); - - // Integrate with form submit. - if ( editor.config.autoUpdateElementJquery && $element.is( 'textarea' ) && $element.parents( 'form' ).length ) - { - var onSubmit = function() - { - $element.ckeditor( function() - { - editor.updateElement(); - }); - }; - - // Bind to submit event. - $element.parents( 'form' ).submit( onSubmit ); - - // Bind to form-pre-serialize from jQuery Forms plugin. - $element.parents( 'form' ).bind( 'form-pre-serialize', onSubmit ); - - // Unbind when editor destroyed. - $element.bind( 'destroy.ckeditor', function() - { - $element.parents( 'form' ).unbind( 'submit', onSubmit ); - $element.parents( 'form' ).unbind( 'form-pre-serialize', onSubmit ); - }); - } - - // Garbage collect on destroy. - editor.on( 'destroy', function() - { - $element.data( 'ckeditorInstance', null ); - }); - - // Remove lock. - $element.data( '_ckeditorInstanceLock', null ); - - // Fire instanceReady event. - $element.trigger( 'instanceReady.ckeditor', [ editor ] ); - - // Run given (first) code. - if ( callback ) - callback.apply( editor, [ element ] ); - }, 0 ); - }, null, null, 9999); - } - else - { - // Editor is already during creation process, bind our code to the event. - CKEDITOR.on( 'instanceReady', function( event ) - { - var editor = event.editor; - setTimeout( function() - { - // Delay bit more if editor is still not ready. - if ( !editor.element ) - { - setTimeout( arguments.callee, 100 ); - return; - } - - if ( editor.element.$ == element ) - { - // Run given code. - if ( callback ) - callback.apply( editor, [ element ] ); - } - }, 0 ); - }, null, null, 9999); - } - }); - return this; - } - }); - - // New val() method for objects. - if ( CKEDITOR.config.jqueryOverrideVal ) - { - jQuery.fn.val = CKEDITOR.tools.override( jQuery.fn.val, function( oldValMethod ) - { - /** - * CKEditor-aware val() method. - * - * Acts same as original jQuery val(), but for textareas which have CKEditor instances binded to them, method - * returns editor's content. It also works for settings values. - * - * @param oldValMethod - * @name jQuery.fn.val - */ - return function( newValue, forceNative ) - { - var isSetter = typeof newValue != 'undefined', - result; - - this.each( function() - { - var $this = jQuery( this ), - editor = $this.data( 'ckeditorInstance' ); - - if ( !forceNative && $this.is( 'textarea' ) && editor ) - { - if ( isSetter ) - editor.setData( newValue ); - else - { - result = editor.getData(); - // break; - return null; - } - } - else - { - if ( isSetter ) - oldValMethod.call( $this, newValue ); - else - { - result = oldValMethod.call( $this ); - // break; - return null; - } - } - - return true; - }); - return isSetter ? this : result; - }; - }); - } -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/_bootstrap.js b/Public/Resources/Javascript/ckeditor/_source/core/_bootstrap.js deleted file mode 100644 index f351ce6..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/_bootstrap.js +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview API initialization code. - */ - -(function() -{ - // Disable HC detaction in WebKit. (#5429) - if ( CKEDITOR.env.webkit ) - { - CKEDITOR.env.hc = false; - return; - } - - // Check is High Contrast is active by creating a temporary element with a - // background image. - - var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7, - useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7; - - var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) : - useBlank ? 'about:blank' : 'data:image/png;base64,'; - - var hcDetect = CKEDITOR.dom.element.createFromHtml( - '
        ', CKEDITOR.document ); - - hcDetect.appendTo( CKEDITOR.document.getHead() ); - - // Update CKEDITOR.env. - // Catch exception needed sometimes for FF. (#4230) - try - { - CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' ); - } - catch (e) - { - CKEDITOR.env.hc = false; - } - - if ( CKEDITOR.env.hc ) - CKEDITOR.env.cssClass += ' cke_hc'; - - hcDetect.remove(); -})(); - -// Load core plugins. -CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function() - { - CKEDITOR.status = 'loaded'; - CKEDITOR.fire( 'loaded' ); - - // Process all instances created by the "basic" implementation. - var pending = CKEDITOR._.pending; - if ( pending ) - { - delete CKEDITOR._.pending; - - for ( var i = 0 ; i < pending.length ; i++ ) - CKEDITOR.add( pending[ i ] ); - } - }); - -/* -TODO: Enable the following and check if effective. - -if ( CKEDITOR.env.ie ) -{ - // Remove IE mouse flickering on IE6 because of background images. - try - { - document.execCommand( 'BackgroundImageCache', false, true ); - } - catch (e) - { - // We have been reported about loading problems caused by the above - // line. For safety, let's just ignore errors. - } -} -*/ - -/** - * Fired when a CKEDITOR core object is fully loaded and ready for interaction. - * @name CKEDITOR#loaded - * @event - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/ajax.js b/Public/Resources/Javascript/ckeditor/_source/core/ajax.js deleted file mode 100644 index 078c15a..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/ajax.js +++ /dev/null @@ -1,143 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.ajax} object, which holds ajax methods for - * data loading. - */ - -/** - * Ajax methods for data loading. - * @namespace - * @example - */ -CKEDITOR.ajax = (function() -{ - var createXMLHttpRequest = function() - { - // In IE, using the native XMLHttpRequest for local files may throw - // "Access is Denied" errors. - if ( !CKEDITOR.env.ie || location.protocol != 'file:' ) - try { return new XMLHttpRequest(); } catch(e) {} - - try { return new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch (e) {} - try { return new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch (e) {} - - return null; - }; - - var checkStatus = function( xhr ) - { - // HTTP Status Codes: - // 2xx : Success - // 304 : Not Modified - // 0 : Returned when running locally (file://) - // 1223 : IE may change 204 to 1223 (see http://dev.jquery.com/ticket/1450) - - return ( xhr.readyState == 4 && - ( ( xhr.status >= 200 && xhr.status < 300 ) || - xhr.status == 304 || - xhr.status === 0 || - xhr.status == 1223 ) ); - }; - - var getResponseText = function( xhr ) - { - if ( checkStatus( xhr ) ) - return xhr.responseText; - return null; - }; - - var getResponseXml = function( xhr ) - { - if ( checkStatus( xhr ) ) - { - var xml = xhr.responseXML; - return new CKEDITOR.xml( xml && xml.firstChild ? xml : xhr.responseText ); - } - return null; - }; - - var load = function( url, callback, getResponseFn ) - { - var async = !!callback; - - var xhr = createXMLHttpRequest(); - - if ( !xhr ) - return null; - - xhr.open( 'GET', url, async ); - - if ( async ) - { - // TODO: perform leak checks on this closure. - /** @ignore */ - xhr.onreadystatechange = function() - { - if ( xhr.readyState == 4 ) - { - callback( getResponseFn( xhr ) ); - xhr = null; - } - }; - } - - xhr.send(null); - - return async ? '' : getResponseFn( xhr ); - }; - - return /** @lends CKEDITOR.ajax */ { - - /** - * Loads data from an URL as plain text. - * @param {String} url The URL from which load data. - * @param {Function} [callback] A callback function to be called on - * data load. If not provided, the data will be loaded - * asynchronously, passing the data value the function on load. - * @returns {String} The loaded data. For asynchronous requests, an - * empty string. For invalid requests, null. - * @example - * // Load data synchronously. - * var data = CKEDITOR.ajax.load( 'somedata.txt' ); - * alert( data ); - * @example - * // Load data asynchronously. - * var data = CKEDITOR.ajax.load( 'somedata.txt', function( data ) - * { - * alert( data ); - * } ); - */ - load : function( url, callback ) - { - return load( url, callback, getResponseText ); - }, - - /** - * Loads data from an URL as XML. - * @param {String} url The URL from which load data. - * @param {Function} [callback] A callback function to be called on - * data load. If not provided, the data will be loaded - * asynchronously, passing the data value the function on load. - * @returns {CKEDITOR.xml} An XML object holding the loaded data. For asynchronous requests, an - * empty string. For invalid requests, null. - * @example - * // Load XML synchronously. - * var xml = CKEDITOR.ajax.loadXml( 'somedata.xml' ); - * alert( xml.getInnerXml( '//' ) ); - * @example - * // Load XML asynchronously. - * var data = CKEDITOR.ajax.loadXml( 'somedata.xml', function( xml ) - * { - * alert( xml.getInnerXml( '//' ) ); - * } ); - */ - loadXml : function( url, callback ) - { - return load( url, callback, getResponseXml ); - } - }; -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/ckeditor.js b/Public/Resources/Javascript/ckeditor/_source/core/ckeditor.js deleted file mode 100644 index 068da31..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/ckeditor.js +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Contains the third and last part of the {@link CKEDITOR} object - * definition. - */ - -// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic. -delete CKEDITOR.loadFullCore; - -/** - * Holds references to all editor instances created. The name of the properties - * in this object correspond to instance names, and their values contains the - * {@link CKEDITOR.editor} object representing them. - * @type {Object} - * @example - * alert( CKEDITOR.instances.editor1.name ); // "editor1" - */ -CKEDITOR.instances = {}; - -/** - * The document of the window holding the CKEDITOR object. - * @type {CKEDITOR.dom.document} - * @example - * alert( CKEDITOR.document.getBody().getName() ); // "body" - */ -CKEDITOR.document = new CKEDITOR.dom.document( document ); - -/** - * Adds an editor instance to the global {@link CKEDITOR} object. This function - * is available for internal use mainly. - * @param {CKEDITOR.editor} editor The editor instance to be added. - * @example - */ -CKEDITOR.add = function( editor ) -{ - CKEDITOR.instances[ editor.name ] = editor; - - editor.on( 'focus', function() - { - if ( CKEDITOR.currentInstance != editor ) - { - CKEDITOR.currentInstance = editor; - CKEDITOR.fire( 'currentInstance' ); - } - }); - - editor.on( 'blur', function() - { - if ( CKEDITOR.currentInstance == editor ) - { - CKEDITOR.currentInstance = null; - CKEDITOR.fire( 'currentInstance' ); - } - }); -}; - -/** - * Removes and editor instance from the global {@link CKEDITOR} object. his function - * is available for internal use mainly. - * @param {CKEDITOR.editor} editor The editor instance to be added. - * @example - */ -CKEDITOR.remove = function( editor ) -{ - delete CKEDITOR.instances[ editor.name ]; -}; - -/** - * Perform global clean up to free as much memory as possible - * when there are no instances left - */ -CKEDITOR.on( 'instanceDestroyed', function () - { - if ( CKEDITOR.tools.isEmpty( this.instances ) ) - CKEDITOR.fire( 'reset' ); - }); - -// Load the bootstrap script. -CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine - -// Tri-state constants. - -/** - * Used to indicate the ON or ACTIVE state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_ON = 1; - -/** - * Used to indicate the OFF or NON ACTIVE state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_OFF = 2; - -/** - * Used to indicate DISABLED state. - * @constant - * @example - */ -CKEDITOR.TRISTATE_DISABLED = 0; - -/** - * Fired when the CKEDITOR.currentInstance object reference changes. This may - * happen when setting the focus on different editor instances in the page. - * @name CKEDITOR#currentInstance - * @event - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/ckeditor_base.js b/Public/Resources/Javascript/ckeditor/_source/core/ckeditor_base.js deleted file mode 100644 index c919816..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/ckeditor_base.js +++ /dev/null @@ -1,193 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Contains the first and essential part of the {@link CKEDITOR} - * object definition. - */ - -// #### Compressed Code -// Must be updated on changes in the script, as well as updated in the -// ckeditor_source.js and ckeditor_basic_source.js files. - -// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.4',rev:'5825',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})(); - -// #### Raw code -// ATTENTION: read the above "Compressed Code" notes when changing this code. - -if ( !window.CKEDITOR ) -{ - /** - * This is the API entry point. The entire CKEditor code runs under this object. - * @name CKEDITOR - * @namespace - * @example - */ - window.CKEDITOR = (function() - { - var CKEDITOR = - /** @lends CKEDITOR */ - { - - /** - * A constant string unique for each release of CKEditor. Its value - * is used, by default, to build the URL for all resources loaded - * by the editor code, guaranteing clean cache results when - * upgrading. - * @type String - * @example - * alert( CKEDITOR.timestamp ); // e.g. '87dm' - */ - // The production implementation contains a fixed timestamp, unique - // for each release, generated by the releaser. - // (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122) - timestamp : 'A7HG4HT', - - /** - * Contains the CKEditor version number. - * @type String - * @example - * alert( CKEDITOR.version ); // e.g. 'CKEditor 3.0 Beta' - */ - version : '3.4', - - /** - * Contains the CKEditor revision number. - * Revision number is incremented automatically after each modification of CKEditor source code. - * @type String - * @example - * alert( CKEDITOR.revision ); // e.g. '3975' - */ - revision : '5825', - - /** - * Private object used to hold core stuff. It should not be used out of - * the API code as properties defined here may change at any time - * without notice. - * @private - */ - _ : {}, - - /** - * Indicates the API loading status. The following status are available: - *
          - *
        • unloaded: the API is not yet loaded.
        • - *
        • basic_loaded: the basic API features are available.
        • - *
        • basic_ready: the basic API is ready to load the full core code.
        • - *
        • loading: the full API is being loaded.
        • - *
        • ready: the API can be fully used.
        • - *
        - * @type String - * @example - * if ( CKEDITOR.status == 'ready' ) - * { - * // The API can now be fully used. - * } - */ - status : 'unloaded', - - /** - * Contains the full URL for the CKEditor installation directory. - * It's possible to manually provide the base path by setting a - * global variable named CKEDITOR_BASEPATH. This global variable - * must be set "before" the editor script loading. - * @type String - * @example - * alert( CKEDITOR.basePath ); // "http://www.example.com/ckeditor/" (e.g.) - */ - basePath : (function() - { - // ATTENTION: fixes on this code must be ported to - // var basePath in "core/loader.js". - - // Find out the editor directory path, based on its ")' ); - } - } - - return $ && new CKEDITOR.dom.document( $.contentWindow.document ); - }, - - /** - * Copy all the attributes from one node to the other, kinda like a clone - * skipAttributes is an object with the attributes that must NOT be copied. - * @param {CKEDITOR.dom.element} dest The destination element. - * @param {Object} skipAttributes A dictionary of attributes to skip. - * @example - */ - copyAttributes : function( dest, skipAttributes ) - { - var attributes = this.$.attributes; - skipAttributes = skipAttributes || {}; - - for ( var n = 0 ; n < attributes.length ; n++ ) - { - var attribute = attributes[n]; - - // Lowercase attribute name hard rule is broken for - // some attribute on IE, e.g. CHECKED. - var attrName = attribute.nodeName.toLowerCase(), - attrValue; - - // We can set the type only once, so do it with the proper value, not copying it. - if ( attrName in skipAttributes ) - continue; - - if ( attrName == 'checked' && ( attrValue = this.getAttribute( attrName ) ) ) - dest.setAttribute( attrName, attrValue ); - // IE BUG: value attribute is never specified even if it exists. - else if ( attribute.specified || - ( CKEDITOR.env.ie && attribute.nodeValue && attrName == 'value' ) ) - { - attrValue = this.getAttribute( attrName ); - if ( attrValue === null ) - attrValue = attribute.nodeValue; - - dest.setAttribute( attrName, attrValue ); - } - } - - // The style: - if ( this.$.style.cssText !== '' ) - dest.$.style.cssText = this.$.style.cssText; - }, - - /** - * Changes the tag name of the current element. - * @param {String} newTag The new tag for the element. - */ - renameNode : function( newTag ) - { - // If it's already correct exit here. - if ( this.getName() == newTag ) - return; - - var doc = this.getDocument(); - - // Create the new node. - var newNode = new CKEDITOR.dom.element( newTag, doc ); - - // Copy all attributes. - this.copyAttributes( newNode ); - - // Move children to the new node. - this.moveChildren( newNode ); - - // Replace the node. - this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ ); - newNode.$._cke_expando = this.$._cke_expando; - this.$ = newNode.$; - }, - - /** - * Gets a DOM tree descendant under the current node. - * @param {Array|Number} indices The child index or array of child indices under the node. - * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist. - * @example - * var strong = p.getChild(0); - */ - getChild : function( indices ) - { - var rawNode = this.$; - - if ( !indices.slice ) - rawNode = rawNode.childNodes[ indices ]; - else - { - while ( indices.length > 0 && rawNode ) - rawNode = rawNode.childNodes[ indices.shift() ]; - } - - return rawNode ? new CKEDITOR.dom.node( rawNode ) : null; - }, - - getChildCount : function() - { - return this.$.childNodes.length; - }, - - disableContextMenu : function() - { - this.on( 'contextmenu', function( event ) - { - // Cancel the browser context menu. - if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) ) - event.data.preventDefault(); - } ); - } - }); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/elementpath.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/elementpath.js deleted file mode 100644 index 3c74a92..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/elementpath.js +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - // Elements that may be considered the "Block boundary" in an element path. - var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1 }; - - // Elements that may be considered the "Block limit" in an element path. - var pathBlockLimitElements = { body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1 }; - - // Check if an element contains any block element. - var checkHasBlock = function( element ) - { - var childNodes = element.getChildren(); - - for ( var i = 0, count = childNodes.count() ; i < count ; i++ ) - { - var child = childNodes.getItem( i ); - - if ( child.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$block[ child.getName() ] ) - return true; - } - - return false; - }; - - CKEDITOR.dom.elementPath = function( lastNode ) - { - var block = null; - var blockLimit = null; - var elements = []; - - var e = lastNode; - - while ( e ) - { - if ( e.type == CKEDITOR.NODE_ELEMENT ) - { - if ( !this.lastElement ) - this.lastElement = e; - - var elementName = e.getName(); - if ( CKEDITOR.env.ie && e.$.scopeName != 'HTML' ) - elementName = e.$.scopeName.toLowerCase() + ':' + elementName; - - if ( !blockLimit ) - { - if ( !block && pathBlockElements[ elementName ] ) - block = e; - - if ( pathBlockLimitElements[ elementName ] ) - { - // DIV is considered the Block, if no block is available (#525) - // and if it doesn't contain other blocks. - if ( !block && elementName == 'div' && !checkHasBlock( e ) ) - block = e; - else - blockLimit = e; - } - } - - elements.push( e ); - - if ( elementName == 'body' ) - break; - } - e = e.getParent(); - } - - this.block = block; - this.blockLimit = blockLimit; - this.elements = elements; - }; -})(); - -CKEDITOR.dom.elementPath.prototype = -{ - /** - * Compares this element path with another one. - * @param {CKEDITOR.dom.elementPath} otherPath The elementPath object to be - * compared with this one. - * @returns {Boolean} "true" if the paths are equal, containing the same - * number of elements and the same elements in the same order. - */ - compare : function( otherPath ) - { - var thisElements = this.elements; - var otherElements = otherPath && otherPath.elements; - - if ( !otherElements || thisElements.length != otherElements.length ) - return false; - - for ( var i = 0 ; i < thisElements.length ; i++ ) - { - if ( !thisElements[ i ].equals( otherElements[ i ] ) ) - return false; - } - - return true; - }, - - contains : function( tagNames ) - { - var elements = this.elements; - for ( var i = 0 ; i < elements.length ; i++ ) - { - if ( elements[ i ].getName() in tagNames ) - return elements[ i ]; - } - - return null; - } -}; diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/event.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/event.js deleted file mode 100644 index cf7d66c..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/event.js +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.event} class, which - * represents the a native DOM event object. - */ - -/** - * Represents a native DOM event object. - * @constructor - * @param {Object} domEvent A native DOM event object. - * @example - */ -CKEDITOR.dom.event = function( domEvent ) -{ - /** - * The native DOM event object represented by this class instance. - * @type Object - * @example - */ - this.$ = domEvent; -}; - -CKEDITOR.dom.event.prototype = -{ - /** - * Gets the key code associated to the event. - * @returns {Number} The key code. - * @example - * alert( event.getKey() ); "65" is "a" has been pressed - */ - getKey : function() - { - return this.$.keyCode || this.$.which; - }, - - /** - * Gets a number represeting the combination of the keys pressed during the - * event. It is the sum with the current key code and the {@link CKEDITOR.CTRL}, - * {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants. - * @returns {Number} The number representing the keys combination. - * @example - * alert( event.getKeystroke() == 65 ); // "a" key - * alert( event.getKeystroke() == CKEDITOR.CTRL + 65 ); // CTRL + "a" key - * alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 ); // CTRL + SHIFT + "a" key - */ - getKeystroke : function() - { - var keystroke = this.getKey(); - - if ( this.$.ctrlKey || this.$.metaKey ) - keystroke += CKEDITOR.CTRL; - - if ( this.$.shiftKey ) - keystroke += CKEDITOR.SHIFT; - - if ( this.$.altKey ) - keystroke += CKEDITOR.ALT; - - return keystroke; - }, - - /** - * Prevents the original behavior of the event to happen. It can optionally - * stop propagating the event in the event chain. - * @param {Boolean} [stopPropagation] Stop propagating this event in the - * event chain. - * @example - * var element = CKEDITOR.document.getById( 'myElement' ); - * element.on( 'click', function( ev ) - * { - * // The DOM event object is passed by the "data" property. - * var domEvent = ev.data; - * // Prevent the click to chave any effect in the element. - * domEvent.preventDefault(); - * }); - */ - preventDefault : function( stopPropagation ) - { - var $ = this.$; - if ( $.preventDefault ) - $.preventDefault(); - else - $.returnValue = false; - - if ( stopPropagation ) - this.stopPropagation(); - }, - - stopPropagation : function() - { - var $ = this.$; - if ( $.stopPropagation ) - $.stopPropagation(); - else - $.cancelBubble = true; - }, - - /** - * Returns the DOM node where the event was targeted to. - * @returns {CKEDITOR.dom.node} The target DOM node. - * @example - * var element = CKEDITOR.document.getById( 'myElement' ); - * element.on( 'click', function( ev ) - * { - * // The DOM event object is passed by the "data" property. - * var domEvent = ev.data; - * // Add a CSS class to the event target. - * domEvent.getTarget().addClass( 'clicked' ); - * }); - */ - - getTarget : function() - { - var rawNode = this.$.target || this.$.srcElement; - return rawNode ? new CKEDITOR.dom.node( rawNode ) : null; - } -}; - -/** - * CTRL key (1000). - * @constant - * @example - */ -CKEDITOR.CTRL = 1000; - -/** - * SHIFT key (2000). - * @constant - * @example - */ -CKEDITOR.SHIFT = 2000; - -/** - * ALT key (4000). - * @constant - * @example - */ -CKEDITOR.ALT = 4000; diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/node.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/node.js deleted file mode 100644 index 02a726c..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/node.js +++ /dev/null @@ -1,683 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.node} class, which is the base - * class for classes that represent DOM nodes. - */ - -/** - * Base class for classes representing DOM nodes. This constructor may return - * and instance of classes that inherits this class, like - * {@link CKEDITOR.dom.element} or {@link CKEDITOR.dom.text}. - * @augments CKEDITOR.dom.domObject - * @param {Object} domNode A native DOM node. - * @constructor - * @see CKEDITOR.dom.element - * @see CKEDITOR.dom.text - * @example - */ -CKEDITOR.dom.node = function( domNode ) -{ - if ( domNode ) - { - switch ( domNode.nodeType ) - { - // Safari don't consider document as element node type. (#3389) - case CKEDITOR.NODE_DOCUMENT : - return new CKEDITOR.dom.document( domNode ); - - case CKEDITOR.NODE_ELEMENT : - return new CKEDITOR.dom.element( domNode ); - - case CKEDITOR.NODE_TEXT : - return new CKEDITOR.dom.text( domNode ); - } - - // Call the base constructor. - CKEDITOR.dom.domObject.call( this, domNode ); - } - - return this; -}; - -CKEDITOR.dom.node.prototype = new CKEDITOR.dom.domObject(); - -/** - * Element node type. - * @constant - * @example - */ -CKEDITOR.NODE_ELEMENT = 1; - -/** - * Document node type. - * @constant - * @example - */ -CKEDITOR.NODE_DOCUMENT = 9; - -/** - * Text node type. - * @constant - * @example - */ -CKEDITOR.NODE_TEXT = 3; - -/** - * Comment node type. - * @constant - * @example - */ -CKEDITOR.NODE_COMMENT = 8; - -CKEDITOR.NODE_DOCUMENT_FRAGMENT = 11; - -CKEDITOR.POSITION_IDENTICAL = 0; -CKEDITOR.POSITION_DISCONNECTED = 1; -CKEDITOR.POSITION_FOLLOWING = 2; -CKEDITOR.POSITION_PRECEDING = 4; -CKEDITOR.POSITION_IS_CONTAINED = 8; -CKEDITOR.POSITION_CONTAINS = 16; - -CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, - /** @lends CKEDITOR.dom.node.prototype */ - { - /** - * Makes this node child of another element. - * @param {CKEDITOR.dom.element} element The target element to which append - * this node. - * @returns {CKEDITOR.dom.element} The target element. - * @example - * var p = new CKEDITOR.dom.element( 'p' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.appendTo( p ); - * - * // result: "<p><strong></strong></p>" - */ - appendTo : function( element, toStart ) - { - element.append( this, toStart ); - return element; - }, - - clone : function( includeChildren, cloneId ) - { - var $clone = this.$.cloneNode( includeChildren ); - - if ( !cloneId ) - { - var removeIds = function( node ) - { - if ( node.nodeType != CKEDITOR.NODE_ELEMENT ) - return; - - node.removeAttribute( 'id', false ) ; - node.removeAttribute( '_cke_expando', false ) ; - - var childs = node.childNodes; - for ( var i=0 ; i < childs.length ; i++ ) - removeIds( childs[ i ] ); - }; - - // The "id" attribute should never be cloned to avoid duplication. - removeIds( $clone ); - } - - return new CKEDITOR.dom.node( $clone ); - }, - - hasPrevious : function() - { - return !!this.$.previousSibling; - }, - - hasNext : function() - { - return !!this.$.nextSibling; - }, - - /** - * Inserts this element after a node. - * @param {CKEDITOR.dom.node} node The that will preceed this element. - * @returns {CKEDITOR.dom.node} The node preceeding this one after - * insertion. - * @example - * var em = new CKEDITOR.dom.element( 'em' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.insertAfter( em ); - * - * // result: "<em></em><strong></strong>" - */ - insertAfter : function( node ) - { - node.$.parentNode.insertBefore( this.$, node.$.nextSibling ); - return node; - }, - - /** - * Inserts this element before a node. - * @param {CKEDITOR.dom.node} node The that will be after this element. - * @returns {CKEDITOR.dom.node} The node being inserted. - * @example - * var em = new CKEDITOR.dom.element( 'em' ); - * var strong = new CKEDITOR.dom.element( 'strong' ); - * strong.insertBefore( em ); - * - * // result: "<strong></strong><em></em>" - */ - insertBefore : function( node ) - { - node.$.parentNode.insertBefore( this.$, node.$ ); - return node; - }, - - insertBeforeMe : function( node ) - { - this.$.parentNode.insertBefore( node.$, this.$ ); - return node; - }, - - /** - * Retrieves a uniquely identifiable tree address for this node. - * The tree address returns is an array of integers, with each integer - * indicating a child index of a DOM node, starting from - * document.documentElement. - * - * For example, assuming is the second child from ( - * being the first), and we'd like to address the third child under the - * fourth child of body, the tree address returned would be: - * [1, 3, 2] - * - * The tree address cannot be used for finding back the DOM tree node once - * the DOM tree structure has been modified. - */ - getAddress : function( normalized ) - { - var address = []; - var $documentElement = this.getDocument().$.documentElement; - var node = this.$; - - while ( node && node != $documentElement ) - { - var parentNode = node.parentNode; - var currentIndex = -1; - - if ( parentNode ) - { - for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) - { - var candidate = parentNode.childNodes[i]; - - if ( normalized && - candidate.nodeType == 3 && - candidate.previousSibling && - candidate.previousSibling.nodeType == 3 ) - { - continue; - } - - currentIndex++; - - if ( candidate == node ) - break; - } - - address.unshift( currentIndex ); - } - - node = parentNode; - } - - return address; - }, - - /** - * Gets the document containing this element. - * @returns {CKEDITOR.dom.document} The document. - * @example - * var element = CKEDITOR.document.getById( 'example' ); - * alert( element.getDocument().equals( CKEDITOR.document ) ); // "true" - */ - getDocument : function() - { - var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); - - return ( - this.getDocument = function() - { - return document; - })(); - }, - - getIndex : function() - { - var $ = this.$; - - var currentNode = $.parentNode && $.parentNode.firstChild; - var currentIndex = -1; - - while ( currentNode ) - { - currentIndex++; - - if ( currentNode == $ ) - return currentIndex; - - currentNode = currentNode.nextSibling; - } - - return -1; - }, - - getNextSourceNode : function( startFromSibling, nodeType, guard ) - { - // If "guard" is a node, transform it in a function. - if ( guard && !guard.call ) - { - var guardNode = guard; - guard = function( node ) - { - return !node.equals( guardNode ); - }; - } - - var node = ( !startFromSibling && this.getFirst && this.getFirst() ), - parent; - - // Guarding when we're skipping the current element( no children or 'startFromSibling' ). - // send the 'moving out' signal even we don't actually dive into. - if ( !node ) - { - if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false ) - return null; - node = this.getNext(); - } - - while ( !node && ( parent = ( parent || this ).getParent() ) ) - { - // The guard check sends the "true" paramenter to indicate that - // we are moving "out" of the element. - if ( guard && guard( parent, true ) === false ) - return null; - - node = parent.getNext(); - } - - if ( !node ) - return null; - - if ( guard && guard( node ) === false ) - return null; - - if ( nodeType && nodeType != node.type ) - return node.getNextSourceNode( false, nodeType, guard ); - - return node; - }, - - getPreviousSourceNode : function( startFromSibling, nodeType, guard ) - { - if ( guard && !guard.call ) - { - var guardNode = guard; - guard = function( node ) - { - return !node.equals( guardNode ); - }; - } - - var node = ( !startFromSibling && this.getLast && this.getLast() ), - parent; - - // Guarding when we're skipping the current element( no children or 'startFromSibling' ). - // send the 'moving out' signal even we don't actually dive into. - if ( !node ) - { - if ( this.type == CKEDITOR.NODE_ELEMENT && guard && guard( this, true ) === false ) - return null; - node = this.getPrevious(); - } - - while ( !node && ( parent = ( parent || this ).getParent() ) ) - { - // The guard check sends the "true" paramenter to indicate that - // we are moving "out" of the element. - if ( guard && guard( parent, true ) === false ) - return null; - - node = parent.getPrevious(); - } - - if ( !node ) - return null; - - if ( guard && guard( node ) === false ) - return null; - - if ( nodeType && node.type != nodeType ) - return node.getPreviousSourceNode( false, nodeType, guard ); - - return node; - }, - - getPrevious : function( evaluator ) - { - var previous = this.$, retval; - do - { - previous = previous.previousSibling; - retval = previous && new CKEDITOR.dom.node( previous ); - } - while ( retval && evaluator && !evaluator( retval ) ) - return retval; - }, - - /** - * Gets the node that follows this element in its parent's child list. - * @param {Function} evaluator Filtering the result node. - * @returns {CKEDITOR.dom.node} The next node or null if not available. - * @example - * var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' ); - * var first = element.getFirst().getNext(); - * alert( first.getName() ); // "i" - */ - getNext : function( evaluator ) - { - var next = this.$, retval; - do - { - next = next.nextSibling; - retval = next && new CKEDITOR.dom.node( next ); - } - while ( retval && evaluator && !evaluator( retval ) ) - return retval; - }, - - /** - * Gets the parent element for this node. - * @returns {CKEDITOR.dom.element} The parent element. - * @example - * var node = editor.document.getBody().getFirst(); - * var parent = node.getParent(); - * alert( node.getName() ); // "body" - */ - getParent : function() - { - var parent = this.$.parentNode; - return ( parent && parent.nodeType == 1 ) ? new CKEDITOR.dom.node( parent ) : null; - }, - - getParents : function( closerFirst ) - { - var node = this; - var parents = []; - - do - { - parents[ closerFirst ? 'push' : 'unshift' ]( node ); - } - while ( ( node = node.getParent() ) ) - - return parents; - }, - - getCommonAncestor : function( node ) - { - if ( node.equals( this ) ) - return this; - - if ( node.contains && node.contains( this ) ) - return node; - - var start = this.contains ? this : this.getParent(); - - do - { - if ( start.contains( node ) ) - return start; - } - while ( ( start = start.getParent() ) ); - - return null; - }, - - getPosition : function( otherNode ) - { - var $ = this.$; - var $other = otherNode.$; - - if ( $.compareDocumentPosition ) - return $.compareDocumentPosition( $other ); - - // IE and Safari have no support for compareDocumentPosition. - - if ( $ == $other ) - return CKEDITOR.POSITION_IDENTICAL; - - // Only element nodes support contains and sourceIndex. - if ( this.type == CKEDITOR.NODE_ELEMENT && otherNode.type == CKEDITOR.NODE_ELEMENT ) - { - if ( $.contains ) - { - if ( $.contains( $other ) ) - return CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING; - - if ( $other.contains( $ ) ) - return CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING; - } - - if ( 'sourceIndex' in $ ) - { - return ( $.sourceIndex < 0 || $other.sourceIndex < 0 ) ? CKEDITOR.POSITION_DISCONNECTED : - ( $.sourceIndex < $other.sourceIndex ) ? CKEDITOR.POSITION_PRECEDING : - CKEDITOR.POSITION_FOLLOWING; - } - } - - // For nodes that don't support compareDocumentPosition, contains - // or sourceIndex, their "address" is compared. - - var addressOfThis = this.getAddress(), - addressOfOther = otherNode.getAddress(), - minLevel = Math.min( addressOfThis.length, addressOfOther.length ); - - // Determinate preceed/follow relationship. - for ( var i = 0 ; i <= minLevel - 1 ; i++ ) - { - if ( addressOfThis[ i ] != addressOfOther[ i ] ) - { - if ( i < minLevel ) - { - return addressOfThis[ i ] < addressOfOther[ i ] ? - CKEDITOR.POSITION_PRECEDING : CKEDITOR.POSITION_FOLLOWING; - } - break; - } - } - - // Determinate contains/contained relationship. - return ( addressOfThis.length < addressOfOther.length ) ? - CKEDITOR.POSITION_CONTAINS + CKEDITOR.POSITION_PRECEDING : - CKEDITOR.POSITION_IS_CONTAINED + CKEDITOR.POSITION_FOLLOWING; - }, - - /** - * Gets the closes ancestor node of a specified node name. - * @param {String} name Node name of ancestor node. - * @param {Boolean} includeSelf (Optional) Whether to include the current - * node in the calculation or not. - * @returns {CKEDITOR.dom.node} Ancestor node. - */ - getAscendant : function( name, includeSelf ) - { - var $ = this.$; - - if ( !includeSelf ) - $ = $.parentNode; - - while ( $ ) - { - if ( $.nodeName && $.nodeName.toLowerCase() == name ) - return new CKEDITOR.dom.node( $ ); - - $ = $.parentNode; - } - return null; - }, - - hasAscendant : function( name, includeSelf ) - { - var $ = this.$; - - if ( !includeSelf ) - $ = $.parentNode; - - while ( $ ) - { - if ( $.nodeName && $.nodeName.toLowerCase() == name ) - return true; - - $ = $.parentNode; - } - return false; - }, - - move : function( target, toStart ) - { - target.append( this.remove(), toStart ); - }, - - /** - * Removes this node from the document DOM. - * @param {Boolean} [preserveChildren] Indicates that the children - * elements must remain in the document, removing only the outer - * tags. - * @example - * var element = CKEDITOR.dom.element.getById( 'MyElement' ); - * element.remove(); - */ - remove : function( preserveChildren ) - { - var $ = this.$; - var parent = $.parentNode; - - if ( parent ) - { - if ( preserveChildren ) - { - // Move all children before the node. - for ( var child ; ( child = $.firstChild ) ; ) - { - parent.insertBefore( $.removeChild( child ), $ ); - } - } - - parent.removeChild( $ ); - } - - return this; - }, - - replace : function( nodeToReplace ) - { - this.insertBefore( nodeToReplace ); - nodeToReplace.remove(); - }, - - trim : function() - { - this.ltrim(); - this.rtrim(); - }, - - ltrim : function() - { - var child; - while ( this.getFirst && ( child = this.getFirst() ) ) - { - if ( child.type == CKEDITOR.NODE_TEXT ) - { - var trimmed = CKEDITOR.tools.ltrim( child.getText() ), - originalLength = child.getLength(); - - if ( !trimmed ) - { - child.remove(); - continue; - } - else if ( trimmed.length < originalLength ) - { - child.split( originalLength - trimmed.length ); - - // IE BUG: child.remove() may raise JavaScript errors here. (#81) - this.$.removeChild( this.$.firstChild ); - } - } - break; - } - }, - - rtrim : function() - { - var child; - while ( this.getLast && ( child = this.getLast() ) ) - { - if ( child.type == CKEDITOR.NODE_TEXT ) - { - var trimmed = CKEDITOR.tools.rtrim( child.getText() ), - originalLength = child.getLength(); - - if ( !trimmed ) - { - child.remove(); - continue; - } - else if ( trimmed.length < originalLength ) - { - child.split( trimmed.length ); - - // IE BUG: child.getNext().remove() may raise JavaScript errors here. - // (#81) - this.$.lastChild.parentNode.removeChild( this.$.lastChild ); - } - } - break; - } - - if ( !CKEDITOR.env.ie && !CKEDITOR.env.opera ) - { - child = this.$.lastChild; - - if ( child && child.type == 1 && child.nodeName.toLowerCase() == 'br' ) - { - // Use "eChildNode.parentNode" instead of "node" to avoid IE bug (#324). - child.parentNode.removeChild( child ) ; - } - } - }, - - isReadOnly : function() - { - var current = this; - while( current ) - { - if ( current.type == CKEDITOR.NODE_ELEMENT ) - { - if ( current.is( 'body' ) || current.getCustomData( '_cke_notReadOnly' ) ) - break; - - if ( current.getAttribute( 'contentEditable' ) == 'false' ) - return current; - else if ( current.getAttribute( 'contentEditable' ) == 'true' ) - break; - } - current = current.getParent(); - } - - return false; - } - } -); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/nodelist.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/nodelist.js deleted file mode 100644 index 7e82ba1..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/nodelist.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dom.nodeList = function( nativeList ) -{ - this.$ = nativeList; -}; - -CKEDITOR.dom.nodeList.prototype = -{ - count : function() - { - return this.$.length; - }, - - getItem : function( index ) - { - var $node = this.$[ index ]; - return $node ? new CKEDITOR.dom.node( $node ) : null; - } -}; diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/range.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/range.js deleted file mode 100644 index 0146f6a..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/range.js +++ /dev/null @@ -1,1880 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dom.range = function( document ) -{ - this.startContainer = null; - this.startOffset = null; - this.endContainer = null; - this.endOffset = null; - this.collapsed = true; - - this.document = document; -}; - -(function() -{ - // Updates the "collapsed" property for the given range object. - var updateCollapsed = function( range ) - { - range.collapsed = ( - range.startContainer && - range.endContainer && - range.startContainer.equals( range.endContainer ) && - range.startOffset == range.endOffset ); - }; - - // This is a shared function used to delete, extract and clone the range - // contents. - // V2 - var execContentsAction = function( range, action, docFrag ) - { - range.optimizeBookmark(); - - var startNode = range.startContainer; - var endNode = range.endContainer; - - var startOffset = range.startOffset; - var endOffset = range.endOffset; - - var removeStartNode; - var removeEndNode; - - // For text containers, we must simply split the node and point to the - // second part. The removal will be handled by the rest of the code . - if ( endNode.type == CKEDITOR.NODE_TEXT ) - endNode = endNode.split( endOffset ); - else - { - // If the end container has children and the offset is pointing - // to a child, then we should start from it. - if ( endNode.getChildCount() > 0 ) - { - // If the offset points after the last node. - if ( endOffset >= endNode.getChildCount() ) - { - // Let's create a temporary node and mark it for removal. - endNode = endNode.append( range.document.createText( '' ) ); - removeEndNode = true; - } - else - endNode = endNode.getChild( endOffset ); - } - } - - // For text containers, we must simply split the node. The removal will - // be handled by the rest of the code . - if ( startNode.type == CKEDITOR.NODE_TEXT ) - { - startNode.split( startOffset ); - - // In cases the end node is the same as the start node, the above - // splitting will also split the end, so me must move the end to - // the second part of the split. - if ( startNode.equals( endNode ) ) - endNode = startNode.getNext(); - } - else - { - // If the start container has children and the offset is pointing - // to a child, then we should start from its previous sibling. - - // If the offset points to the first node, we don't have a - // sibling, so let's use the first one, but mark it for removal. - if ( !startOffset ) - { - // Let's create a temporary node and mark it for removal. - startNode = startNode.getFirst().insertBeforeMe( range.document.createText( '' ) ); - removeStartNode = true; - } - else if ( startOffset >= startNode.getChildCount() ) - { - // Let's create a temporary node and mark it for removal. - startNode = startNode.append( range.document.createText( '' ) ); - removeStartNode = true; - } - else - startNode = startNode.getChild( startOffset ).getPrevious(); - } - - // Get the parent nodes tree for the start and end boundaries. - var startParents = startNode.getParents(); - var endParents = endNode.getParents(); - - // Compare them, to find the top most siblings. - var i, topStart, topEnd; - - for ( i = 0 ; i < startParents.length ; i++ ) - { - topStart = startParents[ i ]; - topEnd = endParents[ i ]; - - // The compared nodes will match until we find the top most - // siblings (different nodes that have the same parent). - // "i" will hold the index in the parents array for the top - // most element. - if ( !topStart.equals( topEnd ) ) - break; - } - - var clone = docFrag, levelStartNode, levelClone, currentNode, currentSibling; - - // Remove all successive sibling nodes for every node in the - // startParents tree. - for ( var j = i ; j < startParents.length ; j++ ) - { - levelStartNode = startParents[j]; - - // For Extract and Clone, we must clone this level. - if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone() ); - - currentNode = levelStartNode.getNext(); - - while ( currentNode ) - { - // Stop processing when the current node matches a node in the - // endParents tree or if it is the endNode. - if ( currentNode.equals( endParents[ j ] ) || currentNode.equals( endNode ) ) - break; - - // Cache the next sibling. - currentSibling = currentNode.getNext(); - - // If cloning, just clone it. - if ( action == 2 ) // 2 = Clone - clone.append( currentNode.clone( true ) ); - else - { - // Both Delete and Extract will remove the node. - currentNode.remove(); - - // When Extracting, move the removed node to the docFrag. - if ( action == 1 ) // 1 = Extract - clone.append( currentNode ); - } - - currentNode = currentSibling; - } - - if ( clone ) - clone = levelClone; - } - - clone = docFrag; - - // Remove all previous sibling nodes for every node in the - // endParents tree. - for ( var k = i ; k < endParents.length ; k++ ) - { - levelStartNode = endParents[ k ]; - - // For Extract and Clone, we must clone this level. - if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone() ); - - // The processing of siblings may have already been done by the parent. - if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode ) - { - currentNode = levelStartNode.getPrevious(); - - while ( currentNode ) - { - // Stop processing when the current node matches a node in the - // startParents tree or if it is the startNode. - if ( currentNode.equals( startParents[ k ] ) || currentNode.equals( startNode ) ) - break; - - // Cache the next sibling. - currentSibling = currentNode.getPrevious(); - - // If cloning, just clone it. - if ( action == 2 ) // 2 = Clone - clone.$.insertBefore( currentNode.$.cloneNode( true ), clone.$.firstChild ) ; - else - { - // Both Delete and Extract will remove the node. - currentNode.remove(); - - // When Extracting, mode the removed node to the docFrag. - if ( action == 1 ) // 1 = Extract - clone.$.insertBefore( currentNode.$, clone.$.firstChild ); - } - - currentNode = currentSibling; - } - } - - if ( clone ) - clone = levelClone; - } - - if ( action == 2 ) // 2 = Clone. - { - // No changes in the DOM should be done, so fix the split text (if any). - - var startTextNode = range.startContainer; - if ( startTextNode.type == CKEDITOR.NODE_TEXT ) - { - startTextNode.$.data += startTextNode.$.nextSibling.data; - startTextNode.$.parentNode.removeChild( startTextNode.$.nextSibling ); - } - - var endTextNode = range.endContainer; - if ( endTextNode.type == CKEDITOR.NODE_TEXT && endTextNode.$.nextSibling ) - { - endTextNode.$.data += endTextNode.$.nextSibling.data; - endTextNode.$.parentNode.removeChild( endTextNode.$.nextSibling ); - } - } - else - { - // Collapse the range. - - // If a node has been partially selected, collapse the range between - // topStart and topEnd. Otherwise, simply collapse it to the start. (W3C specs). - if ( topStart && topEnd && ( startNode.$.parentNode != topStart.$.parentNode || endNode.$.parentNode != topEnd.$.parentNode ) ) - { - var endIndex = topEnd.getIndex(); - - // If the start node is to be removed, we must correct the - // index to reflect the removal. - if ( removeStartNode && topEnd.$.parentNode == startNode.$.parentNode ) - endIndex--; - - range.setStart( topEnd.getParent(), endIndex ); - } - - // Collapse it to the start. - range.collapse( true ); - } - - // Cleanup any marked node. - if ( removeStartNode ) - startNode.remove(); - - if ( removeEndNode && endNode.$.parentNode ) - endNode.remove(); - }; - - var inlineChildReqElements = { abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1 }; - - // Creates the appropriate node evaluator for the dom walker used inside - // check(Start|End)OfBlock. - function getCheckStartEndBlockEvalFunction( isStart ) - { - var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ); - return function( node ) - { - // First ignore bookmark nodes. - if ( bookmarkEvaluator( node ) ) - return true; - - if ( node.type == CKEDITOR.NODE_TEXT ) - { - // If there's any visible text, then we're not at the start. - if ( CKEDITOR.tools.trim( node.getText() ).length ) - return false; - } - else if ( node.type == CKEDITOR.NODE_ELEMENT ) - { - // If there are non-empty inline elements (e.g. ), then we're not - // at the start. - if ( !inlineChildReqElements[ node.getName() ] ) - { - // If we're working at the end-of-block, forgive the first
        in non-IE - // browsers. - if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr ) - hadBr = true; - else - return false; - } - } - return true; - }; - } - - // Evaluator for CKEDITOR.dom.element::checkBoundaryOfElement, reject any - // text node and non-empty elements unless it's being bookmark text. - function elementBoundaryEval( node ) - { - // Reject any text node unless it's being bookmark - // OR it's spaces. (#3883) - return node.type != CKEDITOR.NODE_TEXT - && node.getName() in CKEDITOR.dtd.$removeEmpty - || !CKEDITOR.tools.trim( node.getText() ) - || node.getParent().hasAttribute( '_fck_bookmark' ); - } - - var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(), - bookmarkEval = new CKEDITOR.dom.walker.bookmark(); - - function nonWhitespaceOrBookmarkEval( node ) - { - // Whitespaces and bookmark nodes are to be ignored. - return !whitespaceEval( node ) && !bookmarkEval( node ); - } - - CKEDITOR.dom.range.prototype = - { - clone : function() - { - var clone = new CKEDITOR.dom.range( this.document ); - - clone.startContainer = this.startContainer; - clone.startOffset = this.startOffset; - clone.endContainer = this.endContainer; - clone.endOffset = this.endOffset; - clone.collapsed = this.collapsed; - - return clone; - }, - - collapse : function( toStart ) - { - if ( toStart ) - { - this.endContainer = this.startContainer; - this.endOffset = this.startOffset; - } - else - { - this.startContainer = this.endContainer; - this.startOffset = this.endOffset; - } - - this.collapsed = true; - }, - - // The selection may be lost when cloning (due to the splitText() call). - cloneContents : function() - { - var docFrag = new CKEDITOR.dom.documentFragment( this.document ); - - if ( !this.collapsed ) - execContentsAction( this, 2, docFrag ); - - return docFrag; - }, - - deleteContents : function() - { - if ( this.collapsed ) - return; - - execContentsAction( this, 0 ); - }, - - extractContents : function() - { - var docFrag = new CKEDITOR.dom.documentFragment( this.document ); - - if ( !this.collapsed ) - execContentsAction( this, 1, docFrag ); - - return docFrag; - }, - - /** - * Creates a bookmark object, which can be later used to restore the - * range by using the moveToBookmark function. - * This is an "intrusive" way to create a bookmark. It includes tags - * in the range boundaries. The advantage of it is that it is possible to - * handle DOM mutations when moving back to the bookmark. - * Attention: the inclusion of nodes in the DOM is a design choice and - * should not be changed as there are other points in the code that may be - * using those nodes to perform operations. See GetBookmarkNode. - * @param {Boolean} [serializable] Indicates that the bookmark nodes - * must contain ids, which can be used to restore the range even - * when these nodes suffer mutations (like a clonation or innerHTML - * change). - * @returns {Object} And object representing a bookmark. - */ - createBookmark : function( serializable ) - { - var startNode, endNode; - var baseId; - var clone; - var collapsed = this.collapsed; - - startNode = this.document.createElement( 'span' ); - startNode.setAttribute( '_fck_bookmark', 1 ); - startNode.setStyle( 'display', 'none' ); - - // For IE, it must have something inside, otherwise it may be - // removed during DOM operations. - startNode.setHtml( ' ' ); - - if ( serializable ) - { - baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber(); - startNode.setAttribute( 'id', baseId + 'S' ); - } - - // If collapsed, the endNode will not be created. - if ( !collapsed ) - { - endNode = startNode.clone(); - endNode.setHtml( ' ' ); - - if ( serializable ) - endNode.setAttribute( 'id', baseId + 'E' ); - - clone = this.clone(); - clone.collapse(); - clone.insertNode( endNode ); - } - - clone = this.clone(); - clone.collapse( true ); - clone.insertNode( startNode ); - - // Update the range position. - if ( endNode ) - { - this.setStartAfter( startNode ); - this.setEndBefore( endNode ); - } - else - this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END ); - - return { - startNode : serializable ? baseId + 'S' : startNode, - endNode : serializable ? baseId + 'E' : endNode, - serializable : serializable, - collapsed : collapsed - }; - }, - - /** - * Creates a "non intrusive" and "mutation sensible" bookmark. This - * kind of bookmark should be used only when the DOM is supposed to - * remain stable after its creation. - * @param {Boolean} [normalized] Indicates that the bookmark must - * normalized. When normalized, the successive text nodes are - * considered a single node. To sucessful load a normalized - * bookmark, the DOM tree must be also normalized before calling - * moveToBookmark. - * @returns {Object} An object representing the bookmark. - */ - createBookmark2 : function( normalized ) - { - var startContainer = this.startContainer, - endContainer = this.endContainer; - - var startOffset = this.startOffset, - endOffset = this.endOffset; - - var collapsed = this.collapsed; - - var child, previous; - - // If there is no range then get out of here. - // It happens on initial load in Safari #962 and if the editor it's - // hidden also in Firefox - if ( !startContainer || !endContainer ) - return { start : 0, end : 0 }; - - if ( normalized ) - { - // Find out if the start is pointing to a text node that will - // be normalized. - if ( startContainer.type == CKEDITOR.NODE_ELEMENT ) - { - child = startContainer.getChild( startOffset ); - - // In this case, move the start information to that text - // node. - if ( child && child.type == CKEDITOR.NODE_TEXT - && startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) - { - startContainer = child; - startOffset = 0; - } - } - - // Normalize the start. - while ( startContainer.type == CKEDITOR.NODE_TEXT - && ( previous = startContainer.getPrevious() ) - && previous.type == CKEDITOR.NODE_TEXT ) - { - startContainer = previous; - startOffset += previous.getLength(); - } - - // Process the end only if not normalized. - if ( !collapsed ) - { - // Find out if the start is pointing to a text node that - // will be normalized. - if ( endContainer.type == CKEDITOR.NODE_ELEMENT ) - { - child = endContainer.getChild( endOffset ); - - // In this case, move the start information to that - // text node. - if ( child && child.type == CKEDITOR.NODE_TEXT - && endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) - { - endContainer = child; - endOffset = 0; - } - } - - // Normalize the end. - while ( endContainer.type == CKEDITOR.NODE_TEXT - && ( previous = endContainer.getPrevious() ) - && previous.type == CKEDITOR.NODE_TEXT ) - { - endContainer = previous; - endOffset += previous.getLength(); - } - } - } - - return { - start : startContainer.getAddress( normalized ), - end : collapsed ? null : endContainer.getAddress( normalized ), - startOffset : startOffset, - endOffset : endOffset, - normalized : normalized, - collapsed : collapsed, - is2 : true // It's a createBookmark2 bookmark. - }; - }, - - moveToBookmark : function( bookmark ) - { - if ( bookmark.is2 ) // Created with createBookmark2(). - { - // Get the start information. - var startContainer = this.document.getByAddress( bookmark.start, bookmark.normalized ), - startOffset = bookmark.startOffset; - - // Get the end information. - var endContainer = bookmark.end && this.document.getByAddress( bookmark.end, bookmark.normalized ), - endOffset = bookmark.endOffset; - - // Set the start boundary. - this.setStart( startContainer, startOffset ); - - // Set the end boundary. If not available, collapse it. - if ( endContainer ) - this.setEnd( endContainer, endOffset ); - else - this.collapse( true ); - } - else // Created with createBookmark(). - { - var serializable = bookmark.serializable, - startNode = serializable ? this.document.getById( bookmark.startNode ) : bookmark.startNode, - endNode = serializable ? this.document.getById( bookmark.endNode ) : bookmark.endNode; - - // Set the range start at the bookmark start node position. - this.setStartBefore( startNode ); - - // Remove it, because it may interfere in the setEndBefore call. - startNode.remove(); - - // Set the range end at the bookmark end node position, or simply - // collapse it if it is not available. - if ( endNode ) - { - this.setEndBefore( endNode ); - endNode.remove(); - } - else - this.collapse( true ); - } - }, - - getBoundaryNodes : function() - { - var startNode = this.startContainer, - endNode = this.endContainer, - startOffset = this.startOffset, - endOffset = this.endOffset, - childCount; - - if ( startNode.type == CKEDITOR.NODE_ELEMENT ) - { - childCount = startNode.getChildCount(); - if ( childCount > startOffset ) - startNode = startNode.getChild( startOffset ); - else if ( childCount < 1 ) - startNode = startNode.getPreviousSourceNode(); - else // startOffset > childCount but childCount is not 0 - { - // Try to take the node just after the current position. - startNode = startNode.$; - while ( startNode.lastChild ) - startNode = startNode.lastChild; - startNode = new CKEDITOR.dom.node( startNode ); - - // Normally we should take the next node in DFS order. But it - // is also possible that we've already reached the end of - // document. - startNode = startNode.getNextSourceNode() || startNode; - } - } - if ( endNode.type == CKEDITOR.NODE_ELEMENT ) - { - childCount = endNode.getChildCount(); - if ( childCount > endOffset ) - endNode = endNode.getChild( endOffset ).getPreviousSourceNode( true ); - else if ( childCount < 1 ) - endNode = endNode.getPreviousSourceNode(); - else // endOffset > childCount but childCount is not 0 - { - // Try to take the node just before the current position. - endNode = endNode.$; - while ( endNode.lastChild ) - endNode = endNode.lastChild; - endNode = new CKEDITOR.dom.node( endNode ); - } - } - - // Sometimes the endNode will come right before startNode for collapsed - // ranges. Fix it. (#3780) - if ( startNode.getPosition( endNode ) & CKEDITOR.POSITION_FOLLOWING ) - startNode = endNode; - - return { startNode : startNode, endNode : endNode }; - }, - - /** - * Find the node which fully contains the range. - * @param includeSelf - * @param {Boolean} ignoreTextNode Whether ignore CKEDITOR.NODE_TEXT type. - */ - getCommonAncestor : function( includeSelf , ignoreTextNode ) - { - var start = this.startContainer, - end = this.endContainer, - ancestor; - - if ( start.equals( end ) ) - { - if ( includeSelf - && start.type == CKEDITOR.NODE_ELEMENT - && this.startOffset == this.endOffset - 1 ) - ancestor = start.getChild( this.startOffset ); - else - ancestor = start; - } - else - ancestor = start.getCommonAncestor( end ); - - return ignoreTextNode && !ancestor.is ? ancestor.getParent() : ancestor; - }, - - /** - * Transforms the startContainer and endContainer properties from text - * nodes to element nodes, whenever possible. This is actually possible - * if either of the boundary containers point to a text node, and its - * offset is set to zero, or after the last char in the node. - */ - optimize : function() - { - var container = this.startContainer; - var offset = this.startOffset; - - if ( container.type != CKEDITOR.NODE_ELEMENT ) - { - if ( !offset ) - this.setStartBefore( container ); - else if ( offset >= container.getLength() ) - this.setStartAfter( container ); - } - - container = this.endContainer; - offset = this.endOffset; - - if ( container.type != CKEDITOR.NODE_ELEMENT ) - { - if ( !offset ) - this.setEndBefore( container ); - else if ( offset >= container.getLength() ) - this.setEndAfter( container ); - } - }, - - /** - * Move the range out of bookmark nodes if they'd been the container. - */ - optimizeBookmark: function() - { - var startNode = this.startContainer, - endNode = this.endContainer; - - if ( startNode.is && startNode.is( 'span' ) - && startNode.hasAttribute( '_fck_bookmark' ) ) - this.setStartAt( startNode, CKEDITOR.POSITION_BEFORE_START ); - if ( endNode && endNode.is && endNode.is( 'span' ) - && endNode.hasAttribute( '_fck_bookmark' ) ) - this.setEndAt( endNode, CKEDITOR.POSITION_AFTER_END ); - }, - - trim : function( ignoreStart, ignoreEnd ) - { - var startContainer = this.startContainer, - startOffset = this.startOffset, - collapsed = this.collapsed; - if ( ( !ignoreStart || collapsed ) - && startContainer && startContainer.type == CKEDITOR.NODE_TEXT ) - { - // If the offset is zero, we just insert the new node before - // the start. - if ( !startOffset ) - { - startOffset = startContainer.getIndex(); - startContainer = startContainer.getParent(); - } - // If the offset is at the end, we'll insert it after the text - // node. - else if ( startOffset >= startContainer.getLength() ) - { - startOffset = startContainer.getIndex() + 1; - startContainer = startContainer.getParent(); - } - // In other case, we split the text node and insert the new - // node at the split point. - else - { - var nextText = startContainer.split( startOffset ); - - startOffset = startContainer.getIndex() + 1; - startContainer = startContainer.getParent(); - - // Check all necessity of updating the end boundary. - if ( this.startContainer.equals( this.endContainer ) ) - this.setEnd( nextText, this.endOffset - this.startOffset ); - else if ( startContainer.equals( this.endContainer ) ) - this.endOffset += 1; - } - - this.setStart( startContainer, startOffset ); - - if ( collapsed ) - { - this.collapse( true ); - return; - } - } - - var endContainer = this.endContainer; - var endOffset = this.endOffset; - - if ( !( ignoreEnd || collapsed ) - && endContainer && endContainer.type == CKEDITOR.NODE_TEXT ) - { - // If the offset is zero, we just insert the new node before - // the start. - if ( !endOffset ) - { - endOffset = endContainer.getIndex(); - endContainer = endContainer.getParent(); - } - // If the offset is at the end, we'll insert it after the text - // node. - else if ( endOffset >= endContainer.getLength() ) - { - endOffset = endContainer.getIndex() + 1; - endContainer = endContainer.getParent(); - } - // In other case, we split the text node and insert the new - // node at the split point. - else - { - endContainer.split( endOffset ); - - endOffset = endContainer.getIndex() + 1; - endContainer = endContainer.getParent(); - } - - this.setEnd( endContainer, endOffset ); - } - }, - - enlarge : function( unit ) - { - switch ( unit ) - { - case CKEDITOR.ENLARGE_ELEMENT : - - if ( this.collapsed ) - return; - - // Get the common ancestor. - var commonAncestor = this.getCommonAncestor(); - - var body = this.document.getBody(); - - // For each boundary - // a. Depending on its position, find out the first node to be checked (a sibling) or, if not available, to be enlarge. - // b. Go ahead checking siblings and enlarging the boundary as much as possible until the common ancestor is not reached. After reaching the common ancestor, just save the enlargeable node to be used later. - - var startTop, endTop; - - var enlargeable, sibling, commonReached; - - // Indicates that the node can be added only if whitespace - // is available before it. - var needsWhiteSpace = false; - var isWhiteSpace; - var siblingText; - - // Process the start boundary. - - var container = this.startContainer; - var offset = this.startOffset; - - if ( container.type == CKEDITOR.NODE_TEXT ) - { - if ( offset ) - { - // Check if there is any non-space text before the - // offset. Otherwise, container is null. - container = !CKEDITOR.tools.trim( container.substring( 0, offset ) ).length && container; - - // If we found only whitespace in the node, it - // means that we'll need more whitespace to be able - // to expand. For example, can be expanded in - // "A [B]", but not in "A [B]". - needsWhiteSpace = !!container; - } - - if ( container ) - { - if ( !( sibling = container.getPrevious() ) ) - enlargeable = container.getParent(); - } - } - else - { - // If we have offset, get the node preceeding it as the - // first sibling to be checked. - if ( offset ) - sibling = container.getChild( offset - 1 ) || container.getLast(); - - // If there is no sibling, mark the container to be - // enlarged. - if ( !sibling ) - enlargeable = container; - } - - while ( enlargeable || sibling ) - { - if ( enlargeable && !sibling ) - { - // If we reached the common ancestor, mark the flag - // for it. - if ( !commonReached && enlargeable.equals( commonAncestor ) ) - commonReached = true; - - if ( !body.contains( enlargeable ) ) - break; - - // If we don't need space or this element breaks - // the line, then enlarge it. - if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' ) - { - needsWhiteSpace = false; - - // If the common ancestor has been reached, - // we'll not enlarge it immediately, but just - // mark it to be enlarged later if the end - // boundary also enlarges it. - if ( commonReached ) - startTop = enlargeable; - else - this.setStartBefore( enlargeable ); - } - - sibling = enlargeable.getPrevious(); - } - - // Check all sibling nodes preceeding the enlargeable - // node. The node wil lbe enlarged only if none of them - // blocks it. - while ( sibling ) - { - // This flag indicates that this node has - // whitespaces at the end. - isWhiteSpace = false; - - if ( sibling.type == CKEDITOR.NODE_TEXT ) - { - siblingText = sibling.getText(); - - if ( /[^\s\ufeff]/.test( siblingText ) ) - sibling = null; - - isWhiteSpace = /[\s\ufeff]$/.test( siblingText ); - } - else - { - // If this is a visible element. - // We need to check for the bookmark attribute because IE insists on - // rendering the display:none nodes we use for bookmarks. (#3363) - if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) ) - { - // We'll accept it only if we need - // whitespace, and this is an inline - // element with whitespace only. - if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] ) - { - // It must contains spaces and inline elements only. - - siblingText = sibling.getText(); - - if ( (/[^\s\ufeff]/).test( siblingText ) ) // Spaces + Zero Width No-Break Space (U+FEFF) - sibling = null; - else - { - var allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' ); - for ( var i = 0, child ; child = allChildren[ i++ ] ; ) - { - if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] ) - { - sibling = null; - break; - } - } - } - - if ( sibling ) - isWhiteSpace = !!siblingText.length; - } - else - sibling = null; - } - } - - // A node with whitespaces has been found. - if ( isWhiteSpace ) - { - // Enlarge the last enlargeable node, if we - // were waiting for spaces. - if ( needsWhiteSpace ) - { - if ( commonReached ) - startTop = enlargeable; - else if ( enlargeable ) - this.setStartBefore( enlargeable ); - } - else - needsWhiteSpace = true; - } - - if ( sibling ) - { - var next = sibling.getPrevious(); - - if ( !enlargeable && !next ) - { - // Set the sibling as enlargeable, so it's - // parent will be get later outside this while. - enlargeable = sibling; - sibling = null; - break; - } - - sibling = next; - } - else - { - // If sibling has been set to null, then we - // need to stop enlarging. - enlargeable = null; - } - } - - if ( enlargeable ) - enlargeable = enlargeable.getParent(); - } - - // Process the end boundary. This is basically the same - // code used for the start boundary, with small changes to - // make it work in the oposite side (to the right). This - // makes it difficult to reuse the code here. So, fixes to - // the above code are likely to be replicated here. - - container = this.endContainer; - offset = this.endOffset; - - // Reset the common variables. - enlargeable = sibling = null; - commonReached = needsWhiteSpace = false; - - if ( container.type == CKEDITOR.NODE_TEXT ) - { - // Check if there is any non-space text after the - // offset. Otherwise, container is null. - container = !CKEDITOR.tools.trim( container.substring( offset ) ).length && container; - - // If we found only whitespace in the node, it - // means that we'll need more whitespace to be able - // to expand. For example, can be expanded in - // "A [B]", but not in "A [B]". - needsWhiteSpace = !( container && container.getLength() ); - - if ( container ) - { - if ( !( sibling = container.getNext() ) ) - enlargeable = container.getParent(); - } - } - else - { - // Get the node right after the boudary to be checked - // first. - sibling = container.getChild( offset ); - - if ( !sibling ) - enlargeable = container; - } - - while ( enlargeable || sibling ) - { - if ( enlargeable && !sibling ) - { - if ( !commonReached && enlargeable.equals( commonAncestor ) ) - commonReached = true; - - if ( !body.contains( enlargeable ) ) - break; - - if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' ) - { - needsWhiteSpace = false; - - if ( commonReached ) - endTop = enlargeable; - else if ( enlargeable ) - this.setEndAfter( enlargeable ); - } - - sibling = enlargeable.getNext(); - } - - while ( sibling ) - { - isWhiteSpace = false; - - if ( sibling.type == CKEDITOR.NODE_TEXT ) - { - siblingText = sibling.getText(); - - if ( /[^\s\ufeff]/.test( siblingText ) ) - sibling = null; - - isWhiteSpace = /^[\s\ufeff]/.test( siblingText ); - } - else - { - // If this is a visible element. - // We need to check for the bookmark attribute because IE insists on - // rendering the display:none nodes we use for bookmarks. (#3363) - if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_fck_bookmark' ) ) - { - // We'll accept it only if we need - // whitespace, and this is an inline - // element with whitespace only. - if ( needsWhiteSpace && CKEDITOR.dtd.$removeEmpty[ sibling.getName() ] ) - { - // It must contains spaces and inline elements only. - - siblingText = sibling.getText(); - - if ( (/[^\s\ufeff]/).test( siblingText ) ) - sibling = null; - else - { - allChildren = sibling.$.all || sibling.$.getElementsByTagName( '*' ); - for ( i = 0 ; child = allChildren[ i++ ] ; ) - { - if ( !CKEDITOR.dtd.$removeEmpty[ child.nodeName.toLowerCase() ] ) - { - sibling = null; - break; - } - } - } - - if ( sibling ) - isWhiteSpace = !!siblingText.length; - } - else - sibling = null; - } - } - - if ( isWhiteSpace ) - { - if ( needsWhiteSpace ) - { - if ( commonReached ) - endTop = enlargeable; - else - this.setEndAfter( enlargeable ); - } - } - - if ( sibling ) - { - next = sibling.getNext(); - - if ( !enlargeable && !next ) - { - enlargeable = sibling; - sibling = null; - break; - } - - sibling = next; - } - else - { - // If sibling has been set to null, then we - // need to stop enlarging. - enlargeable = null; - } - } - - if ( enlargeable ) - enlargeable = enlargeable.getParent(); - } - - // If the common ancestor can be enlarged by both boundaries, then include it also. - if ( startTop && endTop ) - { - commonAncestor = startTop.contains( endTop ) ? endTop : startTop; - - this.setStartBefore( commonAncestor ); - this.setEndAfter( commonAncestor ); - } - break; - - case CKEDITOR.ENLARGE_BLOCK_CONTENTS: - case CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS: - - // Enlarging the start boundary. - var walkerRange = new CKEDITOR.dom.range( this.document ); - - body = this.document.getBody(); - - walkerRange.setStartAt( body, CKEDITOR.POSITION_AFTER_START ); - walkerRange.setEnd( this.startContainer, this.startOffset ); - - var walker = new CKEDITOR.dom.walker( walkerRange ), - blockBoundary, // The node on which the enlarging should stop. - tailBr, // In case BR as block boundary. - notBlockBoundary = CKEDITOR.dom.walker.blockBoundary( - ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ), - // Record the encountered 'blockBoundary' for later use. - boundaryGuard = function( node ) - { - var retval = notBlockBoundary( node ); - if ( !retval ) - blockBoundary = node; - return retval; - }, - // Record the encounted 'tailBr' for later use. - tailBrGuard = function( node ) - { - var retval = boundaryGuard( node ); - if ( !retval && node.is && node.is( 'br' ) ) - tailBr = node; - return retval; - }; - - walker.guard = boundaryGuard; - - enlargeable = walker.lastBackward(); - - // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; - - // Start the range either after the end of found block (

        ...

        [text) - // or at the start of block (

        [text...), by comparing the document position - // with 'enlargeable' node. - this.setStartAt( - blockBoundary, - !blockBoundary.is( 'br' ) && - ( !enlargeable && this.checkStartOfBlock() - || enlargeable && blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_AFTER_START : - CKEDITOR.POSITION_AFTER_END ); - - // Enlarging the end boundary. - walkerRange = this.clone(); - walkerRange.collapse(); - walkerRange.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); - walker = new CKEDITOR.dom.walker( walkerRange ); - - // tailBrGuard only used for on range end. - walker.guard = ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? - tailBrGuard : boundaryGuard; - blockBoundary = null; - // End the range right before the block boundary node. - - enlargeable = walker.lastForward(); - - // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; - - // Close the range either before the found block start (text]

        ...

        ) or at the block end (...text]

        ) - // by comparing the document position with 'enlargeable' node. - this.setEndAt( - blockBoundary, - ( !enlargeable && this.checkEndOfBlock() - || enlargeable && blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_BEFORE_END : - CKEDITOR.POSITION_BEFORE_START ); - // We must include the
        at the end of range if there's - // one and we're expanding list item contents - if ( tailBr ) - this.setEndAfter( tailBr ); - } - }, - - /** - * Descrease the range to make sure that boundaries - * always anchor beside text nodes or innermost element. - * @param {Number} mode ( CKEDITOR.SHRINK_ELEMENT | CKEDITOR.SHRINK_TEXT ) The shrinking mode. - *
        - *
        CKEDITOR.SHRINK_ELEMENT
        - *
        Shrink the range boundaries to the edge of the innermost element.
        - *
        CKEDITOR.SHRINK_TEXT
        - *
        Shrink the range boudaries to anchor by the side of enclosed text node, range remains if there's no text nodes on boundaries at all.
        - *
        - * @param {Boolean} selectContents Whether result range anchors at the inner OR outer boundary of the node. - */ - shrink : function( mode, selectContents ) - { - // Unable to shrink a collapsed range. - if ( !this.collapsed ) - { - mode = mode || CKEDITOR.SHRINK_TEXT; - - var walkerRange = this.clone(); - - var startContainer = this.startContainer, - endContainer = this.endContainer, - startOffset = this.startOffset, - endOffset = this.endOffset, - collapsed = this.collapsed; - - // Whether the start/end boundary is moveable. - var moveStart = 1, - moveEnd = 1; - - if ( startContainer && startContainer.type == CKEDITOR.NODE_TEXT ) - { - if ( !startOffset ) - walkerRange.setStartBefore( startContainer ); - else if ( startOffset >= startContainer.getLength( ) ) - walkerRange.setStartAfter( startContainer ); - else - { - // Enlarge the range properly to avoid walker making - // DOM changes caused by triming the text nodes later. - walkerRange.setStartBefore( startContainer ); - moveStart = 0; - } - } - - if ( endContainer && endContainer.type == CKEDITOR.NODE_TEXT ) - { - if ( !endOffset ) - walkerRange.setEndBefore( endContainer ); - else if ( endOffset >= endContainer.getLength( ) ) - walkerRange.setEndAfter( endContainer ); - else - { - walkerRange.setEndAfter( endContainer ); - moveEnd = 0; - } - } - - var walker = new CKEDITOR.dom.walker( walkerRange ); - - walker.evaluator = function( node ) - { - return node.type == ( mode == CKEDITOR.SHRINK_ELEMENT ? - CKEDITOR.NODE_ELEMENT : CKEDITOR.NODE_TEXT ); - }; - - var currentElement; - walker.guard = function( node, movingOut ) - { - // Stop when we're shrink in element mode while encountering a text node. - if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT ) - return false; - - // Stop when we've already walked "through" an element. - if ( movingOut && node.equals( currentElement ) ) - return false; - - if ( !movingOut && node.type == CKEDITOR.NODE_ELEMENT ) - currentElement = node; - - return true; - }; - - if ( moveStart ) - { - var textStart = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastForward' : 'next'](); - textStart && this.setStartAt( textStart, selectContents ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_START ); - } - - if ( moveEnd ) - { - walker.reset(); - var textEnd = walker[ mode == CKEDITOR.SHRINK_ELEMENT ? 'lastBackward' : 'previous'](); - textEnd && this.setEndAt( textEnd, selectContents ? CKEDITOR.POSITION_BEFORE_END : CKEDITOR.POSITION_AFTER_END ); - } - - return !!( moveStart || moveEnd ); - } - }, - - /** - * Inserts a node at the start of the range. The range will be expanded - * the contain the node. - */ - insertNode : function( node ) - { - this.optimizeBookmark(); - this.trim( false, true ); - - var startContainer = this.startContainer; - var startOffset = this.startOffset; - - var nextNode = startContainer.getChild( startOffset ); - - if ( nextNode ) - node.insertBefore( nextNode ); - else - startContainer.append( node ); - - // Check if we need to update the end boundary. - if ( node.getParent().equals( this.endContainer ) ) - this.endOffset++; - - // Expand the range to embrace the new node. - this.setStartBefore( node ); - }, - - moveToPosition : function( node, position ) - { - this.setStartAt( node, position ); - this.collapse( true ); - }, - - selectNodeContents : function( node ) - { - this.setStart( node, 0 ); - this.setEnd( node, node.type == CKEDITOR.NODE_TEXT ? node.getLength() : node.getChildCount() ); - }, - - /** - * Sets the start position of a Range. - * @param {CKEDITOR.dom.node} startNode The node to start the range. - * @param {Number} startOffset An integer greater than or equal to zero - * representing the offset for the start of the range from the start - * of startNode. - */ - setStart : function( startNode, startOffset ) - { - // W3C requires a check for the new position. If it is after the end - // boundary, the range should be collapsed to the new start. It seams - // we will not need this check for our use of this class so we can - // ignore it for now. - - // Fixing invalid range start inside dtd empty elements. - if( startNode.type == CKEDITOR.NODE_ELEMENT - && CKEDITOR.dtd.$empty[ startNode.getName() ] ) - startNode = startNode.getParent(), startOffset = startNode.getIndex(); - - this.startContainer = startNode; - this.startOffset = startOffset; - - if ( !this.endContainer ) - { - this.endContainer = startNode; - this.endOffset = startOffset; - } - - updateCollapsed( this ); - }, - - /** - * Sets the end position of a Range. - * @param {CKEDITOR.dom.node} endNode The node to end the range. - * @param {Number} endOffset An integer greater than or equal to zero - * representing the offset for the end of the range from the start - * of endNode. - */ - setEnd : function( endNode, endOffset ) - { - // W3C requires a check for the new position. If it is before the start - // boundary, the range should be collapsed to the new end. It seams we - // will not need this check for our use of this class so we can ignore - // it for now. - - // Fixing invalid range end inside dtd empty elements. - if( endNode.type == CKEDITOR.NODE_ELEMENT - && CKEDITOR.dtd.$empty[ endNode.getName() ] ) - endNode = endNode.getParent(), endOffset = endNode.getIndex() + 1; - - this.endContainer = endNode; - this.endOffset = endOffset; - - if ( !this.startContainer ) - { - this.startContainer = endNode; - this.startOffset = endOffset; - } - - updateCollapsed( this ); - }, - - setStartAfter : function( node ) - { - this.setStart( node.getParent(), node.getIndex() + 1 ); - }, - - setStartBefore : function( node ) - { - this.setStart( node.getParent(), node.getIndex() ); - }, - - setEndAfter : function( node ) - { - this.setEnd( node.getParent(), node.getIndex() + 1 ); - }, - - setEndBefore : function( node ) - { - this.setEnd( node.getParent(), node.getIndex() ); - }, - - setStartAt : function( node, position ) - { - switch( position ) - { - case CKEDITOR.POSITION_AFTER_START : - this.setStart( node, 0 ); - break; - - case CKEDITOR.POSITION_BEFORE_END : - if ( node.type == CKEDITOR.NODE_TEXT ) - this.setStart( node, node.getLength() ); - else - this.setStart( node, node.getChildCount() ); - break; - - case CKEDITOR.POSITION_BEFORE_START : - this.setStartBefore( node ); - break; - - case CKEDITOR.POSITION_AFTER_END : - this.setStartAfter( node ); - } - - updateCollapsed( this ); - }, - - setEndAt : function( node, position ) - { - switch( position ) - { - case CKEDITOR.POSITION_AFTER_START : - this.setEnd( node, 0 ); - break; - - case CKEDITOR.POSITION_BEFORE_END : - if ( node.type == CKEDITOR.NODE_TEXT ) - this.setEnd( node, node.getLength() ); - else - this.setEnd( node, node.getChildCount() ); - break; - - case CKEDITOR.POSITION_BEFORE_START : - this.setEndBefore( node ); - break; - - case CKEDITOR.POSITION_AFTER_END : - this.setEndAfter( node ); - } - - updateCollapsed( this ); - }, - - fixBlock : function( isStart, blockTag ) - { - var bookmark = this.createBookmark(), - fixedBlock = this.document.createElement( blockTag ); - - this.collapse( isStart ); - - this.enlarge( CKEDITOR.ENLARGE_BLOCK_CONTENTS ); - - this.extractContents().appendTo( fixedBlock ); - fixedBlock.trim(); - - if ( !CKEDITOR.env.ie ) - fixedBlock.appendBogus(); - - this.insertNode( fixedBlock ); - - this.moveToBookmark( bookmark ); - - return fixedBlock; - }, - - splitBlock : function( blockTag ) - { - var startPath = new CKEDITOR.dom.elementPath( this.startContainer ), - endPath = new CKEDITOR.dom.elementPath( this.endContainer ); - - var startBlockLimit = startPath.blockLimit, - endBlockLimit = endPath.blockLimit; - - var startBlock = startPath.block, - endBlock = endPath.block; - - var elementPath = null; - // Do nothing if the boundaries are in different block limits. - if ( !startBlockLimit.equals( endBlockLimit ) ) - return null; - - // Get or fix current blocks. - if ( blockTag != 'br' ) - { - if ( !startBlock ) - { - startBlock = this.fixBlock( true, blockTag ); - endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block; - } - - if ( !endBlock ) - endBlock = this.fixBlock( false, blockTag ); - } - - // Get the range position. - var isStartOfBlock = startBlock && this.checkStartOfBlock(), - isEndOfBlock = endBlock && this.checkEndOfBlock(); - - // Delete the current contents. - // TODO: Why is 2.x doing CheckIsEmpty()? - this.deleteContents(); - - if ( startBlock && startBlock.equals( endBlock ) ) - { - if ( isEndOfBlock ) - { - elementPath = new CKEDITOR.dom.elementPath( this.startContainer ); - this.moveToPosition( endBlock, CKEDITOR.POSITION_AFTER_END ); - endBlock = null; - } - else if ( isStartOfBlock ) - { - elementPath = new CKEDITOR.dom.elementPath( this.startContainer ); - this.moveToPosition( startBlock, CKEDITOR.POSITION_BEFORE_START ); - startBlock = null; - } - else - { - endBlock = this.splitElement( startBlock ); - - // In Gecko, the last child node must be a bogus
        . - // Note: bogus
        added under
          or
            would cause - // lists to be incorrectly rendered. - if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') ) - startBlock.appendBogus() ; - } - } - - return { - previousBlock : startBlock, - nextBlock : endBlock, - wasStartOfBlock : isStartOfBlock, - wasEndOfBlock : isEndOfBlock, - elementPath : elementPath - }; - }, - - /** - * Branch the specified element from the collapsed range position and - * place the caret between the two result branches. - * Note: The range must be collapsed and been enclosed by this element. - * @param {CKEDITOR.dom.element} element - * @return {CKEDITOR.dom.element} Root element of the new branch after the split. - */ - splitElement : function( toSplit ) - { - if ( !this.collapsed ) - return null; - - // Extract the contents of the block from the selection point to the end - // of its contents. - this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END ); - var documentFragment = this.extractContents(); - - // Duplicate the element after it. - var clone = toSplit.clone( false ); - - // Place the extracted contents into the duplicated element. - documentFragment.appendTo( clone ); - clone.insertAfter( toSplit ); - this.moveToPosition( toSplit, CKEDITOR.POSITION_AFTER_END ); - return clone; - }, - - /** - * Check whether a range boundary is at the inner boundary of a given - * element. - * @param {CKEDITOR.dom.element} element The target element to check. - * @param {Number} checkType The boundary to check for both the range - * and the element. It can be CKEDITOR.START or CKEDITOR.END. - * @returns {Boolean} "true" if the range boundary is at the inner - * boundary of the element. - */ - checkBoundaryOfElement : function( element, checkType ) - { - var checkStart = ( checkType == CKEDITOR.START ); - - // Create a copy of this range, so we can manipulate it for our checks. - var walkerRange = this.clone(); - - // Collapse the range at the proper size. - walkerRange.collapse( checkStart ); - - // Expand the range to element boundary. - walkerRange[ checkStart ? 'setStartAt' : 'setEndAt' ] - ( element, checkStart ? CKEDITOR.POSITION_AFTER_START : CKEDITOR.POSITION_BEFORE_END ); - - // Create the walker, which will check if we have anything useful - // in the range. - var walker = new CKEDITOR.dom.walker( walkerRange ); - walker.evaluator = elementBoundaryEval; - - return walker[ checkStart ? 'checkBackward' : 'checkForward' ](); - }, - - // Calls to this function may produce changes to the DOM. The range may - // be updated to reflect such changes. - checkStartOfBlock : function() - { - var startContainer = this.startContainer, - startOffset = this.startOffset; - - // If the starting node is a text node, and non-empty before the offset, - // then we're surely not at the start of block. - if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT ) - { - var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) ); - if ( textBefore.length ) - return false; - } - - // Antecipate the trim() call here, so the walker will not make - // changes to the DOM, which would not get reflected into this - // range otherwise. - this.trim(); - - // We need to grab the block element holding the start boundary, so - // let's use an element path for it. - var path = new CKEDITOR.dom.elementPath( this.startContainer ); - - // Creates a range starting at the block start until the range start. - var walkerRange = this.clone(); - walkerRange.collapse( true ); - walkerRange.setStartAt( path.block || path.blockLimit, CKEDITOR.POSITION_AFTER_START ); - - var walker = new CKEDITOR.dom.walker( walkerRange ); - walker.evaluator = getCheckStartEndBlockEvalFunction( true ); - - return walker.checkBackward(); - }, - - checkEndOfBlock : function() - { - var endContainer = this.endContainer, - endOffset = this.endOffset; - - // If the ending node is a text node, and non-empty after the offset, - // then we're surely not at the end of block. - if ( endContainer.type == CKEDITOR.NODE_TEXT ) - { - var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) ); - if ( textAfter.length ) - return false; - } - - // Antecipate the trim() call here, so the walker will not make - // changes to the DOM, which would not get reflected into this - // range otherwise. - this.trim(); - - // We need to grab the block element holding the start boundary, so - // let's use an element path for it. - var path = new CKEDITOR.dom.elementPath( this.endContainer ); - - // Creates a range starting at the block start until the range start. - var walkerRange = this.clone(); - walkerRange.collapse( false ); - walkerRange.setEndAt( path.block || path.blockLimit, CKEDITOR.POSITION_BEFORE_END ); - - var walker = new CKEDITOR.dom.walker( walkerRange ); - walker.evaluator = getCheckStartEndBlockEvalFunction( false ); - - return walker.checkForward(); - }, - - /** - * Moves the range boundaries to the first/end editing point inside an - * element. For example, in an element tree like - * "<p><b><i></i></b> Text</p>", the start editing point is - * "<p><b><i>^</i></b> Text</p>" (inside <i>). - * @param {CKEDITOR.dom.element} el The element into which look for the - * editing spot. - * @param {Boolean} isMoveToEnd Whether move to the end editable position. - */ - moveToElementEditablePosition : function( el, isMoveToEnd ) - { - var isEditable; - - // Empty elements are rejected. - if ( CKEDITOR.dtd.$empty[ el.getName() ] ) - return false; - - while ( el && el.type == CKEDITOR.NODE_ELEMENT ) - { - isEditable = el.isEditable(); - - // If an editable element is found, move inside it. - if ( isEditable ) - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_BEFORE_END : - CKEDITOR.POSITION_AFTER_START ); - // Stop immediately if we've found a non editable inline element (e.g ). - else if ( CKEDITOR.dtd.$inline[ el.getName() ] ) - { - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_AFTER_END : - CKEDITOR.POSITION_BEFORE_START ); - return true; - } - - // Non-editable non-inline elements are to be bypassed, getting the next one. - if ( CKEDITOR.dtd.$empty[ el.getName() ] ) - el = el[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval ); - else - el = el[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval ); - - // Stop immediately if we've found a text node. - if ( el && el.type == CKEDITOR.NODE_TEXT ) - { - this.moveToPosition( el, isMoveToEnd ? - CKEDITOR.POSITION_AFTER_END : - CKEDITOR.POSITION_BEFORE_START ); - return true; - } - } - - return isEditable; - }, - - /** - *@see {CKEDITOR.dom.range.moveToElementEditablePosition} - */ - moveToElementEditStart : function( target ) - { - return this.moveToElementEditablePosition( target ); - }, - - /** - *@see {CKEDITOR.dom.range.moveToElementEditablePosition} - */ - moveToElementEditEnd : function( target ) - { - return this.moveToElementEditablePosition( target, true ); - }, - - /** - * Get the single node enclosed within the range if there's one. - */ - getEnclosedNode : function() - { - var walkerRange = this.clone(); - - // Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780) - walkerRange.optimize(); - if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT - || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT ) - return null; - - var walker = new CKEDITOR.dom.walker( walkerRange ), - isNotBookmarks = CKEDITOR.dom.walker.bookmark( true ), - isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), - evaluator = function( node ) - { - return isNotWhitespaces( node ) && isNotBookmarks( node ); - }; - walkerRange.evaluator = evaluator; - var node = walker.next(); - walker.reset(); - return node && node.equals( walker.previous() ) ? node : null; - }, - - getTouchedStartNode : function() - { - var container = this.startContainer ; - - if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT ) - return container ; - - return container.getChild( this.startOffset ) || container ; - }, - - getTouchedEndNode : function() - { - var container = this.endContainer ; - - if ( this.collapsed || container.type != CKEDITOR.NODE_ELEMENT ) - return container ; - - return container.getChild( this.endOffset - 1 ) || container ; - } - }; -})(); - -CKEDITOR.POSITION_AFTER_START = 1; // ^contents "^text" -CKEDITOR.POSITION_BEFORE_END = 2; // contents^ "text^" -CKEDITOR.POSITION_BEFORE_START = 3; // ^contents ^"text" -CKEDITOR.POSITION_AFTER_END = 4; // contents^ "text" - -CKEDITOR.ENLARGE_ELEMENT = 1; -CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2; -CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3; - -/** - * Check boundary types. - * @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement - */ -CKEDITOR.START = 1; -CKEDITOR.END = 2; -CKEDITOR.STARTEND = 3; - -/** - * Shrink range types. - * @see CKEDITOR.dom.range.prototype.shrink - */ -CKEDITOR.SHRINK_ELEMENT = 1; -CKEDITOR.SHRINK_TEXT = 2; diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/rangelist.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/rangelist.js deleted file mode 100644 index 9c12e48..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/rangelist.js +++ /dev/null @@ -1,163 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - /** - * Represents a list os CKEDITOR.dom.range objects, which can be easily - * iterated sequentially. - * @constructor - * @param {CKEDITOR.dom.range|Array} [ranges] The ranges contained on this list. - * Note that, if an array of ranges is specified, the range sequence - * should match its DOM order. This class will not help to sort them. - */ - CKEDITOR.dom.rangeList = function( ranges ) - { - if ( ranges instanceof CKEDITOR.dom.rangeList ) - return ranges; - - if ( !ranges ) - ranges = []; - else if ( ranges instanceof CKEDITOR.dom.range ) - ranges = [ ranges ]; - - return CKEDITOR.tools.extend( ranges, mixins ); - }; - - var mixins = - /** @lends CKEDITOR.dom.rangeList.prototype */ - { - /** - * Creates an instance of the rangeList iterator, it should be used - * only when the ranges processing could be DOM intrusive, which - * means it may pollute and break other ranges in this list. - * Otherwise, it's enough to just iterate over this array in a for loop. - * @returns {CKEDITOR.dom.rangeListIterator} - */ - createIterator : function() - { - var rangeList = this, - bookmarks = [], - current; - - /** - * @lends CKEDITOR.dom.rangeListIterator.prototype - */ - return { - - /** - * Retrieves the next range in the list. - */ - getNextRange : function() - { - current = current == undefined ? 0 : current + 1; - - var range = rangeList[ current ]; - - // Multiple ranges might be mangled by each other. - if ( range && rangeList.length > 1 ) - { - // Bookmarking all other ranges on the first iteration, - // the range correctness after it doesn't matter since we'll - // restore them before the next iteration. - if ( !current ) - { - // Make sure bookmark correctness by reverse processing. - for ( var i = rangeList.length - 1; i > 0; i-- ) - bookmarks.unshift( rangeList[ i ].createBookmark( true ) ); - } - else - range.moveToBookmark( bookmarks.shift() ); - } - - return range; - } - }; - }, - - createBookmarks : function( serializable ) - { - var retval = [], bookmark; - for ( var i = 0; i < this.length ; i++ ) - { - retval.push( bookmark = this[ i ].createBookmark( serializable, true) ); - - // Updating the container & offset values for ranges - // that have been touched. - for ( var j = i + 1; j < this.length; j++ ) - { - this[ j ] = updateDirtyRange( bookmark, this[ j ] ); - this[ j ] = updateDirtyRange( bookmark, this[ j ], true ); - } - } - return retval; - }, - - createBookmarks2 : function( normalized ) - { - var bookmarks = []; - - for ( var i = 0 ; i < this.length ; i++ ) - bookmarks.push( this[ i ].createBookmark2( normalized ) ); - - return bookmarks; - }, - - /** - * Move each range in the list to the position specified by a list of bookmarks. - * @param {Array} bookmarks The list of bookmarks, each one matching a range in the list. - */ - moveToBookmarks : function( bookmarks ) - { - for ( var i = 0 ; i < this.length ; i++ ) - this[ i ].moveToBookmark( bookmarks[ i ] ); - } - }; - - // Update the specified range which has been mangled by previous insertion of - // range bookmark nodes.(#3256) - function updateDirtyRange( bookmark, dirtyRange, checkEnd ) - { - var serializable = bookmark.serializable, - container = dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ], - offset = checkEnd ? 'endOffset' : 'startOffset'; - - var bookmarkStart = serializable ? - dirtyRange.document.getById( bookmark.startNode ) - : bookmark.startNode; - - var bookmarkEnd = serializable ? - dirtyRange.document.getById( bookmark.endNode ) - : bookmark.endNode; - - if ( container.equals( bookmarkStart.getPrevious() ) ) - { - dirtyRange.startOffset = dirtyRange.startOffset - - container.getLength() - - bookmarkEnd.getPrevious().getLength(); - container = bookmarkEnd.getNext(); - } - else if ( container.equals( bookmarkEnd.getPrevious() ) ) - { - dirtyRange.startOffset = dirtyRange.startOffset - container.getLength(); - container = bookmarkEnd.getNext(); - } - - container.equals( bookmarkStart.getParent() ) && dirtyRange[ offset ]++; - container.equals( bookmarkEnd.getParent() ) && dirtyRange[ offset ]++; - - // Update and return this range. - dirtyRange[ checkEnd ? 'endContainer' : 'startContainer' ] = container; - return dirtyRange; - } -})(); - -/** - * (Virtual Class) Do not call this constructor. This class is not really part - * of the API. It just describes the return type of {@link CKEDITOR.dom.rangeList#createIterator}. - * @name CKEDITOR.dom.rangeListIterator - * @constructor - * @example - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/text.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/text.js deleted file mode 100644 index a1eb690..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/text.js +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.text} class, which represents - * a DOM text node. - */ - -/** - * Represents a DOM text node. - * @constructor - * @augments CKEDITOR.dom.node - * @param {Object|String} text A native DOM text node or a string containing - * the text to use to create a new text node. - * @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain - * the node in case of new node creation. Defaults to the current document. - * @example - * var nativeNode = document.createTextNode( 'Example' ); - * var text = CKEDITOR.dom.text( nativeNode ); - * @example - * var text = CKEDITOR.dom.text( 'Example' ); - */ -CKEDITOR.dom.text = function( text, ownerDocument ) -{ - if ( typeof text == 'string' ) - text = ( ownerDocument ? ownerDocument.$ : document ).createTextNode( text ); - - // Theoretically, we should call the base constructor here - // (not CKEDITOR.dom.node though). But, IE doesn't support expando - // properties on text node, so the features provided by domObject will not - // work for text nodes (which is not a big issue for us). - // - // CKEDITOR.dom.domObject.call( this, element ); - - /** - * The native DOM text node represented by this class instance. - * @type Object - * @example - * var element = new CKEDITOR.dom.text( 'Example' ); - * alert( element.$.nodeType ); // "3" - */ - this.$ = text; -}; - -CKEDITOR.dom.text.prototype = new CKEDITOR.dom.node(); - -CKEDITOR.tools.extend( CKEDITOR.dom.text.prototype, - /** @lends CKEDITOR.dom.text.prototype */ - { - /** - * The node type. This is a constant value set to - * {@link CKEDITOR.NODE_TEXT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_TEXT, - - getLength : function() - { - return this.$.nodeValue.length; - }, - - getText : function() - { - return this.$.nodeValue; - }, - - /** - * Breaks this text node into two nodes at the specified offset, - * keeping both in the tree as siblings. This node then only contains - * all the content up to the offset point. A new text node, which is - * inserted as the next sibling of this node, contains all the content - * at and after the offset point. When the offset is equal to the - * length of this node, the new node has no data. - * @param {Number} The position at which to split, starting from zero. - * @returns {CKEDITOR.dom.text} The new text node. - */ - split : function( offset ) - { - // If the offset is after the last char, IE creates the text node - // on split, but don't include it into the DOM. So, we have to do - // that manually here. - if ( CKEDITOR.env.ie && offset == this.getLength() ) - { - var next = this.getDocument().createText( '' ); - next.insertAfter( this ); - return next; - } - - var doc = this.getDocument(); - var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc ); - - // IE BUG: IE8 does not update the childNodes array in DOM after splitText(), - // we need to make some DOM changes to make it update. (#3436) - if ( CKEDITOR.env.ie8 ) - { - var workaround = new CKEDITOR.dom.text( '', doc ); - workaround.insertAfter( retval ); - workaround.remove(); - } - - return retval; - }, - - /** - * Extracts characters from indexA up to but not including indexB. - * @param {Number} indexA An integer between 0 and one less than the - * length of the text. - * @param {Number} [indexB] An integer between 0 and the length of the - * string. If omitted, extracts characters to the end of the text. - */ - substring : function( indexA, indexB ) - { - // We need the following check due to a Firefox bug - // https://bugzilla.mozilla.org/show_bug.cgi?id=458886 - if ( typeof indexB != 'number' ) - return this.$.nodeValue.substr( indexA ); - else - return this.$.nodeValue.substring( indexA, indexB ); - } - }); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/walker.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/walker.js deleted file mode 100644 index 191d758..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/walker.js +++ /dev/null @@ -1,445 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - // This function is to be called under a "walker" instance scope. - function iterate( rtl, breakOnFalse ) - { - // Return null if we have reached the end. - if ( this._.end ) - return null; - - var node, - range = this.range, - guard, - userGuard = this.guard, - type = this.type, - getSourceNodeFn = ( rtl ? 'getPreviousSourceNode' : 'getNextSourceNode' ); - - // This is the first call. Initialize it. - if ( !this._.start ) - { - this._.start = 1; - - // Trim text nodes and optmize the range boundaries. DOM changes - // may happen at this point. - range.trim(); - - // A collapsed range must return null at first call. - if ( range.collapsed ) - { - this.end(); - return null; - } - } - - // Create the LTR guard function, if necessary. - if ( !rtl && !this._.guardLTR ) - { - // Gets the node that stops the walker when going LTR. - var limitLTR = range.endContainer, - blockerLTR = limitLTR.getChild( range.endOffset ); - - this._.guardLTR = function( node, movingOut ) - { - return ( ( !movingOut || !limitLTR.equals( node ) ) - && ( !blockerLTR || !node.equals( blockerLTR ) ) - && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); - }; - } - - // Create the RTL guard function, if necessary. - if ( rtl && !this._.guardRTL ) - { - // Gets the node that stops the walker when going LTR. - var limitRTL = range.startContainer, - blockerRTL = ( range.startOffset > 0 ) && limitRTL.getChild( range.startOffset - 1 ); - - this._.guardRTL = function( node, movingOut ) - { - return ( ( !movingOut || !limitRTL.equals( node ) ) - && ( !blockerRTL || !node.equals( blockerRTL ) ) - && ( node.type != CKEDITOR.NODE_ELEMENT || !movingOut || node.getName() != 'body' ) ); - }; - } - - // Define which guard function to use. - var stopGuard = rtl ? this._.guardRTL : this._.guardLTR; - - // Make the user defined guard function participate in the process, - // otherwise simply use the boundary guard. - if ( userGuard ) - { - guard = function( node, movingOut ) - { - if ( stopGuard( node, movingOut ) === false ) - return false; - - return userGuard( node, movingOut ); - }; - } - else - guard = stopGuard; - - if ( this.current ) - node = this.current[ getSourceNodeFn ]( false, type, guard ); - else - { - // Get the first node to be returned. - - if ( rtl ) - { - node = range.endContainer; - - if ( range.endOffset > 0 ) - { - node = node.getChild( range.endOffset - 1 ); - if ( guard( node ) === false ) - node = null; - } - else - node = ( guard ( node, true ) === false ) ? - null : node.getPreviousSourceNode( true, type, guard ); - } - else - { - node = range.startContainer; - node = node.getChild( range.startOffset ); - - if ( node ) - { - if ( guard( node ) === false ) - node = null; - } - else - node = ( guard ( range.startContainer, true ) === false ) ? - null : range.startContainer.getNextSourceNode( true, type, guard ) ; - } - } - - while ( node && !this._.end ) - { - this.current = node; - - if ( !this.evaluator || this.evaluator( node ) !== false ) - { - if ( !breakOnFalse ) - return node; - } - else if ( breakOnFalse && this.evaluator ) - return false; - - node = node[ getSourceNodeFn ]( false, type, guard ); - } - - this.end(); - return this.current = null; - } - - function iterateToLast( rtl ) - { - var node, last = null; - - while ( ( node = iterate.call( this, rtl ) ) ) - last = node; - - return last; - } - - CKEDITOR.dom.walker = CKEDITOR.tools.createClass( - { - /** - * Utility class to "walk" the DOM inside a range boundaries. If - * necessary, partially included nodes (text nodes) are broken to - * reflect the boundaries limits, so DOM and range changes may happen. - * Outside changes to the range may break the walker. - * - * The walker may return nodes that are not totaly included into the - * range boundaires. Let's take the following range representation, - * where the square brackets indicate the boundaries: - * - * [<p>Some <b>sample] text</b> - * - * While walking forward into the above range, the following nodes are - * returned: <p>, "Some ", <b> and "sample". Going - * backwards instead we have: "sample" and "Some ". So note that the - * walker always returns nodes when "entering" them, but not when - * "leaving" them. The guard function is instead called both when - * entering and leaving nodes. - * - * @constructor - * @param {CKEDITOR.dom.range} range The range within which walk. - */ - $ : function( range ) - { - this.range = range; - - /** - * A function executed for every matched node, to check whether - * it's to be considered into the walk or not. If not provided, all - * matched nodes are considered good. - * If the function returns "false" the node is ignored. - * @name CKEDITOR.dom.walker.prototype.evaluator - * @property - * @type Function - */ - // this.evaluator = null; - - /** - * A function executed for every node the walk pass by to check - * whether the walk is to be finished. It's called when both - * entering and exiting nodes, as well as for the matched nodes. - * If this function returns "false", the walking ends and no more - * nodes are evaluated. - * @name CKEDITOR.dom.walker.prototype.guard - * @property - * @type Function - */ - // this.guard = null; - - /** @private */ - this._ = {}; - }, - -// statics : -// { -// /* Creates a CKEDITOR.dom.walker instance to walk inside DOM boundaries set by nodes. -// * @param {CKEDITOR.dom.node} startNode The node from wich the walk -// * will start. -// * @param {CKEDITOR.dom.node} [endNode] The last node to be considered -// * in the walk. No more nodes are retrieved after touching or -// * passing it. If not provided, the walker stops at the -// * <body> closing boundary. -// * @returns {CKEDITOR.dom.walker} A DOM walker for the nodes between the -// * provided nodes. -// */ -// createOnNodes : function( startNode, endNode, startInclusive, endInclusive ) -// { -// var range = new CKEDITOR.dom.range(); -// if ( startNode ) -// range.setStartAt( startNode, startInclusive ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_END ) ; -// else -// range.setStartAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_AFTER_START ) ; -// -// if ( endNode ) -// range.setEndAt( endNode, endInclusive ? CKEDITOR.POSITION_AFTER_END : CKEDITOR.POSITION_BEFORE_START ) ; -// else -// range.setEndAt( startNode.getDocument().getBody(), CKEDITOR.POSITION_BEFORE_END ) ; -// -// return new CKEDITOR.dom.walker( range ); -// } -// }, -// - proto : - { - /** - * Stop walking. No more nodes are retrieved if this function gets - * called. - */ - end : function() - { - this._.end = 1; - }, - - /** - * Retrieves the next node (at right). - * @returns {CKEDITOR.dom.node} The next node or null if no more - * nodes are available. - */ - next : function() - { - return iterate.call( this ); - }, - - /** - * Retrieves the previous node (at left). - * @returns {CKEDITOR.dom.node} The previous node or null if no more - * nodes are available. - */ - previous : function() - { - return iterate.call( this, true ); - }, - - /** - * Check all nodes at right, executing the evaluation fuction. - * @returns {Boolean} "false" if the evaluator function returned - * "false" for any of the matched nodes. Otherwise "true". - */ - checkForward : function() - { - return iterate.call( this, false, true ) !== false; - }, - - /** - * Check all nodes at left, executing the evaluation fuction. - * @returns {Boolean} "false" if the evaluator function returned - * "false" for any of the matched nodes. Otherwise "true". - */ - checkBackward : function() - { - return iterate.call( this, true, true ) !== false; - }, - - /** - * Executes a full walk forward (to the right), until no more nodes - * are available, returning the last valid node. - * @returns {CKEDITOR.dom.node} The last node at the right or null - * if no valid nodes are available. - */ - lastForward : function() - { - return iterateToLast.call( this ); - }, - - /** - * Executes a full walk backwards (to the left), until no more nodes - * are available, returning the last valid node. - * @returns {CKEDITOR.dom.node} The last node at the left or null - * if no valid nodes are available. - */ - lastBackward : function() - { - return iterateToLast.call( this, true ); - }, - - reset : function() - { - delete this.current; - this._ = {}; - } - - } - }); - - /* - * Anything whose display computed style is block, list-item, table, - * table-row-group, table-header-group, table-footer-group, table-row, - * table-column-group, table-column, table-cell, table-caption, or whose node - * name is hr, br (when enterMode is br only) is a block boundary. - */ - var blockBoundaryDisplayMatch = - { - block : 1, - 'list-item' : 1, - table : 1, - 'table-row-group' : 1, - 'table-header-group' : 1, - 'table-footer-group' : 1, - 'table-row' : 1, - 'table-column-group' : 1, - 'table-column' : 1, - 'table-cell' : 1, - 'table-caption' : 1 - }, - blockBoundaryNodeNameMatch = { hr : 1 }; - - CKEDITOR.dom.element.prototype.isBlockBoundary = function( customNodeNames ) - { - var nodeNameMatches = CKEDITOR.tools.extend( {}, - blockBoundaryNodeNameMatch, customNodeNames || {} ); - - return blockBoundaryDisplayMatch[ this.getComputedStyle( 'display' ) ] || - nodeNameMatches[ this.getName() ]; - }; - - CKEDITOR.dom.walker.blockBoundary = function( customNodeNames ) - { - return function( node , type ) - { - return ! ( node.type == CKEDITOR.NODE_ELEMENT - && node.isBlockBoundary( customNodeNames ) ); - }; - }; - - CKEDITOR.dom.walker.listItemBoundary = function() - { - return this.blockBoundary( { br : 1 } ); - }; - - /** - * Whether the to-be-evaluated node is a bookmark node OR bookmark node - * inner contents. - * @param {Boolean} contentOnly Whether only test againt the text content of - * bookmark node instead of the element itself(default). - * @param {Boolean} isReject Whether should return 'false' for the bookmark - * node instead of 'true'(default). - */ - CKEDITOR.dom.walker.bookmark = function( contentOnly, isReject ) - { - function isBookmarkNode( node ) - { - return ( node && node.getName - && node.getName() == 'span' - && node.hasAttribute('_fck_bookmark') ); - } - - return function( node ) - { - var isBookmark, parent; - // Is bookmark inner text node? - isBookmark = ( node && !node.getName && ( parent = node.getParent() ) - && isBookmarkNode( parent ) ); - // Is bookmark node? - isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node ); - return isReject ^ isBookmark; - }; - }; - - /** - * Whether the node is a text node containing only whitespaces characters. - * @param isReject - */ - CKEDITOR.dom.walker.whitespaces = function( isReject ) - { - return function( node ) - { - var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT ) - && !CKEDITOR.tools.trim( node.getText() ); - return isReject ^ isWhitespace; - }; - }; - - /** - * Whether the node is invisible in wysiwyg mode. - * @param isReject - */ - CKEDITOR.dom.walker.invisible = function( isReject ) - { - var whitespace = CKEDITOR.dom.walker.whitespaces(); - return function( node ) - { - // Nodes that take no spaces in wysiwyg: - // 1. White-spaces but not including NBSP; - // 2. Empty inline elements, e.g. we're checking here - // 'offsetHeight' instead of 'offsetWidth' for properly excluding - // all sorts of empty paragraph, e.g.
            . - var isInvisible = whitespace( node ) || node.is && !node.$.offsetHeight; - return isReject ^ isInvisible; - }; - }; - - var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/, - isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), - isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ), - fillerEvaluator = function( element ) - { - return isNotBookmark( element ) && isNotWhitespaces( element ); - }; - - // Check if there's a filler node at the end of an element, and return it. - CKEDITOR.dom.element.prototype.getBogus = function () - { - var tail = this.getLast( fillerEvaluator ); - if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' ) - : tail.getText && tailNbspRegex.test( tail.getText() ) ) ) - { - return tail; - } - return false; - }; - -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dom/window.js b/Public/Resources/Javascript/ckeditor/_source/core/dom/window.js deleted file mode 100644 index 853b9bc..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dom/window.js +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dom.document} class, which - * represents a DOM document. - */ - -/** - * Represents a DOM window. - * @constructor - * @augments CKEDITOR.dom.domObject - * @param {Object} domWindow A native DOM window. - * @example - * var document = new CKEDITOR.dom.window( window ); - */ -CKEDITOR.dom.window = function( domWindow ) -{ - CKEDITOR.dom.domObject.call( this, domWindow ); -}; - -CKEDITOR.dom.window.prototype = new CKEDITOR.dom.domObject(); - -CKEDITOR.tools.extend( CKEDITOR.dom.window.prototype, - /** @lends CKEDITOR.dom.window.prototype */ - { - /** - * Moves the selection focus to this window. - * @function - * @example - * var win = new CKEDITOR.dom.window( window ); - * win.focus(); - */ - focus : function() - { - // Webkit is sometimes failed to focus iframe, blur it first(#3835). - if ( CKEDITOR.env.webkit && this.$.parent ) - this.$.parent.focus(); - // tobias@cention.se 2010-08-18: - // IE7 sometimes gives a permission denied error - // so lets put this in a try catch block - try - { - this.$.focus(); - } - catch ( e ) - { - } - }, - - /** - * Gets the width and height of this window's viewable area. - * @function - * @returns {Object} An object with the "width" and "height" - * properties containing the size. - * @example - * var win = new CKEDITOR.dom.window( window ); - * var size = win.getViewPaneSize(); - * alert( size.width ); - * alert( size.height ); - */ - getViewPaneSize : function() - { - var doc = this.$.document, - stdMode = doc.compatMode == 'CSS1Compat'; - return { - width : ( stdMode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0, - height : ( stdMode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0 - }; - }, - - /** - * Gets the current position of the window's scroll. - * @function - * @returns {Object} An object with the "x" and "y" properties - * containing the scroll position. - * @example - * var win = new CKEDITOR.dom.window( window ); - * var pos = win.getScrollPosition(); - * alert( pos.x ); - * alert( pos.y ); - */ - getScrollPosition : function() - { - var $ = this.$; - - if ( 'pageXOffset' in $ ) - { - return { - x : $.pageXOffset || 0, - y : $.pageYOffset || 0 - }; - } - else - { - var doc = $.document; - return { - x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0, - y : doc.documentElement.scrollTop || doc.body.scrollTop || 0 - }; - } - } - }); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/dtd.js b/Public/Resources/Javascript/ckeditor/_source/core/dtd.js deleted file mode 100644 index d5af5bf..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/dtd.js +++ /dev/null @@ -1,233 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD - * mapping for XHTML 1.0 Transitional. This file was automatically - * generated from the file: xhtml1-transitional.dtd. - */ - -/** - * Holds and object representation of the HTML DTD to be used by the editor in - * its internal operations. - * - * Each element in the DTD is represented by a - * property in this object. Each property contains the list of elements that - * can be contained by the element. Text is represented by the "#" property. - * - * Several special grouping properties are also available. Their names start - * with the "$" character. - * @namespace - * @example - * // Check if "div" can be contained in a "p" element. - * alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false" - * @example - * // Check if "p" can be contained in a "div" element. - * alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true" - * @example - * // Check if "p" is a block element. - * alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true" - */ -CKEDITOR.dtd = (function() -{ - var X = CKEDITOR.tools.extend, - - A = {isindex:1,fieldset:1}, - B = {input:1,button:1,select:1,textarea:1,label:1}, - C = X({a:1},B), - D = X({iframe:1},C), - E = {hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1}, - F = {ins:1,del:1,script:1,style:1}, - G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},F), - H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},G), - I = X({p:1},H), - J = X({iframe:1},H,B), - K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1}, - - L = X({a:1},J), - M = {tr:1}, - N = {'#':1}, - O = X({param:1},K), - P = X({form:1},A,D,E,I), - Q = {li:1}, - R = {style:1,script:1}, - S = {base:1,link:1,meta:1,title:1}, - T = X(S,R), - U = {head:1,body:1}, - V = {html:1}; - - var block = {address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1}; - - return /** @lends CKEDITOR.dtd */ { - - // The "$" items have been added manually. - - // List of elements living outside body. - $nonBodyContent: X(V,U,S), - - /** - * List of block elements, like "p" or "div". - * @type Object - * @example - */ - $block : block, - - /** - * List of block limit elements. - * @type Object - * @example - */ - $blockLimit : { body:1,div:1,td:1,th:1,caption:1,form:1 }, - - $inline : L, // Just like span. - - $body : X({script:1,style:1}, block), - - $cdata : {script:1,style:1}, - - /** - * List of empty (self-closing) elements, like "br" or "img". - * @type Object - * @example - */ - $empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1}, - - /** - * List of list item elements, like "li" or "dd". - * @type Object - * @example - */ - $listItem : {dd:1,dt:1,li:1}, - - /** - * List of list root elements. - * @type Object - * @example - */ - $list: { ul:1,ol:1,dl:1}, - - /** - * Elements that accept text nodes, but are not possible to edit into - * the browser. - * @type Object - * @example - */ - $nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1}, - - /** - * List of elements that can be ignored if empty, like "b" or "span". - * @type Object - * @example - */ - $removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1}, - - /** - * List of elements that have tabindex set to zero by default. - * @type Object - * @example - */ - $tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1}, - - /** - * List of elements used inside the "table" element, like "tbody" or "td". - * @type Object - * @example - */ - $tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1}, - - html: U, - head: T, - style: N, - script: N, - body: P, - base: {}, - link: {}, - meta: {}, - title: N, - col : {}, - tr : {td:1,th:1}, - img : {}, - colgroup : {col:1}, - noscript : P, - td : P, - br : {}, - th : P, - center : P, - kbd : L, - button : X(I,E), - basefont : {}, - h5 : L, - h4 : L, - samp : L, - h6 : L, - ol : Q, - h1 : L, - h3 : L, - option : N, - h2 : L, - form : X(A,D,E,I), - select : {optgroup:1,option:1}, - font : L, - ins : L, - menu : Q, - abbr : L, - label : L, - table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}, - code : L, - script : N, - tfoot : M, - cite : L, - li : P, - input : {}, - iframe : P, - strong : L, - textarea : N, - noframes : P, - big : L, - small : L, - span : L, - hr : {}, - dt : L, - sub : L, - optgroup : {option:1}, - param : {}, - bdo : L, - 'var' : L, - div : P, - object : O, - sup : L, - dd : P, - strike : L, - area : {}, - dir : Q, - map : X({area:1,form:1,p:1},A,F,E), - applet : O, - dl : {dt:1,dd:1}, - del : L, - isindex : {}, - fieldset : X({legend:1},K), - thead : M, - ul : Q, - acronym : L, - b : L, - a : J, - blockquote : P, - caption : L, - i : L, - u : L, - tbody : M, - s : L, - address : X(D,I), - tt : L, - legend : L, - q : L, - pre : X(G,C), - p : L, - em : L, - dfn : L - }; -})(); - -// PACKAGER_RENAME( CKEDITOR.dtd ) diff --git a/Public/Resources/Javascript/ckeditor/_source/core/editor.js b/Public/Resources/Javascript/ckeditor/_source/core/editor.js deleted file mode 100644 index 629c8d3..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/editor.js +++ /dev/null @@ -1,889 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.editor} class, which represents an - * editor instance. - */ - -(function() -{ - // The counter for automatic instance names. - var nameCounter = 0; - - var getNewName = function() - { - var name = 'editor' + ( ++nameCounter ); - return ( CKEDITOR.instances && CKEDITOR.instances[ name ] ) ? getNewName() : name; - }; - - // ##### START: Config Privates - - // These function loads custom configuration files and cache the - // CKEDITOR.editorConfig functions defined on them, so there is no need to - // download them more than once for several instances. - var loadConfigLoaded = {}; - var loadConfig = function( editor ) - { - var customConfig = editor.config.customConfig; - - // Check if there is a custom config to load. - if ( !customConfig ) - return false; - - customConfig = CKEDITOR.getUrl( customConfig ); - - var loadedConfig = loadConfigLoaded[ customConfig ] || ( loadConfigLoaded[ customConfig ] = {} ); - - // If the custom config has already been downloaded, reuse it. - if ( loadedConfig.fn ) - { - // Call the cached CKEDITOR.editorConfig defined in the custom - // config file for the editor instance depending on it. - loadedConfig.fn.call( editor, editor.config ); - - // If there is no other customConfig in the chain, fire the - // "configLoaded" event. - if ( CKEDITOR.getUrl( editor.config.customConfig ) == customConfig || !loadConfig( editor ) ) - editor.fireOnce( 'customConfigLoaded' ); - } - else - { - // Load the custom configuration file. - CKEDITOR.scriptLoader.load( customConfig, function() - { - // If the CKEDITOR.editorConfig function has been properly - // defined in the custom configuration file, cache it. - if ( CKEDITOR.editorConfig ) - loadedConfig.fn = CKEDITOR.editorConfig; - else - loadedConfig.fn = function(){}; - - // Call the load config again. This time the custom - // config is already cached and so it will get loaded. - loadConfig( editor ); - }); - } - - return true; - }; - - var initConfig = function( editor, instanceConfig ) - { - // Setup the lister for the "customConfigLoaded" event. - editor.on( 'customConfigLoaded', function() - { - if ( instanceConfig ) - { - // Register the events that may have been set at the instance - // configuration object. - if ( instanceConfig.on ) - { - for ( var eventName in instanceConfig.on ) - { - editor.on( eventName, instanceConfig.on[ eventName ] ); - } - } - - // Overwrite the settings from the in-page config. - CKEDITOR.tools.extend( editor.config, instanceConfig, true ); - - delete editor.config.on; - } - - onConfigLoaded( editor ); - }); - - // The instance config may override the customConfig setting to avoid - // loading the default ~/config.js file. - if ( instanceConfig && instanceConfig.customConfig != undefined ) - editor.config.customConfig = instanceConfig.customConfig; - - // Load configs from the custom configuration files. - if ( !loadConfig( editor ) ) - editor.fireOnce( 'customConfigLoaded' ); - }; - - // ##### END: Config Privates - - var onConfigLoaded = function( editor ) - { - // Set config related properties. - - var skin = editor.config.skin.split( ',' ), - skinName = skin[ 0 ], - skinPath = CKEDITOR.getUrl( skin[ 1 ] || ( - '_source/' + // @Packager.RemoveLine - 'skins/' + skinName + '/' ) ); - - editor.skinName = skinName; - editor.skinPath = skinPath; - editor.skinClass = 'cke_skin_' + skinName; - - editor.tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; - - // Fire the "configLoaded" event. - editor.fireOnce( 'configLoaded' ); - - // Load language file. - loadSkin( editor ); - }; - - var loadLang = function( editor ) - { - CKEDITOR.lang.load( editor.config.language, editor.config.defaultLanguage, function( languageCode, lang ) - { - editor.langCode = languageCode; - - // As we'll be adding plugin specific entries that could come - // from different language code files, we need a copy of lang, - // not a direct reference to it. - editor.lang = CKEDITOR.tools.prototypedCopy( lang ); - - // We're not able to support RTL in Firefox 2 at this time. - if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 && editor.lang.dir == 'rtl' ) - editor.lang.dir = 'ltr'; - - var config = editor.config; - config.contentsLangDirection == 'ui' && ( config.contentsLangDirection = editor.lang.dir ); - - loadPlugins( editor ); - }); - }; - - var loadPlugins = function( editor ) - { - var config = editor.config, - plugins = config.plugins, - extraPlugins = config.extraPlugins, - removePlugins = config.removePlugins; - - if ( extraPlugins ) - { - // Remove them first to avoid duplications. - var removeRegex = new RegExp( '(?:^|,)(?:' + extraPlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' ); - plugins = plugins.replace( removeRegex, '' ); - - plugins += ',' + extraPlugins; - } - - if ( removePlugins ) - { - removeRegex = new RegExp( '(?:^|,)(?:' + removePlugins.replace( /\s*,\s*/g, '|' ) + ')(?=,|$)' , 'g' ); - plugins = plugins.replace( removeRegex, '' ); - } - - // Load all plugins defined in the "plugins" setting. - CKEDITOR.plugins.load( plugins.split( ',' ), function( plugins ) - { - // The list of plugins. - var pluginsArray = []; - - // The language code to get loaded for each plugin. Null - // entries will be appended for plugins with no language files. - var languageCodes = []; - - // The list of URLs to language files. - var languageFiles = []; - - // Cache the loaded plugin names. - editor.plugins = plugins; - - // Loop through all plugins, to build the list of language - // files to get loaded. - for ( var pluginName in plugins ) - { - var plugin = plugins[ pluginName ], - pluginLangs = plugin.lang, - pluginPath = CKEDITOR.plugins.getPath( pluginName ), - lang = null; - - // Set the plugin path in the plugin. - plugin.path = pluginPath; - - // If the plugin has "lang". - if ( pluginLangs ) - { - // Resolve the plugin language. If the current language - // is not available, get the first one (default one). - lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] ); - - if ( !plugin.lang[ lang ] ) - { - // Put the language file URL into the list of files to - // get downloaded. - languageFiles.push( CKEDITOR.getUrl( pluginPath + 'lang/' + lang + '.js' ) ); - } - else - { - CKEDITOR.tools.extend( editor.lang, plugin.lang[ lang ] ); - lang = null; - } - } - - // Save the language code, so we know later which - // language has been resolved to this plugin. - languageCodes.push( lang ); - - pluginsArray.push( plugin ); - } - - // Load all plugin specific language files in a row. - CKEDITOR.scriptLoader.load( languageFiles, function() - { - // Initialize all plugins that have the "beforeInit" and "init" methods defined. - var methods = [ 'beforeInit', 'init', 'afterInit' ]; - for ( var m = 0 ; m < methods.length ; m++ ) - { - for ( var i = 0 ; i < pluginsArray.length ; i++ ) - { - var plugin = pluginsArray[ i ]; - - // Uses the first loop to update the language entries also. - if ( m === 0 && languageCodes[ i ] && plugin.lang ) - CKEDITOR.tools.extend( editor.lang, plugin.lang[ languageCodes[ i ] ] ); - - // Call the plugin method (beforeInit and init). - if ( plugin[ methods[ m ] ] ) - plugin[ methods[ m ] ]( editor ); - } - } - - // Load the editor skin. - editor.fire( 'pluginsLoaded' ); - loadTheme( editor ); - }); - }); - }; - - var loadSkin = function( editor ) - { - CKEDITOR.skins.load( editor, 'editor', function() - { - loadLang( editor ); - }); - }; - - var loadTheme = function( editor ) - { - var theme = editor.config.theme; - CKEDITOR.themes.load( theme, function() - { - var editorTheme = editor.theme = CKEDITOR.themes.get( theme ); - editorTheme.path = CKEDITOR.themes.getPath( theme ); - editorTheme.build( editor ); - - if ( editor.config.autoUpdateElement ) - attachToForm( editor ); - }); - }; - - var attachToForm = function( editor ) - { - var element = editor.element; - - // If are replacing a textarea, we must - if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.is( 'textarea' ) ) - { - var form = element.$.form && new CKEDITOR.dom.element( element.$.form ); - if ( form ) - { - function onSubmit() - { - editor.updateElement(); - } - form.on( 'submit',onSubmit ); - - // Setup the submit function because it doesn't fire the - // "submit" event. - if ( !form.$.submit.nodeName ) - { - form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit ) - { - return function() - { - editor.updateElement(); - - // For IE, the DOM submit function is not a - // function, so we need thid check. - if ( originalSubmit.apply ) - originalSubmit.apply( this, arguments ); - else - originalSubmit(); - }; - }); - } - - // Remove 'submit' events registered on form element before destroying.(#3988) - editor.on( 'destroy', function() - { - form.removeListener( 'submit', onSubmit ); - } ); - } - } - }; - - function updateCommandsMode() - { - var command, - commands = this._.commands, - mode = this.mode; - - for ( var name in commands ) - { - command = commands[ name ]; - command[ command.startDisabled ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ](); - } - } - - /** - * Initializes the editor instance. This function is called by the editor - * contructor (editor_basic.js). - * @private - */ - CKEDITOR.editor.prototype._init = function() - { - // Get the properties that have been saved in the editor_base - // implementation. - var element = CKEDITOR.dom.element.get( this._.element ), - instanceConfig = this._.instanceConfig; - delete this._.element; - delete this._.instanceConfig; - - this._.commands = {}; - this._.styles = []; - - /** - * The DOM element that has been replaced by this editor instance. This - * element holds the editor data on load and post. - * @name CKEDITOR.editor.prototype.element - * @type CKEDITOR.dom.element - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.element.getName() ); "textarea" - */ - this.element = element; - - /** - * The editor instance name. It hay be the replaced element id, name or - * a default name using a progressive counter (editor1, editor2, ...). - * @name CKEDITOR.editor.prototype.name - * @type String - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.name ); "editor1" - */ - this.name = ( element && ( this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - && ( element.getId() || element.getNameAtt() ) ) - || getNewName(); - - if ( this.name in CKEDITOR.instances ) - throw '[CKEDITOR.editor] The instance "' + this.name + '" already exists.'; - - /** - * The configurations for this editor instance. It inherits all - * settings defined in (@link CKEDITOR.config}, combined with settings - * loaded from custom configuration files and those defined inline in - * the page when creating the editor. - * @name CKEDITOR.editor.prototype.config - * @type Object - * @example - * var editor = CKEDITOR.instances.editor1; - * alert( editor.config.theme ); "default" e.g. - */ - this.config = CKEDITOR.tools.prototypedCopy( CKEDITOR.config ); - - /** - * Namespace containing UI features related to this editor instance. - * @name CKEDITOR.editor.prototype.ui - * @type CKEDITOR.ui - * @example - */ - this.ui = new CKEDITOR.ui( this ); - - /** - * Controls the focus state of this editor instance. This property - * is rarely used for normal API operations. It is mainly - * destinated to developer adding UI elements to the editor interface. - * @name CKEDITOR.editor.prototype.focusManager - * @type CKEDITOR.focusManager - * @example - */ - this.focusManager = new CKEDITOR.focusManager( this ); - - CKEDITOR.fire( 'instanceCreated', null, this ); - - this.on( 'mode', updateCommandsMode, null, null, 1 ); - - initConfig( this, instanceConfig ); - }; -})(); - -CKEDITOR.tools.extend( CKEDITOR.editor.prototype, - /** @lends CKEDITOR.editor.prototype */ - { - /** - * Adds a command definition to the editor instance. Commands added with - * this function can be later executed with {@link #execCommand}. - * @param {String} commandName The indentifier name of the command. - * @param {CKEDITOR.commandDefinition} commandDefinition The command definition. - * @example - * editorInstance.addCommand( 'sample', - * { - * exec : function( editor ) - * { - * alert( 'Executing a command for the editor name "' + editor.name + '"!' ); - * } - * }); - */ - addCommand : function( commandName, commandDefinition ) - { - return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition ); - }, - - /** - * Add a trunk of css text to the editor which will be applied to the wysiwyg editing document. - * Note: This function should be called before editor is loaded to take effect. - * @param css {String} CSS text. - * @example - * editorInstance.addCss( 'body { background-color: grey; }' ); - */ - addCss : function( css ) - { - this._.styles.push( css ); - }, - - /** - * Destroys the editor instance, releasing all resources used by it. - * If the editor replaced an element, the element will be recovered. - * @param {Boolean} [noUpdate] If the instance is replacing a DOM - * element, this parameter indicates whether or not to update the - * element with the instance contents. - * @example - * alert( CKEDITOR.instances.editor1 ); e.g "object" - * CKEDITOR.instances.editor1.destroy(); - * alert( CKEDITOR.instances.editor1 ); "undefined" - */ - destroy : function( noUpdate ) - { - if ( !noUpdate ) - this.updateElement(); - - if ( this.mode ) - { - // -> currentMode.unload( holderElement ); - this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) ); - } - - this.theme.destroy( this ); - - var toolbars, - index = 0, - j, - items, - instance; - - if ( this.toolbox ) - { - toolbars = this.toolbox.toolbars; - for ( ; index < toolbars.length ; index++ ) - { - items = toolbars[ index ].items; - for ( j = 0 ; j < items.length ; j++ ) - { - instance = items[ j ]; - if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); - if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); - - if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null; - } - } - } - - if ( this.contextMenu ) - CKEDITOR.tools.removeFunction( this.contextMenu._.functionId ); - - if ( this._.filebrowserFn ) - CKEDITOR.tools.removeFunction( this._.filebrowserFn ); - - this.fire( 'destroy' ); - CKEDITOR.remove( this ); - CKEDITOR.fire( 'instanceDestroyed', null, this ); - }, - - /** - * Executes a command. - * @param {String} commandName The indentifier name of the command. - * @param {Object} [data] Data to be passed to the command - * @returns {Boolean} "true" if the command has been successfuly - * executed, otherwise "false". - * @example - * editorInstance.execCommand( 'Bold' ); - */ - execCommand : function( commandName, data ) - { - var command = this.getCommand( commandName ); - - var eventData = - { - name: commandName, - commandData: data, - command: command - }; - - if ( command && command.state != CKEDITOR.TRISTATE_DISABLED ) - { - if ( this.fire( 'beforeCommandExec', eventData ) !== true ) - { - eventData.returnValue = command.exec( eventData.commandData ); - - // Fire the 'afterCommandExec' immediately if command is synchronous. - if ( !command.async && this.fire( 'afterCommandExec', eventData ) !== true ) - return eventData.returnValue; - } - } - - // throw 'Unknown command name "' + commandName + '"'; - return false; - }, - - /** - * Gets one of the registered commands. Note that, after registering a - * command definition with addCommand, it is transformed internally - * into an instance of {@link CKEDITOR.command}, which will be then - * returned by this function. - * @param {String} commandName The name of the command to be returned. - * This is the same used to register the command with addCommand. - * @returns {CKEDITOR.command} The command object identified by the - * provided name. - */ - getCommand : function( commandName ) - { - return this._.commands[ commandName ]; - }, - - /** - * Gets the editor data. The data will be in raw format. It is the same - * data that is posted by the editor. - * @type String - * @returns (String) The editor data. - * @example - * if ( CKEDITOR.instances.editor1.getData() == '' ) - * alert( 'There is no data available' ); - */ - getData : function() - { - this.fire( 'beforeGetData' ); - - var eventData = this._.data; - - if ( typeof eventData != 'string' ) - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - eventData = element.is( 'textarea' ) ? element.getValue() : element.getHtml(); - else - eventData = ''; - } - - eventData = { dataValue : eventData }; - - // Fire "getData" so data manipulation may happen. - this.fire( 'getData', eventData ); - - return eventData.dataValue; - }, - - getSnapshot : function() - { - var data = this.fire( 'getSnapshot' ); - - if ( typeof data != 'string' ) - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - data = element.is( 'textarea' ) ? element.getValue() : element.getHtml(); - } - - return data; - }, - - loadSnapshot : function( snapshot ) - { - this.fire( 'loadSnapshot', snapshot ); - }, - - /** - * Sets the editor data. The data must be provided in raw format (HTML).
            - *
            - * Note that this menthod is asynchronous. The "callback" parameter must - * be used if interaction with the editor is needed after setting the data. - * @param {String} data HTML code to replace the curent content in the - * editor. - * @param {Function} callback Function to be called after the setData - * is completed. - * @example - * CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' ); - * @example - * CKEDITOR.instances.editor1.setData( '<p>Some other editor data.</p>', function() - * { - * this.checkDirty(); // true - * }); - */ - setData : function( data , callback ) - { - - if( callback ) - { - this.on( 'dataReady', function( evt ) - { - evt.removeListener(); - callback.call( evt.editor ); - } ); - } - - // Fire "setData" so data manipulation may happen. - var eventData = { dataValue : data }; - this.fire( 'setData', eventData ); - - this._.data = eventData.dataValue; - - this.fire( 'afterSetData', eventData ); - }, - - /** - * Inserts HTML into the currently selected position in the editor. - * @param {String} data HTML code to be inserted into the editor. - * @example - * CKEDITOR.instances.editor1.insertHtml( '<p>This is a new paragraph.</p>' ); - */ - insertHtml : function( data ) - { - this.fire( 'insertHtml', data ); - }, - - /** - * Inserts an element into the currently selected position in the - * editor. - * @param {CKEDITOR.dom.element} element The element to be inserted - * into the editor. - * @example - * var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' ); - * CKEDITOR.instances.editor1.insertElement( element ); - */ - insertElement : function( element ) - { - this.fire( 'insertElement', element ); - }, - - checkDirty : function() - { - return ( this.mayBeDirty && this._.previousValue !== this.getSnapshot() ); - }, - - resetDirty : function() - { - if ( this.mayBeDirty ) - this._.previousValue = this.getSnapshot(); - }, - - /** - * Updates the <textarea> element that has been replaced by the editor with - * the current data available in the editor. - * @example - * CKEDITOR.instances.editor1.updateElement(); - * alert( document.getElementById( 'editor1' ).value ); // The current editor data. - */ - updateElement : function() - { - var element = this.element; - if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - { - var data = this.getData(); - - if ( this.config.htmlEncodeOutput ) - data = CKEDITOR.tools.htmlEncode( data ); - - if ( element.is( 'textarea' ) ) { - element.setValue( data ); - } - else { - element.setHtml( data ); - } - } - }, - - setPlainTextMode : function( enable ) - { - if ( enable ) - { - /* TODO: Make this list configurable */ - this.hideToolbarItems( [ - 'CentionSpellCheckLanguage', - 'CentionSpellCheck', - 'CentionSpellCheckDone' - ] ); - this.inPlainTextMode = true; - this.returnPlainText = true; - this.config.forcePasteAsPlainText = true; - } - else - { - this.showToolbarItems(); - this.inPlainTextMode = false; - this.returnPlainText = false; - this.config.forcePasteAsPlainText = false; - } - }, - - showToolbarItems : function() - { - if ( this.toolbox ) - { - var toolbarsLength = this.toolbox.toolbars.length; - var toolbarContainer = null; - var i; - var j; - - for ( i = 0; i < toolbarsLength; i++ ) - { - var toolbar = this.toolbox.toolbars[i]; - var toolbarElement = CKEDITOR.document.getById( toolbar.id ); - var itemsLength = toolbar.items.length; - - toolbarElement.show(); - - if ( !toolbarContainer ) - { - toolbarContainer = toolbarElement.getParent(); - } - - for ( j = 0; j < itemsLength; j++ ) - { - var item = toolbar.items[ j ]; - var itemElement = CKEDITOR.document.getById( item.id ); - if ( itemElement ) - itemElement.getParent().show(); - } - } - - if ( toolbarContainer ) - { - var breaks = toolbarContainer.$.getElementsByTagName( 'div' ); - var breaksLength = breaks.length; - - for ( i = 0; i < breaksLength; i++ ) - { - breaks[i].style.display = ''; - } - } - } - }, - - hideToolbarItems : function( skipList ) - { - if ( this.toolbox ) - { - var toolbarsLength = this.toolbox.toolbars.length; - var toolbarContainer = null; - var allToolbarsHidden = true; - var i; - var j; - - for ( i = 0; i < toolbarsLength; i++ ) - { - var toolbar = this.toolbox.toolbars[ i ]; - var toolbarElement = CKEDITOR.document.getById( toolbar.id ); - var itemsLength = toolbar.items.length; - var allItemsHidden = true; - - if ( !toolbarContainer ) - { - toolbarContainer = toolbarElement.getParent(); - } - - if ( skipList ) - { - for ( j = 0; j < itemsLength; j++ ) - { - var item = toolbar.items[ j ]; - - if ( skipList.indexOf( item.itemName ) == -1 ) - { - var itemElement = CKEDITOR.document.getById( item.id ); - if ( itemElement ) - itemElement.getParent().hide(); - } - else - { - allItemsHidden = false; - allToolbarsHidden = false; - } - } - } - - if ( allItemsHidden ) - toolbarElement.hide(); - } - - - if ( toolbarContainer && !allToolbarsHidden ) - { - var breaks = toolbarContainer.$.getElementsByTagName( 'div' ); - var breaksLength = breaks.length; - - for ( i = 0; i < breaksLength; i++ ) - { - breaks[i].style.display = 'none'; - } - } - } - } - }); - -CKEDITOR.on( 'loaded', function() - { - // Run the full initialization for pending editors. - var pending = CKEDITOR.editor._pending; - if ( pending ) - { - delete CKEDITOR.editor._pending; - - for ( var i = 0 ; i < pending.length ; i++ ) - pending[ i ]._init(); - } - }); - -/** - * Whether escape HTML when editor update original input element. - * @name CKEDITOR.config.htmlEncodeOutput - * @since 3.1 - * @type Boolean - * @default false - * @example - * config.htmlEncodeOutput = true; - */ - -/** - * Fired when a CKEDITOR instance is created, but still before initializing it. - * To interact with a fully initialized instance, use the - * {@link CKEDITOR#instanceReady} event instead. - * @name CKEDITOR#instanceCreated - * @event - * @param {CKEDITOR.editor} editor The editor instance that has been created. - */ - -/** - * Fired when a CKEDITOR instance is destroyed. - * @name CKEDITOR#instanceDestroyed - * @event - * @param {CKEDITOR.editor} editor The editor instance that has been destroyed. - */ - -/** - * Fired when all plugins are loaded and initialized into the editor instance. - * @name CKEDITOR#pluginsLoaded - * @event - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/editor_basic.js b/Public/Resources/Javascript/ckeditor/_source/core/editor_basic.js deleted file mode 100644 index ec90bf7..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/editor_basic.js +++ /dev/null @@ -1,182 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -if ( !CKEDITOR.editor ) -{ - /** - * No element is linked to the editor instance. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_NONE = 0; - - /** - * The element is to be replaced by the editor instance. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_REPLACE = 1; - - /** - * The editor is to be created inside the element. - * @constant - * @example - */ - CKEDITOR.ELEMENT_MODE_APPENDTO = 2; - - /** - * Represents an editor instance. This constructor should be rarely used, - * being the {@link CKEDITOR} methods preferible. - * @constructor - * @param {Object} instanceConfig Configuration values for this specific - * instance. - * @param {CKEDITOR.dom.element} [element] The element linked to this - * instance. - * @param {Number} [mode] The mode in which the element is linked to this - * instance. - * @param {String} [data] Since 3.3. Initial value for the instance. - * @augments CKEDITOR.event - * @example - */ - CKEDITOR.editor = function( instanceConfig, element, mode, data ) - { - this._ = - { - // Save the config to be processed later by the full core code. - instanceConfig : instanceConfig, - element : element, - data : data - }; - - /** - * The mode in which the {@link #element} is linked to this editor - * instance. It can be any of the following values: - *
              - *
            • CKEDITOR.ELEMENT_MODE_NONE: No element is linked to the - * editor instance.
            • - *
            • CKEDITOR.ELEMENT_MODE_REPLACE: The element is to be - * replaced by the editor instance.
            • - *
            • CKEDITOR.ELEMENT_MODE_APPENDTO: The editor is to be - * created inside the element.
            • - *
            - * @name CKEDITOR.editor.prototype.elementMode - * @type Number - * @example - * var editor = CKEDITOR.replace( 'editor1' ); - * alert( editor.elementMode ); "1" - */ - this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE; - - // Call the CKEDITOR.event constructor to initialize this instance. - CKEDITOR.event.call( this ); - - this._init(); - }; - - /** - * Replaces a <textarea> or a DOM element (DIV) with a CKEditor - * instance. For textareas, the initial value in the editor will be the - * textarea value. For DOM elements, their innerHTML will be used - * instead. We recommend using TEXTAREA and DIV elements only. Do not use - * this function directly. Use {@link CKEDITOR.replace} instead. - * @param {Object|String} elementOrIdOrName The DOM element (textarea), its - * ID or name. - * @param {Object} [config] The specific configurations to apply to this - * editor instance. Configurations set here will override global CKEditor - * settings. - * @returns {CKEDITOR.editor} The editor instance created. - * @example - */ - CKEDITOR.editor.replace = function( elementOrIdOrName, config ) - { - var element = elementOrIdOrName; - - if ( typeof element != 'object' ) - { - // Look for the element by id. We accept any kind of element here. - element = document.getElementById( elementOrIdOrName ); - - // If not found, look for elements by name. In this case we accept only - // textareas. - if ( !element ) - { - var i = 0, - textareasByName = document.getElementsByName( elementOrIdOrName ); - - while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' ) - { /*jsl:pass*/ } - } - - if ( !element ) - throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.'; - } - - // Do not replace the textarea right now, just hide it. The effective - // replacement will be done by the _init function. - element.style.visibility = 'hidden'; - - // Create the editor instance. - return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE ); - }; - - /** - * Creates a new editor instance inside a specific DOM element. Do not use - * this function directly. Use {@link CKEDITOR.appendTo} instead. - * @param {Object|String} elementOrId The DOM element or its ID. - * @param {Object} [config] The specific configurations to apply to this - * editor instance. Configurations set here will override global CKEditor - * settings. - * @param {String} [data] Since 3.3. Initial value for the instance. - * @returns {CKEDITOR.editor} The editor instance created. - * @example - */ - CKEDITOR.editor.appendTo = function( elementOrId, config, data ) - { - var element = elementOrId; - if ( typeof element != 'object' ) - { - element = document.getElementById( elementOrId ); - - if ( !element ) - throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.'; - } - - // Create the editor instance. - return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data ); - }; - - CKEDITOR.editor.prototype = - { - /** - * Initializes the editor instance. This function will be overriden by the - * full CKEDITOR.editor implementation (editor.js). - * @private - */ - _init : function() - { - var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] ); - pending.push( this ); - }, - - // Both fire and fireOnce will always pass this editor instance as the - // "editor" param in CKEDITOR.event.fire. So, we override it to do that - // automaticaly. - - /** @ignore */ - fire : function( eventName, data ) - { - return CKEDITOR.event.prototype.fire.call( this, eventName, data, this ); - }, - - /** @ignore */ - fireOnce : function( eventName, data ) - { - return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this ); - } - }; - - // "Inherit" (copy actually) from CKEDITOR.event. - CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true ); -} diff --git a/Public/Resources/Javascript/ckeditor/_source/core/env.js b/Public/Resources/Javascript/ckeditor/_source/core/env.js deleted file mode 100644 index a0ae465..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/env.js +++ /dev/null @@ -1,229 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.env} object, which constains - * environment and browser information. - */ - -if ( !CKEDITOR.env ) -{ - /** - * Environment and browser information. - * @namespace - * @example - */ - CKEDITOR.env = (function() - { - var agent = navigator.userAgent.toLowerCase(); - var opera = window.opera; - - var env = - /** @lends CKEDITOR.env */ - { - /** - * Indicates that CKEditor is running on Internet Explorer. - * @type Boolean - * @example - * if ( CKEDITOR.env.ie ) - * alert( "I'm on IE!" ); - */ - ie : /*@cc_on!@*/false, - - /** - * Indicates that CKEditor is running on Opera. - * @type Boolean - * @example - * if ( CKEDITOR.env.opera ) - * alert( "I'm on Opera!" ); - */ - opera : ( !!opera && opera.version ), - - /** - * Indicates that CKEditor is running on a WebKit based browser, like - * Safari. - * @type Boolean - * @example - * if ( CKEDITOR.env.webkit ) - * alert( "I'm on WebKit!" ); - */ - webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ), - - /** - * Indicates that CKEditor is running on Adobe AIR. - * @type Boolean - * @example - * if ( CKEDITOR.env.air ) - * alert( "I'm on AIR!" ); - */ - air : ( agent.indexOf( ' adobeair/' ) > -1 ), - - /** - * Indicates that CKEditor is running on Macintosh. - * @type Boolean - * @example - * if ( CKEDITOR.env.mac ) - * alert( "I love apples!" ); - */ - mac : ( agent.indexOf( 'macintosh' ) > -1 ), - - quirks : ( document.compatMode == 'BackCompat' ), - - mobile : ( agent.indexOf( 'mobile' ) > -1 ), - - isCustomDomain : function() - { - if ( !this.ie ) - return false; - - var domain = document.domain, - hostname = window.location.hostname; - - return domain != hostname && - domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434) - } - }; - - /** - * Indicates that CKEditor is running on a Gecko based browser, like - * Firefox. - * @name CKEDITOR.env.gecko - * @type Boolean - * @example - * if ( CKEDITOR.env.gecko ) - * alert( "I'm riding a gecko!" ); - */ - env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera ); - - var version = 0; - - // Internet Explorer 6.0+ - if ( env.ie ) - { - version = parseFloat( agent.match( /msie (\d+)/ )[1] ); - - /** - * Indicate IE8 browser. - */ - env.ie8 = !!document.documentMode; - - /** - * Indicte IE8 document mode. - */ - env.ie8Compat = document.documentMode == 8; - - /** - * Indicates that CKEditor is running on an IE7-like environment, which - * includes IE7 itself and IE8's IE7 document mode. - * @type Boolean - */ - env.ie7Compat = ( ( version == 7 && !document.documentMode ) - || document.documentMode == 7 ); - - /** - * Indicates that CKEditor is running on an IE6-like environment, which - * includes IE6 itself and IE7 and IE8 quirks mode. - * @type Boolean - * @example - * if ( CKEDITOR.env.ie6Compat ) - * alert( "I'm on IE6 or quirks mode!" ); - */ - env.ie6Compat = ( version < 7 || env.quirks ); - - } - - // Gecko. - if ( env.gecko ) - { - var geckoRelease = agent.match( /rv:([\d\.]+)/ ); - if ( geckoRelease ) - { - geckoRelease = geckoRelease[1].split( '.' ); - version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1; - } - } - - // Opera 9.50+ - if ( env.opera ) - version = parseFloat( opera.version() ); - - // Adobe AIR 1.0+ - // Checked before Safari because AIR have the WebKit rich text editor - // features from Safari 3.0.4, but the version reported is 420. - if ( env.air ) - version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] ); - - // WebKit 522+ (Safari 3+) - if ( env.webkit ) - version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] ); - - /** - * Contains the browser version. - * - * For gecko based browsers (like Firefox) it contains the revision - * number with first three parts concatenated with a padding zero - * (e.g. for revision 1.9.0.2 we have 10900). - * - * For webkit based browser (like Safari and Chrome) it contains the - * WebKit build version (e.g. 522). - * @name CKEDITOR.env.version - * @type Boolean - * @example - * if ( CKEDITOR.env.ie && CKEDITOR.env.version <= 6 ) - * alert( "Ouch!" ); - */ - env.version = version; - - /** - * Indicates that CKEditor is running on a compatible browser. - * @name CKEDITOR.env.isCompatible - * @type Boolean - * @example - * if ( CKEDITOR.env.isCompatible ) - * alert( "Your browser is pretty cool!" ); - */ - env.isCompatible = - !env.mobile && ( - ( env.ie && version >= 6 ) || - ( env.gecko && version >= 10801 ) || - ( env.opera && version >= 9.5 ) || - ( env.air && version >= 1 ) || - ( env.webkit && version >= 522 ) || - false ); - - // The CSS class to be appended on the main UI containers, making it - // easy to apply browser specific styles to it. - env.cssClass = - 'cke_browser_' + ( - env.ie ? 'ie' : - env.gecko ? 'gecko' : - env.opera ? 'opera' : - env.air ? 'air' : - env.webkit ? 'webkit' : - 'unknown' ); - - if ( env.quirks ) - env.cssClass += ' cke_browser_quirks'; - - if ( env.ie ) - { - env.cssClass += ' cke_browser_ie' + ( - env.version < 7 ? '6' : - env.version >= 8 ? '8' : - '7' ); - - if ( env.quirks ) - env.cssClass += ' cke_browser_iequirks'; - } - - if ( env.gecko && version < 10900 ) - env.cssClass += ' cke_browser_gecko18'; - - return env; - })(); -} - -// PACKAGER_RENAME( CKEDITOR.env ) -// PACKAGER_RENAME( CKEDITOR.env.ie ) diff --git a/Public/Resources/Javascript/ckeditor/_source/core/event.js b/Public/Resources/Javascript/ckeditor/_source/core/event.js deleted file mode 100644 index 8668a3d..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/event.js +++ /dev/null @@ -1,336 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.event} class, which serves as the - * base for classes and objects that require event handling features. - */ - -if ( !CKEDITOR.event ) -{ - /** - * This is a base class for classes and objects that require event handling - * features. - * @constructor - * @example - */ - CKEDITOR.event = function() - {}; - - /** - * Implements the {@link CKEDITOR.event} features in an object. - * @param {Object} targetObject The object in which implement the features. - * @example - * var myObject = { message : 'Example' }; - * CKEDITOR.event.implementOn( myObject }; - * myObject.on( 'testEvent', function() - * { - * alert( this.message ); // "Example" - * }); - * myObject.fire( 'testEvent' ); - */ - CKEDITOR.event.implementOn = function( targetObject, isTargetPrototype ) - { - var eventProto = CKEDITOR.event.prototype; - - for ( var prop in eventProto ) - { - if ( targetObject[ prop ] == undefined ) - targetObject[ prop ] = eventProto[ prop ]; - } - }; - - CKEDITOR.event.prototype = (function() - { - // Returns the private events object for a given object. - var getPrivate = function( obj ) - { - var _ = ( obj.getPrivate && obj.getPrivate() ) || obj._ || ( obj._ = {} ); - return _.events || ( _.events = {} ); - }; - - var eventEntry = function( eventName ) - { - this.name = eventName; - this.listeners = []; - }; - - eventEntry.prototype = - { - // Get the listener index for a specified function. - // Returns -1 if not found. - getListenerIndex : function( listenerFunction ) - { - for ( var i = 0, listeners = this.listeners ; i < listeners.length ; i++ ) - { - if ( listeners[i].fn == listenerFunction ) - return i; - } - return -1; - } - }; - - return /** @lends CKEDITOR.event.prototype */ { - /** - * Registers a listener to a specific event in the current object. - * @param {String} eventName The event name to which listen. - * @param {Function} listenerFunction The function listening to the - * event. A single {@link CKEDITOR.eventInfo} object instanced - * is passed to this function containing all the event data. - * @param {Object} [scopeObj] The object used to scope the listener - * call (the this object. If omitted, the current object is used. - * @param {Object} [listenerData] Data to be sent as the - * {@link CKEDITOR.eventInfo#listenerData} when calling the - * listener. - * @param {Number} [priority] The listener priority. Lower priority - * listeners are called first. Listeners with the same priority - * value are called in registration order. Defaults to 10. - * @example - * someObject.on( 'someEvent', function() - * { - * alert( this == someObject ); // "true" - * }); - * @example - * someObject.on( 'someEvent', function() - * { - * alert( this == anotherObject ); // "true" - * } - * , anotherObject ); - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.listenerData ); // "Example" - * } - * , null, 'Example' ); - * @example - * someObject.on( 'someEvent', function() { ... } ); // 2nd called - * someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called - * someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st called - */ - on : function( eventName, listenerFunction, scopeObj, listenerData, priority ) - { - // Get the event entry (create it if needed). - var events = getPrivate( this ), - event = events[ eventName ] || ( events[ eventName ] = new eventEntry( eventName ) ); - - if ( event.getListenerIndex( listenerFunction ) < 0 ) - { - // Get the listeners. - var listeners = event.listeners; - - // Fill the scope. - if ( !scopeObj ) - scopeObj = this; - - // Default the priority, if needed. - if ( isNaN( priority ) ) - priority = 10; - - var me = this; - - // Create the function to be fired for this listener. - var listenerFirer = function( editor, publisherData, stopFn, cancelFn ) - { - var ev = - { - name : eventName, - sender : this, - editor : editor, - data : publisherData, - listenerData : listenerData, - stop : stopFn, - cancel : cancelFn, - removeListener : function() - { - me.removeListener( eventName, listenerFunction ); - } - }; - - listenerFunction.call( scopeObj, ev ); - - return ev.data; - }; - listenerFirer.fn = listenerFunction; - listenerFirer.priority = priority; - - // Search for the right position for this new listener, based on its - // priority. - for ( var i = listeners.length - 1 ; i >= 0 ; i-- ) - { - // Find the item which should be before the new one. - if ( listeners[ i ].priority <= priority ) - { - // Insert the listener in the array. - listeners.splice( i + 1, 0, listenerFirer ); - return; - } - } - - // If no position has been found (or zero length), put it in - // the front of list. - listeners.unshift( listenerFirer ); - } - }, - - /** - * Fires an specific event in the object. All registered listeners are - * called at this point. - * @function - * @param {String} eventName The event name to fire. - * @param {Object} [data] Data to be sent as the - * {@link CKEDITOR.eventInfo#data} when calling the - * listeners. - * @param {CKEDITOR.editor} [editor] The editor instance to send as the - * {@link CKEDITOR.eventInfo#editor} when calling the - * listener. - * @returns {Boolean|Object} A booloan indicating that the event is to be - * canceled, or data returned by one of the listeners. - * @example - * someObject.on( 'someEvent', function() { ... } ); - * someObject.on( 'someEvent', function() { ... } ); - * someObject.fire( 'someEvent' ); // both listeners are called - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.data ); // "Example" - * }); - * someObject.fire( 'someEvent', 'Example' ); - */ - fire : (function() - { - // Create the function that marks the event as stopped. - var stopped = false; - var stopEvent = function() - { - stopped = true; - }; - - // Create the function that marks the event as canceled. - var canceled = false; - var cancelEvent = function() - { - canceled = true; - }; - - return function( eventName, data, editor ) - { - // Get the event entry. - var event = getPrivate( this )[ eventName ]; - - // Save the previous stopped and cancelled states. We may - // be nesting fire() calls. - var previousStopped = stopped, - previousCancelled = canceled; - - // Reset the stopped and canceled flags. - stopped = canceled = false; - - if ( event ) - { - var listeners = event.listeners; - - if ( listeners.length ) - { - // As some listeners may remove themselves from the - // event, the original array length is dinamic. So, - // let's make a copy of all listeners, so we are - // sure we'll call all of them. - listeners = listeners.slice( 0 ); - - // Loop through all listeners. - for ( var i = 0 ; i < listeners.length ; i++ ) - { - // Call the listener, passing the event data. - var retData = listeners[i].call( this, editor, data, stopEvent, cancelEvent ); - - if ( typeof retData != 'undefined' ) - data = retData; - - // No further calls is stopped or canceled. - if ( stopped || canceled ) - break; - } - } - } - - var ret = canceled || ( typeof data == 'undefined' ? false : data ); - - // Restore the previous stopped and canceled states. - stopped = previousStopped; - canceled = previousCancelled; - - return ret; - }; - })(), - - /** - * Fires an specific event in the object, releasing all listeners - * registered to that event. The same listeners are not called again on - * successive calls of it or of {@link #fire}. - * @param {String} eventName The event name to fire. - * @param {Object} [data] Data to be sent as the - * {@link CKEDITOR.eventInfo#data} when calling the - * listeners. - * @param {CKEDITOR.editor} [editor] The editor instance to send as the - * {@link CKEDITOR.eventInfo#editor} when calling the - * listener. - * @returns {Boolean|Object} A booloan indicating that the event is to be - * canceled, or data returned by one of the listeners. - * @example - * someObject.on( 'someEvent', function() { ... } ); - * someObject.fire( 'someEvent' ); // above listener called - * someObject.fireOnce( 'someEvent' ); // above listener called - * someObject.fire( 'someEvent' ); // no listeners called - */ - fireOnce : function( eventName, data, editor ) - { - var ret = this.fire( eventName, data, editor ); - delete getPrivate( this )[ eventName ]; - return ret; - }, - - /** - * Unregisters a listener function from being called at the specified - * event. No errors are thrown if the listener has not been - * registered previously. - * @param {String} eventName The event name. - * @param {Function} listenerFunction The listener function to unregister. - * @example - * var myListener = function() { ... }; - * someObject.on( 'someEvent', myListener ); - * someObject.fire( 'someEvent' ); // myListener called - * someObject.removeListener( 'someEvent', myListener ); - * someObject.fire( 'someEvent' ); // myListener not called - */ - removeListener : function( eventName, listenerFunction ) - { - // Get the event entry. - var event = getPrivate( this )[ eventName ]; - - if ( event ) - { - var index = event.getListenerIndex( listenerFunction ); - if ( index >= 0 ) - event.listeners.splice( index, 1 ); - } - }, - - /** - * Checks if there is any listener registered to a given event. - * @param {String} eventName The event name. - * @example - * var myListener = function() { ... }; - * someObject.on( 'someEvent', myListener ); - * alert( someObject.hasListeners( 'someEvent' ) ); // "true" - * alert( someObject.hasListeners( 'noEvent' ) ); // "false" - */ - hasListeners : function( eventName ) - { - var event = getPrivate( this )[ eventName ]; - return ( event && event.listeners.length > 0 ) ; - } - }; - })(); -} diff --git a/Public/Resources/Javascript/ckeditor/_source/core/eventInfo.js b/Public/Resources/Javascript/ckeditor/_source/core/eventInfo.js deleted file mode 100644 index dbeca5c..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/eventInfo.js +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which - * contains the defintions of the event object passed to event listeners. - * This file is for documentation purposes only. - */ - -/** - * This class is not really part of the API. It just illustrates the features - * of the event object passed to event listeners by a {@link CKEDITOR.event} - * based object. - * @name CKEDITOR.eventInfo - * @constructor - * @example - * // Do not do this. - * var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined - */ - -/** - * The event name. - * @name CKEDITOR.eventInfo.prototype.name - * @field - * @type String - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.name ); // "someEvent" - * }); - * someObject.fire( 'someEvent' ); - */ - -/** - * The object that publishes (sends) the event. - * @name CKEDITOR.eventInfo.prototype.sender - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.sender == someObject ); // "true" - * }); - * someObject.fire( 'someEvent' ); - */ - -/** - * The editor instance that holds the sender. May be the same as sender. May be - * null if the sender is not part of an editor instance, like a component - * running in standalone mode. - * @name CKEDITOR.eventInfo.prototype.editor - * @field - * @type CKEDITOR.editor - * @example - * myButton.on( 'someEvent', function( event ) - * { - * alert( event.editor == myEditor ); // "true" - * }); - * myButton.fire( 'someEvent', null, myEditor ); - */ - -/** - * Any kind of additional data. Its format and usage is event dependent. - * @name CKEDITOR.eventInfo.prototype.data - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.data ); // "Example" - * }); - * someObject.fire( 'someEvent', 'Example' ); - */ - -/** - * Any extra data appended during the listener registration. - * @name CKEDITOR.eventInfo.prototype.listenerData - * @field - * @type Object - * @example - * someObject.on( 'someEvent', function( event ) - * { - * alert( event.listenerData ); // "Example" - * } - * , null, 'Example' ); - */ - -/** - * Indicates that no further listeners are to be called. - * @name CKEDITOR.eventInfo.prototype.stop - * @function - * @example - * someObject.on( 'someEvent', function( event ) - * { - * event.stop(); - * }); - * someObject.on( 'someEvent', function( event ) - * { - * // This one will not be called. - * }); - * alert( someObject.fire( 'someEvent' ) ); // "false" - */ - -/** - * Indicates that the event is to be cancelled (if cancelable). - * @name CKEDITOR.eventInfo.prototype.cancel - * @function - * @example - * someObject.on( 'someEvent', function( event ) - * { - * event.cancel(); - * }); - * someObject.on( 'someEvent', function( event ) - * { - * // This one will not be called. - * }); - * alert( someObject.fire( 'someEvent' ) ); // "true" - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/focusmanager.js b/Public/Resources/Javascript/ckeditor/_source/core/focusmanager.js deleted file mode 100644 index 933c3cf..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/focusmanager.js +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used - * to handle the focus on editor instances.. - */ - -/** - * Manages the focus activity in an editor instance. This class is to be used - * mainly by UI elements coders when adding interface elements to CKEditor. - * @constructor - * @param {CKEDITOR.editor} editor The editor instance. - * @example - */ -CKEDITOR.focusManager = function( editor ) -{ - if ( editor.focusManager ) - return editor.focusManager; - - /** - * Indicates that the editor instance has focus. - * @type Boolean - * @example - * alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true" - */ - this.hasFocus = false; - - /** - * Object used to hold private stuff. - * @private - */ - this._ = - { - editor : editor - }; - - return this; -}; - -CKEDITOR.focusManager.prototype = -{ - /** - * Indicates that the editor instance has the focus. - * - * This function is not used to set the focus in the editor. Use - * {@link CKEDITOR.editor#focus} for it instead. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.focus(); - */ - focus : function() - { - if ( this._.timer ) - clearTimeout( this._.timer ); - - if ( !this.hasFocus ) - { - // If another editor has the current focus, we first "blur" it. In - // this way the events happen in a more logical sequence, like: - // "focus 1" > "blur 1" > "focus 2" - // ... instead of: - // "focus 1" > "focus 2" > "blur 1" - if ( CKEDITOR.currentInstance ) - CKEDITOR.currentInstance.focusManager.forceBlur(); - - var editor = this._.editor; - - editor.container.getChild( 1 ).addClass( 'cke_focus' ); - - this.hasFocus = true; - editor.fire( 'focus' ); - } - }, - - /** - * Indicates that the editor instance has lost the focus. Note that this - * functions acts asynchronously with a delay of 100ms to avoid subsequent - * blur/focus effects. If you want the "blur" to happen immediately, use - * the {@link #forceBlur} function instead. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.blur(); - */ - blur : function() - { - var focusManager = this; - - if ( focusManager._.timer ) - clearTimeout( focusManager._.timer ); - - focusManager._.timer = setTimeout( - function() - { - delete focusManager._.timer; - focusManager.forceBlur(); - } - , 100 ); - }, - - /** - * Indicates that the editor instance has lost the focus. Unlike - * {@link #blur}, this function is synchronous, marking the instance as - * "blured" immediately. - * @example - * var editor = CKEDITOR.instances.editor1; - * editor.focusManager.forceBlur(); - */ - forceBlur : function() - { - if ( this.hasFocus ) - { - var editor = this._.editor; - - editor.container.getChild( 1 ).removeClass( 'cke_focus' ); - - this.hasFocus = false; - editor.fire( 'blur' ); - } - } -}; - -/** - * Fired when the editor instance receives the input focus. - * @name CKEDITOR.editor#focus - * @event - * @param {CKEDITOR.editor} editor The editor instance. - */ - -/** - * Fired when the editor instance loses the input focus. - * @name CKEDITOR.editor#blur - * @event - * @param {CKEDITOR.editor} editor The editor instance. - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser.js deleted file mode 100644 index acd5ef5..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser.js +++ /dev/null @@ -1,218 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * HTML text parser. - * @constructor - * @example - */ -CKEDITOR.htmlParser = function() -{ - this._ = - { - htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^"\'>]+)|(?:"[^"]*")|(?:\'[^\']*\'))*)\\/?>))', 'g' ) - }; -}; - -(function() -{ - var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g, - emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1}; - - CKEDITOR.htmlParser.prototype = - { - /** - * Function to be fired when a tag opener is found. This function - * should be overriden when using this class. - * @param {String} tagName The tag name. The name is guarantted to be - * lowercased. - * @param {Object} attributes An object containing all tag attributes. Each - * property in this object represent and attribute name and its - * value is the attribute value. - * @param {Boolean} selfClosing true if the tag closes itself, false if the - * tag doesn't. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onTagOpen = function( tagName, attributes, selfClosing ) - * { - * alert( tagName ); // e.g. "b" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onTagOpen : function() {}, - - /** - * Function to be fired when a tag closer is found. This function - * should be overriden when using this class. - * @param {String} tagName The tag name. The name is guarantted to be - * lowercased. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onTagClose = function( tagName ) - * { - * alert( tagName ); // e.g. "b" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onTagClose : function() {}, - - /** - * Function to be fired when text is found. This function - * should be overriden when using this class. - * @param {String} text The text found. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onText = function( text ) - * { - * alert( text ); // e.g. "Hello" - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onText : function() {}, - - /** - * Function to be fired when CDATA section is found. This function - * should be overriden when using this class. - * @param {String} cdata The CDATA been found. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onCDATA = function( cdata ) - * { - * alert( cdata ); // e.g. "var hello;" - * }); - * parser.parse( "<script>var hello;</script>" ); - */ - onCDATA : function() {}, - - /** - * Function to be fired when a commend is found. This function - * should be overriden when using this class. - * @param {String} comment The comment text. - * @example - * var parser = new CKEDITOR.htmlParser(); - * parser.onText = function( comment ) - * { - * alert( comment ); // e.g. " Example " - * }); - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - onComment : function() {}, - - /** - * Parses text, looking for HTML tokens, like tag openers or closers, - * or comments. This function fires the onTagOpen, onTagClose, onText - * and onComment function during its execution. - * @param {String} html The HTML to be parsed. - * @example - * var parser = new CKEDITOR.htmlParser(); - * // The onTagOpen, onTagClose, onText and onComment should be overriden - * // at this point. - * parser.parse( "<!-- Example --><b>Hello</b>" ); - */ - parse : function( html ) - { - var parts, - tagName, - nextIndex = 0, - cdata; // The collected data inside a CDATA section. - - while ( ( parts = this._.htmlPartsRegex.exec( html ) ) ) - { - var tagIndex = parts.index; - if ( tagIndex > nextIndex ) - { - var text = html.substring( nextIndex, tagIndex ); - - if ( cdata ) - cdata.push( text ); - else - this.onText( text ); - } - - nextIndex = this._.htmlPartsRegex.lastIndex; - - /* - "parts" is an array with the following items: - 0 : The entire match for opening/closing tags and comments. - 1 : Group filled with the tag name for closing tags. - 2 : Group filled with the comment text. - 3 : Group filled with the tag name for opening tags. - 4 : Group filled with the attributes part of opening tags. - */ - - // Closing tag - if ( ( tagName = parts[ 1 ] ) ) - { - tagName = tagName.toLowerCase(); - - if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] ) - { - // Send the CDATA data. - this.onCDATA( cdata.join('') ); - cdata = null; - } - - if ( !cdata ) - { - this.onTagClose( tagName ); - continue; - } - } - - // If CDATA is enabled, just save the raw match. - if ( cdata ) - { - cdata.push( parts[ 0 ] ); - continue; - } - - // Opening tag - if ( ( tagName = parts[ 3 ] ) ) - { - tagName = tagName.toLowerCase(); - - // There are some tag names that can break things, so let's - // simply ignore them when parsing. (#5224) - if ( /="/.test( tagName ) ) - continue; - - var attribs = {}, - attribMatch, - attribsPart = parts[ 4 ], - selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' ); - - if ( attribsPart ) - { - while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) ) - { - var attName = attribMatch[1].toLowerCase(), - attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || ''; - - if ( !attValue && emptyAttribs[ attName ] ) - attribs[ attName ] = attName; - else - attribs[ attName ] = attValue; - } - } - - this.onTagOpen( tagName, attribs, selfClosing ); - - // Open CDATA mode when finding the appropriate tags. - if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] ) - cdata = []; - - continue; - } - - // Comment - if ( ( tagName = parts[ 2 ] ) ) - this.onComment( tagName ); - } - - if ( html.length > nextIndex ) - this.onText( html.substring( nextIndex, html.length ) ); - } - }; -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/basicwriter.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/basicwriter.js deleted file mode 100644 index 3a0231c..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/basicwriter.js +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass( -{ - $ : function() - { - this._ = - { - output : [] - }; - }, - - proto : - { - /** - * Writes the tag opening part for a opener tag. - * @param {String} tagName The element name for this tag. - * @param {Object} attributes The attributes defined for this tag. The - * attributes could be used to inspect the tag. - * @example - * // Writes "<p". - * writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } ); - */ - openTag : function( tagName, attributes ) - { - this._.output.push( '<', tagName ); - }, - - /** - * Writes the tag closing part for a opener tag. - * @param {String} tagName The element name for this tag. - * @param {Boolean} isSelfClose Indicates that this is a self-closing tag, - * like "br" or "img". - * @example - * // Writes ">". - * writer.openTagClose( 'p', false ); - * @example - * // Writes " />". - * writer.openTagClose( 'br', true ); - */ - openTagClose : function( tagName, isSelfClose ) - { - if ( isSelfClose ) - this._.output.push( ' />' ); - else - this._.output.push( '>' ); - }, - - /** - * Writes an attribute. This function should be called after opening the - * tag with {@link #openTagClose}. - * @param {String} attName The attribute name. - * @param {String} attValue The attribute value. - * @example - * // Writes ' class="MyClass"'. - * writer.attribute( 'class', 'MyClass' ); - */ - attribute : function( attName, attValue ) - { - // Browsers don't always escape special character in attribute values. (#4683, #4719). - if ( typeof attValue == 'string' ) - attValue = CKEDITOR.tools.htmlEncodeAttr( attValue ); - - this._.output.push( ' ', attName, '="', attValue, '"' ); - }, - - /** - * Writes a closer tag. - * @param {String} tagName The element name for this tag. - * @example - * // Writes "</p>". - * writer.closeTag( 'p' ); - */ - closeTag : function( tagName ) - { - this._.output.push( '' ); - }, - - /** - * Writes text. - * @param {String} text The text value - * @example - * // Writes "Hello Word". - * writer.text( 'Hello Word' ); - */ - text : function( text ) - { - this._.output.push( text ); - }, - - /** - * Writes a comment. - * @param {String} comment The comment text. - * @example - * // Writes "<!-- My comment -->". - * writer.comment( ' My comment ' ); - */ - comment : function( comment ) - { - this._.output.push( '' ); - }, - - /** - * Writes any kind of data to the ouput. - * @example - * writer.write( 'This is an <b>example</b>.' ); - */ - write : function( data ) - { - this._.output.push( data ); - }, - - /** - * Empties the current output buffer. - * @example - * writer.reset(); - */ - reset : function() - { - this._.output = []; - this._.indent = false; - }, - - /** - * Empties the current output buffer. - * @param {Boolean} reset Indicates that the {@link reset} function is to - * be automatically called after retrieving the HTML. - * @returns {String} The HTML written to the writer so far. - * @example - * var html = writer.getHtml(); - */ - getHtml : function( reset ) - { - var html = this._.output.join( '' ); - - if ( reset ) - this.reset(); - - return html; - } - } -}); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/cdata.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/cdata.js deleted file mode 100644 index ff2f227..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/cdata.js +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - - /** - * A lightweight representation of HTML text. - * @constructor - * @example - */ - CKEDITOR.htmlParser.cdata = function( value ) - { - /** - * The CDATA value. - * @type String - * @example - */ - this.value = value; - }; - - CKEDITOR.htmlParser.cdata.prototype = - { - /** - * CDATA has the same type as {@link CKEDITOR.htmlParser.text} This is - * a constant value set to {@link CKEDITOR.NODE_TEXT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_TEXT, - - /** - * Writes write the CDATA with no special manipulations. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - */ - writeHtml : function( writer ) - { - writer.write( this.value ); - } - }; -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/comment.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/comment.js deleted file mode 100644 index 67830d9..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/comment.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML comment. - * @constructor - * @example - */ -CKEDITOR.htmlParser.comment = function( value ) -{ - /** - * The comment text. - * @type String - * @example - */ - this.value = value; - - /** @private */ - this._ = - { - isBlockLike : false - }; -}; - -CKEDITOR.htmlParser.comment.prototype = -{ - /** - * The node type. This is a constant value set to {@link CKEDITOR.NODE_COMMENT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_COMMENT, - - /** - * Writes the HTML representation of this comment to a CKEDITOR.htmlWriter. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - * @example - */ - writeHtml : function( writer, filter ) - { - var comment = this.value; - - if ( filter ) - { - if ( !( comment = filter.onComment( comment, this ) ) ) - return; - - if ( typeof comment != 'string' ) - { - comment.parent = this.parent; - comment.writeHtml( writer, filter ); - return; - } - } - - writer.comment( comment ); - } -}; diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/element.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/element.js deleted file mode 100644 index 69bacda..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/element.js +++ /dev/null @@ -1,240 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML element. - * @param {String} name The element name. - * @param {Object} attributes And object holding all attributes defined for - * this element. - * @constructor - * @example - */ -CKEDITOR.htmlParser.element = function( name, attributes ) -{ - /** - * The element name. - * @type String - * @example - */ - this.name = name; - - /** - * Holds the attributes defined for this element. - * @type Object - * @example - */ - this.attributes = attributes || ( attributes = {} ); - - /** - * The nodes that are direct children of this element. - * @type Array - * @example - */ - this.children = []; - - var tagName = attributes._cke_real_element_type || name; - - var dtd = CKEDITOR.dtd, - isBlockLike = !!( dtd.$nonBodyContent[ tagName ] || dtd.$block[ tagName ] || dtd.$listItem[ tagName ] || dtd.$tableContent[ tagName ] || dtd.$nonEditable[ tagName ] || tagName == 'br' ), - isEmpty = !!dtd.$empty[ name ]; - - this.isEmpty = isEmpty; - this.isUnknown = !dtd[ name ]; - - /** @private */ - this._ = - { - isBlockLike : isBlockLike, - hasInlineStarted : isEmpty || !isBlockLike - }; -}; - -(function() -{ - // Used to sort attribute entries in an array, where the first element of - // each object is the attribute name. - var sortAttribs = function( a, b ) - { - a = a[0]; - b = b[0]; - return a < b ? -1 : a > b ? 1 : 0; - }; - - CKEDITOR.htmlParser.element.prototype = - { - /** - * The node type. This is a constant value set to {@link CKEDITOR.NODE_ELEMENT}. - * @type Number - * @example - */ - type : CKEDITOR.NODE_ELEMENT, - - /** - * Adds a node to the element children list. - * @param {Object} node The node to be added. It can be any of of the - * following types: {@link CKEDITOR.htmlParser.element}, - * {@link CKEDITOR.htmlParser.text} and - * {@link CKEDITOR.htmlParser.comment}. - * @function - * @example - */ - add : CKEDITOR.htmlParser.fragment.prototype.add, - - /** - * Clone this element. - * @returns {CKEDITOR.htmlParser.element} The element clone. - * @example - */ - clone : function() - { - return new CKEDITOR.htmlParser.element( this.name, this.attributes ); - }, - - /** - * Writes the element HTML to a CKEDITOR.htmlWriter. - * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. - * @example - */ - writeHtml : function( writer, filter ) - { - var attributes = this.attributes; - - // Ignore cke: prefixes when writing HTML. - var element = this, - writeName = element.name, - a, newAttrName, value; - - var isChildrenFiltered; - - /** - * Providing an option for bottom-up filtering order ( element - * children to be pre-filtered before the element itself ). - */ - element.filterChildren = function() - { - if ( !isChildrenFiltered ) - { - var writer = new CKEDITOR.htmlParser.basicWriter(); - CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter ); - element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml() ).children; - isChildrenFiltered = 1; - } - }; - - if ( filter ) - { - while ( true ) - { - if ( !( writeName = filter.onElementName( writeName ) ) ) - return; - - element.name = writeName; - - if ( !( element = filter.onElement( element ) ) ) - return; - - element.parent = this.parent; - - if ( element.name == writeName ) - break; - - // If the element has been replaced with something of a - // different type, then make the replacement write itself. - if ( element.type != CKEDITOR.NODE_ELEMENT ) - { - element.writeHtml( writer, filter ); - return; - } - - writeName = element.name; - - // This indicate that the element has been dropped by - // filter but not the children. - if ( !writeName ) - { - this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter ); - return; - } - } - - // The element may have been changed, so update the local - // references. - attributes = element.attributes; - } - - // Open element tag. - writer.openTag( writeName, attributes ); - - // Copy all attributes to an array. - var attribsArray = []; - // Iterate over the attributes twice since filters may alter - // other attributes. - for ( var i = 0 ; i < 2; i++ ) - { - for ( a in attributes ) - { - newAttrName = a; - value = attributes[ a ]; - if ( i == 1 ) - attribsArray.push( [ a, value ] ); - else if ( filter ) - { - while ( true ) - { - if ( !( newAttrName = filter.onAttributeName( a ) ) ) - { - delete attributes[ a ]; - break; - } - else if ( newAttrName != a ) - { - delete attributes[ a ]; - a = newAttrName; - continue; - } - else - break; - } - if ( newAttrName ) - { - if ( ( value = filter.onAttribute( element, newAttrName, value ) ) === false ) - delete attributes[ newAttrName ]; - else - attributes [ newAttrName ] = value; - } - } - } - } - // Sort the attributes by name. - if ( writer.sortAttributes ) - attribsArray.sort( sortAttribs ); - - // Send the attributes. - var len = attribsArray.length; - for ( i = 0 ; i < len ; i++ ) - { - var attrib = attribsArray[ i ]; - writer.attribute( attrib[0], attrib[1] ); - } - - // Close the tag. - writer.openTagClose( writeName, element.isEmpty ); - - if ( !element.isEmpty ) - { - this.writeChildrenHtml.call( element, writer, isChildrenFiltered ? null : filter ); - // Close the element. - writer.closeTag( writeName ); - } - }, - - writeChildrenHtml : function( writer, filter ) - { - // Send children. - CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.apply( this, arguments ); - - } - }; -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/filter.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/filter.js deleted file mode 100644 index 5d16292..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/filter.js +++ /dev/null @@ -1,288 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - CKEDITOR.htmlParser.filter = CKEDITOR.tools.createClass( - { - $ : function( rules ) - { - this._ = - { - elementNames : [], - attributeNames : [], - elements : { $length : 0 }, - attributes : { $length : 0 } - }; - - if ( rules ) - this.addRules( rules, 10 ); - }, - - proto : - { - addRules : function( rules, priority ) - { - if ( typeof priority != 'number' ) - priority = 10; - - // Add the elementNames. - addItemsToList( this._.elementNames, rules.elementNames, priority ); - - // Add the attributeNames. - addItemsToList( this._.attributeNames, rules.attributeNames, priority ); - - // Add the elements. - addNamedItems( this._.elements, rules.elements, priority ); - - // Add the attributes. - addNamedItems( this._.attributes, rules.attributes, priority ); - - // Add the text. - this._.text = transformNamedItem( this._.text, rules.text, priority ) || this._.text; - - // Add the comment. - this._.comment = transformNamedItem( this._.comment, rules.comment, priority ) || this._.comment; - - // Add root fragment. - this._.root = transformNamedItem( this._.root, rules.root, priority ) || this._.root; - }, - - onElementName : function( name ) - { - return filterName( name, this._.elementNames ); - }, - - onAttributeName : function( name ) - { - return filterName( name, this._.attributeNames ); - }, - - onText : function( text ) - { - var textFilter = this._.text; - return textFilter ? textFilter.filter( text ) : text; - }, - - onComment : function( commentText, comment ) - { - var textFilter = this._.comment; - return textFilter ? textFilter.filter( commentText, comment ) : commentText; - }, - - onFragment : function( element ) - { - var rootFilter = this._.root; - return rootFilter ? rootFilter.filter( element ) : element; - }, - - onElement : function( element ) - { - // We must apply filters set to the specific element name as - // well as those set to the generic $ name. So, add both to an - // array and process them in a small loop. - var filters = [ this._.elements[ '^' ], this._.elements[ element.name ], this._.elements.$ ], - filter, ret; - - for ( var i = 0 ; i < 3 ; i++ ) - { - filter = filters[ i ]; - if ( filter ) - { - ret = filter.filter( element, this ); - - if ( ret === false ) - return null; - - if ( ret && ret != element ) - return this.onNode( ret ); - - // The non-root element has been dismissed by one of the filters. - if ( element.parent && !element.name ) - break; - } - } - - return element; - }, - - onNode : function( node ) - { - var type = node.type; - - return type == CKEDITOR.NODE_ELEMENT ? this.onElement( node ) : - type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.text( this.onText( node.value ) ) : - type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.comment( this.onComment( node.value ) ): - null; - }, - - onAttribute : function( element, name, value ) - { - var filter = this._.attributes[ name ]; - - if ( filter ) - { - var ret = filter.filter( value, element, this ); - - if ( ret === false ) - return false; - - if ( typeof ret != 'undefined' ) - return ret; - } - - return value; - } - } - }); - - function filterName( name, filters ) - { - for ( var i = 0 ; name && i < filters.length ; i++ ) - { - var filter = filters[ i ]; - name = name.replace( filter[ 0 ], filter[ 1 ] ); - } - return name; - } - - function addItemsToList( list, items, priority ) - { - if ( typeof items == 'function' ) - items = [ items ]; - - var i, j, - listLength = list.length, - itemsLength = items && items.length; - - if ( itemsLength ) - { - // Find the index to insert the items at. - for ( i = 0 ; i < listLength && list[ i ].pri < priority ; i++ ) - { /*jsl:pass*/ } - - // Add all new items to the list at the specific index. - for ( j = itemsLength - 1 ; j >= 0 ; j-- ) - { - var item = items[ j ]; - if ( item ) - { - item.pri = priority; - list.splice( i, 0, item ); - } - } - } - } - - function addNamedItems( hashTable, items, priority ) - { - if ( items ) - { - for ( var name in items ) - { - var current = hashTable[ name ]; - - hashTable[ name ] = - transformNamedItem( - current, - items[ name ], - priority ); - - if ( !current ) - hashTable.$length++; - } - } - } - - function transformNamedItem( current, item, priority ) - { - if ( item ) - { - item.pri = priority; - - if ( current ) - { - // If the current item is not an Array, transform it. - if ( !current.splice ) - { - if ( current.pri > priority ) - current = [ item, current ]; - else - current = [ current, item ]; - - current.filter = callItems; - } - else - addItemsToList( current, item, priority ); - - return current; - } - else - { - item.filter = item; - return item; - } - } - } - - // Invoke filters sequentially on the array, break the iteration - // when it doesn't make sense to continue anymore. - function callItems( currentEntry ) - { - var isNode = currentEntry.type - || currentEntry instanceof CKEDITOR.htmlParser.fragment; - - for ( var i = 0 ; i < this.length ; i++ ) - { - // Backup the node info before filtering. - if ( isNode ) - { - var orgType = currentEntry.type, - orgName = currentEntry.name; - } - - var item = this[ i ], - ret = item.apply( window, arguments ); - - if ( ret === false ) - return ret; - - // We're filtering node (element/fragment). - if ( isNode ) - { - // No further filtering if it's not anymore - // fitable for the subsequent filters. - if ( ret && ( ret.name != orgName - || ret.type != orgType ) ) - { - return ret; - } - } - // Filtering value (nodeName/textValue/attrValue). - else - { - // No further filtering if it's not - // any more values. - if ( typeof ret != 'string' ) - return ret; - } - - ret != undefined && ( currentEntry = ret ); - } - - return currentEntry; - } -})(); - -// "entities" plugin -/* -{ - text : function( text ) - { - // TODO : Process entities. - return text.toUpperCase(); - } -}; -*/ diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/fragment.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/fragment.js deleted file mode 100644 index d31b050..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/fragment.js +++ /dev/null @@ -1,497 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * A lightweight representation of an HTML DOM structure. - * @constructor - * @example - */ -CKEDITOR.htmlParser.fragment = function() -{ - /** - * The nodes contained in the root of this fragment. - * @type Array - * @example - * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' ); - * alert( fragment.children.length ); "2" - */ - this.children = []; - - /** - * Get the fragment parent. Should always be null. - * @type Object - * @default null - * @example - */ - this.parent = null; - - /** @private */ - this._ = - { - isBlockLike : true, - hasInlineStarted : false - }; -}; - -(function() -{ - // Elements which the end tag is marked as optional in the HTML 4.01 DTD - // (expect empty elements). - var optionalClose = {colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1}; - - // Block-level elements whose internal structure should be respected during - // parser fixing. - var nonBreakingBlocks = CKEDITOR.tools.extend( - {table:1,ul:1,ol:1,dl:1}, - CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ), - listBlocks = CKEDITOR.dtd.$list, listItems = CKEDITOR.dtd.$listItem; - - /** - * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string. - * @param {String} fragmentHtml The HTML to be parsed, filling the fragment. - * @param {Number} [fixForBody=false] Wrap body with specified element if needed. - * @returns CKEDITOR.htmlParser.fragment The fragment created. - * @example - * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( 'Sample Text' ); - * alert( fragment.children[0].name ); "b" - * alert( fragment.children[1].value ); " Text" - */ - CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody ) - { - var parser = new CKEDITOR.htmlParser(), - html = [], - fragment = new CKEDITOR.htmlParser.fragment(), - pendingInline = [], - pendingBRs = [], - currentNode = fragment, - // Indicate we're inside a
             element, spaces should be touched differently.
            -			inPre = false,
            -			returnPoint;
            -
            -		function checkPending( newTagName )
            -		{
            -			var pendingBRsSent;
            -
            -			if ( pendingInline.length > 0 )
            -			{
            -				for ( var i = 0 ; i < pendingInline.length ; i++ )
            -				{
            -					var pendingElement = pendingInline[ i ],
            -						pendingName = pendingElement.name,
            -						pendingDtd = CKEDITOR.dtd[ pendingName ],
            -						currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ];
            -
            -					if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
            -					{
            -						if ( !pendingBRsSent )
            -						{
            -							sendPendingBRs();
            -							pendingBRsSent = 1;
            -						}
            -
            -						// Get a clone for the pending element.
            -						pendingElement = pendingElement.clone();
            -
            -						// Add it to the current node and make it the current,
            -						// so the new element will be added inside of it.
            -						pendingElement.parent = currentNode;
            -						currentNode = pendingElement;
            -
            -						// Remove the pending element (back the index by one
            -						// to properly process the next entry).
            -						pendingInline.splice( i, 1 );
            -						i--;
            -					}
            -				}
            -			}
            -		}
            -
            -		function sendPendingBRs( brsToIgnore )
            -		{
            -			while ( pendingBRs.length - ( brsToIgnore || 0 ) > 0 )
            -				currentNode.add( pendingBRs.shift() );
            -		}
            -
            -		function addElement( element, target, enforceCurrent )
            -		{
            -			target = target || currentNode || fragment;
            -
            -			// If the target is the fragment and this element can't go inside
            -			// body (if fixForBody).
            -			if ( fixForBody && !target.type )
            -			{
            -				var elementName, realElementName;
            -				if ( element.attributes
            -					 && ( realElementName =
            -						  element.attributes[ '_cke_real_element_type' ] ) )
            -					elementName = realElementName;
            -				else
            -					elementName =  element.name;
            -				if ( elementName
            -						&& !( elementName in CKEDITOR.dtd.$body )
            -						&& !( elementName in CKEDITOR.dtd.$nonBodyContent )  )
            -				{
            -					var savedCurrent = currentNode;
            -
            -					// Create a 

            in the fragment. - currentNode = target; - parser.onTagOpen( fixForBody, {} ); - - // The new target now is the

            . - target = currentNode; - - if ( enforceCurrent ) - currentNode = savedCurrent; - } - } - - // Rtrim empty spaces on block end boundary. (#3585) - if ( element._.isBlockLike - && element.name != 'pre' ) - { - - var length = element.children.length, - lastChild = element.children[ length - 1 ], - text; - if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT ) - { - if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) ) - element.children.length = length -1; - else - lastChild.value = text; - } - } - - target.add( element ); - - if ( element.returnPoint ) - { - currentNode = element.returnPoint; - delete element.returnPoint; - } - } - - parser.onTagOpen = function( tagName, attributes, selfClosing ) - { - var element = new CKEDITOR.htmlParser.element( tagName, attributes ); - - // "isEmpty" will be always "false" for unknown elements, so we - // must force it if the parser has identified it as a selfClosing tag. - if ( element.isUnknown && selfClosing ) - element.isEmpty = true; - - // This is a tag to be removed if empty, so do not add it immediately. - if ( CKEDITOR.dtd.$removeEmpty[ tagName ] ) - { - pendingInline.push( element ); - return; - } - else if ( tagName == 'pre' ) - inPre = true; - else if ( tagName == 'br' && inPre ) - { - currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) ); - return; - } - - if ( tagName == 'br' ) - { - pendingBRs.push( element ); - return; - } - - var currentName = currentNode.name; - - var currentDtd = currentName - && ( CKEDITOR.dtd[ currentName ] - || ( currentNode._.isBlockLike ? CKEDITOR.dtd.div : CKEDITOR.dtd.span ) ); - - // If the element cannot be child of the current element. - if ( currentDtd // Fragment could receive any elements. - && !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] ) - { - - var reApply = false, - addPoint; // New position to start adding nodes. - - // Fixing malformed nested lists by moving it into a previous list item. (#3828) - if ( tagName in listBlocks - && currentName in listBlocks ) - { - var children = currentNode.children, - lastChild = children[ children.length - 1 ]; - - // Establish the list item if it's not existed. - if ( !( lastChild && lastChild.name in listItems ) ) - addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode ); - - returnPoint = currentNode, addPoint = lastChild; - } - // If the element name is the same as the current element name, - // then just close the current one and append the new one to the - // parent. This situation usually happens with

            ,

          1. ,
            and - //
            , specially in IE. Do not enter in this if block in this case. - else if ( tagName == currentName ) - { - addElement( currentNode, currentNode.parent ); - } - else - { - if ( nonBreakingBlocks[ currentName ] ) - { - if ( !returnPoint ) - returnPoint = currentNode; - } - else - { - addElement( currentNode, currentNode.parent, true ); - - if ( !optionalClose[ currentName ] ) - { - // The current element is an inline element, which - // cannot hold the new one. Put it in the pending list, - // and try adding the new one after it. - pendingInline.unshift( currentNode ); - } - } - - reApply = true; - } - - if ( addPoint ) - currentNode = addPoint; - // Try adding it to the return point, or the parent element. - else - currentNode = currentNode.returnPoint || currentNode.parent; - - if ( reApply ) - { - parser.onTagOpen.apply( this, arguments ); - return; - } - } - - checkPending( tagName ); - sendPendingBRs(); - - element.parent = currentNode; - element.returnPoint = returnPoint; - returnPoint = 0; - - if ( element.isEmpty ) - addElement( element ); - else - currentNode = element; - }; - - parser.onTagClose = function( tagName ) - { - // Check if there is any pending tag to be closed. - for ( var i = pendingInline.length - 1 ; i >= 0 ; i-- ) - { - // If found, just remove it from the list. - if ( tagName == pendingInline[ i ].name ) - { - pendingInline.splice( i, 1 ); - return; - } - } - - var pendingAdd = [], - newPendingInline = [], - candidate = currentNode; - - while ( candidate.type && candidate.name != tagName ) - { - // If this is an inline element, add it to the pending list, if we're - // really closing one of the parents element later, they will continue - // after it. - if ( !candidate._.isBlockLike ) - newPendingInline.unshift( candidate ); - - // This node should be added to it's parent at this point. But, - // it should happen only if the closing tag is really closing - // one of the nodes. So, for now, we just cache it. - pendingAdd.push( candidate ); - - candidate = candidate.parent; - } - - if ( candidate.type ) - { - // Add all elements that have been found in the above loop. - for ( i = 0 ; i < pendingAdd.length ; i++ ) - { - var node = pendingAdd[ i ]; - addElement( node, node.parent ); - } - - currentNode = candidate; - - if ( currentNode.name == 'pre' ) - inPre = false; - - if ( candidate._.isBlockLike ) - sendPendingBRs(); - - addElement( candidate, candidate.parent ); - - // The parent should start receiving new nodes now, except if - // addElement changed the currentNode. - if ( candidate == currentNode ) - currentNode = currentNode.parent; - - pendingInline = pendingInline.concat( newPendingInline ); - } - - if ( tagName == 'body' ) - fixForBody = false; - }; - - parser.onText = function( text ) - { - // Trim empty spaces at beginning of element contents except
            .
            -			if ( !currentNode._.hasInlineStarted && !inPre )
            -			{
            -				text = CKEDITOR.tools.ltrim( text );
            -
            -				if ( text.length === 0 )
            -					return;
            -			}
            -
            -			sendPendingBRs();
            -			checkPending();
            -
            -			if ( fixForBody
            -				 && ( !currentNode.type || currentNode.name == 'body' )
            -				 && CKEDITOR.tools.trim( text ) )
            -			{
            -				this.onTagOpen( fixForBody, {} );
            -			}
            -
            -			// Shrinking consequential spaces into one single for all elements
            -			// text contents.
            -			if ( !inPre )
            -				text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' );
            -
            -			currentNode.add( new CKEDITOR.htmlParser.text( text ) );
            -		};
            -
            -		parser.onCDATA = function( cdata )
            -		{
            -			currentNode.add( new CKEDITOR.htmlParser.cdata( cdata ) );
            -		};
            -
            -		parser.onComment = function( comment )
            -		{
            -			currentNode.add( new CKEDITOR.htmlParser.comment( comment ) );
            -		};
            -
            -		// Parse it.
            -		parser.parse( fragmentHtml );
            -
            -		// Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
            -		sendPendingBRs( !CKEDITOR.env.ie && 1 );
            -
            -		// Close all pending nodes.
            -		while ( currentNode.type )
            -		{
            -			var parent = currentNode.parent,
            -				node = currentNode;
            -
            -			if ( fixForBody
            -				 && ( !parent.type || parent.name == 'body' )
            -				 && !CKEDITOR.dtd.$body[ node.name ] )
            -			{
            -				currentNode = parent;
            -				parser.onTagOpen( fixForBody, {} );
            -				parent = currentNode;
            -			}
            -
            -			parent.add( node );
            -			currentNode = parent;
            -		}
            -
            -		return fragment;
            -	};
            -
            -	CKEDITOR.htmlParser.fragment.prototype =
            -	{
            -		/**
            -		 * Adds a node to this fragment.
            -		 * @param {Object} node The node to be added. It can be any of of the
            -		 *		following types: {@link CKEDITOR.htmlParser.element},
            -		 *		{@link CKEDITOR.htmlParser.text} and
            -		 *		{@link CKEDITOR.htmlParser.comment}.
            -		 * @example
            -		 */
            -		add : function( node )
            -		{
            -			var len = this.children.length,
            -				previous = len > 0 && this.children[ len - 1 ] || null;
            -
            -			if ( previous )
            -			{
            -				// If the block to be appended is following text, trim spaces at
            -				// the right of it.
            -				if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT )
            -				{
            -					previous.value = CKEDITOR.tools.rtrim( previous.value );
            -
            -					// If we have completely cleared the previous node.
            -					if ( previous.value.length === 0 )
            -					{
            -						// Remove it from the list and add the node again.
            -						this.children.pop();
            -						this.add( node );
            -						return;
            -					}
            -				}
            -
            -				previous.next = node;
            -			}
            -
            -			node.previous = previous;
            -			node.parent = this;
            -
            -			this.children.push( node );
            -
            -			this._.hasInlineStarted = node.type == CKEDITOR.NODE_TEXT || ( node.type == CKEDITOR.NODE_ELEMENT && !node._.isBlockLike );
            -		},
            -
            -		/**
            -		 * Writes the fragment HTML to a CKEDITOR.htmlWriter.
            -		 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
            -		 * @example
            -		 * var writer = new CKEDITOR.htmlWriter();
            -		 * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<P><B>Example' );
            -		 * fragment.writeHtml( writer )
            -		 * alert( writer.getHtml() );  "<p><b>Example</b></p>"
            -		 */
            -		writeHtml : function( writer, filter )
            -		{
            -			var isChildrenFiltered;
            -			this.filterChildren = function()
            -			{
            -				var writer = new CKEDITOR.htmlParser.basicWriter();
            -				this.writeChildrenHtml.call( this, writer, filter, true );
            -				var html = writer.getHtml();
            -				this.children = new CKEDITOR.htmlParser.fragment.fromHtml( html ).children;
            -				isChildrenFiltered = 1;
            -			};
            -
            -			// Filtering the root fragment before anything else.
            -			!this.name && filter && filter.onFragment( this );
            -
            -			this.writeChildrenHtml( writer, isChildrenFiltered ? null : filter );
            -		},
            -
            -		writeChildrenHtml : function( writer, filter )
            -		{
            -			for ( var i = 0 ; i < this.children.length ; i++ )
            -				this.children[i].writeHtml( writer, filter );
            -		}
            -	};
            -})();
            diff --git a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/text.js b/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/text.js
            deleted file mode 100644
            index 0d63ac9..0000000
            --- a/Public/Resources/Javascript/ckeditor/_source/core/htmlparser/text.js
            +++ /dev/null
            @@ -1,55 +0,0 @@
            -/*
            -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
            -For licensing, see LICENSE.html or http://ckeditor.com/license
            -*/
            -
            -(function()
            -{
            -	var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g;
            -
            -	/**
            -	 * A lightweight representation of HTML text.
            -	 * @constructor
            -	 * @example
            -	 */
            - 	CKEDITOR.htmlParser.text = function( value )
            -	{
            -		/**
            -		 * The text value.
            -		 * @type String
            -		 * @example
            -		 */
            -		this.value = value;
            -
            -		/** @private */
            -		this._ =
            -		{
            -			isBlockLike : false
            -		};
            -	};
            -
            -	CKEDITOR.htmlParser.text.prototype =
            -	{
            -		/**
            -		 * The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.
            -		 * @type Number
            -		 * @example
            -		 */
            -		type : CKEDITOR.NODE_TEXT,
            -
            -		/**
            -		 * Writes the HTML representation of this text to a CKEDITOR.htmlWriter.
            -		 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.
            -		 * @example
            -		 */
            -		writeHtml : function( writer, filter )
            -		{
            -			var text = this.value;
            -
            -			if ( filter && !( text = filter.onText( text, this ) ) )
            -				return;
            -
            -			writer.text( text );
            -		}
            -	};
            -})();
            diff --git a/Public/Resources/Javascript/ckeditor/_source/core/imagecacher.js b/Public/Resources/Javascript/ckeditor/_source/core/imagecacher.js
            deleted file mode 100644
            index 0704556..0000000
            --- a/Public/Resources/Javascript/ckeditor/_source/core/imagecacher.js
            +++ /dev/null
            @@ -1,59 +0,0 @@
            -/*
            -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
            -For licensing, see LICENSE.html or http://ckeditor.com/license
            -*/
            -
            -(function()
            -{
            -	var loaded = {};
            -
            -	var loadImage = function( image, callback )
            -	{
            -		var doCallback = function()
            -			{
            -				img.removeAllListeners();
            -				loaded[ image ] = 1;
            -				callback();
            -			};
            -
            -		var img = new CKEDITOR.dom.element( 'img' );
            -		img.on( 'load', doCallback );
            -		img.on( 'error', doCallback );
            -		img.setAttribute( 'src', image );
            -	};
            -
            -	/**
            -	 * Load images into the browser cache.
            -	 * @namespace
            -	 * @example
            -	 */
            - 	CKEDITOR.imageCacher =
            -	{
            -		/**
            -		 * Loads one or more images.
            -		 * @param {Array} images The URLs for the images to be loaded.
            -		 * @param {Function} callback The function to be called once all images
            -		 *		are loaded.
            -		 */
            -		load : function( images, callback )
            -		{
            -			var pendingCount = images.length;
            -
            -			var checkPending = function()
            -			{
            -				if ( --pendingCount === 0 )
            -					callback();
            -			};
            -
            -			for ( var i = 0 ; i < images.length ; i++ )
            -			{
            -				var image = images[ i ];
            -
            -				if ( loaded[ image ] )
            -					checkPending();
            -				else
            -					loadImage( image, checkPending );
            -			}
            -		}
            -	};
            -})();
            diff --git a/Public/Resources/Javascript/ckeditor/_source/core/lang.js b/Public/Resources/Javascript/ckeditor/_source/core/lang.js
            deleted file mode 100644
            index add9982..0000000
            --- a/Public/Resources/Javascript/ckeditor/_source/core/lang.js
            +++ /dev/null
            @@ -1,152 +0,0 @@
            -/*
            -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
            -For licensing, see LICENSE.html or http://ckeditor.com/license
            -*/
            -
            -(function()
            -{
            -	var loadedLangs = {};
            -
            -	CKEDITOR.lang =
            -	{
            -		/**
            -		 * The list of languages available in the editor core.
            -		 * @type Object
            -		 * @example
            -		 * alert( CKEDITOR.lang.en );  // "true"
            -		 */
            -		languages :
            -		{
            -			'af'	: 1,
            -			'ar'	: 1,
            -			'bg'	: 1,
            -			'bn'	: 1,
            -			'bs'	: 1,
            -			'ca'	: 1,
            -			'cs'	: 1,
            -			'cy'	: 1,
            -			'da'	: 1,
            -			'de'	: 1,
            -			'el'	: 1,
            -			'en-au'	: 1,
            -			'en-ca'	: 1,
            -			'en-gb'	: 1,
            -			'en'	: 1,
            -			'eo'	: 1,
            -			'es'	: 1,
            -			'et'	: 1,
            -			'eu'	: 1,
            -			'fa'	: 1,
            -			'fi'	: 1,
            -			'fo'	: 1,
            -			'fr-ca'	: 1,
            -			'fr'	: 1,
            -			'gl'	: 1,
            -			'gu'	: 1,
            -			'he'	: 1,
            -			'hi'	: 1,
            -			'hr'	: 1,
            -			'hu'	: 1,
            -			'is'	: 1,
            -			'it'	: 1,
            -			'ja'	: 1,
            -			'km'	: 1,
            -			'ko'	: 1,
            -			'lt'	: 1,
            -			'lv'	: 1,
            -			'mn'	: 1,
            -			'ms'	: 1,
            -			'nb'	: 1,
            -			'nl'	: 1,
            -			'no'	: 1,
            -			'pl'	: 1,
            -			'pt-br'	: 1,
            -			'pt'	: 1,
            -			'ro'	: 1,
            -			'ru'	: 1,
            -			'sk'	: 1,
            -			'sl'	: 1,
            -			'sr-latn'	: 1,
            -			'sr'	: 1,
            -			'sv'	: 1,
            -			'th'	: 1,
            -			'tr'	: 1,
            -			'uk'	: 1,
            -			'vi'	: 1,
            -			'zh-cn'	: 1,
            -			'zh'	: 1
            -		},
            -
            -		/**
            -		 * Loads a specific language file, or auto detect it. A callback is
            -		 * then called when the file gets loaded.
            -		 * @param {String} languageCode The code of the language file to be
            -		 *		loaded. If "autoDetect" is set to true, this language will be
            -		 *		used as the default one, if the detect language is not
            -		 *		available in the core.
            -		 * @param {Boolean} autoDetect Indicates that the function must try to
            -		 *		detect the user language and load it instead.
            -		 * @param {Function} callback The function to be called once the
            -		 *		language file is loaded. Two parameters are passed to this
            -		 *		function: the language code and the loaded language entries.
            -		 * @example
            -		 */
            -		load : function( languageCode, defaultLanguage, callback )
            -		{
            -			// If no languageCode - fallback to browser or default.
            -			// If languageCode - fallback to no-localized version or default.
            -			if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
            -				languageCode = this.detect( defaultLanguage, languageCode );
            -
            -			if ( !this[ languageCode ] )
            -			{
            -				CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
            -					'_source/' +	// @Packager.RemoveLine
            -					'lang/' + languageCode + '.js' ),
            -					function()
            -						{
            -							callback( languageCode, this[ languageCode ] );
            -						}
            -						, this );
            -			}
            -			else
            -				callback( languageCode, this[ languageCode ] );
            -		},
            -
            -		/**
            -		 * Returns the language that best fit the user language. For example,
            -		 * suppose that the user language is "pt-br". If this language is
            -		 * supported by the editor, it is returned. Otherwise, if only "pt" is
            -		 * supported, it is returned instead. If none of the previous are
            -		 * supported, a default language is then returned.
            -		 * @param {String} defaultLanguage The default language to be returned
            -		 *		if the user language is not supported.
            -		 * @returns {String} The detected language code.
            -		 * @example
            -		 * alert( CKEDITOR.lang.detect( 'en' ) );  // e.g., in a German browser: "de"
            -		 */
            -		detect : function( defaultLanguage, probeLanguage )
            -		{
            -			var languages = this.languages;
            -			probeLanguage = probeLanguage || navigator.userLanguage || navigator.language;
            -
            -			var parts = probeLanguage
            -					.toLowerCase()
            -					.match( /([a-z]+)(?:-([a-z]+))?/ ),
            -				lang = parts[1],
            -				locale = parts[2];
            -
            -			if ( languages[ lang + '-' + locale ] )
            -				lang = lang + '-' + locale;
            -			else if ( !languages[ lang ] )
            -				lang = null;
            -
            -			CKEDITOR.lang.detect = lang ?
            -				function() { return lang; } :
            -				function( defaultLanguage ) { return defaultLanguage; };
            -
            -			return lang || defaultLanguage;
            -		}
            -	};
            -
            -})();
            diff --git a/Public/Resources/Javascript/ckeditor/_source/core/loader.js b/Public/Resources/Javascript/ckeditor/_source/core/loader.js
            deleted file mode 100644
            index 2e23d7e..0000000
            --- a/Public/Resources/Javascript/ckeditor/_source/core/loader.js
            +++ /dev/null
            @@ -1,243 +0,0 @@
            -/*
            -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
            -For licensing, see LICENSE.html or http://ckeditor.com/license
            -*/
            -
            -/**
            - * @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
            - *		load core scripts and their dependencies from _source.
            - */
            -
            -if ( typeof CKEDITOR == 'undefined' )
            -	CKEDITOR = {};
            -
            -if ( !CKEDITOR.loader )
            -{
            -	/**
            -	 * Load core scripts and their dependencies from _source.
            -	 * @namespace
            -	 * @example
            -	 */
            -	CKEDITOR.loader = (function()
            -	{
            -		// Table of script names and their dependencies.
            -		var scripts =
            -		{
            -			'core/_bootstrap'		: [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
            -			'core/ajax'				: [ 'core/xml' ],
            -			'core/ckeditor'			: [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
            -			'core/ckeditor_base'	: [],
            -			'core/ckeditor_basic'	: [ 'core/editor_basic', 'core/env', 'core/event' ],
            -			'core/command'			: [],
            -			'core/config'			: [ 'core/ckeditor_base' ],
            -			'core/dom'				: [],
            -			'core/dom/comment'		: [ 'core/dom/node' ],
            -			'core/dom/document'		: [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
            -			'core/dom/documentfragment'	: [ 'core/dom/element' ],
            -			'core/dom/element'		: [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
            -			'core/dom/elementpath'	: [ 'core/dom/element' ],
            -			'core/dom/event'		: [],
            -			'core/dom/node'			: [ 'core/dom/domobject', 'core/tools' ],
            -			'core/dom/nodelist'		: [ 'core/dom/node' ],
            -			'core/dom/domobject'	: [ 'core/dom/event' ],
            -			'core/dom/range'		: [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
            -			'core/dom/rangelist'    : [ 'core/dom/range' ],
            -			'core/dom/text'			: [ 'core/dom/node', 'core/dom/domobject' ],
            -			'core/dom/walker'		: [ 'core/dom/node' ],
            -			'core/dom/window'		: [ 'core/dom/domobject' ],
            -			'core/dtd'				: [ 'core/tools' ],
            -			'core/editor'			: [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
            -			'core/editor_basic'		: [ 'core/event' ],
            -			'core/env'				: [],
            -			'core/event'			: [],
            -			'core/focusmanager'		: [],
            -			'core/htmlparser'		: [],
            -			'core/htmlparser/comment'	: [ 'core/htmlparser' ],
            -			'core/htmlparser/element'	: [ 'core/htmlparser', 'core/htmlparser/fragment' ],
            -			'core/htmlparser/fragment'	: [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
            -			'core/htmlparser/text'		: [ 'core/htmlparser' ],
            -			'core/htmlparser/cdata'		: [ 'core/htmlparser' ],
            -			'core/htmlparser/filter'	: [ 'core/htmlparser' ],
            -			'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
            -			'core/imagecacher'		: [ 'core/dom/element' ],
            -			'core/lang'				: [],
            -			'core/plugins'			: [ 'core/resourcemanager' ],
            -			'core/resourcemanager'	: [ 'core/scriptloader', 'core/tools' ],
            -			'core/scriptloader'		: [ 'core/dom/element', 'core/env' ],
            -			'core/skins'			: [ 'core/imagecacher', 'core/scriptloader' ],
            -			'core/themes'			: [ 'core/resourcemanager' ],
            -			'core/tools'			: [ 'core/env' ],
            -			'core/ui'				: [],
            -			'core/xml'				: [ 'core/env' ]
            -		};
            -
            -		var basePath = (function()
            -		{
            -			// This is a copy of CKEDITOR.basePath, but requires the script having
            -			// "_source/core/loader.js".
            -			if ( CKEDITOR && CKEDITOR.basePath )
            -				return CKEDITOR.basePath;
            -
            -			// Find out the editor directory path, based on its ' +
            -				'';
            -
            -			var iframe = CKEDITOR.dom.element.createFromHtml(
            -						'' );
            -
            -			iframe.on( 'load', function( e )
            -			{
            -				e.removeListener();
            -				var doc = iframe.getFrameDocument().$;
            -				// Custom domain handling is needed after each document.open().
            -				doc.open();
            -				if ( isCustomDomain )
            -					doc.domain = document.domain;
            -				doc.write( htmlToLoad );
            -				doc.close();
            -			}, this );
            -
            -			iframe.setCustomData( 'dialog', this );
            -
            -			var field = this.getContentElement( 'general', 'editing_area' ),
            -				container = field.getElement();
            -			container.setHtml( '' );
            -			container.append( iframe );
            -
            -			// IE need a redirect on focus to make
            -			// the cursor blinking inside iframe. (#5461)
            -			if ( CKEDITOR.env.ie )
            -			{
            -				var focusGrabber = CKEDITOR.dom.element.createFromHtml( '' );
            -				focusGrabber.on( 'focus', function()
            -				{
            -					iframe.$.contentWindow.focus();
            -				});
            -				container.append( focusGrabber );
            -
            -				// Override focus handler on field.
            -				field.focus = function()
            -				{
            -					focusGrabber.focus();
            -					this.fire( 'focus' );
            -				};
            -			}
            -
            -			field.getInputElement = function(){ return iframe; };
            -
            -			// Force container to scale in IE.
            -			if ( CKEDITOR.env.ie )
            -			{
            -				container.setStyle( 'display', 'block' );
            -				container.setStyle( 'height', ( iframe.$.offsetHeight + 2 ) + 'px' );
            -			}
            -		},
            -
            -		onHide : function()
            -		{
            -			if ( CKEDITOR.env.ie )
            -				this.getParentEditor().document.getBody().$.contentEditable = 'true';
            -		},
            -
            -		onLoad : function()
            -		{
            -			if ( ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) && editor.lang.dir == 'rtl' )
            -				this.parts.contents.setStyle( 'overflow', 'hidden' );
            -		},
            -
            -		onOk : function()
            -		{
            -			var container = this.getContentElement( 'general', 'editing_area' ).getElement(),
            -				iframe = container.getElementsByTag( 'iframe' ).getItem( 0 ),
            -				editor = this.getParentEditor(),
            -				html = iframe.$.contentWindow.document.body.innerHTML;
            -
            -			setTimeout( function(){
            -				editor.fire( 'paste', { 'html' : html } );
            -			}, 0 );
            -
            -		},
            -
            -		contents : [
            -			{
            -				id : 'general',
            -				label : editor.lang.common.generalTab,
            -				elements : [
            -					{
            -						type : 'html',
            -						id : 'securityMsg',
            -						html : '
            ' + lang.securityMsg + '
            ' - }, - { - type : 'html', - id : 'pasteMsg', - html : '
            '+lang.pasteMsg +'
            ' - }, - { - type : 'html', - id : 'editing_area', - style : 'width: 100%; height: 100%;', - html : '', - focus : function() - { - var win = this.getInputElement().$.contentWindow; - - // #3291 : JAWS needs the 500ms delay to detect that the editor iframe - // iframe is no longer editable. So that it will put the focus into the - // Paste from Word dialog's editable area instead. - setTimeout( function() - { - win.focus(); - }, 500 ); - } - } - ] - } - ] - }; -}); diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/clipboard/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/clipboard/plugin.js deleted file mode 100644 index 9dc230e..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/clipboard/plugin.js +++ /dev/null @@ -1,412 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @file Clipboard support - */ - -(function() -{ - // Tries to execute any of the paste, cut or copy commands in IE. Returns a - // boolean indicating that the operation succeeded. - var execIECommand = function( editor, command ) - { - var doc = editor.document, - body = doc.getBody(); - - var enabled = false; - var onExec = function() - { - enabled = true; - }; - - // The following seems to be the only reliable way to detect that - // clipboard commands are enabled in IE. It will fire the - // onpaste/oncut/oncopy events only if the security settings allowed - // the command to execute. - body.on( command, onExec ); - - // IE6/7: document.execCommand has problem to paste into positioned element. - ( CKEDITOR.env.version > 7 ? doc.$ : doc.$.selection.createRange() ) [ 'execCommand' ]( command ); - - body.removeListener( command, onExec ); - - return enabled; - }; - - // Attempts to execute the Cut and Copy operations. - var tryToCutCopy = - CKEDITOR.env.ie ? - function( editor, type ) - { - return execIECommand( editor, type ); - } - : // !IE. - function( editor, type ) - { - try - { - // Other browsers throw an error if the command is disabled. - return editor.document.$.execCommand( type ); - } - catch( e ) - { - return false; - } - }; - - // A class that represents one of the cut or copy commands. - var cutCopyCmd = function( type ) - { - this.type = type; - this.canUndo = ( this.type == 'cut' ); // We can't undo copy to clipboard. - }; - - cutCopyCmd.prototype = - { - exec : function( editor, data ) - { - this.type == 'cut' && fixCut( editor ); - - var success = tryToCutCopy( editor, this.type ); - - if ( !success ) - alert( editor.lang.clipboard[ this.type + 'Error' ] ); // Show cutError or copyError. - - return success; - } - }; - - // Paste command. - var pasteCmd = - { - canUndo : false, - - exec : - CKEDITOR.env.ie ? - function( editor ) - { - // Prevent IE from pasting at the begining of the document. - editor.focus(); - - if ( !editor.document.getBody().fire( 'beforepaste' ) - && !execIECommand( editor, 'paste' ) ) - { - editor.fire( 'pasteDialog' ); - return false; - } - } - : - function( editor ) - { - try - { - if ( !editor.document.getBody().fire( 'beforepaste' ) - && !editor.document.$.execCommand( 'Paste', false, null ) ) - { - throw 0; - } - } - catch ( e ) - { - setTimeout( function() - { - editor.fire( 'pasteDialog' ); - }, 0 ); - return false; - } - } - }; - - // Listens for some clipboard related keystrokes, so they get customized. - var onKey = function( event ) - { - if ( this.mode != 'wysiwyg' ) - return; - - switch ( event.data.keyCode ) - { - // Paste - case CKEDITOR.CTRL + 86 : // CTRL+V - case CKEDITOR.SHIFT + 45 : // SHIFT+INS - - var body = this.document.getBody(); - - // Simulate 'beforepaste' event for all none-IEs. - if ( !CKEDITOR.env.ie && body.fire( 'beforepaste' ) ) - event.cancel(); - // Simulate 'paste' event for Opera/Firefox2. - else if ( CKEDITOR.env.opera - || CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) - body.fire( 'paste' ); - return; - - // Cut - case CKEDITOR.CTRL + 88 : // CTRL+X - case CKEDITOR.SHIFT + 46 : // SHIFT+DEL - - // Save Undo snapshot. - var editor = this; - this.fire( 'saveSnapshot' ); // Save before paste - setTimeout( function() - { - editor.fire( 'saveSnapshot' ); // Save after paste - }, 0 ); - } - }; - - // Allow to peek clipboard content by redirecting the - // pasting content into a temporary bin and grab the content of it. - function getClipboardData( evt, mode, callback ) - { - var doc = this.document; - - // Avoid recursions on 'paste' event for IE. - if ( CKEDITOR.env.ie && doc.getById( 'cke_pastebin' ) ) - return; - - // If the browser supports it, get the data directly - if (mode == 'text' && evt.data && evt.data.$.clipboardData) - { - // evt.data.$.clipboardData.types contains all the flavours in Mac's Safari, but not on windows. - var plain = evt.data.$.clipboardData.getData( 'text/plain' ); - if (plain) - { - evt.data.preventDefault(); - callback( plain ); - return; - } - } - - var sel = this.getSelection(), - range = new CKEDITOR.dom.range( doc ); - - // Create container to paste into - var pastebin = new CKEDITOR.dom.element( mode == 'text' ? 'textarea' : CKEDITOR.env.webkit ? 'body' : 'div', doc ); - pastebin.setAttribute( 'id', 'cke_pastebin' ); - // Safari requires a filler node inside the div to have the content pasted into it. (#4882) - CKEDITOR.env.webkit && pastebin.append( doc.createText( '\xa0' ) ); - doc.getBody().append( pastebin ); - - pastebin.setStyles( - { - position : 'absolute', - // Position the bin exactly at the position of the selected element - // to avoid any subsequent document scroll. - top : sel.getStartElement().getDocumentPosition().y + 'px', - width : '1px', - height : '1px', - overflow : 'hidden' - }); - - // It's definitely a better user experience if we make the paste-bin pretty unnoticed - // by pulling it off the screen. - pastebin.setStyle( this.config.contentsLangDirection == 'ltr' ? 'left' : 'right', '-1000px' ); - - var bms = sel.createBookmarks(); - - // Turn off design mode temporarily before give focus to the paste bin. - if ( mode == 'text' ) - { - if ( CKEDITOR.env.ie ) - { - var ieRange = doc.getBody().$.createTextRange(); - ieRange.moveToElementText( pastebin.$ ); - ieRange.execCommand( 'Paste' ); - evt.data.preventDefault(); - } - else - { - doc.$.designMode = 'off'; - pastebin.$.focus(); - } - } - else - { - range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START ); - range.setEndAt( pastebin, CKEDITOR.POSITION_BEFORE_END ); - range.select( true ); - } - - // Wait a while and grab the pasted contents - window.setTimeout( function() - { - mode == 'text' && !CKEDITOR.env.ie && ( doc.$.designMode = 'on' ); - pastebin.remove(); - - // Grab the HTML contents. - // We need to look for a apple style wrapper on webkit it also adds - // a div wrapper if you copy/paste the body of the editor. - // Remove hidden div and restore selection. - var bogusSpan; - pastebin = ( CKEDITOR.env.webkit - && ( bogusSpan = pastebin.getFirst() ) - && ( bogusSpan.is && bogusSpan.hasClass( 'Apple-style-span' ) ) ? - bogusSpan : pastebin ); - - sel.selectBookmarks( bms ); - callback( pastebin[ 'get' + ( mode == 'text' ? 'Value' : 'Html' ) ]() ); - }, 0 ); - } - - // Cutting off control type element in IE standards breaks the selection entirely. (#4881) - function fixCut( editor ) - { - if ( !CKEDITOR.env.ie || editor.document.$.compatMode == 'BackCompat' ) - return; - - var sel = editor.getSelection(); - var control; - if( ( sel.getType() == CKEDITOR.SELECTION_ELEMENT ) && ( control = sel.getSelectedElement() ) ) - { - var range = sel.getRanges()[ 0 ]; - var dummy = editor.document.createText( '' ); - dummy.insertBefore( control ); - range.setStartBefore( dummy ); - range.setEndAfter( control ); - sel.selectRanges( [ range ] ); - - // Clear up the fix if the paste wasn't succeeded. - setTimeout( function() - { - // Element still online? - if ( control.getParent() ) - { - dummy.remove(); - sel.selectElement( control ); - } - }, 0 ); - } - } - - // Register the plugin. - CKEDITOR.plugins.add( 'clipboard', - { - requires : [ 'dialog', 'htmldataprocessor' ], - init : function( editor ) - { - // Inserts processed data into the editor at the end of the - // events chain. - editor.on( 'paste', function( evt ) - { - var data = evt.data; - if ( data[ 'html' ] ) - editor.insertHtml( data[ 'html' ] ); - else if ( data[ 'text' ] ) - editor.insertText( data[ 'text' ] ); - - }, null, null, 1000 ); - - editor.on( 'pasteDialog', function( evt ) - { - setTimeout( function() - { - // Open default paste dialog. - editor.openDialog( 'paste' ); - }, 0 ); - }); - - function addButtonCommand( buttonName, commandName, command, ctxMenuOrder ) - { - var lang = editor.lang[ commandName ]; - - editor.addCommand( commandName, command ); - editor.ui.addButton( buttonName, - { - label : lang, - command : commandName - }); - - // If the "menu" plugin is loaded, register the menu item. - if ( editor.addMenuItems ) - { - editor.addMenuItem( commandName, - { - label : lang, - command : commandName, - group : 'clipboard', - order : ctxMenuOrder - }); - } - } - - addButtonCommand( 'Cut', 'cut', new cutCopyCmd( 'cut' ), 1 ); - addButtonCommand( 'Copy', 'copy', new cutCopyCmd( 'copy' ), 4 ); - addButtonCommand( 'Paste', 'paste', pasteCmd, 8 ); - - CKEDITOR.dialog.add( 'paste', CKEDITOR.getUrl( this.path + 'dialogs/paste.js' ) ); - - editor.on( 'key', onKey, editor ); - - var mode = editor.config.forcePasteAsPlainText ? 'text' : 'html'; - - // We'll be catching all pasted content in one line, regardless of whether the - // it's introduced by a document command execution (e.g. toolbar buttons) or - // user paste behaviors. (e.g. Ctrl-V) - editor.on( 'contentDom', function() - { - var body = editor.document.getBody(); - body.on( ( (mode == 'text' && CKEDITOR.env.ie) || CKEDITOR.env.webkit ) ? 'paste' : 'beforepaste', - function( evt ) - { - if ( depressBeforeEvent ) - return; - - getClipboardData.call( editor, evt, mode, function ( data ) - { - // The very last guard to make sure the - // paste has successfully happened. - if ( !data ) - return; - - var dataTransfer = {}; - dataTransfer[ mode ] = data; - editor.fire( 'paste', dataTransfer ); - } ); - }); - - body.on( 'beforecut', function() { !depressBeforeEvent && fixCut( editor ); } ); - }); - - // If the "contextmenu" plugin is loaded, register the listeners. - if ( editor.contextMenu ) - { - var depressBeforeEvent; - function stateFromNamedCommand( command ) - { - // IE Bug: queryCommandEnabled('paste') fires also 'beforepaste(copy/cut)', - // guard to distinguish from the ordinary sources( either - // keyboard paste or execCommand ) (#4874). - CKEDITOR.env.ie && ( depressBeforeEvent = 1 ); - - var retval = editor.document.$.queryCommandEnabled( command ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; - depressBeforeEvent = 0; - return retval; - } - - editor.contextMenu.addListener( function( element, selection ) - { - var readOnly = selection.getCommonAncestor().isReadOnly(); - return { - cut : !readOnly && stateFromNamedCommand( 'Cut' ), - copy : stateFromNamedCommand( 'Copy' ), - paste : !readOnly && ( CKEDITOR.env.webkit ? CKEDITOR.TRISTATE_OFF : stateFromNamedCommand( 'Paste' ) ) - }; - }); - } - } - }); -})(); - -/** - * Fired when a clipboard operation is about to be taken into the editor. - * Listeners can manipulate the data to be pasted before having it effectively - * inserted into the document. - * @name CKEDITOR.editor#paste - * @since 3.1 - * @event - * @param {String} [data.html] The HTML data to be pasted. If not available, e.data.text will be defined. - * @param {String} [data.text] The plain text data to be pasted, available when plain text operations are to used. If not available, e.data.html will be defined. - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/colorbutton/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/colorbutton/plugin.js deleted file mode 100644 index 305c44d..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/colorbutton/plugin.js +++ /dev/null @@ -1,251 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.plugins.add( 'colorbutton', -{ - requires : [ 'panelbutton', 'floatpanel', 'styles' ], - - init : function( editor ) - { - var config = editor.config, - lang = editor.lang.colorButton; - - var clickFn; - - if ( !CKEDITOR.env.hc ) - { - addButton( 'TextColor', 'fore', lang.textColorTitle ); - addButton( 'BGColor', 'back', lang.bgColorTitle ); - } - - function addButton( name, type, title ) - { - editor.ui.add( name, CKEDITOR.UI_PANELBUTTON, - { - label : title, - title : title, - className : 'cke_button_' + name.toLowerCase(), - modes : { wysiwyg : 1 }, - - panel : - { - css : editor.skin.editor.css, - attributes : { role : 'listbox', 'aria-label' : lang.panelTitle } - }, - - onBlock : function( panel, block ) - { - block.autoSize = true; - block.element.addClass( 'cke_colorblock' ); - block.element.setHtml( renderColors( panel, type ) ); - // The block should not have scrollbars (#5933, #6056) - block.element.getDocument().getBody().setStyle( 'overflow', 'hidden' ); - - var keys = block.keys; - var rtl = editor.lang.dir == 'rtl'; - keys[ rtl ? 37 : 39 ] = 'next'; // ARROW-RIGHT - keys[ 40 ] = 'next'; // ARROW-DOWN - keys[ 9 ] = 'next'; // TAB - keys[ rtl ? 39 : 37 ] = 'prev'; // ARROW-LEFT - keys[ 38 ] = 'prev'; // ARROW-UP - keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB - keys[ 32 ] = 'click'; // SPACE - } - }); - } - - - function renderColors( panel, type ) - { - var output = [], - colors = config.colorButton_colors.split( ',' ), - total = colors.length + ( config.colorButton_enableMore ? 2 : 1 ); - - var clickFn = CKEDITOR.tools.addFunction( function( color, type ) - { - if ( color == '?' ) - { - var applyColorStyle = arguments.callee; - function onColorDialogClose( evt ) - { - this.removeListener( 'ok', onColorDialogClose ); - this.removeListener( 'cancel', onColorDialogClose ); - - evt.name == 'ok' && applyColorStyle( this.getContentElement( 'picker', 'selectedColor' ).getValue(), type ); - } - - editor.openDialog( 'colordialog', function() - { - this.on( 'ok', onColorDialogClose ); - this.on( 'cancel', onColorDialogClose ); - } ); - - return; - } - - editor.focus(); - - panel.hide(); - - - editor.fire( 'saveSnapshot' ); - - // Clean up any conflicting style within the range. - new CKEDITOR.style( config['colorButton_' + type + 'Style'], { color : 'inherit' } ).remove( editor.document ); - - if ( color ) - { - var colorStyle = config['colorButton_' + type + 'Style']; - - colorStyle.childRule = type == 'back' ? - // It's better to apply background color as the innermost style. (#3599) - function(){ return false; } : - // Fore color style must be applied inside links instead of around it. - function( element ){ return element.getName() != 'a'; }; - - new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document ); - } - - editor.fire( 'saveSnapshot' ); - }); - - // Render the "Automatic" button. - output.push( - '' + - '' + - '' + - '' + - '' + - '' + - '
            ' + - '' + - '', - lang.auto, - '
            ' + - '
            ' + - '' ); - - // Render the color boxes. - for ( var i = 0 ; i < colors.length ; i++ ) - { - if ( ( i % 8 ) === 0 ) - output.push( '' ); - - var parts = colors[ i ].split( '/' ), - colorName = parts[ 0 ], - colorCode = parts[ 1 ] || colorName; - - // The data can be only a color code (without #) or colorName + color code - // If only a color code is provided, then the colorName is the color with the hash - // Convert the color from RGB to RRGGBB for better compatibility with IE and . See #5676 - if (!parts[1]) - colorName = '#' + colorName.replace( /^(.)(.)(.)$/, '$1$1$2$2$3$3' ); - - var colorLabel = editor.lang.colors[ colorCode ] || colorCode; - output.push( - '' ); - } - - // Render the "More Colors" button. - if ( config.colorButton_enableMore ) - { - output.push( - '' + - '' + - '' ); // It is later in the code. - } - - output.push( '
            ' + - '' + - '' + - '' + - '
            ' + - '', - lang.more, - '' + - '
            ' ); - - return output.join( '' ); - } - } -}); - -/** - * Whether to enable the "More Colors..." button in the color selectors. - * @default false - * @type Boolean - * @example - * config.colorButton_enableMore = false; - */ -CKEDITOR.config.colorButton_enableMore = true; - -/** - * Defines the colors to be displayed in the color selectors. It's a string - * containing the hexadecimal notation for HTML colors, without the "#" prefix. - * - * Since 3.3: A name may be optionally defined by prefixing the entries with the - * name and the slash character. For example, "FontColor1/FF9900" will be - * displayed as the color #FF9900 in the selector, but will be outputted as "FontColor1". - * @type String - * @default '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF' - * @example - * // Brazil colors only. - * config.colorButton_colors = '00923E,F8C100,28166F'; - * @example - * config.colorButton_colors = 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00' - */ -CKEDITOR.config.colorButton_colors = - '000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' + - 'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' + - 'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' + - 'FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,' + - 'FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF'; - -/** - * Holds the style definition to be used to apply the text foreground color. - * @type Object - * @example - * // This is basically the default setting value. - * config.colorButton_foreStyle = - * { - * element : 'span', - * styles : { 'color' : '#(color)' } - * }; - */ -CKEDITOR.config.colorButton_foreStyle = - { - element : 'span', - styles : { 'color' : '#(color)' }, - overrides : [ { element : 'font', attributes : { 'color' : null } } ] - }; - -/** - * Holds the style definition to be used to apply the text background color. - * @type Object - * @example - * // This is basically the default setting value. - * config.colorButton_backStyle = - * { - * element : 'span', - * styles : { 'background-color' : '#(color)' } - * }; - */ -CKEDITOR.config.colorButton_backStyle = - { - element : 'span', - styles : { 'background-color' : '#(color)' } - }; diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js b/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js deleted file mode 100644 index 4454d19..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js +++ /dev/null @@ -1,340 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.dialog.add( 'colordialog', function( editor ) - { - // Define some shorthands. - var $el = CKEDITOR.dom.element, - $doc = CKEDITOR.document, - $tools = CKEDITOR.tools, - lang = editor.lang.colordialog; - - // Reference the dialog. - var dialog; - - function spacer() - { - return { - type : 'html', - html : ' ' - }; - } - - function clearSelected() - { - $doc.getById( selHiColorId ).removeStyle( 'background-color' ); - dialog.getContentElement( 'picker', 'selectedColor' ).setValue( '' ); - } - - function updateSelected( evt ) - { - if ( ! (evt instanceof CKEDITOR.dom.event ) ) - evt = new CKEDITOR.dom.event( evt ); - - var target = evt.getTarget(), - color; - - if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) - dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color ); - } - - function updateHighlight( event ) - { - if ( ! (event instanceof CKEDITOR.dom.event ) ) - event = event.data; - - var target = event.getTarget(), - color; - - if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) - { - $doc.getById( hicolorId ).setStyle( 'background-color', color ); - $doc.getById( hicolorTextId ).setHtml( color ); - } - } - - function clearHighlight() - { - $doc.getById( hicolorId ).removeStyle( 'background-color' ); - $doc.getById( hicolorTextId ).setHtml( ' ' ); - } - - var onMouseout = $tools.addFunction( clearHighlight ); - - var onClick = updateSelected, - onClickHandler = CKEDITOR.tools.addFunction( onClick ); - - var onFocus = updateHighlight, - onBlur = clearHighlight; - - var onKeydownHandler = CKEDITOR.tools.addFunction( function( ev ) - { - ev = new CKEDITOR.dom.event( ev ); - var element = ev.getTarget(); - var relative, nodeToMove; - var keystroke = ev.getKeystroke(); - var rtl = editor.lang.dir == 'rtl'; - - switch ( keystroke ) - { - // UP-ARROW - case 38 : - // relative is TR - if ( ( relative = element.getParent().getParent().getPrevious() ) ) - { - nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - } - ev.preventDefault(); - break; - // DOWN-ARROW - case 40 : - // relative is TR - if ( ( relative = element.getParent().getParent().getNext() ) ) - { - nodeToMove = relative.getChild( [ element.getParent().getIndex(), 0 ] ); - if ( nodeToMove && nodeToMove.type == 1 ) - { - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - } - } - ev.preventDefault(); - break; - // SPACE - // ENTER is already handled as onClick - case 32 : - onClick( ev ); - ev.preventDefault(); - break; - - // RIGHT-ARROW - case rtl ? 37 : 39 : - // relative is TD - if ( ( relative = element.getParent().getNext() ) ) - { - nodeToMove = relative.getChild( 0 ); - if ( nodeToMove.type == 1 ) - { - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - ev.preventDefault( true ); - } - else - onBlur( null, element ); - } - // relative is TR - else if ( ( relative = element.getParent().getParent().getNext() ) ) - { - nodeToMove = relative.getChild( [ 0, 0 ] ); - if ( nodeToMove && nodeToMove.type == 1 ) - { - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - ev.preventDefault( true ); - } - else - onBlur( null, element ); - } - break; - - // LEFT-ARROW - case rtl ? 39 : 37 : - // relative is TD - if ( ( relative = element.getParent().getPrevious() ) ) - { - nodeToMove = relative.getChild( 0 ); - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - ev.preventDefault( true ); - } - // relative is TR - else if ( ( relative = element.getParent().getParent().getPrevious() ) ) - { - nodeToMove = relative.getLast().getChild( 0 ); - nodeToMove.focus(); - onBlur( ev, element ); - onFocus( ev, nodeToMove ); - ev.preventDefault( true ); - } - else - onBlur( null, element ); - break; - default : - // Do not stop not handled events. - return; - } - }); - - function createColorTable() - { - // Create the base colors array. - var aColors = ['00','33','66','99','cc','ff']; - - // This function combines two ranges of three values from the color array into a row. - function appendColorRow( rangeA, rangeB ) - { - for ( var i = rangeA ; i < rangeA + 3 ; i++ ) - { - var row = table.$.insertRow(-1); - - for ( var j = rangeB ; j < rangeB + 3 ; j++ ) - { - for ( var n = 0 ; n < 6 ; n++ ) - { - appendColorCell( row, '#' + aColors[j] + aColors[n] + aColors[i] ); - } - } - } - } - - // This function create a single color cell in the color table. - function appendColorCell( targetRow, color ) - { - var cell = new $el( targetRow.insertCell( -1 ) ); - cell.setAttribute( 'class', 'ColorCell' ); - cell.setStyle( 'background-color', color ); - - cell.setStyle( 'width', '15px' ); - cell.setStyle( 'height', '15px' ); - - var index = cell.$.cellIndex + 1 + 18 * targetRow.rowIndex; - cell.append( CKEDITOR.dom.element.createFromHtml( - '' + color + ' ', CKEDITOR.document ) ); - } - - appendColorRow( 0, 0 ); - appendColorRow( 3, 0 ); - appendColorRow( 0, 3 ); - appendColorRow( 3, 3 ); - - // Create the last row. - var oRow = table.$.insertRow(-1) ; - - // Create the gray scale colors cells. - for ( var n = 0 ; n < 6 ; n++ ) - { - appendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ; - } - - // Fill the row with black cells. - for ( var i = 0 ; i < 12 ; i++ ) - { - appendColorCell( oRow, '#000000' ) ; - } - } - - var table = new $el( 'table' ); - createColorTable(); - - var numbering = function( id ) - { - return CKEDITOR.tools.getNextId() + '_' + id; - }, - hicolorId = numbering( 'hicolor' ), - hicolorTextId = numbering( 'hicolortext' ), - selHiColorId = numbering( 'selhicolor' ), - tableLabelId = numbering( 'color_table_label' ); - - return { - title : lang.title, - minWidth : 360, - minHeight : 220, - onLoad : function() - { - // Update reference. - dialog = this; - }, - contents : [ - { - id : 'picker', - label : lang.title, - accessKey : 'I', - elements : - [ - { - type : 'hbox', - padding : 0, - widths : [ '70%', '10%', '30%' ], - children : - [ - { - type : 'html', - html : '' + table.getHtml() + '
            ' + - '' + lang.options +'', - onLoad : function() - { - var table = CKEDITOR.document.getById( this.domId ); - table.on( 'mouseover', updateHighlight ); - }, - focus: function() - { - var firstColor = this.getElement().getElementsByTag( 'a' ).getItem( 0 ); - firstColor.focus(); - } - }, - spacer(), - { - type : 'vbox', - padding : 0, - widths : [ '70%', '5%', '25%' ], - children : - [ - { - type : 'html', - html : '' + lang.highlight +'\ -
            \ -
             
            ' + lang.selected + '\ -
            ' - }, - { - type : 'text', - label : lang.selected, - labelStyle: 'display:none', - id : 'selectedColor', - style : 'width: 74px', - onChange : function() - { - // Try to update color preview with new value. If fails, then set it no none. - try - { - $doc.getById( selHiColorId ).setStyle( 'background-color', this.getValue() ); - } - catch ( e ) - { - clearSelected(); - } - } - }, - spacer(), - { - type : 'button', - id : 'clear', - style : 'margin-top: 5px', - label : lang.clear, - onClick : clearSelected - } - ] - } - ] - } - ] - } - ] - }; - } - ); diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/plugin.js deleted file mode 100644 index 7006d68..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/colordialog/plugin.js +++ /dev/null @@ -1,13 +0,0 @@ -( function() -{ - CKEDITOR.plugins.colordialog = - { - init : function( editor ) - { - editor.addCommand( 'colordialog', new CKEDITOR.dialogCommand( 'colordialog' ) ); - CKEDITOR.dialog.add( 'colordialog', this.path + 'dialogs/colordialog.js' ); - } - }; - - CKEDITOR.plugins.add( 'colordialog', CKEDITOR.plugins.colordialog ); -} )(); diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/contextmenu/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/contextmenu/plugin.js deleted file mode 100644 index 3a5b082..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/contextmenu/plugin.js +++ /dev/null @@ -1,281 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.plugins.add( 'contextmenu', -{ - requires : [ 'menu' ], - - beforeInit : function( editor ) - { - editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor ); - - editor.addCommand( 'contextMenu', - { - exec : function() - { - editor.contextMenu.show( editor.document.getBody() ); - } - }); - } -}); - -CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( -{ - $ : function( editor ) - { - this.id = 'cke_' + CKEDITOR.tools.getNextNumber(); - this.editor = editor; - this._.listeners = []; - this._.functionId = CKEDITOR.tools.addFunction( function( commandName ) - { - this._.panel.hide(); - editor.focus(); - editor.execCommand( commandName ); - }, - this); - - this.definition = - { - panel: - { - className : editor.skinClass + ' cke_contextmenu', - attributes : - { - 'aria-label' : editor.lang.contextmenu.options - } - } - }; - }, - - _ : - { - onMenu : function( offsetParent, corner, offsetX, offsetY ) - { - var menu = this._.menu, - editor = this.editor; - - if ( menu ) - { - menu.hide(); - menu.removeAll(); - } - else - { - menu = this._.menu = new CKEDITOR.menu( editor, this.definition ); - menu.onClick = CKEDITOR.tools.bind( function( item ) - { - menu.hide(); - - if ( item.onClick ) - item.onClick(); - else if ( item.command ) - editor.execCommand( item.command ); - - }, this ); - - menu.onEscape = function( keystroke ) - { - var parent = this.parent; - // 1. If it's sub-menu, restore the last focused item - // of upper level menu. - // 2. In case of a top-menu, close it. - if ( parent ) - { - parent._.panel.hideChild(); - // Restore parent block item focus. - var parentBlock = parent._.panel._.panel._.currentBlock, - parentFocusIndex = parentBlock._.focusIndex; - parentBlock._.markItem( parentFocusIndex ); - } - else if ( keystroke == 27 ) - { - this.hide(); - editor.focus(); - } - return false; - }; - } - - var listeners = this._.listeners, - includedItems = []; - - var selection = this.editor.getSelection(), - element = selection && selection.getStartElement(); - - menu.onHide = CKEDITOR.tools.bind( function() - { - menu.onHide = null; - - if ( CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.unlock(); - } - - this.onHide && this.onHide(); - }, - this ); - - // Call all listeners, filling the list of items to be displayed. - for ( var i = 0 ; i < listeners.length ; i++ ) - { - var listenerItems = listeners[ i ]( element, selection ); - - if ( listenerItems ) - { - for ( var itemName in listenerItems ) - { - var item = this.editor.getMenuItem( itemName ); - - if ( item ) - { - item.state = listenerItems[ itemName ]; - menu.add( item ); - } - } - } - } - - // Don't show context menu with zero items. - menu.items.length && menu.show( offsetParent, corner || ( editor.lang.dir == 'rtl' ? 2 : 1 ), offsetX, offsetY ); - } - }, - - proto : - { - addTarget : function( element, nativeContextMenuOnCtrl ) - { - // Opera doesn't support 'contextmenu' event, we have duo approaches employed here: - // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser - // option 'Allow script to detect context menu/right click events' to be always turned on. - // 2. Considering the fact that ctrl/meta key is not been occupied - // for multiple range selecting (like Gecko), we use this key - // combination as a fallback for triggering context-menu. (#4530) - if ( CKEDITOR.env.opera ) - { - var contextMenuOverrideButton; - element.on( 'mousedown', function( evt ) - { - evt = evt.data; - if ( evt.$.button != 2 ) - { - if ( evt.getKeystroke() == CKEDITOR.CTRL + 1 ) - element.fire( 'contextmenu', evt ); - return; - } - - if ( nativeContextMenuOnCtrl - && ( CKEDITOR.env.mac ? evt.$.metaKey : evt.$.ctrlKey ) ) - return; - - var target = evt.getTarget(); - - if ( !contextMenuOverrideButton ) - { - var ownerDoc = target.getDocument(); - contextMenuOverrideButton = ownerDoc.createElement( 'input' ) ; - contextMenuOverrideButton.$.type = 'button' ; - ownerDoc.getBody().append( contextMenuOverrideButton ) ; - } - - contextMenuOverrideButton.setAttribute( 'style', 'position:absolute;top:' + ( evt.$.clientY - 2 ) + - 'px;left:' + ( evt.$.clientX - 2 ) + - 'px;width:5px;height:5px;opacity:0.01' ); - - } ); - - element.on( 'mouseup', function ( evt ) - { - if ( contextMenuOverrideButton ) - { - contextMenuOverrideButton.remove(); - contextMenuOverrideButton = undefined; - // Simulate 'contextmenu' event. - element.fire( 'contextmenu', evt.data ); - } - } ); - } - - element.on( 'contextmenu', function( event ) - { - if ( this.editor.config.onlyShowContextMenuInSpellCheckMode && !this.editor.inSpellCheckMode ) - return; - - var domEvent = event.data; - - if ( nativeContextMenuOnCtrl && - // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event, - // which make this property unreliable. (#4826) - ( CKEDITOR.env.webkit ? holdCtrlKey : ( CKEDITOR.env.mac ? domEvent.$.metaKey : domEvent.$.ctrlKey ) ) ) - return; - - - // Cancel the browser context menu. - domEvent.preventDefault(); - - var offsetParent = domEvent.getTarget().getDocument().getDocumentElement(), - offsetX = domEvent.$.clientX, - offsetY = domEvent.$.clientY; - - CKEDITOR.tools.setTimeout( function() - { - this.show( offsetParent, null, offsetX, offsetY ); - }, - 0, this ); - }, - this ); - - if ( CKEDITOR.env.webkit ) - { - var holdCtrlKey, - onKeyDown = function( event ) - { - holdCtrlKey = CKEDITOR.env.mac ? event.data.$.metaKey : event.data.$.ctrlKey ; - }, - resetOnKeyUp = function() - { - holdCtrlKey = 0; - }; - - element.on( 'keydown', onKeyDown ); - element.on( 'keyup', resetOnKeyUp ); - element.on( 'contextmenu', resetOnKeyUp ); - } - }, - - addListener : function( listenerFn ) - { - this._.listeners.push( listenerFn ); - }, - - show : function( offsetParent, corner, offsetX, offsetY ) - { - this.editor.focus(); - - // Selection will be unavailable after context menu shows up - // in IE, lock it now. - if ( CKEDITOR.env.ie ) - { - var selection = this.editor.getSelection(); - selection && selection.lock(); - } - - this._.onMenu( offsetParent || CKEDITOR.document.getDocumentElement(), corner, offsetX || 0, offsetY || 0 ); - } - } -}); - -/** - * Whether to show the browser native context menu when the CTRL or the - * META (Mac) key is pressed while opening the context menu. - * @name CKEDITOR.config.browserContextMenuOnCtrl - * @since 3.0.2 - * @type Boolean - * @default true - * @example - * config.browserContextMenuOnCtrl = false; - */ -CKEDITOR.config.onlyShowContextMenuInSpellCheckMode = false; - diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/dialogDefinition.js b/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/dialogDefinition.js deleted file mode 100644 index a3094f6..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/dialogDefinition.js +++ /dev/null @@ -1,315 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview Defines the "virtual" dialog, dialog content and dialog button - * definition classes. - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialogs. - * @name CKEDITOR.dialog.dialogDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - * - * CKEDITOR.dialog.add( 'testOnly', function( editor ) - * { - * return { - * title : 'Test Dialog', - * resizable : CKEDITOR.DIALOG_RESIZE_BOTH, - * minWidth : 500, - * minHeight : 400, - * contents : [ - * { - * id : 'tab1', - * label : 'First Tab', - * title : 'First Tab Title', - * accessKey : 'Q', - * elements : [ - * { - * type : 'text', - * label : 'Test Text 1', - * id : 'testText1', - * 'default' : 'hello world!' - * } - * ] - * } - * ] - * }; - * }); - */ - -/** - * The dialog title, displayed in the dialog's header. Required. - * @name CKEDITOR.dialog.dialogDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * How the dialog can be resized, must be one of the four contents defined below. - *

            - * CKEDITOR.DIALOG_RESIZE_NONE
            - * CKEDITOR.DIALOG_RESIZE_WIDTH
            - * CKEDITOR.DIALOG_RESIZE_HEIGHT
            - * CKEDITOR.DIALOG_RESIZE_BOTH
            - * @name CKEDITOR.dialog.dialogDefinition.prototype.resizable - * @field - * @type Number - * @default CKEDITOR.DIALOG_RESIZE_NONE - * @example - */ - -/** - * The minimum width of the dialog, in pixels. - * @name CKEDITOR.dialog.dialogDefinition.prototype.minWidth - * @field - * @type Number - * @default 600 - * @example - */ - -/** - * The minimum height of the dialog, in pixels. - * @name CKEDITOR.dialog.dialogDefinition.prototype.minHeight - * @field - * @type Number - * @default 400 - * @example - */ - -/** - * The buttons in the dialog, defined as an array of - * {@link CKEDITOR.dialog.buttonDefinition} objects. - * @name CKEDITOR.dialog.dialogDefinition.prototype.buttons - * @field - * @type Array - * @default [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] - * @example - */ - -/** - * The contents in the dialog, defined as an array of - * {@link CKEDITOR.dialog.contentDefinition} objects. Required. - * @name CKEDITOR.dialog.dialogDefinition.prototype.contents - * @field - * @type Array - * @example - */ - -/** - * The function to execute when OK is pressed. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onOk - * @field - * @type Function - * @example - */ - -/** - * The function to execute when Cancel is pressed. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onCancel - * @field - * @type Function - * @example - */ - -/** - * The function to execute when the dialog is displayed for the first time. - * @name CKEDITOR.dialog.dialogDefinition.prototype.onLoad - * @field - * @type Function - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog content pages. - * @name CKEDITOR.dialog.contentDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the content page. - * @name CKEDITOR.dialog.contentDefinition.prototype.id - * @field - * @type String - * @example - */ - -/** - * The tab label of the content page. - * @name CKEDITOR.dialog.contentDefinition.prototype.label - * @field - * @type String - * @example - */ - -/** - * The popup message of the tab label. - * @name CKEDITOR.dialog.contentDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * The CTRL hotkey for switching to the tab. - * @name CKEDITOR.dialog.contentDefinition.prototype.accessKey - * @field - * @type String - * @example - * contentDefinition.accessKey = 'Q'; // Switch to this page when CTRL-Q is pressed. - */ - -/** - * The UI elements contained in this content page, defined as an array of - * {@link CKEDITOR.dialog.uiElementDefinition} objects. - * @name CKEDITOR.dialog.contentDefinition.prototype.elements - * @field - * @type Array - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog buttons. - * @name CKEDITOR.dialog.buttonDefinition - * @constructor - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the dialog button. Required. - * @name CKEDITOR.dialog.buttonDefinition.prototype.id - * @type String - * @field - * @example - */ - -/** - * The label of the dialog button. Required. - * @name CKEDITOR.dialog.buttonDefinition.prototype.label - * @type String - * @field - * @example - */ - -/** - * The popup message of the dialog button. - * @name CKEDITOR.dialog.buttonDefinition.prototype.title - * @type String - * @field - * @example - */ - -/** - * The CTRL hotkey for the button. - * @name CKEDITOR.dialog.buttonDefinition.prototype.accessKey - * @type String - * @field - * @example - * exitButton.accessKey = 'X'; // Button will be pressed when user presses CTRL-X - */ - -/** - * Whether the button is disabled. - * @name CKEDITOR.dialog.buttonDefinition.prototype.disabled - * @type Boolean - * @field - * @default false - * @example - */ - -/** - * The function to execute when the button is clicked. - * @name CKEDITOR.dialog.buttonDefinition.prototype.onClick - * @type Function - * @field - * @example - */ - -/** - * This class is not really part of the API. It just illustrates the properties - * that developers can use to define and create dialog UI elements. - * @name CKEDITOR.dialog.uiElementDefinition - * @constructor - * @see CKEDITOR.ui.dialog.uiElement - * @example - * // There is no constructor for this class, the user just has to define an - * // object with the appropriate properties. - */ - -/** - * The id of the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.id - * @field - * @type String - * @example - */ - -/** - * The type of the UI element. Required. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.type - * @field - * @type String - * @example - */ - -/** - * The popup label of the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.title - * @field - * @type String - * @example - */ - -/** - * CSS class names to append to the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.className - * @field - * @type String - * @example - */ - -/** - * Inline CSS classes to append to the UI element. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.style - * @field - * @type String - * @example - */ - -/** - * Function to execute the first time the UI element is displayed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onLoad - * @field - * @type Function - * @example - */ - -/** - * Function to execute whenever the UI element's parent dialog is displayed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onShow - * @field - * @type Function - * @example - */ - -/** - * Function to execute whenever the UI element's parent dialog is closed. - * @name CKEDITOR.dialog.uiElementDefinition.prototype.onHide - * @field - * @type Function - * @example - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/plugin.js deleted file mode 100644 index f2430cc..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/dialog/plugin.js +++ /dev/null @@ -1,2974 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** - * @fileOverview The floating dialog plugin. - */ - -/** - * No resize for this dialog. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_NONE = 0; - -/** - * Only allow horizontal resizing for this dialog, disable vertical resizing. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_WIDTH = 1; - -/** - * Only allow vertical resizing for this dialog, disable horizontal resizing. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_HEIGHT = 2; - -/* - * Allow the dialog to be resized in both directions. - * @constant - */ -CKEDITOR.DIALOG_RESIZE_BOTH = 3; - -(function() -{ - function isTabVisible( tabId ) - { - return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight; - } - - function getPreviousVisibleTab() - { - var tabId = this._.currentTabId, - length = this._.tabIdList.length, - tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length; - - for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- ) - { - if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) - return this._.tabIdList[ i % length ]; - } - - return null; - } - - function getNextVisibleTab() - { - var tabId = this._.currentTabId, - length = this._.tabIdList.length, - tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ); - - for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ ) - { - if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) ) - return this._.tabIdList[ i % length ]; - } - - return null; - } - - /** - * This is the base class for runtime dialog objects. An instance of this - * class represents a single named dialog for a single editor instance. - * @param {Object} editor The editor which created the dialog. - * @param {String} dialogName The dialog's registered name. - * @constructor - * @example - * var dialogObj = new CKEDITOR.dialog( editor, 'smiley' ); - */ - CKEDITOR.dialog = function( editor, dialogName ) - { - // Load the dialog definition. - var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ]; - - // Completes the definition with the default values. - definition = CKEDITOR.tools.extend( definition( editor ), defaultDialogDefinition ); - - // Clone a functionally independent copy for this dialog. - definition = CKEDITOR.tools.clone( definition ); - - // Create a complex definition object, extending it with the API - // functions. - definition = new definitionObject( this, definition ); - - - var doc = CKEDITOR.document; - - var themeBuilt = editor.theme.buildDialog( editor ); - - // Initialize some basic parameters. - this._ = - { - editor : editor, - element : themeBuilt.element, - name : dialogName, - contentSize : { width : 0, height : 0 }, - size : { width : 0, height : 0 }, - updateSize : false, - contents : {}, - buttons : {}, - accessKeyMap : {}, - - // Initialize the tab and page map. - tabs : {}, - tabIdList : [], - currentTabId : null, - currentTabIndex : null, - pageCount : 0, - lastTab : null, - tabBarMode : false, - - // Initialize the tab order array for input widgets. - focusList : [], - currentFocusIndex : 0, - hasFocus : false - }; - - this.parts = themeBuilt.parts; - - CKEDITOR.tools.setTimeout( function() - { - editor.fire( 'ariaWidget', this.parts.contents ); - }, - 0, this ); - - // Set the startup styles for the dialog, avoiding it enlarging the - // page size on the dialog creation. - this.parts.dialog.setStyles( - { - position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed', - top : 0, - left: 0, - visibility : 'hidden' - }); - - // Call the CKEDITOR.event constructor to initialize this instance. - CKEDITOR.event.call( this ); - - // Fire the "dialogDefinition" event, making it possible to customize - // the dialog definition. - this.definition = definition = CKEDITOR.fire( 'dialogDefinition', - { - name : dialogName, - definition : definition - } - , editor ).definition; - // Initialize load, show, hide, ok and cancel events. - if ( definition.onLoad ) - this.on( 'load', definition.onLoad ); - - if ( definition.onShow ) - this.on( 'show', definition.onShow ); - - if ( definition.onHide ) - this.on( 'hide', definition.onHide ); - - if ( definition.onOk ) - { - this.on( 'ok', function( evt ) - { - // Dialog confirm might probably introduce content changes (#5415). - editor.fire( 'saveSnapshot' ); - setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 ); - if ( definition.onOk.call( this, evt ) === false ) - evt.data.hide = false; - }); - } - - if ( definition.onCancel ) - { - this.on( 'cancel', function( evt ) - { - if ( definition.onCancel.call( this, evt ) === false ) - evt.data.hide = false; - }); - } - - var me = this; - - // Iterates over all items inside all content in the dialog, calling a - // function for each of them. - var iterContents = function( func ) - { - var contents = me._.contents, - stop = false; - - for ( var i in contents ) - { - for ( var j in contents[i] ) - { - stop = func.call( this, contents[i][j] ); - if ( stop ) - return; - } - } - }; - - this.on( 'ok', function( evt ) - { - iterContents( function( item ) - { - if ( item.validate ) - { - var isValid = item.validate( this ); - - if ( typeof isValid == 'string' ) - { - alert( isValid ); - isValid = false; - } - - if ( isValid === false ) - { - if ( item.select ) - item.select(); - else - item.focus(); - - evt.data.hide = false; - evt.stop(); - return true; - } - } - }); - }, this, null, 0 ); - - this.on( 'cancel', function( evt ) - { - iterContents( function( item ) - { - if ( item.isChanged() ) - { - if ( !confirm( editor.lang.common.confirmCancel ) ) - evt.data.hide = false; - return true; - } - }); - }, this, null, 0 ); - - this.parts.close.on( 'click', function( evt ) - { - if ( this.fire( 'cancel', { hide : true } ).hide !== false ) - this.hide(); - evt.data.preventDefault(); - }, this ); - - // Sort focus list according to tab order definitions. - function setupFocus() - { - var focusList = me._.focusList; - focusList.sort( function( a, b ) - { - // Mimics browser tab order logics; - if ( a.tabIndex != b.tabIndex ) - return b.tabIndex - a.tabIndex; - // Sort is not stable in some browsers, - // fall-back the comparator to 'focusIndex'; - else - return a.focusIndex - b.focusIndex; - }); - - var size = focusList.length; - for ( var i = 0; i < size; i++ ) - focusList[ i ].focusIndex = i; - } - - function changeFocus( forward ) - { - var focusList = me._.focusList, - offset = forward ? 1 : -1; - if ( focusList.length < 1 ) - return; - - var current = me._.currentFocusIndex; - - // Trigger the 'blur' event of any input element before anything, - // since certain UI updates may depend on it. - try - { - focusList[ current ].getInputElement().$.blur(); - } - catch( e ){} - - var startIndex = ( current + offset + focusList.length ) % focusList.length, - currentIndex = startIndex; - while ( !focusList[ currentIndex ].isFocusable() ) - { - currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length; - if ( currentIndex == startIndex ) - break; - } - focusList[ currentIndex ].focus(); - - // Select whole field content. - if ( focusList[ currentIndex ].type == 'text' ) - focusList[ currentIndex ].select(); - } - - this.changeFocus = changeFocus; - - var processed; - - function focusKeydownHandler( evt ) - { - // If I'm not the top dialog, ignore. - if ( me != CKEDITOR.dialog._.currentTop ) - return; - - var keystroke = evt.data.getKeystroke(), - rtl = editor.lang.dir == 'rtl'; - - processed = 0; - if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 ) - { - var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 ); - - // Handling Tab and Shift-Tab. - if ( me._.tabBarMode ) - { - // Change tabs. - var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ); - me.selectPage( nextId ); - me._.tabs[ nextId ][ 0 ].focus(); - } - else - { - // Change the focus of inputs. - changeFocus( !shiftPressed ); - } - - processed = 1; - } - else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 ) - { - // Alt-F10 puts focus into the current tab item in the tab bar. - me._.tabBarMode = true; - me._.tabs[ me._.currentTabId ][ 0 ].focus(); - processed = 1; - } - else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode ) - { - // Arrow keys - used for changing tabs. - nextId = ( keystroke == ( rtl ? 39 : 37 ) ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) ); - me.selectPage( nextId ); - me._.tabs[ nextId ][ 0 ].focus(); - processed = 1; - } - else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode ) - { - this.selectPage( this._.currentTabId ); - this._.tabBarMode = false; - this._.currentFocusIndex = -1; - changeFocus( true ); - processed = 1; - } - - if ( processed ) - { - evt.stop(); - evt.data.preventDefault(); - } - } - - function focusKeyPressHandler( evt ) - { - processed && evt.data.preventDefault(); - } - - var dialogElement = this._.element; - // Add the dialog keyboard handlers. - this.on( 'show', function() - { - dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 ); - // Some browsers instead, don't cancel key events in the keydown, but in the - // keypress. So we must do a longer trip in those cases. (#4531) - if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) - dialogElement.on( 'keypress', focusKeyPressHandler, this ); - - } ); - this.on( 'hide', function() - { - dialogElement.removeListener( 'keydown', focusKeydownHandler ); - if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) - dialogElement.removeListener( 'keypress', focusKeyPressHandler ); - } ); - this.on( 'iframeAdded', function( evt ) - { - var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document ); - doc.on( 'keydown', focusKeydownHandler, this, null, 0 ); - } ); - - // Auto-focus logic in dialog. - this.on( 'show', function() - { - // Setup tabIndex on showing the dialog instead of on loading - // to allow dynamic tab order happen in dialog definition. - setupFocus(); - - if ( editor.config.dialog_startupFocusTab - && me._.pageCount > 1 ) - { - me._.tabBarMode = true; - me._.tabs[ me._.currentTabId ][ 0 ].focus(); - } - else if ( !this._.hasFocus ) - { - this._.currentFocusIndex = -1; - - // Decide where to put the initial focus. - if ( definition.onFocus ) - { - var initialFocus = definition.onFocus.call( this ); - // Focus the field that the user specified. - initialFocus && initialFocus.focus(); - } - // Focus the first field in layout order. - else - changeFocus( true ); - - /* - * IE BUG: If the initial focus went into a non-text element (e.g. button), - * then IE would still leave the caret inside the editing area. - */ - if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var $selection = editor.document.$.selection, - $range = $selection.createRange(); - - if ( $range ) - { - if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$ - || $range.item && $range.item( 0 ).ownerDocument == editor.document.$ ) - { - var $myRange = document.body.createTextRange(); - $myRange.moveToElementText( this.getElement().getFirst().$ ); - $myRange.collapse( true ); - $myRange.select(); - } - } - } - } - }, this, null, 0xffffffff ); - - // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661). - // This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken. - if ( CKEDITOR.env.ie6Compat ) - { - this.on( 'load', function( evt ) - { - var outer = this.getElement(), - inner = outer.getFirst(); - inner.remove(); - inner.appendTo( outer ); - }, this ); - } - - initDragAndDrop( this ); - initResizeHandles( this ); - - // Insert the title. - ( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title ); - - // Insert the tabs and contents. - for ( var i = 0 ; i < definition.contents.length ; i++ ) - { - var page = definition.contents[i]; - page && this.addPage( page ); - } - - this.parts['tabs'].on( 'click', function( evt ) - { - var target = evt.data.getTarget(); - // If we aren't inside a tab, bail out. - if ( target.hasClass( 'cke_dialog_tab' ) ) - { - // Get the ID of the tab, without the 'cke_' prefix and the unique number suffix. - var id = target.$.id; - this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) ); - - if ( this._.tabBarMode ) - { - this._.tabBarMode = false; - this._.currentFocusIndex = -1; - changeFocus( true ); - } - evt.data.preventDefault(); - } - }, this ); - - // Insert buttons. - var buttonsHtml = [], - buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this, - { - type : 'hbox', - className : 'cke_dialog_footer_buttons', - widths : [], - children : definition.buttons - }, buttonsHtml ).getChild(); - this.parts.footer.setHtml( buttonsHtml.join( '' ) ); - - for ( i = 0 ; i < buttons.length ; i++ ) - this._.buttons[ buttons[i].id ] = buttons[i]; - }; - - // Focusable interface. Use it via dialog.addFocusable. - function Focusable( dialog, element, index ) - { - this.element = element; - this.focusIndex = index; - // TODO: support tabIndex for focusables. - this.tabIndex = 0; - this.isFocusable = function() - { - return !element.getAttribute( 'disabled' ) && element.isVisible(); - }; - this.focus = function() - { - dialog._.currentFocusIndex = this.focusIndex; - this.element.focus(); - }; - // Bind events - element.on( 'keydown', function( e ) - { - if ( e.data.getKeystroke() in { 32:1, 13:1 } ) - this.fire( 'click' ); - } ); - element.on( 'focus', function() - { - this.fire( 'mouseover' ); - } ); - element.on( 'blur', function() - { - this.fire( 'mouseout' ); - } ); - } - - CKEDITOR.dialog.prototype = - { - destroy : function() - { - this.hide(); - this._.element.remove(); - }, - - /** - * Resizes the dialog. - * @param {Number} width The width of the dialog in pixels. - * @param {Number} height The height of the dialog in pixels. - * @function - * @example - * dialogObj.resize( 800, 640 ); - */ - resize : (function() - { - return function( width, height ) - { - if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height ) - return; - - CKEDITOR.dialog.fire( 'resize', - { - dialog : this, - skin : this._.editor.skinName, - width : width, - height : height - }, this._.editor ); - - this._.contentSize = { width : width, height : height }; - this._.updateSize = true; - }; - })(), - - /** - * Gets the current size of the dialog in pixels. - * @returns {Object} An object with "width" and "height" properties. - * @example - * var width = dialogObj.getSize().width; - */ - getSize : function() - { - if ( !this._.updateSize ) - return this._.size; - var element = this._.element.getFirst(); - var size = this._.size = { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0}; - - // If either the offsetWidth or offsetHeight is 0, the element isn't visible. - this._.updateSize = !size.width || !size.height; - - return size; - }, - - /** - * Moves the dialog to an (x, y) coordinate relative to the window. - * @function - * @param {Number} x The target x-coordinate. - * @param {Number} y The target y-coordinate. - * @example - * dialogObj.move( 10, 40 ); - */ - move : (function() - { - var isFixed; - return function( x, y ) - { - // The dialog may be fixed positioned or absolute positioned. Ask the - // browser what is the current situation first. - var element = this._.element.getFirst(); - if ( isFixed === undefined ) - isFixed = element.getComputedStyle( 'position' ) == 'fixed'; - - if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y ) - return; - - // Save the current position. - this._.position = { x : x, y : y }; - - // If not fixed positioned, add scroll position to the coordinates. - if ( !isFixed ) - { - var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition(); - x += scrollPosition.x; - y += scrollPosition.y; - } - - element.setStyles( - { - 'left' : ( x > 0 ? x : 0 ) + 'px', - 'top' : ( y > 0 ? y : 0 ) + 'px' - }); - }; - })(), - - /** - * Gets the dialog's position in the window. - * @returns {Object} An object with "x" and "y" properties. - * @example - * var dialogX = dialogObj.getPosition().x; - */ - getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); }, - - /** - * Shows the dialog box. - * @example - * dialogObj.show(); - */ - show : function() - { - var editor = this._.editor; - if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.lock(); - } - - // Insert the dialog's element to the root document. - var element = this._.element; - var definition = this.definition; - if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) ) - element.appendTo( CKEDITOR.document.getBody() ); - else - element.setStyle( 'display', 'block' ); - - // FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8. - if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) - { - var dialogElement = this.parts.dialog; - dialogElement.setStyle( 'position', 'absolute' ); - setTimeout( function() - { - dialogElement.setStyle( 'position', 'fixed' ); - }, 0 ); - } - - - // First, set the dialog to an appropriate size. - this.resize( definition.minWidth, definition.minHeight ); - - // Select the first tab by default. - this.selectPage( this.definition.contents[0].id ); - - // Reset all inputs back to their default value. - this.reset(); - - // Set z-index. - if ( CKEDITOR.dialog._.currentZIndex === null ) - CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex; - this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 ); - - // Maintain the dialog ordering and dialog cover. - // Also register key handlers if first dialog. - if ( CKEDITOR.dialog._.currentTop === null ) - { - CKEDITOR.dialog._.currentTop = this; - this._.parentDialog = null; - showCover( this._.editor ); - - element.on( 'keydown', accessKeyDownHandler ); - element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); - - // Prevent some keys from bubbling up. (#4269) - for ( var event in { keyup :1, keydown :1, keypress :1 } ) - element.on( event, preventKeyBubbling ); - } - else - { - this._.parentDialog = CKEDITOR.dialog._.currentTop; - var parentElement = this._.parentDialog.getElement().getFirst(); - parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 ); - CKEDITOR.dialog._.currentTop = this; - } - - // Register the Esc hotkeys. - registerAccessKey( this, this, '\x1b', null, function() - { - this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click(); - } ); - - // Reset the hasFocus state. - this._.hasFocus = false; - - // Rearrange the dialog to the middle of the window. - CKEDITOR.tools.setTimeout( function() - { - var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(); - var dialogSize = this.getSize(); - - // We're using definition size for initial position because of - // offten corrupted data in offsetWidth at this point. (#4084) - this.move( ( viewSize.width - definition.minWidth ) / 2, ( viewSize.height - dialogSize.height ) / 2 ); - - this.parts.dialog.setStyle( 'visibility', '' ); - - // Execute onLoad for the first show. - this.fireOnce( 'load', {} ); - this.fire( 'show', {} ); - this._.editor.fire( 'dialogShow', this ); - - // Save the initial values of the dialog. - this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); - - }, - 100, this ); - }, - - /** - * Executes a function for each UI element. - * @param {Function} fn Function to execute for each UI element. - * @returns {CKEDITOR.dialog} The current dialog object. - */ - foreach : function( fn ) - { - for ( var i in this._.contents ) - { - for ( var j in this._.contents[i] ) - fn( this._.contents[i][j] ); - } - return this; - }, - - /** - * Resets all input values in the dialog. - * @example - * dialogObj.reset(); - * @returns {CKEDITOR.dialog} The current dialog object. - */ - reset : (function() - { - var fn = function( widget ){ if ( widget.reset ) widget.reset( 1 ); }; - return function(){ this.foreach( fn ); return this; }; - })(), - - setupContent : function() - { - var args = arguments; - this.foreach( function( widget ) - { - if ( widget.setup ) - widget.setup.apply( widget, args ); - }); - }, - - commitContent : function() - { - var args = arguments; - this.foreach( function( widget ) - { - if ( widget.commit ) - widget.commit.apply( widget, args ); - }); - }, - - /** - * Hides the dialog box. - * @example - * dialogObj.hide(); - */ - hide : function() - { - if ( !this.parts.dialog.isVisible() ) - return; - - this.fire( 'hide', {} ); - this._.editor.fire( 'dialogHide', this ); - var element = this._.element; - element.setStyle( 'display', 'none' ); - this.parts.dialog.setStyle( 'visibility', 'hidden' ); - // Unregister all access keys associated with this dialog. - unregisterAccessKey( this ); - - // Close any child(top) dialogs first. - while( CKEDITOR.dialog._.currentTop != this ) - CKEDITOR.dialog._.currentTop.hide(); - - // Maintain dialog ordering and remove cover if needed. - if ( !this._.parentDialog ) - hideCover(); - else - { - var parentElement = this._.parentDialog.getElement().getFirst(); - parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) ); - } - CKEDITOR.dialog._.currentTop = this._.parentDialog; - - // Deduct or clear the z-index. - if ( !this._.parentDialog ) - { - CKEDITOR.dialog._.currentZIndex = null; - - // Remove access key handlers. - element.removeListener( 'keydown', accessKeyDownHandler ); - element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler ); - - // Remove bubbling-prevention handler. (#4269) - for ( var event in { keyup :1, keydown :1, keypress :1 } ) - element.removeListener( event, preventKeyBubbling ); - - var editor = this._.editor; - editor.focus(); - - if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie ) - { - var selection = editor.getSelection(); - selection && selection.unlock( true ); - } - } - else - CKEDITOR.dialog._.currentZIndex -= 10; - - delete this._.parentDialog; - // Reset the initial values of the dialog. - this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } ); - }, - - /** - * Adds a tabbed page into the dialog. - * @param {Object} contents Content definition. - * @example - */ - addPage : function( contents ) - { - var pageHtml = [], - titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '', - elements = contents.elements, - vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this, - { - type : 'vbox', - className : 'cke_dialog_page_contents', - children : contents.elements, - expand : !!contents.expand, - padding : contents.padding, - style : contents.style || 'width: 100%; height: 100%;' - }, pageHtml ); - - // Create the HTML for the tab and the content block. - var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) ); - page.setAttribute( 'role', 'tabpanel' ); - - var env = CKEDITOR.env; - var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(), - tab = CKEDITOR.dom.element.createFromHtml( [ - ' 0 ? ' cke_last' : 'cke_first' ), - titleHtml, - ( !!contents.hidden ? ' style="display:none"' : '' ), - ' id="', tabId, '"', - env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"', - ' tabIndex="-1"', - ' hidefocus="true"', - ' role="tab">', - contents.label, - '' - ].join( '' ) ); - - page.setAttribute( 'aria-labelledby', tabId ); - - // Take records for the tabs and elements created. - this._.tabs[ contents.id ] = [ tab, page ]; - this._.tabIdList.push( contents.id ); - !contents.hidden && this._.pageCount++; - this._.lastTab = tab; - this.updateStyle(); - - var contentMap = this._.contents[ contents.id ] = {}, - cursor, - children = vbox.getChild(); - - while ( ( cursor = children.shift() ) ) - { - contentMap[ cursor.id ] = cursor; - if ( typeof( cursor.getChild ) == 'function' ) - children.push.apply( children, cursor.getChild() ); - } - - // Attach the DOM nodes. - - page.setAttribute( 'name', contents.id ); - page.appendTo( this.parts.contents ); - - tab.unselectable(); - this.parts.tabs.append( tab ); - - // Add access key handlers if access key is defined. - if ( contents.accessKey ) - { - registerAccessKey( this, this, 'CTRL+' + contents.accessKey, - tabAccessKeyDown, tabAccessKeyUp ); - this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id; - } - }, - - /** - * Activates a tab page in the dialog by its id. - * @param {String} id The id of the dialog tab to be activated. - * @example - * dialogObj.selectPage( 'tab_1' ); - */ - selectPage : function( id ) - { - if ( this._.currentTabId == id ) - return; - - // Returning true means that the event has been canceled - if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true ) - return; - - // Hide the non-selected tabs and pages. - for ( var i in this._.tabs ) - { - var tab = this._.tabs[i][0], - page = this._.tabs[i][1]; - if ( i != id ) - { - tab.removeClass( 'cke_dialog_tab_selected' ); - page.hide(); - } - page.setAttribute( 'aria-hidden', i != id ); - } - - var selected = this._.tabs[id]; - selected[0].addClass( 'cke_dialog_tab_selected' ); - selected[1].show(); - this._.currentTabId = id; - this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id ); - }, - - // Dialog state-specific style updates. - updateStyle : function() - { - // If only a single page shown, a different style is used in the central pane. - this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' ); - }, - - /** - * Hides a page's tab away from the dialog. - * @param {String} id The page's Id. - * @example - * dialog.hidePage( 'tab_3' ); - */ - hidePage : function( id ) - { - var tab = this._.tabs[id] && this._.tabs[id][0]; - if ( !tab || this._.pageCount == 1 ) - return; - // Switch to other tab first when we're hiding the active tab. - else if ( id == this._.currentTabId ) - this.selectPage( getPreviousVisibleTab.call( this ) ); - - tab.hide(); - this._.pageCount--; - this.updateStyle(); - }, - - /** - * Unhides a page's tab. - * @param {String} id The page's Id. - * @example - * dialog.showPage( 'tab_2' ); - */ - showPage : function( id ) - { - var tab = this._.tabs[id] && this._.tabs[id][0]; - if ( !tab ) - return; - tab.show(); - this._.pageCount++; - this.updateStyle(); - }, - - /** - * Gets the root DOM element of the dialog. - * @returns {CKEDITOR.dom.element} The <span> element containing this dialog. - * @example - * var dialogElement = dialogObj.getElement().getFirst(); - * dialogElement.setStyle( 'padding', '5px' ); - */ - getElement : function() - { - return this._.element; - }, - - /** - * Gets the name of the dialog. - * @returns {String} The name of this dialog. - * @example - * var dialogName = dialogObj.getName(); - */ - getName : function() - { - return this._.name; - }, - - /** - * Gets a dialog UI element object from a dialog page. - * @param {String} pageId id of dialog page. - * @param {String} elementId id of UI element. - * @example - * @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element. - */ - getContentElement : function( pageId, elementId ) - { - var page = this._.contents[ pageId ]; - return page && page[ elementId ]; - }, - - /** - * Gets the value of a dialog UI element. - * @param {String} pageId id of dialog page. - * @param {String} elementId id of UI element. - * @example - * @returns {Object} The value of the UI element. - */ - getValueOf : function( pageId, elementId ) - { - return this.getContentElement( pageId, elementId ).getValue(); - }, - - /** - * Sets the value of a dialog UI element. - * @param {String} pageId id of the dialog page. - * @param {String} elementId id of the UI element. - * @param {Object} value The new value of the UI element. - * @example - */ - setValueOf : function( pageId, elementId, value ) - { - return this.getContentElement( pageId, elementId ).setValue( value ); - }, - - /** - * Gets the UI element of a button in the dialog's button row. - * @param {String} id The id of the button. - * @example - * @returns {CKEDITOR.ui.dialog.button} The button object. - */ - getButton : function( id ) - { - return this._.buttons[ id ]; - }, - - /** - * Simulates a click to a dialog button in the dialog's button row. - * @param {String} id The id of the button. - * @example - * @returns The return value of the dialog's "click" event. - */ - click : function( id ) - { - return this._.buttons[ id ].click(); - }, - - /** - * Disables a dialog button. - * @param {String} id The id of the button. - * @example - */ - disableButton : function( id ) - { - return this._.buttons[ id ].disable(); - }, - - /** - * Enables a dialog button. - * @param {String} id The id of the button. - * @example - */ - enableButton : function( id ) - { - return this._.buttons[ id ].enable(); - }, - - /** - * Gets the number of pages in the dialog. - * @returns {Number} Page count. - */ - getPageCount : function() - { - return this._.pageCount; - }, - - /** - * Gets the editor instance which opened this dialog. - * @returns {CKEDITOR.editor} Parent editor instances. - */ - getParentEditor : function() - { - return this._.editor; - }, - - /** - * Gets the element that was selected when opening the dialog, if any. - * @returns {CKEDITOR.dom.element} The element that was selected, or null. - */ - getSelectedElement : function() - { - return this.getParentEditor().getSelection().getSelectedElement(); - }, - - /** - * Adds element to dialog's focusable list. - * - * @param {CKEDITOR.dom.element} element - * @param {Number} [index] - */ - addFocusable: function( element, index ) { - if ( typeof index == 'undefined' ) - { - index = this._.focusList.length; - this._.focusList.push( new Focusable( this, element, index ) ); - } - else - { - this._.focusList.splice( index, 0, new Focusable( this, element, index ) ); - for ( var i = index + 1 ; i < this._.focusList.length ; i++ ) - this._.focusList[ i ].focusIndex++; - } - } - }; - - CKEDITOR.tools.extend( CKEDITOR.dialog, - /** - * @lends CKEDITOR.dialog - */ - { - /** - * Registers a dialog. - * @param {String} name The dialog's name. - * @param {Function|String} dialogDefinition - * A function returning the dialog's definition, or the URL to the .js file holding the function. - * The function should accept an argument "editor" which is the current editor instance, and - * return an object conforming to {@link CKEDITOR.dialog.dialogDefinition}. - * @example - * @see CKEDITOR.dialog.dialogDefinition - */ - add : function( name, dialogDefinition ) - { - // Avoid path registration from multiple instances override definition. - if ( !this._.dialogDefinitions[name] - || typeof dialogDefinition == 'function' ) - this._.dialogDefinitions[name] = dialogDefinition; - }, - - exists : function( name ) - { - return !!this._.dialogDefinitions[ name ]; - }, - - getCurrent : function() - { - return CKEDITOR.dialog._.currentTop; - }, - - /** - * The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds. - * @static - * @field - * @example - * @type Function - */ - okButton : (function() - { - var retval = function( editor, override ) - { - override = override || {}; - return CKEDITOR.tools.extend( { - id : 'ok', - type : 'button', - label : editor.lang.common.ok, - 'class' : 'cke_dialog_ui_button_ok', - onClick : function( evt ) - { - var dialog = evt.data.dialog; - if ( dialog.fire( 'ok', { hide : true } ).hide !== false ) - dialog.hide(); - } - }, override, true ); - }; - retval.type = 'button'; - retval.override = function( override ) - { - return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, - { type : 'button' }, true ); - }; - return retval; - })(), - - /** - * The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed. - * @static - * @field - * @example - * @type Function - */ - cancelButton : (function() - { - var retval = function( editor, override ) - { - override = override || {}; - return CKEDITOR.tools.extend( { - id : 'cancel', - type : 'button', - label : editor.lang.common.cancel, - 'class' : 'cke_dialog_ui_button_cancel', - onClick : function( evt ) - { - var dialog = evt.data.dialog; - if ( dialog.fire( 'cancel', { hide : true } ).hide !== false ) - dialog.hide(); - } - }, override, true ); - }; - retval.type = 'button'; - retval.override = function( override ) - { - return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); }, - { type : 'button' }, true ); - }; - return retval; - })(), - - /** - * Registers a dialog UI element. - * @param {String} typeName The name of the UI element. - * @param {Function} builder The function to build the UI element. - * @example - */ - addUIElement : function( typeName, builder ) - { - this._.uiElementBuilders[ typeName ] = builder; - } - }); - - CKEDITOR.dialog._ = - { - uiElementBuilders : {}, - - dialogDefinitions : {}, - - currentTop : null, - - currentZIndex : null - }; - - // "Inherit" (copy actually) from CKEDITOR.event. - CKEDITOR.event.implementOn( CKEDITOR.dialog ); - CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true ); - - var defaultDialogDefinition = - { - resizable : CKEDITOR.DIALOG_RESIZE_BOTH, - minWidth : 600, - minHeight : 400, - buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ] - }; - - // The buttons in MacOS Apps are in reverse order #4750 - CKEDITOR.env.mac && defaultDialogDefinition.buttons.reverse(); - - // Tool function used to return an item from an array based on its id - // property. - var getById = function( array, id, recurse ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == id ) - return item; - if ( recurse && item[ recurse ] ) - { - var retval = getById( item[ recurse ], id, recurse ) ; - if ( retval ) - return retval; - } - } - return null; - }; - - // Tool function used to add an item into an array. - var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) - { - if ( nextSiblingId ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == nextSiblingId ) - { - array.splice( i, 0, newItem ); - return newItem; - } - - if ( recurse && item[ recurse ] ) - { - var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true ); - if ( retval ) - return retval; - } - } - - if ( nullIfNotFound ) - return null; - } - - array.push( newItem ); - return newItem; - }; - - // Tool function used to remove an item from an array based on its id. - var removeById = function( array, id, recurse ) - { - for ( var i = 0, item ; ( item = array[ i ] ) ; i++ ) - { - if ( item.id == id ) - return array.splice( i, 1 ); - if ( recurse && item[ recurse ] ) - { - var retval = removeById( item[ recurse ], id, recurse ); - if ( retval ) - return retval; - } - } - return null; - }; - - /** - * This class is not really part of the API. It is the "definition" property value - * passed to "dialogDefinition" event handlers. - * @constructor - * @name CKEDITOR.dialog.dialogDefinitionObject - * @extends CKEDITOR.dialog.dialogDefinition - * @example - * CKEDITOR.on( 'dialogDefinition', function( evt ) - * { - * var definition = evt.data.definition; - * var content = definition.getContents( 'page1' ); - * ... - * } ); - */ - var definitionObject = function( dialog, dialogDefinition ) - { - // TODO : Check if needed. - this.dialog = dialog; - - // Transform the contents entries in contentObjects. - var contents = dialogDefinition.contents; - for ( var i = 0, content ; ( content = contents[i] ) ; i++ ) - contents[ i ] = content && new contentObject( dialog, content ); - - CKEDITOR.tools.extend( this, dialogDefinition ); - }; - - definitionObject.prototype = - /** @lends CKEDITOR.dialog.dialogDefinitionObject.prototype */ - { - /** - * Gets a content definition. - * @param {String} id The id of the content definition. - * @returns {CKEDITOR.dialog.contentDefinition} The content definition - * matching id. - */ - getContents : function( id ) - { - return getById( this.contents, id ); - }, - - /** - * Gets a button definition. - * @param {String} id The id of the button definition. - * @returns {CKEDITOR.dialog.buttonDefinition} The button definition - * matching id. - */ - getButton : function( id ) - { - return getById( this.buttons, id ); - }, - - /** - * Adds a content definition object under this dialog definition. - * @param {CKEDITOR.dialog.contentDefinition} contentDefinition The - * content definition. - * @param {String} [nextSiblingId] The id of an existing content - * definition which the new content definition will be inserted - * before. Omit if the new content definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.contentDefinition} The inserted content - * definition. - */ - addContents : function( contentDefinition, nextSiblingId ) - { - return addById( this.contents, contentDefinition, nextSiblingId ); - }, - - /** - * Adds a button definition object under this dialog definition. - * @param {CKEDITOR.dialog.buttonDefinition} buttonDefinition The - * button definition. - * @param {String} [nextSiblingId] The id of an existing button - * definition which the new button definition will be inserted - * before. Omit if the new button definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.buttonDefinition} The inserted button - * definition. - */ - addButton : function( buttonDefinition, nextSiblingId ) - { - return addById( this.buttons, buttonDefinition, nextSiblingId ); - }, - - /** - * Removes a content definition from this dialog definition. - * @param {String} id The id of the content definition to be removed. - * @returns {CKEDITOR.dialog.contentDefinition} The removed content - * definition. - */ - removeContents : function( id ) - { - removeById( this.contents, id ); - }, - - /** - * Removes a button definition from the dialog definition. - * @param {String} id The id of the button definition to be removed. - * @returns {CKEDITOR.dialog.buttonDefinition} The removed button - * definition. - */ - removeButton : function( id ) - { - removeById( this.buttons, id ); - } - }; - - /** - * This class is not really part of the API. It is the template of the - * objects representing content pages inside the - * CKEDITOR.dialog.dialogDefinitionObject. - * @constructor - * @name CKEDITOR.dialog.contentDefinitionObject - * @example - * CKEDITOR.on( 'dialogDefinition', function( evt ) - * { - * var definition = evt.data.definition; - * var content = definition.getContents( 'page1' ); - * content.remove( 'textInput1' ); - * ... - * } ); - */ - function contentObject( dialog, contentDefinition ) - { - this._ = - { - dialog : dialog - }; - - CKEDITOR.tools.extend( this, contentDefinition ); - } - - contentObject.prototype = - /** @lends CKEDITOR.dialog.contentDefinitionObject.prototype */ - { - /** - * Gets a UI element definition under the content definition. - * @param {String} id The id of the UI element definition. - * @returns {CKEDITOR.dialog.uiElementDefinition} - */ - get : function( id ) - { - return getById( this.elements, id, 'children' ); - }, - - /** - * Adds a UI element definition to the content definition. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition The - * UI elemnet definition to be added. - * @param {String} nextSiblingId The id of an existing UI element - * definition which the new UI element definition will be inserted - * before. Omit if the new button definition is to be inserted as - * the last item. - * @returns {CKEDITOR.dialog.uiElementDefinition} The element - * definition inserted. - */ - add : function( elementDefinition, nextSiblingId ) - { - return addById( this.elements, elementDefinition, nextSiblingId, 'children' ); - }, - - /** - * Removes a UI element definition from the content definition. - * @param {String} id The id of the UI element definition to be - * removed. - * @returns {CKEDITOR.dialog.uiElementDefinition} The element - * definition removed. - * @example - */ - remove : function( id ) - { - removeById( this.elements, id, 'children' ); - } - }; - - function initDragAndDrop( dialog ) - { - var lastCoords = null, - abstractDialogCoords = null, - element = dialog.getElement().getFirst(), - editor = dialog.getParentEditor(), - magnetDistance = editor.config.dialog_magnetDistance, - margins = editor.skin.margins || [ 0, 0, 0, 0 ]; - - if ( typeof magnetDistance == 'undefined' ) - magnetDistance = 20; - - function mouseMoveHandler( evt ) - { - var dialogSize = dialog.getSize(), - viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(), - x = evt.data.$.screenX, - y = evt.data.$.screenY, - dx = x - lastCoords.x, - dy = y - lastCoords.y, - realX, realY; - - lastCoords = { x : x, y : y }; - abstractDialogCoords.x += dx; - abstractDialogCoords.y += dy; - - if ( abstractDialogCoords.x + margins[3] < magnetDistance ) - realX = - margins[3]; - else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance ) - realX = viewPaneSize.width - dialogSize.width + margins[1]; - else - realX = abstractDialogCoords.x; - - if ( abstractDialogCoords.y + margins[0] < magnetDistance ) - realY = - margins[0]; - else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance ) - realY = viewPaneSize.height - dialogSize.height + margins[2]; - else - realY = abstractDialogCoords.y; - - dialog.move( realX, realY ); - - evt.data.preventDefault(); - } - - function mouseUpHandler( evt ) - { - CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); - CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); - coverDoc.removeListener( 'mousemove', mouseMoveHandler ); - coverDoc.removeListener( 'mouseup', mouseUpHandler ); - } - } - - dialog.parts.title.on( 'mousedown', function( evt ) - { - dialog._.updateSize = true; - - lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY }; - - CKEDITOR.document.on( 'mousemove', mouseMoveHandler ); - CKEDITOR.document.on( 'mouseup', mouseUpHandler ); - abstractDialogCoords = dialog.getPosition(); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); - coverDoc.on( 'mousemove', mouseMoveHandler ); - coverDoc.on( 'mouseup', mouseUpHandler ); - } - - evt.data.preventDefault(); - }, dialog ); - } - - function initResizeHandles( dialog ) - { - var definition = dialog.definition, - minWidth = definition.minWidth || 0, - minHeight = definition.minHeight || 0, - resizable = definition.resizable, - margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ]; - - function topSizer( coords, dy ) - { - coords.y += dy; - } - - function rightSizer( coords, dx ) - { - coords.x2 += dx; - } - - function bottomSizer( coords, dy ) - { - coords.y2 += dy; - } - - function leftSizer( coords, dx ) - { - coords.x += dx; - } - - var lastCoords = null, - abstractDialogCoords = null, - magnetDistance = dialog._.editor.config.magnetDistance, - parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ]; - - function mouseDownHandler( evt ) - { - var partName = evt.listenerData.part, size = dialog.getSize(); - abstractDialogCoords = dialog.getPosition(); - CKEDITOR.tools.extend( abstractDialogCoords, - { - x2 : abstractDialogCoords.x + size.width, - y2 : abstractDialogCoords.y + size.height - } ); - lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY }; - - CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } ); - CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); - coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } ); - coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } ); - } - - evt.data.preventDefault(); - } - - function mouseMoveHandler( evt ) - { - var x = evt.data.$.screenX, - y = evt.data.$.screenY, - dx = x - lastCoords.x, - dy = y - lastCoords.y, - viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(), - partName = evt.listenerData.part; - - if ( partName.search( 't' ) != -1 ) - topSizer( abstractDialogCoords, dy ); - if ( partName.search( 'l' ) != -1 ) - leftSizer( abstractDialogCoords, dx ); - if ( partName.search( 'b' ) != -1 ) - bottomSizer( abstractDialogCoords, dy ); - if ( partName.search( 'r' ) != -1 ) - rightSizer( abstractDialogCoords, dx ); - - lastCoords = { x : x, y : y }; - - var realX, realY, realX2, realY2; - - if ( abstractDialogCoords.x + margins[3] < magnetDistance ) - realX = - margins[3]; - else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance ) - realX = abstractDialogCoords.x2 - minWidth; - else - realX = abstractDialogCoords.x; - - if ( abstractDialogCoords.y + margins[0] < magnetDistance ) - realY = - margins[0]; - else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance ) - realY = abstractDialogCoords.y2 - minHeight; - else - realY = abstractDialogCoords.y; - - if ( abstractDialogCoords.x2 - margins[1] > viewPaneSize.width - magnetDistance ) - realX2 = viewPaneSize.width + margins[1] ; - else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance ) - realX2 = abstractDialogCoords.x + minWidth; - else - realX2 = abstractDialogCoords.x2; - - if ( abstractDialogCoords.y2 - margins[2] > viewPaneSize.height - magnetDistance ) - realY2= viewPaneSize.height + margins[2] ; - else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance ) - realY2 = abstractDialogCoords.y + minHeight; - else - realY2 = abstractDialogCoords.y2 ; - - dialog.move( realX, realY ); - dialog.resize( realX2 - realX, realY2 - realY ); - - evt.data.preventDefault(); - } - - function mouseUpHandler( evt ) - { - CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler ); - CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler ); - - if ( CKEDITOR.env.ie6Compat ) - { - var coverDoc = currentCover.getChild( 0 ).getFrameDocument(); - coverDoc.removeListener( 'mouseup', mouseUpHandler ); - coverDoc.removeListener( 'mousemove', mouseMoveHandler ); - } - } - -// TODO : Simplify the resize logic, having just a single resize grip
            . -// var widthTest = /[lr]/, -// heightTest = /[tb]/; -// for ( var i = 0 ; i < parts.length ; i++ ) -// { -// var element = dialog.parts[ parts[i] + '_resize' ]; -// if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE || -// resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) || -// resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) ) -// { -// element.hide(); -// continue; -// } -// element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } ); -// } - } - - var resizeCover; - // Caching resuable covers and allowing only one cover - // on screen. - var covers = {}, - currentCover; - - function showCover( editor ) - { - var win = CKEDITOR.document.getWindow(); - var backgroundColorStyle = editor.config.dialog_backgroundCoverColor || 'white', - backgroundCoverOpacity = editor.config.dialog_backgroundCoverOpacity, - baseFloatZIndex = editor.config.baseFloatZIndex, - coverKey = CKEDITOR.tools.genKey( - backgroundColorStyle, - backgroundCoverOpacity, - baseFloatZIndex ), - coverElement = covers[ coverKey ]; - - if ( !coverElement ) - { - var html = [ - '
            ' - ]; - - if ( CKEDITOR.env.ie6Compat ) - { - // Support for custom document.domain in IE. - var isCustomDomain = CKEDITOR.env.isCustomDomain(), - iframeHtml = ''; - - html.push( - '' + - '' ); - } - - html.push( '
            ' ); - - coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) ); - coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 ); - - coverElement.appendTo( CKEDITOR.document.getBody() ); - covers[ coverKey ] = coverElement; - } - else - coverElement. show(); - - currentCover = coverElement; - var resizeFunc = function() - { - var size = win.getViewPaneSize(); - coverElement.setStyles( - { - width : size.width + 'px', - height : size.height + 'px' - } ); - }; - - var scrollFunc = function() - { - var pos = win.getScrollPosition(), - cursor = CKEDITOR.dialog._.currentTop; - coverElement.setStyles( - { - left : pos.x + 'px', - top : pos.y + 'px' - }); - - do - { - var dialogPos = cursor.getPosition(); - cursor.move( dialogPos.x, dialogPos.y ); - } while ( ( cursor = cursor._.parentDialog ) ); - }; - - resizeCover = resizeFunc; - win.on( 'resize', resizeFunc ); - resizeFunc(); - if ( CKEDITOR.env.ie6Compat ) - { - // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll. - // So we need to invent a really funny way to make it work. - var myScrollHandler = function() - { - scrollFunc(); - arguments.callee.prevScrollHandler.apply( this, arguments ); - }; - win.$.setTimeout( function() - { - myScrollHandler.prevScrollHandler = window.onscroll || function(){}; - window.onscroll = myScrollHandler; - }, 0 ); - scrollFunc(); - } - } - - function hideCover() - { - if ( !currentCover ) - return; - - var win = CKEDITOR.document.getWindow(); - currentCover.hide(); - win.removeListener( 'resize', resizeCover ); - - if ( CKEDITOR.env.ie6Compat ) - { - win.$.setTimeout( function() - { - var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler; - window.onscroll = prevScrollHandler || null; - }, 0 ); - } - resizeCover = null; - } - - function removeCovers() - { - for ( var coverId in covers ) - covers[ coverId ].remove(); - covers = {}; - } - - var accessKeyProcessors = {}; - - var accessKeyDownHandler = function( evt ) - { - var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, - alt = evt.data.$.altKey, - shift = evt.data.$.shiftKey, - key = String.fromCharCode( evt.data.$.keyCode ), - keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; - - if ( !keyProcessor || !keyProcessor.length ) - return; - - keyProcessor = keyProcessor[keyProcessor.length - 1]; - keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); - evt.data.preventDefault(); - }; - - var accessKeyUpHandler = function( evt ) - { - var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey, - alt = evt.data.$.altKey, - shift = evt.data.$.shiftKey, - key = String.fromCharCode( evt.data.$.keyCode ), - keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key]; - - if ( !keyProcessor || !keyProcessor.length ) - return; - - keyProcessor = keyProcessor[keyProcessor.length - 1]; - if ( keyProcessor.keyup ) - { - keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key ); - evt.data.preventDefault(); - } - }; - - var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc ) - { - var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] ); - procList.push( { - uiElement : uiElement, - dialog : dialog, - key : key, - keyup : upFunc || uiElement.accessKeyUp, - keydown : downFunc || uiElement.accessKeyDown - } ); - }; - - var unregisterAccessKey = function( obj ) - { - for ( var i in accessKeyProcessors ) - { - var list = accessKeyProcessors[i]; - for ( var j = list.length - 1 ; j >= 0 ; j-- ) - { - if ( list[j].dialog == obj || list[j].uiElement == obj ) - list.splice( j, 1 ); - } - if ( list.length === 0 ) - delete accessKeyProcessors[i]; - } - }; - - var tabAccessKeyUp = function( dialog, key ) - { - if ( dialog._.accessKeyMap[key] ) - dialog.selectPage( dialog._.accessKeyMap[key] ); - }; - - var tabAccessKeyDown = function( dialog, key ) - { - }; - - // ESC, ENTER - var preventKeyBubblingKeys = { 27 :1, 13 :1 }; - var preventKeyBubbling = function( e ) - { - if ( e.data.getKeystroke() in preventKeyBubblingKeys ) - e.data.stopPropagation(); - }; - - (function() - { - CKEDITOR.ui.dialog = - { - /** - * The base class of all dialog UI elements. - * @constructor - * @param {CKEDITOR.dialog} dialog Parent dialog object. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition Element - * definition. Accepted fields: - *
              - *
            • id (Required) The id of the UI element. See {@link - * CKEDITOR.dialog#getContentElement}
            • - *
            • type (Required) The type of the UI element. The - * value to this field specifies which UI element class will be used to - * generate the final widget.
            • - *
            • title (Optional) The popup tooltip for the UI - * element.
            • - *
            • hidden (Optional) A flag that tells if the element - * should be initially visible.
            • - *
            • className (Optional) Additional CSS class names - * to add to the UI element. Separated by space.
            • - *
            • style (Optional) Additional CSS inline styles - * to add to the UI element. A semicolon (;) is required after the last - * style declaration.
            • - *
            • accessKey (Optional) The alphanumeric access key - * for this element. Access keys are automatically prefixed by CTRL.
            • - *
            • on* (Optional) Any UI element definition field that - * starts with on followed immediately by a capital letter and - * probably more letters is an event handler. Event handlers may be further - * divided into registered event handlers and DOM event handlers. Please - * refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and - * {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more - * information.
            • - *
            - * @param {Array} htmlList - * List of HTML code to be added to the dialog's content area. - * @param {Function|String} nodeNameArg - * A function returning a string, or a simple string for the node name for - * the root DOM node. Default is 'div'. - * @param {Function|Object} stylesArg - * A function returning an object, or a simple object for CSS styles applied - * to the DOM node. Default is empty object. - * @param {Function|Object} attributesArg - * A fucntion returning an object, or a simple object for attributes applied - * to the DOM node. Default is empty object. - * @param {Function|String} contentsArg - * A function returning a string, or a simple string for the HTML code inside - * the root DOM node. Default is empty string. - * @example - */ - uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg ) - { - if ( arguments.length < 4 ) - return; - - var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div', - html = [ '<', nodeName, ' ' ], - styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {}, - attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {}, - innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '', - domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement', - id = this.id = elementDefinition.id, - i; - - // Set the id, a unique id is required for getElement() to work. - attributes.id = domId; - - // Set the type and definition CSS class names. - var classes = {}; - if ( elementDefinition.type ) - classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1; - if ( elementDefinition.className ) - classes[ elementDefinition.className ] = 1; - var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : []; - for ( i = 0 ; i < attributeClasses.length ; i++ ) - { - if ( attributeClasses[i] ) - classes[ attributeClasses[i] ] = 1; - } - var finalClasses = []; - for ( i in classes ) - finalClasses.push( i ); - attributes['class'] = finalClasses.join( ' ' ); - - // Set the popup tooltop. - if ( elementDefinition.title ) - attributes.title = elementDefinition.title; - - // Write the inline CSS styles. - var styleStr = ( elementDefinition.style || '' ).split( ';' ); - for ( i in styles ) - styleStr.push( i + ':' + styles[i] ); - if ( elementDefinition.hidden ) - styleStr.push( 'display:none' ); - for ( i = styleStr.length - 1 ; i >= 0 ; i-- ) - { - if ( styleStr[i] === '' ) - styleStr.splice( i, 1 ); - } - if ( styleStr.length > 0 ) - attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' ); - - // Write the attributes. - for ( i in attributes ) - html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" '); - - // Write the content HTML. - html.push( '>', innerHTML, '' ); - - // Add contents to the parent HTML array. - htmlList.push( html.join( '' ) ); - - ( this._ || ( this._ = {} ) ).dialog = dialog; - - // Override isChanged if it is defined in element definition. - if ( typeof( elementDefinition.isChanged ) == 'boolean' ) - this.isChanged = function(){ return elementDefinition.isChanged; }; - if ( typeof( elementDefinition.isChanged ) == 'function' ) - this.isChanged = elementDefinition.isChanged; - - // Add events. - CKEDITOR.event.implementOn( this ); - - this.registerEvents( elementDefinition ); - if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey ) - registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey ); - - var me = this; - dialog.on( 'load', function() - { - if ( me.getInputElement() ) - { - me.getInputElement().on( 'focus', function() - { - dialog._.tabBarMode = false; - dialog._.hasFocus = true; - me.fire( 'focus' ); - }, me ); - } - } ); - - // Register the object as a tab focus if it can be included. - if ( this.keyboardFocusable ) - { - this.tabIndex = elementDefinition.tabIndex || 0; - - this.focusIndex = dialog._.focusList.push( this ) - 1; - this.on( 'focus', function() - { - dialog._.currentFocusIndex = me.focusIndex; - } ); - } - - // Completes this object with everything we have in the - // definition. - CKEDITOR.tools.extend( this, elementDefinition ); - }, - - /** - * Horizontal layout box for dialog UI elements, auto-expends to available width of container. - * @constructor - * @extends CKEDITOR.ui.dialog.uiElement - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {Array} childObjList - * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this - * container. - * @param {Array} childHtmlList - * Array of HTML code that correspond to the HTML output of all the - * objects in childObjList. - * @param {Array} htmlList - * Array of HTML code that this element will output to. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
              - *
            • widths (Optional) The widths of child cells.
            • - *
            • height (Optional) The height of the layout.
            • - *
            • padding (Optional) The padding width inside child - * cells.
            • - *
            • align (Optional) The alignment of the whole layout - *
            • - *
            - * @example - */ - hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) - { - if ( arguments.length < 4 ) - return; - - this._ || ( this._ = {} ); - - var children = this._.children = childObjList, - widths = elementDefinition && elementDefinition.widths || null, - height = elementDefinition && elementDefinition.height || null, - styles = {}, - i; - /** @ignore */ - var innerHTML = function() - { - var html = [ '' ]; - for ( i = 0 ; i < childHtmlList.length ; i++ ) - { - var className = 'cke_dialog_ui_hbox_child', - styles = []; - if ( i === 0 ) - className = 'cke_dialog_ui_hbox_first'; - if ( i == childHtmlList.length - 1 ) - className = 'cke_dialog_ui_hbox_last'; - html.push( ' 0 ) - html.push( 'style="' + styles.join('; ') + '" ' ); - html.push( '>', childHtmlList[i], '' ); - } - html.push( '' ); - return html.join( '' ); - }; - - var attribs = { role : 'presentation' }; - elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align ); - - CKEDITOR.ui.dialog.uiElement.call( - this, - dialog, - elementDefinition || { type : 'hbox' }, - htmlList, - 'table', - styles, - attribs, - innerHTML ); - }, - - /** - * Vertical layout box for dialog UI elements. - * @constructor - * @extends CKEDITOR.ui.dialog.hbox - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {Array} childObjList - * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this - * container. - * @param {Array} childHtmlList - * Array of HTML code that correspond to the HTML output of all the - * objects in childObjList. - * @param {Array} htmlList - * Array of HTML code that this element will output to. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
              - *
            • width (Optional) The width of the layout.
            • - *
            • heights (Optional) The heights of individual cells. - *
            • - *
            • align (Optional) The alignment of the layout.
            • - *
            • padding (Optional) The padding width inside child - * cells.
            • - *
            • expand (Optional) Whether the layout should expand - * vertically to fill its container.
            • - *
            - * @example - */ - vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) - { - if (arguments.length < 3 ) - return; - - this._ || ( this._ = {} ); - - var children = this._.children = childObjList, - width = elementDefinition && elementDefinition.width || null, - heights = elementDefinition && elementDefinition.heights || null; - /** @ignore */ - var innerHTML = function() - { - var html = [ '' ); - for ( var i = 0 ; i < childHtmlList.length ; i++ ) - { - var styles = []; - html.push( '' ); - } - html.push( '
            0 ) - html.push( 'style="', styles.join( '; ' ), '" ' ); - html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '
            ' ); - return html.join( '' ); - }; - CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); - } - }; - })(); - - CKEDITOR.ui.dialog.uiElement.prototype = - { - /** - * Gets the root DOM element of this dialog UI object. - * @returns {CKEDITOR.dom.element} Root DOM element of UI object. - * @example - * uiElement.getElement().hide(); - */ - getElement : function() - { - return CKEDITOR.document.getById( this.domId ); - }, - - /** - * Gets the DOM element that the user inputs values. - * This function is used by setValue(), getValue() and focus(). It should - * be overrided in child classes where the input element isn't the root - * element. - * @returns {CKEDITOR.dom.element} The element where the user input values. - * @example - * var rawValue = textInput.getInputElement().$.value; - */ - getInputElement : function() - { - return this.getElement(); - }, - - /** - * Gets the parent dialog object containing this UI element. - * @returns {CKEDITOR.dialog} Parent dialog object. - * @example - * var dialog = uiElement.getDialog(); - */ - getDialog : function() - { - return this._.dialog; - }, - - /** - * Sets the value of this dialog UI object. - * @param {Object} value The new value. - * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * uiElement.setValue( 'Dingo' ); - */ - setValue : function( value, noChangeEvent ) - { - this.getInputElement().setValue( value ); - !noChangeEvent && this.fire( 'change', { value : value } ); - return this; - }, - - /** - * Gets the current value of this dialog UI object. - * @returns {Object} The current value. - * @example - * var myValue = uiElement.getValue(); - */ - getValue : function() - { - return this.getInputElement().getValue(); - }, - - /** - * Tells whether the UI object's value has changed. - * @returns {Boolean} true if changed, false if not changed. - * @example - * if ( uiElement.isChanged() ) - *   confirm( 'Value changed! Continue?' ); - */ - isChanged : function() - { - // Override in input classes. - return false; - }, - - /** - * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * focus : function() - * { - * this.selectParentTab(); - * // do something else. - * } - */ - selectParentTab : function() - { - var element = this.getInputElement(), - cursor = element, - tabId; - while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 ) - { /*jsl:pass*/ } - - // Some widgets don't have parent tabs (e.g. OK and Cancel buttons). - if ( !cursor ) - return this; - - tabId = cursor.getAttribute( 'name' ); - // Avoid duplicate select. - if ( this._.dialog._.currentTabId != tabId ) - this._.dialog.selectPage( tabId ); - return this; - }, - - /** - * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - * uiElement.focus(); - */ - focus : function() - { - this.selectParentTab().getInputElement().focus(); - return this; - }, - - /** - * Registers the on* event handlers defined in the element definition. - * The default behavior of this function is: - *
              - *
            1. - * If the on* event is defined in the class's eventProcesors list, - * then the registration is delegated to the corresponding function - * in the eventProcessors list. - *
            2. - *
            3. - * If the on* event is not defined in the eventProcessors list, then - * register the event handler under the corresponding DOM event of - * the UI element's input DOM element (as defined by the return value - * of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}). - *
            4. - *
            - * This function is only called at UI element instantiation, but can - * be overridded in child classes if they require more flexibility. - * @param {CKEDITOR.dialog.uiElementDefinition} definition The UI element - * definition. - * @returns {CKEDITOR.dialog.uiElement} The current UI element. - * @example - */ - registerEvents : function( definition ) - { - var regex = /^on([A-Z]\w+)/, - match; - - var registerDomEvent = function( uiElement, dialog, eventName, func ) - { - dialog.on( 'load', function() - { - uiElement.getInputElement().on( eventName, func, uiElement ); - }); - }; - - for ( var i in definition ) - { - if ( !( match = i.match( regex ) ) ) - continue; - if ( this.eventProcessors[i] ) - this.eventProcessors[i].call( this, this._.dialog, definition[i] ); - else - registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] ); - } - - return this; - }, - - /** - * The event processor list used by - * {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element - * instantiation. The default list defines three on* events: - *
              - *
            1. onLoad - Called when the element's parent dialog opens for the - * first time
            2. - *
            3. onShow - Called whenever the element's parent dialog opens.
            4. - *
            5. onHide - Called whenever the element's parent dialog closes.
            6. - *
            - * @field - * @type Object - * @example - * // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick - * // handlers in the UI element's definitions. - * CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {}, - *   CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, - *   { onClick : function( dialog, func ) { this.on( 'click', func ); } }, - *   true ); - */ - eventProcessors : - { - onLoad : function( dialog, func ) - { - dialog.on( 'load', func, this ); - }, - - onShow : function( dialog, func ) - { - dialog.on( 'show', func, this ); - }, - - onHide : function( dialog, func ) - { - dialog.on( 'hide', func, this ); - } - }, - - /** - * The default handler for a UI element's access key down event, which - * tries to put focus to the UI element.
            - * Can be overridded in child classes for more sophisticaed behavior. - * @param {CKEDITOR.dialog} dialog The parent dialog object. - * @param {String} key The key combination pressed. Since access keys - * are defined to always include the CTRL key, its value should always - * include a 'CTRL+' prefix. - * @example - */ - accessKeyDown : function( dialog, key ) - { - this.focus(); - }, - - /** - * The default handler for a UI element's access key up event, which - * does nothing.
            - * Can be overridded in child classes for more sophisticated behavior. - * @param {CKEDITOR.dialog} dialog The parent dialog object. - * @param {String} key The key combination pressed. Since access keys - * are defined to always include the CTRL key, its value should always - * include a 'CTRL+' prefix. - * @example - */ - accessKeyUp : function( dialog, key ) - { - }, - - /** - * Disables a UI element. - * @example - */ - disable : function() - { - var element = this.getInputElement(); - element.setAttribute( 'disabled', 'true' ); - element.addClass( 'cke_disabled' ); - }, - - /** - * Enables a UI element. - * @example - */ - enable : function() - { - var element = this.getInputElement(); - element.removeAttribute( 'disabled' ); - element.removeClass( 'cke_disabled' ); - }, - - /** - * Determines whether an UI element is enabled or not. - * @returns {Boolean} Whether the UI element is enabled. - * @example - */ - isEnabled : function() - { - return !this.getInputElement().getAttribute( 'disabled' ); - }, - - /** - * Determines whether an UI element is visible or not. - * @returns {Boolean} Whether the UI element is visible. - * @example - */ - isVisible : function() - { - return this.getInputElement().isVisible(); - }, - - /** - * Determines whether an UI element is focus-able or not. - * Focus-able is defined as being both visible and enabled. - * @returns {Boolean} Whether the UI element can be focused. - * @example - */ - isFocusable : function() - { - if ( !this.isEnabled() || !this.isVisible() ) - return false; - return true; - } - }; - - CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, - /** - * @lends CKEDITOR.ui.dialog.hbox.prototype - */ - { - /** - * Gets a child UI element inside this container. - * @param {Array|Number} indices An array or a single number to indicate the child's - * position in the container's descendant tree. Omit to get all the children in an array. - * @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container - * if no argument given, or the specified UI element if indices is given. - * @example - * var checkbox = hbox.getChild( [0,1] ); - * checkbox.setValue( true ); - */ - getChild : function( indices ) - { - // If no arguments, return a clone of the children array. - if ( arguments.length < 1 ) - return this._.children.concat(); - - // If indices isn't array, make it one. - if ( !indices.splice ) - indices = [ indices ]; - - // Retrieve the child element according to tree position. - if ( indices.length < 2 ) - return this._.children[ indices[0] ]; - else - return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ? - this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) : - null; - } - }, true ); - - CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox(); - - - - (function() - { - var commonBuilder = { - build : function( dialog, elementDefinition, output ) - { - var children = elementDefinition.children, - child, - childHtmlList = [], - childObjList = []; - for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) - { - var childHtml = []; - childHtmlList.push( childHtml ); - childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); - } - return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition ); - } - }; - - CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder ); - CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder ); - })(); - - /** - * Generic dialog command. It opens a specific dialog when executed. - * @constructor - * @augments CKEDITOR.commandDefinition - * @param {string} dialogName The name of the dialog to open when executing - * this command. - * @example - * // Register the "link" command, which opens the "link" dialog. - * editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) ); - */ - CKEDITOR.dialogCommand = function( dialogName ) - { - this.dialogName = dialogName; - }; - - CKEDITOR.dialogCommand.prototype = - { - /** @ignore */ - exec : function( editor ) - { - editor.openDialog( this.dialogName ); - }, - - // Dialog commands just open a dialog ui, thus require no undo logic, - // undo support should dedicate to specific dialog implementation. - canUndo: false, - - editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit - }; - - (function() - { - var notEmptyRegex = /^([a]|[^a])+$/, - integerRegex = /^\d*$/, - numberRegex = /^\d*(?:\.\d+)?$/; - - CKEDITOR.VALIDATE_OR = 1; - CKEDITOR.VALIDATE_AND = 2; - - CKEDITOR.dialog.validate = - { - functions : function() - { - return function() - { - /** - * It's important for validate functions to be able to accept the value - * as argument in addition to this.getValue(), so that it is possible to - * combine validate functions together to make more sophisticated - * validators. - */ - var value = this && this.getValue ? this.getValue() : arguments[0]; - - var msg = undefined, - relation = CKEDITOR.VALIDATE_AND, - functions = [], i; - - for ( i = 0 ; i < arguments.length ; i++ ) - { - if ( typeof( arguments[i] ) == 'function' ) - functions.push( arguments[i] ); - else - break; - } - - if ( i < arguments.length && typeof( arguments[i] ) == 'string' ) - { - msg = arguments[i]; - i++; - } - - if ( i < arguments.length && typeof( arguments[i]) == 'number' ) - relation = arguments[i]; - - var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false ); - for ( i = 0 ; i < functions.length ; i++ ) - { - if ( relation == CKEDITOR.VALIDATE_AND ) - passed = passed && functions[i]( value ); - else - passed = passed || functions[i]( value ); - } - - if ( !passed ) - { - if ( msg !== undefined ) - alert( msg ); - if ( this && ( this.select || this.focus ) ) - ( this.select || this.focus )(); - return false; - } - - return true; - }; - }, - - regex : function( regex, msg ) - { - /* - * Can be greatly shortened by deriving from functions validator if code size - * turns out to be more important than performance. - */ - return function() - { - var value = this && this.getValue ? this.getValue() : arguments[0]; - if ( !regex.test( value ) ) - { - if ( msg !== undefined ) - alert( msg ); - if ( this && ( this.select || this.focus ) ) - { - if ( this.select ) - this.select(); - else - this.focus(); - } - return false; - } - return true; - }; - }, - - notEmpty : function( msg ) - { - return this.regex( notEmptyRegex, msg ); - }, - - integer : function( msg ) - { - return this.regex( integerRegex, msg ); - }, - - 'number' : function( msg ) - { - return this.regex( numberRegex, msg ); - }, - - equals : function( value, msg ) - { - return this.functions( function( val ){ return val == value; }, msg ); - }, - - notEqual : function( value, msg ) - { - return this.functions( function( val ){ return val != value; }, msg ); - } - }; - - CKEDITOR.on( 'instanceDestroyed', function( evt ) - { - // Remove dialog cover on last instance destroy. - if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) ) - { - var currentTopDialog; - while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) ) - currentTopDialog.hide(); - removeCovers(); - } - - var dialogs = evt.editor._.storedDialogs; - for ( var name in dialogs ) - dialogs[ name ].destroy(); - - }); - - })(); -})(); - -// Extend the CKEDITOR.editor class with dialog specific functions. -CKEDITOR.tools.extend( CKEDITOR.editor.prototype, - /** @lends CKEDITOR.editor.prototype */ - { - /** - * Loads and opens a registered dialog. - * @param {String} dialogName The registered name of the dialog. - * @param {Function} callback The function to be invoked after dialog instance created. - * @see CKEDITOR.dialog.add - * @example - * CKEDITOR.instances.editor1.openDialog( 'smiley' ); - * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered. - */ - openDialog : function( dialogName, callback ) - { - var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], - dialogSkin = this.skin.dialog; - - // If the dialogDefinition is already loaded, open it immediately. - if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded ) - { - var storedDialogs = this._.storedDialogs || - ( this._.storedDialogs = {} ); - - var dialog = storedDialogs[ dialogName ] || - ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) ); - - callback && callback.call( dialog, dialog ); - dialog.show(); - - return dialog; - } - else if ( dialogDefinitions == 'failed' ) - throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' ); - - // Not loaded? Load the .js file first. - var body = CKEDITOR.document.getBody(), - cursor = body.$.style.cursor, - me = this; - - body.setStyle( 'cursor', 'wait' ); - - function onDialogFileLoaded( success ) - { - var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ], - skin = me.skin.dialog; - - // Check if both skin part and definition is loaded. - if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' ) - return; - - // In case of plugin error, mark it as loading failed. - if ( typeof dialogDefinition != 'function' ) - CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed'; - - me.openDialog( dialogName, callback ); - body.setStyle( 'cursor', cursor ); - } - - if ( typeof dialogDefinitions == 'string' ) - { - var loadDefinition = 1; - CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded ); - } - - CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded ); - - return null; - } - }); - -CKEDITOR.plugins.add( 'dialog', - { - requires : [ 'dialogui' ] - }); - -// Dialog related configurations. - -/** - * The color of the dialog background cover. It should be a valid CSS color - * string. - * @name CKEDITOR.config.dialog_backgroundCoverColor - * @type String - * @default 'white' - * @example - * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - */ - -/** - * The opacity of the dialog background cover. It should be a number within the - * range [0.0, 1.0]. - * @name CKEDITOR.config.dialog_backgroundCoverOpacity - * @type Number - * @default 0.5 - * @example - * config.dialog_backgroundCoverOpacity = 0.7; - */ - -/** - * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened. - * @name CKEDITOR.config.dialog_startupFocusTab - * @type Boolean - * @default false - * @example - * config.dialog_startupFocusTab = true; - */ - -/** - * The distance of magnetic borders used in moving and resizing dialogs, - * measured in pixels. - * @name CKEDITOR.config.dialog_magnetDistance - * @type Number - * @default 20 - * @example - * config.dialog_magnetDistance = 30; - */ - -/** - * Fired when a dialog definition is about to be used to create a dialog into - * an editor instance. This event makes it possible to customize the definition - * before creating it. - *

            Note that this event is called only the first time a specific dialog is - * opened. Successive openings will use the cached dialog, and this event will - * not get fired.

            - * @name CKEDITOR#dialogDefinition - * @event - * @param {CKEDITOR.dialog.dialogDefinition} data The dialog defination that - * is being loaded. - * @param {CKEDITOR.editor} editor The editor instance that will use the - * dialog. - */ - -/** - * Fired when a tab is going to be selected in a dialog - * @name dialog#selectPage - * @event - * @param String page The id of the page that it's gonna be selected. - * @param String currentPage The id of the current page. - */ diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/dialogadvtab/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/dialogadvtab/plugin.js deleted file mode 100644 index deed8fc..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/dialogadvtab/plugin.js +++ /dev/null @@ -1,207 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function() -{ - -function setupAdvParams( element ) -{ - var attrName = this.att; - - var value = element && element.hasAttribute( attrName ) && element.getAttribute( attrName ) || ''; - - if ( value !== undefined ) - this.setValue( value ); -} - -function commitAdvParams() -{ - // Dialogs may use different parameters in the commit list, so, by - // definition, we take the first CKEDITOR.dom.element available. - var element; - - for ( var i = 0 ; i < arguments.length ; i++ ) - { - if ( arguments[ i ] instanceof CKEDITOR.dom.element ) - { - element = arguments[ i ]; - break; - } - } - - if ( element ) - { - var attrName = this.att, - value = this.getValue(); - - if ( value ) - element.setAttribute( attrName, value ); - else - element.removeAttribute( attrName, value ); - } -} - -CKEDITOR.plugins.add( 'dialogadvtab', -{ - /** - * - * @param tabConfig - * id, dir, classes, styles - */ - createAdvancedTab : function( editor, tabConfig ) - { - if ( !tabConfig ) - tabConfig = { id:1, dir:1, classes:1, styles:1 }; - - var lang = editor.lang.common; - - var result = - { - id : 'advanced', - label : lang.advancedTab, - title : lang.advancedTab, - elements : - [ - { - type : 'vbox', - padding : 1, - children : [] - } - ] - }; - - var contents = []; - - if ( tabConfig.id || tabConfig.dir ) - { - if ( tabConfig.id ) - { - contents.push( - { - id : 'advId', - att : 'id', - type : 'text', - label : lang.id, - setup : setupAdvParams, - commit : commitAdvParams - }); - } - - if ( tabConfig.dir ) - { - contents.push( - { - id : 'advLangDir', - att : 'dir', - type : 'select', - label : lang.langDir, - 'default' : '', - style : 'width:110px', - items : - [ - [ lang.notSet, '' ], - [ lang.langDirLTR, 'ltr' ], - [ lang.langDirRTL, 'rtl' ] - ], - setup : setupAdvParams, - commit : commitAdvParams - }); - } - - result.elements[ 0 ].children.push( - { - type : 'hbox', - widths : [ '50%', '50%' ], - children : [].concat( contents ) - }); - } - - if ( tabConfig.styles || tabConfig.classes ) - { - contents = []; - - if ( tabConfig.id ) - { - contents.push( - { - id : 'advStyles', - att : 'style', - type : 'text', - label : lang.styles, - 'default' : '', - - onChange : function(){}, - - getStyle : function( name, defaultValue ) - { - var match = this.getValue().match( new RegExp( name + '\\s*:\s*([^;]*)', 'i') ); - return match ? match[ 1 ] : defaultValue; - }, - - updateStyle : function( name, value ) - { - var styles = this.getValue(); - - // Remove the current value. - if ( styles ) - { - styles = styles - .replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' ) - .replace( /^[;\s]+/, '' ) - .replace( /\s+$/, '' ); - } - - if ( value ) - { - styles && !(/;\s*$/).test( styles ) && ( styles += '; ' ); - styles += name + ': ' + value; - } - - this.setValue( styles, true ); - - }, - - setup : setupAdvParams, - - commit : commitAdvParams - - }); - } - - if ( tabConfig.classes ) - { - contents.push( - { - type : 'hbox', - widths : [ '45%', '55%' ], - children : - [ - { - id : 'advCSSClasses', - att : 'class', - type : 'text', - label : lang.cssClasses, - 'default' : '', - setup : setupAdvParams, - commit : commitAdvParams - - } - ] - }); - } - - result.elements[ 0 ].children.push( - { - type : 'hbox', - widths : [ '50%', '50%' ], - children : [].concat( contents ) - }); - } - - return result; - } -}); - -})(); diff --git a/Public/Resources/Javascript/ckeditor/_source/plugins/dialogui/plugin.js b/Public/Resources/Javascript/ckeditor/_source/plugins/dialogui/plugin.js deleted file mode 100644 index 7875b5b..0000000 --- a/Public/Resources/Javascript/ckeditor/_source/plugins/dialogui/plugin.js +++ /dev/null @@ -1,1522 +0,0 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -/** @fileoverview The "dialogui" plugin. */ - -CKEDITOR.plugins.add( 'dialogui' ); - -(function() -{ - var initPrivateObject = function( elementDefinition ) - { - this._ || ( this._ = {} ); - this._['default'] = this._.initValue = elementDefinition['default'] || ''; - this._.required = elementDefinition[ 'required' ] || false; - var args = [ this._ ]; - for ( var i = 1 ; i < arguments.length ; i++ ) - args.push( arguments[i] ); - args.push( true ); - CKEDITOR.tools.extend.apply( CKEDITOR.tools, args ); - return this._; - }, - textBuilder = - { - build : function( dialog, elementDefinition, output ) - { - return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output ); - } - }, - commonBuilder = - { - build : function( dialog, elementDefinition, output ) - { - return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output ); - } - }, - containerBuilder = - { - build : function( dialog, elementDefinition, output ) - { - var children = elementDefinition.children, - child, - childHtmlList = [], - childObjList = []; - for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) - { - var childHtml = []; - childHtmlList.push( childHtml ); - childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); - } - return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition ); - } - }, - commonPrototype = - { - isChanged : function() - { - return this.getValue() != this.getInitValue(); - }, - - reset : function( noChangeEvent ) - { - this.setValue( this.getInitValue(), noChangeEvent ); - }, - - setInitValue : function() - { - this._.initValue = this.getValue(); - }, - - resetInitValue : function() - { - this._.initValue = this._['default']; - }, - - getInitValue : function() - { - return this._.initValue; - } - }, - commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, - { - onChange : function( dialog, func ) - { - if ( !this._.domOnChangeRegistered ) - { - dialog.on( 'load', function() - { - this.getInputElement().on( 'change', function() - { - // Make sure 'onchange' doesn't get fired after dialog closed. (#5719) - if ( !dialog.parts.dialog.isVisible() ) - return; - - this.fire( 'change', { value : this.getValue() } ); - }, this ); - }, this ); - this._.domOnChangeRegistered = true; - } - - this.on( 'change', func ); - } - }, true ), - eventRegex = /^on([A-Z]\w+)/, - cleanInnerDefinition = function( def ) - { - // An inner UI element should not have the parent's type, title or events. - for ( var i in def ) - { - if ( eventRegex.test( i ) || i == 'title' || i == 'type' ) - delete def[i]; - } - return def; - }; - - CKEDITOR.tools.extend( CKEDITOR.ui.dialog, - /** @lends CKEDITOR.ui.dialog */ - { - /** - * Base class for all dialog elements with a textual label on the left. - * @constructor - * @example - * @extends CKEDITOR.ui.dialog.uiElement - * @param {CKEDITOR.dialog} dialog - * Parent dialog object. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition - * The element definition. Accepted fields: - *
              - *
            • label (Required) The label string.
            • - *
            • labelLayout (Optional) Put 'horizontal' here if the - * label element is to be layed out horizontally. Otherwise a vertical - * layout will be used.
            • - *
            • widths (Optional) This applies only for horizontal - * layouts - an 2-element array of lengths to specify the widths of the - * label and the content element.
            • - *
            - * @param {Array} htmlList - * List of HTML code to output to. - * @param {Function} contentHtml - * A function returning the HTML code string to be added inside the content - * cell. - */ - labeledElement : function( dialog, elementDefinition, htmlList, contentHtml ) - { - if ( arguments.length < 4 ) - return; - - var _ = initPrivateObject.call( this, elementDefinition ); - _.labelId = CKEDITOR.tools.getNextId() + '_label'; - var children = this._.children = []; - /** @ignore */ - var innerHTML = function() - { - var html = [], - requiredClass = elementDefinition.required ? ' cke_required' : '' ; - if ( elementDefinition.labelLayout != 'horizontal' ) - html.push( '', - '' ); - else - { - var hboxDefinition = { - type : 'hbox', - widths : elementDefinition.widths, - padding : 0, - children : - [ - { - type : 'html', - html : '