Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromBBCode doesn't support emoticons #719

Open
adiantek opened this issue Nov 6, 2018 · 5 comments
Open

fromBBCode doesn't support emoticons #719

adiantek opened this issue Nov 6, 2018 · 5 comments

Comments

@adiantek
Copy link

adiantek commented Nov 6, 2018

Calling sceditor.instance(textarea).fromBBCode("as :) df") returns <div>as :) df</div> instead of HTML code with emoticon.

@brunoais
Copy link
Collaborator

brunoais commented Nov 6, 2018

By design. See: https://www.sceditor.com/documentation/formats/bbcode/
If you think the design is wrong, ask for a change of the design but I think, due to the inherit current architecture, you cannot do BBCode + emote using such function. It may be possible to make a new one for that, instead.

@Doidel
Copy link

Doidel commented Nov 8, 2018

What is the suggested way then to load bbcode e.g. from a database and display it? Would it be to load the bbcode into a textarea and create a readonly editor instance? Or is there a seperate "parse emoticons" function?

@Doidel
Copy link

Doidel commented Nov 8, 2018

Well, this is my hack for now:

Copy/paste emoticons from https://github.com/samclarke/SCEditor/blob/master/src/lib/defaultOptions.js:

var emoticons = {
':)': 'emoticons/smile.png',
'8-)': 'emoticons/cool.png',
':'(': 'emoticons/cwy.png',
...
};

function convertEmoticons(text) { $.each(emoticons, function (key, src) { text = text.replace(key, '<img src="/lib/sceditor/' + src + '" title="' + key + '" alt="' + key + '" />') }); return text; }

convertEmoticons(yourSceditorInstance.fromBBCode(bbtext))

@brunoais
Copy link
Collaborator

brunoais commented Nov 8, 2018

I can't think of any alternatives.....

@adiantek
Copy link
Author

I made the pull request to this #721
It's not a perfect solution, but better than nothing.

@live627 live627 added this to the v3.0.0 milestone Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants