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/05/02 19:40:44 UTC
[royale-asjs] branch develop updated: tourdejewel: use new hljs
class to show highlighted github code in TDJ
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 5880a7c tourdejewel: use new hljs class to show highlighted github code in TDJ
5880a7c is described below
commit 5880a7c1ad8a2571c3758d380d98906dedbc0aed
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu May 2 21:40:37 2019 +0200
tourdejewel: use new hljs class to show highlighted github code in TDJ
---
.../src/main/royale/{externs => }/hljs.as | 2 +-
.../src/main/royale/utils/HighlightCode.as | 21 +++++++++++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/royale/externs/hljs.as b/examples/royale/TourDeJewel/src/main/royale/hljs.as
similarity index 98%
rename from examples/royale/TourDeJewel/src/main/royale/externs/hljs.as
rename to examples/royale/TourDeJewel/src/main/royale/hljs.as
index a0e7ee8..60866b2 100644
--- a/examples/royale/TourDeJewel/src/main/royale/externs/hljs.as
+++ b/examples/royale/TourDeJewel/src/main/royale/hljs.as
@@ -16,7 +16,7 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package externs
+package
{
/**
* @externs
diff --git a/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as b/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as
index 0d35017..3c23bfa 100644
--- a/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as
+++ b/examples/royale/TourDeJewel/src/main/royale/utils/HighlightCode.as
@@ -18,6 +18,11 @@
////////////////////////////////////////////////////////////////////////////////
package utils
{
+ COMPILE::JS
+ {
+ import org.apache.royale.core.WrappedHTMLElement;
+ }
+
public class HighlightCode
{
/**
@@ -45,11 +50,19 @@ package utils
/**
* block is the element (WrappedHTMLElement) inside the component (the <code> tag)
*/
- public function highlightBlock(block:Object):void
+ public function highlightBlock(block:WrappedHTMLElement):void
{
- var hljs:Object = window["hljs"];
- //prevent renaming by compiler
- hljs["highlightBlock"](block);
+ // 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