Please or Register to create posts and topics.

Emoticons & shortcodes parsed inside the editor when opening a post!

PreviousPage 4 of 6Next

Arf… 🙁

We have 2 similar but separate problems.
“Keep Emoticons as Text” does not stop the short code parsing, so there are 2 different parsing to stop.

Try with Better Font Awesome short codes like this one you will see the result after edit 🙁

[icon name="coffee"]

 

This means: This code and event-listeners are available globally all the time for the entire document and not related in any way to the editor. So the only way is to disable it globally – or more specific: if you are inside of the editor-view.

I’m not sure. Admin editors are able to avoid this behaviour, so either it’s not global, or there’s a way to stop it for editing.

@ftp Its avoided because this kind of event-listening-script is not included inside the HTML-document for the administration-area. The logic is only included in the front-end.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Basically you can use the following workaround which should work fine when you edit posts:

function disable_smilies() {
  global $asgarosforum;
  
  if ($asgarosforum->current_view === 'editpost') {
    add_filter('option_use_smilies', '__return_false');
  }
}
add_action('template_redirect', 'disable_smilies');

However, this disables emoticons for all visible parts of your page – not the editor only – when you are inside the editor-view.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on June 20, 2019, 10:19 pm

NThere is some JavaScript-code included which basically triggers the conversion in this case automatically:

BTW, I’m not surprised there’s some JS involved because it would explain why I can see the smiley url extremely quickly when I edit a post. If it was not via JS we would not see anything on the client side.

Quote from Asgaros on June 20, 2019, 10:34 pm

Basically you can use the following workaround which should work fine when you edit posts:

function disable_smilies() {
  global $asgarosforum;
  
  if ($asgarosforum->current_view === 'editpost') {
    add_filter('option_use_smilies', '__return_false');
  }
}
add_action('template_redirect', 'disable_smilies');
function disable_smilies() {
  global $asgarosforum;
  
  if ($asgarosforum->current_view === 'editpost') {
    add_filter('option_use_smilies', '__return_false');
  }
}
add_action('template_redirect', 'disable_smilies');
(…)

However, this disables emoticons for all visible parts of your page when you are inside the editor-view.

Yup it seems to work fine for smilies.
What could be the cases where it would create any problem?

Now there still the same pb with the short codes.

What could be the cases where it would create any problem?

Look at the following picture. The smiley above the forum is gone because the emoticon-function is disabled globally for the entire editor-view page.

Uploaded files:
  • explain.PNG
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Ok, I see your point. But it’s very limited/specific. Can be acceptable (at least for me).
But you’re right, it’s not perfect.

All this behaviour limited to the front-end (smilies & short codes) should be raised at WP level.
It’s a real problem. Everything becomes hardcoded after an edit and a save.

Yes, basically its a bad design of the functionality by the WordPress-developers and they should ensure that smiley-processing is not applied inside of the editor.

BTW: The fontawesome-icons-shortcodes are working fine: They get parsed inside of posts but the shortcode is visible normally when editing the post. This only holds, as long as the parsed shortcode is not inside of a quote which you want to edit, because in this case the parsed version is used. I dont see any possible workaround for this.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on June 20, 2019, 10:51 pm

BTW: The fontawesome-icons-shortcodes are working fine: They get parsed inside of posts but the shortcode is visible normally when editing the post.

???

Which shortcodes are you using?
I don’t have this behaviour at all. And not only for “Better Font Awesome” shortcodes, but also “User Shortcodes” & “User Shortcodes Plus” shortcodes. All are parsed in the editor, we can’t see the shortcodes any more (and I don’t use quotes).

Try installing “Better Font Awesome” & “User Shortcodes” and try with those shortcodes for example…

[icon name="coffee"]

[currentuser_username]
PreviousPage 4 of 6Next