SCEditor icon indicating copy to clipboard operation
SCEditor copied to clipboard

custom BBCode. Issue with quotes

Open Shura0 opened this issue 7 years ago • 0 comments

Seems there is an issue with quote handling.

My test code is:

sceditor.formats.bbcode.set(
		'img',
		{
			tags: {
				img: null
			},
			format: function (element, content) {
				if($(element).attr('alt'))
					content='[img descr="'+$(element).attr('alt')+'"]'+$(element).attr('src')+'[/img]';
				return content;
			},
			html: function(token, attrs, content) {
				if(attrs.descr)
					content = '<img alt="' + attrs.descr + '" src="'+ content+ '" />';
				else
					content = '<img src="'+ content+ '" />';
				return content;
			}
		}
	);

Now I type BBCode: [img descr="two words"]url[/img] It translates it to: <img alt="two words" src="url">

It's OK, but then I switch view back to source mode and see: [img descr=two words]url[/img] It lost quotes. And I could not find a way to return quotes back

Best regards, Alexander

Shura0 avatar Sep 15 '18 19:09 Shura0