Skip to content

Commit abcd5cb

Browse files
committed
Added configurable links to editors.
1 parent c0d4f2e commit abcd5cb

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ cloud (env) : CLOUD
2525
// Limits max. count of projects
2626
limit (env) : LIMIT
2727

28-
default_uid : f
28+
default_uid : f
29+
30+
floweditor : https://floweditor.totaljs.com
31+
uibuilder : https://uibuilder.totaljs.com

public/js/ui.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14159,7 +14159,7 @@ COMPONENT('animation', 'style:2;delay:200;init:1000;cleaner:1000;visible:0;offse
1415914159
COMPONENT('miniform','zindex:12',function(self,config,cls){var cls2='.'+cls,csspos={};if(!W.$$miniform){W.$$miniform_level=W.$$miniform_level||1;W.$$miniform=true;$(document).on('click',cls2+'-button-close',function(){SET($(this).attrd('path'),'')});var resize=function(){setTimeout2(self.name,function(){for(var i=0;i<M.components.length;i++){var com=M.components[i];if(com.name==='miniform'&&!HIDDEN(com.dom)&&com.$ready&&!com.$removed)com.resize()}},200)};ON('resize2',resize);$(document).on('click',cls2+'-container',function(e){if(e.target===this){var com=$(this).component();if(com&&com.config.closeoutside){com.set('');return}}var el=$(e.target);if(el.hclass(cls+'-container-cell')){var form=$(this).find(cls2);var c=cls+'-animate-click';form.aclass(c).rclass(c,300);var com=el.parent().component();if(com&&com.config.closeoutside)com.set('')}})}self.readonly();self.submit=function(){if(config.submit)self.EXEC(config.submit,self.hide,self.element);else self.hide()};self.cancel=function(){if(config.cancel)self.EXEC(config.cancel,self.hide);else self.hide()};self.hide=function(){config.close&&self.EXEC(config.close);if(config.independent)self.hideforce();self.esc(false);self.set('')};self.esc=function(bind){if(bind){if(!self.$esc){self.$esc=true;$(W).on('keydown',self.esc_keydown)}}else{if(self.$esc){self.$esc=false;$(W).off('keydown',self.esc_keydown)}}};self.esc_keydown=function(e){if(e.which===27&&!e.isPropagationStopped()){var val=self.get();if(!val||config.if===val){e.preventDefault();e.stopPropagation();self.hide()}}};self.hideforce=function(){if(!self.hclass('hidden')){self.aclass('hidden');self.release(true);self.find(cls2).rclass(cls+'-animate');W.$$miniform_level--}};self.resize=function(){if(!config.center||self.hclass('hidden'))return;var ui=self.find(cls2);var fh=ui.innerHeight();var wh=WH,r=(wh/2)-(fh/2);csspos.marginTop=(r>30?(r-15):20)+'px';ui.css(csspos)};self.make=function(){$(document.body).append('<div id="{0}" class="hidden {4}-container invisible"><div class="{4}-container-table"><div class="{4}-container-cell"><div class="{4}" style="max-width:{1}px"><div class="{4}-title"><button name="cancel" class="{4}-button-close{3}" data-path="{2}"><i class="ti ti-times"></i></button><i class="{4}-icon hidden"></i><span></span></div></div></div></div>'.format(self.ID,config.width||800,self.path,config.closebutton==false?' hidden':'',cls));var scr=self.find('> script');self.template=scr.length?scr.html().trim():'';if(scr.length)scr.remove();var el=$('#'+self.ID);var body=el.find(cls2)[0];while(self.dom.children.length)body.appendChild(self.dom.children[0]);self.rclass('hidden invisible');var csscls=self.attr('class');csscls&&el.aclass(csscls);self.replace(el,true);self.event('scroll',function(){EMIT('scroll',self.name);EMIT('reflow',self.name)});self.event('click','button[name]',function(){var t=this;switch(t.name){case'submit':self.submit(self.hide);break;case'cancel':!t.disabled&&self[t.name](self.hide);break}});config.enter&&self.event('keydown','input',function(e){e.which===13&&!self.find('button[name="submit"]')[0].disabled&&setTimeout2(self.ID+'enter',self.submit,500)})};self.configure=function(key,value,init,prev){switch(key){case'title':self.find(cls2+'-title > span').text(value);break;case'icon':var icon=self.find(cls2+'-icon');icon.rclass2('fa ti');if(value)icon.aclass(self.faicon(value)).rclass('hidden');else icon.aclass('hidden');break;case'width':!init&&value!==prev&&self.find(cls2).css('max-width',value+'px');break;case'closebutton':!init&&self.find(cls2+'-button-close').tclass('hidden',value!==true);break}};self.setter=function(value){setTimeout2(cls+'-noscroll',function(){$('html').tclass(cls+'-noscroll',!!$(cls2+'-container').not('.hidden').length)},50);var isHidden=value!==config.if;if(self.hclass('hidden')===isHidden){if(!isHidden){config.reload&&self.EXEC(config.reload,self);config.default&&DEFAULT(self.makepath(config.default),true)}return}setTimeout2(cls,function(){EMIT('reflow',self.name)},10);if(isHidden){if(!config.independent)self.hideforce();return}if(self.template){var is=self.template.COMPILABLE();self.find(cls2).append(self.template);self.template=null;is&&COMPILE()}if(W.$$miniform_level<1)W.$$miniform_level=1;W.$$miniform_level++;self.css('z-index',W.$$miniform_level*config.zindex);self.rclass('hidden');self.resize();self.release(false);config.reload&&self.EXEC(config.reload,self);config.default&&DEFAULT(self.makepath(config.default),true);setTimeout(function(){self.rclass('invisible');self.find(cls2).aclass(cls+'-animate');config.autofocus&&self.autofocus(config.autofocus)},200);setTimeout2(self.ID,function(){self.css('z-index',(W.$$miniform_level*config.zindex)+1)},400);config.closeesc&&self.esc(true)}});
1416014160
// End: j-MiniForm
1416114161

14162-
COMPONENT('uidesigner', 'url:https://uibuilder.totaljs.com', function(self, config, cls) {
14162+
COMPONENT('uidesigner', function(self, config, cls) {
1416314163

1416414164
var self = this;
1416514165
var iframe;
@@ -14171,6 +14171,8 @@ COMPONENT('uidesigner', 'url:https://uibuilder.totaljs.com', function(self, conf
1417114171

1417214172
self.make = function() {
1417314173

14174+
config.url = self.attrd('url') || 'https://uibuilder.totaljs.com';
14175+
1417414176
self.aclass(cls + ' hidden');
1417514177
self.css({ position: 'absolute', 'z-index': 80, left: 0, top: margin, right: 0, bottom: 0 });
1417614178
self.on('resize + resize2', self.resize);
@@ -14301,7 +14303,7 @@ COMPONENT('errorhandler', 'keywords:401=login', function(self, config) {
1430114303

1430214304
});
1430314305

14304-
COMPONENT('flowstream', 'left:0;top:0;zindex:100;url:https://floweditor.totaljs.com;language:eu', function(self, config, cls) {
14306+
COMPONENT('flowstream', 'left:0;top:0;zindex:100;language:eu', function(self, config, cls) {
1430514307

1430614308
var self = this;
1430714309
var iframe;
@@ -14312,6 +14314,7 @@ COMPONENT('flowstream', 'left:0;top:0;zindex:100;url:https://floweditor.totaljs.
1431214314

1431314315
self.make = function() {
1431414316

14317+
config.url = self.attrd('url') || 'https://floweditor.totaljs.com';
1431514318
config.margin = common.electron ? (common.ismac ? 28 : 1) : 0;
1431614319

1431714320
self.aclass(cls + ' hidden');

views/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
<div data---="LAZY colorpicker"></div>
4949
<div data---="windows__windows"></div>
5050

51-
<ui-component name="LAZY flowstream"></ui-component>
51+
<ui-component name="LAZY flowstream"@{if CONF.floweditor}} data-url="@{CONF.floweditor}"@{fi}></ui-component>
52+
<ui-component name="LAZY uidesigner"@{if CONF.uibuilder}} data-url="@{CONF.uibuilder}"@{fi}></ui-component>
5253
<ui-component name="LAZY builder"></ui-component>
53-
<ui-component name="LAZY uidesigner"></ui-component>
5454
<ui-component name="errorhandler"></ui-component>
5555

5656
<div class="windowtitlebar" data-bind="document.title__text">@{config.name}</div>

0 commit comments

Comments
 (0)