From 5a5116a292c8266644abc7016048f80402201146 Mon Sep 17 00:00:00 2001 From: Robert Karlsson Date: Tue, 12 Jun 2018 15:55:10 +0200 Subject: [PATCH] Don't render hidden widgets in markdown visual editor (#1414) --- .all-contributorsrc | 29 +++++++++++++++++++ README.md | 4 +-- .../MarkdownControl/VisualEditor/Shortcode.js | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 61fe54174ee4..bb075814c25b 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -937,6 +937,35 @@ "contributions": [ "code" ] + }, + { + "login": "hennessyevan", + "name": "Evan Hennessy", + "avatar_url": "https://avatars1.githubusercontent.com/u/16711653?v=4", + "profile": "https://www.hennessyevan.com", + "contributions": [ + "plugin" + ] + }, + { + "login": "hasanavi", + "name": "Hasan Azizul Haque", + "avatar_url": "https://avatars1.githubusercontent.com/u/3259517?v=4", + "profile": "https://hasanavi.me", + "contributions": [ + "code", + "doc", + "ideas" + ] + }, + { + "login": "robertkarlsson", + "name": "Robert Karlsson", + "avatar_url": "https://avatars1.githubusercontent.com/u/5166612?v=4", + "profile": "https://github.com/robertkarlsson", + "contributions": [ + "bug" + ] } ] } diff --git a/README.md b/README.md index 6213b8e6e027..2a269ca7c9c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Netlify CMS -[![All Contributors](https://img.shields.io/badge/all_contributors-107-orange.svg)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-110-orange.svg)](#contributors) [![Open Source Helpers](https://www.codetriage.com/netlify/netlify-cms/badges/users.svg)](https://www.codetriage.com/netlify/netlify-cms) [![](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/netlify/netlifycms) @@ -77,7 +77,7 @@ These wonderful folks are responsible for developing and maintaining Netlify CMS | [
Tim Carry](http://www.pixelastic.com/)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=pixelastic "Code") [🎨](#design-pixelastic "Design") [πŸ“–](https://github.com/netlify/netlify-cms/commits?author=pixelastic "Documentation") | [
Sol Park](https://github.com/solpark)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=solpark "Code") | [
Michael Romani](https://github.com/MichaelRomani)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=MichaelRomani "Code") | [
Xifeng Jin](http://linkedin/in/xifengjin88)
[πŸ›](https://github.com/netlify/netlify-cms/issues?q=author%3Axifengjin88 "Bug reports") [πŸ’»](https://github.com/netlify/netlify-cms/commits?author=xifengjin88 "Code") | [
Pedro Duarte](http://pedroduarte.me)
[πŸ›](https://github.com/netlify/netlify-cms/issues?q=author%3Apeduarte "Bug reports") [πŸ’»](https://github.com/netlify/netlify-cms/commits?author=peduarte "Code") [πŸ“–](https://github.com/netlify/netlify-cms/commits?author=peduarte "Documentation") | [
Antonio Argote](http://antonioargote.com)
[🎨](#design-Strangehill "Design") | [
Kristaps Taube](https://www.ktaube.com)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=ktaube "Code") | | [
David Ko](https://github.com/daveyko)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=daveyko "Code") | [
IΓ±aki GarcΓ­a](http://www.txorua.com)
[🎨](#design-igarbla "Design") | [
Sam](https://github.com/gazebosx3)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=gazebosx3 "Code") | [
Josh Dzielak](https://dzello.com)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=dzello "Documentation") | [
Jeremy Bise](http://thosegeeks.com)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=jeremybise "Documentation") | [
terrierscript](https://terrierscript.com)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=terrierscript "Code") | [
Christopher Geary](https://twitter.com/crgeary)
[πŸ”Œ](#plugin-crgeary "Plugin/utility libraries") | | [
Brian Macdonald](https://github.com/brianlmacdonald)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=brianlmacdonald "Code") | [
John Vandenberg](https://jayvdb.github.io/)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=jayvdb "Documentation") | [
MarkZither](https://github.com/MarkZither)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=MarkZither "Documentation") | [
Rob Phoenix](https://www.robphoenix.com)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=robphoenix "Documentation") | [
Steve Lathrop](https://www.SteLa.io)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=slathrop "Code") [πŸ“–](https://github.com/netlify/netlify-cms/commits?author=slathrop "Documentation") [πŸ’‘](#example-slathrop "Examples") | [
Maciej Matuszewski](https://github.com/maciejmatu)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=maciejmatu "Code") | [
Eko Eryanto](https://github.com/ekoeryanto)
[πŸ”Œ](#plugin-ekoeryanto "Plugin/utility libraries") | -| [
Taylor D. Edmiston](http://blog.tedmiston.com/)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=tedmiston "Documentation") | [
Daniel Mahon](https://www.mahonstudios.com)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=danielmahon "Code") | +| [
Taylor D. Edmiston](http://blog.tedmiston.com/)
[πŸ“–](https://github.com/netlify/netlify-cms/commits?author=tedmiston "Documentation") | [
Daniel Mahon](https://www.mahonstudios.com)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=danielmahon "Code") | [
Evan Hennessy](https://www.hennessyevan.com)
[πŸ”Œ](#plugin-hennessyevan "Plugin/utility libraries") | [
Hasan Azizul Haque](https://hasanavi.me)
[πŸ’»](https://github.com/netlify/netlify-cms/commits?author=hasanavi "Code") [πŸ“–](https://github.com/netlify/netlify-cms/commits?author=hasanavi "Documentation") [πŸ€”](#ideas-hasanavi "Ideas, Planning, & Feedback") | [
Robert Karlsson](https://github.com/robertkarlsson)
[πŸ›](https://github.com/netlify/netlify-cms/issues?q=author%3Arobertkarlsson "Bug reports") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/Shortcode.js b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/Shortcode.js index 346ea3e2e1ba..0bb807a5ab27 100644 --- a/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/Shortcode.js +++ b/src/components/EditorWidgets/Markdown/MarkdownControl/VisualEditor/Shortcode.js @@ -66,6 +66,7 @@ class Shortcode extends React.Component { onOpenMediaLibrary, onRemoveInsertedMedia, } = this.props; + if (field.get('widget') === 'hidden') return null; const value = shortcodeData.get(field.get('name')); const key = `field-${ field.get('name') }`; const Control = getEditorControl();