https://github.com/gxanshu/grapesjs-zoom-plugin
stupidly simple zoom plugin for grapesjs
https://github.com/gxanshu/grapesjs-zoom-plugin
grapesjs grapesjs-builder grapesjs-plugin
Last synced: about 1 month ago
JSON representation
stupidly simple zoom plugin for grapesjs
- Host: GitHub
- URL: https://github.com/gxanshu/grapesjs-zoom-plugin
- Owner: gxanshu
- License: mit
- Created: 2023-07-15T10:36:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T21:04:30.000Z (over 1 year ago)
- Last Synced: 2025-03-29T19:11:21.717Z (about 2 months ago)
- Topics: grapesjs, grapesjs-builder, grapesjs-plugin
- Language: JavaScript
- Homepage: https://codenanshu.in/projects/grapesjs-zoom-plugin
- Size: 181 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grapesjs Zoom Plugin
[DEMO](https://codesandbox.io/s/sharp-haslett-dwcpvt?file=/src/index.js)
### HTML
```html
```### JS
```js
const editor = grapesjs.init({
container: '#gjs',
height: '100%',
fromElement: true,
storageManager: false,
plugins: ['grapesjs-zoom-plugin'],
});
```### CSS
```css
body, html {
margin: 0;
height: 100%;
}
```## Summary
* Plugin name: `grapesjs-zoom-plugin`
super simple plugin for canvas zoom in zoom out. this plugin works with the api of canvas of the grapesjs.there are two buttons in the `Panel` to control the canvas if you want the keyboard shortcut then its `shift -` for zoom out and `shift =` for zoom in.
in any case you have issue with the keyboard shortcuts keys then please open a [issue](https://github.com/gxanshu/grapesjs-zoom-plugin/issues/new) i am happy to help!
## Download
* CDN
* `https://unpkg.com/grapesjs-zoom-plugin`
* NPM
* `npm i grapesjs-zoom-plugin`
* GIT
* `git clone https://github.com/gxnanshu/grapesjs-zoom-plugin.git`## Usage
Directly in the browser
```htmlvar editor = grapesjs.init({
container: '#gjs',
// ...
plugins: ['grapesjs-zoom-plugin'],
pluginsOpts: {
'grapesjs-zoom-plugin': { /* options */ }
}
});```
Modern javascript
```js
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-zoom-plugin';
import 'grapesjs/dist/css/grapes.min.css';const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
```## Development
Clone the repository
```sh
$ git clone https://github.com/gxnanshu/grapesjs-zoom-plugin.git
$ cd grapesjs-zoom-plugin
```Install dependencies
```sh
$ npm i
```Start the dev server
```sh
$ npm start
```Build the source
```sh
$ npm run build
```## License
MIT