-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prettier workflow for js files
Signed-off-by: Royal Simpson Pinto <[email protected]> feat: prettier workflow modification Signed-off-by: Royal Simpson Pinto <[email protected]>
- Loading branch information
1 parent
2fc751c
commit f5de03b
Showing
7 changed files
with
6,675 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Prettier Code Formatter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Run Prettier on JS files | ||
run: npx prettier --write 'js/**/*.js' |
18 changes: 9 additions & 9 deletions
18
js/ckeditor5_plugins/text2text_generation/src/TextToTextGeneration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { Plugin } from 'ckeditor5/src/core'; | ||
import createButtonView from './buttonView'; | ||
import { Plugin } from "ckeditor5/src/core"; | ||
import createButtonView from "./buttonView"; | ||
|
||
export default class TextToTextGeneration extends Plugin { | ||
init() { | ||
const editor = this.editor; | ||
editor.ui.componentFactory.add('textToTextGeneration', locale => { | ||
const view = createButtonView(locale, editor); | ||
return view; | ||
}); | ||
} | ||
init() { | ||
const editor = this.editor; | ||
editor.ui.componentFactory.add("textToTextGeneration", (locale) => { | ||
const view = createButtonView(locale, editor); | ||
return view; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import axios from 'axios'; | ||
import axios from "axios"; | ||
|
||
export function generateText(inputText, editor) { | ||
axios.post('/generate-text', JSON.stringify({ text: inputText }), { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
axios | ||
.post("/generate-text", JSON.stringify({ text: inputText }), { | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}) | ||
.then(response => { | ||
console.log('Received response:', response.data); | ||
const generatedText = response.data.generated_text; | ||
const textarea = document.getElementById('inputText'); | ||
if (textarea) { | ||
textarea.value = generatedText; | ||
} | ||
.then((response) => { | ||
console.log("Received response:", response.data); | ||
const generatedText = response.data.generated_text; | ||
const textarea = document.getElementById("inputText"); | ||
if (textarea) { | ||
textarea.value = generatedText; | ||
} | ||
}) | ||
.catch(error => { | ||
console.error('Error generating text:', error.response.data); | ||
const textarea = document.getElementById('inputText'); | ||
if (textarea) { | ||
textarea.value = 'Error generating text, please try again.'; | ||
} | ||
.catch((error) => { | ||
console.error("Error generating text:", error.response.data); | ||
const textarea = document.getElementById("inputText"); | ||
if (textarea) { | ||
textarea.value = "Error generating text, please try again."; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.