codejar
Advanced tools
Comparing version 3.7.0 to 4.0.0
{ | ||
"name": "codejar", | ||
"version": "3.7.0", | ||
"description": "An embeddable code editor for the browser", | ||
"license": "MIT", | ||
"repository": "antonmedv/codejar", | ||
"author": "Anton Medvedev <anton@medv.io>", | ||
"homepage": "https://medv.io/codejar/", | ||
"main": "codejar.js", | ||
"types": "codejar.d.ts", | ||
"version": "4.0.0", | ||
"type": "module", | ||
"main": "./dist/codejar.js", | ||
"types": "./dist/codejar.d.ts", | ||
"exports": { | ||
".": "./dist/codejar.js", | ||
"./cursor": "./dist/cursor.js" | ||
}, | ||
"files": [ | ||
"*.ts", | ||
"*.js" | ||
"dist" | ||
], | ||
@@ -18,3 +18,3 @@ "scripts": { | ||
"build": "tsc", | ||
"size": "minify codejar.js --sourceType module | gzip-size", | ||
"size": "minify ./dist/codejar.js --sourceType module | gzip-size", | ||
"release": "release-it" | ||
@@ -25,4 +25,4 @@ }, | ||
"gzip-size-cli": "^5.1.0", | ||
"release-it": "^15.6.0", | ||
"typescript": "^4.9.5" | ||
"release-it": "^16.1.3", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -36,3 +36,7 @@ "release-it": { | ||
} | ||
} | ||
}, | ||
"license": "MIT", | ||
"repository": "antonmedv/codejar", | ||
"author": "Anton Medvedev <anton@medv.io>", | ||
"homepage": "https://medv.io/codejar/" | ||
} |
@@ -10,3 +10,3 @@ <p align="center"><a href="https://medv.io/codejar/"><img src="https://medv.io/assets/codejar.svg" width="72"></a></p> | ||
* Lightweight (**2 kB** only) | ||
* Lightweight (**3 kB** only) | ||
* Preserves indentation on a new line | ||
@@ -25,10 +25,2 @@ * Adds closing brackets, quotes | ||
CodeJar 🍯 can be used via modules: | ||
```html | ||
<script type="module"> | ||
import {CodeJar} from 'https://medv.io/codejar/codejar.js' | ||
</script> | ||
``` | ||
Create an element and init the CodeJar 🍯: | ||
@@ -39,7 +31,7 @@ | ||
<script> | ||
let jar = CodeJar(document.querySelector('.editor'), hljs.highlightElement) | ||
let jar = CodeJar(document.querySelector('.editor'), highlight) | ||
</script> | ||
``` | ||
Second argument to `CodeJar` is a highlighting function (in this example [highlight.js](https://highlightjs.org)), but any function may be used: | ||
Second argument to `CodeJar` is a highlighting function (like Prism.js, highlight.js): | ||
@@ -49,7 +41,7 @@ ```ts | ||
const code = editor.textContent | ||
// Do something with code and set html. | ||
code = code.replace('foo', '<span style="color: red">foo</span>') | ||
editor.innerHTML = code | ||
} | ||
let jar = CodeJar(editor, highlight) | ||
const jar = CodeJar(editor, highlight) | ||
``` | ||
@@ -71,3 +63,3 @@ | ||
```js | ||
let options = { | ||
const options = { | ||
tab: ' '.repeat(4), // default is '\t' | ||
@@ -77,22 +69,5 @@ indentOn: /[(\[]$/, // default is /{$/ | ||
let jar = CodeJar(editor, highlight, options) | ||
const jar = CodeJar(editor, highlight, options) | ||
``` | ||
Some styles may be applied to our editor to make it better looking: | ||
```css | ||
.editor { | ||
border-radius: 6px; | ||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); | ||
font-family: 'Source Code Pro', monospace; | ||
font-size: 14px; | ||
font-weight: 400; | ||
height: 340px; | ||
letter-spacing: normal; | ||
line-height: 20px; | ||
padding: 10px; | ||
tab-size: 4; | ||
} | ||
``` | ||
## API | ||
@@ -161,4 +136,4 @@ | ||
* [react-codejar](https://github.com/guilhermelimak/react-codejar) - a react wrapper for CodeJar. | ||
* [ngx-codejar](https://github.com/julianpoemp/ngx-codejar) - an angular wrapper for CodeJar. | ||
* [react-codejar](https://github.com/guilhermelimak/react-codejar) - a React wrapper for CodeJar. | ||
* [ngx-codejar](https://github.com/julianpoemp/ngx-codejar) - an Angular wrapper for CodeJar. | ||
@@ -165,0 +140,0 @@ ## License |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Yes
24061
7
594
136
1