The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
[Solved] Allow and tags | Do not remove classes on edit
Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
How-to and Troubleshooting
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
Show original
Translating...
Aug 14, 2021 2:40 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
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.
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
Show original
Translating...
Aug 16, 2021 5:26 pm
(@jacob)
Estimable Member
Joined: 11 years ago
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.
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
Show original
Translating...
Aug 16, 2021 7:15 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
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.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8297
Sep 02, 2021 5:31 pm
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
Show original
Translating...
@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.
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
Show original
Translating...
Sep 04, 2021 3:03 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
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.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8297
Sep 06, 2021 11:42 am
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
Show original
Translating...
@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.
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
Show original
Translating...
Sep 06, 2021 12:44 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
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:
What appears:
I also get "Uncaught ReferenceError: Quill is not defined". This might be the issue.
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
Show original
Translating...
Sep 06, 2021 12:49 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
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.
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
Show original
Translating...
Sep 06, 2021 1:13 pm
(@tetrakern)
Eminent Member
Joined: 6 years ago
For those who might encounter a similar problem with the plugin: add "wp-content/plugins/wpdiscuz" to the "Exclude scripts from Autoptimize" list.
(@asti)
Joined: 8 years ago
Illustrious Member
Posts: 8297
Sep 06, 2021 1:27 pm
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
Show original
Translating...
Thank you for sharing the solution.
Super Globals
Options and Features