mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Editors: Updated entity link select to pre-fill with selection
Updated all uses across both editors, so the entity link selector popup now initates a search with the selection text if existing. For #4571
This commit is contained in:
@ -68,11 +68,12 @@ export class Actions {
|
||||
|
||||
/** @type {EntitySelectorPopup} * */
|
||||
const selector = window.$components.first('entity-selector-popup');
|
||||
const selectionText = this.#getSelectionText(selectionRange);
|
||||
selector.show(entity => {
|
||||
const selectedText = this.#getSelectionText(selectionRange) || entity.name;
|
||||
const selectedText = selectionText || entity.name;
|
||||
const newText = `[${selectedText}](${entity.link})`;
|
||||
this.#replaceSelection(newText, newText.length, selectionRange);
|
||||
});
|
||||
}, selectionText);
|
||||
}
|
||||
|
||||
// Show draw.io if enabled and handle save.
|
||||
|
Reference in New Issue
Block a user