• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 968e1951319a69b551587c91336c23b536bcefce

28 Mar 2024 08:42AM UTC coverage: 53.779%. First build
968e1951319a69b551587c91336c23b536bcefce

push

github

igorschoester
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into feature/woo-new-editor

# Conflicts:
#	config/webpack/webpack.config.base.js

7588 of 13915 branches covered (54.53%)

Branch coverage included in aggregate %.

31 of 47 new or added lines in 18 files covered. (65.96%)

29666 of 55358 relevant lines covered (53.59%)

40476.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/js/src/elementor/containers/TwitterEditor.js
1
/* External dependencies */
2
import { compose } from "@wordpress/compose";
3
import { withDispatch, withSelect, dispatch as wpDataDispatch } from "@wordpress/data";
4

5
/* Internal dependencies */
6
import TwitterWrapper from "../../components/social/TwitterWrapper";
7
import getL10nObject from "../../analysis/getL10nObject";
8
import withLocation from "../../helpers/withLocation";
9
import { getCurrentReplacementVariablesForEditor } from "../replaceVars/elementor-replacevar-plugin";
10
import { openMedia, prepareTwitterPreviewImage } from "../../helpers/selectMedia";
11

NEW
12
const socialMediumName = "X";
×
13

14
/**
15
 * Lazy function to open the media instance.
16
 *
17
 * @returns {void}
18
 */
19
const selectMedia = () => {
×
20
        openMedia( ( image ) => wpDataDispatch( "yoast-seo/editor" ).setTwitterPreviewImage( prepareTwitterPreviewImage( image ) ) );
×
21
};
22

23
/* eslint-disable complexity */
24
export default compose( [
25
        withSelect( select => {
26
                const {
27
                        getTwitterDescription,
28
                        getTwitterTitle,
29
                        getTwitterImageUrl,
30
                        getFacebookImageUrl,
31
                        getFacebookTitle,
32
                        getFacebookDescription,
33
                        getDescription,
34
                        getSeoTitle,
35
                        getTwitterWarnings,
36
                        getTwitterImageType,
37
                        getEditorDataImageFallback,
38
                        getRecommendedReplaceVars,
39
                        getSiteUrl,
40
                        getSeoTitleTemplate,
41
                        getSeoTitleTemplateNoFallback,
42
                        getSocialTitleTemplate,
43
                        getSeoDescriptionTemplate,
44
                        getSocialDescriptionTemplate,
45
                        getEditorDataExcerptWithFallback,
46
                        getTwitterAltText,
47
                } = select( "yoast-seo/editor" );
×
48

49
                const titleInputPlaceholder  = "";
×
50

51
                const descriptionInputPlaceholder  = "";
×
52

53
                return {
×
54
                        imageUrl: getTwitterImageUrl(),
55
                        imageFallbackUrl: getFacebookImageUrl() || getEditorDataImageFallback(),
×
56
                        recommendedReplacementVariables: getRecommendedReplaceVars(),
57
                        replacementVariables: getCurrentReplacementVariablesForEditor(),
58
                        description: getTwitterDescription(),
59
                        descriptionPreviewFallback: getSocialDescriptionTemplate() ||
×
60
                                getFacebookDescription() ||
61
                                getDescription() ||
62
                                getSeoDescriptionTemplate() ||
63
                                getEditorDataExcerptWithFallback() ||
64
                                descriptionInputPlaceholder,
65
                        title: getTwitterTitle(),
66
                        titlePreviewFallback: getSocialTitleTemplate() ||
×
67
                                getFacebookTitle() ||
68
                                getSeoTitle() ||
69
                                getSeoTitleTemplateNoFallback() ||
70
                                getSeoTitleTemplate() ||
71
                                titleInputPlaceholder,
72
                        imageWarnings: getTwitterWarnings(),
73
                        siteUrl: getSiteUrl(),
74
                        isPremium: !! getL10nObject().isPremium,
75
                        isLarge: getTwitterImageType() !== "summary",
76
                        titleInputPlaceholder,
77
                        descriptionInputPlaceholder,
78
                        socialMediumName,
79
                        alt: getTwitterAltText(),
80
                };
81
        } ),
82

83
        withDispatch( dispatch => {
84
                const {
85
                        setTwitterPreviewTitle,
86
                        setTwitterPreviewDescription,
87
                        clearTwitterPreviewImage,
88
                        loadTwitterPreviewData,
89
                } = dispatch( "yoast-seo/editor" );
×
90

91
                return {
×
92
                        onSelectImageClick: selectMedia,
93
                        onRemoveImageClick:        clearTwitterPreviewImage,
94
                        onDescriptionChange: setTwitterPreviewDescription,
95
                        onTitleChange: setTwitterPreviewTitle,
96
                        onLoad: loadTwitterPreviewData,
97
                };
98
        } ),
99

100
        withLocation(),
101
] )( TwitterWrapper );
102
/* eslint-enable complexity */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc