This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new cc33d6c  fix @externs example
cc33d6c is described below

commit cc33d6cc4c309f23bfec86ebe3233204d740aa68
Author: Carlos Rovira <[email protected]>
AuthorDate: Sun Jun 2 20:23:18 2019 +0200

    fix @externs example
---
 .../pom.xml                                        | 16 +-----
 ...rnal_javascript_libraries_in_Apache_Royale.mxml | 19 +++----
 .../src/main/royale/utils/HighlightCode.as         | 58 ++++++++++++++++++++++
 3 files changed, 69 insertions(+), 24 deletions(-)

diff --git 
a/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/pom.xml
 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/pom.xml
index ad0d11b..f08f3dd 100644
--- 
a/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/pom.xml
+++ 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/pom.xml
@@ -44,7 +44,7 @@
           <targets>${royale.example.targets}</targets>
           <debug>false</debug>
           
<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>
-          
<additionalCompilerOptions>-source-map=true;-js-dynamic-access-unknown-members=true</additionalCompilerOptions>
+          
<additionalCompilerOptions>-source-map=true;</additionalCompilerOptions>
         </configuration>
       </plugin>
     </plugins>
@@ -53,20 +53,6 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.royale.framework</groupId>
-      <artifactId>Network</artifactId>
-      <version>0.9.6-SNAPSHOT</version>
-      <type>swc</type>
-      <classifier>swf</classifier>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.royale.framework</groupId>
-      <artifactId>Network</artifactId>
-      <version>0.9.6-SNAPSHOT</version>
-      <type>swc</type>
-      <classifier>js</classifier>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.royale.framework</groupId>
       <artifactId>Jewel</artifactId>
       <version>0.9.6-SNAPSHOT</version>
       <type>swc</type>
diff --git 
a/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/BE0012_Using_external_javascript_libraries_in_Apache_Royale.mxml
 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/BE0012_Using_external_javascript_libraries_in_Apache_Royale.mxml
index bf89d5d..f74ba29 100644
--- 
a/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/BE0012_Using_external_javascript_libraries_in_Apache_Royale.mxml
+++ 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/BE0012_Using_external_javascript_libraries_in_Apache_Royale.mxml
@@ -24,18 +24,19 @@
 
     <fx:Script>
                <![CDATA[
+            import utils.HighlightCode;
+
             public var _hljs:hljs;
             
             public function highLightContent():void
             {
-                // dot access notation using a class hljs created with @externs
-                
-                hljs.highlightBlock(sourceCodeMXMLText.element);
-
-                // bracket access notation for a diynaimc access without 
create additional class
-                //var hljs:Object = window["hljs"];
-                //prevent renaming by compiler
-                //hljs["highlightBlock"](block);
+                sourceCodeMXMLText.text = "public function hello(){}";
+            
+                COMPILE::JS
+                {
+                    var highlightCode:HighlightCode = new HighlightCode();
+                    highlightCode.highlightBlock(sourceCodeMXMLText.element);
+                }
             }
                ]]>
        </fx:Script>
@@ -55,7 +56,7 @@
                     <js:beads>
                         <j:ScrollingViewport/>
                     </js:beads>
-                    <html:Code id="sourceCodeMXMLText" text="public function 
hello(){}"/>รง
+                    <html:Code id="sourceCodeMXMLText"/>
                 </html:Pre>
                 
                 <j:Button text="highlight Block" emphasis="primary" 
click="highLightContent()"/>
diff --git 
a/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/utils/HighlightCode.as
 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/utils/HighlightCode.as
new file mode 100644
index 0000000..849438b
--- /dev/null
+++ 
b/examples/blog/BE0012_Using_external_javascript_libraries_in_Apache_Royale/src/main/royale/utils/HighlightCode.as
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package utils
+{
+       COMPILE::JS
+       {
+       import org.apache.royale.core.WrappedHTMLElement;
+       }
+
+       public class HighlightCode
+       {
+               /** 
+         * Code created by Piotr Zarzycki in transpiledactionScript.com
+         * 
https://github.com/piotrzarzycki21/TranspiledActionScript/blob/examples/Examples/TranspiledActionScriptWebsite/src/utils/Highlight.as
+         * 
+                * <inject_html>
+                * <script 
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js";></script>
+         * <link rel="stylesheet" title="Atom One Dark" 
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css";>
+                * </inject_html>
+                */
+               public function HighlightCode()
+               {
+               }
+
+               COMPILE::JS     
+        /**
+         * block is the element (WrappedHTMLElement) inside the component (the 
<code> tag)
+         */
+               public function highlightBlock(block:WrappedHTMLElement):void
+               {
+                       // dot access notation using a class hljs created with 
@externs
+                       
+                               hljs.highlightBlock(block);
+
+                       // bracket access notation for a diynaimc access 
without create additional class
+
+                               //var hljs:Object = window["hljs"];
+                               //prevent renaming by compiler
+                               //hljs["highlightBlock"](block);
+               }
+       }
+}
\ No newline at end of file

Reply via email to