-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
114 additions
and
17 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 |
---|---|---|
|
@@ -17,6 +17,7 @@ Online Examples: | |
|
||
* [🎬 Template Creator](https://b4rtaz.github.io/mini-canvas-editor/webpack-app/public/template-creator.html) | ||
* [🎨 Inpainting Mask](https://b4rtaz.github.io/mini-canvas-editor/webpack-app/public/inpainting-mask.html) | ||
* [📦 Vanilla JavaScript](https://b4rtaz.github.io/mini-canvas-editor/webpack-app/public/vanilla-javascript.html) | ||
|
||
## 🚀 Installation | ||
|
||
|
@@ -43,7 +44,6 @@ import 'mini-canvas-editor/css/editor.css'; | |
To create the editor write the below code: | ||
|
||
```ts | ||
// ... | ||
Editor.createBlank(placeholder, 200, 300, {}); | ||
``` | ||
|
||
|
@@ -54,8 +54,8 @@ Add the below code to your head section in HTML document. | |
```html | ||
<head> | ||
... | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected].2/css/editor.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/index.umd.min.js"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected].3/css/editor.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/index.umd.js"></script> | ||
``` | ||
|
||
Call the editor by: | ||
|
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
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
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
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
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
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,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>📦 Vanilla JavaScript Example - Mini Canvas Editor</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> | ||
<link rel="icon" href="./assets/favicon.ico" /> | ||
<style> | ||
html, | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font: 14px/1.5em Arial, Verdana, sans-serif; | ||
min-height: 100%; | ||
background: url('./assets/background-pattern.svg'); | ||
} | ||
#placeholder { | ||
width: 100%; | ||
height: 50vh; | ||
} | ||
p { | ||
text-align: center; | ||
padding: 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="placeholder"></div> | ||
|
||
<p> | ||
<button id="saveButton">Save bitmap</button> | ||
</p> | ||
<p> | ||
<a href="https://github.com/b4rtaz/mini-canvas-editor">Mini Canvas Editor</a> | ||
</p> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/editor.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js"></script> | ||
<script> | ||
const placeholder = document.getElementById('placeholder'); | ||
const saveButton = document.getElementById('saveButton'); | ||
const editor = miniCanvasEditor.Editor.createBlank(placeholder, 200, 300, {}); | ||
|
||
saveButton.addEventListener('click', () => { | ||
const a = document.createElement('a'); | ||
a.download = 'filename.png'; | ||
a.href = editor.render().toDataURL('image/png'); | ||
a.click(); | ||
}, false); | ||
</script> | ||
</body> | ||
</html> |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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