Ausnahme gefangen: SSL certificate problem: certificate is not yet valid 📌 How to Add Writing Assistance to Any JavaScript App in Minutes

🏠 Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeiträge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden Überblick über die wichtigsten Aspekte der IT-Sicherheit in einer sich ständig verändernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch übersetzen, erst Englisch auswählen dann wieder Deutsch!

Google Android Playstore Download Button für Team IT Security



📚 How to Add Writing Assistance to Any JavaScript App in Minutes


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

You’ve launched your app. Maybe it’s the next great blogging platform, marketplace, or social media platform. Whatever it is, your users are writing, and it’s important to you and them that they can write well. Thankfully, you’ve armed your users with a rich text editor that can do things like mark up their text, embed rich media, and tag posts with hashtags. But what about making sure that the text itself is clear, compelling, and grammatically correct? In just five minutes, you can use the Grammarly Text Editor SDK to add writing assistance to any JavaScript application.

The Grammarly Text Editor Plugin running in a text editor. The Grammarly button appears once the Text Editor Plugin has been initialized.

What’s the Grammarly Text Editor SDK?

The Grammarly Text Editor SDK provides a JavaScript plugin that lets you add Grammarly’s writing assistance to any <textarea>,<input>, or contenteditable element in your application. As they type, your users will automatically get real-time writing suggestions for correctness, clarity, tone, and more, without needing to sign up for a Grammarly account. You can also customize the plugin to tailor it to your application’s UX. The core functionality is free, and you can sign up for the paid Plus plan to get advanced writing features.

Adding writing assistance to your web app

Let’s walk through integrating Grammarly with an app.

Horizontal rule

💡 If you’d like to code along with this article, you can fork our starter templates for React, Vue, vanilla JavaScript, and HTML on Codesandbox.io. You can also clone the Grammarly for Developers repository on GitHub. The starter templates are under examples and follow the naming pattern demo-[framework-name].

If you have the Grammarly browser extension, make sure it’s turned off, or the Grammarly Text Editor plugin will not initialize.

Horizontal rule

Create a Grammarly for Developers account

If you don’t already have one, sign up for a free Grammarly account at developer.grammarly.com. If you already have a Grammarly account, you can use your existing credentials to log in.

Set up your Grammarly for Developers app

Once you’ve signed in, you’ll be taken to the My Apps page, where you can create your first Grammarly for Developers app. After you’ve created your first app, you’ll automatically be taken to the App Console. There are two steps you’ll need to take in the App Console: getting your client ID and configuring your origins.

Get your client ID

Your app has a client ID that identifies your Grammarly Text Editor SDK integration. To get your client ID, navigate to the web client page located under “Clients” in the navigation menu. Then, you can grab your client ID from the quick start or find it under the Credentials header at the bottom of the page.

Configure your web app origins

Add the origin of your web app to the list of origins. You can find it in the Credentials section at the bottom of the page, just below the client ID.

Add the Grammarly Text Editor SDK dependency

Next, depending on which framework you’re using, you’ll install the appropriate npm package for the Grammarly Text Editor SDK. We have a core JavaScript library as well as framework-specific wrapper libraries for React and Vue.

React

If you’re using React, you can install the React wrapper library:

npm install @grammarly/editor-sdk-react

Vue

If you’re using Vue, you can install the Vue wrapper library:

npm install @grammarly/editor-sdk-vue

JavaScript

If you’re using plain JavaScript or a framework other than React or Vue, install the core library:

npm install @grammarly/editor-sdk

HTML

If you don’t want to use a build step or are building a prototype, you can also use a content delivery network (CDN) like jsDelivr:

<script src="https://cdn.jsdelivr.net/npm/@grammarly/editor-sdk?clientId=your_client_ID">
</script>

Add the plugin to your text editor

The last step is to add the Grammarly Text Editor Plugin to your text editor.

Using the Grammarly Text Editor component

The fastest way to add the plugin is to wrap your text editor with a Grammarly Text Editor Plugin component. In the examples below, we’re wrapping a <textarea>, but the plugin works with <input>, or contenteditable elements as well.

React

In React and Vue, you’ll import the component and use it to wrap your text editor. Make sure to pass in your client ID.

import { GrammarlyEditorPlugin } from '@grammarly/editor-sdk-react'
...
export function GrammarlyEditor() {
  <GrammarlyEditorPlugin clientId="your_client_ID">
    <textarea />
  </GrammarlyEditorPlugin>
}

Vue

<script setup>
  import { GrammarlyEditorPlugin } from '@grammarly/editor-sdk-vue'
</script>
...
<template>
  <GrammarlyEditorPlugin clientId="your_client_ID">
    <textarea />
  </GrammarlyEditorPlugin>
</template>

JavaScript

In plain JS and HTML, you’ll wrap your text editor with a <grammarly-editor-plugin> component and pass your client ID when initializing the SDK. If you’re using the core JavaScript library, you’ll do this by calling Grammarly.init() and passing in your client ID.

