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',
});
}
+/**
+ * @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
*/
registerPrimaryToolbarGroups(editor);
registerLinkContextToolbar(editor);
registerImageContextToolbar(editor);
+ registerObjectContextToolbar(editor);
}
margin-left: auto;
margin-right: auto;
}
- img {
- max-width: 100%;
- height:auto;
- }
h1, h2, h3, h4, h5, h6, pre {
clear: left;
}
}
}
+// This is seperated out so we can target it out-of-editor by default
+// and use advanced (:not) syntax, not supported by things like PDF gen,
+// to target in-editor scenarios to handle edge-case of TinyMCE using an
+// image for data placeholders where we'd want height attributes to take effect.
+body .page-content img,
+.page-content img:not([data-mce-object]) {
+ max-width: 100%;
+ height:auto;
+}
+
/**
* Callouts
*/