diff --git a/assets/styles/main.scss b/assets/styles/main.scss
index d22f3ec08..662b8bb0d 100644
--- a/assets/styles/main.scss
+++ b/assets/styles/main.scss
@@ -78,45 +78,6 @@ blockquote {
}
}
-.hc-editor-content {
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
- &:not(:first-child) {
- margin-top: 2rem;
- }
- }
- p {
- &:not(:last-child) {
- margin-top: 0;
- margin-bottom: 0;
- }
- }
- dl,
- ol,
- ul,
- blockquote,
- pre,
- table {
- &:not(:first-child) {
- margin-top: 15px;
- }
- }
- *:first-child {
- margin-top: 0;
- }
- *:last-child {
- margin-bottom: 0;
- }
- // avoid double breaks
- br + p {
- margin-top: 0;
- }
-}
-
hr {
border: 0;
width: 100%;
diff --git a/components/Editor/plugins/eventHandler.js b/components/Editor/plugins/eventHandler.js
index 46137f5c1..b3e41ace5 100644
--- a/components/Editor/plugins/eventHandler.js
+++ b/components/Editor/plugins/eventHandler.js
@@ -15,18 +15,33 @@ export default class EventHandler extends Extension {
},
transformPastedHTML(html) {
html = html
- .replace(/(
\s*){2,}/gim, '
')
+ // remove all tags with "space only"
+ .replace(/<[a-z-]+>[\s]+<\/[a-z-]+>/gim, '')
+ // remove all iframes
.replace(
- /<\/(p|div|th|tr)>\s*(
\s*)+\s*<(p|div|th|tr)>/gim,
- '
'
- )
- .replace(
- /<(p|div|th|tr)>\s*(
\s*)+\s*<\/(p|div|th|tr)>/gim,
+ /(
'
+ )
+ // remove additional linebreaks inside p tags
+ .replace(
+ /<[a-z-]+>(<[a-z-]+>)*\s*(
\s*)+\s*(<\/[a-z-]+>)*<\/[a-z-]+>/gim,
+ ''
+ )
+ // remove additional linebreaks when first child inside p tags
+ .replace(/
(\s*
\s*)+/gim, '
')
+ // remove additional linebreaks when last child inside p tags
+ .replace(/(\s*
\s*)+<\/p>/gim, '