Hello everyone!

So Vincent asked me to send a mail to the dev list regarding the current
status of the Blockly editor project, and what needs to be done in the
coming few months, so we're all on the same page, so here goes.

Firstly, regarding the current status of the project, here's what the user
çan do:
- Create and delete Blockly blocks
- Generate code in Javascript (Show Javascript)
- Execute it
- Save the code to the page (without executing it)

However after discussion with Vincent, he raised the following concerns:
1. Show Javascript just appends content to right and does not do anything
to the existing content. Now I'm a bit confused as to what the problem is
here, because the code just gets appended to the right of the cursor
position, and that's how I wanted it to be, because that way the user can
just navigate normally to the line where he/she wants code inserted, and
click on "Show Javascript" to generate said code. So I believe this is fine.

2. Code does get saved but not interpreted and this is a problem.

3. There is no option to execute the code in view mode, this exists only in
the editor

4. There is no option to convert the generated code back to Blockly blocks.
Blockly actually does not provide this feature. In order for this to be
implemented, the AST generated using Velocity needs to be converted to XML
so it can be displayed using blocks, but I feel this would be outside the
scope of this project. IMO what we can do is push this to the end and add
this feature later if time permits. However if we provide this support for
Velocity, we won't be able to provide it for other languages, since it
would be much more complicated then and providing the back conversion
feature for just one language (ie. Velocity) doesn't make sense to me.
That's something else we need to consider. Maybe it can be implemented as
part of a separate project.

5. There is a design flaw when the page gets redirected to Blockly/Editor
for editing the content of the page. I had implemented it this way since
Clement suggested me this editor (https://github.com/xwiki-
contrib/application-xwebide) as reference, and so I used this.
Nevertheless, it does cause some complications as the content of the page
gets edited in case the $docRef is empty which can be handled but it
doesn't make sense logically.

The solution which we agreed upon is:
For points 2 and 3, the generated code should be saved in an XObject that's
retranslated back to code when the edit page is rendered. A sheet is
attached to this XObject for view and edit modes, and the content gets
rendered appropriately. A Javascript macro is used to render the code, and
it gets executed when an execute button is pressed in the view mode.
For point 5, we decided to drop Blockly as an editor and remove the edit
menu entry and implement it as a template instead using a template page and
a template provider page, similar to how its been done in
https://github.com/xwiki-contrib/application-diagram/.

That is all! This is what I've understood so far, and if any of you has
feedback/suggestions, please get back to me ASAP! :)

Regards,
Vivek Iyer

Reply via email to