1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Merge branch 'master' into bug/image-upload

This commit is contained in:
Abijeet Patro
2018-03-18 23:44:33 +05:30
committed by GitHub
39 changed files with 8518 additions and 2530 deletions

View File

@@ -16,12 +16,12 @@ let componentMapping = {
'editor-toolbox': require('./editor-toolbox'),
'image-picker': require('./image-picker'),
'collapsible': require('./collapsible'),
'toggle-switch': require('./toggle-switch'),
};
window.components = {};
let componentNames = Object.keys(componentMapping);
initAll();
/**
* Initialize components of the given name within the given element.
@@ -53,4 +53,6 @@ function initAll(parentElement) {
}
}
window.components.init = initAll;
window.components.init = initAll;
export default initAll;

View File

@@ -255,7 +255,9 @@ class MarkdownEditor {
let placeholderImage = window.baseUrl(`/loading.gif#upload${id}`);
let selectedText = cm.getSelection();
let placeHolderText = `![${selectedText}](${placeholderImage})`;
let cursor = cm.getCursor();
cm.replaceSelection(placeHolderText);
cm.setCursor({line: cursor.line, ch: cursor.ch + selectedText.length + 2});
let remoteFilename = "image-" + Date.now() + "." + ext;
let formData = new FormData();
@@ -264,7 +266,7 @@ class MarkdownEditor {
window.$http.post('/images/gallery/upload', formData).then(resp => {
replaceContent(placeholderImage, resp.data.thumbs.display);
}).catch(err => {
events.emit('error', trans('errors.image_upload_error'));
window.$events.emit('error', trans('errors.image_upload_error'));
replaceContent(placeHolderText, selectedText);
console.log(err);
});

View File

@@ -18,7 +18,7 @@ class Notification {
show(textToShow = '') {
this.elem.removeEventListener('transitionend', this.hideCleanup);
this.textElem.textContent = textToShow;
this.elem.style.display = 'block';
this.elem.style.display = 'grid';
setTimeout(() => {
this.elem.classList.add('showing');
}, 1);

View File

@@ -0,0 +1,19 @@
class ToggleSwitch {
constructor(elem) {
this.elem = elem;
this.input = elem.querySelector('input');
this.elem.onclick = this.onClick.bind(this);
}
onClick(event) {
let checked = this.input.value !== 'true';
this.input.value = checked ? 'true' : 'false';
checked ? this.elem.classList.add('active') : this.elem.classList.remove('active');
}
}
module.exports = ToggleSwitch;

View File

@@ -1,6 +1,16 @@
"use strict";
require("babel-polyfill");
require('./dom-polyfills');
import "babel-polyfill"
import "./dom-polyfills"
import jQuery from "jquery"
window.jQuery = window.$ = jQuery;
import "./pages/page-show"
import Translations from "./translations"
import vues from "./vues/vues"
import components from "./components"
import Vue from "vue"
import axios from "axios"
// Url retrieval function
window.baseUrl = function(path) {
@@ -37,9 +47,6 @@ class EventManager {
window.$events = new EventManager();
const Vue = require("vue");
const axios = require("axios");
let axiosInstance = axios.create({
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name=token]').getAttribute('content'),
@@ -60,14 +67,13 @@ Vue.prototype.$events = window.$events;
// Translation setup
// Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
const Translations = require("./translations");
let translator = new Translations(window.translations);
window.trans = translator.get.bind(translator);
window.trans_choice = translator.getPlural.bind(translator);
require("./vues/vues");
require("./components");
// Load vues and components
vues();
components();
//Global jQuery Config & Extensions
@@ -125,6 +131,3 @@ if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.userAgent.indexOf('Safari') !== -1){
document.body.classList.add('flexbox-support');
}
// Page specific items
require("./pages/page-show");

View File

@@ -350,7 +350,7 @@ if (document.querySelector('[drawio-enabled]').getAttribute('drawio-enabled') ==
module.exports = {
selector: '#html-editor',
content_css: [
window.baseUrl('/css/styles.css'),
window.baseUrl('/dist/styles.css'),
],
branding: false,
body_class: 'page-content',

View File

@@ -16,10 +16,17 @@ let vueMapping = {
window.vues = {};
let ids = Object.keys(vueMapping);
for (let i = 0, len = ids.length; i < len; i++) {
if (!exists(ids[i])) continue;
let config = vueMapping[ids[i]];
config.el = '#' + ids[i];
window.vues[ids[i]] = new Vue(config);
}
function load() {
let ids = Object.keys(vueMapping);
for (let i = 0, len = ids.length; i < len; i++) {
if (!exists(ids[i])) continue;
let config = vueMapping[ids[i]];
config.el = '#' + ids[i];
window.vues[ids[i]] = new Vue(config);
}
}
export default load;

View File

@@ -65,6 +65,7 @@ $button-border-radius: 2px;
.button.outline {
background-color: transparent;
color: #888;
fill: #888;
border: 1px solid #DDD;
&:hover, &:focus, &:active {
box-shadow: none;
@@ -73,25 +74,31 @@ $button-border-radius: 2px;
&.page {
border-color: $color-page;
color: $color-page;
fill: $color-page;
&:hover, &:focus, &:active {
background-color: $color-page;
color: #FFF;
fill: #FFF;
}
}
&.chapter {
border-color: $color-chapter;
color: $color-chapter;
fill: $color-chapter;
&:hover, &:focus, &:active {
background-color: $color-chapter;
color: #FFF;
fill: #FFF;
}
}
&.book {
border-color: $color-book;
color: $color-book;
fill: $color-book;
&:hover, &:focus, &:active {
background-color: $color-book;
color: #FFF;
fill: #FFF;
}
}
}

View File

@@ -10,8 +10,8 @@
box-shadow: $bs-med;
z-index: 999999;
cursor: pointer;
max-width: 480px;
transition: transform ease-in-out 360ms;
max-width: 360px;
transition: transform ease-in-out 280ms;
transform: translate3d(580px, 0, 0);
display: grid;
grid-template-columns: 64px 1fr;
@@ -27,6 +27,7 @@
}
span {
vertical-align: middle;
line-height: 1.3;
}
&.pos {
background-color: $positive;
@@ -43,6 +44,9 @@
&.showing {
transform: translate3d(0, 0, 0);
}
&.showing:hover {
transform: translate3d(0, -2px, 0);
}
}
[chapter-toggle] {

View File

@@ -58,6 +58,7 @@
flex-direction: column;
border: 1px solid #DDD;
width: 50%;
max-width: 50%;
}
}
@@ -97,7 +98,6 @@ label {
font-size: 0.94em;
font-weight: 400;
color: #999;
text-transform: uppercase;
padding-bottom: 2px;
margin-bottom: 0.2em;
&.inline {
@@ -191,6 +191,13 @@ input:checked + .toggle-switch {
}
}
.simple-code-input {
background-color: #F8F8F8;
font-family: monospace;
font-size: 12px;
min-height: 100px;
}
.form-group {
.text-pos, .text-neg {
padding: $-xs 0;
@@ -315,4 +322,4 @@ div[editor-type="markdown"] .title-input.page-title input[type="text"] {
.image-picker img {
background-color: #BBB;
}
}

View File

@@ -210,7 +210,7 @@ header .search-box {
@include smaller-than($m) {
.breadcrumbs .text-button, .action-buttons .text-button {
padding: $-s $-xs;
padding: $-xs $-xs;
}
.action-buttons .dropdown-container:last-child a {
padding-left: $-xs;
@@ -218,6 +218,9 @@ header .search-box {
.breadcrumbs .text-button {
font-size: 0;
}
.breadcrumbs .text-button svg {
font-size: $fs-m;
}
.breadcrumbs a i {
font-size: $fs-m;
padding-right: 0;
@@ -225,6 +228,9 @@ header .search-box {
.breadcrumbs span.sep {
padding: 0 $-xxs;
}
.toolbar .col-xs-1:first-child {
padding-right: 0;
}
}
.nav-tabs {

View File

@@ -55,6 +55,12 @@
}
}
@include smaller-than($s) {
.page-list h4 {
font-size: 1.333em;
}
}
.sidebar-page-nav {
$nav-indent: $-s;
list-style: none;

View File

@@ -2,6 +2,7 @@
display: flex;
flex-direction: column;
align-items: stretch;
overflow: hidden;
.faded-small {
height: auto;
}

View File

@@ -61,6 +61,24 @@ h5, h6 {
margin-bottom: 0.66em;
}
@include smaller-than($s) {
h1 {
font-size: 2.8275em;
}
h2 {
font-size: 2.333em;
}
h3 {
font-size: 1.666em;
}
h4 {
font-size: 1.333em;
}
h5 {
font-size: 1.161616em;
}
}
/*
* Link styling
*/
@@ -374,8 +392,8 @@ li.checkbox-item, li.task-list-item {
}
.break-text {
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
}
/**

View File

@@ -10,6 +10,10 @@
@import "lists";
@import "pages";
body {
font-family: 'DejaVu Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Roboto", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
table {
border-spacing: 0;
border-collapse: collapse;

View File

@@ -19,7 +19,7 @@ return [
'app_settings' => 'App Settings',
'app_name' => 'Application name',
'app_name_desc' => 'This name is shown in the header and any emails.',
'app_name_header' => 'Show Application name in header?',
'app_name_header' => 'Show application name in header?',
'app_public_viewing' => 'Allow public viewing?',
'app_secure_images' => 'Enable higher security image uploads?',
'app_secure_images_desc' => 'For performance reasons, all images are public. This option adds a random, hard-to-guess string in front of image urls. Ensure directory indexes are not enabled to prevent easy access.',
@@ -31,7 +31,7 @@ return [
'app_logo_desc' => 'This image should be 43px in height. <br>Large images will be scaled down.',
'app_primary_color' => 'Application primary color',
'app_primary_color_desc' => 'This should be a hex value. <br>Leave empty to reset to the default color.',
'app_homepage' => 'Application Homepage',
'app_homepage' => 'Application homepage',
'app_homepage_desc' => 'Select a page to show on the homepage instead of the default view. Page permissions are ignored for selected pages.',
'app_homepage_default' => 'Default homepage view chosen',
'app_disable_comments' => 'Disable comments',

View File

@@ -18,6 +18,8 @@ return [
'name' => 'Nome',
'description' => 'Descrizione',
'role' => 'Ruolo',
'cover_image' => 'Immagine di copertina',
'cover_image_description' => 'Questa immagine dovrebbe essere approssimatamente 440x250px.',
/**
* Actions
@@ -45,7 +47,10 @@ return [
'no_items' => 'Nessun elemento disponibile',
'back_to_top' => 'Torna in alto',
'toggle_details' => 'Mostra Dettagli',
'toggle_thumbnails' => 'Mostra Miniature',
'details' => 'Dettagli',
'grid_view' => 'Visualizzazione Griglia',
'list_view' => 'Visualizzazione Lista',
/**
* Header

View File

@@ -162,6 +162,7 @@ return [
'pages_md_preview' => 'Anteprima',
'pages_md_insert_image' => 'Inserisci Immagina',
'pages_md_insert_link' => 'Inserisci Link Entità',
'pages_md_insert_drawing' => 'Inserisci Disegno',
'pages_not_in_chapter' => 'La pagina non è in un capitolo',
'pages_move' => 'Muovi Pagina',
'pages_move_success' => 'Pagina mossa in ":parentName"',
@@ -244,6 +245,7 @@ return [
*/
'comment' => 'Commento',
'comments' => 'Commenti',
'comment_add' => 'Aggiungi Commento',
'comment_placeholder' => 'Scrivi un commento',
'comment_count' => '{0} Nessun Commento|{1} 1 Commento|[2,*] :count Commenti',
'comment_save' => 'Salva Commento',