import * as Grammarly from '@grammarly/editor-sdk'
Grammarly.init(your_client_ID) // initialize the SDK with your client ID
...
<grammarly-editor-plugin>
  <textarea></textarea>
</grammarly-editor-plugin>

HTML

In HTML, you can initialize the SDK by passing your client ID to the script tag as a parameter. Loading the SDK through a CDN is a good approach for development but isn’t meant for production.

<grammarly-editor-plugin>
  <textarea></textarea>
</grammarly-editor-plugin>
...
<script src="https://cdn.jsdelivr.net/npm/@grammarly/editor-sdk?clientId=your_client_ID">
</script>

Now your writing assistance integration is complete! 🎉

Try writing some text in your text editor. The Grammarly button should appear in the bottom right corner of your web page. If it isn’t showing, check out our article on diagnosing issues.

Wrapping up

You’ve learned how to add writing assistance to any JavaScript application using the Grammarly Text Editor SDK, but this is just the beginning. You can explore our docs to learn how to configure the behavior of the plugin, set the default English dialect, and use CSS to customize the plugin’s theme. You can also demo configuration options in real time without writing a line of code using the Configurator.

If you have questions about the Grammarly Text Editor SDK or want to make a feature request, join us on the Grammarly for Developers discussion board on GitHub. To stay up to date on the SDK’s development as we add new features, follow @GrammarlyDevs on Twitter. We’d love to hear about what you’re building.

The post How to Add Writing Assistance to Any JavaScript App in Minutes appeared first on Grammarly Blog.

...



📌 How to Add Writing Assistance to Any JavaScript App in Minutes


📈 67.55 Punkte

📌 Harnessing GPT-4 for Writing Assistance and Content Creation


📈 29.57 Punkte

📌 Writing Visual Studio Extensions with Mads - Fixing bugs in Add Any File


📈 27.81 Punkte

📌 My samba share broke on an old RHEL 5 system that links to my Windows Domain. Any assistance is appreciated!


📈 25.25 Punkte

📌 Writing Cybersecurity Articles – Setting Up Your Writing Process


📈 24.72 Punkte

📌 Writing Visual Studio Extensions with Mads - Writing JSON Schemas


📈 24.72 Punkte

📌 Writing Visual Studio Extensions with Mads - Writing your first extension


📈 24.72 Punkte

📌 What is Content Writing? 10 Best Tips for Great Content Writing


📈 24.72 Punkte

📌 Comparing the writing speeds of ISO writing tools


📈 24.72 Punkte

📌 5 Content Writing Tools to Improve your Content Writing Skills


📈 24.72 Punkte

📌 Can an AI writing assistant match my personal writing style?


📈 24.72 Punkte

📌 Excel 2023 update: Check Performance, Formula Argument Assistance, XLL add-ins blocking, more


📈 24.62 Punkte

📌 Visual Studio Code: How Microsoft's 'any OS, any programming language, any software' plan is paying off


📈 24.11 Punkte

📌 Psst! Want to build a bot without writing any code?


📈 20.4 Punkte

📌 Windows Bug Allows Hackers to Steal Personal Files with Remote Assistance App


📈 20.27 Punkte

📌 Get and Give Remote Assistance with Quick Assist app in Windows 11


📈 20.27 Punkte

📌 Windows Bug Allows Hackers to Steal Personal Files with Remote Assistance App


📈 20.27 Punkte

📌 Waze Traffic App to Offer SOS Feature for Emergency Roadside Assistance


📈 20.27 Punkte

📌 This Flaw Could Have Allowed Hackers to Hack Any Instagram Account Within 10 Minutes


📈 20.02 Punkte

📌 Block Websites in Windows without Using any third party software. | 2 Minutes Tricks | Technodi


📈 20.02 Punkte

📌 Server hard freezing only on multiples of 10 minutes of uptime... Any ideas?


📈 20.02 Punkte

📌 A flaw could have allowed hackers to take over any Instagram account in 10 minutes


📈 20.02 Punkte

📌 How any instagram account could be hacked in less than 10 minutes


📈 20.02 Punkte

📌 Hackers Claim ‘Any’ Smartphone Fingerprint Lock Can Be Broken In 20 Minutes


📈 20.02 Punkte

📌 Hackers Claim ‘Any’ Smartphone Fingerprint Lock Can Be Broken In 20 Minutes


📈 20.02 Punkte

📌 Score double the minutes and data with any Tello mobile plan from $5/month


📈 20.02 Punkte

📌 How to Improve Any Prompt in Less Than 5 Minutes (Chat UI and Code)


📈 20.02 Punkte

📌 Supercharge Your Skills: 7 Tips for Writing Clean and Efficient JavaScript


📈 19.85 Punkte

📌 Safer URL reading and writing in modern JavaScript


📈 19.85 Punkte

📌 Writing Cleaner JavaScript with Modules


📈 19.85 Punkte











matomo