fix: Improvements to image positioning (#3061)

* fix: Empty paragraph below images that confuses block insertion

* Remove spacing for caption when unused
This commit is contained in:
Tom Moor
2022-02-05 10:14:10 -08:00
committed by GitHub
parent ae0644177b
commit c7df74fcc4
5 changed files with 26 additions and 10 deletions

View File

@@ -55,6 +55,8 @@ export default class ComponentView {
? document.createElement("span")
: document.createElement("div");
this.dom.classList.add(`component-${node.type.name}`);
this.renderElement();
}

View File

@@ -120,6 +120,7 @@ const EditorStyles = styled.div<{
}
.image {
line-height: 0;
text-align: center;
max-width: 100%;
clear: both;
@@ -200,6 +201,19 @@ const EditorStyles = styled.div<{
pointer-events: none;
}
img.ProseMirror-separator {
display: inline;
border: none !important;
margin: 0 !important;
}
// Removes forced paragraph spaces below images, this is needed to images
// being inline nodes that are displayed like blocks
.component-image + img.ProseMirror-separator,
.component-image + img.ProseMirror-separator + br.ProseMirror-trailingBreak {
display: none;
}
.ProseMirror[contenteditable="false"] {
.caption {
pointer-events: none;