Browse Source

Fix editors insert + Error pages styling

pull/73/head
NGPixel 7 years ago
parent
commit
67bd4acdeb
9 changed files with 67728 additions and 32 deletions
  1. 67695
      assets/js/bundle.min.js
  2. 3
      client/index.js
  3. 2
      client/js/app.js
  4. 1
      client/js/components/editor-image.js
  5. 16
      client/js/components/editor.js
  6. 22
      client/js/pages/create.js
  7. 7
      views/error-forbidden.pug
  8. 7
      views/error-notexist.pug
  9. 7
      views/error.pug

67695
assets/js/bundle.min.js
File diff suppressed because it is too large
View File

3
client/index.js

@ -3,6 +3,9 @@
let logic = document.documentElement.dataset.logic
switch (logic) {
case 'error':
require('./scss/error.scss')
break
case 'login':
require('./scss/login.scss')
require('./js/login.js')

2
client/js/app.js

@ -54,7 +54,7 @@ $(() => {
// ====================================
require('./pages/view.js')(alerts)
// require('./pages/create.js')
require('./pages/create.js')(alerts, socket)
require('./pages/edit.js')(alerts, socket)
require('./pages/source.js')(alerts)
require('./pages/admin.js')(alerts)

1
client/js/components/editor-image.js

@ -51,6 +51,7 @@ module.exports = (alerts, mde, mdeModalOpenState, socket) => {
vueImage.currentImage = imageId
},
insertImage: (ev) => {
console.log(mde)
if (mde.codemirror.doc.somethingSelected()) {
mde.codemirror.execCommand('singleSelection')
}

16
client/js/components/editor.js

@ -16,14 +16,13 @@ module.exports = (alerts, pageEntryPath, socket) => {
return _.toUpper(filesize(v))
})
let mde
let mdeModalOpenState = false
let vueImage = require('./editor-image.js')(alerts, mde, mdeModalOpenState, socket)
let vueFile = require('./editor-file.js')(alerts, mde, mdeModalOpenState, socket)
let vueVideo = require('./editor-video.js')(mde, mdeModalOpenState)
let vueCodeBlock = require('./editor-codeblock.js')(mde, mdeModalOpenState)
let vueImage
let vueFile
let vueVideo
let vueCodeBlock
mde = new SimpleMDE({
let mde = new SimpleMDE({
autofocus: true,
autoDownloadFontAwesome: false,
element: $('#mk-editor').get(0),
@ -185,6 +184,11 @@ module.exports = (alerts, pageEntryPath, socket) => {
}
})
vueImage = require('./editor-image.js')(alerts, mde, mdeModalOpenState, socket)
vueFile = require('./editor-file.js')(alerts, mde, mdeModalOpenState, socket)
vueVideo = require('./editor-video.js')(mde, mdeModalOpenState)
vueCodeBlock = require('./editor-codeblock.js')(mde, mdeModalOpenState)
// -> Save
let saveCurrentDocument = (ev) => {

22
client/js/pages/create.js

@ -1,15 +1,17 @@
/* global $ */
'use strict'
if ($('#page-type-create').length) {
let pageEntryPath = $('#page-type-create').data('entrypath') // eslint-disable-line no-unused-vars
import $ from 'jquery'
// -> Discard
module.exports = (alerts, socket) => {
if ($('#page-type-create').length) {
let pageEntryPath = $('#page-type-create').data('entrypath')
$('.btn-create-discard').on('click', (ev) => {
$('#modal-create-discard').toggleClass('is-active')
})
// -> Discard
/* eslint-disable spaced-comment */
//=include ../components/editor.js
/* eslint-enable spaced-comment */
$('.btn-create-discard').on('click', (ev) => {
$('#modal-create-discard').toggleClass('is-active')
})
require('../components/editor.js')(alerts, pageEntryPath, socket)
}
}

7
views/error-forbidden.pug

@ -1,5 +1,5 @@
doctype html
html
html(data-logic='error')
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
@ -17,9 +17,8 @@ html
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
// CSS
link(type='text/css', rel='stylesheet', href='/css/libs.css')
link(type='text/css', rel='stylesheet', href='/css/error.css')
// JS / CSS
script(type='text/javascript', src='/js/bundle.min.js')
body(class='is-forbidden')
.container

7
views/error-notexist.pug

@ -1,5 +1,5 @@
doctype html
html
html(data-logic='error')
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
@ -17,9 +17,8 @@ html
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
// CSS
link(type='text/css', rel='stylesheet', href='/css/libs.css')
link(type='text/css', rel='stylesheet', href='/css/error.css')
// JS / CSS
script(type='text/javascript', src='/js/bundle.min.js')
body(class='is-notexist')
.container

7
views/error.pug

@ -1,5 +1,5 @@
doctype html
html
html(data-logic='error')
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
@ -17,9 +17,8 @@ html
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
// CSS
link(type='text/css', rel='stylesheet', href='/css/libs.css')
link(type='text/css', rel='stylesheet', href='/css/error.css')
// JS / CSS
script(type='text/javascript', src='/js/bundle.min.js')
body(class='is-error')
.container

Loading…
Cancel
Save