Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
events: {
'froalaEditor.initialized' () {
console.log('froalaEditor.initialized')
}
},
language: 'pt_br',
imagePaste: true,
charCounterCount: true,
placeholderText: 'test',
toolbarStickyOffset: 50,
height: this.getAppHeight - 200,
imageManagerPageSize: 20,
imageManagerLoadURL: URL_IMAGE_MANAGER,
imageUploadURL: URL_IMAGE_UPLOAD,
imageUploadParams: {
uid: uid(),
type: 'image'
},
// toolbarButtons: [
// 'undo', 'redo', '|',
// 'bold', 'italic', 'underline', 'strikeThrough', 'paragraphFormat', '|',
// 'subscript', 'superscript', '|',
// 'outdent', 'indent', '|',
// 'formatOL', 'formatUL', 'insertTable', 'insertLink', 'insertImage', '|',
// 'clearFormatting', 'html'
// ],
toolbarButtonsXS: ['undo', 'redo', '-', 'bold', 'italic', 'underline']
}
}),
extends: FieldAbstract,
export const logout = function() {
resetLoginInfo()
Notify.create({
message: 'You have been logged out.',
type: 'info'
})
// @todo check if current route is !== from login then go to login else do nothing
console.info('compare the location.href with / if different then push / to router, check that you dont loop infinitly')
if (location.hash.replace('#/', '/') !== '/') {
router.push('/')
}
}
created() {
const defaultUser = {
user: {
username: 'inconnu'
}
}
this.user = defaultUser
if (typeof localStorage == 'undefined') {
Notify.create({
message: `No localStorage feature available in the browser`,
type: 'warning'
})
}
IsLoggedInObservable.subscribe(isLoggedIn => {
if (!isLoggedIn
|| !isLoggedIn.me) {
this.user = defaultUser
} else {
this.user = isLoggedIn.me
}
this.isLoading = false
}, err => {
// @todo we may have different message belongs to err
Notify.create({
updateTransition (from, to) {
this.key = uid()
if (from === to) {
this.transition = ''
return
}
const fromDepth = String(from).split('/').length
const toDepth = String(to).split('/').length
this.transition = toDepth < fromDepth ? 'slide-right' : 'slide-left'
}
},
.then(res => {
Notify.create({
message: `Invalid token, please try again`,
type: 'warning'
})
})
.catch(err => console.warn('axios middleware CsrfTokenRetreiveOnInvalidResponse', 'getToken', err))
onError(({ networkError }) => {
if (423 === networkError.statusCode) {
getToken()
.then(res => Toast.create.warning(`Invalid token, please try again`))
.catch(err => console.warn('apollo onError', 'getToken', err))
} else {
console.warn(`Unknown error ${networkError.statusCode}`, networkError)
Notify.create({
message: `Unknown error ${networkError.statusCode}`,
type: 'warning'
})
}
})
'$route' (to, from) {
Events.$emit('app.route.update', from.path, to.path)
}
},
const toNext = (to, next, path = '') => {
Events.$emit('app.route.before', to, path)
if (path) {
return next(path)
}
next()
}
export function setupDateForPersianDate (date) {
if (isString(date)) {
let dd = date.substring(0, 19).replace('T', ' ')
if (rePersianDateTimeStr.exec(dd) !== null) {
let datetime = dd.replace(rePersianDateTimeStr, function (match, text) {
return match.split('-').join('/')
}).substring(0, 19).split(' ')
datetime[1] = (typeof datetime[1] !== 'undefined') ? datetime[1] : '00:00:00'
date = datetime[0].split('/').concat(datetime[1].split(':')).map(Number)
}
}
return date
}
toggleFullscreen () {
if (AppFullscreen.isActive()) {
AppFullscreen.exit()
}
else {
AppFullscreen.request()
}
}
},