Summernote pastHTML add unwanted extra lines. - summernote

I am loading user input back into summernote for editing, both top and bottom get extra lines added on. Is there a way to fix it?
$('#summernote').summernote('editor.pasteHTML', "<p>hello world</p>");
comes out
"
hello world
"
instead of "hello world"

I ran into the same problem. If you're trying to initialize the editor with html, try doing $('#summernote').summernote('code', "<p>hello world</p>"); instead. The $('#summernote').summernote('code', markupString); is for setting the html directly.

Related

VS2015 html editor adding blank space after and before tag name when i use wrap and duplicate line

When i use Wrap with or Duplication line, Html editor format's like this.
How to fix it?

Can't get text out of quote area in summernote editor

I'm having trouble getting out of quote mode when in the editor.
I'm trying to put the "Can't get out of quote mode below it" out of the quote section and choosing normal in the format dropdown doesn't work.
Looks like this is a known bug:
https://github.com/summernote/summernote/issues/42

How can I stop Joomla from stripping HTML code from the Contact info?

I've only spent maybe 30 mins searching online for this, and couldn't come up with a decent answer.
But anyway, in Joomla there are normal input fields for the Contacts component, but there's a textarea for the Address.
This would make me assume you can enter multiple lines of address in there, and it would be displayed as separate lines... but it doesn't. Even if I enter line breaks, the output is rendered on one line.
So I try to enter <br> to separate, and upon saving, Joomla strips these tags out.
In the template, the output is being written simply by echoing $this->contact->address
Is there anyway, to explode this input and replace linebreaks with <br> marks?
UPDATE:
For now as a temporary measure I'm able to add HTML code into the database values, which saves and outputs on the front end.
On a separate note, I'm now looking to remove the Subject line from the contact form, without hacking the code. and by using overrides as much as possible. Can anyone help?
Have you tried the Sourcerer extension?
Your question is pretty old, but did you get a solution to this Lee?
To create line-breaks in Joomla, titles, text areas etc. Easiest way to do this is to use the ReReplace extension from NoNumber: http://extensions.joomla.org/extensions/edition/replace/4336
I personally use this to add line break in e.x. menu-item titles, where < br / > aren't allowed and get stripped.
With ReReplacer, you can create a custom tag e.x. {br} and then have ReReplacer replace {br} with < br / >.
So everytime you need to add a line break anywhere in Joomla, where html codes usually get stripped, you can just add {br} to have it add a new line.
Very old question but I've fallen into the same issue and tried to find a more user friendly solution.
You can enter multiple lines in the address textarea, and they are correctly outputted to the HTML page source. But as you know, newlines in HTML are not rendered, they have to be transformed to <br>.
For this PHP has a nice function, nl2br, that inserts a <br> each time it encounters a newline in a string.
So in html\com_contact\contact\default_address.php of your template, replace:
echo $this->contact->address;
with
echo nl2br($this->contact->address);
This would nicely do the job, and allow the user to naturally insert any newline in the contact address textarea that will be correctly rendered with the appropriate <br>; I believe this is quite more user friendly solution than your previous one of the user having to insert -br- tags in the address field.

how to disable tag validation in ckeditor?

CKeditor apparently automatically creates matching end tags when you enter a start tag. Is there a way to turn this behavior off?
I have a situation where I am creating two blocks of text in an admin program using CKeditor, then I'm using these to paint a page with the first block, some static content, and then the second block. Now I've got a case where I want to wrap the static content in a table. I was thinking, No problem, I'll just put the <table> tag in the first block and the </table> tag in the second block, and the static content will be inside the table. But no, CKeditor insists on closing the table tag in the first block.
In general, I can go to source mode and enter HTML directly, but CKeditor then decides to reformat my tagging. This seems to rather defeat the purpose of having a source mode. (I hate it when I tell the computer what I want and it tells me, No, you're wrong, I know better than you what you want!)
CKEditor produces valid HTML. Valid HTML has to include both - start and end tags. There's no way to change this behaviour without hacking editor. Note that even if you'll force editor to produce content without one of these tags it will then try to fix this and won't do this as you expect. E.g. load:
<p>foo</p></td></tr></table>
And you'll completely loose this table so only regexp based fix on data loading could help. In the opposite case:
<table><tr><td><p>foo</p>
You'll end up with paragraph wrapped with table, so it's better. But what if someone would remove this table from editor contents?
Therefore you should do this integration outside editor - prepend table to contents of one editor and append to contents of second one. You simply cannot force editor to work on partial HTML.

How to put space in tab title in dojo?

i am using dojo toolkit with php codeigniter 2.1.0 and i want to put space in tab name wherever necessary.
Anyone has any solution??
My code is :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('AddParty');">Manage <u>P</u>arty</div
If i will directly write as :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('Add Party');">Manage <u>P</u>arty</div
then it throws error
I want my tab to be displayed with name as "Add Party"
can anyone suggest me solution for this???
Thanx in advance
What error does it throw?
how does the code in addPartyTab look like?
The following should work in any case:
onclick="addPartyTab('Add Party');">
However, this may not be an ideal solution. You need to look into your addPartyTab function to first, ensure the text with embedded space is coming through fine (and i dont see any reason why it shouldnt) and then examine the code in that function to ensure it is being processed correctly - i suspect somewhere in there you will find why it is breaking.
In general, you can set title on a dijit tab (which is typically a contentpane) directly even if the title contains spaces without any issue. Following is a typical way of doing it:
dijit.byId("myTabContentPane").set("title", "Add Party - Hurray!");
where myTabContentPane is the id of the contentpane that makes up that tab

Resources