mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-09-01 21:22:04 +03:00
Merge branch 'v0.11'
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
var DropZone = require('dropzone');
|
||||
var markdown = require('marked');
|
||||
const DropZone = require('dropzone');
|
||||
const markdown = require('marked');
|
||||
|
||||
var toggleSwitchTemplate = require('./components/toggle-switch.html');
|
||||
var imagePickerTemplate = require('./components/image-picker.html');
|
||||
var dropZoneTemplate = require('./components/drop-zone.html');
|
||||
const toggleSwitchTemplate = require('./components/toggle-switch.html');
|
||||
const imagePickerTemplate = require('./components/image-picker.html');
|
||||
const dropZoneTemplate = require('./components/drop-zone.html');
|
||||
|
||||
module.exports = function (ngApp, events) {
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = function (ngApp, events) {
|
||||
imageClass: '@'
|
||||
},
|
||||
link: function (scope, element, attrs) {
|
||||
var usingIds = typeof scope.currentId !== 'undefined' || scope.currentId === 'false';
|
||||
let usingIds = typeof scope.currentId !== 'undefined' || scope.currentId === 'false';
|
||||
scope.image = scope.currentImage;
|
||||
scope.value = scope.currentImage || '';
|
||||
if (usingIds) scope.value = scope.currentId;
|
||||
@@ -80,7 +80,7 @@ module.exports = function (ngApp, events) {
|
||||
};
|
||||
|
||||
scope.updateImageFromModel = function (model) {
|
||||
var isResized = scope.resizeWidth && scope.resizeHeight;
|
||||
let isResized = scope.resizeWidth && scope.resizeHeight;
|
||||
|
||||
if (!isResized) {
|
||||
scope.$apply(() => {
|
||||
@@ -89,8 +89,9 @@ module.exports = function (ngApp, events) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cropped = scope.resizeCrop ? 'true' : 'false';
|
||||
var requestString = '/images/thumb/' + model.id + '/' + scope.resizeWidth + '/' + scope.resizeHeight + '/' + cropped;
|
||||
let cropped = scope.resizeCrop ? 'true' : 'false';
|
||||
let requestString = '/images/thumb/' + model.id + '/' + scope.resizeWidth + '/' + scope.resizeHeight + '/' + cropped;
|
||||
requestString = window.baseUrl(requestString);
|
||||
$http.get(requestString).then((response) => {
|
||||
setImage(model, response.data.url);
|
||||
});
|
||||
@@ -265,11 +266,14 @@ module.exports = function (ngApp, events) {
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
// Set initial model content
|
||||
var content = element.val();
|
||||
element = element.find('textarea').first();
|
||||
let content = element.val();
|
||||
scope.mdModel = content;
|
||||
scope.mdChange(markdown(content));
|
||||
|
||||
element.on('change input', (e) => {
|
||||
console.log('test');
|
||||
|
||||
element.on('change input', (event) => {
|
||||
content = element.val();
|
||||
$timeout(() => {
|
||||
scope.mdModel = content;
|
||||
@@ -297,7 +301,7 @@ module.exports = function (ngApp, events) {
|
||||
link: function (scope, element, attrs) {
|
||||
|
||||
// Elements
|
||||
const input = element.find('textarea[markdown-input]');
|
||||
const input = element.find('[markdown-input] textarea').first();
|
||||
const display = element.find('.markdown-display').first();
|
||||
const insertImage = element.find('button[data-action="insertImage"]');
|
||||
|
||||
@@ -342,9 +346,9 @@ module.exports = function (ngApp, events) {
|
||||
// Insert image shortcut
|
||||
if (event.which === 73 && event.ctrlKey && event.shiftKey) {
|
||||
event.preventDefault();
|
||||
var caretPos = input[0].selectionStart;
|
||||
var currentContent = input.val();
|
||||
var mdImageText = "";
|
||||
let caretPos = input[0].selectionStart;
|
||||
let currentContent = input.val();
|
||||
const mdImageText = "";
|
||||
input.val(currentContent.substring(0, caretPos) + mdImageText + currentContent.substring(caretPos));
|
||||
input.focus();
|
||||
input[0].selectionStart = caretPos + (";
|
||||
@@ -358,9 +362,9 @@ module.exports = function (ngApp, events) {
|
||||
// Insert image from image manager
|
||||
insertImage.click(event => {
|
||||
window.ImageManager.showExternal(image => {
|
||||
var caretPos = currentCaretPos;
|
||||
var currentContent = input.val();
|
||||
var mdImageText = "";
|
||||
let caretPos = currentCaretPos;
|
||||
let currentContent = input.val();
|
||||
let mdImageText = "";
|
||||
input.val(currentContent.substring(0, caretPos) + mdImageText + currentContent.substring(caretPos));
|
||||
input.change();
|
||||
});
|
||||
@@ -634,7 +638,7 @@ module.exports = function (ngApp, events) {
|
||||
// Get search url with correct types
|
||||
function getSearchUrl() {
|
||||
let types = (attrs.entityTypes) ? encodeURIComponent(attrs.entityTypes) : encodeURIComponent('page,book,chapter');
|
||||
return `/ajax/search/entities?types=${types}`;
|
||||
return window.baseUrl(`/ajax/search/entities?types=${types}`);
|
||||
}
|
||||
|
||||
// Get initial contents
|
||||
|
Reference in New Issue
Block a user