webwizo / laravel-shortcodes

Wordpress like shortcodes for Laravel 4.2, 5.x, 6.x, 7.x, 8.x, 9.x and 10.x
MIT License
213 stars 49 forks source link

Strip html within shortcode #66

Open basdog22 opened 3 years ago

basdog22 commented 3 years ago

Hello, I am doing this:

[tabs]
[tab]something[/tab]
[tab]something[/tab]
[tab]something[/tab]
[/tabs]

but this generates this when the input was done through a WYSIWYG:

<p>[tabs]</p>
<p>[tab]something[/tab]</p>
<p>[tab]something[/tab]</p>
<p>[tab]something[/tab]</p>
<p>[/tabs]</p>

And the shortcode will finally generate something like this:

<p><ul id="tabs16084068915098" class="nav nav-tabs "></p>
<p><li class="nav-item ">
                    <a class="nav-link " id="16084068912629" data-toggle="tab" role="tab" href="#tab16084068912629">
                    Tab1
                    </a>
                </li>
                <div id="tab16084068912629" class="tab ">Tab1 content</div></p>
<p></ul></p>

producing extra

elements and making a non HTML valid list

How do we handle this situation?

webwizo commented 3 years ago

WYSIWYG always generates patagraph tags when add new lines, if you do SHIFT+ENTER for new line, it might not use Paragraph tag.

Also, if we follow WordPress for short tas, it never use lines for nested tags, always use short tags in one line.

[tabs][tab]something[/tab] [tab]something[/tab] [tab]something[/tab][/tabs]

Can you please verify?

Thanks,

basdog22 commented 3 years ago

It might not generate paragraphs but it will generate br. It is still not valid html. Not to mention that all users use enter and not shift enter. I tried some str replace but no luck.

Yeah it's ok if we try to use it in one line but i want to do something like this:

[tabs][tab title="This is the tab title"]This it the tab content which might include html[/tab][tab title="This is the tab title"]This it the tab content which might include html[/tab][tab title="This is the tab title"]This it the tab content which might include html[/tab][tab title="This is the tab title"]This it the tab content which might include html[/tab][/tabs]

So, you see it gets very big with just 4 tabs.

On Sun, Dec 20, 2020, 10:31 Asif Iqbal notifications@github.com wrote:

WYSIWYG always generates patagraph tags when add new lines, if you do SHIFT+ENTER for new line, it might not use Paragraph tag.

Can you please verify?

Thanks,

Get Outlook for Androidhttps://aka.ms/ghei36


From: Vasilis Kerasiotis notifications@github.com Sent: Sunday, December 20, 2020 12:44:15 AM To: webwizo/laravel-shortcodes laravel-shortcodes@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [webwizo/laravel-shortcodes] Strip html within shortcode (#66)

Hello, I am doing this:

[tabs] [tab]something[/tab] [tab]something[/tab] [tab]something[/tab] [/tabs]

but this generates this when the input was done through a WYSIWYG:

[tabs]

[tab]something[/tab]

[tab]something[/tab]

[tab]something[/tab]

[/tabs]

And the shortcode will finally generate something like this:

producing extra

elements and making a non HTML valid list

How do we handle this situation?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/webwizo/laravel-shortcodes/issues/66>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AAMFEYKFSP2BPQGGAB2ARRTSVT7A7ANCNFSM4VCQOVFQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/webwizo/laravel-shortcodes/issues/66#issuecomment-748578735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAJT3FYTTRM5HW3CS2MJ3SVWY43ANCNFSM4VCQOVFQ .