@widgetic/editor 3.10.47 → 3.10.48

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
@@ -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.47");
13350
+ this.el.attr('editorVersion', "3.10.48");
13351
13351
  }
13352
13352
 
13353
13353
 
@@ -16658,6 +16658,7 @@ var File = function File(options) {
16658
16658
  };
16659
16659
 
16660
16660
  File.defaults = {
16661
+ lastModified: undefined,
16661
16662
  state: 'complete',
16662
16663
  thumbnail: undefined,
16663
16664
  url: undefined,
@@ -16728,6 +16729,7 @@ var UploadService = function (_EventsMixin) {
16728
16729
  }));
16729
16730
 
16730
16731
  return this._fetch(type).then(function (files) {
16732
+ // console.log('fetched files:', files)
16731
16733
  return _this2.files.push.apply(_this2.files, files);
16732
16734
  }).then(this._broadcast.update).then(function (_) {
16733
16735
  return _this2.files.filter(function (f) {
@@ -16745,11 +16747,14 @@ var UploadService = function (_EventsMixin) {
16745
16747
  }, {
16746
16748
  key: 'upload',
16747
16749
  value: function upload(uploadFile) {
16750
+ // console.log("upload file:", uploadFile);
16751
+
16748
16752
  this.files.push(new File({
16749
16753
  state: 'new',
16750
16754
  size: uploadFile.size,
16751
16755
  name: uploadFile.name,
16752
16756
  type: parseType(uploadFile.type),
16757
+ // lastModified: uploadFile.lastModified,
16753
16758
  uploadFile: uploadFile
16754
16759
  }));
16755
16760
  this.used += uploadFile.size;
@@ -16758,9 +16763,12 @@ var UploadService = function (_EventsMixin) {
16758
16763
  }, {
16759
16764
  key: 'uploadComplete',
16760
16765
  value: function uploadComplete(uploadFile, instanceId) {
16766
+ // console.log("uploadComplete file:", uploadFile);
16761
16767
  if (uploadFile.status === 'error') return;
16762
- var response = JSON.parse(uploadFile.xhr.response);
16763
16768
 
16769
+ // read metadata(id here) from the file that's on the server
16770
+ var response = JSON.parse(uploadFile.xhr.response);
16771
+ // console.log("uploadComplete file on the server:", response.files.data[0])
16764
16772
  var id = response.files.data[0].id;
16765
16773
 
16766
16774
  // read quota from response
@@ -16772,6 +16780,7 @@ var UploadService = function (_EventsMixin) {
16772
16780
  f.id = id;
16773
16781
  f.path = response.files.data[0].path;
16774
16782
  f.url = response.hostUrl + f.path;
16783
+ // f.lastModified = uploadFile.lastModified;
16775
16784
  });
16776
16785
 
16777
16786
  this._broadcast.complete([this.get(id), instanceId]);
@@ -16846,6 +16855,7 @@ var UploadService = function (_EventsMixin) {
16846
16855
  url: '/upload/?user=' + this.user + '&type=' + type,
16847
16856
  headers: this.getAuthHeaders()
16848
16857
  }).then(function (response) {
16858
+ // console.log("fetched files response:", response);
16849
16859
  _this3.refreshed[type] = true;
16850
16860
 
16851
16861
  // read quota from response
@@ -16853,10 +16863,14 @@ var UploadService = function (_EventsMixin) {
16853
16863
  _this3.used = response.quota.used;
16854
16864
 
16855
16865
  return response.files.data.map(function (file) {
16866
+
16867
+ // console.log("fetched file:", file);
16868
+
16856
16869
  var type = parseType(file.mime);
16857
16870
  var url = response.hostUrl + file.path;
16858
16871
  var thumbnail = type === 'image' ? url : undefined;
16859
16872
 
16873
+ // return a new File instance
16860
16874
  return new File({
16861
16875
  id: file.id,
16862
16876
  type: type,
@@ -16864,7 +16878,8 @@ var UploadService = function (_EventsMixin) {
16864
16878
  thumbnail: thumbnail,
16865
16879
  path: file.path,
16866
16880
  name: file.name,
16867
- size: file.size
16881
+ size: file.size,
16882
+ lastModified: file.lastModified
16868
16883
  });
16869
16884
  });
16870
16885
  });
@@ -17054,6 +17069,8 @@ var template = function () {
17054
17069
  oncreate: function oncreate() {
17055
17070
  this.Uploads = this.refs.Uploads.instance();
17056
17071
  this.set({ maxFilesize: this.Uploads.getMaxFileSize() });
17072
+
17073
+ // load uploaded files
17057
17074
  this.refresh();
17058
17075
  },
17059
17076
  ondestroy: function ondestroy() {
@@ -17062,7 +17079,15 @@ var template = function () {
17062
17079
 
17063
17080
 
17064
17081
  methods: {
17082
+
17083
+ /**
17084
+ * CONTENT LIST HANDLERS
17085
+ */
17086
+
17087
+ // on selecting a file square
17065
17088
  toggle: function toggle(file) {
17089
+ console.log("on toggle file:", file);
17090
+
17066
17091
  if (file.error) {
17067
17092
  this.Uploads.remove(file);
17068
17093
  return this.refresh();
@@ -17077,9 +17102,29 @@ var template = function () {
17077
17102
  refresh: function refresh(ev) {
17078
17103
  var _this = this;
17079
17104
 
17105
+ console.log("refreshing...");
17080
17106
  if (ev) ev.preventDefault();
17081
17107
 
17082
17108
  return this.Uploads.getFiles(this.get('filetypes')).then(function (files) {
17109
+ // console.log("uploadedFiles: ", files);
17110
+
17111
+ // sort files by id
17112
+ // files = files.sort((a, b) => {
17113
+ // // console.log("a & b: ", a.id, b.id);
17114
+ // if(!a.id.indexOf) return -1;
17115
+ // let noIdA = a.id.substr(a.id.indexOf('_t')+2, 4);
17116
+ // let noIdB = b.id.substr(a.id.indexOf('_t')+2, 4);
17117
+ // // console.log("noIdA & noIdB: ", noIdA, noIdB, (noIdA >= noIdB));
17118
+ // return noIdA - noIdB;
17119
+ // });
17120
+ // console.log("uploadedFiles after sort: ", files);
17121
+
17122
+ // sort files by last modified date
17123
+ files = files.sort(function (a, b) {
17124
+ return a.lastModified - b.lastModified;
17125
+ });
17126
+ console.log("uploadedFiles after sort: ", files);
17127
+
17083
17128
  return _this.set({ files: files });
17084
17129
  }).then(this.activate.bind(this)).catch(this._reportError.bind(this)).then(function (_) {
17085
17130
  return _this.set({ loading: false, error: null });
@@ -17134,16 +17179,44 @@ var template = function () {
17134
17179
  this.set({ error: processedError });
17135
17180
  this.fire('error', processedError);
17136
17181
  },
17137
- _onNewUpload: function _onNewUpload() {
17182
+
17183
+
17184
+ /**
17185
+ * DROPZONE HANDLERS
17186
+ */
17187
+
17188
+ _onDropZoneNewUpload: function _onDropZoneNewUpload(event) {
17189
+ console.log("on DropZone New Upload:", event);
17138
17190
  this.refs.scrollPane && this.refs.scrollPane.scrollBottom();
17139
17191
  },
17192
+ _onDropZoneUpload: function _onDropZoneUpload(event) {
17193
+ console.log("on DropZone Upload:", event);
17194
+ this.toggle(event);
17195
+ },
17196
+
17197
+
17198
+ /**
17199
+ * BROWSER HANDLERS
17200
+ */
17201
+
17202
+ _onUpdate: function _onUpdate(event) {
17203
+ console.log("on Update Content:", event);
17204
+
17205
+ // re-load uploaded files
17206
+ this.refresh();
17207
+ },
17140
17208
  _onUploadComplete: function _onUploadComplete(_ref) {
17141
17209
  var _ref2 = _slicedToArray(_ref, 2),
17142
17210
  file = _ref2[0],
17143
17211
  instanceId = _ref2[1];
17144
17212
 
17213
+ console.log("on Upload Complete:", file, instanceId);
17214
+
17145
17215
  // toggle the file only if it's upload originated from this instance
17146
17216
  if (instanceId === this.get('instanceId')) this._toggleSelect(file, { afterUpload: true });
17217
+
17218
+ // sort files by upload date
17219
+ // this.refresh();
17147
17220
  }
17148
17221
  }
17149
17222
  };
@@ -17151,8 +17224,8 @@ var template = function () {
17151
17224
 
17152
17225
  function add_css() {
17153
17226
  var style = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('style');
17154
- style.id = "svelte-268055198-style";
17155
- style.textContent = "\n section[svelte-268055198], [svelte-268055198] 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-268055198]:focus, [svelte-268055198] a:focus {\n outline: none;\n }\n\n [svelte-268055198].error-panel, [svelte-268055198] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-268055198].browser-nav, [svelte-268055198] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-268055198].blogvio-browser-title, [svelte-268055198] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px \"ProximaNova-Regular\";\n color: #0055FF;\n }\n\n [svelte-268055198].nano, [svelte-268055198] .nano {\n flex: 1;\n }\n\n strong[svelte-268055198], [svelte-268055198] strong {\n color: #0055FF;\n }\n\n [svelte-268055198].dropzone_plchldr, [svelte-268055198] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-268055198].dropzone, [svelte-268055198] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-268055198].scrolling-container, [svelte-268055198] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-268055198].dropzone--dragging .scrolling-container, [svelte-268055198] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-268055198].dropzone--dragging .dropzone, [svelte-268055198] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-268055198].dropzone--large .dropzone, [svelte-268055198] .dropzone--large .dropzone,\n [svelte-268055198].dropzone--dragging .dropzone--large .dropzone, [svelte-268055198] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-268055198].icon, [svelte-268055198] .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-268055198].clear-content svg, [svelte-268055198] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-268055198].clear-content:hover svg, [svelte-268055198] .clear-content:hover svg {\n fill: #665b68;\n }\n";
17227
+ style.id = "svelte-1522966996-style";
17228
+ style.textContent = "\n section[svelte-1522966996], [svelte-1522966996] 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-1522966996]:focus, [svelte-1522966996] a:focus {\n outline: none;\n }\n\n [svelte-1522966996].error-panel, [svelte-1522966996] .error-panel {\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n text-align: center;\n padding-right: 20px;\n }\n\n [svelte-1522966996].browser-nav, [svelte-1522966996] .browser-nav {\n position: static;\n\n font-family: ProximaNova-Regular;\n font-size: 16px;\n color: #0055FF;\n }\n\n [svelte-1522966996].blogvio-browser-title, [svelte-1522966996] .blogvio-browser-title {\n margin-top: 0;\n font: 30px/60px \"ProximaNova-Regular\";\n color: #0055FF;\n }\n\n [svelte-1522966996].nano, [svelte-1522966996] .nano {\n flex: 1;\n }\n\n strong[svelte-1522966996], [svelte-1522966996] strong {\n color: #0055FF;\n }\n\n [svelte-1522966996].dropzone_plchldr, [svelte-1522966996] .dropzone_plchldr {\n position: relative;\n margin: 20px 20px 20px 0;\n height: 75px;\n }\n\n [svelte-1522966996].dropzone, [svelte-1522966996] .dropzone {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n [svelte-1522966996].scrolling-container, [svelte-1522966996] .scrolling-container {\n transition: opacity 200ms ease-in;\n }\n\n [svelte-1522966996].dropzone--dragging .scrolling-container, [svelte-1522966996] .dropzone--dragging .scrolling-container {\n opacity: 0.4;\n }\n\n [svelte-1522966996].dropzone--dragging .dropzone, [svelte-1522966996] .dropzone--dragging .dropzone {\n top: -100px;\n }\n\n [svelte-1522966996].dropzone--large .dropzone, [svelte-1522966996] .dropzone--large .dropzone,\n [svelte-1522966996].dropzone--dragging .dropzone--large .dropzone, [svelte-1522966996] .dropzone--dragging .dropzone--large .dropzone {\n top: -200px;\n }\n\n [svelte-1522966996].icon, [svelte-1522966996] .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-1522966996].clear-content svg, [svelte-1522966996] .clear-content svg {\n width: 14px;\n fill: #a0a0a0;\n position: relative;\n top: 1px;\n right: 2px;\n }\n\n [svelte-1522966996].clear-content:hover svg, [svelte-1522966996] .clear-content:hover svg {\n fill: #665b68;\n }\n";
17156
17229
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](style, document.head);
17157
17230
  }
17158
17231
 
@@ -17165,7 +17238,7 @@ function create_main_fragment(state, component) {
17165
17238
  });
17166
17239
 
17167
17240
  service.on('update', function (event) {
17168
- component.refresh();
17241
+ component._onUpdate(event);
17169
17242
  });
17170
17243
 
17171
17244
  service.on('complete', function (event) {
@@ -17197,7 +17270,7 @@ function create_main_fragment(state, component) {
17197
17270
  },
17198
17271
 
17199
17272
  hydrate: function hydrate(nodes) {
17200
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-268055198', '');
17273
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-1522966996', '');
17201
17274
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'style', "position: absolute; width: 0; height: 0; overflow: hidden");
17202
17275
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'version', "1.1");
17203
17276
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'xmlns', "http://www.w3.org/2000/svg");
@@ -17651,7 +17724,8 @@ function create_if_block_9(state, component) {
17651
17724
 
17652
17725
  var scrollpane_1 = new __WEBPACK_IMPORTED_MODULE_1__scroll_pane_html__["a" /* default */]({
17653
17726
  _root: component._root,
17654
- _yield: scrollpane_1_yield_fragment
17727
+ _yield: scrollpane_1_yield_fragment,
17728
+ data: { class: "content-list" }
17655
17729
  });
17656
17730
 
17657
17731
  component.refs.scrollPane = scrollpane_1;
@@ -17764,7 +17838,7 @@ function create_if_block_1(state, component) {
17764
17838
  },
17765
17839
 
17766
17840
  hydrate: function hydrate(nodes) {
17767
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-268055198', '');
17841
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-1522966996', '');
17768
17842
  div.className = "error-panel";
17769
17843
  h2.className = "blogvio-browser-title";
17770
17844
  a.href = "#";
@@ -17808,7 +17882,7 @@ function create_if_block_1(state, component) {
17808
17882
  }
17809
17883
 
17810
17884
  function create_if_block_2(state, component) {
17811
- var div, text, section, section_class_value, text_1, div_1, div_1_class_value;
17885
+ var div, text, section, section_class_value, text_1, text_2, div_1, div_1_class_value;
17812
17886
 
17813
17887
  function get_block(state) {
17814
17888
  if (state.deleteMode) return create_if_block_3;
@@ -17836,15 +17910,15 @@ function create_if_block_2(state, component) {
17836
17910
  });
17837
17911
 
17838
17912
  dropzone.on('new', function (event) {
17839
- component._onNewUpload();
17913
+ component._onDropZoneNewUpload(event);
17840
17914
  });
17841
17915
 
17842
- dropzone.on('dragging', function (event) {
17843
- component.set({ dragging: event });
17916
+ dropzone.on('upload', function (event) {
17917
+ component._onDropZoneUpload(event);
17844
17918
  });
17845
17919
 
17846
- dropzone.on('upload', function (event) {
17847
- component.toggle(event);
17920
+ dropzone.on('dragging', function (event) {
17921
+ component.set({ dragging: event });
17848
17922
  });
17849
17923
 
17850
17924
  dropzone.on('error', function (event) {
@@ -17859,17 +17933,18 @@ function create_if_block_2(state, component) {
17859
17933
  if_block_2.create();
17860
17934
  text = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n ");
17861
17935
  section = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('section');
17936
+ text_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n ");
17862
17937
  if_block_6.create();
17863
- text_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n\n ");
17938
+ text_2 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n\n \n ");
17864
17939
  div_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('div');
17865
17940
  dropzone._fragment.create();
17866
17941
  this.hydrate();
17867
17942
  },
17868
17943
 
17869
17944
  hydrate: function hydrate(nodes) {
17870
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-268055198', '');
17945
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-1522966996', '');
17871
17946
  div.className = "browser-nav";
17872
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-268055198', '');
17947
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-1522966996', '');
17873
17948
  section.className = section_class_value = state.dragging ? 'dropzone--dragging' : '';
17874
17949
  div_1.className = div_1_class_value = "dropzone_plchldr " + (!state.files.length ? 'dropzone--large' : '');
17875
17950
  },
@@ -17879,8 +17954,9 @@ function create_if_block_2(state, component) {
17879
17954
  if_block_2.mount(div, null);
17880
17955
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["l" /* insertNode */](text, target, anchor);
17881
17956
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["l" /* insertNode */](section, target, anchor);
17882
- if_block_6.mount(section, null);
17883
17957
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](text_1, section);
17958
+ if_block_6.mount(section, null);
17959
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](text_2, section);
17884
17960
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](div_1, section);
17885
17961
  dropzone._fragment.mount(div_1, null);
17886
17962
  },
@@ -17907,7 +17983,7 @@ function create_if_block_2(state, component) {
17907
17983
  if_block_6.destroy();
17908
17984
  if_block_6 = current_block_1(state, component);
17909
17985
  if_block_6.create();
17910
- if_block_6.mount(section, text_1);
17986
+ if_block_6.mount(section, text_2);
17911
17987
  }
17912
17988
 
17913
17989
  if (div_1_class_value !== (div_1_class_value = "dropzone_plchldr " + (!state.files.length ? 'dropzone--large' : ''))) {
@@ -18001,7 +18077,7 @@ function SvelteComponent(options) {
18001
18077
  this._yield = options._yield;
18002
18078
 
18003
18079
  this._torndown = false;
18004
- if (!document.getElementById("svelte-268055198-style")) add_css();
18080
+ if (!document.getElementById("svelte-1522966996-style")) add_css();
18005
18081
  this._renderHooks = [];
18006
18082
 
18007
18083
  this._fragment = create_main_fragment(this._state, this);