瀏覽代碼

Clipboard data validation; Crosshair cursor

Michael 10 年之前
父節點
當前提交
b0ed041615

+ 1 - 1
src/allplatforms/classes/Clipboard.js

@@ -45,7 +45,7 @@ SC.loadPackage({ 'Clipboard': {
                 var self = this;
                 window.setTimeout(function(){
                     callback.call(self, self.get('pasteField').value)
-                }, 500)
+                }, 300)
 
             }
         }

+ 9 - 10
src/allplatforms/classes/Grid.js

@@ -13,16 +13,10 @@ SC.loadPackage({ 'Grid': {
         active:     { comment: 'Wether the grid is active.',
                       transform: function(aBoolean){
 
-                            var gridContainer = this.get('gridContainer');
-
                             if(aBoolean){
-                                if(gridContainer.parentNode !== document.body){
-                                    document.body.insertBefore(gridContainer, this.get('myDocument').get('pageContainer'));
-                                }
+                                this.get('gridContainer').style.opacity = 1;
                             }else{
-                                if(gridContainer.parentNode === document.body){
-                                    document.body.removeChild(gridContainer);
-                                }
+                                this.get('gridContainer').style.opacity = 0;
                             }
                             
                             return aBoolean;
@@ -64,10 +58,14 @@ SC.loadPackage({ 'Grid': {
         visible:    { comment: 'Wether I am visible or not.',
                       transform: function(aBoolean){
                             if(aBoolean){
-                                this.get('gridContainer').style.display = 'block';
+                                if(this.get('active')){
+                                    this.get('gridContainer').style.opacity = 1;
+                                }else{
+                                    this.get('gridContainer').style.opacity = 0;
+                                }
                                 this.get('gridControl').classList.remove('sg-editing-grid-control-hidden');
                             }else{
-                                this.get('gridContainer').style.display = 'none';
+                                this.get('gridContainer').style.opacity = 0;
                                 this.get('gridControl').classList.add('sg-editing-grid-control-hidden');
                             }
                             return aBoolean;
@@ -107,6 +105,7 @@ SC.loadPackage({ 'Grid': {
                                                     }).call(this)
                                     });
 
+                document.body.insertBefore(gridContainer, this.get('myDocument').get('pageContainer'));
 
                 window.addEventListener('resize', function(){
                     self.do('updateDimensions');

+ 2 - 0
src/allplatforms/classes/History.js

@@ -15,6 +15,8 @@ SC.loadPackage({ 'History': {
     		comment: 	'method comment',
     		code: 		function(){
 
+                
+
     		}
     	}
 

+ 23 - 7
src/allplatforms/classes/MenuItemPaste.js

@@ -37,22 +37,38 @@ SC.loadPackage({ 'MenuItemPaste': {
                                     ? SuperGlue.get('document').get('grid').get('gridSize')
                                     : 10;
 
+                        SC.setHandlerForMessageNotUnderstood(function(message, reason, params){
+                            throw new Error('SC: Message not understood: ' + message + '; ' + reason);
+                        });
+
                         for(var i = 0, l = domNodes.length; i < l; i++){
 
-                            newNode = domNodes[i]
-                            SuperGlue.get('document').get('pageContainer').appendChild(newNode);
+                            newNode = domNodes[i];
+
+                            try{
+
+                                SuperGlue.get('document').get('pageContainer').appendChild(newNode);
 
-                            newChild = SC.do('Element', 'awakeFromDOM', newNode)
-                            newChild.set({
-                                top:    newChild.get('top')  + offset,
-                                left:   newChild.get('left') + offset
-                            })
+                                newChild = SC.do('Element', 'awakeFromDOM', newNode)
+                                newChild.set({
+                                    top:    newChild.get('top')  + offset,
+                                    left:   newChild.get('left') + offset
+                                })
+
+                            }catch(e){
+                                SuperGlue.get('document').get('pageContainer').removeChild(newNode);
+                                continue;
+                            }
 
                             SuperGlue.get('document').get('children').push(newChild);
                             SuperGlue.get('document').do('afterLayoutHasChanged');
 
                         }
 
+                        SC.setHandlerForMessageNotUnderstood();
+
+                        theDocumentMenu.do('close');
+
 
                     });
 

+ 2 - 1
src/allplatforms/classes/MenuItemSaveAs.js

@@ -20,7 +20,8 @@ SC.loadPackage({ 'MenuItemSaveAs': {
 
                 this.get('menuContainer').firstChild.addEventListener('mouseup', function(evt){
 
-
+                    theDocumentMenu.do('close');
+                    
                     SuperGlue.get('fileManager').do('saveAs', function(filePath){
 
                         SuperGlue.do('savePage', {

+ 1 - 1
src/allplatforms/css/CreationMenu.css

@@ -3,7 +3,7 @@
 	pointer-events: all;
 	position:       absolute;
 	z-index:		200;
-
+	cursor: 		crosshair;
 	background:  	url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAGklEQVQImWP4r237/7+27X8GdIBTgihAmbEAtfATMUvnCp0AAAAASUVORK5CYII=") repeat;	
 
 }

+ 2 - 2
src/allplatforms/css/Grid.css

@@ -1,10 +1,10 @@
 
 #sg-editing-grid-container {
 
-	pointer-events: 	none;
+	cursor: 			crosshair;
 	position: 			absolute;
 	top: 				0px;
-	background-repeat:  repeat;	
+	background-repeat:  repeat;
 
 }