I'm having an issue i've seen others post about, using the Enter key is causing an extra line break to appear. Now I know I can use shift + enter, but i can't except my users to know that.
Is there a fix for this? I've using v0.8.8, I saw this:
https://github.com/summernote/summernote/issues/546#issuecomment-341518461
but this did not work, i saw another post using $.summernote.addPlugin({
but .addPlugin does not work in v0.8.8 anymore.
Was anyone able to get around this?
The answer to this question is at this link by summernote breakline paragraph to br
all credit to Ghylt
You can use the following code to change the functionality of Enter
$('#summernote').summernote().on("summernote.enter", function(we, e) {
$(this).summernote('pasteHTML', '<br> ');
e.preventDefault();
});
It's works for me.
Ref:- Github
Related
I am trying to create posts with comments with CodeIgniter and I am trying to add voting for the comments with + and -.
But my problem is not actually this functionallity but more exactly creating the link and the method in controller/model for this.
I understand that there is some kind of link to methods.
If I have something like this:
public function like() {
echo 'Test Function';
}
and when I create link like this one sitename.com/posts/first-post/like theoritecally I will see blank page with "Test Function" text (and of course if I write proper routing rule but I cannor for now).
I can see a blank page with this working echo 'Test Function', but does this mean I have to load every methods and views for the entire page if I want to display the entire webpage with all the elements? I think that I mistake something very serious here but I don't know what.
The example with the "Create news" tutorial in ellislab.com didnt help me. They show something similar I think with /create/ section in the URL and create() methods.
If I have many links with functionallities do I have to add new routing rules for all of them? I really tried to search in Google and everywhere but I didnt find anything related.
Sorry for this lame question.
You need to use Ajax call and on callback you have to increase or decrease the count. For creating a link , once page is loading render the data and provided the default link like
for + http://<site.com>/<controller>/like?totalLike=<36>
for - http://<site.com>/<controller>/unlike?totalunLike=<3>
Once user will click + link then by using Ajax, call the controller method link/unlike and increase or decrease the count and repopulate the link again with fresh counter.
Hope it will resolve your problem.
I have searched on this matter but havent been able to find an answer that work for me.
On my website I have one page with a menu and a div. When clicking on a menu link the information in the div changes (ajax). But then Cufón stop working in that div. I have read about Cufon.refresh but can't get it to work. Which code should I use and where do I put it?
My links look like this:test
I have read about Cufon.refresh at this page but I don't understand how to use it: https://github.com/sorccu/cufon/wiki/API
Cufon.refresh also does not work for me. A workaround is to use Cufon.replace again.
Based on the JS you are using, you can edit the trigger function to work like the below and see if that works. Essentially, it will refresh the Cufon call after you have updated the content on that element.
if (xmlhttp.readyState == 4) if (xmlhttp.status == 200)
{
document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
Cufon.refresh('#ajaxdestination');
}
I'm trying to keep my modal from closing when validation, done with an actionLister, fails.
I've seen numerous discussions on this issue with several purposed solutions but have had no luck with any of them. Anyone have any working solutions?
I'm using RichFaces 3.3.3.Final.
Have you tried this?
oncomplete="if (#{!validation.failed}) Richfaces.hideModalPanel('accounts_popup1');"
I love StackOverflow because I always find the solution immediately after posting a question.
The first solution in http://community.jboss.org/wiki/ModalPanelValidation works for me.
Paraphrased, put an id on your h:messages element and then do this Javascript check to see if you can close the modal.
function modalClose() {
if (!document.getElementById('fullresolvedidofmessagepanel')) {
Richfaces.hideModalPanel('modalpanelid');
}
}
The strings here are stand ins.
Yup - in the oncomplete(..) function of your button verify whether the facesContext contains any errors. If not - hide(), otherwise do nothing.
Am having some behaviour I cannot understand why in my jqgrid.My Add , Edit and Delete buttons seem to have interchanged there respective urls.
$("#list").navGrid("#pager",
{add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Delete'},
{top:50,left:"100",width:500,url:'<?php echo $this->baseUrl() ?>/artist/add',closeAfterAdd:'true'},
{top:50,left:"100",width:500,url:'<?php echo $this->baseUrl() ?>/artist/edit',closeAfterEdit:'true'},
{url:'<?php echo $this->baseUrl() ?>/artist/delete',closeAfterAdd:'true'}
);
When I try Add from the interface firebug console shows that am actually Editing.
When I try Edit from the interface firebug console shows that am actually Adding.
Delete seems to be fine.
Are there defaults or something that am missing in my jqgrid?
According to the jqGrid Documentation, the order of parameters is:
jQuery("#grid_id").jqGrid('navGrid','#gridpager',{parameters},
prmEdit, prmAdd, prmDel, prmSearch, prmView);
The problem with your code is that you are passing the Add and Edit parameters in the wrong order. You need to re-order them:
$("#list").navGrid("#pager",
{add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Delete'},
{top:50,left:"100",width:500,url:'baseUrl() ?>/artist/edit',closeAfterEdit:'true'},
{top:50,left:"100",width:500,url:'baseUrl() ?>/artist/add',closeAfterAdd:'true'},
{url:'baseUrl() ?>/artist/delete',closeAfterAdd:'true'}
);
for example:
user submit a comment , I add the comment in the page by javascript , then do the ajax. if ajax post failed ,tell user that something wrong happend.
in this way , it can improve user experience . and the probability of ajax failed is not low. but I didn't seen which site is using this technology , so is this method possible?
Actually, I'd say that stackoverflow uses this technique :
Make sure you are using firebug, and have the console displayed on the bottom of your browser scree
Click on (for instance) the arrow to upvote
you will see the arrow immediatly becomes orange, to indicate you have upvoted)
but looking at firebug's console, you will see the Ajax request starts only after the arrow has changed color -- or, at least, it is not finised yet when the arrow has changed color.
Considering the probably of the Ajax request failing is pretty low, changing the arrow immediatly indicates the user his vote has been taken into account... Even if it's not true before a couple milliseconds ;-)
You can add the comment via Javascript but you've also pointed out exactly why you shouldn't: what if it fails? Do you then remove the content?
In my opinion, adding it to the page implies to the user that it has worked. I would leave the comment in a form field until the AJAX submit succeeds. If that fails you can tell the user and they can try to submit again or whatever.
Of course, there is no functional reason why you couldn't do this.
Yes there is nothing stopping you doing this.
You add the comment in an element you create in javascript post the data and get the response code back form the ajax post.