The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Allow and tags | Do...
 
Notifications
Clear all

[Solved] Allow and tags | Do not remove classes on edit

10 Posts
3 Users
0 Reactions
2,793 Views
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#2718]

I have a custom made suggestion system on my site that shows you a colored diff to the original text. I just append it to the comment form per JavaScript. This works, albeit the the auto formatting causes some inconsistencies.

Anyway, there are two major problems. The first one, as in the title, is that the <ins> and <del> tags are filtered out. Which baffles me since they are content tags that do no harm. I need to mark the inserted and deleted texts. Right now, I misappropriate the sup/sub tags for that and add a class to style them as I like.

Which leads me to the second problem. When you edit the comment, the CSS classes get stripped and the whole formatting is gone. I either would like for that not to happen or allow more content tags I can safely use.

Screen Shot 2021 08 14 at 12.30.03
Screen Shot 2021 08 14 at 12.30.24

 
Posted : 14/08/2021 2:40 pm
(@jacob)
Posts: 132
Estimable Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi @tetrakern

Read this doc please - https://wpdiscuz.com/docs/codex/filters/wpdiscuz_allowedtags/

You can add custom tags with its attributes using the hook provided in this doc.


In case you want to say thank you! 🙂

We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 16/08/2021 5:26 pm
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Unfortunately, this doesn't work. Provided I did it right.

add_filter( "wpdiscuz_allowedtags", function ( $allowedtags ) {
  $allowedtags["ins"] = true;
  $allowedtags["del"] = true;
  return $allowedtags;
});

The visual editor will reject or rather vandalize the appended HTML, remove all tags including their content and only leave a plain block. I didn't test it for the non-visual editor but that's not what I want to use. I think the Quill Editor does not care for the allowed tags by this filter.


 
Posted : 16/08/2021 7:15 pm
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@tetrakern,

Please use this code:

add_filter( "wpdiscuz_allowedtags", function ( $allowedtags ) {
  $allowedtags["ins"] = true;
  $allowedtags["del"] = true;
  return $allowedtags;
});
add_action("wpdiscuz_front_scripts", function ($options) {
    if ($options->form["richEditor"] === "both" || (!wp_is_mobile() && $options->form["richEditor"] === "desktop")) {
        if ($options->general["loadComboVersion"]) {
            wp_add_inline_script("wpdiscuz-combo-js", quillAddNewTagSupport(), "after");
        } else {
            wp_add_inline_script("quill", quillAddNewTagSupport(), "after");
        }
    }
});
function quillAddNewTagSupport() {
    ob_start();
    ?>
    let Inline = Quill.import('blots/inline');
    class wpdQuillDel extends Inline {}
    wpdQuillDel.blotName = 'del';
    wpdQuillDel.tagName = 'DEL';
    Quill.register(wpdQuillDel, true);
    class wpdQuillIns extends Inline {}
    wpdQuillIns.blotName = 'ins';
    wpdQuillIns.tagName = 'INS';
    Quill.register(wpdQuillIns, true);
    <?php
    return ob_get_clean();
}

It should work fine. 

Please don't forget to delete all kind of caches before checking. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 02/09/2021 5:31 pm
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Thank you for the effort; seems to be more involved than one might expect. Unfortunately, it still doesn't work. The ql-editor still sanitizes the tags away -- I could not test if they are saved and loaded, obviously.

I did clear all caches I could think of, deactivated any plugins like WP Super Cache and Autoptimize to be sure, turned wpDiscuz off and on, cleared the browser data, hard reloaded, used a different browser, used a different computer, used a different WordPress installation on a live test server.

I'm to 99% sure it was not a caching issue.


 
Posted : 04/09/2021 3:03 pm
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@tetrakern,

Have you put the code in the functions.php file? We've checked the code several times, it works fine in our case. 

Please note the code works only for <del> u <ins> tags. Probably you've not tested for those tags. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 06/09/2021 11:42 am
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

It is inside the functions.php and I did test it for <del> and <ins>. After all, that's how the diff-match-patch script works.

What the script is trying to append:

Screen Shot 2021 09 06 at 10.42.29

What appears:

Screen Shot 2021 09 06 at 10.43.25

I also get "Uncaught ReferenceError: Quill is not defined". This might be the issue.


 
Posted : 06/09/2021 12:44 pm
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Yep, I think I found the error. It's Autoptimize that aggregates all scripts and apparently causes the script to be executed before it is ready. Or whatever. I turned it off before and it changed nothing, but oh well. I'll find a solution for that myself. Thanks for the help.


 
Posted : 06/09/2021 12:49 pm
Tetrakern
(@tetrakern)
Posts: 18
Eminent Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

For those who might encounter a similar problem with the plugin: add "wp-content/plugins/wpdiscuz" to the "Exclude scripts from Autoptimize" list.


 
Posted : 06/09/2021 1:13 pm
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Thank you for sharing the solution. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 06/09/2021 1:27 pm