Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
codex.editor.image
Advanced tools
Image Block for the CodeX Editor.
Note This Tool requires server-side implementation for file uploading. See backend response format for more details.
Get the package
npm i --save-dev codex.editor.image
Include module at your application
const ImageTool = require('codex.editor.image');
dist
from repositorydist/bundle.js
file to your page.You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/codex.editor.image@1.0.0
Then require this script on page with CodeX Editor through the <script src=""></script>
tag.
Add a new Tool to the tools
property of the CodeX Editor initial config.
var editor = CodexEditor({
...
tools: {
...
image: {
class: ImageTool,
config: {
url: 'http://localhost:8008/', // Your backend uploader endpoint
}
}
}
...
});
Field | Type | Description |
---|---|---|
url | string | Required Path for file uploading |
field | string | (default: image ) Name of uploaded image field in POST request |
types | string | (default: image/* ) Mime-types of files that can be accepted with file selection. |
captionPlaceholder | string | (default: Caption ) Placeholder for Caption input |
Add border
Stretch to full-width
Add background
This Tool returns data
with following format
Field | Type | Description |
---|---|---|
file | object | Uploaded file data. Any data got from backend uploader. Always contain the url property |
caption | string | image's caption |
withBorder | boolean | add border to image |
withBackground | boolean | need to add background |
stretched | boolean | stretch image to screen's width |
{
"type" : "image",
"data" : {
"file": {
"url" : "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg"
},
"caption" : "Roadster // tesla.com",
"withBorder" : false,
"withBackground" : false,
"stretched" : true
}
}
This Tool works by following scheme:
So, you can implement backend for file saving by your own way. It is a specific and trivial task depending on your environment and stack.
Response of your uploader should cover following format:
{
"success" : 1,
"file": {
"url" : "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg",
// ... and any additional fields you want
}
}
success - uploading status. 1 for successful, 0 for failed
file - uploaded file data. Must contain an url
field with full public path to the uploaded image.
Also, can contain any additional fields you want to store. For example, width, height, id etc.
All additional fields will be saved at the file
object of output data.
FAQs
Image Tool for CodeX.Editor
The npm package codex.editor.image receives a total of 0 weekly downloads. As such, codex.editor.image popularity was classified as not popular.
We found that codex.editor.image demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.