Browse Source

Merge branch 'master' of git.superglue.it:superglue/editor

Joscha Jaeger 10 năm trước cách đây
mục cha
commit
71a017e688

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

@@ -7,7 +7,7 @@ SC.loadPackage({ 'ImageElement': {
 
     sharedProperties: {
         protoHTML:          { initValue: '<div class="sg-element" data-superglue-type="ImageElement" style="left: 0px; top: 0px; width: 0px; height: 0px;">'
-                                        +'\t<img src="/resources/img/defaultImg.svg" style="min-width: 100%; min-height: 100%;">'
+                                        +'\t<img src="/resources/img/defaultImage.svg" style="min-width: 100%; min-height: 100%;">'
                                         +'</div>' },
         applicableWidgets:  { initValue: [ 'WidgetBackgroundColor', 'WidgetBorderColor', 'WidgetBorder', 'WidgetBorderRadius', 'WidgetPadding', 'WidgetOpacity', 'WidgetImgLink', 'WidgetImgDimensions', 'WidgetImgSrc' ] },
         creationMenuItem:   { initValue: '<div class="sg-editing-creation-menu-container"><button id="sg-editing-creation-menu-imageElement" class="sg-editing-creation-menu-button" data-tooltip="Image"></button></div>' }

+ 4 - 2
src/allplatforms/classes/SuperGlue.js

@@ -141,11 +141,13 @@ SC.loadPackage({ 'SuperGlue': {
                                 ? SC.init('Server', saveOptions.remoteOrigin)
                                 : this.get('server');
 
-                
+                this.get('windowManager').set({ activityIndicator: true });
+
                 server.do('uploadHTML', {
                     path:   saveOptions.path,
                     data:   thisPage,
                     onerror:    function(){
+                                    SuperGlue.get('windowManager').set({ activityIndicator: false });
                                     console.log(this);
                                     alert('Critical error: The page could not be saved.\nSee console for more details.');
                                 },
@@ -153,7 +155,7 @@ SC.loadPackage({ 'SuperGlue': {
 
                                 },
                     onresponse: function(){
-                                    alert('Page successfully saved.\n\n' + server.get('origin') + '/' + saveOptions.path);
+                                    SuperGlue.get('windowManager').set({ activityIndicator: false });
                                 }
                 })
 

+ 2 - 2
src/allplatforms/classes/TextEditor.js

@@ -134,12 +134,12 @@ SC.loadPackage({ 'TextEditor': {
                     self.do('closeTextEditor');
 
                     evt.stopPropagation();
-                }, true);
+                }, false);
 
                 textEditorContainer.addEventListener('mousedown', function(evt){
                     evt.stopPropagation();
 
-                }, true);
+                }, false);
 
 
                 document.body.insertBefore(

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

@@ -7,7 +7,7 @@ SC.loadPackage({ 'TextElement': {
     
     sharedProperties: {
         protoHTML:          { initValue: '<div class="sg-element" data-superglue-type="TextElement" style="left: 0px; top: 0px; width: 0px; height: 0px;">'
-                                        +'\t<p style="font-family: \'Sans\'; font-size: 40px;">Text</p>'
+                                        +'\t<p>Text</p>'
                                         +'</div>' },
         applicableWidgets:  { initValue: [ 'WidgetBackgroundColor', 'WidgetBorderColor', 'WidgetBorder', 'WidgetBorderRadius', 'WidgetPadding', 'WidgetOpacity' ] },
         creationMenuItem:   { initValue: '<div class="sg-editing-creation-menu-container"><button id="sg-editing-creation-menu-textElement" class="sg-editing-creation-menu-button" data-tooltip="Text"></button></div>' }

+ 27 - 1
src/allplatforms/classes/WindowManager.js

@@ -6,7 +6,33 @@ SC.loadPackage({ 'WindowManager': {
     properties: {
 
         windowsContainer:   { comment: 'I hold the DOM node which contains the windows.' },
-        windows:            { comment: 'I hold an map of id-->references to my window DOM nodes.' }
+        windows:            { comment: 'I hold an map of id-->references to my window DOM nodes.' },
+        activityIndicator:  { comment: 'I can show wether SuperGlue is working or not.',
+                              transform: function(aBoolean){
+                                    if(aBoolean){
+
+                                        if(!this.get('windowsContainer').querySelector('#sg-editing-activity-indicator')){
+
+                                            var indicator = document.createElement('div');
+                                            indicator.setAttribute('id', 'sg-editing-activity-indicator');
+                                            this.get('windowsContainer').appendChild(indicator)
+
+                                        }
+
+                                    }else{
+
+                                        if(this.get('windowsContainer').querySelector('#sg-editing-activity-indicator')){
+
+                                            this.get('windowsContainer').removeChild(
+                                                this.get('windowsContainer').querySelector('#sg-editing-activity-indicator')
+                                            );
+
+                                        }
+
+                                    }
+                                    return aBoolean;
+                              }
+                            }
 
     },
 

+ 12 - 0
src/allplatforms/css/WindowManager.css

@@ -7,3 +7,15 @@
 	font-size:			15px;
 	letter-spacing: 	1px;
 }
+
+#sg-editing-activity-indicator {
+	position: 			fixed;
+	top: 				5px;
+	left: 				5px;
+	width: 				30px;
+	height: 			30px;
+	background-image:	url(./icons/loading.gif);
+	background-repeat: 	no-repeat;
+	background-size:	28px auto;
+	background-position: center;
+}

+ 20 - 0
testpages/empty.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<meta name="generator" content="SuperGlue" data-superglue-version="1.0" data-superglue-settings="">
+		<title>New Page</title>
+		<style type="text/css" data-superglue="default-css">
+			body { margin: 0px; padding: 0px; }
+			#sg-page { position: relative; top: 0px; }
+			#sg-page.sg-page-centered { margin: 0px auto; }
+			.sg-element { position: absolute; overflow: hidden; }
+		</style>
+		<link rel="stylesheet" href="/resources/css/SuperGlue.css" data-superglue="text-css">
+	</head>
+	<body>
+		<div id="sg-page" data-superglue-grid="off/0px">
+			
+		</div>
+	</body>
+</html>