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: bober1...@gmx.de [mailto:bober1...@gmx.de]
Gesendet: Donnerstag, 5. März 2015 09:35
An: qooxdoo-devel@lists.sourceforge.net
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 
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" <mustafa....@1und1.de<mailto:mustafa....@1und1.de>>
An: "qooxdoo Development" 
<qooxdoo-devel@lists.sourceforge.net<mailto:qooxdoo-devel@lists.sourceforge.net>>
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: bober1...@gmx.de<mailto:bober1...@gmx.de> [mailto:bober1...@gmx.de]
Gesendet: Mittwoch, 4. März 2015 14:50
An: 
qooxdoo-devel@lists.sourceforge.net<mailto:qooxdoo-devel@lists.sourceforge.net>
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....@1und1.de>
An: "qooxdoo Development" <qooxdoo-devel@lists.sourceforge.net>
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:bober1...@gmx.de<bober1...@gmx.de>]
Gesendet: Mittwoch, 4. März 2015 14:07
An: qooxdoo-devel@lists.sourceforge.net
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@lists.sourceforge.net
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@lists.sourceforge.net
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@lists.sourceforge.net<mailto:qooxdoo-devel@lists.sourceforge.net> 
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to