Get current code in embed.Html (with Sage cell)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Get current code in embed.Html (with Sage cell)

Bober
Hi,

I am using a qx.ui.embed.Html object to include a Sage Div in my Application.

The code I use in the Html is:

        var sage = new qx.ui.embed.Html('<script type="text/x-sage">1+2</script>');

which is translated to three separate DIVs by Sage (https://sagecell.sagemath.org/static/embedded_sagecell.js) while rendering the site.

I do now have to get access to the new inserted DIVs and change their value for example.

I was trying to use the getHtml() method:

sage.getHtml()

but it always returns the initial value I gave to it, not the current html created by the Sage Script (which I can also see in my browser/debugger).

How can I comfortably access the current content of a embed.Html? And how can I comfortably navigate thru the hierarchies?


Thanks a lot for your advice.


Regards,

Bober
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Mustafa Sak-5
Hi,

would you please describe how you bound the sage library with the embedded widget?

Please notice, that the embedded HTML code will  be evaluated asynchronously. That means you should use following scheme to implement your code:

var sage = new qx.ui.embed.Html('');
sage.addListenerOnce("appear", function(){
        var elem = sage.getContentElement().getDomElement();
        // bind sage lib with DOM element
}, this);

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 12:04
An: [hidden email]
Betreff: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Hi,

I am using a qx.ui.embed.Html object to include a Sage Div in my Application.

The code I use in the Html is:

        var sage = new qx.ui.embed.Html('');

which is translated to three separate DIVs by Sage
(https://sagecell.sagemath.org/static/embedded_sagecell.js) while rendering the site.

I do now have to get access to the new inserted DIVs and change their value for example.

I was trying to use the getHtml() method:

sage.getHtml()

but it always returns the initial value I gave to it, not the current html created by the Sage Script (which I can also see in my browser/debugger).

How can I comfortably access the current content of a embed.Html? And how can I comfortably navigate thru the hierarchies?


Thanks a lot for your advice.


Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Bober
Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml);
});

Regards,

Bober
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Mustafa Sak-5
Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:07
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Bober
Dear Mustafa,

here the complete email:

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml());
});
 
 
If I call 
 
sage.getContentElement().getDomElement()
 
it says "Object HTMLDivElement"

Regards,

Bober         
 
Gesendet: Mittwoch, 04. März 2015 um 14:27 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)
Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:07
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {

alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
 
 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Mustafa Sak-5

Sorry Bober,

 

but I am not familiar with sagecell. But normally a lib provides a function to be able connect the logic with a Dom element. Or a library overtakes the whole document. In this case you should think about using an embedded Iframe widget [1]

 

[1] http://demo.qooxdoo.org/current/apiviewer/#qx.ui.embed.Iframe

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: [hidden email] [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:50
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,


here the complete email:

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml());
});

 

 

If I call 

 

sage.getContentElement().getDomElement()

 

it says "Object HTMLDivElement"


Regards,

Bober         

 

Gesendet: Mittwoch, 04. März 2015 um 14:27 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:07
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {

alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Bober
Dear Mustafa,
 
thanks again for your answer.
 
The Sage lib provides a function that takes all cells with a given class (or ID), takes the (script) content of it as the initial value for the editor and overrides the DIV with the Sage-specific DIVs (Code editor, Activate Button, results, …) in that part of the Document.
 
<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
<script>$(function () {
                        // Make the div with class ‘sage’ a Sage cell
                        sagecell.makeSagecell({inputLocation:  '.sage',
                         //template:       sagecell.templates.minimal,
                        evalButtonText: 'Activate'});
              });
</script>
 
That will change the DIV with the class “sage” including the script:
 
<div class="sage">
<script type="text/x-sage">1+2</script>
</div>
 
to the Sage specific DIVs (can be seen in debugger after page is rendered).
 
What I want to do now is get access to this Sage created code. Right now, I am using as mentioned an qx.ui.embed.Html. It gets rendered correctly and the sage-code-editor and the Activate button are shown. I can also see the generated code in the debugger and browse thru the DIVs using JQuerry for exampe.
 
All I want to do now is access this generated code thru qooxdoo api.
 
Even though the code is changed and I can see that, it isn’t changed in the getHtml() of the qx.ui.embed.Html.
So I was wondering if there were any other options to get that content an browse thru it confortably (like getting all objects with a given ID).
 
I hope this explanation was sufficient now and I am looking forward to hearing from you.
 
 
Regards,
 
Bober
 
Gesendet: Mittwoch, 04. März 2015 um 16:31 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry Bober,

 

but I am not familiar with sagecell. But normally a lib provides a function to be able connect the logic with a Dom element. Or a library overtakes the whole document. In this case you should think about using an embedded Iframe widget [1]

 

[1] http://demo.qooxdoo.org/current/apiviewer/#qx.ui.embed.Iframe

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: [hidden email] [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:50
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,


here the complete email:

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml());
});

 

 

If I call 

 

sage.getContentElement().getDomElement()

 

it says "Object HTMLDivElement"


Regards,

Bober         

 

Gesendet: Mittwoch, 04. März 2015 um 14:27 Uhr
Von: "Mustafa Sak" <mustafa.sak@...>
An: "qooxdoo Development" <qooxdoo-devel@...>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:bober1990@...]
Gesendet: Mittwoch, 4. März 2015 14:07
An: qooxdoo-devel@...
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {

alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 

------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/_______________________________________________ qooxdoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
 
 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Mustafa Sak-5

Ok, well this is more a common JS task!

 

 

But with qx helper functions, you could do like this

 

 

 

var element = Widget.getContentElement().getDomElement();

var html = qx.bom.element.Attribute.get(element, "html");

alert(html);

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: [hidden email] [mailto:[hidden email]]
Gesendet: Donnerstag, 5. März 2015 09:35
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,

 

thanks again for your answer.

 

The Sage lib provides a function that takes all cells with a given class (or ID), takes the (script) content of it as the initial value for the editor and overrides the DIV with the Sage-specific DIVs (Code editor, Activate Button, results, …) in that part of the Document.

 

<script>$(function () {

                        // Make the div with class ‘sage’ a Sage cell

                        sagecell.makeSagecell({inputLocation:  '.sage',

                         //template:       sagecell.templates.minimal,

                        evalButtonText: 'Activate'});

              });

</script>

 

That will change the DIV with the class “sage” including the script:

 

<div class="sage">

<script type="text/x-sage">1+2</script>

</div>

 

to the Sage specific DIVs (can be seen in debugger after page is rendered).

 

What I want to do now is get access to this Sage created code. Right now, I am using as mentioned an qx.ui.embed.Html. It gets rendered correctly and the sage-code-editor and the Activate button are shown. I can also see the generated code in the debugger and browse thru the DIVs using JQuerry for exampe.

 

All I want to do now is access this generated code thru qooxdoo api.

 

Even though the code is changed and I can see that, it isn’t changed in the getHtml() of the qx.ui.embed.Html.

So I was wondering if there were any other options to get that content an browse thru it confortably (like getting all objects with a given ID).

 

I hope this explanation was sufficient now and I am looking forward to hearing from you.

 

 

Regards,

 

Bober

 

Gesendet: Mittwoch, 04. März 2015 um 16:31 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry Bober,

 

but I am not familiar with sagecell. But normally a lib provides a function to be able connect the logic with a Dom element. Or a library overtakes the whole document. In this case you should think about using an embedded Iframe widget [1]

 

[1] http://demo.qooxdoo.org/current/apiviewer/#qx.ui.embed.Iframe

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: [hidden email] [[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:50
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,


here the complete email:

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml());
});

 

 

If I call 

 

sage.getContentElement().getDomElement()

 

it says "Object HTMLDivElement"


Regards,

Bober         

 

