Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Blockly intergration for grapesjs

License

NotificationsYou must be signed in to change notification settings

Ju99ernaut/grapesjs-blockly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attach code generated fromgoogle blockly to a component

RequiresBlockly and@blockly/block-plus-minus plugin recommended. Try adding after all components

screenshot.png

DEMO

HTML

<linkhref="https://unpkg.com/grapesjs/dist/css/grapes.min.css"rel="stylesheet"><scriptsrc="https://unpkg.com/grapesjs"></script><scriptsrc="https://unpkg.com/blockly"></script><scriptsrc="https://unpkg.com/grapesjs-blockly"></script><divid="gjs"></div>

JS

consteditor=grapesjs.init({container:'#gjs',height:'100%',fromElement:true,storageManager:false,plugins:['grapesjs-blockly'],});

CSS

body,html {margin:0;height:100%;}

Summary

  • Plugin name:grapesjs-blockly
  • Commands
    • blockly-script

Options

OptionDescriptionDefault
blocklyOptionsOptions to pass to blockly on init,toolbox defines blockly toolbox,workspaceOptions defines blockly injection options,toolbox will overwrite the default andtoolboxPush will add to default{toolbox: '', toolboxPush: '', workspaceOptions: {}}
starterCanvas starter blocks, defaulf setting generateslet el = this<xml xmlns=...>...</xml>
toolbarIconToolbar icon for opening blockly modal<i></i>
blocklyTypesSupportComponent types to allow script editing from blockly,avoid components with predefined scripts or scripts set elsewhere['default', 'wrapper', 'text', 'textnode', 'image', 'video', 'svg']
toolbarBtnBlocklyOptions to pass when extending toolbar{}
onRunLogic to run if debug is successful() => console.log('valid syntax')
onErrorLogic to run if debug finds errorserr => console.log('error:',err)
modalTitleTitle for blockly modalBlockly
codeViewOptionsAdditional options for the code viewer{}
buttonLabelLabel for the default save buttonsave
commandBlocklyScriptObject to extend the defaultblockly-script command{}

Download

  • CDN
    • https://unpkg.com/grapesjs-blockly
  • NPM
    • npm i grapesjs-blockly
  • GIT
    • git clone https://github.com/Ju99ernaut/grapesjs-blockly.git

Usage

Directly in the browser

<linkhref="https://unpkg.com/grapesjs/dist/css/grapes.min.css"rel="stylesheet"/><scriptsrc="https://unpkg.com/grapesjs"></script><scriptsrc="path/to/blockly"></script><scriptsrc="path/to/grapesjs-blockly.min.js"></script><divid="gjs"></div><scripttype="text/javascript">vareditor=grapesjs.init({container:'#gjs',// ...plugins:['grapesjs-blockly'],pluginsOpts:{'grapesjs-blockly':{/* options */}}});</script>

Modern javascript

importgrapesjsfrom'grapesjs';importpluginfrom'grapesjs-blockly';importBlocklyfrom'blockly';import'grapesjs/dist/css/grapes.min.css';consteditor=grapesjs.init({container :'#gjs',// ...plugins:[plugin],pluginsOpts:{[plugin]:{/* options */}}// orplugins:[editor=>plugin(editor,{/* options */}),],});

Development

Clone the repository

$ git clone https://github.com/Ju99ernaut/grapesjs-blockly.git$cd grapesjs-blockly

Install dependencies

$ npm i

Start the dev server

$ npm start

Build the source

$ npm run build

License

MIT

About

Blockly intergration for grapesjs

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp