mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-17 13:52:04 +00:00
Removed use of image-manager/entity-selector window globals
This commit is contained in:
parent
3b8ee3954e
commit
25c23a2e5f
5 changed files with 22 additions and 12 deletions
resources/js/components
|
@ -431,7 +431,9 @@ export class MarkdownEditor extends Component {
|
|||
|
||||
actionInsertImage() {
|
||||
const cursorPos = this.cm.getCursor('from');
|
||||
window.ImageManager.show(image => {
|
||||
/** @type {ImageManager} **/
|
||||
const imageManager = window.$components.first('image-manager');
|
||||
imageManager.show(image => {
|
||||
const imageUrl = image.thumbs.display || image.url;
|
||||
let selectedText = this.cm.getSelection();
|
||||
let newText = "[](" + image.url + ")";
|
||||
|
@ -443,7 +445,9 @@ export class MarkdownEditor extends Component {
|
|||
|
||||
actionShowImageManager() {
|
||||
const cursorPos = this.cm.getCursor('from');
|
||||
window.ImageManager.show(image => {
|
||||
/** @type {ImageManager} **/
|
||||
const imageManager = window.$components.first('image-manager');
|
||||
imageManager.show(image => {
|
||||
this.insertDrawing(image, cursorPos);
|
||||
}, 'drawio');
|
||||
}
|
||||
|
@ -451,7 +455,9 @@ export class MarkdownEditor extends Component {
|
|||
// Show the popup link selector and insert a link when finished
|
||||
actionShowLinkSelector() {
|
||||
const cursorPos = this.cm.getCursor('from');
|
||||
window.EntitySelectorPopup.show(entity => {
|
||||
/** @type {EntitySelectorPopup} **/
|
||||
const selector = window.$components.first('entity-selector-popup');
|
||||
selector.show(entity => {
|
||||
let selectedText = this.cm.getSelection() || entity.name;
|
||||
let newText = `[${selectedText}](${entity.link})`;
|
||||
this.cm.focus();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue