ghost 5.70.1 → 5.71.0
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/README.md +1 -1
- package/components/tryghost-adapter-cache-memory-ttl-5.71.0.tgz +0 -0
- package/components/{tryghost-adapter-cache-redis-5.70.1.tgz → tryghost-adapter-cache-redis-5.71.0.tgz} +0 -0
- package/components/{tryghost-adapter-manager-5.70.1.tgz → tryghost-adapter-manager-5.71.0.tgz} +0 -0
- package/components/tryghost-announcement-bar-settings-5.71.0.tgz +0 -0
- package/components/tryghost-api-framework-5.71.0.tgz +0 -0
- package/components/{tryghost-api-version-compatibility-service-5.70.1.tgz → tryghost-api-version-compatibility-service-5.71.0.tgz} +0 -0
- package/components/{tryghost-audience-feedback-5.70.1.tgz → tryghost-audience-feedback-5.71.0.tgz} +0 -0
- package/components/tryghost-bookshelf-repository-5.71.0.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.71.0.tgz +0 -0
- package/components/tryghost-collections-5.71.0.tgz +0 -0
- package/components/tryghost-constants-5.71.0.tgz +0 -0
- package/components/tryghost-custom-theme-settings-service-5.71.0.tgz +0 -0
- package/components/{tryghost-data-generator-5.70.1.tgz → tryghost-data-generator-5.71.0.tgz} +0 -0
- package/components/{tryghost-domain-events-5.70.1.tgz → tryghost-domain-events-5.71.0.tgz} +0 -0
- package/components/tryghost-donations-5.71.0.tgz +0 -0
- package/components/{tryghost-dynamic-routing-events-5.70.1.tgz → tryghost-dynamic-routing-events-5.71.0.tgz} +0 -0
- package/components/{tryghost-email-analytics-provider-mailgun-5.70.1.tgz → tryghost-email-analytics-provider-mailgun-5.71.0.tgz} +0 -0
- package/components/{tryghost-email-analytics-service-5.70.1.tgz → tryghost-email-analytics-service-5.71.0.tgz} +0 -0
- package/components/tryghost-email-content-generator-5.71.0.tgz +0 -0
- package/components/{tryghost-email-events-5.70.1.tgz → tryghost-email-events-5.71.0.tgz} +0 -0
- package/components/tryghost-email-service-5.71.0.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.71.0.tgz +0 -0
- package/components/tryghost-event-aware-cache-wrapper-5.71.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.71.0.tgz +0 -0
- package/components/{tryghost-external-media-inliner-5.70.1.tgz → tryghost-external-media-inliner-5.71.0.tgz} +0 -0
- package/components/{tryghost-extract-api-key-5.70.1.tgz → tryghost-extract-api-key-5.71.0.tgz} +0 -0
- package/components/{tryghost-html-to-plaintext-5.70.1.tgz → tryghost-html-to-plaintext-5.71.0.tgz} +0 -0
- package/components/tryghost-i18n-5.71.0.tgz +0 -0
- package/components/{tryghost-importer-handler-content-files-5.70.1.tgz → tryghost-importer-handler-content-files-5.71.0.tgz} +0 -0
- package/components/tryghost-importer-revue-5.71.0.tgz +0 -0
- package/components/{tryghost-in-memory-repository-5.70.1.tgz → tryghost-in-memory-repository-5.71.0.tgz} +0 -0
- package/components/{tryghost-job-manager-5.70.1.tgz → tryghost-job-manager-5.71.0.tgz} +0 -0
- package/components/{tryghost-link-redirects-5.70.1.tgz → tryghost-link-redirects-5.71.0.tgz} +0 -0
- package/components/tryghost-link-replacer-5.71.0.tgz +0 -0
- package/components/{tryghost-link-tracking-5.70.1.tgz → tryghost-link-tracking-5.71.0.tgz} +0 -0
- package/components/{tryghost-magic-link-5.70.1.tgz → tryghost-magic-link-5.71.0.tgz} +0 -0
- package/components/tryghost-mail-events-5.71.0.tgz +0 -0
- package/components/tryghost-mailgun-client-5.71.0.tgz +0 -0
- package/components/tryghost-member-attribution-5.71.0.tgz +0 -0
- package/components/{tryghost-member-events-5.70.1.tgz → tryghost-member-events-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-api-5.70.1.tgz → tryghost-members-api-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-csv-5.70.1.tgz → tryghost-members-csv-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-events-service-5.70.1.tgz → tryghost-members-events-service-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-importer-5.70.1.tgz → tryghost-members-importer-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-offers-5.70.1.tgz → tryghost-members-offers-5.71.0.tgz} +0 -0
- package/components/{tryghost-members-payments-5.70.1.tgz → tryghost-members-payments-5.71.0.tgz} +0 -0
- package/components/tryghost-members-ssr-5.71.0.tgz +0 -0
- package/components/{tryghost-members-stripe-service-5.70.1.tgz → tryghost-members-stripe-service-5.71.0.tgz} +0 -0
- package/components/{tryghost-mentions-email-report-5.70.1.tgz → tryghost-mentions-email-report-5.71.0.tgz} +0 -0
- package/components/{tryghost-milestones-5.70.1.tgz → tryghost-milestones-5.71.0.tgz} +0 -0
- package/components/{tryghost-minifier-5.70.1.tgz → tryghost-minifier-5.71.0.tgz} +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.71.0.tgz +0 -0
- package/components/{tryghost-mw-api-version-mismatch-5.70.1.tgz → tryghost-mw-api-version-mismatch-5.71.0.tgz} +0 -0
- package/components/tryghost-mw-cache-control-5.71.0.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.71.0.tgz +0 -0
- package/components/{tryghost-mw-session-from-token-5.70.1.tgz → tryghost-mw-session-from-token-5.71.0.tgz} +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.71.0.tgz +0 -0
- package/components/{tryghost-mw-version-match-5.70.1.tgz → tryghost-mw-version-match-5.71.0.tgz} +0 -0
- package/components/{tryghost-mw-vhost-5.70.1.tgz → tryghost-mw-vhost-5.71.0.tgz} +0 -0
- package/components/{tryghost-nql-filter-expansions-5.70.1.tgz → tryghost-nql-filter-expansions-5.71.0.tgz} +0 -0
- package/components/tryghost-oembed-service-5.71.0.tgz +0 -0
- package/components/{tryghost-package-json-5.70.1.tgz → tryghost-package-json-5.71.0.tgz} +0 -0
- package/components/{tryghost-post-events-5.70.1.tgz → tryghost-post-events-5.71.0.tgz} +0 -0
- package/components/{tryghost-post-revisions-5.70.1.tgz → tryghost-post-revisions-5.71.0.tgz} +0 -0
- package/components/{tryghost-posts-service-5.70.1.tgz → tryghost-posts-service-5.71.0.tgz} +0 -0
- package/components/tryghost-recommendations-5.71.0.tgz +0 -0
- package/components/tryghost-referrers-5.71.0.tgz +0 -0
- package/components/{tryghost-security-5.70.1.tgz → tryghost-security-5.71.0.tgz} +0 -0
- package/components/tryghost-session-service-5.71.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.71.0.tgz +0 -0
- package/components/tryghost-slack-notifications-5.71.0.tgz +0 -0
- package/components/{tryghost-staff-service-5.70.1.tgz → tryghost-staff-service-5.71.0.tgz} +0 -0
- package/components/tryghost-stats-service-5.71.0.tgz +0 -0
- package/components/{tryghost-tiers-5.70.1.tgz → tryghost-tiers-5.71.0.tgz} +0 -0
- package/components/tryghost-update-check-service-5.71.0.tgz +0 -0
- package/components/{tryghost-verification-trigger-5.70.1.tgz → tryghost-verification-trigger-5.71.0.tgz} +0 -0
- package/components/{tryghost-version-notifications-data-service-5.70.1.tgz → tryghost-version-notifications-data-service-5.71.0.tgz} +0 -0
- package/components/tryghost-webmentions-5.71.0.tgz +0 -0
- package/content/themes/source/assets/built/screen.css +1 -1
- package/content/themes/source/assets/built/screen.css.map +1 -1
- package/content/themes/source/assets/css/screen.css +105 -2
- package/content/themes/source/package.json +1 -1
- package/content/themes/source/partials/components/post-list.hbs +28 -19
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-0b0348c8.mjs → CodeEditorView-cf9b94da.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-c0ec330d.mjs → index-2cbdc6fc.mjs} +5764 -5641
- package/core/built/admin/assets/admin-x-settings/{limit-service-57764392.mjs → limit-service-c2ca5332.mjs} +4862 -5021
- package/core/built/admin/assets/admin-x-settings/{modals-073c681a.mjs → modals-3c8a0931.mjs} +2283 -2284
- package/core/built/admin/assets/{chunk.143.faae1eef2142011c150d.js → chunk.143.dd35d008afe4417cb7b6.js} +11 -11
- package/core/built/admin/assets/{chunk.178.a0feb7ec6d36a13b6fb1.js → chunk.178.5c10121aa029f6b9fab7.js} +4 -4
- package/core/built/admin/assets/{chunk.334.3498cc12ebd02c179e3a.js → chunk.338.a23271afc734a6de1d3b.js} +7154 -6587
- package/core/built/admin/assets/{chunk.334.3498cc12ebd02c179e3a.js.LICENSE.txt → chunk.338.a23271afc734a6de1d3b.js.LICENSE.txt} +7 -0
- package/core/built/admin/assets/{ghost-71766888f233d8996c2171e03257c940.js → ghost-a43c6dbe8d871a5929a0c4ccb54d391e.js} +22 -21
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +15657 -15678
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +128 -128
- package/core/built/admin/index.html +4 -4
- package/core/frontend/helpers/ghost_head.js +1 -1
- package/core/frontend/helpers/tpl/recommendations.hbs +5 -1
- package/core/frontend/services/routing/controllers/unsubscribe.js +41 -1
- package/core/server/api/endpoints/utils/serializers/input/pages.js +2 -5
- package/core/server/api/endpoints/utils/serializers/input/posts.js +2 -5
- package/core/server/lib/lexical.js +22 -0
- package/core/server/models/post.js +7 -2
- package/core/shared/labs.js +4 -3
- package/package.json +157 -157
- package/yarn.lock +387 -248
- package/components/tryghost-adapter-cache-memory-ttl-5.70.1.tgz +0 -0
- package/components/tryghost-announcement-bar-settings-5.70.1.tgz +0 -0
- package/components/tryghost-api-framework-5.70.1.tgz +0 -0
- package/components/tryghost-bookshelf-repository-5.70.1.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.70.1.tgz +0 -0
- package/components/tryghost-collections-5.70.1.tgz +0 -0
- package/components/tryghost-constants-5.70.1.tgz +0 -0
- package/components/tryghost-custom-theme-settings-service-5.70.1.tgz +0 -0
- package/components/tryghost-donations-5.70.1.tgz +0 -0
- package/components/tryghost-email-content-generator-5.70.1.tgz +0 -0
- package/components/tryghost-email-service-5.70.1.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.70.1.tgz +0 -0
- package/components/tryghost-event-aware-cache-wrapper-5.70.1.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.70.1.tgz +0 -0
- package/components/tryghost-i18n-5.70.1.tgz +0 -0
- package/components/tryghost-importer-revue-5.70.1.tgz +0 -0
- package/components/tryghost-link-replacer-5.70.1.tgz +0 -0
- package/components/tryghost-mail-events-5.70.1.tgz +0 -0
- package/components/tryghost-mailgun-client-5.70.1.tgz +0 -0
- package/components/tryghost-member-attribution-5.70.1.tgz +0 -0
- package/components/tryghost-members-ssr-5.70.1.tgz +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.70.1.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.70.1.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.70.1.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.70.1.tgz +0 -0
- package/components/tryghost-oembed-service-5.70.1.tgz +0 -0
- package/components/tryghost-recommendations-5.70.1.tgz +0 -0
- package/components/tryghost-referrers-5.70.1.tgz +0 -0
- package/components/tryghost-session-service-5.70.1.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.70.1.tgz +0 -0
- package/components/tryghost-slack-notifications-5.70.1.tgz +0 -0
- package/components/tryghost-stats-service-5.70.1.tgz +0 -0
- package/components/tryghost-update-check-service-5.70.1.tgz +0 -0
- package/components/tryghost-webmentions-5.70.1.tgz +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<title>Ghost Admin</title>
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.
|
|
11
|
+
<meta name="ghost-admin/config/environment" content="%7B%22modulePrefix%22%3A%22ghost-admin%22%2C%22environment%22%3A%22production%22%2C%22cdnUrl%22%3A%22%22%2C%22editorUrl%22%3A%22%22%2C%22rootURL%22%3A%22%22%2C%22locationType%22%3A%22trailing-hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%2C%22Array%22%3Atrue%2C%22String%22%3Atrue%2C%22Function%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_JQUERY_INTEGRATION%22%3Atrue%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22version%22%3A%225.71%22%2C%22name%22%3A%22ghost-admin%22%7D%2C%22ember-simple-auth%22%3A%7B%7D%2C%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22%40sentry%2Fember%22%3A%7B%22disablePerformance%22%3Atrue%2C%22sentry%22%3A%7B%7D%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%3Afalse%2C%22useDefaultPassthroughs%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-load%22%3A%7B%22loadingIndicatorClass%22%3A%22ember-load-indicator%22%7D%2C%22editorFilename%22%3A%22koenig-lexical.umd.js%22%2C%22editorHash%22%3A%22f960def3fe%22%2C%22adminXSettingsFilename%22%3A%22admin-x-settings.js%22%2C%22adminXSettingsHash%22%3A%22b4a426895e%22%7D" />
|
|
12
12
|
|
|
13
13
|
<meta name="HandheldFriendly" content="True" />
|
|
14
14
|
<meta name="MobileOptimized" content="320" />
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
<div id="ember-basic-dropdown-wormhole"></div>
|
|
58
58
|
|
|
59
59
|
<script src="assets/vendor-d4aa86641c6080ce3bc58e6d54252774.js"></script>
|
|
60
|
-
<script src="assets/chunk.
|
|
61
|
-
<script src="assets/chunk.143.
|
|
62
|
-
<script src="assets/ghost-
|
|
60
|
+
<script src="assets/chunk.338.a23271afc734a6de1d3b.js"></script>
|
|
61
|
+
<script src="assets/chunk.143.dd35d008afe4417cb7b6.js"></script>
|
|
62
|
+
<script src="assets/ghost-a43c6dbe8d871a5929a0c4ccb54d391e.js"></script>
|
|
63
63
|
</body>
|
|
64
64
|
</html>
|
|
@@ -46,7 +46,7 @@ function finaliseStructuredData(meta) {
|
|
|
46
46
|
|
|
47
47
|
function getMembersHelper(data, frontendKey) {
|
|
48
48
|
// Do not load Portal if both Memberships and Tips & Donations are disabled
|
|
49
|
-
if (!settingsCache.get('members_enabled') && !settingsCache.get('donations_enabled')) {
|
|
49
|
+
if (!settingsCache.get('members_enabled') && !(settingsCache.get('donations_enabled') && labs.isSet('tipsAndDonations'))) {
|
|
50
50
|
return '';
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
{{#each recommendations as |rec|}}
|
|
4
4
|
<li class="recommendation">
|
|
5
5
|
<a href="{{rec.url}}" data-recommendation="{{rec.id}}" target="_blank" rel="noopener">
|
|
6
|
-
<
|
|
6
|
+
<div class="recommendation-favicon">
|
|
7
|
+
{{#if rec.favicon}}
|
|
8
|
+
<img src="{{rec.favicon}}" alt="{{rec.title}}" loading="lazy" onerror="this.style.display='none';">
|
|
9
|
+
{{/if}}
|
|
10
|
+
</div>
|
|
7
11
|
<h5 class="recommendation-title">{{rec.title}}</h5>
|
|
8
12
|
<span class="recommendation-url">{{readable_url rec.url}}</span>
|
|
9
13
|
<p class="recommendation-description">{{rec.description}}</p>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const debug = require('@tryghost/debug')('services:routing:controllers:unsubscribe');
|
|
2
2
|
const url = require('url');
|
|
3
|
-
|
|
3
|
+
const members = require('../../../../server/services/members');
|
|
4
4
|
const urlUtils = require('../../../../shared/url-utils');
|
|
5
|
+
const labs = require('../../../../shared/labs');
|
|
6
|
+
const logging = require('@tryghost/logging');
|
|
5
7
|
|
|
6
8
|
module.exports = async function unsubscribeController(req, res) {
|
|
7
9
|
debug('unsubscribeController');
|
|
@@ -13,6 +15,44 @@ module.exports = async function unsubscribeController(req, res) {
|
|
|
13
15
|
return res.end('Email address not found.');
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
if (req.method === 'POST' && labs.isSet('listUnsubscribeHeader')) {
|
|
19
|
+
logging.info('[List-Unsubscribe] Received POST unsubscribe for ' + query.uuid + ', newsletter: ' + (query.newsletter ?? 'null') + ', comments: ' + (query.comments ?? 'false'));
|
|
20
|
+
|
|
21
|
+
// Do an actual unsubscribe
|
|
22
|
+
try {
|
|
23
|
+
const member = await members.api.members.get({uuid: query.uuid}, {withRelated: ['newsletters']});
|
|
24
|
+
if (member) {
|
|
25
|
+
if (query.comments) {
|
|
26
|
+
// Unsubscribe from comments
|
|
27
|
+
await members.api.members.update({
|
|
28
|
+
enable_comment_notifications: false
|
|
29
|
+
}, {
|
|
30
|
+
id: member.id
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
const filteredNewsletters = query.newsletter ?
|
|
34
|
+
member.related('newsletters').models
|
|
35
|
+
.filter(n => n.get('uuid') !== query.newsletter)
|
|
36
|
+
.map(n => ({id: n.id}))
|
|
37
|
+
: [];
|
|
38
|
+
await members.api.members.update({
|
|
39
|
+
newsletters: filteredNewsletters
|
|
40
|
+
}, {
|
|
41
|
+
id: member.id
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
logging.error({
|
|
47
|
+
err: e,
|
|
48
|
+
message: '[List-Unsubscribe] Failed POST unsubscribe for ' + query.uuid
|
|
49
|
+
});
|
|
50
|
+
return res.status(400).end();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return res.status(201).end();
|
|
54
|
+
}
|
|
55
|
+
|
|
16
56
|
const redirectUrl = new URL(urlUtils.urlFor('home', true));
|
|
17
57
|
redirectUrl.searchParams.append('uuid', query.uuid);
|
|
18
58
|
if (query.newsletter) {
|
|
@@ -6,7 +6,6 @@ const slugFilterOrder = require('./utils/slug-filter-order');
|
|
|
6
6
|
const localUtils = require('../../index');
|
|
7
7
|
const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta;
|
|
8
8
|
const clean = require('./utils/clean');
|
|
9
|
-
const labs = require('../../../../../../shared/labs');
|
|
10
9
|
const lexical = require('../../../../../lib/lexical');
|
|
11
10
|
|
|
12
11
|
function removeSourceFormats(frame) {
|
|
@@ -57,7 +56,7 @@ function defaultFormat(frame) {
|
|
|
57
56
|
return;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
frame.options.formats = 'mobiledoc';
|
|
59
|
+
frame.options.formats = 'mobiledoc,lexical';
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
function handlePostsMeta(frame) {
|
|
@@ -138,9 +137,7 @@ module.exports = {
|
|
|
138
137
|
|
|
139
138
|
// normally we don't allow both mobiledoc+lexical but the model layer will remove lexical
|
|
140
139
|
// if mobiledoc is already present to avoid migrating formats outside of an explicit conversion
|
|
141
|
-
|
|
142
|
-
frame.data.pages[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
|
143
|
-
}
|
|
140
|
+
frame.data.pages[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
|
144
141
|
}
|
|
145
142
|
}
|
|
146
143
|
|
|
@@ -6,7 +6,6 @@ const localUtils = require('../../index');
|
|
|
6
6
|
const mobiledoc = require('../../../../../lib/mobiledoc');
|
|
7
7
|
const postsMetaSchema = require('../../../../../data/schema').tables.posts_meta;
|
|
8
8
|
const clean = require('./utils/clean');
|
|
9
|
-
const labs = require('../../../../../../shared/labs');
|
|
10
9
|
const lexical = require('../../../../../lib/lexical');
|
|
11
10
|
|
|
12
11
|
function removeSourceFormats(frame) {
|
|
@@ -74,7 +73,7 @@ function defaultFormat(frame) {
|
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
frame.options.formats = 'mobiledoc';
|
|
76
|
+
frame.options.formats = 'mobiledoc,lexical';
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
function handlePostsMeta(frame) {
|
|
@@ -172,9 +171,7 @@ module.exports = {
|
|
|
172
171
|
|
|
173
172
|
// normally we don't allow both mobiledoc+lexical but the model layer will remove lexical
|
|
174
173
|
// if mobiledoc is already present to avoid migrating formats outside of an explicit conversion
|
|
175
|
-
|
|
176
|
-
frame.data.posts[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
|
177
|
-
}
|
|
174
|
+
frame.data.posts[0].lexical = JSON.stringify(lexical.htmlToLexicalConverter(html));
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
177
|
|
|
@@ -16,6 +16,28 @@ function populateNodes() {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
module.exports = {
|
|
19
|
+
get blankDocument() {
|
|
20
|
+
return {
|
|
21
|
+
root: {
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
children: [],
|
|
25
|
+
direction: null,
|
|
26
|
+
format: '',
|
|
27
|
+
indent: 0,
|
|
28
|
+
type: 'paragraph',
|
|
29
|
+
version: 1
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
direction: null,
|
|
33
|
+
format: '',
|
|
34
|
+
indent: 0,
|
|
35
|
+
type: 'root',
|
|
36
|
+
version: 1
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
|
|
19
41
|
get lexicalHtmlRenderer() {
|
|
20
42
|
if (!lexicalHtmlRenderer) {
|
|
21
43
|
if (!nodes) {
|
|
@@ -392,6 +392,11 @@ Post = ghostBookshelf.Model.extend({
|
|
|
392
392
|
const html = await lexicalLib.render(model.get('lexical'));
|
|
393
393
|
const plaintext = htmlToPlaintext.excerpt(html);
|
|
394
394
|
|
|
395
|
+
// avoid a DB query if we have no html - knex will set it to an empty string rather than NULL
|
|
396
|
+
if (!html && !model.get('plaintext')) {
|
|
397
|
+
return model;
|
|
398
|
+
}
|
|
399
|
+
|
|
395
400
|
// set model attributes so they are available immediately in code that uses the returned model
|
|
396
401
|
model.set('html', html);
|
|
397
402
|
model.set('plaintext', plaintext);
|
|
@@ -716,7 +721,7 @@ Post = ghostBookshelf.Model.extend({
|
|
|
716
721
|
}
|
|
717
722
|
|
|
718
723
|
if (!this.get('mobiledoc') && !this.get('lexical')) {
|
|
719
|
-
this.set('
|
|
724
|
+
this.set('lexical', JSON.stringify(lexicalLib.blankDocument));
|
|
720
725
|
}
|
|
721
726
|
|
|
722
727
|
// If we're force re-rendering we want to make sure that all image cards
|
|
@@ -984,7 +989,7 @@ Post = ghostBookshelf.Model.extend({
|
|
|
984
989
|
}
|
|
985
990
|
|
|
986
991
|
// CASE: Convert post to lexical on the fly
|
|
987
|
-
if (
|
|
992
|
+
if (options.convert_to_lexical) {
|
|
988
993
|
ops.push(async function convertToLexical() {
|
|
989
994
|
const mobiledoc = model.get('mobiledoc');
|
|
990
995
|
if (mobiledoc !== null) { // only run conversion when there is a mobiledoc string
|
package/core/shared/labs.js
CHANGED
|
@@ -20,7 +20,7 @@ const GA_FEATURES = [
|
|
|
20
20
|
'outboundLinkTagging',
|
|
21
21
|
'announcementBar',
|
|
22
22
|
'signupForm',
|
|
23
|
-
'
|
|
23
|
+
'recommendations'
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
// NOTE: this allowlist is meant to be used to filter out any unexpected
|
|
@@ -41,8 +41,9 @@ const ALPHA_FEATURES = [
|
|
|
41
41
|
'collectionsCard',
|
|
42
42
|
'tipsAndDonations',
|
|
43
43
|
'importMemberTier',
|
|
44
|
-
'
|
|
45
|
-
'
|
|
44
|
+
'lexicalIndicators',
|
|
45
|
+
'listUnsubscribeHeader',
|
|
46
|
+
'editorEmojiPicker'
|
|
46
47
|
];
|
|
47
48
|
|
|
48
49
|
module.exports.GA_KEYS = [...GA_FEATURES];
|