Blockly Editor

Version 10.1 by Vivek Iyer on 2018/06/08 20:31

cogAdds a new editor based on Google Blockly
TypeXAR
CategoryApplication
Developed by

Vivek Iyer

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

9.11.3

Installable with the Extension Manager

Description

This extension adds the Google Blockly Editor to XWiki, to make programming easier for users who have little/no previous experience of programming. Currently, this editor provides support for generating Javascript code, using the minimalistic default toolbox provided by Google, editing a document using this generated code and saving it.

Usage

To edit a document using the Blockly editor, please follow the steps given below:

  1. Make sure you're logged in
  2. Go to the page you want to edit (for example: /xwiki/bin/view/test/testChild/testGChild/)
  3. Click on the edit page icon, and choose Blockly from the dropdown menu.
    SelectingBlocklyEditor.png
    Selecting Blockly editor to edit the page
  4. This should take you to the editor page. Drag and drop the blocks from the toolbox onto the adjacent div and combine them like puzzle pieces, as desired. For example:BlocksExample.png
    Combining blocks appropriately
  5. To delete any of the blocks, drag and drop the blocks into the bin.
  6. Once you are done with generating the blocks, to generate JS code for these blocks, click on the Show JavaScript button. The code is shown in the textarea.BlocksWithCode.png
    Blocks with the generated JS code
  7. To run this code, click on the Run JavaScript button. You should get an alert box, as shown in the image below.RunningGeneratedCode.png
    Blockly generated code on being run
  8. Save the code using either the "Save and View", or the "Save and Continue" buttons.SavedCode.png
    The code gets saved
  9. Now on refreshing the page, the generated code which got saved, is shown in the textarea. In case you want to further edit the content of the page, take the cursor to the position where you want the code to be inserted, combine the blocks as described in Step 4 and click on Show JavaScript, and the code gets inserted at the cursor position emoticon_smileInsertingCodeAtCursorPosition.png
    Inserting Code at Cursor Position

Features

  • A default toolbox containing tools for if-else conditions, loops, print statements, assignment, comparison statements etc.Toolbox.png
    The default Blockly toolbox
  • A bin for deleting unnecessary blocks
  • Converting this generated code into Javascript and running it as well
  • Displaying the generated code in the textarea, wherein the code gets inserted at cursor position
  • Saving the code to the page

(For screenshots and more information on how to use these features, please check the Usage section given above emoticon_smile)

Future

Refer the Blockly design page for further details.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Dependencies

Dependencies for this extension (org.xwiki.contrib:application-blockly-ui 0.1):

Tags:
    

Get Connected