plandem / lwrte

Export from Google Code. Lightweight Rich Text Editor (RTE / WYSIWYG) for jQuery
https://code.google.com/p/lwrte/
0 stars 0 forks source link

Linking sometimes doesn't work. #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Mostly, linking works normally. But sometimes linking acts very strange:

1.You mark text.
2.Press linking button.
3.Enter the address(also you can enter title - doesn't matter).
4.Press OK.
5.Text doesn't turn into a link or text duplicates, but neither the first
one, neither the second one turns into a link. Or if you mark the whole
line, text just vanishes.
6.Very strange. 

Original issue reported on code.google.com by vaidas....@gmail.com on 22 Jan 2009 at 2:04

GoogleCodeExporter commented 9 years ago
What browser?

Original comment by plandem on 24 Jan 2009 at 5:35

GoogleCodeExporter commented 9 years ago
afaik firefox 3

Original comment by energijapanikoj@gmail.com on 3 Feb 2009 at 12:44

GoogleCodeExporter commented 9 years ago
yes ff3

Original comment by vaidas....@gmail.com on 3 Feb 2009 at 12:57

GoogleCodeExporter commented 9 years ago
This bug appears when you select _all_ text in an editor

Original comment by McSe...@gmail.com on 15 Feb 2009 at 9:27

GoogleCodeExporter commented 9 years ago
Still can't reproduce :( Can you provide test-files?

Original comment by plandem on 9 Mar 2009 at 2:56

GoogleCodeExporter commented 9 years ago
What files do you mean?

BTW, linking works if you have only one line of text. If you have two 
paragraphs of 
text, select all of them, and try to create URL - it fails. Probably because of 
<P> 
tag between paragraphs.

Original comment by McSe...@gmail.com on 10 Mar 2009 at 7:08

GoogleCodeExporter commented 9 years ago
files with html at text-area. Somethimes it's problem of bad formating.

Original comment by plandem on 22 Mar 2009 at 11:24

GoogleCodeExporter commented 9 years ago
Yes,I also get this problem,I select one line of text,then click linking button 
to
enter the url,then I click save button,the line of text just vanished...all same
problem in ie,ff, and safari.
Bty,I create the editor on the fly with jquery when I click something on the 
page.

Original comment by missingw...@gmail.com on 4 Apr 2009 at 12:00

GoogleCodeExporter commented 9 years ago
Same here .. It worked once for me .. But then after that it never worked

Original comment by akashmoh...@gmail.com on 9 Apr 2009 at 9:51

GoogleCodeExporter commented 9 years ago
Hi all, please check http://code.google.com/p/lwrte/issues/detail?id=7

I posted the fix for this there.

Original comment by Grace.Ba...@gmail.com on 16 Jun 2009 at 3:58

GoogleCodeExporter commented 9 years ago
I've had this same problem and I discovered that the error occurs (in Firefox 
3.5 at
least) when there are no tags in the source code of the texteditor.  Simplest 
fix is
to always include a tag (I put in a <br /> tag if there are no tags in the 
content
being loaded or if there is no content at all).  This DOES NOT, however, seem 
to work
in Safari (4.03).

Grace.BasilioR, I tried your Safari fix and it does indeed work, but it removes 
any
formatting in the selected text.  Example: test1 test2 test3.  If you created
a link on that text the bold tags would disappear.  That being said, I can't 
come up
with a better solution so I'm going with yours for now.  I think this error is 
the
same as the other, without any html tags it doesn't know how to create a link 
around
the text for whatever reason.

Also, I think the fact that you commented out
self.selection_replace_with(tmp.html()); means it won't work in any other 
browser. 
And you might want to check to see if you have title / target values before 
putting
them in the link tag.  Here's my browser specific code when the #ok button is 
clicked:

if($.browser.safari) {
  var html = '<a href="' + url + '"';
  if(target.length > 0) html = html + ' target="'+target+'"';
  if(title.length > 0) html = html + ' title="'+title+'"';
  html = html + ' />' + self.get_selected_text() + '</a>';
  self.selection_replace_with(html);
}

I'm sure there's a more elegant way to do that, but I don't know it so...

Original comment by CharlieK...@gmail.com on 22 Oct 2009 at 12:48

GoogleCodeExporter commented 9 years ago
Just another note.  If you alert(self.get_selected_html()); right after the
self.editor_cmd('createLink', rte_tag); you'll want something like this 
(assuming
'test' was the selected text):

    <a href="-rte-tmp-tag-">test</a>

If you do the alert in Safari (4.03) you get simply:

    test

I think the problem is in the get_selected_html() function.  Again, don't know 
how to
fix it, just thought I'd add that.

One last thing, as I said the links work in Safari if there are tags amidst them
(test test test) but it actually is creating 3 links, one on each word.  Not
sure if this is what is supposed to happen.

Original comment by CharlieK...@gmail.com on 22 Oct 2009 at 1:00

GoogleCodeExporter commented 9 years ago
I'm getting this error.  It's because I'm using the text editor in an xml html 
5 document.  I get an error because one of the input tags isn't closed.  (Valid 
sgml html, but not valid xml html.)

Per the HTML 5 spec, HTML 5 can either be SGML or xml.  Xml isn't as popular, 
so bugs like this are understandable.  The difference is usually a matter of 
making sure that all tags are closed.

Original comment by andrew.r...@gmail.com on 13 Sep 2010 at 11:09

GoogleCodeExporter commented 9 years ago
Browsers 
FF 3.6.15
Safari 5.0.3

Refer to attachment:
If all text =) "aaaa" is selected? then it is impossible to make it link.

Original comment by 174...@gmail.com on 9 Mar 2011 at 3:25

Attachments:

GoogleCodeExporter commented 9 years ago
hi, i have question regarding on the link.. 

Browser : IE9

doesn't add any link? do anyone knows how to fix this issue??

it already work on every browser but on IE 9 it doesn't

Original comment by rommel...@gmail.com on 26 Jan 2012 at 7:41

GoogleCodeExporter commented 9 years ago
I had problems with the linking function, so I made the following 
modifications. Works for me  (YMMV):

// we wanna well-formed linkage (<p>,<h1> and other block types can't be inside 
of link due to WC3)

            //var linkText = self.get_selected_text();          
            self.editor_cmd('createLink', url);

            //var tmp = $('<span></span>').append(self.get_selected_html());

            if(target.length > 0)
                $(self.iframe).contents().find('a[href="' + url +'"]').attr('target', target);

            if(title.length > 0)
                $(self.iframe).contents().find('a[href="' + url +'"]').attr('title', title);

            //$('a[href*="' + rte_tag + '"]', tmp).attr('href', url);

            //self.selection_replace_with(tmp.html());

            return false;

Original comment by judsonmitchell on 10 Feb 2012 at 1:28