@widgetic/editor 3.10.47 → 3.10.49

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.49");
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,37 @@ 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
+ var x = a.lastModified;
17125
+ if (!x) x = 0;
17126
+
17127
+ var y = b.lastModified;
17128
+ if (!y) y = 0;
17129
+
17130
+ // console.log("x & y: ", x, y);
17131
+
17132
+ return x - y;
17133
+ });
17134
+ console.log("uploadedFiles after sort: ", files);
17135
+
17083
17136
  return _this.set({ files: files });
17084
17137
  }).then(this.activate.bind(this)).catch(this._reportError.bind(this)).then(function (_) {
17085
17138
  return _this.set({ loading: false, error: null });
@@ -17134,16 +17187,44 @@ var template = function () {
17134
17187
  this.set({ error: processedError });
17135
17188
  this.fire('error', processedError);
17136
17189
  },
17137
- _onNewUpload: function _onNewUpload() {
17190
+
17191
+
17192
+ /**
17193
+ * DROPZONE HANDLERS
17194
+ */
17195
+
17196
+ _onDropZoneNewUpload: function _onDropZoneNewUpload(event) {
17197
+ console.log("on DropZone New Upload:", event);
17138
17198
  this.refs.scrollPane && this.refs.scrollPane.scrollBottom();
17139
17199
  },
17200
+ _onDropZoneUpload: function _onDropZoneUpload(event) {
17201
+ console.log("on DropZone Upload:", event);
17202
+ this.toggle(event);
17203
+ },
17204
+
17205
+
17206
+ /**
17207
+ * BROWSER HANDLERS
17208
+ */
17209
+
17210
+ _onUpdate: function _onUpdate(event) {
17211
+ // console.log("on Update Content:", event);
17212
+
17213
+ // re-load uploaded files
17214
+ this.refresh();
17215
+ },
17140
17216
  _onUploadComplete: function _onUploadComplete(_ref) {
17141
17217
  var _ref2 = _slicedToArray(_ref, 2),
17142
17218
  file = _ref2[0],
17143
17219
  instanceId = _ref2[1];
17144
17220
 
17221
+ // console.log("on Upload Complete:", file, instanceId);
17222
+
17145
17223
  // toggle the file only if it's upload originated from this instance
17146
17224
  if (instanceId === this.get('instanceId')) this._toggleSelect(file, { afterUpload: true });
17225
+
17226
+ // reload files by upload date
17227
+ // this.refresh();
17147
17228
  }
17148
17229
  }
17149
17230
  };
@@ -17151,8 +17232,8 @@ var template = function () {
17151
17232
 
17152
17233
  function add_css() {
17153
17234
  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";
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";
17156
17237
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](style, document.head);
17157
17238
  }
17158
17239
 
@@ -17165,7 +17246,7 @@ function create_main_fragment(state, component) {
17165
17246
  });
17166
17247
 
17167
17248
  service.on('update', function (event) {
17168
- component.refresh();
17249
+ component._onUpdate(event);
17169
17250
  });
17170
17251
 