View File

@@ -20,6 +20,7 @@ return [
'ldap_extension_not_installed' => 'L\'estensione PHP LDAP non è installata',
'ldap_cannot_connect' => 'Impossibile connettersi al server ldap, connessione iniziale fallita',
'social_no_action_defined' => 'Nessuna azione definita',
'social_login_bad_response' => "Ricevuto error durante il login con :socialAccount : \n:error",
'social_account_in_use' => 'Questo account :socialAccount è già utilizzato, prova a loggarti usando l\'opzione :socialAccount.',
'social_account_email_in_use' => 'La mail :email è già in uso. Se hai già un account puoi connettere il tuo account :socialAccount dalle impostazioni del tuo profilo.',
'social_account_existing' => 'Questo account :socialAccount è già connesso al tuo profilo.',
@@ -35,12 +36,15 @@ return [
'cannot_create_thumbs' => 'Il server non può creare thumbnail. Controlla che l\'estensione GD sia installata.',
'server_upload_limit' => 'Il server non permette un upload di questa grandezza. Prova con un file più piccolo.',
'image_upload_error' => 'C\'è stato un errore caricando l\'immagine',
'image_upload_type_error' => 'Il tipo di immagine in upload non è valido',
// Attachments
'attachment_page_mismatch' => 'Page mismatch during attachment update',
'attachment_not_found' => 'Allegato non trovato',
// Pages
'page_draft_autosave_fail' => 'Impossibile salvare la bozza. Controlla di essere connesso ad internet prima di salvare questa pagina',
'page_custom_home_deletion' => 'Impossibile eliminare una pagina quando è impostata come homepage',
// Entities
'entity_not_found' => 'Entità non trovata',

View File

@@ -40,6 +40,7 @@ return [
/**
* Registration settings
*/
'reg_settings' => 'Impostazioni Registrazione',
'reg_allow' => 'Consentire Registrazione?',
'reg_default_role' => 'Ruolo predefinito dopo la registrazione',

View File

@@ -10,12 +10,10 @@
<meta charset="utf-8">
<!-- Styles and Fonts -->
<link rel="stylesheet" href="{{ versioned_asset('css/styles.css') }}">
<link rel="stylesheet" media="print" href="{{ versioned_asset('css/print-styles.css') }}">
<link rel="stylesheet" href="{{ versioned_asset('dist/styles.css') }}">
<link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
<!-- Scripts -->
<script src="{{ baseUrl('/libs/jquery/jquery.min.js?version=2.1.4') }}"></script>
<script src="{{ baseUrl('/libs/jquery/jquery-ui.min.js?version=1.11.4') }}"></script>
<script src="{{ baseUrl('/translations') }}"></script>
@yield('head')
@@ -82,7 +80,7 @@
</div>
</div>
@yield('bottom')
<script src="{{ versioned_asset('js/common.js') }}"></script>
<script src="{{ versioned_asset('dist/app.js') }}"></script>
@yield('scripts')
</body>
</html>

View File

@@ -91,8 +91,8 @@
@section('body')
<div class="container small">
<h1>{{$book->name}}</h1>
<div class="container small nopad">
<h1 class="break-text" v-pre>{{$book->name}}</h1>
<div class="book-content" v-show="!searching">
<p class="text-muted" v-pre>{!! nl2br(e($book->description)) !!}</p>
@if(count($bookChildren) > 0)

View File

@@ -1,9 +1,5 @@
@extends('simple-layout')
@section('head')
<script src="{{ baseUrl("/libs/jquery-sortable/jquery-sortable.min.js") }}"></script>
@stop
@section('toolbar')
<div class="col-sm-12 faded">
@include('books._breadcrumbs', ['book' => $book])
@@ -52,11 +48,12 @@
</div>
@endif
</div>
</div>
@stop
@section('scripts')
<script src="{{ baseUrl("/libs/jquery-sortable/jquery-sortable.min.js") }}"></script>
<script>
$(document).ready(function() {

View File

@@ -96,8 +96,8 @@
@section('body')
<div class="container small">
<h1 v-pre>{{ $chapter->name }}</h1>
<div class="container small nopad">
<h1 class="break-text" v-pre>{{ $chapter->name }}</h1>
<div class="chapter-content" v-show="!searching">
<p v-pre class="text-muted break-text">{!! nl2br(e($chapter->description)) !!}</p>

View File

@@ -1,15 +1,4 @@
<div toggle-switch="{{$name}}" class="toggle-switch @if($value) active @endif">
<input type="hidden" name="{{$name}}" value="{{$value?'true':'false'}}"/>
<div class="switch-handle"></div>
</div>
<script>
(function() {
var toggle = document.querySelector('[toggle-switch="{{$name}}"]');
var toggleInput = toggle.querySelector('input');
toggle.onclick = function(event) {
var checked = toggleInput.value !== 'true';
toggleInput.value = checked ? 'true' : 'false';
checked ? toggle.classList.add('active') : toggle.classList.remove('active');
};
})()
</script>
</div>

View File

@@ -6,7 +6,7 @@
<style>
@if (!app()->environment('testing'))
{!! file_get_contents(public_path('/css/export-styles.css')) !!}
{!! file_get_contents(public_path('/dist/export-styles.css')) !!}
@endif
</style>
@yield('head')

View File

@@ -1,6 +1,6 @@
<div ng-non-bindable>
<h1 id="bkmrk-page-title">{{$page->name}}</h1>
<h1 class="break-text" v-pre id="bkmrk-page-title">{{$page->name}}</h1>
<div style="clear:left;"></div>

View File

@@ -10,8 +10,8 @@
<meta charset="utf-8">
<!-- Styles and Fonts -->
<link rel="stylesheet" href="{{ versioned_asset('css/styles.css') }}">
<link rel="stylesheet" media="print" href="{{ versioned_asset('css/print-styles.css') }}">
<link rel="stylesheet" href="{{ versioned_asset('dist/styles.css') }}">
<link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
<!-- Scripts -->
<script src="{{ baseUrl("/libs/jquery/jquery.min.js?version=2.1.4") }}"></script>
@@ -58,6 +58,6 @@
@yield('content')
</section>
<script src="{{ versioned_asset('js/common.js') }}"></script>
<script src="{{ versioned_asset('dist/app.js') }}"></script>
</body>
</html>

View File

@@ -88,7 +88,7 @@
<div class="form-group">
<label for="setting-app-custom-head">{{ trans('settings.app_custom_html') }}</label>
<p class="small">{{ trans('settings.app_custom_html_desc') }}</p>
<textarea name="setting-app-custom-head" id="setting-app-custom-head">{{ setting('app-custom-head', '') }}</textarea>
<textarea class="simple-code-input" name="setting-app-custom-head" id="setting-app-custom-head">{{ setting('app-custom-head', '') }}</textarea>
</div>
<div class="form-group text-right">