Gesendet: Mittwoch, 04. März 2015 um 14:27 Uhr
Von: "Mustafa Sak" <mustafa.sak@...>
An: "qooxdoo Development" <qooxdoo-devel@...>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:bober1990@...]
Gesendet: Mittwoch, 4. März 2015 14:07
An: qooxdoo-devel@...
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {

alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 

------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/_______________________________________________ qooxdoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Get current code in embed.Html (with Sage cell)

Bober
Dear Mustafa,
 
thanks again.
 
Unfortunately, it is still not working…
 
If I try to use your example:
 
                               var sage = new qx.ui.embed.Html('<script type="text/x-sage">1+2</script>');
                               sage.getContentElement().addClass('sage');
                               sage.setWidth(300);
                               sage.setHeight(200);
 
var element = sage.getContentElement().getDomElement();
var html = qx.bom.element.Attribute.get(element, "html");
alert(html);
 
 
sage.getContentElement().getDomElement(); returns null.
 
Do you have any other idea how I could access the current code within the embed HTML after it was rendered?
 
 
Regards,
 
Bober
 
Gesendet: Donnerstag, 05. März 2015 um 10:01 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Ok, well this is more a common JS task!

 

 

But with qx helper functions, you could do like this

 

 

 

var element = Widget.getContentElement().getDomElement();

var html = qx.bom.element.Attribute.get(element, "html");

alert(html);

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: [hidden email] [mailto:[hidden email]]
Gesendet: Donnerstag, 5. März 2015 09:35
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,

 

thanks again for your answer.

 

The Sage lib provides a function that takes all cells with a given class (or ID), takes the (script) content of it as the initial value for the editor and overrides the DIV with the Sage-specific DIVs (Code editor, Activate Button, results, …) in that part of the Document.

 

<script>$(function () {

                        // Make the div with class ‘sage’ a Sage cell

                        sagecell.makeSagecell({inputLocation:  '.sage',

                         //template:       sagecell.templates.minimal,

                        evalButtonText: 'Activate'});

              });

</script>

 

That will change the DIV with the class “sage” including the script:

 

<div class="sage">

<script type="text/x-sage">1+2</script>

</div>

 

to the Sage specific DIVs (can be seen in debugger after page is rendered).

 

What I want to do now is get access to this Sage created code. Right now, I am using as mentioned an qx.ui.embed.Html. It gets rendered correctly and the sage-code-editor and the Activate button are shown. I can also see the generated code in the debugger and browse thru the DIVs using JQuerry for exampe.

 

All I want to do now is access this generated code thru qooxdoo api.

 

Even though the code is changed and I can see that, it isn’t changed in the getHtml() of the qx.ui.embed.Html.

So I was wondering if there were any other options to get that content an browse thru it confortably (like getting all objects with a given ID).

 

I hope this explanation was sufficient now and I am looking forward to hearing from you.

 

 

Regards,

 

Bober

 

Gesendet: Mittwoch, 04. März 2015 um 16:31 Uhr
Von: "Mustafa Sak" <mustafa.sak@...>
An: "qooxdoo Development" <qooxdoo-devel@...>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry Bober,

 

but I am not familiar with sagecell. But normally a lib provides a function to be able connect the logic with a Dom element. Or a library overtakes the whole document. In this case you should think about using an embedded Iframe widget [1]

 

[1] http://demo.qooxdoo.org/current/apiviewer/#qx.ui.embed.Iframe

 

Gruß

Mustafa Sak


Applications & Integration

1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany

 

Von: Bober1990@... [mailto:Bober1990@...]
Gesendet: Mittwoch, 4. März 2015 14:50
An: qooxdoo-devel@...
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

 

Dear Mustafa,


here the complete email:

I simply bound the sage lib to the whole application using

<script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value of the embeded html:

apply_button.addListener("execute", function(e) {
                               
                                alert(sage.getHtml());
});

 

 

If I call 

 

sage.getContentElement().getDomElement()

 

it says "Object HTMLDivElement"


Regards,

Bober         

 

Gesendet: Mittwoch, 04. März 2015 um 14:27 Uhr
Von: "Mustafa Sak" <[hidden email]>
An: "qooxdoo Development" <[hidden email]>
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Sorry but I could not see your example code.

By the way,

Console.log(sage.getContentElement().getDomElement());

will show you the DOM elements you are interested in.

The property "html" is just one way, you are bale to set HTML code as String and the widget lets it be evaluated by the browser. But the property still just holds the string, not the evaluated and maybe modified DOM elements.

Your third party library will sure make some modification on the DOM, so please use getDomElement().

Gruß
Mustafa Sak

Applications & Integration
1&1 Internet AG | Ernst-Frey-Straße 10 | 76135 Karlsruhe | Germany


-----Ursprüngliche Nachricht-----
Von: Bober [mailto:[hidden email]]
Gesendet: Mittwoch, 4. März 2015 14:07
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Get current code in embed.Html (with Sage cell)

Dear Mustafa,

thanks for the answer.

I simply bound the sage lib to the whole application using



in the head of the index.html

Is there a better way to do so?

How exactly am I supposed to implement my html code?
And how can I access the code in it?

Right now I am using a button that shows a alert containing the html value
of the embeded html:

apply_button.addListener("execute", function(e) {

alert(sage.getHtml);
});

Regards,

Bober



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Get-current-code-in-embed-Html-with-Sage-cell-tp7586907p7586913.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 

------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/_______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@... https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 

 

 
 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel