-
Notifications
You must be signed in to change notification settings - Fork 38
Added loading svg prior to init #71
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,30 @@ function PopcornEditor() { | |
|
|
||
| this.init = function (el, url) { | ||
| var editor = (typeof el === 'string') ? document.getElementById(el) : el, | ||
| url = url || 'PopcornEditor/editor.html'; | ||
| url = url || 'PopcornEditor/editor.html', | ||
| loadingDiv = null, | ||
| loadingSpinner = null; | ||
|
|
||
| window.addEventListener('message', onmessage); | ||
| this.listen('loaded', function () { | ||
| document.querySelector('#loading').remove(); | ||
| }); | ||
|
|
||
| loadingDiv = document.createElement('div'); | ||
| loadingDiv.setAttribute('id', 'loading'); | ||
| loadingDiv.style.width = '100%'; | ||
| loadingDiv.style.height = '100%'; | ||
| loadingDiv.style.backgroundColor = 'white'; | ||
| loadingDiv.style.display = 'flex'; | ||
| loadingDiv.style.justifyContent = 'center'; | ||
|
|
||
| loadingSpinner = document.createElement('img'); | ||
| loadingSpinner.setAttribute('class', 'loading-spinner'); | ||
| loadingSpinner.setAttribute('src', 'PopcornEditor/resources/ring-alt.svg'); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sanity check here: is this the proper way we should read resources from the library outside of the iframe?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'm a bit confused. This is how I see it atm:
If the stuff inside Otherwise, ¯_(ツ)_/¯ sure! This makes sense. |
||
| loadingSpinner.style.width = '30%'; | ||
|
|
||
| loadingDiv.appendChild(loadingSpinner); | ||
| editor.appendChild(loadingDiv); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about putting this in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same goes for above. |
||
|
|
||
| this.iframe = document.createElement('iframe'), | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it meshes with the architecture you're thinking here, I'd put this in
index.htmlor some css file, just to be clean.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index.htmlis just meant to be a an example though correct?