From 1c5685d68f1b73270fb814fe04cbb490eb90ba5f Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 14 Nov 2008 15:39:19 +0000 Subject: Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dijit/_editor/selection.js | 246 --------------------------------- 1 file changed, 246 deletions(-) delete mode 100644 includes/js/dijit/_editor/selection.js (limited to 'includes/js/dijit/_editor/selection.js') diff --git a/includes/js/dijit/_editor/selection.js b/includes/js/dijit/_editor/selection.js deleted file mode 100644 index 9b403aa..0000000 --- a/includes/js/dijit/_editor/selection.js +++ /dev/null @@ -1,246 +0,0 @@ -if(!dojo._hasResource["dijit._editor.selection"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. -dojo._hasResource["dijit._editor.selection"] = true; -dojo.provide("dijit._editor.selection"); - -// FIXME: -// all of these methods branch internally for IE. This is probably -// sub-optimal in terms of runtime performance. We should investigate the -// size difference for differentiating at definition time. - -dojo.mixin(dijit._editor.selection, { - getType: function(){ - // summary: Get the selection type (like dojo.doc.select.type in IE). - if(dojo.doc.selection){ //IE - return dojo.doc.selection.type.toLowerCase(); - }else{ - var stype = "text"; - - // Check if the actual selection is a CONTROL (IMG, TABLE, HR, etc...). - var oSel; - try{ - oSel = dojo.global.getSelection(); - }catch(e){ /*squelch*/ } - - if(oSel && oSel.rangeCount==1){ - var oRange = oSel.getRangeAt(0); - if( (oRange.startContainer == oRange.endContainer) && - ((oRange.endOffset - oRange.startOffset) == 1) && - (oRange.startContainer.nodeType != 3 /* text node*/) - ){ - stype = "control"; - } - } - return stype; - } - }, - - getSelectedText: function(){ - // summary: - // Return the text (no html tags) included in the current selection or null if no text is selected - if(dojo.doc.selection){ //IE - if(dijit._editor.selection.getType() == 'control'){ - return null; - } - return dojo.doc.selection.createRange().text; - }else{ - var selection = dojo.global.getSelection(); - if(selection){ - return selection.toString(); - } - } - return '' - }, - - getSelectedHtml: function(){ - // summary: - // Return the html of the current selection or null if unavailable - if(dojo.doc.selection){ //IE - if(dijit._editor.selection.getType() == 'control'){ - return null; - } - return dojo.doc.selection.createRange().htmlText; - }else{ - var selection = dojo.global.getSelection(); - if(selection && selection.rangeCount){ - var frag = selection.getRangeAt(0).cloneContents(); - var div = dojo.doc.createElement("div"); - div.appendChild(frag); - return div.innerHTML; - } - return null; - } - }, - - getSelectedElement: function(){ - // summary: - // Retrieves the selected element (if any), just in the case that - // a single element (object like and image or a table) is - // selected. - if(this.getType() == "control"){ - if(dojo.doc.selection){ //IE - var range = dojo.doc.selection.createRange(); - if(range && range.item){ - return dojo.doc.selection.createRange().item(0); - } - }else{ - var selection = dojo.global.getSelection(); - return selection.anchorNode.childNodes[ selection.anchorOffset ]; - } - } - return null; - }, - - getParentElement: function(){ - // summary: - // Get the parent element of the current selection - if(this.getType() == "control"){ - var p = this.getSelectedElement(); - if(p){ return p.parentNode; } - }else{ - if(dojo.doc.selection){ //IE - return dojo.doc.selection.createRange().parentElement(); - }else{ - var selection = dojo.global.getSelection(); - if(selection){ - var node = selection.anchorNode; - - while(node && (node.nodeType != 1)){ // not an element - node = node.parentNode; - } - - return node; - } - } - } - return null; - }, - - hasAncestorElement: function(/*String*/tagName /* ... */){ - // summary: - // Check whether current selection has a parent element which is - // of type tagName (or one of the other specified tagName) - return this.getAncestorElement.apply(this, arguments) != null; - }, - - getAncestorElement: function(/*String*/tagName /* ... */){ - // summary: - // Return the parent element of the current selection which is of - // type tagName (or one of the other specified tagName) - - var node = this.getSelectedElement() || this.getParentElement(); - return this.getParentOfType(node, arguments); - }, - - isTag: function(/*DomNode*/node, /*Array*/tags){ - if(node && node.tagName){ - var _nlc = node.tagName.toLowerCase(); - for(var i=0; i