17171
17252
  service.on('complete', function (event) {
@@ -17197,7 +17278,7 @@ function create_main_fragment(state, component) {
17197
17278
  },
17198
17279
 
17199
17280
  hydrate: function hydrate(nodes) {
17200
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-268055198', '');
17281
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'svelte-712365636', '');
17201
17282
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'style', "position: absolute; width: 0; height: 0; overflow: hidden");
17202
17283
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'version', "1.1");
17203
17284
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](svg, 'xmlns', "http://www.w3.org/2000/svg");
@@ -17651,7 +17732,8 @@ function create_if_block_9(state, component) {
17651
17732
 
17652
17733
  var scrollpane_1 = new __WEBPACK_IMPORTED_MODULE_1__scroll_pane_html__["a" /* default */]({
17653
17734
  _root: component._root,
17654
- _yield: scrollpane_1_yield_fragment
17735
+ _yield: scrollpane_1_yield_fragment,
17736
+ data: { class: "content-list" }
17655
17737
  });
17656
17738
 
17657
17739
  component.refs.scrollPane = scrollpane_1;
@@ -17764,7 +17846,7 @@ function create_if_block_1(state, component) {
17764
17846
  },
17765
17847
 
17766
17848
  hydrate: function hydrate(nodes) {
17767
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-268055198', '');
17849
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-712365636', '');
17768
17850
  div.className = "error-panel";
17769
17851
  h2.className = "blogvio-browser-title";
17770
17852
  a.href = "#";
@@ -17808,7 +17890,7 @@ function create_if_block_1(state, component) {
17808
17890
  }
17809
17891
 
17810
17892
  function create_if_block_2(state, component) {
17811
- var div, text, section, section_class_value, text_1, div_1, div_1_class_value;
17893
+ var div, text, section, section_class_value, text_1, text_2, div_1, div_1_class_value;
17812
17894
 
17813
17895
  function get_block(state) {
17814
17896
  if (state.deleteMode) return create_if_block_3;
@@ -17836,15 +17918,15 @@ function create_if_block_2(state, component) {
17836
17918
  });
17837
17919
 
17838
17920
  dropzone.on('new', function (event) {
17839
- component._onNewUpload();
17921
+ component._onDropZoneNewUpload(event);
17840
17922
  });
17841
17923
 
17842
- dropzone.on('dragging', function (event) {
17843
- component.set({ dragging: event });
17924
+ dropzone.on('upload', function (event) {
17925
+ component._onDropZoneUpload(event);
17844
17926
  });
17845
17927
 
17846
- dropzone.on('upload', function (event) {
17847
- component.toggle(event);
17928
+ dropzone.on('dragging', function (event) {
17929
+ component.set({ dragging: event });
17848
17930
  });
17849
17931
 
17850
17932
  dropzone.on('error', function (event) {
@@ -17859,17 +17941,18 @@ function create_if_block_2(state, component) {
17859
17941
  if_block_2.create();
17860
17942
  text = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n ");
17861
17943
  section = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('section');
17944
+ text_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n ");
17862
17945
  if_block_6.create();
17863
- text_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n\n ");
17946
+ text_2 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["g" /* createText */]("\n\n \n ");
17864
17947
  div_1 = __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["e" /* createElement */]('div');
17865
17948
  dropzone._fragment.create();
17866
17949
  this.hydrate();
17867
17950
  },
17868
17951
 
17869
17952
  hydrate: function hydrate(nodes) {
17870
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-268055198', '');
17953
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](div, 'svelte-712365636', '');
17871
17954
  div.className = "browser-nav";
17872
- __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-268055198', '');
17955
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["p" /* setAttribute */](section, 'svelte-712365636', '');
17873
17956
  section.className = section_class_value = state.dragging ? 'dropzone--dragging' : '';
17874
17957
  div_1.className = div_1_class_value = "dropzone_plchldr " + (!state.files.length ? 'dropzone--large' : '');
17875
17958
  },
@@ -17879,8 +17962,9 @@ function create_if_block_2(state, component) {
17879
17962
  if_block_2.mount(div, null);
17880
17963
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["l" /* insertNode */](text, target, anchor);
17881
17964
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["l" /* insertNode */](section, target, anchor);
17882
- if_block_6.mount(section, null);
17883
17965
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](text_1, section);
17966
+ if_block_6.mount(section, null);
17967
+ __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](text_2, section);
17884
17968
  __WEBPACK_IMPORTED_MODULE_4_svelte_shared_js__["b" /* appendNode */](div_1, section);
17885
17969
  dropzone._fragment.mount(div_1, null);
17886
17970
  },
@@ -17907,7 +17991,7 @@ function create_if_block_2(state, component) {
17907
17991
  if_block_6.destroy();
17908
17992
  if_block_6 = current_block_1(state, component);
17909
17993
  if_block_6.create();
17910
- if_block_6.mount(section, text_1);
17994
+ if_block_6.mount(section, text_2);
17911
17995
  }
17912
17996
 
17913
17997
  if (div_1_class_value !== (div_1_class_value = "dropzone_plchldr " + (!state.files.length ? 'dropzone--large' : ''))) {
@@ -18001,7 +18085,7 @@ function SvelteComponent(options) {
18001
18085
  this._yield = options._yield;
18002
18086
 
18003
18087
  this._torndown = false;
18004
- if (!document.getElementById("svelte-268055198-style")) add_css();
18088
+ if (!document.getElementById("svelte-712365636-style")) add_css();
18005
18089
  this._renderHooks = [];
18006
18090
 
18007
18091
  this._fragment = create_main_fragment(this._state, this);