huge problem with elrte('val')

Added by mike mathews 10 months ago

alright so i narrowed this bug down to more of a certain area.

if i use var content = $('selector').elrte('val'); it seems that if you have an & within the editor whether it be in html character or a normal & that the editor truncated all content after that point.

elrte v 1.3
with elfinder installed.


Replies (6)

RE: huge problem with elrte('val') - Added by Troex Nevelin 10 months ago

Please report in which browser did you get this behavior?

RE: huge problem with elrte('val') - Added by mike mathews 9 months ago

Sry i never got a notification that someone replied.

At the time i was using firefox 4

the only way that i was able to get it to work was this

$('#header_content').elrte('updateSource');
var custom_header = $('#header_content').val();

RE: huge problem with elrte('val') - Added by Troex Nevelin 8 months ago

That seams to be very strange. Can you please this on demo also using firebug?

RE: huge problem with elrte('val') - Added by mike mathews 7 months ago

sry again there was no notification

ok so i looked into it more and idk if this is a jquery problem or the editor problem but it seems fine when i call it from the console but when it gets pushed to my php via ajax it truncated anything after a & symbol. even if it does use & cause there is still and &. so one thing that i have found that works even better than the code used above is

encodeURIComponent($('#pagecontent').elrte('val'));

Might i suggest adding encondeURIComponent to the elrte('val') function within the editor js files. This would be helpful to not just me but others also.

RE: huge problem with elrte('val') - Added by John Doe 5 months ago

The one and only problem is: Internet Explorer (< 9) doesn't know the .trim() method: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/trim

This little snippet will fix it (in my case):

if(typeof String.prototype.trim !== 'function') {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, ''); 
  }
}

http://stackoverflow.com/questions/2308134/trim-in-javascript-not-working-in-ie

(1-6/6)