frayerjj-frontend 0.1.38 → 0.1.40

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/init.js +27 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frayerjj-frontend",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "My base frontend for various projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/init.js CHANGED
@@ -18,6 +18,8 @@ export const init = () => {
18
18
  window.ajax = ajax;
19
19
  window.session = session;
20
20
  window.validate = validate;
21
+ window.loading = loading;
22
+ window.editors = [];
21
23
 
22
24
  class CkeUploadAdapter {
23
25
  constructor(loader, uri, token) {
@@ -150,31 +152,33 @@ export const init = () => {
150
152
  }
151
153
  });
152
154
 
153
-
154
- window.editors = [];
155
155
  document.querySelectorAll('.wysiwyg').forEach(el => {
156
- ClassicEditor.create(el, {
157
- licenseKey: 'GPL',
158
- htmlSupport: {
159
- allow: [
160
- {
161
- name: /.*/,
162
- attributes: true,
163
- classes: true,
164
- styles: true
156
+ if (window.ClassicEditor) {
157
+ window.ClassicEditor.create(el, {
158
+ licenseKey: 'GPL',
159
+ htmlSupport: {
160
+ allow: [
161
+ {
162
+ name: /.*/,
163
+ attributes: true,
164
+ classes: true,
165
+ styles: true
166
+ }
167
+ ]
168
+ },
169
+ ckfinder: {
170
+ uploadUrl: document.querySelector('meta[name="asset-upload"]').getAttribute('content'),
171
+ headers: {
172
+ 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
165
173
  }
166
- ]
167
- },
168
- extraParams: {
169
- uri: document.querySelector('meta[name="asset-upload"]').getAttribute('content'),
170
- token: document.querySelector('meta[name="csrf-token"]').getAttribute('content')
171
- },
172
- extraPlugins: [ CkeUploadAdapterPlugin ]
173
- }).then(editor => {
174
- window.editors[el.id] = editor;
175
- }).catch( error => {
176
- console.error( 'There was a problem initializing the editor.', error );
177
- });
174
+ },
175
+ extraPlugins: [ window.CkeUploadAdapterPlugin ]
176
+ }).then(editor => {
177
+ window.editors[el.id] = editor;
178
+ }).catch( error => {
179
+ console.error( 'There was a problem initializing the editor.', error );
180
+ });
181
+ } else message.warn('CKEditor not loaded.');
178
182
  });
179
183
 
180
184
  });