Comments (16)
Here's what we do in Kademi
btnSaveFile.on('click', function (e) {
e.preventDefault();
showLoadingIcon();
var fileContent = $('#content-area').keditor('getContent');
var saveUrl = postMessageData && postMessageData.pageName ? postMessageData.pageName : fileName;
$.ajax({
url: saveUrl,
type: 'POST',
data: {
body: fileContent
},
dataType: 'json',
success: function () {
if (isEmbeddedIframe) {
doPostMessage({
isSaved: true,
resp: postMessageData.resp,
willClose: postMessageData.willClose
}, postMessageData.url);
} else {
Msg.success('File is saved!');
}
hideLoadingIcon();
body.removeClass('content-changed');
},
error: function (e) {
Msg.error(e.status + ': ' + e.statusText);
hideLoadingIcon();
}
})
});
from keditor.
@umefarooq note that logging uses a function which checks to see if the console is enabled, so it is safe to leave logging enabled in production.
from keditor.
so quick let me try if its work really thanks.
from keditor.
it worked amazing, now part of my development list, how can i disable all console logs.
from keditor.
@umefarooq can you create an issue for it? I would assume that it should be an option like
$('div').keditor({debug: false});
from keditor.
@umefarooq: If you want, you still can disable log console by using this code $.keditor.debug = false;
from keditor.
Amazing plugin.
@ducdhm @bradmac can you please tell me if I can again load the page design after saving html through this line of code?
var fileContent = $('#keditor-body').keditor('getContent');
from keditor.
Hey @umarch06 what do you mean by loading the page design again? In Kademi we save the content with ajax and the user just continues editing, so the page is not reloaded.
from keditor.
@bradmac consider that I need to save a page and then I have to reload it with the same design I left with.
Like in an invoice, a person may have as much design as he want and later on he needs to build a new invoice with some of his custom designs?
from keditor.
OK, so it sounds like what you want is to save to a template library, and allow your users to load from that template library, right?
You can definitely do that, but i would expect thats outside of the scope of keditor. You would want to create a new table in your db, create an ajax service to get and set templates, and then have some sort of drop down to select one which would load the content into the content editor
from keditor.
yes exactly @bradmac you got me right.
I need to save templates. Later on I need to use them again, even again I can have right to make changes in that.
The question is relative. Like thorugh this code var fileContent = $('#keditor-body').keditor('getContent');
I am gonna get all the html. Later on I will save it to db and then again I will reload it on my page.
Problem is that, how will I render that again? How would all the stuff be created again, like containers, snippets and anything else. Please refer to this --url--
How would be everything get back to that state which I was before saving and reloading (like elements on invoice page, the draggers and each and evey property like drag, settings etc would be needed to remain same after reloading)?
I have created a new tab that names Invoice Items. Keep in mind that it was not created by using ExtraTabs in your plugin. I myself created it through some custom logic. Since it needs to be dynamic.
Note that I will remove this url which I provided above after your comment.
from keditor.
We generate editor page like this (uses velocity):
<div id="content-area">$!file.body</div>
And then we initialise it like this:
contentArea.keditor({
ckeditorOptions: {
skin: editorSkin,
...
To load new content we would simple replace the content div and then re-init keditor
$("#content-area").html(newContent);
contentArea.keditor({..});
The content produced by keditor should be clean, it should not contain anything editor specific such as draggers.
from keditor.
BTW, you should really consider using dynamic components. Check it out here, but you might want to skip my long boring intro and skip forward to about 4:30 :)
http://www.kademi.co/blogs/kb/building-customized-analytics-dashboards/
from keditor.
@bradmac I loved the way you have implemented this. I watched your video till the end and wonder why in that case Elements and Containers are on same tab and some other snippets are separately placed on second tab of side bar.
- Moreover, it would have been excellent if one could drag elements on content area rather than first placing containers and then placing elements in those containers (most of us need to drag single element) to some custom space.
- I would also need to suggest you a thing that the containers should be move able in their parent content areas like I did in the (deleted)URL I provided above. Resizing is a plus too. The reason I am asking for so is that almost every drag and drop I have seen on internet restricts user to push the containers in stack (containers are not free to move or in simple words I can say I cannot place the element exactly at that position that I wish).
- Coming to dynamic content, what If I need the things to come from some webservices like in my case and than show them in side bar. Since I can see the html has been restricted to show the elements only if they are present in dyamic_content file.
from keditor.
Hi @ghost
I like to do a similar thing.. Can you please share your code which you have done.
It would be much appreciated!
@bradmac Any way to get snippets and its data dynamically?
from keditor.
@Dhara-ZYMR You can check my comment in this issue to know the ways to load dynamic components' content: #76 (comment)
from keditor.
Related Issues (20)
- add ckfinder to ckeditor HOT 2
- Custom component not working as intended after creation following guide HOT 1
- how do I get the file upload on bootstrap to work?
- keditor conflict with jquery-ui ?
- Arabic language issue in Keditor content area HOT 1
- Clean Documentation
- [BUG]
- Issue with Vue.js HOT 2
- Load & Save content with full html document structure didn't works ([BUG]
- attached javascript event on element inside iframe
- Add background image
- [BUG]
- Ho
- Side Navigation HOT 2
- [BUG] Can't move container with content HOT 2
- Drag and Drop wherever I want HOT 5
- getContent method does not return the parsed content
- unable to add new content when setContent is defined HOT 5
- Can't use scripts inside iframe
- License Query HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keditor.