mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-06 10:44:33 +08:00
WYSWIYG: Improved use of object tags to embed content
- Prevented image toolbars showing for objects embeds due to tinymce image placeholder, and added media toolbar. - Fixed height of object embed placeholder being forced to auto when in the editor, allowing height attributed to be properly reflected as it would on normal page view. Closes #4974
This commit is contained in:
@ -60,7 +60,7 @@ function registerLinkContextToolbar(editor) {
|
||||
function registerImageContextToolbar(editor) {
|
||||
editor.ui.registry.addContextToolbar('imagecontexttoolbar', {
|
||||
predicate(node) {
|
||||
return node.closest('img') !== null;
|
||||
return node.closest('img') !== null && !node.hasAttribute('data-mce-object');
|
||||
},
|
||||
position: 'node',
|
||||
scope: 'node',
|
||||
@ -68,6 +68,20 @@ function registerImageContextToolbar(editor) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Editor} editor
|
||||
*/
|
||||
function registerObjectContextToolbar(editor) {
|
||||
editor.ui.registry.addContextToolbar('objectcontexttoolbar', {
|
||||
predicate(node) {
|
||||
return node.closest('img') !== null && node.hasAttribute('data-mce-object');
|
||||
},
|
||||
position: 'node',
|
||||
scope: 'node',
|
||||
items: 'media',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Editor} editor
|
||||
*/
|
||||
@ -75,4 +89,5 @@ export function registerAdditionalToolbars(editor) {
|
||||
registerPrimaryToolbarGroups(editor);
|
||||
registerLinkContextToolbar(editor);
|
||||
registerImageContextToolbar(editor);
|
||||
registerObjectContextToolbar(editor);
|
||||
}
|
||||
|
Reference in New Issue
Block a user