IE11 support updates (#18)
* IE11 support updates * Fix Object.values IE11 support * forEach * Object.values * Array.includes
This commit is contained in:
parent
3c2516a158
commit
052afdeb10
5 changed files with 19 additions and 10 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 0.2.9 - 2018-05-30
|
||||||
|
|
||||||
|
* IE11 support updates
|
||||||
|
|
||||||
## 0.2.8 - 2018-05-29
|
## 0.2.8 - 2018-05-29
|
||||||
|
|
||||||
* Use imgix auto=format for automatic webp conversion
|
* Use imgix auto=format for automatic webp conversion
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@
|
||||||
<script>
|
<script>
|
||||||
// check for netlifyIdentity, redirect to admin if user is logging in
|
// check for netlifyIdentity, redirect to admin if user is logging in
|
||||||
if (window.localStorage && window.netlifyIdentity) {
|
if (window.localStorage && window.netlifyIdentity) {
|
||||||
netlifyIdentity.on('init', user => {
|
netlifyIdentity.on('init', function (user) {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
netlifyIdentity.on('login', () => {
|
netlifyIdentity.on('login', function () {
|
||||||
document.location.href = '/admin/'
|
document.location.href = '/admin/'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class Form extends Component {
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
if (!this.form) return
|
if (!this.form) return
|
||||||
this.inputs = this.form.querySelectorAll('input, textarea')
|
this.inputs = [...this.form.querySelectorAll('input, textarea')]
|
||||||
this.addListeners()
|
this.addListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
/* global URL, fetch, Event */
|
/* global URL, fetch, Event */
|
||||||
|
|
||||||
const swReady = new Event('swReady')
|
|
||||||
const swUpdated = new Event('swUpdated')
|
|
||||||
const swOffline = new Event('swOffline')
|
|
||||||
|
|
||||||
// In production, we register a service worker to serve assets from local cache.
|
// In production, we register a service worker to serve assets from local cache.
|
||||||
|
|
||||||
// This lets the app load faster on subsequent visits in production, and gives
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
|
@ -24,9 +20,16 @@ const isLocalhost = Boolean(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let swReady, swUpdated, swOffline
|
||||||
|
|
||||||
export default function register () {
|
export default function register () {
|
||||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||||
// The URL constructor is available in all browsers that support SW.
|
// The URL constructor is available in all browsers that support SW.
|
||||||
|
|
||||||
|
swReady = new Event('swReady')
|
||||||
|
swUpdated = new Event('swUpdated')
|
||||||
|
swOffline = new Event('swOffline')
|
||||||
|
|
||||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location)
|
const publicUrl = new URL(process.env.PUBLIC_URL, window.location)
|
||||||
if (publicUrl.origin !== window.location.origin) {
|
if (publicUrl.origin !== window.location.origin) {
|
||||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import _uniq from 'lodash/uniq'
|
import _uniq from 'lodash/uniq'
|
||||||
import _kebabCase from 'lodash/kebabCase'
|
import _kebabCase from 'lodash/kebabCase'
|
||||||
|
import _values from 'lodash/values'
|
||||||
|
import _includes from 'lodash/includes'
|
||||||
|
|
||||||
export const getCollectionTerms = (
|
export const getCollectionTerms = (
|
||||||
collection = [],
|
collection = [],
|
||||||
|
|
@ -18,7 +20,7 @@ export const getCollectionTerms = (
|
||||||
const collectionItemTerms =
|
const collectionItemTerms =
|
||||||
typeof termField === 'string'
|
typeof termField === 'string'
|
||||||
? termField.split(',').map(term => _kebabCase(term.trim()))
|
? termField.split(',').map(term => _kebabCase(term.trim()))
|
||||||
: termField.map(term => _kebabCase(Object.values(term)[0]))
|
: termField.map(term => _kebabCase(_values(term)[0]))
|
||||||
return _uniq([...acc, ...collectionItemTerms])
|
return _uniq([...acc, ...collectionItemTerms])
|
||||||
}, [])
|
}, [])
|
||||||
.sort()
|
.sort()
|
||||||
|
|
@ -32,7 +34,7 @@ export const documentHasTerm = (doc, taxonomyName, term) => {
|
||||||
const terms =
|
const terms =
|
||||||
typeof termField === 'string'
|
typeof termField === 'string'
|
||||||
? termField.split(',').map(term => _kebabCase(term))
|
? termField.split(',').map(term => _kebabCase(term))
|
||||||
: termField.map(term => _kebabCase(Object.values(term)[0]))
|
: termField.map(term => _kebabCase(_values(term)[0]))
|
||||||
|
|
||||||
return terms.includes(_kebabCase(term))
|
return _includes(terms, _kebabCase(term))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue