@widgetic/editor 3.10.49 → 3.10.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/dev/editor.js CHANGED
@@ -6641,7 +6641,7 @@ var template = function () {
6641
6641
  computed: {
6642
6642
  instance: function instance(service) {
6643
6643
  return __WEBPACK_IMPORTED_MODULE_0_Core_services_container_instance__["default"][service];
6644
- }
6644
+ } // get the service instance
6645
6645
  },
6646
6646
 
6647
6647
  oncreate: function oncreate() {
@@ -13347,7 +13347,7 @@ WidgetEditor = (function(superClass) {
13347
13347
  this.el.append(this.tabs.el);
13348
13348
  LoginPopup.place(this.el);
13349
13349
  Blogvio.pubsub.subscribe('api/token/update', this._updateLoggedInStatus);
13350
- this.el.attr('editorVersion', "3.10.49");
13350
+ this.el.attr('editorVersion', "3.10.51");
13351
13351
  }
13352
13352
 
13353
13353
 
@@ -16747,43 +16747,58 @@ var UploadService = function (_EventsMixin) {
16747
16747
  }, {
16748
16748
  key: 'upload',
16749
16749
  value: function upload(uploadFile) {
16750
- // console.log("upload file:", uploadFile);
16750
+ // console.log("on upload file:", uploadFile);
16751
16751
 
16752
- this.files.push(new File({
16752
+ // create a new File instance from the uploadFile
16753
+ var file = new File({
16753
16754
  state: 'new',
16754
16755
  size: uploadFile.size,
16755
16756
  name: uploadFile.name,
16756
16757
  type: parseType(uploadFile.type),
16757
- // lastModified: uploadFile.lastModified,
16758
+ lastModified: Date.now(),
16758
16759
  uploadFile: uploadFile
16759
- }));
16760
+ });
16761
+ console.log("on upload file:", file);
16762
+
16763
+ // push it to the files array
16764
+ this.files.push(file);
16765
+
16766
+ // increase used quota
16760
16767
  this.used += uploadFile.size;
16768
+
16769
+ // broadcast the update of the files array
16761
16770
  this._broadcast.update();
16762
16771
  }
16763
16772
  }, {
16764
16773
  key: 'uploadComplete',
16765
16774
  value: function uploadComplete(uploadFile, instanceId) {
16766
16775
  // console.log("uploadComplete file:", uploadFile);
16776
+
16767
16777
  if (uploadFile.status === 'error') return;
16768
16778
 
16769
- // read metadata(id here) from the file that's on the server
16779
+ // read metadata from the file that's on the server
16770
16780
  var response = JSON.parse(uploadFile.xhr.response);
16771
- // console.log("uploadComplete file on the server:", response.files.data[0])
16772
- var id = response.files.data[0].id;
16781
+ // console.log("uploadComplete server response:", response);
16782
+
16783
+ // read file from the response
16784
+ var serverFile = response.files.data[0];
16785
+ // console.log("uploadComplete file on the server:", serverFile);
16773
16786
 
16774
16787
  // read quota from response
16775
16788
  // this.quota = response.quota.max;
16776
16789
  this.used = response.quota.used;
16777
16790
 
16791
+ // update the file in the files array with the data from the server
16778
16792
  this._update(uploadFile, function (f) {
16779
16793
  f.state = 'complete';
16780
- f.id = id;
16781
- f.path = response.files.data[0].path;
16794
+ f.id = serverFile.id;
16795
+ f.path = serverFile.path;
16782
16796
  f.url = response.hostUrl + f.path;
16783
- // f.lastModified = uploadFile.lastModified;
16797
+ f.lastModified = serverFile.lastModified;
16784
16798
  });
16785
16799
 
16786
- this._broadcast.complete([this.get(id), instanceId]);
16800
+ // broadcast the completion of the upload based on the fileId and instanceId
16801
+ this._broadcast.complete([this.get(serverFile.id), instanceId]);
16787
16802
  }
16788
16803
  }, {
16789
16804
  key: 'accept',
@@ -16840,10 +16855,13 @@ var UploadService = function (_EventsMixin) {
16840
16855
  }, {
16841
16856
  key: '_update',
16842
16857
  value: function _update(file, transform) {
16858
+ // apply the transform function to the file in the array
16843
16859
  this.files = this.files.map(function (f) {
16844
16860
  if (f.uploadFile === file) transform(f);
16845
16861
  return f;
16846
16862
  });
16863
+
16864
+ // broadcast the update of the files array
16847
16865
  this._broadcast.update();
16848
16866
  }
16849
16867
  }, {
@@ -17039,6 +17057,8 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
17039
17057
 
17040
17058
 
17041
17059
  var template = function () {
17060
+ // actually imports services/uploads.js
17061
+
17042
17062
  var instanceId = 0;
17043
17063
 
17044
17064
  return {
@@ -17072,6 +17092,9 @@ var template = function () {
17072
17092
 
17073
17093
  // load uploaded files
17074
17094
  this.refresh();
17095
+
17096
+ // scroll to uploads files list to bottom
17097
+ this.scrollToListBottom();
17075
17098
  },
17076
17099
  ondestroy: function ondestroy() {
17077
17100
  this.observer.cancel();
@@ -17086,7 +17109,7 @@ var template = function () {
17086
17109
 
17087
17110
  // on selecting a file square
17088
17111
  toggle: function toggle(file) {
17089
- console.log("on toggle file:", file);
17112
+ // console.log("on toggle file:", file);
17090
17113
 
17091
17114
  if (file.error) {
17092
17115
  this.Uploads.remove(file);
@@ -17102,7 +17125,7 @@ var template = function () {
17102
17125
  refresh: function refresh(ev) {
17103
17126
  var _this = this;
17104
17127
 
17105
- console.log("refreshing...");
17128
+ // console.log("refreshing...");
17106
17129
  if (ev) ev.preventDefault();
17107
17130
 
17108
17131
  return this.Uploads.getFiles(this.get('filetypes')).then(function (files) {
@@ -17114,20 +17137,37 @@ var template = function () {
17114
17137
  // if(!a.id.indexOf) return -1;
17115
17138
  // let noIdA = a.id.substr(a.id.indexOf('_t')+2, 4);
17116
17139
  // let noIdB = b.id.substr(a.id.indexOf('_t')+2, 4);
17117
- // // console.log("noIdA & noIdB: ", noIdA, noIdB, (noIdA >= noIdB));
17140
+ // // console.log("noIdA & noIdB: ", noIdA, noIdB, (noIdA - noIdB));
17118
17141
  // return noIdA - noIdB;
17119
17142
  // });
17120
17143
  // console.log("uploadedFiles after sort: ", files);
17121
17144
 
17122
- // sort files by last modified date
17145
+ // sort files by last modified(uploadTime) date
17123
17146
  files = files.sort(function (a, b) {
17147
+
17148
+ // read a lastModified timestamp
17124
17149
  var x = a.lastModified;
17150
+
17151
+ // read the lastModified date from the id
17152
+ if (!x) x = a.id.substring(a.id.indexOf('_u') + 3);
17153
+
17154
+ // if still not available then set it to 0
17125
17155
  if (!x) x = 0;
17156
+ // a.lastModified = x;
17126
17157
 
17158
+
17159
+ // read b lastModified timestamp
17127
17160
  var y = b.lastModified;
17161
+
17162
+ // read the lastModified date from the id
17163
+ if (!y) y = b.id.substring(b.id.indexOf('_u') + 3);
17164
+
17165
+ // if still not available then set it to 0
17128
17166
  if (!y) y = 0;
17167
+ // b.lastModified = y;
17129
17168
 
17130
- // console.log("x & y: ", x, y);
17169
+
17170
+ // console.log("x & y: ", a.lastModified, x, b.lastModified, y);
17131
17171
 
17132
17172
  return x - y;
17133
17173
  });
@@ -17194,11 +17234,20 @@ var template = function () {
17194
17234
  */
17195
17235
 
17196
17236
  _onDropZoneNewUpload: function _onDropZoneNewUpload(event) {
17197
- console.log("on DropZone New Upload:", event);
17237
+ // console.log("on DropZone New Upload:", event);
17238
+
17239
+ // scroll the list to the bottom
17240
+ this.scrollToListBottom();
17241
+ },
17242
+
17243
+
17244
+ // scroll to uploads files list to bottom
17245
+ scrollToListBottom: function scrollToListBottom() {
17246
+ // console.log("on DropZone New Upload:", event);
17198
17247
  this.refs.scrollPane && this.refs.scrollPane.scrollBottom();
17199
17248
  },
17200
17249
  _onDropZoneUpload: function _onDropZoneUpload(event) {
17201
- console.log("on DropZone Upload:", event);
17250
+ // console.log("on DropZone Upload:", event);
17202
17251
  this.toggle(event);
17203
17252
  },
17204
17253
 
@@ -17232,8 +17281,8 @@ var template = function () {
17232
17281
 
17233
17282
  function add_css() {
17234
17283
  var style = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('style');
17235
- style.id = "svelte-712365636-style";
17236
- style.textContent = "\n section[svelte-712365636], [svelte-712365636] section {\n display: flex;\n flex-direction: column;\n padding-left: 20px;\n height: calc(100% - 25px);\n color: #665b68;\n }\n\n a[svelte-712365636]:focus, [svelte-712365636] a:focus {\n outline: none;\n }\n\n [svelte-712365636].error-panel, [svelte-712365636] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-712365636].browser-nav, [svelte-712365636] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-712365636].blogvio-browser-title, [svelte-712365636] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px \"ProximaNova-Regular\";\n color: #0055FF;\n }\n\n [svelte-712365636].nano, [svelte-712365636] .nano {\n flex: 1;\n }\n\n strong[svelte-712365636], [svelte-712365636] strong {\n color: #0055FF;\n }\n\n [svelte-712365636].dropzone_plchldr, [svelte-712365636] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-712365636].dropzone, [svelte-712365636] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-712365636].scrolling-container, [svelte-712365636] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-712365636].dropzone--dragging .scrolling-container, [svelte-712365636] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-712365636].dropzone--dragging .dropzone, [svelte-712365636] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-712365636].dropzone--large .dropzone, [svelte-712365636] .dropzone--large .dropzone,\n [svelte-712365636].dropzone--dragging .dropzone--large .dropzone, [svelte-712365636] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-712365636].icon, [svelte-712365636] .icon {\n display: inline-block;\n width: 1em;\n height: 1em;\n stroke-width: 0;\n stroke: currentColor;\n fill: currentColor\n }\n\n [svelte-712365636].clear-content svg, [svelte-712365636] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-712365636].clear-content:hover svg, [svelte-712365636] .clear-content:hover svg {\n fill: #665b68;\n }\n";
17284
+ style.id = "svelte-3393837139-style";
17285
+ style.textContent = "\n section[svelte-3393837139], [svelte-3393837139] section {\n display: flex;\n flex-direction: column;\n padding-left: 20px;\n height: calc(100% - 25px);\n color: #665b68;\n }\n\n a[svelte-3393837139]:focus, [svelte-3393837139] a:focus {\n outline: none;\n }\n\n [svelte-3393837139].error-panel, [svelte-3393837139] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-3393837139].browser-nav, [svelte-3393837139] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-3393837139].blogvio-browser-title, [svelte-3393837139] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px \"ProximaNova-Regular\";\n color: #0055FF;\n }\n\n [svelte-3393837139].nano, [svelte-3393837139] .nano {\n flex: 1;\n }\n\n strong[svelte-3393837139], [svelte-3393837139] strong {\n color: #0055FF;\n }\n\n [svelte-3393837139].dropzone_plchldr, [svelte-3393837139] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-3393837139].dropzone, [svelte-3393837139] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-3393837139].scrolling-container, [svelte-3393837139] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-3393837139].dropzone--dragging .scrolling-container, [svelte-3393837139] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-3393837139].dropzone--dragging .dropzone, [svelte-3393837139] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-3393837139].dropzone--large .dropzone, [svelte-3393837139] .dropzone--large .dropzone,\n [svelte-3393837139].dropzone--dragging .dropzone--large .dropzone, [svelte-3393837139] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-3393837139].icon, [svelte-3393837139] .icon {\n display: inline-block;\n width: 1em;\n height: 1em;\n stroke-width: 0;\n stroke: currentColor;\n fill: currentColor\n }\n\n [svelte-3393837139].clear-content svg, [svelte-3393837139] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-3393837139].clear-content:hover svg, [svelte-3393837139] .clear-content:hover svg {\n fill: #665b68;\n }\n";
17237
17286
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](style, document.head);
17238
17287
  }
17239
17288
 
@@ -17278,7 +17327,7 @@ function create_main_fragment(state, component) {
17278
17327
  },
17279
17328
 
17280
17329
  hydrate: function hydrate(nodes) {
17281
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-712365636', '');
17330
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-3393837139', '');
17282
17331
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'style', "position: absolute; width: 0; height: 0; overflow: hidden");
17283
17332
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'version', "1.1");
17284
17333
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'xmlns', "http://www.w3.org/2000/svg");
@@ -17846,7 +17895,7 @@ function create_if_block_1(state, component) {
17846
17895
  },
17847
17896
 
17848
17897
  hydrate: function hydrate(nodes) {
17849
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-712365636', '');
17898
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-3393837139', '');
17850
17899
  div.className = "error-panel";
17851
17900
  h2.className = "blogvio-browser-title";
17852
17901
  a.href = "#";
@@ -17950,9 +17999,9 @@ function create_if_block_2(state, component) {
17950
17999
  },
17951
18000
 
17952
18001
  hydrate: function hydrate(nodes) {
17953
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-712365636', '');
18002
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-3393837139', '');
17954
18003
  div.className = "browser-nav";
17955
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-712365636', '');
18004
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-3393837139', '');
17956
18005
  section.className = section_class_value = state.dragging ? 'dropzone--dragging' : '';
17957
18006
  div_1.className = div_1_class_value = "dropzone_plchldr " + (!state.files.length ? 'dropzone--large' : '');
17958
18007
  },
@@ -18085,7 +18134,7 @@ function SvelteComponent(options) {
18085
18134
  this._yield = options._yield;
18086
18135
 
18087
18136
  this._torndown = false;
18088
- if (!document.getElementById("svelte-712365636-style")) add_css();
18137
+ if (!document.getElementById("svelte-3393837139-style")) add_css();
18089
18138
  this._renderHooks = [];
18090
18139
 
18091
18140
  this._fragment = create_main_fragment(this._state, this);