You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/06/03 15:33:47 UTC

[royale-asjs] branch develop updated: tourdejewel: remove HighlighCode and use new hljs code that injects the html line to import the highlight.js library

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 33a4b5c  tourdejewel: remove HighlighCode and use new hljs code that injects the html line to import the highlight.js library
33a4b5c is described below

commit 33a4b5c9b9061f8fc3d0c17257b7f9981e1ad89a
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Mon Jun 3 17:33:41 2019 +0200

    tourdejewel: remove HighlighCode and use new hljs code that injects the html line to import the highlight.js library
---
 .../ExampleAndSourceCodeTabbedSectionContent.as    |  8 +--
 .../royale/TourDeJewel/src/main/royale/hljs.as     | 28 ---------
 .../src/main/royale/utils/HighlightCode.as         | 68 ----------------------
 3 files changed, 1 insertion(+), 103 deletions(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/components/ExampleAndSourceCodeTabbedSectionContent.as b/examples/royale/TourDeJewel/src/main/royale/components/ExampleAndSourceCodeTabbedSectionContent.as
index b1bfbe1..75d9a3a 100644
--- a/examples/royale/TourDeJewel/src/main/royale/components/ExampleAndSourceCodeTabbedSectionContent.as
+++ b/examples/royale/TourDeJewel/src/main/royale/components/ExampleAndSourceCodeTabbedSectionContent.as
@@ -31,8 +31,6 @@ package components
 
     import services.GitHubService;
 
-    import utils.HighlightCode;
-
     import vos.TabBarButtonVO;
     
     public class ExampleAndSourceCodeTabbedSectionContent extends ScrollableSectionContent implements IContainerBaseStrandChildrenHost 
@@ -132,11 +130,7 @@ package components
         {
             sourceCodeMXMLText.text = event.target.sourceCode;
             
-            COMPILE::JS
-            {
-                var highlightCode:HighlightCode = new HighlightCode();
-                highlightCode.highlightBlock(sourceCodeMXMLText.element);
-            }
+            hljs.highlightBlock(sourceCodeMXMLText.element);
         }
 
         
diff --git a/examples/royale/TourDeJewel/src/main/royale/hljs.as b/examples/royale/TourDeJewel/src/main/royale/hljs.as
deleted file mode 100644
index 60866b2..0000000
--- a/examples/royale/TourDeJewel/src/main/royale/hljs.as
+++ /dev/null
@@ -1,28 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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
-{
-	/**
-	 * @externs
-	 */
-	public class hljs
-	{
-		public static function highlightBlock(block:Element):void {}
-	}
-}
\ No newline at end of file
diff --git a/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as b/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as
deleted file mode 100644
index 3c23bfa..0000000
--- a/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as
+++ /dev/null
@@ -1,68 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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		
-		// public function initHighlight():void
-		// {
-		// 	var hljs:Object = window["hljs"];
-		// 	//prevent renaming by compiler
-		// 	hljs["initHighlightingOnLoad"]();
-		// }
-		
-		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