mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 08:54:33 +08:00
Merge branch 'master' into 2019-design
This commit is contained in:
@ -56,4 +56,4 @@ class BackToTop {
|
||||
|
||||
}
|
||||
|
||||
module.exports = BackToTop;
|
||||
export default BackToTop;
|
@ -69,4 +69,4 @@ class ChapterToggle {
|
||||
|
||||
}
|
||||
|
||||
module.exports = ChapterToggle;
|
||||
export default ChapterToggle;
|
||||
|
@ -34,4 +34,4 @@ class Collapsible {
|
||||
|
||||
}
|
||||
|
||||
module.exports = Collapsible;
|
||||
export default Collapsible;
|
@ -45,4 +45,4 @@ class DropDown {
|
||||
|
||||
}
|
||||
|
||||
module.exports = DropDown;
|
||||
export default DropDown;
|
@ -44,4 +44,4 @@ class EditorToolbox {
|
||||
|
||||
}
|
||||
|
||||
module.exports = EditorToolbox;
|
||||
export default EditorToolbox;
|
@ -44,4 +44,4 @@ class EntitySelectorPopup {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EntitySelectorPopup;
|
||||
export default EntitySelectorPopup;
|
@ -115,4 +115,4 @@ class EntitySelector {
|
||||
|
||||
}
|
||||
|
||||
module.exports = EntitySelector;
|
||||
export default EntitySelector;
|
@ -62,4 +62,4 @@ class ExpandToggle {
|
||||
|
||||
}
|
||||
|
||||
module.exports = ExpandToggle;
|
||||
export default ExpandToggle;
|
@ -19,4 +19,4 @@ class HomepageControl {
|
||||
|
||||
}
|
||||
|
||||
module.exports = HomepageControl;
|
||||
export default HomepageControl;
|
@ -56,4 +56,4 @@ class ImagePicker {
|
||||
|
||||
}
|
||||
|
||||
module.exports = ImagePicker;
|
||||
export default ImagePicker;
|
@ -1,31 +1,53 @@
|
||||
import dropdown from "./dropdown";
|
||||
import overlay from "./overlay";
|
||||
import backToTop from "./back-to-top";
|
||||
import notification from "./notification";
|
||||
import chapterToggle from "./chapter-toggle";
|
||||
import expandToggle from "./expand-toggle";
|
||||
import entitySelectorPopup from "./entity-selector-popup";
|
||||
import entitySelector from "./entity-selector";
|
||||
import sidebar from "./sidebar";
|
||||
import pagePicker from "./page-picker";
|
||||
import pageComments from "./page-comments";
|
||||
import wysiwygEditor from "./wysiwyg-editor";
|
||||
import markdownEditor from "./markdown-editor";
|
||||
import editorToolbox from "./editor-toolbox";
|
||||
import imagePicker from "./image-picker";
|
||||
import collapsible from "./collapsible";
|
||||
import toggleSwitch from "./toggle-switch";
|
||||
import pageDisplay from "./page-display";
|
||||
import shelfSort from "./shelf-sort";
|
||||
import homepageControl from "./homepage-control";
|
||||
import headerMobileToggle from "./header-mobile-toggle";
|
||||
|
||||
let componentMapping = {
|
||||
'dropdown': require('./dropdown'),
|
||||
'overlay': require('./overlay'),
|
||||
'back-to-top': require('./back-top-top'),
|
||||
'notification': require('./notification'),
|
||||
'chapter-toggle': require('./chapter-toggle'),
|
||||
'expand-toggle': require('./expand-toggle'),
|
||||
'entity-selector-popup': require('./entity-selector-popup'),
|
||||
'entity-selector': require('./entity-selector'),
|
||||
'sidebar': require('./sidebar'),
|
||||
'page-picker': require('./page-picker'),
|
||||
'page-comments': require('./page-comments'),
|
||||
'wysiwyg-editor': require('./wysiwyg-editor'),
|
||||
'markdown-editor': require('./markdown-editor'),
|
||||
'editor-toolbox': require('./editor-toolbox'),
|
||||
'image-picker': require('./image-picker'),
|
||||
'collapsible': require('./collapsible'),
|
||||
'toggle-switch': require('./toggle-switch'),
|
||||
'page-display': require('./page-display'),
|
||||
'shelf-sort': require('./shelf-sort'),
|
||||
'homepage-control': require('./homepage-control'),
|
||||
'header-mobile-toggle': require('./header-mobile-toggle'),
|
||||
|
||||
const componentMapping = {
|
||||
'dropdown': dropdown,
|
||||
'overlay': overlay,
|
||||
'back-to-top': backToTop,
|
||||
'notification': notification,
|
||||
'chapter-toggle': chapterToggle,
|
||||
'expand-toggle': expandToggle,
|
||||
'entity-selector-popup': entitySelectorPopup,
|
||||
'entity-selector': entitySelector,
|
||||
'sidebar': sidebar,
|
||||
'page-picker': pagePicker,
|
||||
'page-comments': pageComments,
|
||||
'wysiwyg-editor': wysiwygEditor,
|
||||
'markdown-editor': markdownEditor,
|
||||
'editor-toolbox': editorToolbox,
|
||||
'image-picker': imagePicker,
|
||||
'collapsible': collapsible,
|
||||
'toggle-switch': toggleSwitch,
|
||||
'page-display': pageDisplay,
|
||||
'shelf-sort': shelfSort,
|
||||
'homepage-control': homepageControl,
|
||||
'header-mobile-toggle': headerMobileToggle,
|
||||
};
|
||||
|
||||
window.components = {};
|
||||
|
||||
let componentNames = Object.keys(componentMapping);
|
||||
const componentNames = Object.keys(componentMapping);
|
||||
|
||||
/**
|
||||
* Initialize components of the given name within the given element.
|
||||
@ -59,4 +81,4 @@ function initAll(parentElement) {
|
||||
|
||||
window.components.init = initAll;
|
||||
|
||||
export default initAll;
|
||||
export default initAll;
|
||||
|
@ -1,8 +1,8 @@
|
||||
const MarkdownIt = require("markdown-it");
|
||||
const mdTasksLists = require('markdown-it-task-lists');
|
||||
const code = require('../services/code');
|
||||
import MarkdownIt from "markdown-it";
|
||||
import mdTasksLists from 'markdown-it-task-lists';
|
||||
import code from '../services/code';
|
||||
|
||||
const DrawIO = require('../services/drawio');
|
||||
import DrawIO from "../services/drawio";
|
||||
|
||||
class MarkdownEditor {
|
||||
|
||||
@ -272,14 +272,15 @@ class MarkdownEditor {
|
||||
let placeHolderText = ``;
|
||||
let cursor = cm.getCursor();
|
||||
cm.replaceSelection(placeHolderText);
|
||||
cm.setCursor({line: cursor.line, ch: cursor.ch + selectedText.length + 2});
|
||||
cm.setCursor({line: cursor.line, ch: cursor.ch + selectedText.length + 3});
|
||||
|
||||
let remoteFilename = "image-" + Date.now() + "." + ext;
|
||||
let formData = new FormData();
|
||||
formData.append('file', file, remoteFilename);
|
||||
|
||||
window.$http.post('/images/gallery/upload', formData).then(resp => {
|
||||
replaceContent(placeholderImage, resp.data.thumbs.display);
|
||||
const newContent = `[](${resp.data.url})`;
|
||||
replaceContent(placeHolderText, newContent);
|
||||
}).catch(err => {
|
||||
window.$events.emit('error', trans('errors.image_upload_error'));
|
||||
replaceContent(placeHolderText, selectedText);
|
||||
@ -304,7 +305,7 @@ class MarkdownEditor {
|
||||
let cursorPos = this.cm.getCursor('from');
|
||||
window.ImageManager.show(image => {
|
||||
let selectedText = this.cm.getSelection();
|
||||
let newText = "";
|
||||
let newText = "[](" + image.url + ")";
|
||||
this.cm.focus();
|
||||
this.cm.replaceSelection(newText);
|
||||
this.cm.setCursor(cursorPos.line, cursorPos.ch + newText.length);
|
||||
@ -427,4 +428,4 @@ class MarkdownEditor {
|
||||
|
||||
}
|
||||
|
||||
module.exports = MarkdownEditor ;
|
||||
export default MarkdownEditor ;
|
||||
|
@ -43,4 +43,4 @@ class Notification {
|
||||
|
||||
}
|
||||
|
||||
module.exports = Notification;
|
||||
export default Notification;
|
@ -36,4 +36,4 @@ class Overlay {
|
||||
|
||||
}
|
||||
|
||||
module.exports = Overlay;
|
||||
export default Overlay;
|
@ -1,4 +1,4 @@
|
||||
const MarkdownIt = require("markdown-it");
|
||||
import MarkdownIt from "markdown-it";
|
||||
const md = new MarkdownIt({ html: false });
|
||||
|
||||
class PageComments {
|
||||
@ -172,4 +172,4 @@ class PageComments {
|
||||
|
||||
}
|
||||
|
||||
module.exports = PageComments;
|
||||
export default PageComments;
|
@ -1,4 +1,4 @@
|
||||
import Clipboard from "clipboard";
|
||||
import Clipboard from "clipboard/dist/clipboard.min";
|
||||
import Code from "../services/code";
|
||||
|
||||
class PageDisplay {
|
||||
@ -233,4 +233,4 @@ class PageDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PageDisplay;
|
||||
export default PageDisplay;
|
||||
|
@ -59,4 +59,4 @@ function toggleElem(elem, show) {
|
||||
elem.style.display = show ? display : 'none';
|
||||
}
|
||||
|
||||
module.exports = PagePicker;
|
||||
export default PagePicker;
|
@ -1,3 +1,4 @@
|
||||
import "jquery-sortable";
|
||||
|
||||
class ShelfSort {
|
||||
|
||||
@ -9,9 +10,8 @@ class ShelfSort {
|
||||
}
|
||||
|
||||
initSortable() {
|
||||
const sortable = require('jquery-sortable');
|
||||
const placeHolderContent = this.getPlaceholderHTML();
|
||||
|
||||
// TODO - Load sortable at this point
|
||||
return $('.scroll-box').sortable({
|
||||
group: 'shelf-books',
|
||||
exclude: '.instruction,.scroll-box-placeholder',
|
||||
@ -68,4 +68,4 @@ class ShelfSort {
|
||||
|
||||
}
|
||||
|
||||
module.exports = ShelfSort;
|
||||
export default ShelfSort;
|
@ -13,4 +13,4 @@ class Sidebar {
|
||||
|
||||
}
|
||||
|
||||
module.exports = Sidebar;
|
||||
export default Sidebar;
|
@ -16,4 +16,4 @@ class ToggleSwitch {
|
||||
|
||||
}
|
||||
|
||||
module.exports = ToggleSwitch;
|
||||
export default ToggleSwitch;
|
@ -1,5 +1,5 @@
|
||||
const Code = require('../services/code');
|
||||
const DrawIO = require('../services/drawio');
|
||||
import Code from "../services/code";
|
||||
import DrawIO from "../services/drawio";
|
||||
|
||||
/**
|
||||
* Handle pasting images from clipboard.
|
||||
@ -593,4 +593,4 @@ class WysiwygEditor {
|
||||
|
||||
}
|
||||
|
||||
module.exports = WysiwygEditor;
|
||||
export default WysiwygEditor;
|
||||
|
Reference in New Issue
Block a user