From c7febbf03cdcd24043b5328ab4561d2ba393c77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Ackermann=20Ferko?= Date: Mon, 30 Dec 2019 10:36:40 +0100 Subject: [PATCH] Update Components-js.md This change makes more clear what is going on and why the code will not work as expected. Even though it was already written there, I was still unsure and I have almost posted a _[Question]_. But upon re-reading what I wrote ten more times, I finally understood what you meant by `but be aware of a string conversion,`. --- docs/modules/Components-js.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/Components-js.md b/docs/modules/Components-js.md index e2264e015..7613b9e84 100644 --- a/docs/modules/Components-js.md +++ b/docs/modules/Components-js.md @@ -68,7 +68,7 @@ As you see the editor attaches a unique ID to all components with scripts and re Keep in mind that all component scripts are executed only inside the iframe of the canvas (isolated, just like your final template), and therefore are NOT part of the current `document`. All your external libraries (eg. jQuery) are not there, but you'll see later how to manage scripted components with dependencies. -One thing you might be concerned about is a string used for the `script`, definitely not the best way to deal with a code, for this reason GrapesJS is able also to handle functions for you, so the previous example might look like this: +One thing you might be concerned about is a string used for the `script`. Definitely not the best way to deal with a code, for this reason GrapesJS is also able to handle functions for you, so the previous example might look like this: ```js editor.BlockManager.add('test-block', { @@ -82,7 +82,7 @@ editor.BlockManager.add('test-block', { } }); ``` -This is much better, but be aware of a string conversion, you can't use variables outside of the function scope. Take a look at this scenario: +This is much better, but be aware though, that the function body is converted to string internally, before it can be placed in the document, so you can't use variables outside of the function scope. Take a look at this scenario: ```js var myVar = 'John';