<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eunjae Lee</title>
    <description>The latest articles on DEV Community by Eunjae Lee (@eunjae_lee).</description>
    <link>https://dev.to/eunjae_lee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F104681%2F6b844efd-40cb-4436-97ae-6c9851d178cc.JPG</url>
      <title>DEV Community: Eunjae Lee</title>
      <link>https://dev.to/eunjae_lee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eunjae_lee"/>
    <language>en</language>
    <item>
      <title>Field Plugin SDK v1 Stable Release</title>
      <dc:creator>Eunjae Lee</dc:creator>
      <pubDate>Wed, 08 Nov 2023 15:35:52 +0000</pubDate>
      <link>https://dev.to/storyblok/field-plugin-sdk-v1-stable-release-30jn</link>
      <guid>https://dev.to/storyblok/field-plugin-sdk-v1-stable-release-30jn</guid>
      <description>&lt;p&gt;We are happy to announce the stable release of Field Plugin SDK v1. Field Plugin SDK helps you create field plugins for your Storyblok projects in vanilla JavaScript, React, Vue, and any other frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's changed since beta
&lt;/h2&gt;

&lt;p&gt;For those following this project, here's a summary of the key changes since the beta version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Breaking change
&lt;/h3&gt;

&lt;p&gt;The setter function pattern is removed from &lt;code&gt;plugin.actions.setModalOpen&lt;/code&gt; and &lt;code&gt;plugin.actions.setContent&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-type SetModalOpen = (newValue: boolean | (prevValue: boolean) =&amp;gt; boolean) =&amp;gt; void;
&lt;/span&gt;&lt;span class="gi"&gt;+type SetModalOpen = (newValue: boolean) =&amp;gt; Promise&amp;lt;FieldPluginData&amp;gt;;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-type SetContent = (content: TContent | (prevContent: TContent) =&amp;gt; TContent) =&amp;gt; void;
&lt;/span&gt;&lt;span class="gi"&gt;+type SetContent = (content: TContent) =&amp;gt; Promise&amp;lt;FieldPluginData&amp;gt;;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;validateContent&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;createFieldPlugin&lt;/code&gt; and &lt;code&gt;useFieldPlugin&lt;/code&gt; now accepts an option called &lt;code&gt;validateContent&lt;/code&gt;, which allows you to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;validate the content&lt;/li&gt;
&lt;li&gt;make changes before sending it to the Storyblok Visual Editor&lt;/li&gt;
&lt;li&gt;provide type-safety
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;plugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useFieldPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="c1"&gt;// For example,&lt;/span&gt;
  &lt;span class="na"&gt;validateContent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`content is expected to be a string (actual value: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;)`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Manifest file
&lt;/h3&gt;

&lt;p&gt;The new templates come with a manifest file named &lt;code&gt;field-plugin.config.json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "options": [
    {
      "name": "somePredefinedOption",
      "value": "its value"
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which can be accessed like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;actions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useFieldPlugin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;somePredefinedOption&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's inside the SDK
&lt;/h2&gt;

&lt;p&gt;The Field Plugin SDK comprises three essential components:&lt;/p&gt;

&lt;h3&gt;
  
  
  Library
&lt;/h3&gt;

&lt;p&gt;The library empowers developers to create plugins using their preferred frontend framework. This flexibility allows you to leverage your existing skills and create custom plugins that perfectly align with your needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Command Line Interface (CLI)
&lt;/h3&gt;

&lt;p&gt;The CLI is designed to streamline your development experience. It offers multiple templates, making it easy for developers to get started quickly. Moreover, it promotes the adoption of Continuous Integration and Continuous Deployment (CI/CD) processes, enabling you to build robust and efficient workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sandbox
&lt;/h3&gt;

&lt;p&gt;To ensure a smooth and hassle-free experience, we have also developed a Sandbox environment. This Sandbox provides a dedicated space for testing and sharing your field plugins before they are ready for production. It offers a safe and controlled environment to fine-tune your plugins and gather valuable feedback from stakeholders.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn More
&lt;/h2&gt;

&lt;p&gt;You can learn more about the Field Plugin SDK: &lt;a href="https://www.storyblok.com/docs/plugins/field-plugins/introduction" rel="noopener noreferrer"&gt;https://www.storyblok.com/docs/plugins/field-plugins/introduction&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>react</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
