Skip to content

Commit

Permalink
Settings - Writing: add toggle for Shortcodes. Make it searchable, re…
Browse files Browse the repository at this point in the history
…move searchable module. Don't activate shortcodes by default. (#12092)
  • Loading branch information
eliorivero authored Apr 22, 2019
1 parent 4d2875e commit 6dad7c5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
1 change: 0 additions & 1 deletion _inc/client/searchable-modules/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const SearchableModules = withModuleSettingsFormHelpers(
'json-api',
'latex',
'notes',
'shortcodes',
'shortlinks',
];

Expand Down
30 changes: 28 additions & 2 deletions _inc/client/writing/composing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,18 @@ export class Composing extends React.Component {
const foundCopyPost = this.props.isModuleFound( 'copy-post' ),
foundAtD = this.props.isModuleFound( 'after-the-deadline' ),
foundLatex = this.props.isModuleFound( 'latex' ),
foundMarkdown = this.props.isModuleFound( 'markdown' );
foundMarkdown = this.props.isModuleFound( 'markdown' ),
foundShortcodes = this.props.isModuleFound( 'shortcodes' );

if ( ! foundCopyPost && ! foundMarkdown && ! foundAtD ) {
if ( ! foundCopyPost && ! foundMarkdown && ! foundAtD && ! foundShortcodes ) {
return null;
}

const markdown = this.props.module( 'markdown' ),
latex = this.props.module( 'latex' ),
atd = this.props.module( 'after-the-deadline' ),
copyPost = this.props.module( 'copy-post' ),
shortcodes = this.props.module( 'shortcodes' ),
unavailableInDevMode = this.props.isUnavailableInDevMode( 'after-the-deadline' ),
copyPostSettings = (
<SettingsGroup
Expand Down Expand Up @@ -289,6 +291,29 @@ export class Composing extends React.Component {
</FormFieldset>
</SettingsGroup>
),
shortcodeSettings = (
<SettingsGroup
module={ shortcodes }
support={ {
text: shortcodes.description,
link: 'https://jetpack.com/support/shortcode-embeds/',
} }
>
<FormFieldset>
<ModuleToggle
slug="shortcodes"
activated={ !! this.props.getOptionValue( 'shortcodes' ) }
toggling={ this.props.isSavingAnyOption( [ 'shortcodes' ] ) }
disabled={ this.props.isSavingAnyOption( [ 'shortcodes' ] ) }
toggleModule={ this.props.toggleModuleNow }
>
<span className="jp-form-toggle-explanation">
{ __( 'Compose using shortcodes to embed media from popular sites' ) }
</span>
</ModuleToggle>
</FormFieldset>
</SettingsGroup>
),
atdSettings = (
<FoldableCard
onOpen={ this.trackOpenCard }
Expand Down Expand Up @@ -327,6 +352,7 @@ export class Composing extends React.Component {
{ foundCopyPost && copyPostSettings }
{ foundMarkdown && markdownSettings }
{ foundLatex && latexSettings }
{ foundShortcodes && shortcodeSettings }
{ foundAtD && atdSettings }
</SettingsCard>
);
Expand Down
1 change: 1 addition & 0 deletions _inc/client/writing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class Writing extends React.Component {
'copy-post',
'masterbar',
'markdown',
'shortcodes',
'after-the-deadline',
'custom-content-types',
'post-by-email',
Expand Down
4 changes: 2 additions & 2 deletions modules/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

/**
* Module Name: Shortcode Embeds
* Module Description: Embed media from popular sites without any coding.
* Module Description: Shortcodes are WordPress-specific markup that let you add media from popular sites. This feature is no longer necessary as the editor now handles media embeds rather gracefully.
* Sort Order: 3
* First Introduced: 1.1
* Major Changes In: 1.2
* Requires Connection: No
* Auto Activate: Yes
* Auto Activate: No
* Module Tags: Photos and Videos, Social, Writing, Appearance
* Feature: Writing
* Additional Search Queries: shortcodes, shortcode, embeds, media, bandcamp, dailymotion, facebook, flickr, google calendars, google maps, google+, polldaddy, recipe, recipes, scribd, slideshare, slideshow, slideshows, soundcloud, ted, twitter, vimeo, vine, youtube
Expand Down

0 comments on commit 6dad7c5

Please sign in to comment.