1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Updated WYSIWYG entity link selector to set link display text

- Sets as entity name if the input is currently empty.

For #2014
This commit is contained in:
Dan Brown 2020-04-09 15:28:44 +01:00
parent 642db1387e
commit 1962c81742
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -508,7 +508,15 @@ class WysiwygEditor {
const originalField = win.document.getElementById(field_name);
originalField.value = entity.link;
const mceForm = originalField.closest('.mce-form');
mceForm.querySelectorAll('input')[2].value = entity.name;
const inputs = mceForm.querySelectorAll('input');
// Set text to display if not empty
if (!inputs[1].value) {
inputs[1].value = entity.name;
}
// Set title field
inputs[2].value = entity.name;
});
}