From 84b1c42aed0e844a4257707890999cda8d3008c2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 4 Mar 2021 18:13:59 +0800 Subject: [PATCH] Fix #6625 - undo reset --- Roo/Template.js | 13 +++++++++++-- buildSDK/File.js | 4 ++-- buildSDK/cssmini.js | 21 +++++++++++++-------- buildSDK/cssminify.js | 10 ++++++---- css/roojs-debug.css | 1 + css/roojs.css | 1 + docs/src/Roo_Template.js.html | 13 +++++++++++-- roojs-all.js | 17 +++++++++-------- roojs-core-debug.js | 14 +++++++++++--- roojs-core.js | 17 +++++++++-------- roojs-debug.js | 14 +++++++++++--- undefined | 0 12 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 undefined diff --git a/Roo/Template.js b/Roo/Template.js index 78917f509b..f117c9aa6d 100644 --- a/Roo/Template.js +++ b/Roo/Template.js @@ -68,11 +68,18 @@ Roo.Template.prototype = { * @cfg {String} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("") */ html : '', + + + compiled : false, + loaded : false, /** * Returns an HTML fragment of this template with the specified values applied. * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) * @return {String} The HTML fragment */ + + + applyTemplate : function(values){ //Roo.log(["applyTemplate", values]); try { @@ -134,7 +141,9 @@ Roo.Template.prototype = { success : function (response) { _t.loading = false; _t.url = false; - _t.set(response.responseText,true) + + _t.set(response.responseText,true); + _t.loaded = true; if (_t.onLoad) { _t.onLoad(); } @@ -154,7 +163,7 @@ Roo.Template.prototype = { */ set : function(html, compile){ this.html = html; - this.compiled = null; + this.compiled = false; if(compile){ this.compile(); } diff --git a/buildSDK/File.js b/buildSDK/File.js index 4185bccf59..8dbf673b15 100644 --- a/buildSDK/File.js +++ b/buildSDK/File.js @@ -39,8 +39,8 @@ var File = { read : function (path) { var out = {}; - GLib.file_get_contents(path, out, null, null); - return out['value']; + out = GLib.file_get_contents(path); + return out['contents']; }, isFile : function (path) { diff --git a/buildSDK/cssmini.js b/buildSDK/cssmini.js index 80a589dfa3..b4a76b8e50 100644 --- a/buildSDK/cssmini.js +++ b/buildSDK/cssmini.js @@ -9,21 +9,22 @@ * This code is a port of Isaac Schlueter's cssmin utility. * * Usage: seed buildSDK/cssmini.js + * Usage: gjs -I buildSDK buildSDK/cssmini.js */ -File = imports.File.File; -GLib = imports.gi.GLib; +GLib = imports.gi.GLib; +Gio = imports.gi.Gio; // let's see if this works.. // should be run from top level.. var pa = GLib.get_current_dir(); -print(pa); +//print(pa); //println(pack(File.read(pa+'/css/basic-dialog.css'))); -var lines = File.read(pa + '/css/roojs-debug.css').split(/\n/); + var lines = String(GLib.file_get_contents(pa + '/css/roojs-debug.css')[1]).split(/\n/); //@import url("reset-min.css"); var out = ''; lines.forEach(function(l) { @@ -33,11 +34,15 @@ lines.forEach(function(l) { l = l.replace(/^[^"]+"([^"]+)".*/, '$1'); print("pack " + l); //out += pack(File.read(pa+'/css/' + l)).replace(/\}/g, "}\n")+"\n"; - out += pack(File.read(pa+'/css/' + l)) + "\n"; + var data = String(GLib.file_get_contents(pa+'/css/' + l)[1]); +//print(data); + out += pack(data) + "\n"; }); - -File.write(pa+'/css/roojs.css', out); - +var f = Gio.file_new_for_path(String(pa+'/css/roojs.css')); +var data_out = new Gio.DataOutputStream({base_stream:f.replace(null, false, Gio.FileCreateFlags.NONE, null)}); +data_out.put_string(out, null); +data_out.close(null); + print("written css/roojs.css"); // and the themese... diff --git a/buildSDK/cssminify.js b/buildSDK/cssminify.js index 69edf12201..985ca7e076 100644 --- a/buildSDK/cssminify.js +++ b/buildSDK/cssminify.js @@ -11,9 +11,8 @@ * Usage: seed buildSDK/cssminify.js {OUTPUT} {files........} */ +return; // do not use this.. - -File = imports.File.File; GLib = imports.gi.GLib; // let's see if this works.. // should be run from top level.. @@ -31,10 +30,13 @@ var out = ''; args.forEach(function(l) { //out += pack(File.read(pa+'/css/' + l)).replace(/\}/g, "}\n")+"\n"; - out += pack(File.read(l)) + "\n"; + out += pack(GLib.file_get_contents(path)['contents']) + "\n"; }); +var f = Gio.file_new_for_path(String(outname)); +var data_out = new Gio.DataOutputStream({base_stream:f.replace(null, false, Gio.FileCreateFlags.NONE, null)}); +data_out.put_string(out, null); +data_out.close(null); -File.write(outname, out); print("written " + outname); diff --git a/css/roojs-debug.css b/css/roojs-debug.css index dc78b499d8..dd07311e1b 100644 --- a/css/roojs-debug.css +++ b/css/roojs-debug.css @@ -28,3 +28,4 @@ @import url("daypicker.css"); @import url("inline-editor.css"); +@import url("undoreset.css"); diff --git a/css/roojs.css b/css/roojs.css index ecc5a7f971..e567bf71c7 100644 --- a/css/roojs.css +++ b/css/roojs.css @@ -15,3 +15,4 @@ x-date{background:white;padding:2px;border:1px solid gray;z-index:12001;-moz-out .x-combo-list{background-color:white;border:1px solid #afafaf;cursor:default;}.x-combo-list-inner{overflow:auto;}.x-combo-list-item{padding-left:2px;padding-top:0;margin:0;padding-bottom:2px;white-space:nowrap;}.x-combo-selected{background-color:#ABC9C2;color:black;border:1px solid #5e8a7f;}.x-form-date-trigger,.x-form-arrow-trigger{width:17px;height:19px;background:url(../images/default/combo/arrow.gif);background-repeat:no-repeat;background-position:center;}.roo-ie .x-form-field-wrap .x-form-trigger,.roo-ie .x-toolbar .x-form-arrow-trigger{margin:0;}.roo-ie .x-form-arrow-trigger,.roo-ie .x-form-date-trigger{height:18px;}.x-form .x-form-combo-add,.x-form .x-form-combo-edit{background:transparent url(../images/default/dd/drop-add.gif) no-repeat scroll 0 0;border-style:none none solid;cursor:pointer;height:21px;position:absolute;top:2;width:17px;margin-left:20px;}.x-form .x-form-combo-edit{background:transparent url(../images/default/tree/leaf.gif) no-repeat scroll 0 0;}.x-combo-list-inner .x-btn{text-align:left;font:12px arial,tahoma,verdana,helvetica;}.x-cbarray-item{display:inline-block;background:#e0ecff none no-repeat scroll 0 0;float:left;height:18px;-moz-border-radius:2px;margin:2px;float:left font-family:arial,tahoma,helvetica,sans-serif;font-size:11px;font-size-adjust:none;font-style:normal;font-variant:normal;font-weight:normal;}.x-cbarray-item div{display:inline-block;float:left;margin:2px;margin-left:5px;}.x-cbarray-item img{margin-left:5px;background:transparent url(../images/default/dd/drop-sub.gif) no-repeat scroll 0 0;cursor:pointer;}.x-cbarray-cb{float:left;}.x-cbarray-grp{padding:2px;border:1px solid #e0ecff;display:inline-block;}.x-cbarray-grp input.x-form-text,.x-cbarray-grp img.x-form-trigger{float:left;}.x-combo-list-item.x-combo-list-item-has-children:after{content:'>';float:right;margin-right:2px;} .x-form-daypick-item td div{width:30px;text-align:center;}.x-form-daypick-icons td img{background:url(../images/default/menu/chk-sprite.gif) no-repeat 0 0;width:16px;height:16px;margin:0;margin-left:5px;cursor:pointer;}.x-form-daypick-icons td img.x-menu-item-checked{background-position:0 -16px;} .x-html-editor-wrap{background-color:#fff;border:1px solid #a3bac9;}.x-html-editor-tb{height:24px;}.x-html-editor-tb .x-toolbar{height:24px;}.x-html-editor-tb .x-toolbar>table{position:absolute;}.x-html-editor-tb .x-btn-text{background:transparent url(../images/default/form/htmleditor.gif) no-repeat scroll 0 0;}.x-html-editor-tb .x-btn-text{min-width:18px;}.x-html-editor-tb .x-edit-bold .x-btn-text{background-position:0 0;}.x-html-editor-tb .x-edit-italic .x-btn-text{background-position:0 -16px;}.x-html-editor-tb .x-edit-underline .x-btn-text{background-position:0 -32px;}.x-html-editor-tb .x-edit-strikethrough .x-btn-text{background-position:0 -223px;}.x-html-editor-tb .x-edit-increasefontsize .x-btn-text{background-position:0 -48px;}.x-html-editor-tb .x-edit-decreasefontsize .x-btn-text{background-position:0 -64px;}.x-html-editor-tb .x-edit-insertorderedlist .x-btn-text{background-position:0 -80px;}.x-html-editor-tb .x-edit-insertunorderedlist .x-btn-text{background-position:0 -96px;}.x-html-editor-tb .x-edit-justifyleft .x-btn-text{background-position:0 -112px;}.x-html-editor-tb .x-edit-justifycenter .x-btn-text{background-position:0 -128px;}.x-html-editor-tb .x-edit-justifyright .x-btn-text{background-position:0 -144px;}.x-html-editor-tb .x-edit-forecolor .x-btn-text{background-position:0 -160px;}.x-html-editor-tb .x-edit-backcolor .x-btn-text{background-position:0 -176px;}.x-html-editor-tb .x-edit-sourceedit .x-btn-text{background-position:0 -192px;}.x-html-editor-tb .x-edit-createlink .x-btn-text{background-position:0 -208px;}.x-html-editor-tb .x-edit-none .x-btn-text{background:transparent none 0 0;}.x-html-editor-tb .x-toolbar .x-btn{margin-left:0;margin-right:0;}.x-html-editor-wrap .x-toolbar{height:20px;}.x-html-editor-wrap .x-editor-context span{cursor:pointer;}.x-html-editor-wrap .x-editor-context span:hover{text-decoration:underline;}.roo-htmleditor-body ol li{list-style:decimal outside;}.roo-htmleditor-body ul li{list-style:disc outside;}.roo-htmleditor-body ol,.roo-htmleditor-body ul,.roo-htmleditor-body dl{margin-left:2em;} +.undoreset div,.undoreset span,.undoreset applet,.undoreset object,.undoreset iframe,.undoreset h1,.undoreset h2,.undoreset h3,.undoreset h4,.undoreset h5,.undoreset h6,.undoreset p,.undoreset blockquote,.undoreset pre,.undoreset a,.undoreset abbr,.undoreset acronym,.undoreset address,.undoreset big,.undoreset cite,.undoreset code,.undoreset del,.undoreset dfn,.undoreset em,.undoreset img,.undoreset ins,.undoreset kbd,.undoreset q,.undoreset s,.undoreset samp,.undoreset small,.undoreset strike,.undoreset strong,.undoreset sub,.undoreset sup,.undoreset tt,.undoreset var,.undoreset b,.undoreset u,.undoreset i,.undoreset center,.undoreset dl,.undoreset dt,.undoreset dd,.undoreset ol,.undoreset ul,.undoreset li,.undoreset fieldset,.undoreset form,.undoreset label,.undoreset legend,.undoreset table,.undoreset caption,.undoreset tbody,.undoreset tfoot,.undoreset thead,.undoreset tr,.undoreset th,.undoreset td,.undoreset article,.undoreset aside,.undoreset canvas,.undoreset details,.undoreset embed,.undoreset figure,.undoreset figcaption,.undoreset footer,.undoreset header,.undoreset hgroup,.undoreset menu,.undoreset nav,.undoreset output,.undoreset ruby,.undoreset section,.undoreset summary,.undoreset time,.undoreset mark,.undoreset audio,.undoreset video{margin-bottom:1em;}.undoreset strong,.undoreset th{font-weight:bold;}.undoreset em,.undoreset address,.undoreset caption,.undoreset cite{font-style:italic;}.undoreset table{display:table;border-spacing:2px;border-collapse:separate;}.undoreset tr{display:table-row;vertical-align:inherit;}.undoreset td{display:table-cell;border-spacing:2px;padding:2px;vertical-align:inherit;text-align:inherit;padding:1px;border-collapse:none;}.undoreset th{display:table-cell;vertical-align:inherit;font-weight:bold;padding:1px;border-collapse:none;}.undoreset p{display:block;margin:1em 0;}.undoreset blockquote{display:block;margin:1em 40px;}.undoreset address{display:block;font-style:italic;}.undoreset center{display:block;text-align:center;}.undoreset h1{display:block;font-size:2em;font-weight:bold;margin:.67em 0;}.undoreset h2{display:block;font-size:1.5em;font-weight:bold;margin:.83em 0;}.undoreset h3{display:block;font-size:1.17em;font-weight:bold;margin:1em 0;}.undoreset h4{display:block;font-weight:bold;margin:1.33em 0;}.undoreset h5{display:block;font-size:.83em;font-weight:bold;margin:1.67em 0;}.undoreset h6{display:block;font-size:.67em;font-weight:bold;margin:2.33em 0;}.undoreset ul{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;}.undoreset ol{display:block;list-style-type:decimal;margin:1em 0;padding-left:40px;}.undoreset li{display:list-item;}.undoreset pre,.undoreset code{display:block;font-family:Courier New;white-space:pre;margin:1em 0;} diff --git a/docs/src/Roo_Template.js.html b/docs/src/Roo_Template.js.html index ce8916ddab..b1347f5bb1 100644 --- a/docs/src/Roo_Template.js.html +++ b/docs/src/Roo_Template.js.html @@ -68,11 +68,18 @@ t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'} * @cfg {String} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("") */ html : '', + + + compiled : false, + loaded : false, /** * Returns an HTML fragment of this template with the specified values applied. * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) * @return {String} The HTML fragment */ + + + applyTemplate : function(values){ //Roo.log(["applyTemplate", values]); try { @@ -134,7 +141,9 @@ t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'} success : function (response) { _t.loading = false; _t.url = false; - _t.set(response.responseText,true) + + _t.set(response.responseText,true); + _t.loaded = true; if (_t.onLoad) { _t.onLoad(); } @@ -154,7 +163,7 @@ t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'} */ set : function(html, compile){ this.html = html; - this.compiled = null; + this.compiled = false; if(compile){ this.compile(); } diff --git a/roojs-all.js b/roojs-all.js index 38a8f800a4..9caf851f22 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -213,16 +213,17 @@ return el.nextSibling;}throw 'Illegal insertion point -> "'+M+'"';},insertBefore el.appendChild(N);}else{var O=E(o);N=this.insertHtml("beforeEnd",el,O);}return M?Roo.get(N,true):N;},overwrite:function(el,o,M){el=Roo.getDom(el);if(o.ns){while(el.childNodes.length){el.removeChild(el.firstChild);}F(o,el);}else{el.innerHTML=E(o);}return M?Roo.get(el.firstChild,true):el.firstChild; },createTemplate:function(o){var M=E(o);return new Roo.Template(M);}};}(); // Roo/Template.js -Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',applyTemplate:function(A){try{if(this.compiled){return this.compiled(A); +Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',compiled:false,loaded:false,applyTemplate:function(A){try{if(this.compiled){return this.compiled(A); }var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),A[D],A);}else{if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,G=F.length;i+~]\s?|\s|$)/;var H=/^(#)?([\w-\*]+)/;var I=/(\d*)n\+?(\d*)/,J=/\D/;function child(p,M){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==M){return n; }}n=n.nextSibling;}return null;};function next(n){while((n=n.nextSibling)&&n.nodeType!=1);return n;};function prev(n){while((n=n.previousSibling)&&n.nodeType!=1);return n;};function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!D.test(n.nodeValue)){d.removeChild(n); diff --git a/roojs-core-debug.js b/roojs-core-debug.js index 0f5667c59e..82fe4290d7 100644 --- a/roojs-core-debug.js +++ b/roojs-core-debug.js @@ -4693,11 +4693,18 @@ Roo.Template.prototype = { * @cfg {String} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("") */ html : '', + + + compiled : false, + loaded : false, /** * Returns an HTML fragment of this template with the specified values applied. * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) * @return {String} The HTML fragment */ + + + applyTemplate : function(values){ //Roo.log(["applyTemplate", values]); try { @@ -4758,9 +4765,10 @@ Roo.Template.prototype = { method : 'GET', success : function (response) { _t.loading = false; - _t.html = response.responseText; _t.url = false; - _t.compile(); + + _t.set(response.responseText,true); + _t.loaded = true; if (_t.onLoad) { _t.onLoad(); } @@ -4780,7 +4788,7 @@ Roo.Template.prototype = { */ set : function(html, compile){ this.html = html; - this.compiled = null; + this.compiled = false; if(compile){ this.compile(); } diff --git a/roojs-core.js b/roojs-core.js index c89e95bb6b..423202aca4 100644 --- a/roojs-core.js +++ b/roojs-core.js @@ -213,16 +213,17 @@ return el.nextSibling;}throw 'Illegal insertion point -> "'+M+'"';},insertBefore el.appendChild(N);}else{var O=E(o);N=this.insertHtml("beforeEnd",el,O);}return M?Roo.get(N,true):N;},overwrite:function(el,o,M){el=Roo.getDom(el);if(o.ns){while(el.childNodes.length){el.removeChild(el.firstChild);}F(o,el);}else{el.innerHTML=E(o);}return M?Roo.get(el.firstChild,true):el.firstChild; },createTemplate:function(o){var M=E(o);return new Roo.Template(M);}};}(); // Roo/Template.js -Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',applyTemplate:function(A){try{if(this.compiled){return this.compiled(A); +Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',compiled:false,loaded:false,applyTemplate:function(A){try{if(this.compiled){return this.compiled(A); }var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),A[D],A);}else{if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,G=F.length;i+~]\s?|\s|$)/;var H=/^(#)?([\w-\*]+)/;var I=/(\d*)n\+?(\d*)/,J=/\D/;function child(p,M){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==M){return n; }}n=n.nextSibling;}return null;};function next(n){while((n=n.nextSibling)&&n.nodeType!=1);return n;};function prev(n){while((n=n.previousSibling)&&n.nodeType!=1);return n;};function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!D.test(n.nodeValue)){d.removeChild(n); diff --git a/roojs-debug.js b/roojs-debug.js index fb819f7e82..29cb7b7a1b 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -4693,11 +4693,18 @@ Roo.Template.prototype = { * @cfg {String} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("") */ html : '', + + + compiled : false, + loaded : false, /** * Returns an HTML fragment of this template with the specified values applied. * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) * @return {String} The HTML fragment */ + + + applyTemplate : function(values){ //Roo.log(["applyTemplate", values]); try { @@ -4758,9 +4765,10 @@ Roo.Template.prototype = { method : 'GET', success : function (response) { _t.loading = false; - _t.html = response.responseText; _t.url = false; - _t.compile(); + + _t.set(response.responseText,true); + _t.loaded = true; if (_t.onLoad) { _t.onLoad(); } @@ -4780,7 +4788,7 @@ Roo.Template.prototype = { */ set : function(html, compile){ this.html = html; - this.compiled = null; + this.compiled = false; if(compile){ this.compile(); } diff --git a/undefined b/undefined new file mode 100644 index 0000000000..e69de29bb2 -- 2.39.2