@tryghost/kg-mobiledoc-html-renderer 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2021 Ghost Foundation
3
+ Copyright (c) 2013-2022 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -36,4 +36,4 @@ Follow the instructions for the top-level repo.
36
36
 
37
37
  # Copyright & License
38
38
 
39
- Copyright (c) 2013-2021 Ghost Foundation - Released under the [MIT license](LICENSE).
39
+ Copyright (c) 2013-2022 Ghost Foundation - Released under the [MIT license](LICENSE).
@@ -74,6 +74,19 @@ class DomModifier {
74
74
  node.setAttribute('id', id);
75
75
  }
76
76
 
77
+ wrapBlockquoteContentInP(node) {
78
+ if (node.firstChild && node.firstChild.tagName === 'P') {
79
+ return;
80
+ }
81
+
82
+ const p = this.options.dom.createElement('p');
83
+ while (node.firstChild) {
84
+ p.appendChild(node.firstChild);
85
+ }
86
+
87
+ node.appendChild(p);
88
+ }
89
+
77
90
  modifyChildren(node) {
78
91
  walkDom(node, this.modify.bind(this));
79
92
  }
@@ -83,6 +96,11 @@ class DomModifier {
83
96
  if (node.nodeType === 1 && node.nodeName.match(/^h\d$/i)) {
84
97
  this.addHeadingId(node);
85
98
  }
99
+
100
+ // wrap blockquote content in P tag for emails
101
+ if (this.options.target === 'email' && node.nodeType === 1 && node.nodeName === 'BLOCKQUOTE') {
102
+ this.wrapBlockquoteContentInP(node);
103
+ }
86
104
  }
87
105
  }
88
106
 
@@ -132,7 +150,7 @@ class MobiledocHtmlRenderer {
132
150
 
133
151
  // Walk the DOM output and modify nodes as needed
134
152
  // eg. to add ID attributes to heading elements
135
- const modifier = new DomModifier({ghostVersion});
153
+ const modifier = new DomModifier(Object.assign({}, cardOptions, {dom: this.options.dom}));
136
154
  modifier.modifyChildren(rendered.result);
137
155
 
138
156
  const output = serializer.serializeChildren(rendered.result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/kg-mobiledoc-html-renderer",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-mobiledoc-html-renderer",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "simple-dom": "^1.4.0"
28
28
  },
29
29
  "devDependencies": {
30
- "c8": "7.10.0"
30
+ "c8": "7.11.0"
31
31
  },
32
- "gitHead": "596e1f3f0d36c905c5cfdd1da2a2acbcdb4f4add"
32
+ "gitHead": "d775807eb5039489e68197b9a2c31ae999499beb"
33
33
  }