You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did a search and you guys did a great job in guiding us on how to save the file to the server side. How if let say I just want to have a pure HTML file which is editable? I want it to be like a document which I can edit and open on the browser which means I can tell the browser to save / replace the current HTML.
I found a script which allows me to save a text in a form, but is there any script which allows me to save the page from the browser after I edit it?
HTML:
Script:
Ext.onReady(function(){
var editor = new Ext.form.container-fluid({id:'note'});
editor.applyTo('note');
})
var contentHtml;
function savePage (){
//alert("Hello World!");
var content;
// iterate all dom elements which have been made aloha editable
jQuery.each(GENTICS.Aloha.editables,function (index, editable) {
// and get their clean and valid html5 content, and remember it to fake saving
content = content + "Editable ID: " + editable.getId() +"\nHTML code: " + editable.getContents() + "\n\n";
publishContent(editable.getContents());
contentHtml = editable.getContents();
editable.disable();
this.obj.deactivateEditable();
// set scope for floating menu
this.obj.FloatingMenu.setScope('GENTICS.Aloha.empty');
//this.activeEditable = null;
//alert(contentHtml);
});
// this fakes the saving of the content to your backend.
// TODO implement this to save the edited aloha content into your backend
//alert("Hello World!123");
//alert(""+content);
};
/// method publishes this content to the url '/TestEditor/saveContent', which directs the request to a servlet to process it ( servlet further can store the content in database and retrieve back for the publishing)
function publishContent(content) {
//alert('this is publish content-'+content);
//alert('checkUserName');
url = '/TestEditor/saveContent';
if (window.XMLHttpRequest) {
// alert('this is window.XMLHttpRequest-'+document.myform.container-fluid.value);
// obtain new object
obj = new XMLHttpRequest();
// callback function
obj.onreadystatechange = processChange;
// this will perform a GET with the url
obj.open("POST", url, true);
obj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
if (content != null){
// alert('content available now'+content);
obj.send('container-fluid='+content);
} else
obj.send('container-fluid='+document.myform.container-fluid.value);
// IE/Windows ActiveX object
} else if (window.ActiveXObject) {
obj = new ActiveXObject("Microsoft.XMLHTTP");
if (obj) {
obj.onreadystatechange = processChange;
obj.open("POST", url, true);
// don't send null for ActiveX
obj.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
obj.send('container-fluid='+document.myform.container-fluid.value);
}
} else {
alert("Your browser does not support AJAX");
}
}
// just after it publish, I force editor to deactivate, which it require to press Edit button for user to again start editing
function activateEditable(){
//alert('activateEditable');
jQuery.each(GENTICS.Aloha.editables,function (index, editable) {
//alert('enabling');
//editable.activate();
editable.enable();
});
};
The text was updated successfully, but these errors were encountered:
I did a search and you guys did a great job in guiding us on how to save the file to the server side. How if let say I just want to have a pure HTML file which is editable? I want it to be like a document which I can edit and open on the browser which means I can tell the browser to save / replace the current HTML.
I found a script which allows me to save a text in a form, but is there any script which allows me to save the page from the browser after I edit it?
HTML:
Script:
The text was updated successfully, but these errors were encountered: